@superbright/indexeddb-orm 0.1.9 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/_virtual/_commonjsHelpers.cjs +2 -0
  2. package/dist/_virtual/_commonjsHelpers.cjs.map +1 -0
  3. package/dist/_virtual/_commonjsHelpers.mjs +9 -0
  4. package/dist/_virtual/_commonjsHelpers.mjs.map +1 -0
  5. package/dist/_virtual/dexie.min.cjs +2 -0
  6. package/dist/_virtual/dexie.min.cjs.map +1 -0
  7. package/dist/_virtual/dexie.min.mjs +5 -0
  8. package/dist/_virtual/dexie.min.mjs.map +1 -0
  9. package/dist/adapters/dexie.cjs +2 -0
  10. package/dist/adapters/dexie.cjs.map +1 -0
  11. package/dist/adapters/dexie.mjs +14 -0
  12. package/dist/adapters/dexie.mjs.map +1 -0
  13. package/dist/adapters/structured-store.cjs +2 -0
  14. package/dist/adapters/structured-store.cjs.map +1 -0
  15. package/dist/adapters/structured-store.mjs +50 -0
  16. package/dist/adapters/structured-store.mjs.map +1 -0
  17. package/dist/adapters/zustand-store.cjs +2 -0
  18. package/dist/adapters/zustand-store.cjs.map +1 -0
  19. package/dist/adapters/zustand-store.mjs +169 -0
  20. package/dist/adapters/zustand-store.mjs.map +1 -0
  21. package/dist/api/favorites.cjs +2 -0
  22. package/dist/api/favorites.cjs.map +1 -0
  23. package/dist/api/favorites.mjs +34 -0
  24. package/dist/api/favorites.mjs.map +1 -0
  25. package/dist/api/properties.cjs +2 -0
  26. package/dist/api/properties.cjs.map +1 -0
  27. package/dist/api/properties.mjs +197 -0
  28. package/dist/api/properties.mjs.map +1 -0
  29. package/dist/api/users.cjs +2 -0
  30. package/dist/api/users.cjs.map +1 -0
  31. package/dist/api/users.mjs +54 -0
  32. package/dist/api/users.mjs.map +1 -0
  33. package/dist/db.cjs +2 -0
  34. package/dist/db.cjs.map +1 -0
  35. package/dist/db.mjs +116 -0
  36. package/dist/db.mjs.map +1 -0
  37. package/dist/debug.cjs +2 -0
  38. package/dist/debug.cjs.map +1 -0
  39. package/dist/debug.mjs +18 -0
  40. package/dist/debug.mjs.map +1 -0
  41. package/dist/errors.cjs +2 -0
  42. package/dist/errors.cjs.map +1 -0
  43. package/dist/errors.mjs +15 -0
  44. package/dist/errors.mjs.map +1 -0
  45. package/dist/features/analytics/MixpanelProvider.cjs +2 -0
  46. package/dist/features/analytics/MixpanelProvider.cjs.map +1 -0
  47. package/dist/features/analytics/MixpanelProvider.mjs +40 -0
  48. package/dist/features/analytics/MixpanelProvider.mjs.map +1 -0
  49. package/dist/features/analytics/analytics.cjs +2 -0
  50. package/dist/features/analytics/analytics.cjs.map +1 -0
  51. package/dist/features/analytics/analytics.d.ts +520 -397
  52. package/dist/features/analytics/analytics.mjs +230 -0
  53. package/dist/features/analytics/analytics.mjs.map +1 -0
  54. package/dist/features/analytics/generateUserUUID.cjs +2 -0
  55. package/dist/features/analytics/generateUserUUID.cjs.map +1 -0
  56. package/dist/features/analytics/generateUserUUID.mjs +6 -0
  57. package/dist/features/analytics/generateUserUUID.mjs.map +1 -0
  58. package/dist/features/units/transformers.cjs +2 -0
  59. package/dist/features/units/transformers.cjs.map +1 -0
  60. package/dist/features/units/transformers.mjs +69 -0
  61. package/dist/features/units/transformers.mjs.map +1 -0
  62. package/dist/index.cjs +1 -65
  63. package/dist/index.cjs.map +1 -1
  64. package/dist/index.d.ts +1 -0
  65. package/dist/index.mjs +84 -14861
  66. package/dist/index.mjs.map +1 -1
  67. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.cjs +4 -0
  68. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.cjs.map +1 -0
  69. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.mjs +3048 -0
  70. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/dist/dexie.min.mjs.map +1 -0
  71. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.cjs +2 -0
  72. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.cjs.map +1 -0
  73. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.mjs +33 -0
  74. package/dist/node_modules/.pnpm/dexie@4.2.0/node_modules/dexie/import-wrapper-prod.mjs.map +1 -0
  75. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.cjs +2 -0
  76. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.cjs.map +1 -0
  77. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.mjs +88 -0
  78. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/ZodError.mjs.map +1 -0
  79. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.cjs +2 -0
  80. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.cjs.map +1 -0
  81. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.mjs +10 -0
  82. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.mjs.map +1 -0
  83. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.cjs +2 -0
  84. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.cjs.map +1 -0
  85. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.mjs +8 -0
  86. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/errorUtil.mjs.map +1 -0
  87. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.cjs +2 -0
  88. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.cjs.map +1 -0
  89. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.mjs +98 -0
  90. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.mjs.map +1 -0
  91. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.cjs +2 -0
  92. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.cjs.map +1 -0
  93. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.mjs +95 -0
  94. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.mjs.map +1 -0
  95. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.cjs +2 -0
  96. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.cjs.map +1 -0
  97. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.mjs +62 -0
  98. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/locales/en.mjs.map +1 -0
  99. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.cjs +2 -0
  100. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.cjs.map +1 -0
  101. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.mjs +2402 -0
  102. package/dist/node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.mjs.map +1 -0
  103. package/dist/schema.cjs +2 -0
  104. package/dist/schema.cjs.map +1 -0
  105. package/dist/schema.d.ts +165 -0
  106. package/dist/schema.mjs +209 -0
  107. package/dist/schema.mjs.map +1 -0
  108. package/dist/storage.cjs +2 -0
  109. package/dist/storage.cjs.map +1 -0
  110. package/dist/storage.mjs +54 -0
  111. package/dist/storage.mjs.map +1 -0
  112. package/dist/stores/store.cjs +2 -0
  113. package/dist/stores/store.cjs.map +1 -0
  114. package/dist/stores/store.mjs +607 -0
  115. package/dist/stores/store.mjs.map +1 -0
  116. package/dist/units/favorites.cjs +2 -0
  117. package/dist/units/favorites.cjs.map +1 -0
  118. package/dist/units/favorites.mjs +19 -0
  119. package/dist/units/favorites.mjs.map +1 -0
  120. package/dist/utils/casing.cjs +2 -0
  121. package/dist/utils/casing.cjs.map +1 -0
  122. package/dist/utils/casing.d.ts +6 -0
  123. package/dist/utils/casing.mjs +12 -0
  124. package/dist/utils/casing.mjs.map +1 -0
  125. package/dist/utils/collections.cjs +2 -0
  126. package/dist/utils/collections.cjs.map +1 -0
  127. package/dist/utils/collections.d.ts +1 -0
  128. package/dist/utils/collections.mjs +13 -0
  129. package/dist/utils/collections.mjs.map +1 -0
  130. package/dist/utils/dimensions.cjs +2 -0
  131. package/dist/utils/dimensions.cjs.map +1 -0
  132. package/dist/utils/dimensions.d.ts +32 -0
  133. package/dist/utils/dimensions.mjs +29 -0
  134. package/dist/utils/dimensions.mjs.map +1 -0
  135. package/dist/validation.cjs +2 -0
  136. package/dist/validation.cjs.map +1 -0
  137. package/dist/validation.mjs +18 -0
  138. package/dist/validation.mjs.map +1 -0
  139. package/package.json +18 -4
@@ -0,0 +1,2402 @@
1
+ import { ZodIssueCode as c, ZodError as $ } from "./ZodError.mjs";
2
+ import { errorUtil as o } from "./helpers/errorUtil.mjs";
3
+ import { addIssueToContext as u, INVALID as p, ParseStatus as k, OK as w, isAsync as U, isValid as I, DIRTY as M, isAborted as re, isDirty as ae } from "./helpers/parseUtil.mjs";
4
+ import { util as v, ZodParsedType as h, getParsedType as Z } from "./helpers/util.mjs";
5
+ class C {
6
+ constructor(e, t, s, r) {
7
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = s, this._key = r;
8
+ }
9
+ get path() {
10
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
11
+ }
12
+ }
13
+ const ne = (n, e) => {
14
+ if (I(e))
15
+ return { success: !0, data: e.value };
16
+ if (!n.common.issues.length)
17
+ throw new Error("Validation failed but no issues detected.");
18
+ return {
19
+ success: !1,
20
+ get error() {
21
+ if (this._error)
22
+ return this._error;
23
+ const t = new $(n.common.issues);
24
+ return this._error = t, this._error;
25
+ }
26
+ };
27
+ };
28
+ function _(n) {
29
+ if (!n)
30
+ return {};
31
+ const { errorMap: e, invalid_type_error: t, required_error: s, description: r } = n;
32
+ if (e && (t || s))
33
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
34
+ return e ? { errorMap: e, description: r } : { errorMap: (d, i) => {
35
+ const { message: l } = n;
36
+ return d.code === "invalid_enum_value" ? { message: l ?? i.defaultError } : typeof i.data > "u" ? { message: l ?? s ?? i.defaultError } : d.code !== "invalid_type" ? { message: i.defaultError } : { message: l ?? t ?? i.defaultError };
37
+ }, description: r };
38
+ }
39
+ class g {
40
+ get description() {
41
+ return this._def.description;
42
+ }
43
+ _getType(e) {
44
+ return Z(e.data);
45
+ }
46
+ _getOrReturnCtx(e, t) {
47
+ return t || {
48
+ common: e.parent.common,
49
+ data: e.data,
50
+ parsedType: Z(e.data),
51
+ schemaErrorMap: this._def.errorMap,
52
+ path: e.path,
53
+ parent: e.parent
54
+ };
55
+ }
56
+ _processInputParams(e) {
57
+ return {
58
+ status: new k(),
59
+ ctx: {
60
+ common: e.parent.common,
61
+ data: e.data,
62
+ parsedType: Z(e.data),
63
+ schemaErrorMap: this._def.errorMap,
64
+ path: e.path,
65
+ parent: e.parent
66
+ }
67
+ };
68
+ }
69
+ _parseSync(e) {
70
+ const t = this._parse(e);
71
+ if (U(t))
72
+ throw new Error("Synchronous parse encountered promise.");
73
+ return t;
74
+ }
75
+ _parseAsync(e) {
76
+ const t = this._parse(e);
77
+ return Promise.resolve(t);
78
+ }
79
+ parse(e, t) {
80
+ const s = this.safeParse(e, t);
81
+ if (s.success)
82
+ return s.data;
83
+ throw s.error;
84
+ }
85
+ safeParse(e, t) {
86
+ const s = {
87
+ common: {
88
+ issues: [],
89
+ async: (t == null ? void 0 : t.async) ?? !1,
90
+ contextualErrorMap: t == null ? void 0 : t.errorMap
91
+ },
92
+ path: (t == null ? void 0 : t.path) || [],
93
+ schemaErrorMap: this._def.errorMap,
94
+ parent: null,
95
+ data: e,
96
+ parsedType: Z(e)
97
+ }, r = this._parseSync({ data: e, path: s.path, parent: s });
98
+ return ne(s, r);
99
+ }
100
+ "~validate"(e) {
101
+ var s, r;
102
+ const t = {
103
+ common: {
104
+ issues: [],
105
+ async: !!this["~standard"].async
106
+ },
107
+ path: [],
108
+ schemaErrorMap: this._def.errorMap,
109
+ parent: null,
110
+ data: e,
111
+ parsedType: Z(e)
112
+ };
113
+ if (!this["~standard"].async)
114
+ try {
115
+ const a = this._parseSync({ data: e, path: [], parent: t });
116
+ return I(a) ? {
117
+ value: a.value
118
+ } : {
119
+ issues: t.common.issues
120
+ };
121
+ } catch (a) {
122
+ (r = (s = a == null ? void 0 : a.message) == null ? void 0 : s.toLowerCase()) != null && r.includes("encountered") && (this["~standard"].async = !0), t.common = {
123
+ issues: [],
124
+ async: !0
125
+ };
126
+ }
127
+ return this._parseAsync({ data: e, path: [], parent: t }).then((a) => I(a) ? {
128
+ value: a.value
129
+ } : {
130
+ issues: t.common.issues
131
+ });
132
+ }
133
+ async parseAsync(e, t) {
134
+ const s = await this.safeParseAsync(e, t);
135
+ if (s.success)
136
+ return s.data;
137
+ throw s.error;
138
+ }
139
+ async safeParseAsync(e, t) {
140
+ const s = {
141
+ common: {
142
+ issues: [],
143
+ contextualErrorMap: t == null ? void 0 : t.errorMap,
144
+ async: !0
145
+ },
146
+ path: (t == null ? void 0 : t.path) || [],
147
+ schemaErrorMap: this._def.errorMap,
148
+ parent: null,
149
+ data: e,
150
+ parsedType: Z(e)
151
+ }, r = this._parse({ data: e, path: s.path, parent: s }), a = await (U(r) ? r : Promise.resolve(r));
152
+ return ne(s, a);
153
+ }
154
+ refine(e, t) {
155
+ const s = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
156
+ return this._refinement((r, a) => {
157
+ const d = e(r), i = () => a.addIssue({
158
+ code: c.custom,
159
+ ...s(r)
160
+ });
161
+ return typeof Promise < "u" && d instanceof Promise ? d.then((l) => l ? !0 : (i(), !1)) : d ? !0 : (i(), !1);
162
+ });
163
+ }
164
+ refinement(e, t) {
165
+ return this._refinement((s, r) => e(s) ? !0 : (r.addIssue(typeof t == "function" ? t(s, r) : t), !1));
166
+ }
167
+ _refinement(e) {
168
+ return new V({
169
+ schema: this,
170
+ typeName: f.ZodEffects,
171
+ effect: { type: "refinement", refinement: e }
172
+ });
173
+ }
174
+ superRefine(e) {
175
+ return this._refinement(e);
176
+ }
177
+ constructor(e) {
178
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
179
+ version: 1,
180
+ vendor: "zod",
181
+ validate: (t) => this["~validate"](t)
182
+ };
183
+ }
184
+ optional() {
185
+ return A.create(this, this._def);
186
+ }
187
+ nullable() {
188
+ return z.create(this, this._def);
189
+ }
190
+ nullish() {
191
+ return this.nullable().optional();
192
+ }
193
+ array() {
194
+ return T.create(this);
195
+ }
196
+ promise() {
197
+ return Y.create(this, this._def);
198
+ }
199
+ or(e) {
200
+ return F.create([this, e], this._def);
201
+ }
202
+ and(e) {
203
+ return W.create(this, e, this._def);
204
+ }
205
+ transform(e) {
206
+ return new V({
207
+ ..._(this._def),
208
+ schema: this,
209
+ typeName: f.ZodEffects,
210
+ effect: { type: "transform", transform: e }
211
+ });
212
+ }
213
+ default(e) {
214
+ const t = typeof e == "function" ? e : () => e;
215
+ return new K({
216
+ ..._(this._def),
217
+ innerType: this,
218
+ defaultValue: t,
219
+ typeName: f.ZodDefault
220
+ });
221
+ }
222
+ brand() {
223
+ return new $e({
224
+ typeName: f.ZodBranded,
225
+ type: this,
226
+ ..._(this._def)
227
+ });
228
+ }
229
+ catch(e) {
230
+ const t = typeof e == "function" ? e : () => e;
231
+ return new ee({
232
+ ..._(this._def),
233
+ innerType: this,
234
+ catchValue: t,
235
+ typeName: f.ZodCatch
236
+ });
237
+ }
238
+ describe(e) {
239
+ const t = this.constructor;
240
+ return new t({
241
+ ...this._def,
242
+ description: e
243
+ });
244
+ }
245
+ pipe(e) {
246
+ return se.create(this, e);
247
+ }
248
+ readonly() {
249
+ return te.create(this);
250
+ }
251
+ isOptional() {
252
+ return this.safeParse(void 0).success;
253
+ }
254
+ isNullable() {
255
+ return this.safeParse(null).success;
256
+ }
257
+ }
258
+ const ye = /^c[^\s-]{8,}$/i, ve = /^[0-9a-z]+$/, xe = /^[0-9A-HJKMNP-TV-Z]{26}$/i, ke = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, we = /^[a-z0-9_-]{21}$/i, be = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Te = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ce = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Ze = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
259
+ let q;
260
+ const Ae = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Se = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, Oe = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, Re = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, Ne = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, je = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, me = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", Ie = new RegExp(`^${me}$`);
261
+ function pe(n) {
262
+ let e = "[0-5]\\d";
263
+ n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`);
264
+ const t = n.precision ? "+" : "?";
265
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
266
+ }
267
+ function Ee(n) {
268
+ return new RegExp(`^${pe(n)}$`);
269
+ }
270
+ function Le(n) {
271
+ let e = `${me}T${pe(n)}`;
272
+ const t = [];
273
+ return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
274
+ }
275
+ function Ve(n, e) {
276
+ return !!((e === "v4" || !e) && Ae.test(n) || (e === "v6" || !e) && Oe.test(n));
277
+ }
278
+ function ze(n, e) {
279
+ if (!be.test(n))
280
+ return !1;
281
+ try {
282
+ const [t] = n.split(".");
283
+ if (!t)
284
+ return !1;
285
+ const s = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), r = JSON.parse(atob(s));
286
+ return !(typeof r != "object" || r === null || "typ" in r && (r == null ? void 0 : r.typ) !== "JWT" || !r.alg || e && r.alg !== e);
287
+ } catch {
288
+ return !1;
289
+ }
290
+ }
291
+ function Pe(n, e) {
292
+ return !!((e === "v4" || !e) && Se.test(n) || (e === "v6" || !e) && Re.test(n));
293
+ }
294
+ class b extends g {
295
+ _parse(e) {
296
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
297
+ const a = this._getOrReturnCtx(e);
298
+ return u(a, {
299
+ code: c.invalid_type,
300
+ expected: h.string,
301
+ received: a.parsedType
302
+ }), p;
303
+ }
304
+ const s = new k();
305
+ let r;
306
+ for (const a of this._def.checks)
307
+ if (a.kind === "min")
308
+ e.data.length < a.value && (r = this._getOrReturnCtx(e, r), u(r, {
309
+ code: c.too_small,
310
+ minimum: a.value,
311
+ type: "string",
312
+ inclusive: !0,
313
+ exact: !1,
314
+ message: a.message
315
+ }), s.dirty());
316
+ else if (a.kind === "max")
317
+ e.data.length > a.value && (r = this._getOrReturnCtx(e, r), u(r, {
318
+ code: c.too_big,
319
+ maximum: a.value,
320
+ type: "string",
321
+ inclusive: !0,
322
+ exact: !1,
323
+ message: a.message
324
+ }), s.dirty());
325
+ else if (a.kind === "length") {
326
+ const d = e.data.length > a.value, i = e.data.length < a.value;
327
+ (d || i) && (r = this._getOrReturnCtx(e, r), d ? u(r, {
328
+ code: c.too_big,
329
+ maximum: a.value,
330
+ type: "string",
331
+ inclusive: !0,
332
+ exact: !0,
333
+ message: a.message
334
+ }) : i && u(r, {
335
+ code: c.too_small,
336
+ minimum: a.value,
337
+ type: "string",
338
+ inclusive: !0,
339
+ exact: !0,
340
+ message: a.message
341
+ }), s.dirty());
342
+ } else if (a.kind === "email")
343
+ Ce.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
344
+ validation: "email",
345
+ code: c.invalid_string,
346
+ message: a.message
347
+ }), s.dirty());
348
+ else if (a.kind === "emoji")
349
+ q || (q = new RegExp(Ze, "u")), q.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
350
+ validation: "emoji",
351
+ code: c.invalid_string,
352
+ message: a.message
353
+ }), s.dirty());
354
+ else if (a.kind === "uuid")
355
+ ke.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
356
+ validation: "uuid",
357
+ code: c.invalid_string,
358
+ message: a.message
359
+ }), s.dirty());
360
+ else if (a.kind === "nanoid")
361
+ we.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
362
+ validation: "nanoid",
363
+ code: c.invalid_string,
364
+ message: a.message
365
+ }), s.dirty());
366
+ else if (a.kind === "cuid")
367
+ ye.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
368
+ validation: "cuid",
369
+ code: c.invalid_string,
370
+ message: a.message
371
+ }), s.dirty());
372
+ else if (a.kind === "cuid2")
373
+ ve.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
374
+ validation: "cuid2",
375
+ code: c.invalid_string,
376
+ message: a.message
377
+ }), s.dirty());
378
+ else if (a.kind === "ulid")
379
+ xe.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
380
+ validation: "ulid",
381
+ code: c.invalid_string,
382
+ message: a.message
383
+ }), s.dirty());
384
+ else if (a.kind === "url")
385
+ try {
386
+ new URL(e.data);
387
+ } catch {
388
+ r = this._getOrReturnCtx(e, r), u(r, {
389
+ validation: "url",
390
+ code: c.invalid_string,
391
+ message: a.message
392
+ }), s.dirty();
393
+ }
394
+ else a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
395
+ validation: "regex",
396
+ code: c.invalid_string,
397
+ message: a.message
398
+ }), s.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (r = this._getOrReturnCtx(e, r), u(r, {
399
+ code: c.invalid_string,
400
+ validation: { includes: a.value, position: a.position },
401
+ message: a.message
402
+ }), s.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (r = this._getOrReturnCtx(e, r), u(r, {
403
+ code: c.invalid_string,
404
+ validation: { startsWith: a.value },
405
+ message: a.message
406
+ }), s.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (r = this._getOrReturnCtx(e, r), u(r, {
407
+ code: c.invalid_string,
408
+ validation: { endsWith: a.value },
409
+ message: a.message
410
+ }), s.dirty()) : a.kind === "datetime" ? Le(a).test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
411
+ code: c.invalid_string,
412
+ validation: "datetime",
413
+ message: a.message
414
+ }), s.dirty()) : a.kind === "date" ? Ie.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
415
+ code: c.invalid_string,
416
+ validation: "date",
417
+ message: a.message
418
+ }), s.dirty()) : a.kind === "time" ? Ee(a).test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
419
+ code: c.invalid_string,
420
+ validation: "time",
421
+ message: a.message
422
+ }), s.dirty()) : a.kind === "duration" ? Te.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
423
+ validation: "duration",
424
+ code: c.invalid_string,
425
+ message: a.message
426
+ }), s.dirty()) : a.kind === "ip" ? Ve(e.data, a.version) || (r = this._getOrReturnCtx(e, r), u(r, {
427
+ validation: "ip",
428
+ code: c.invalid_string,
429
+ message: a.message
430
+ }), s.dirty()) : a.kind === "jwt" ? ze(e.data, a.alg) || (r = this._getOrReturnCtx(e, r), u(r, {
431
+ validation: "jwt",
432
+ code: c.invalid_string,
433
+ message: a.message
434
+ }), s.dirty()) : a.kind === "cidr" ? Pe(e.data, a.version) || (r = this._getOrReturnCtx(e, r), u(r, {
435
+ validation: "cidr",
436
+ code: c.invalid_string,
437
+ message: a.message
438
+ }), s.dirty()) : a.kind === "base64" ? Ne.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
439
+ validation: "base64",
440
+ code: c.invalid_string,
441
+ message: a.message
442
+ }), s.dirty()) : a.kind === "base64url" ? je.test(e.data) || (r = this._getOrReturnCtx(e, r), u(r, {
443
+ validation: "base64url",
444
+ code: c.invalid_string,
445
+ message: a.message
446
+ }), s.dirty()) : v.assertNever(a);
447
+ return { status: s.value, value: e.data };
448
+ }
449
+ _regex(e, t, s) {
450
+ return this.refinement((r) => e.test(r), {
451
+ validation: t,
452
+ code: c.invalid_string,
453
+ ...o.errToObj(s)
454
+ });
455
+ }
456
+ _addCheck(e) {
457
+ return new b({
458
+ ...this._def,
459
+ checks: [...this._def.checks, e]
460
+ });
461
+ }
462
+ email(e) {
463
+ return this._addCheck({ kind: "email", ...o.errToObj(e) });
464
+ }
465
+ url(e) {
466
+ return this._addCheck({ kind: "url", ...o.errToObj(e) });
467
+ }
468
+ emoji(e) {
469
+ return this._addCheck({ kind: "emoji", ...o.errToObj(e) });
470
+ }
471
+ uuid(e) {
472
+ return this._addCheck({ kind: "uuid", ...o.errToObj(e) });
473
+ }
474
+ nanoid(e) {
475
+ return this._addCheck({ kind: "nanoid", ...o.errToObj(e) });
476
+ }
477
+ cuid(e) {
478
+ return this._addCheck({ kind: "cuid", ...o.errToObj(e) });
479
+ }
480
+ cuid2(e) {
481
+ return this._addCheck({ kind: "cuid2", ...o.errToObj(e) });
482
+ }
483
+ ulid(e) {
484
+ return this._addCheck({ kind: "ulid", ...o.errToObj(e) });
485
+ }
486
+ base64(e) {
487
+ return this._addCheck({ kind: "base64", ...o.errToObj(e) });
488
+ }
489
+ base64url(e) {
490
+ return this._addCheck({
491
+ kind: "base64url",
492
+ ...o.errToObj(e)
493
+ });
494
+ }
495
+ jwt(e) {
496
+ return this._addCheck({ kind: "jwt", ...o.errToObj(e) });
497
+ }
498
+ ip(e) {
499
+ return this._addCheck({ kind: "ip", ...o.errToObj(e) });
500
+ }
501
+ cidr(e) {
502
+ return this._addCheck({ kind: "cidr", ...o.errToObj(e) });
503
+ }
504
+ datetime(e) {
505
+ return typeof e == "string" ? this._addCheck({
506
+ kind: "datetime",
507
+ precision: null,
508
+ offset: !1,
509
+ local: !1,
510
+ message: e
511
+ }) : this._addCheck({
512
+ kind: "datetime",
513
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
514
+ offset: (e == null ? void 0 : e.offset) ?? !1,
515
+ local: (e == null ? void 0 : e.local) ?? !1,
516
+ ...o.errToObj(e == null ? void 0 : e.message)
517
+ });
518
+ }
519
+ date(e) {
520
+ return this._addCheck({ kind: "date", message: e });
521
+ }
522
+ time(e) {
523
+ return typeof e == "string" ? this._addCheck({
524
+ kind: "time",
525
+ precision: null,
526
+ message: e
527
+ }) : this._addCheck({
528
+ kind: "time",
529
+ precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
530
+ ...o.errToObj(e == null ? void 0 : e.message)
531
+ });
532
+ }
533
+ duration(e) {
534
+ return this._addCheck({ kind: "duration", ...o.errToObj(e) });
535
+ }
536
+ regex(e, t) {
537
+ return this._addCheck({
538
+ kind: "regex",
539
+ regex: e,
540
+ ...o.errToObj(t)
541
+ });
542
+ }
543
+ includes(e, t) {
544
+ return this._addCheck({
545
+ kind: "includes",
546
+ value: e,
547
+ position: t == null ? void 0 : t.position,
548
+ ...o.errToObj(t == null ? void 0 : t.message)
549
+ });
550
+ }
551
+ startsWith(e, t) {
552
+ return this._addCheck({
553
+ kind: "startsWith",
554
+ value: e,
555
+ ...o.errToObj(t)
556
+ });
557
+ }
558
+ endsWith(e, t) {
559
+ return this._addCheck({
560
+ kind: "endsWith",
561
+ value: e,
562
+ ...o.errToObj(t)
563
+ });
564
+ }
565
+ min(e, t) {
566
+ return this._addCheck({
567
+ kind: "min",
568
+ value: e,
569
+ ...o.errToObj(t)
570
+ });
571
+ }
572
+ max(e, t) {
573
+ return this._addCheck({
574
+ kind: "max",
575
+ value: e,
576
+ ...o.errToObj(t)
577
+ });
578
+ }
579
+ length(e, t) {
580
+ return this._addCheck({
581
+ kind: "length",
582
+ value: e,
583
+ ...o.errToObj(t)
584
+ });
585
+ }
586
+ /**
587
+ * Equivalent to `.min(1)`
588
+ */
589
+ nonempty(e) {
590
+ return this.min(1, o.errToObj(e));
591
+ }
592
+ trim() {
593
+ return new b({
594
+ ...this._def,
595
+ checks: [...this._def.checks, { kind: "trim" }]
596
+ });
597
+ }
598
+ toLowerCase() {
599
+ return new b({
600
+ ...this._def,
601
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
602
+ });
603
+ }
604
+ toUpperCase() {
605
+ return new b({
606
+ ...this._def,
607
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
608
+ });
609
+ }
610
+ get isDatetime() {
611
+ return !!this._def.checks.find((e) => e.kind === "datetime");
612
+ }
613
+ get isDate() {
614
+ return !!this._def.checks.find((e) => e.kind === "date");
615
+ }
616
+ get isTime() {
617
+ return !!this._def.checks.find((e) => e.kind === "time");
618
+ }
619
+ get isDuration() {
620
+ return !!this._def.checks.find((e) => e.kind === "duration");
621
+ }
622
+ get isEmail() {
623
+ return !!this._def.checks.find((e) => e.kind === "email");
624
+ }
625
+ get isURL() {
626
+ return !!this._def.checks.find((e) => e.kind === "url");
627
+ }
628
+ get isEmoji() {
629
+ return !!this._def.checks.find((e) => e.kind === "emoji");
630
+ }
631
+ get isUUID() {
632
+ return !!this._def.checks.find((e) => e.kind === "uuid");
633
+ }
634
+ get isNANOID() {
635
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
636
+ }
637
+ get isCUID() {
638
+ return !!this._def.checks.find((e) => e.kind === "cuid");
639
+ }
640
+ get isCUID2() {
641
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
642
+ }
643
+ get isULID() {
644
+ return !!this._def.checks.find((e) => e.kind === "ulid");
645
+ }
646
+ get isIP() {
647
+ return !!this._def.checks.find((e) => e.kind === "ip");
648
+ }
649
+ get isCIDR() {
650
+ return !!this._def.checks.find((e) => e.kind === "cidr");
651
+ }
652
+ get isBase64() {
653
+ return !!this._def.checks.find((e) => e.kind === "base64");
654
+ }
655
+ get isBase64url() {
656
+ return !!this._def.checks.find((e) => e.kind === "base64url");
657
+ }
658
+ get minLength() {
659
+ let e = null;
660
+ for (const t of this._def.checks)
661
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
662
+ return e;
663
+ }
664
+ get maxLength() {
665
+ let e = null;
666
+ for (const t of this._def.checks)
667
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
668
+ return e;
669
+ }
670
+ }
671
+ b.create = (n) => new b({
672
+ checks: [],
673
+ typeName: f.ZodString,
674
+ coerce: (n == null ? void 0 : n.coerce) ?? !1,
675
+ ..._(n)
676
+ });
677
+ function Me(n, e) {
678
+ const t = (n.toString().split(".")[1] || "").length, s = (e.toString().split(".")[1] || "").length, r = t > s ? t : s, a = Number.parseInt(n.toFixed(r).replace(".", "")), d = Number.parseInt(e.toFixed(r).replace(".", ""));
679
+ return a % d / 10 ** r;
680
+ }
681
+ class O extends g {
682
+ constructor() {
683
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
684
+ }
685
+ _parse(e) {
686
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== h.number) {
687
+ const a = this._getOrReturnCtx(e);
688
+ return u(a, {
689
+ code: c.invalid_type,
690
+ expected: h.number,
691
+ received: a.parsedType
692
+ }), p;
693
+ }
694
+ let s;
695
+ const r = new k();
696
+ for (const a of this._def.checks)
697
+ a.kind === "int" ? v.isInteger(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
698
+ code: c.invalid_type,
699
+ expected: "integer",
700
+ received: "float",
701
+ message: a.message
702
+ }), r.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), u(s, {
703
+ code: c.too_small,
704
+ minimum: a.value,
705
+ type: "number",
706
+ inclusive: a.inclusive,
707
+ exact: !1,
708
+ message: a.message
709
+ }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), u(s, {
710
+ code: c.too_big,
711
+ maximum: a.value,
712
+ type: "number",
713
+ inclusive: a.inclusive,
714
+ exact: !1,
715
+ message: a.message
716
+ }), r.dirty()) : a.kind === "multipleOf" ? Me(e.data, a.value) !== 0 && (s = this._getOrReturnCtx(e, s), u(s, {
717
+ code: c.not_multiple_of,
718
+ multipleOf: a.value,
719
+ message: a.message
720
+ }), r.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (s = this._getOrReturnCtx(e, s), u(s, {
721
+ code: c.not_finite,
722
+ message: a.message
723
+ }), r.dirty()) : v.assertNever(a);
724
+ return { status: r.value, value: e.data };
725
+ }
726
+ gte(e, t) {
727
+ return this.setLimit("min", e, !0, o.toString(t));
728
+ }
729
+ gt(e, t) {
730
+ return this.setLimit("min", e, !1, o.toString(t));
731
+ }
732
+ lte(e, t) {
733
+ return this.setLimit("max", e, !0, o.toString(t));
734
+ }
735
+ lt(e, t) {
736
+ return this.setLimit("max", e, !1, o.toString(t));
737
+ }
738
+ setLimit(e, t, s, r) {
739
+ return new O({
740
+ ...this._def,
741
+ checks: [
742
+ ...this._def.checks,
743
+ {
744
+ kind: e,
745
+ value: t,
746
+ inclusive: s,
747
+ message: o.toString(r)
748
+ }
749
+ ]
750
+ });
751
+ }
752
+ _addCheck(e) {
753
+ return new O({
754
+ ...this._def,
755
+ checks: [...this._def.checks, e]
756
+ });
757
+ }
758
+ int(e) {
759
+ return this._addCheck({
760
+ kind: "int",
761
+ message: o.toString(e)
762
+ });
763
+ }
764
+ positive(e) {
765
+ return this._addCheck({
766
+ kind: "min",
767
+ value: 0,
768
+ inclusive: !1,
769
+ message: o.toString(e)
770
+ });
771
+ }
772
+ negative(e) {
773
+ return this._addCheck({
774
+ kind: "max",
775
+ value: 0,
776
+ inclusive: !1,
777
+ message: o.toString(e)
778
+ });
779
+ }
780
+ nonpositive(e) {
781
+ return this._addCheck({
782
+ kind: "max",
783
+ value: 0,
784
+ inclusive: !0,
785
+ message: o.toString(e)
786
+ });
787
+ }
788
+ nonnegative(e) {
789
+ return this._addCheck({
790
+ kind: "min",
791
+ value: 0,
792
+ inclusive: !0,
793
+ message: o.toString(e)
794
+ });
795
+ }
796
+ multipleOf(e, t) {
797
+ return this._addCheck({
798
+ kind: "multipleOf",
799
+ value: e,
800
+ message: o.toString(t)
801
+ });
802
+ }
803
+ finite(e) {
804
+ return this._addCheck({
805
+ kind: "finite",
806
+ message: o.toString(e)
807
+ });
808
+ }
809
+ safe(e) {
810
+ return this._addCheck({
811
+ kind: "min",
812
+ inclusive: !0,
813
+ value: Number.MIN_SAFE_INTEGER,
814
+ message: o.toString(e)
815
+ })._addCheck({
816
+ kind: "max",
817
+ inclusive: !0,
818
+ value: Number.MAX_SAFE_INTEGER,
819
+ message: o.toString(e)
820
+ });
821
+ }
822
+ get minValue() {
823
+ let e = null;
824
+ for (const t of this._def.checks)
825
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
826
+ return e;
827
+ }
828
+ get maxValue() {
829
+ let e = null;
830
+ for (const t of this._def.checks)
831
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
832
+ return e;
833
+ }
834
+ get isInt() {
835
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && v.isInteger(e.value));
836
+ }
837
+ get isFinite() {
838
+ let e = null, t = null;
839
+ for (const s of this._def.checks) {
840
+ if (s.kind === "finite" || s.kind === "int" || s.kind === "multipleOf")
841
+ return !0;
842
+ s.kind === "min" ? (t === null || s.value > t) && (t = s.value) : s.kind === "max" && (e === null || s.value < e) && (e = s.value);
843
+ }
844
+ return Number.isFinite(t) && Number.isFinite(e);
845
+ }
846
+ }
847
+ O.create = (n) => new O({
848
+ checks: [],
849
+ typeName: f.ZodNumber,
850
+ coerce: (n == null ? void 0 : n.coerce) || !1,
851
+ ..._(n)
852
+ });
853
+ class R extends g {
854
+ constructor() {
855
+ super(...arguments), this.min = this.gte, this.max = this.lte;
856
+ }
857
+ _parse(e) {
858
+ if (this._def.coerce)
859
+ try {
860
+ e.data = BigInt(e.data);
861
+ } catch {
862
+ return this._getInvalidInput(e);
863
+ }
864
+ if (this._getType(e) !== h.bigint)
865
+ return this._getInvalidInput(e);
866
+ let s;
867
+ const r = new k();
868
+ for (const a of this._def.checks)
869
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (s = this._getOrReturnCtx(e, s), u(s, {
870
+ code: c.too_small,
871
+ type: "bigint",
872
+ minimum: a.value,
873
+ inclusive: a.inclusive,
874
+ message: a.message
875
+ }), r.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (s = this._getOrReturnCtx(e, s), u(s, {
876
+ code: c.too_big,
877
+ type: "bigint",
878
+ maximum: a.value,
879
+ inclusive: a.inclusive,
880
+ message: a.message
881
+ }), r.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (s = this._getOrReturnCtx(e, s), u(s, {
882
+ code: c.not_multiple_of,
883
+ multipleOf: a.value,
884
+ message: a.message
885
+ }), r.dirty()) : v.assertNever(a);
886
+ return { status: r.value, value: e.data };
887
+ }
888
+ _getInvalidInput(e) {
889
+ const t = this._getOrReturnCtx(e);
890
+ return u(t, {
891
+ code: c.invalid_type,
892
+ expected: h.bigint,
893
+ received: t.parsedType
894
+ }), p;
895
+ }
896
+ gte(e, t) {
897
+ return this.setLimit("min", e, !0, o.toString(t));
898
+ }
899
+ gt(e, t) {
900
+ return this.setLimit("min", e, !1, o.toString(t));
901
+ }
902
+ lte(e, t) {
903
+ return this.setLimit("max", e, !0, o.toString(t));
904
+ }
905
+ lt(e, t) {
906
+ return this.setLimit("max", e, !1, o.toString(t));
907
+ }
908
+ setLimit(e, t, s, r) {
909
+ return new R({
910
+ ...this._def,
911
+ checks: [
912
+ ...this._def.checks,
913
+ {
914
+ kind: e,
915
+ value: t,
916
+ inclusive: s,
917
+ message: o.toString(r)
918
+ }
919
+ ]
920
+ });
921
+ }
922
+ _addCheck(e) {
923
+ return new R({
924
+ ...this._def,
925
+ checks: [...this._def.checks, e]
926
+ });
927
+ }
928
+ positive(e) {
929
+ return this._addCheck({
930
+ kind: "min",
931
+ value: BigInt(0),
932
+ inclusive: !1,
933
+ message: o.toString(e)
934
+ });
935
+ }
936
+ negative(e) {
937
+ return this._addCheck({
938
+ kind: "max",
939
+ value: BigInt(0),
940
+ inclusive: !1,
941
+ message: o.toString(e)
942
+ });
943
+ }
944
+ nonpositive(e) {
945
+ return this._addCheck({
946
+ kind: "max",
947
+ value: BigInt(0),
948
+ inclusive: !0,
949
+ message: o.toString(e)
950
+ });
951
+ }
952
+ nonnegative(e) {
953
+ return this._addCheck({
954
+ kind: "min",
955
+ value: BigInt(0),
956
+ inclusive: !0,
957
+ message: o.toString(e)
958
+ });
959
+ }
960
+ multipleOf(e, t) {
961
+ return this._addCheck({
962
+ kind: "multipleOf",
963
+ value: e,
964
+ message: o.toString(t)
965
+ });
966
+ }
967
+ get minValue() {
968
+ let e = null;
969
+ for (const t of this._def.checks)
970
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
971
+ return e;
972
+ }
973
+ get maxValue() {
974
+ let e = null;
975
+ for (const t of this._def.checks)
976
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
977
+ return e;
978
+ }
979
+ }
980
+ R.create = (n) => new R({
981
+ checks: [],
982
+ typeName: f.ZodBigInt,
983
+ coerce: (n == null ? void 0 : n.coerce) ?? !1,
984
+ ..._(n)
985
+ });
986
+ class B extends g {
987
+ _parse(e) {
988
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
989
+ const s = this._getOrReturnCtx(e);
990
+ return u(s, {
991
+ code: c.invalid_type,
992
+ expected: h.boolean,
993
+ received: s.parsedType
994
+ }), p;
995
+ }
996
+ return w(e.data);
997
+ }
998
+ }
999
+ B.create = (n) => new B({
1000
+ typeName: f.ZodBoolean,
1001
+ coerce: (n == null ? void 0 : n.coerce) || !1,
1002
+ ..._(n)
1003
+ });
1004
+ class E extends g {
1005
+ _parse(e) {
1006
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
1007
+ const a = this._getOrReturnCtx(e);
1008
+ return u(a, {
1009
+ code: c.invalid_type,
1010
+ expected: h.date,
1011
+ received: a.parsedType
1012
+ }), p;
1013
+ }
1014
+ if (Number.isNaN(e.data.getTime())) {
1015
+ const a = this._getOrReturnCtx(e);
1016
+ return u(a, {
1017
+ code: c.invalid_date
1018
+ }), p;
1019
+ }
1020
+ const s = new k();
1021
+ let r;
1022
+ for (const a of this._def.checks)
1023
+ a.kind === "min" ? e.data.getTime() < a.value && (r = this._getOrReturnCtx(e, r), u(r, {
1024
+ code: c.too_small,
1025
+ message: a.message,
1026
+ inclusive: !0,
1027
+ exact: !1,
1028
+ minimum: a.value,
1029
+ type: "date"
1030
+ }), s.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (r = this._getOrReturnCtx(e, r), u(r, {
1031
+ code: c.too_big,
1032
+ message: a.message,
1033
+ inclusive: !0,
1034
+ exact: !1,
1035
+ maximum: a.value,
1036
+ type: "date"
1037
+ }), s.dirty()) : v.assertNever(a);
1038
+ return {
1039
+ status: s.value,
1040
+ value: new Date(e.data.getTime())
1041
+ };
1042
+ }
1043
+ _addCheck(e) {
1044
+ return new E({
1045
+ ...this._def,
1046
+ checks: [...this._def.checks, e]
1047
+ });
1048
+ }
1049
+ min(e, t) {
1050
+ return this._addCheck({
1051
+ kind: "min",
1052
+ value: e.getTime(),
1053
+ message: o.toString(t)
1054
+ });
1055
+ }
1056
+ max(e, t) {
1057
+ return this._addCheck({
1058
+ kind: "max",
1059
+ value: e.getTime(),
1060
+ message: o.toString(t)
1061
+ });
1062
+ }
1063
+ get minDate() {
1064
+ let e = null;
1065
+ for (const t of this._def.checks)
1066
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1067
+ return e != null ? new Date(e) : null;
1068
+ }
1069
+ get maxDate() {
1070
+ let e = null;
1071
+ for (const t of this._def.checks)
1072
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1073
+ return e != null ? new Date(e) : null;
1074
+ }
1075
+ }
1076
+ E.create = (n) => new E({
1077
+ checks: [],
1078
+ coerce: (n == null ? void 0 : n.coerce) || !1,
1079
+ typeName: f.ZodDate,
1080
+ ..._(n)
1081
+ });
1082
+ class ie extends g {
1083
+ _parse(e) {
1084
+ if (this._getType(e) !== h.symbol) {
1085
+ const s = this._getOrReturnCtx(e);
1086
+ return u(s, {
1087
+ code: c.invalid_type,
1088
+ expected: h.symbol,
1089
+ received: s.parsedType
1090
+ }), p;
1091
+ }
1092
+ return w(e.data);
1093
+ }
1094
+ }
1095
+ ie.create = (n) => new ie({
1096
+ typeName: f.ZodSymbol,
1097
+ ..._(n)
1098
+ });
1099
+ class de extends g {
1100
+ _parse(e) {
1101
+ if (this._getType(e) !== h.undefined) {
1102
+ const s = this._getOrReturnCtx(e);
1103
+ return u(s, {
1104
+ code: c.invalid_type,
1105
+ expected: h.undefined,
1106
+ received: s.parsedType
1107
+ }), p;
1108
+ }
1109
+ return w(e.data);
1110
+ }
1111
+ }
1112
+ de.create = (n) => new de({
1113
+ typeName: f.ZodUndefined,
1114
+ ..._(n)
1115
+ });
1116
+ class H extends g {
1117
+ _parse(e) {
1118
+ if (this._getType(e) !== h.null) {
1119
+ const s = this._getOrReturnCtx(e);
1120
+ return u(s, {
1121
+ code: c.invalid_type,
1122
+ expected: h.null,
1123
+ received: s.parsedType
1124
+ }), p;
1125
+ }
1126
+ return w(e.data);
1127
+ }
1128
+ }
1129
+ H.create = (n) => new H({
1130
+ typeName: f.ZodNull,
1131
+ ..._(n)
1132
+ });
1133
+ class G extends g {
1134
+ constructor() {
1135
+ super(...arguments), this._any = !0;
1136
+ }
1137
+ _parse(e) {
1138
+ return w(e.data);
1139
+ }
1140
+ }
1141
+ G.create = (n) => new G({
1142
+ typeName: f.ZodAny,
1143
+ ..._(n)
1144
+ });
1145
+ class Q extends g {
1146
+ constructor() {
1147
+ super(...arguments), this._unknown = !0;
1148
+ }
1149
+ _parse(e) {
1150
+ return w(e.data);
1151
+ }
1152
+ }
1153
+ Q.create = (n) => new Q({
1154
+ typeName: f.ZodUnknown,
1155
+ ..._(n)
1156
+ });
1157
+ class S extends g {
1158
+ _parse(e) {
1159
+ const t = this._getOrReturnCtx(e);
1160
+ return u(t, {
1161
+ code: c.invalid_type,
1162
+ expected: h.never,
1163
+ received: t.parsedType
1164
+ }), p;
1165
+ }
1166
+ }
1167
+ S.create = (n) => new S({
1168
+ typeName: f.ZodNever,
1169
+ ..._(n)
1170
+ });
1171
+ class ce extends g {
1172
+ _parse(e) {
1173
+ if (this._getType(e) !== h.undefined) {
1174
+ const s = this._getOrReturnCtx(e);
1175
+ return u(s, {
1176
+ code: c.invalid_type,
1177
+ expected: h.void,
1178
+ received: s.parsedType
1179
+ }), p;
1180
+ }
1181
+ return w(e.data);
1182
+ }
1183
+ }
1184
+ ce.create = (n) => new ce({
1185
+ typeName: f.ZodVoid,
1186
+ ..._(n)
1187
+ });
1188
+ class T extends g {
1189
+ _parse(e) {
1190
+ const { ctx: t, status: s } = this._processInputParams(e), r = this._def;
1191
+ if (t.parsedType !== h.array)
1192
+ return u(t, {
1193
+ code: c.invalid_type,
1194
+ expected: h.array,
1195
+ received: t.parsedType
1196
+ }), p;
1197
+ if (r.exactLength !== null) {
1198
+ const d = t.data.length > r.exactLength.value, i = t.data.length < r.exactLength.value;
1199
+ (d || i) && (u(t, {
1200
+ code: d ? c.too_big : c.too_small,
1201
+ minimum: i ? r.exactLength.value : void 0,
1202
+ maximum: d ? r.exactLength.value : void 0,
1203
+ type: "array",
1204
+ inclusive: !0,
1205
+ exact: !0,
1206
+ message: r.exactLength.message
1207
+ }), s.dirty());
1208
+ }
1209
+ if (r.minLength !== null && t.data.length < r.minLength.value && (u(t, {
1210
+ code: c.too_small,
1211
+ minimum: r.minLength.value,
1212
+ type: "array",
1213
+ inclusive: !0,
1214
+ exact: !1,
1215
+ message: r.minLength.message
1216
+ }), s.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (u(t, {
1217
+ code: c.too_big,
1218
+ maximum: r.maxLength.value,
1219
+ type: "array",
1220
+ inclusive: !0,
1221
+ exact: !1,
1222
+ message: r.maxLength.message
1223
+ }), s.dirty()), t.common.async)
1224
+ return Promise.all([...t.data].map((d, i) => r.type._parseAsync(new C(t, d, t.path, i)))).then((d) => k.mergeArray(s, d));
1225
+ const a = [...t.data].map((d, i) => r.type._parseSync(new C(t, d, t.path, i)));
1226
+ return k.mergeArray(s, a);
1227
+ }
1228
+ get element() {
1229
+ return this._def.type;
1230
+ }
1231
+ min(e, t) {
1232
+ return new T({
1233
+ ...this._def,
1234
+ minLength: { value: e, message: o.toString(t) }
1235
+ });
1236
+ }
1237
+ max(e, t) {
1238
+ return new T({
1239
+ ...this._def,
1240
+ maxLength: { value: e, message: o.toString(t) }
1241
+ });
1242
+ }
1243
+ length(e, t) {
1244
+ return new T({
1245
+ ...this._def,
1246
+ exactLength: { value: e, message: o.toString(t) }
1247
+ });
1248
+ }
1249
+ nonempty(e) {
1250
+ return this.min(1, e);
1251
+ }
1252
+ }
1253
+ T.create = (n, e) => new T({
1254
+ type: n,
1255
+ minLength: null,
1256
+ maxLength: null,
1257
+ exactLength: null,
1258
+ typeName: f.ZodArray,
1259
+ ..._(e)
1260
+ });
1261
+ function j(n) {
1262
+ if (n instanceof x) {
1263
+ const e = {};
1264
+ for (const t in n.shape) {
1265
+ const s = n.shape[t];
1266
+ e[t] = A.create(j(s));
1267
+ }
1268
+ return new x({
1269
+ ...n._def,
1270
+ shape: () => e
1271
+ });
1272
+ } else return n instanceof T ? new T({
1273
+ ...n._def,
1274
+ type: j(n.element)
1275
+ }) : n instanceof A ? A.create(j(n.unwrap())) : n instanceof z ? z.create(j(n.unwrap())) : n instanceof N ? N.create(n.items.map((e) => j(e))) : n;
1276
+ }
1277
+ class x extends g {
1278
+ constructor() {
1279
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1280
+ }
1281
+ _getCached() {
1282
+ if (this._cached !== null)
1283
+ return this._cached;
1284
+ const e = this._def.shape(), t = v.objectKeys(e);
1285
+ return this._cached = { shape: e, keys: t }, this._cached;
1286
+ }
1287
+ _parse(e) {
1288
+ if (this._getType(e) !== h.object) {
1289
+ const m = this._getOrReturnCtx(e);
1290
+ return u(m, {
1291
+ code: c.invalid_type,
1292
+ expected: h.object,
1293
+ received: m.parsedType
1294
+ }), p;
1295
+ }
1296
+ const { status: s, ctx: r } = this._processInputParams(e), { shape: a, keys: d } = this._getCached(), i = [];
1297
+ if (!(this._def.catchall instanceof S && this._def.unknownKeys === "strip"))
1298
+ for (const m in r.data)
1299
+ d.includes(m) || i.push(m);
1300
+ const l = [];
1301
+ for (const m of d) {
1302
+ const y = a[m], P = r.data[m];
1303
+ l.push({
1304
+ key: { status: "valid", value: m },
1305
+ value: y._parse(new C(r, P, r.path, m)),
1306
+ alwaysSet: m in r.data
1307
+ });
1308
+ }
1309
+ if (this._def.catchall instanceof S) {
1310
+ const m = this._def.unknownKeys;
1311
+ if (m === "passthrough")
1312
+ for (const y of i)
1313
+ l.push({
1314
+ key: { status: "valid", value: y },
1315
+ value: { status: "valid", value: r.data[y] }
1316
+ });
1317
+ else if (m === "strict")
1318
+ i.length > 0 && (u(r, {
1319
+ code: c.unrecognized_keys,
1320
+ keys: i
1321
+ }), s.dirty());
1322
+ else if (m !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1323
+ } else {
1324
+ const m = this._def.catchall;
1325
+ for (const y of i) {
1326
+ const P = r.data[y];
1327
+ l.push({
1328
+ key: { status: "valid", value: y },
1329
+ value: m._parse(
1330
+ new C(r, P, r.path, y)
1331
+ //, ctx.child(key), value, getParsedType(value)
1332
+ ),
1333
+ alwaysSet: y in r.data
1334
+ });
1335
+ }
1336
+ }
1337
+ return r.common.async ? Promise.resolve().then(async () => {
1338
+ const m = [];
1339
+ for (const y of l) {
1340
+ const P = await y.key, ge = await y.value;
1341
+ m.push({
1342
+ key: P,
1343
+ value: ge,
1344
+ alwaysSet: y.alwaysSet
1345
+ });
1346
+ }
1347
+ return m;
1348
+ }).then((m) => k.mergeObjectSync(s, m)) : k.mergeObjectSync(s, l);
1349
+ }
1350
+ get shape() {
1351
+ return this._def.shape();
1352
+ }
1353
+ strict(e) {
1354
+ return o.errToObj, new x({
1355
+ ...this._def,
1356
+ unknownKeys: "strict",
1357
+ ...e !== void 0 ? {
1358
+ errorMap: (t, s) => {
1359
+ var a, d;
1360
+ const r = ((d = (a = this._def).errorMap) == null ? void 0 : d.call(a, t, s).message) ?? s.defaultError;
1361
+ return t.code === "unrecognized_keys" ? {
1362
+ message: o.errToObj(e).message ?? r
1363
+ } : {
1364
+ message: r
1365
+ };
1366
+ }
1367
+ } : {}
1368
+ });
1369
+ }
1370
+ strip() {
1371
+ return new x({
1372
+ ...this._def,
1373
+ unknownKeys: "strip"
1374
+ });
1375
+ }
1376
+ passthrough() {
1377
+ return new x({
1378
+ ...this._def,
1379
+ unknownKeys: "passthrough"
1380
+ });
1381
+ }
1382
+ // const AugmentFactory =
1383
+ // <Def extends ZodObjectDef>(def: Def) =>
1384
+ // <Augmentation extends ZodRawShape>(
1385
+ // augmentation: Augmentation
1386
+ // ): ZodObject<
1387
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1388
+ // Def["unknownKeys"],
1389
+ // Def["catchall"]
1390
+ // > => {
1391
+ // return new ZodObject({
1392
+ // ...def,
1393
+ // shape: () => ({
1394
+ // ...def.shape(),
1395
+ // ...augmentation,
1396
+ // }),
1397
+ // }) as any;
1398
+ // };
1399
+ extend(e) {
1400
+ return new x({
1401
+ ...this._def,
1402
+ shape: () => ({
1403
+ ...this._def.shape(),
1404
+ ...e
1405
+ })
1406
+ });
1407
+ }
1408
+ /**
1409
+ * Prior to zod@1.0.12 there was a bug in the
1410
+ * inferred type of merged objects. Please
1411
+ * upgrade if you are experiencing issues.
1412
+ */
1413
+ merge(e) {
1414
+ return new x({
1415
+ unknownKeys: e._def.unknownKeys,
1416
+ catchall: e._def.catchall,
1417
+ shape: () => ({
1418
+ ...this._def.shape(),
1419
+ ...e._def.shape()
1420
+ }),
1421
+ typeName: f.ZodObject
1422
+ });
1423
+ }
1424
+ // merge<
1425
+ // Incoming extends AnyZodObject,
1426
+ // Augmentation extends Incoming["shape"],
1427
+ // NewOutput extends {
1428
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1429
+ // ? Augmentation[k]["_output"]
1430
+ // : k extends keyof Output
1431
+ // ? Output[k]
1432
+ // : never;
1433
+ // },
1434
+ // NewInput extends {
1435
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1436
+ // ? Augmentation[k]["_input"]
1437
+ // : k extends keyof Input
1438
+ // ? Input[k]
1439
+ // : never;
1440
+ // }
1441
+ // >(
1442
+ // merging: Incoming
1443
+ // ): ZodObject<
1444
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1445
+ // Incoming["_def"]["unknownKeys"],
1446
+ // Incoming["_def"]["catchall"],
1447
+ // NewOutput,
1448
+ // NewInput
1449
+ // > {
1450
+ // const merged: any = new ZodObject({
1451
+ // unknownKeys: merging._def.unknownKeys,
1452
+ // catchall: merging._def.catchall,
1453
+ // shape: () =>
1454
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1455
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1456
+ // }) as any;
1457
+ // return merged;
1458
+ // }
1459
+ setKey(e, t) {
1460
+ return this.augment({ [e]: t });
1461
+ }
1462
+ // merge<Incoming extends AnyZodObject>(
1463
+ // merging: Incoming
1464
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1465
+ // ZodObject<
1466
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1467
+ // Incoming["_def"]["unknownKeys"],
1468
+ // Incoming["_def"]["catchall"]
1469
+ // > {
1470
+ // // const mergedShape = objectUtil.mergeShapes(
1471
+ // // this._def.shape(),
1472
+ // // merging._def.shape()
1473
+ // // );
1474
+ // const merged: any = new ZodObject({
1475
+ // unknownKeys: merging._def.unknownKeys,
1476
+ // catchall: merging._def.catchall,
1477
+ // shape: () =>
1478
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1479
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1480
+ // }) as any;
1481
+ // return merged;
1482
+ // }
1483
+ catchall(e) {
1484
+ return new x({
1485
+ ...this._def,
1486
+ catchall: e
1487
+ });
1488
+ }
1489
+ pick(e) {
1490
+ const t = {};
1491
+ for (const s of v.objectKeys(e))
1492
+ e[s] && this.shape[s] && (t[s] = this.shape[s]);
1493
+ return new x({
1494
+ ...this._def,
1495
+ shape: () => t
1496
+ });
1497
+ }
1498
+ omit(e) {
1499
+ const t = {};
1500
+ for (const s of v.objectKeys(this.shape))
1501
+ e[s] || (t[s] = this.shape[s]);
1502
+ return new x({
1503
+ ...this._def,
1504
+ shape: () => t
1505
+ });
1506
+ }
1507
+ /**
1508
+ * @deprecated
1509
+ */
1510
+ deepPartial() {
1511
+ return j(this);
1512
+ }
1513
+ partial(e) {
1514
+ const t = {};
1515
+ for (const s of v.objectKeys(this.shape)) {
1516
+ const r = this.shape[s];
1517
+ e && !e[s] ? t[s] = r : t[s] = r.optional();
1518
+ }
1519
+ return new x({
1520
+ ...this._def,
1521
+ shape: () => t
1522
+ });
1523
+ }
1524
+ required(e) {
1525
+ const t = {};
1526
+ for (const s of v.objectKeys(this.shape))
1527
+ if (e && !e[s])
1528
+ t[s] = this.shape[s];
1529
+ else {
1530
+ let a = this.shape[s];
1531
+ for (; a instanceof A; )
1532
+ a = a._def.innerType;
1533
+ t[s] = a;
1534
+ }
1535
+ return new x({
1536
+ ...this._def,
1537
+ shape: () => t
1538
+ });
1539
+ }
1540
+ keyof() {
1541
+ return _e(v.objectKeys(this.shape));
1542
+ }
1543
+ }
1544
+ x.create = (n, e) => new x({
1545
+ shape: () => n,
1546
+ unknownKeys: "strip",
1547
+ catchall: S.create(),
1548
+ typeName: f.ZodObject,
1549
+ ..._(e)
1550
+ });
1551
+ x.strictCreate = (n, e) => new x({
1552
+ shape: () => n,
1553
+ unknownKeys: "strict",
1554
+ catchall: S.create(),
1555
+ typeName: f.ZodObject,
1556
+ ..._(e)
1557
+ });
1558
+ x.lazycreate = (n, e) => new x({
1559
+ shape: n,
1560
+ unknownKeys: "strip",
1561
+ catchall: S.create(),
1562
+ typeName: f.ZodObject,
1563
+ ..._(e)
1564
+ });
1565
+ class F extends g {
1566
+ _parse(e) {
1567
+ const { ctx: t } = this._processInputParams(e), s = this._def.options;
1568
+ function r(a) {
1569
+ for (const i of a)
1570
+ if (i.result.status === "valid")
1571
+ return i.result;
1572
+ for (const i of a)
1573
+ if (i.result.status === "dirty")
1574
+ return t.common.issues.push(...i.ctx.common.issues), i.result;
1575
+ const d = a.map((i) => new $(i.ctx.common.issues));
1576
+ return u(t, {
1577
+ code: c.invalid_union,
1578
+ unionErrors: d
1579
+ }), p;
1580
+ }
1581
+ if (t.common.async)
1582
+ return Promise.all(s.map(async (a) => {
1583
+ const d = {
1584
+ ...t,
1585
+ common: {
1586
+ ...t.common,
1587
+ issues: []
1588
+ },
1589
+ parent: null
1590
+ };
1591
+ return {
1592
+ result: await a._parseAsync({
1593
+ data: t.data,
1594
+ path: t.path,
1595
+ parent: d
1596
+ }),
1597
+ ctx: d
1598
+ };
1599
+ })).then(r);
1600
+ {
1601
+ let a;
1602
+ const d = [];
1603
+ for (const l of s) {
1604
+ const m = {
1605
+ ...t,
1606
+ common: {
1607
+ ...t.common,
1608
+ issues: []
1609
+ },
1610
+ parent: null
1611
+ }, y = l._parseSync({
1612
+ data: t.data,
1613
+ path: t.path,
1614
+ parent: m
1615
+ });
1616
+ if (y.status === "valid")
1617
+ return y;
1618
+ y.status === "dirty" && !a && (a = { result: y, ctx: m }), m.common.issues.length && d.push(m.common.issues);
1619
+ }
1620
+ if (a)
1621
+ return t.common.issues.push(...a.ctx.common.issues), a.result;
1622
+ const i = d.map((l) => new $(l));
1623
+ return u(t, {
1624
+ code: c.invalid_union,
1625
+ unionErrors: i
1626
+ }), p;
1627
+ }
1628
+ }
1629
+ get options() {
1630
+ return this._def.options;
1631
+ }
1632
+ }
1633
+ F.create = (n, e) => new F({
1634
+ options: n,
1635
+ typeName: f.ZodUnion,
1636
+ ..._(e)
1637
+ });
1638
+ function X(n, e) {
1639
+ const t = Z(n), s = Z(e);
1640
+ if (n === e)
1641
+ return { valid: !0, data: n };
1642
+ if (t === h.object && s === h.object) {
1643
+ const r = v.objectKeys(e), a = v.objectKeys(n).filter((i) => r.indexOf(i) !== -1), d = { ...n, ...e };
1644
+ for (const i of a) {
1645
+ const l = X(n[i], e[i]);
1646
+ if (!l.valid)
1647
+ return { valid: !1 };
1648
+ d[i] = l.data;
1649
+ }
1650
+ return { valid: !0, data: d };
1651
+ } else if (t === h.array && s === h.array) {
1652
+ if (n.length !== e.length)
1653
+ return { valid: !1 };
1654
+ const r = [];
1655
+ for (let a = 0; a < n.length; a++) {
1656
+ const d = n[a], i = e[a], l = X(d, i);
1657
+ if (!l.valid)
1658
+ return { valid: !1 };
1659
+ r.push(l.data);
1660
+ }
1661
+ return { valid: !0, data: r };
1662
+ } else return t === h.date && s === h.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
1663
+ }
1664
+ class W extends g {
1665
+ _parse(e) {
1666
+ const { status: t, ctx: s } = this._processInputParams(e), r = (a, d) => {
1667
+ if (re(a) || re(d))
1668
+ return p;
1669
+ const i = X(a.value, d.value);
1670
+ return i.valid ? ((ae(a) || ae(d)) && t.dirty(), { status: t.value, value: i.data }) : (u(s, {
1671
+ code: c.invalid_intersection_types
1672
+ }), p);
1673
+ };
1674
+ return s.common.async ? Promise.all([
1675
+ this._def.left._parseAsync({
1676
+ data: s.data,
1677
+ path: s.path,
1678
+ parent: s
1679
+ }),
1680
+ this._def.right._parseAsync({
1681
+ data: s.data,
1682
+ path: s.path,
1683
+ parent: s
1684
+ })
1685
+ ]).then(([a, d]) => r(a, d)) : r(this._def.left._parseSync({
1686
+ data: s.data,
1687
+ path: s.path,
1688
+ parent: s
1689
+ }), this._def.right._parseSync({
1690
+ data: s.data,
1691
+ path: s.path,
1692
+ parent: s
1693
+ }));
1694
+ }
1695
+ }
1696
+ W.create = (n, e, t) => new W({
1697
+ left: n,
1698
+ right: e,
1699
+ typeName: f.ZodIntersection,
1700
+ ..._(t)
1701
+ });
1702
+ class N extends g {
1703
+ _parse(e) {
1704
+ const { status: t, ctx: s } = this._processInputParams(e);
1705
+ if (s.parsedType !== h.array)
1706
+ return u(s, {
1707
+ code: c.invalid_type,
1708
+ expected: h.array,
1709
+ received: s.parsedType
1710
+ }), p;
1711
+ if (s.data.length < this._def.items.length)
1712
+ return u(s, {
1713
+ code: c.too_small,
1714
+ minimum: this._def.items.length,
1715
+ inclusive: !0,
1716
+ exact: !1,
1717
+ type: "array"
1718
+ }), p;
1719
+ !this._def.rest && s.data.length > this._def.items.length && (u(s, {
1720
+ code: c.too_big,
1721
+ maximum: this._def.items.length,
1722
+ inclusive: !0,
1723
+ exact: !1,
1724
+ type: "array"
1725
+ }), t.dirty());
1726
+ const a = [...s.data].map((d, i) => {
1727
+ const l = this._def.items[i] || this._def.rest;
1728
+ return l ? l._parse(new C(s, d, s.path, i)) : null;
1729
+ }).filter((d) => !!d);
1730
+ return s.common.async ? Promise.all(a).then((d) => k.mergeArray(t, d)) : k.mergeArray(t, a);
1731
+ }
1732
+ get items() {
1733
+ return this._def.items;
1734
+ }
1735
+ rest(e) {
1736
+ return new N({
1737
+ ...this._def,
1738
+ rest: e
1739
+ });
1740
+ }
1741
+ }
1742
+ N.create = (n, e) => {
1743
+ if (!Array.isArray(n))
1744
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
1745
+ return new N({
1746
+ items: n,
1747
+ typeName: f.ZodTuple,
1748
+ rest: null,
1749
+ ..._(e)
1750
+ });
1751
+ };
1752
+ class J extends g {
1753
+ get keySchema() {
1754
+ return this._def.keyType;
1755
+ }
1756
+ get valueSchema() {
1757
+ return this._def.valueType;
1758
+ }
1759
+ _parse(e) {
1760
+ const { status: t, ctx: s } = this._processInputParams(e);
1761
+ if (s.parsedType !== h.object)
1762
+ return u(s, {
1763
+ code: c.invalid_type,
1764
+ expected: h.object,
1765
+ received: s.parsedType
1766
+ }), p;
1767
+ const r = [], a = this._def.keyType, d = this._def.valueType;
1768
+ for (const i in s.data)
1769
+ r.push({
1770
+ key: a._parse(new C(s, i, s.path, i)),
1771
+ value: d._parse(new C(s, s.data[i], s.path, i)),
1772
+ alwaysSet: i in s.data
1773
+ });
1774
+ return s.common.async ? k.mergeObjectAsync(t, r) : k.mergeObjectSync(t, r);
1775
+ }
1776
+ get element() {
1777
+ return this._def.valueType;
1778
+ }
1779
+ static create(e, t, s) {
1780
+ return t instanceof g ? new J({
1781
+ keyType: e,
1782
+ valueType: t,
1783
+ typeName: f.ZodRecord,
1784
+ ..._(s)
1785
+ }) : new J({
1786
+ keyType: b.create(),
1787
+ valueType: e,
1788
+ typeName: f.ZodRecord,
1789
+ ..._(t)
1790
+ });
1791
+ }
1792
+ }
1793
+ class ue extends g {
1794
+ get keySchema() {
1795
+ return this._def.keyType;
1796
+ }
1797
+ get valueSchema() {
1798
+ return this._def.valueType;
1799
+ }
1800
+ _parse(e) {
1801
+ const { status: t, ctx: s } = this._processInputParams(e);
1802
+ if (s.parsedType !== h.map)
1803
+ return u(s, {
1804
+ code: c.invalid_type,
1805
+ expected: h.map,
1806
+ received: s.parsedType
1807
+ }), p;
1808
+ const r = this._def.keyType, a = this._def.valueType, d = [...s.data.entries()].map(([i, l], m) => ({
1809
+ key: r._parse(new C(s, i, s.path, [m, "key"])),
1810
+ value: a._parse(new C(s, l, s.path, [m, "value"]))
1811
+ }));
1812
+ if (s.common.async) {
1813
+ const i = /* @__PURE__ */ new Map();
1814
+ return Promise.resolve().then(async () => {
1815
+ for (const l of d) {
1816
+ const m = await l.key, y = await l.value;
1817
+ if (m.status === "aborted" || y.status === "aborted")
1818
+ return p;
1819
+ (m.status === "dirty" || y.status === "dirty") && t.dirty(), i.set(m.value, y.value);
1820
+ }
1821
+ return { status: t.value, value: i };
1822
+ });
1823
+ } else {
1824
+ const i = /* @__PURE__ */ new Map();
1825
+ for (const l of d) {
1826
+ const m = l.key, y = l.value;
1827
+ if (m.status === "aborted" || y.status === "aborted")
1828
+ return p;
1829
+ (m.status === "dirty" || y.status === "dirty") && t.dirty(), i.set(m.value, y.value);
1830
+ }
1831
+ return { status: t.value, value: i };
1832
+ }
1833
+ }
1834
+ }
1835
+ ue.create = (n, e, t) => new ue({
1836
+ valueType: e,
1837
+ keyType: n,
1838
+ typeName: f.ZodMap,
1839
+ ..._(t)
1840
+ });
1841
+ class D extends g {
1842
+ _parse(e) {
1843
+ const { status: t, ctx: s } = this._processInputParams(e);
1844
+ if (s.parsedType !== h.set)
1845
+ return u(s, {
1846
+ code: c.invalid_type,
1847
+ expected: h.set,
1848
+ received: s.parsedType
1849
+ }), p;
1850
+ const r = this._def;
1851
+ r.minSize !== null && s.data.size < r.minSize.value && (u(s, {
1852
+ code: c.too_small,
1853
+ minimum: r.minSize.value,
1854
+ type: "set",
1855
+ inclusive: !0,
1856
+ exact: !1,
1857
+ message: r.minSize.message
1858
+ }), t.dirty()), r.maxSize !== null && s.data.size > r.maxSize.value && (u(s, {
1859
+ code: c.too_big,
1860
+ maximum: r.maxSize.value,
1861
+ type: "set",
1862
+ inclusive: !0,
1863
+ exact: !1,
1864
+ message: r.maxSize.message
1865
+ }), t.dirty());
1866
+ const a = this._def.valueType;
1867
+ function d(l) {
1868
+ const m = /* @__PURE__ */ new Set();
1869
+ for (const y of l) {
1870
+ if (y.status === "aborted")
1871
+ return p;
1872
+ y.status === "dirty" && t.dirty(), m.add(y.value);
1873
+ }
1874
+ return { status: t.value, value: m };
1875
+ }
1876
+ const i = [...s.data.values()].map((l, m) => a._parse(new C(s, l, s.path, m)));
1877
+ return s.common.async ? Promise.all(i).then((l) => d(l)) : d(i);
1878
+ }
1879
+ min(e, t) {
1880
+ return new D({
1881
+ ...this._def,
1882
+ minSize: { value: e, message: o.toString(t) }
1883
+ });
1884
+ }
1885
+ max(e, t) {
1886
+ return new D({
1887
+ ...this._def,
1888
+ maxSize: { value: e, message: o.toString(t) }
1889
+ });
1890
+ }
1891
+ size(e, t) {
1892
+ return this.min(e, t).max(e, t);
1893
+ }
1894
+ nonempty(e) {
1895
+ return this.min(1, e);
1896
+ }
1897
+ }
1898
+ D.create = (n, e) => new D({
1899
+ valueType: n,
1900
+ minSize: null,
1901
+ maxSize: null,
1902
+ typeName: f.ZodSet,
1903
+ ..._(e)
1904
+ });
1905
+ class oe extends g {
1906
+ get schema() {
1907
+ return this._def.getter();
1908
+ }
1909
+ _parse(e) {
1910
+ const { ctx: t } = this._processInputParams(e);
1911
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
1912
+ }
1913
+ }
1914
+ oe.create = (n, e) => new oe({
1915
+ getter: n,
1916
+ typeName: f.ZodLazy,
1917
+ ..._(e)
1918
+ });
1919
+ class le extends g {
1920
+ _parse(e) {
1921
+ if (e.data !== this._def.value) {
1922
+ const t = this._getOrReturnCtx(e);
1923
+ return u(t, {
1924
+ received: t.data,
1925
+ code: c.invalid_literal,
1926
+ expected: this._def.value
1927
+ }), p;
1928
+ }
1929
+ return { status: "valid", value: e.data };
1930
+ }
1931
+ get value() {
1932
+ return this._def.value;
1933
+ }
1934
+ }
1935
+ le.create = (n, e) => new le({
1936
+ value: n,
1937
+ typeName: f.ZodLiteral,
1938
+ ..._(e)
1939
+ });
1940
+ function _e(n, e) {
1941
+ return new L({
1942
+ values: n,
1943
+ typeName: f.ZodEnum,
1944
+ ..._(e)
1945
+ });
1946
+ }
1947
+ class L extends g {
1948
+ _parse(e) {
1949
+ if (typeof e.data != "string") {
1950
+ const t = this._getOrReturnCtx(e), s = this._def.values;
1951
+ return u(t, {
1952
+ expected: v.joinValues(s),
1953
+ received: t.parsedType,
1954
+ code: c.invalid_type
1955
+ }), p;
1956
+ }
1957
+ if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
1958
+ const t = this._getOrReturnCtx(e), s = this._def.values;
1959
+ return u(t, {
1960
+ received: t.data,
1961
+ code: c.invalid_enum_value,
1962
+ options: s
1963
+ }), p;
1964
+ }
1965
+ return w(e.data);
1966
+ }
1967
+ get options() {
1968
+ return this._def.values;
1969
+ }
1970
+ get enum() {
1971
+ const e = {};
1972
+ for (const t of this._def.values)
1973
+ e[t] = t;
1974
+ return e;
1975
+ }
1976
+ get Values() {
1977
+ const e = {};
1978
+ for (const t of this._def.values)
1979
+ e[t] = t;
1980
+ return e;
1981
+ }
1982
+ get Enum() {
1983
+ const e = {};
1984
+ for (const t of this._def.values)
1985
+ e[t] = t;
1986
+ return e;
1987
+ }
1988
+ extract(e, t = this._def) {
1989
+ return L.create(e, {
1990
+ ...this._def,
1991
+ ...t
1992
+ });
1993
+ }
1994
+ exclude(e, t = this._def) {
1995
+ return L.create(this.options.filter((s) => !e.includes(s)), {
1996
+ ...this._def,
1997
+ ...t
1998
+ });
1999
+ }
2000
+ }
2001
+ L.create = _e;
2002
+ class he extends g {
2003
+ _parse(e) {
2004
+ const t = v.getValidEnumValues(this._def.values), s = this._getOrReturnCtx(e);
2005
+ if (s.parsedType !== h.string && s.parsedType !== h.number) {
2006
+ const r = v.objectValues(t);
2007
+ return u(s, {
2008
+ expected: v.joinValues(r),
2009
+ received: s.parsedType,
2010
+ code: c.invalid_type
2011
+ }), p;
2012
+ }
2013
+ if (this._cache || (this._cache = new Set(v.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2014
+ const r = v.objectValues(t);
2015
+ return u(s, {
2016
+ received: s.data,
2017
+ code: c.invalid_enum_value,
2018
+ options: r
2019
+ }), p;
2020
+ }
2021
+ return w(e.data);
2022
+ }
2023
+ get enum() {
2024
+ return this._def.values;
2025
+ }
2026
+ }
2027
+ he.create = (n, e) => new he({
2028
+ values: n,
2029
+ typeName: f.ZodNativeEnum,
2030
+ ..._(e)
2031
+ });
2032
+ class Y extends g {
2033
+ unwrap() {
2034
+ return this._def.type;
2035
+ }
2036
+ _parse(e) {
2037
+ const { ctx: t } = this._processInputParams(e);
2038
+ if (t.parsedType !== h.promise && t.common.async === !1)
2039
+ return u(t, {
2040
+ code: c.invalid_type,
2041
+ expected: h.promise,
2042
+ received: t.parsedType
2043
+ }), p;
2044
+ const s = t.parsedType === h.promise ? t.data : Promise.resolve(t.data);
2045
+ return w(s.then((r) => this._def.type.parseAsync(r, {
2046
+ path: t.path,
2047
+ errorMap: t.common.contextualErrorMap
2048
+ })));
2049
+ }
2050
+ }
2051
+ Y.create = (n, e) => new Y({
2052
+ type: n,
2053
+ typeName: f.ZodPromise,
2054
+ ..._(e)
2055
+ });
2056
+ class V extends g {
2057
+ innerType() {
2058
+ return this._def.schema;
2059
+ }
2060
+ sourceType() {
2061
+ return this._def.schema._def.typeName === f.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2062
+ }
2063
+ _parse(e) {
2064
+ const { status: t, ctx: s } = this._processInputParams(e), r = this._def.effect || null, a = {
2065
+ addIssue: (d) => {
2066
+ u(s, d), d.fatal ? t.abort() : t.dirty();
2067
+ },
2068
+ get path() {
2069
+ return s.path;
2070
+ }
2071
+ };
2072
+ if (a.addIssue = a.addIssue.bind(a), r.type === "preprocess") {
2073
+ const d = r.transform(s.data, a);
2074
+ if (s.common.async)
2075
+ return Promise.resolve(d).then(async (i) => {
2076
+ if (t.value === "aborted")
2077
+ return p;
2078
+ const l = await this._def.schema._parseAsync({
2079
+ data: i,
2080
+ path: s.path,
2081
+ parent: s
2082
+ });
2083
+ return l.status === "aborted" ? p : l.status === "dirty" ? M(l.value) : t.value === "dirty" ? M(l.value) : l;
2084
+ });
2085
+ {
2086
+ if (t.value === "aborted")
2087
+ return p;
2088
+ const i = this._def.schema._parseSync({
2089
+ data: d,
2090
+ path: s.path,
2091
+ parent: s
2092
+ });
2093
+ return i.status === "aborted" ? p : i.status === "dirty" ? M(i.value) : t.value === "dirty" ? M(i.value) : i;
2094
+ }
2095
+ }
2096
+ if (r.type === "refinement") {
2097
+ const d = (i) => {
2098
+ const l = r.refinement(i, a);
2099
+ if (s.common.async)
2100
+ return Promise.resolve(l);
2101
+ if (l instanceof Promise)
2102
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2103
+ return i;
2104
+ };
2105
+ if (s.common.async === !1) {
2106
+ const i = this._def.schema._parseSync({
2107
+ data: s.data,
2108
+ path: s.path,
2109
+ parent: s
2110
+ });
2111
+ return i.status === "aborted" ? p : (i.status === "dirty" && t.dirty(), d(i.value), { status: t.value, value: i.value });
2112
+ } else
2113
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((i) => i.status === "aborted" ? p : (i.status === "dirty" && t.dirty(), d(i.value).then(() => ({ status: t.value, value: i.value }))));
2114
+ }
2115
+ if (r.type === "transform")
2116
+ if (s.common.async === !1) {
2117
+ const d = this._def.schema._parseSync({
2118
+ data: s.data,
2119
+ path: s.path,
2120
+ parent: s
2121
+ });
2122
+ if (!I(d))
2123
+ return p;
2124
+ const i = r.transform(d.value, a);
2125
+ if (i instanceof Promise)
2126
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2127
+ return { status: t.value, value: i };
2128
+ } else
2129
+ return this._def.schema._parseAsync({ data: s.data, path: s.path, parent: s }).then((d) => I(d) ? Promise.resolve(r.transform(d.value, a)).then((i) => ({
2130
+ status: t.value,
2131
+ value: i
2132
+ })) : p);
2133
+ v.assertNever(r);
2134
+ }
2135
+ }
2136
+ V.create = (n, e, t) => new V({
2137
+ schema: n,
2138
+ typeName: f.ZodEffects,
2139
+ effect: e,
2140
+ ..._(t)
2141
+ });
2142
+ V.createWithPreprocess = (n, e, t) => new V({
2143
+ schema: e,
2144
+ effect: { type: "preprocess", transform: n },
2145
+ typeName: f.ZodEffects,
2146
+ ..._(t)
2147
+ });
2148
+ class A extends g {
2149
+ _parse(e) {
2150
+ return this._getType(e) === h.undefined ? w(void 0) : this._def.innerType._parse(e);
2151
+ }
2152
+ unwrap() {
2153
+ return this._def.innerType;
2154
+ }
2155
+ }
2156
+ A.create = (n, e) => new A({
2157
+ innerType: n,
2158
+ typeName: f.ZodOptional,
2159
+ ..._(e)
2160
+ });
2161
+ class z extends g {
2162
+ _parse(e) {
2163
+ return this._getType(e) === h.null ? w(null) : this._def.innerType._parse(e);
2164
+ }
2165
+ unwrap() {
2166
+ return this._def.innerType;
2167
+ }
2168
+ }
2169
+ z.create = (n, e) => new z({
2170
+ innerType: n,
2171
+ typeName: f.ZodNullable,
2172
+ ..._(e)
2173
+ });
2174
+ class K extends g {
2175
+ _parse(e) {
2176
+ const { ctx: t } = this._processInputParams(e);
2177
+ let s = t.data;
2178
+ return t.parsedType === h.undefined && (s = this._def.defaultValue()), this._def.innerType._parse({
2179
+ data: s,
2180
+ path: t.path,
2181
+ parent: t
2182
+ });
2183
+ }
2184
+ removeDefault() {
2185
+ return this._def.innerType;
2186
+ }
2187
+ }
2188
+ K.create = (n, e) => new K({
2189
+ innerType: n,
2190
+ typeName: f.ZodDefault,
2191
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2192
+ ..._(e)
2193
+ });
2194
+ class ee extends g {
2195
+ _parse(e) {
2196
+ const { ctx: t } = this._processInputParams(e), s = {
2197
+ ...t,
2198
+ common: {
2199
+ ...t.common,
2200
+ issues: []
2201
+ }
2202
+ }, r = this._def.innerType._parse({
2203
+ data: s.data,
2204
+ path: s.path,
2205
+ parent: {
2206
+ ...s
2207
+ }
2208
+ });
2209
+ return U(r) ? r.then((a) => ({
2210
+ status: "valid",
2211
+ value: a.status === "valid" ? a.value : this._def.catchValue({
2212
+ get error() {
2213
+ return new $(s.common.issues);
2214
+ },
2215
+ input: s.data
2216
+ })
2217
+ })) : {
2218
+ status: "valid",
2219
+ value: r.status === "valid" ? r.value : this._def.catchValue({
2220
+ get error() {
2221
+ return new $(s.common.issues);
2222
+ },
2223
+ input: s.data
2224
+ })
2225
+ };
2226
+ }
2227
+ removeCatch() {
2228
+ return this._def.innerType;
2229
+ }
2230
+ }
2231
+ ee.create = (n, e) => new ee({
2232
+ innerType: n,
2233
+ typeName: f.ZodCatch,
2234
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2235
+ ..._(e)
2236
+ });
2237
+ class fe extends g {
2238
+ _parse(e) {
2239
+ if (this._getType(e) !== h.nan) {
2240
+ const s = this._getOrReturnCtx(e);
2241
+ return u(s, {
2242
+ code: c.invalid_type,
2243
+ expected: h.nan,
2244
+ received: s.parsedType
2245
+ }), p;
2246
+ }
2247
+ return { status: "valid", value: e.data };
2248
+ }
2249
+ }
2250
+ fe.create = (n) => new fe({
2251
+ typeName: f.ZodNaN,
2252
+ ..._(n)
2253
+ });
2254
+ class $e extends g {
2255
+ _parse(e) {
2256
+ const { ctx: t } = this._processInputParams(e), s = t.data;
2257
+ return this._def.type._parse({
2258
+ data: s,
2259
+ path: t.path,
2260
+ parent: t
2261
+ });
2262
+ }
2263
+ unwrap() {
2264
+ return this._def.type;
2265
+ }
2266
+ }
2267
+ class se extends g {
2268
+ _parse(e) {
2269
+ const { status: t, ctx: s } = this._processInputParams(e);
2270
+ if (s.common.async)
2271
+ return (async () => {
2272
+ const a = await this._def.in._parseAsync({
2273
+ data: s.data,
2274
+ path: s.path,
2275
+ parent: s
2276
+ });
2277
+ return a.status === "aborted" ? p : a.status === "dirty" ? (t.dirty(), M(a.value)) : this._def.out._parseAsync({
2278
+ data: a.value,
2279
+ path: s.path,
2280
+ parent: s
2281
+ });
2282
+ })();
2283
+ {
2284
+ const r = this._def.in._parseSync({
2285
+ data: s.data,
2286
+ path: s.path,
2287
+ parent: s
2288
+ });
2289
+ return r.status === "aborted" ? p : r.status === "dirty" ? (t.dirty(), {
2290
+ status: "dirty",
2291
+ value: r.value
2292
+ }) : this._def.out._parseSync({
2293
+ data: r.value,
2294
+ path: s.path,
2295
+ parent: s
2296
+ });
2297
+ }
2298
+ }
2299
+ static create(e, t) {
2300
+ return new se({
2301
+ in: e,
2302
+ out: t,
2303
+ typeName: f.ZodPipeline
2304
+ });
2305
+ }
2306
+ }
2307
+ class te extends g {
2308
+ _parse(e) {
2309
+ const t = this._def.innerType._parse(e), s = (r) => (I(r) && (r.value = Object.freeze(r.value)), r);
2310
+ return U(t) ? t.then((r) => s(r)) : s(t);
2311
+ }
2312
+ unwrap() {
2313
+ return this._def.innerType;
2314
+ }
2315
+ }
2316
+ te.create = (n, e) => new te({
2317
+ innerType: n,
2318
+ typeName: f.ZodReadonly,
2319
+ ..._(e)
2320
+ });
2321
+ var f;
2322
+ (function(n) {
2323
+ n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
2324
+ })(f || (f = {}));
2325
+ const We = b.create, Je = O.create;
2326
+ R.create;
2327
+ const Ye = B.create;
2328
+ E.create;
2329
+ const qe = H.create, He = G.create, Ge = Q.create;
2330
+ S.create;
2331
+ const Qe = T.create, Xe = x.create, Ke = F.create;
2332
+ W.create;
2333
+ N.create;
2334
+ const et = J.create, tt = L.create;
2335
+ Y.create;
2336
+ A.create;
2337
+ z.create;
2338
+ const st = {
2339
+ string: (n) => b.create({ ...n, coerce: !0 }),
2340
+ number: (n) => O.create({ ...n, coerce: !0 }),
2341
+ boolean: (n) => B.create({
2342
+ ...n,
2343
+ coerce: !0
2344
+ }),
2345
+ bigint: (n) => R.create({ ...n, coerce: !0 }),
2346
+ date: (n) => E.create({ ...n, coerce: !0 })
2347
+ };
2348
+ export {
2349
+ g as Schema,
2350
+ G as ZodAny,
2351
+ T as ZodArray,
2352
+ R as ZodBigInt,
2353
+ B as ZodBoolean,
2354
+ $e as ZodBranded,
2355
+ ee as ZodCatch,
2356
+ E as ZodDate,
2357
+ K as ZodDefault,
2358
+ V as ZodEffects,
2359
+ L as ZodEnum,
2360
+ f as ZodFirstPartyTypeKind,
2361
+ W as ZodIntersection,
2362
+ oe as ZodLazy,
2363
+ le as ZodLiteral,
2364
+ ue as ZodMap,
2365
+ fe as ZodNaN,
2366
+ he as ZodNativeEnum,
2367
+ S as ZodNever,
2368
+ H as ZodNull,
2369
+ z as ZodNullable,
2370
+ O as ZodNumber,
2371
+ x as ZodObject,
2372
+ A as ZodOptional,
2373
+ se as ZodPipeline,
2374
+ Y as ZodPromise,
2375
+ te as ZodReadonly,
2376
+ J as ZodRecord,
2377
+ g as ZodSchema,
2378
+ D as ZodSet,
2379
+ b as ZodString,
2380
+ ie as ZodSymbol,
2381
+ V as ZodTransformer,
2382
+ N as ZodTuple,
2383
+ g as ZodType,
2384
+ de as ZodUndefined,
2385
+ F as ZodUnion,
2386
+ Q as ZodUnknown,
2387
+ ce as ZodVoid,
2388
+ He as any,
2389
+ Qe as array,
2390
+ Ye as boolean,
2391
+ st as coerce,
2392
+ Le as datetimeRegex,
2393
+ tt as enum,
2394
+ qe as null,
2395
+ Je as number,
2396
+ Xe as object,
2397
+ et as record,
2398
+ We as string,
2399
+ Ke as union,
2400
+ Ge as unknown
2401
+ };
2402
+ //# sourceMappingURL=types.mjs.map