@geekmidas/cli 0.0.26 → 0.1.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 (142) hide show
  1. package/FUNCTION_CRON_SUPPORT.md +266 -0
  2. package/README.md +21 -4
  3. package/dist/CronGenerator-ClbRcmz_.mjs +53 -0
  4. package/dist/CronGenerator-ClbRcmz_.mjs.map +1 -0
  5. package/dist/CronGenerator-Ctl4USy4.cjs +59 -0
  6. package/dist/CronGenerator-Ctl4USy4.cjs.map +1 -0
  7. package/dist/EndpointGenerator-Dj7AumHi.cjs +164 -0
  8. package/dist/EndpointGenerator-Dj7AumHi.cjs.map +1 -0
  9. package/dist/EndpointGenerator-uBA1ixUw.mjs +158 -0
  10. package/dist/EndpointGenerator-uBA1ixUw.mjs.map +1 -0
  11. package/dist/FunctionGenerator-DN681IUn.cjs +58 -0
  12. package/dist/FunctionGenerator-DN681IUn.cjs.map +1 -0
  13. package/dist/FunctionGenerator-crAa-JC7.mjs +52 -0
  14. package/dist/FunctionGenerator-crAa-JC7.mjs.map +1 -0
  15. package/dist/Generator-C3tYSTQY.cjs +47 -0
  16. package/dist/Generator-C3tYSTQY.cjs.map +1 -0
  17. package/dist/Generator-CDt4pB3W.mjs +41 -0
  18. package/dist/Generator-CDt4pB3W.mjs.map +1 -0
  19. package/dist/__tests__/config.spec.cjs +98 -0
  20. package/dist/__tests__/config.spec.cjs.map +1 -0
  21. package/dist/__tests__/config.spec.mjs +97 -0
  22. package/dist/__tests__/config.spec.mjs.map +1 -0
  23. package/dist/__tests__/test-helpers.cjs +14 -0
  24. package/dist/__tests__/test-helpers.mjs +4 -0
  25. package/dist/build/__tests__/index-new.spec.cjs +286 -0
  26. package/dist/build/__tests__/index-new.spec.cjs.map +1 -0
  27. package/dist/build/__tests__/index-new.spec.mjs +285 -0
  28. package/dist/build/__tests__/index-new.spec.mjs.map +1 -0
  29. package/dist/build/index.cjs +11 -0
  30. package/dist/build/index.mjs +11 -0
  31. package/dist/build/manifests.cjs +3 -0
  32. package/dist/build/manifests.mjs +3 -0
  33. package/dist/build/providerResolver.cjs +5 -0
  34. package/dist/build/providerResolver.mjs +3 -0
  35. package/dist/build/types.cjs +0 -0
  36. package/dist/build/types.mjs +0 -0
  37. package/dist/build-BZdwxCLW.mjs +64 -0
  38. package/dist/build-BZdwxCLW.mjs.map +1 -0
  39. package/dist/build-BfQFnU5-.cjs +70 -0
  40. package/dist/build-BfQFnU5-.cjs.map +1 -0
  41. package/dist/{chunk-CUT6urMc.cjs → chunk-CsX-DzYB.cjs} +12 -0
  42. package/dist/config-CXxYmz_o.mjs +30 -0
  43. package/dist/config-CXxYmz_o.mjs.map +1 -0
  44. package/dist/config-RcNESK0T.cjs +36 -0
  45. package/dist/config-RcNESK0T.cjs.map +1 -0
  46. package/dist/config.cjs +1 -1
  47. package/dist/config.mjs +1 -1
  48. package/dist/esm-9eeZntth.mjs +3777 -0
  49. package/dist/esm-9eeZntth.mjs.map +1 -0
  50. package/dist/esm-Crmo4h9t.cjs +4392 -0
  51. package/dist/esm-Crmo4h9t.cjs.map +1 -0
  52. package/dist/esm-CsJbr7gi.mjs +3 -0
  53. package/dist/esm-w09tAC4l.cjs +8 -0
  54. package/dist/generators/CronGenerator.cjs +4 -0
  55. package/dist/generators/CronGenerator.mjs +4 -0
  56. package/dist/generators/EndpointGenerator.cjs +4 -0
  57. package/dist/generators/EndpointGenerator.mjs +4 -0
  58. package/dist/generators/FunctionGenerator.cjs +4 -0
  59. package/dist/generators/FunctionGenerator.mjs +4 -0
  60. package/dist/generators/Generator.cjs +3 -0
  61. package/dist/generators/Generator.mjs +3 -0
  62. package/dist/generators/__tests__/CronGenerator.spec.cjs +216 -0
  63. package/dist/generators/__tests__/CronGenerator.spec.cjs.map +1 -0
  64. package/dist/generators/__tests__/CronGenerator.spec.mjs +215 -0
  65. package/dist/generators/__tests__/CronGenerator.spec.mjs.map +1 -0
  66. package/dist/generators/__tests__/EndpointGenerator.spec.cjs +182 -0
  67. package/dist/generators/__tests__/EndpointGenerator.spec.cjs.map +1 -0
  68. package/dist/generators/__tests__/EndpointGenerator.spec.mjs +181 -0
  69. package/dist/generators/__tests__/EndpointGenerator.spec.mjs.map +1 -0
  70. package/dist/generators/__tests__/FunctionGenerator.spec.cjs +152 -0
  71. package/dist/generators/__tests__/FunctionGenerator.spec.cjs.map +1 -0
  72. package/dist/generators/__tests__/FunctionGenerator.spec.mjs +151 -0
  73. package/dist/generators/__tests__/FunctionGenerator.spec.mjs.map +1 -0
  74. package/dist/generators/index.cjs +10 -0
  75. package/dist/generators/index.mjs +7 -0
  76. package/dist/generators-CsLujGXs.mjs +0 -0
  77. package/dist/generators-_pY7sHy1.cjs +0 -0
  78. package/dist/index.cjs +68 -26
  79. package/dist/index.cjs.map +1 -0
  80. package/dist/index.mjs +67 -25
  81. package/dist/index.mjs.map +1 -0
  82. package/dist/manifests-BTtfDMX8.cjs +26 -0
  83. package/dist/manifests-BTtfDMX8.cjs.map +1 -0
  84. package/dist/manifests-HX4z4kkz.mjs +20 -0
  85. package/dist/manifests-HX4z4kkz.mjs.map +1 -0
  86. package/dist/{openapi-CksVdkh2.mjs → openapi-BivnatiC.mjs} +8 -6
  87. package/dist/openapi-BivnatiC.mjs.map +1 -0
  88. package/dist/{openapi-D4QQJUPY.cjs → openapi-DW-qF3oW.cjs} +9 -7
  89. package/dist/openapi-DW-qF3oW.cjs.map +1 -0
  90. package/dist/{openapi-react-query-C1JLYUOs.cjs → openapi-react-query-J0BzBHhN.cjs} +4 -3
  91. package/dist/openapi-react-query-J0BzBHhN.cjs.map +1 -0
  92. package/dist/{openapi-react-query-DpT3XHFC.mjs → openapi-react-query-lgS7AVEz.mjs} +3 -2
  93. package/dist/openapi-react-query-lgS7AVEz.mjs.map +1 -0
  94. package/dist/openapi-react-query.cjs +1 -1
  95. package/dist/openapi-react-query.mjs +1 -1
  96. package/dist/openapi.cjs +4 -3
  97. package/dist/openapi.mjs +4 -3
  98. package/dist/providerResolver-B_TjNF0_.mjs +96 -0
  99. package/dist/providerResolver-B_TjNF0_.mjs.map +1 -0
  100. package/dist/providerResolver-Cs-0YCaP.cjs +114 -0
  101. package/dist/providerResolver-Cs-0YCaP.cjs.map +1 -0
  102. package/dist/test-helpers-ARd8GDgx.cjs +199 -0
  103. package/dist/test-helpers-ARd8GDgx.cjs.map +1 -0
  104. package/dist/test-helpers-DdVBk23F.mjs +133 -0
  105. package/dist/test-helpers-DdVBk23F.mjs.map +1 -0
  106. package/examples/cron-example.ts +45 -0
  107. package/examples/function-example.ts +40 -0
  108. package/examples/gkm.config.json +22 -0
  109. package/examples/gkm.minimal.config.json +7 -0
  110. package/examples/gkm.production.config.json +27 -0
  111. package/package.json +35 -14
  112. package/src/__tests__/config.spec.ts +110 -0
  113. package/src/__tests__/test-helpers.ts +178 -0
  114. package/src/build/__tests__/index-new.spec.ts +578 -0
  115. package/src/build/index.ts +136 -0
  116. package/src/build/manifests.ts +32 -0
  117. package/src/build/providerResolver.ts +184 -0
  118. package/src/build/types.ts +37 -0
  119. package/src/config.ts +14 -6
  120. package/src/generators/CronGenerator.ts +97 -0
  121. package/src/generators/EndpointGenerator.ts +290 -0
  122. package/src/generators/FunctionGenerator.ts +96 -0
  123. package/src/generators/Generator.ts +95 -0
  124. package/src/generators/__tests__/CronGenerator.spec.ts +445 -0
  125. package/src/generators/__tests__/EndpointGenerator.spec.ts +372 -0
  126. package/src/generators/__tests__/FunctionGenerator.spec.ts +257 -0
  127. package/src/generators/index.ts +8 -0
  128. package/src/index.ts +57 -22
  129. package/src/openapi.ts +4 -3
  130. package/src/types.ts +73 -2
  131. package/dist/build-BTggTCYL.cjs +0 -176
  132. package/dist/build-Ca4P6_lY.mjs +0 -170
  133. package/dist/build.cjs +0 -5
  134. package/dist/build.mjs +0 -5
  135. package/dist/config-BNqUMsvc.cjs +0 -24
  136. package/dist/config-BciAdY6_.mjs +0 -18
  137. package/dist/loadEndpoints-BBIavB9h.cjs +0 -37
  138. package/dist/loadEndpoints-DAZ53Og2.mjs +0 -31
  139. package/dist/loadEndpoints.cjs +0 -3
  140. package/dist/loadEndpoints.mjs +0 -3
  141. package/src/build.ts +0 -305
  142. package/src/loadEndpoints.ts +0 -48
@@ -0,0 +1,4392 @@
1
+ const require_chunk = require('./chunk-CsX-DzYB.cjs');
2
+
3
+ //#region ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/helpers/util.js
4
+ var util;
5
+ (function(util$1) {
6
+ util$1.assertEqual = (_) => {};
7
+ function assertIs(_arg) {}
8
+ util$1.assertIs = assertIs;
9
+ function assertNever(_x) {
10
+ throw new Error();
11
+ }
12
+ util$1.assertNever = assertNever;
13
+ util$1.arrayToEnum = (items) => {
14
+ const obj = {};
15
+ for (const item of items) obj[item] = item;
16
+ return obj;
17
+ };
18
+ util$1.getValidEnumValues = (obj) => {
19
+ const validKeys = util$1.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
20
+ const filtered = {};
21
+ for (const k of validKeys) filtered[k] = obj[k];
22
+ return util$1.objectValues(filtered);
23
+ };
24
+ util$1.objectValues = (obj) => {
25
+ return util$1.objectKeys(obj).map(function(e) {
26
+ return obj[e];
27
+ });
28
+ };
29
+ util$1.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
30
+ const keys = [];
31
+ for (const key in object) if (Object.prototype.hasOwnProperty.call(object, key)) keys.push(key);
32
+ return keys;
33
+ };
34
+ util$1.find = (arr, checker) => {
35
+ for (const item of arr) if (checker(item)) return item;
36
+ return void 0;
37
+ };
38
+ util$1.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && Number.isFinite(val) && Math.floor(val) === val;
39
+ function joinValues(array, separator = " | ") {
40
+ return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
41
+ }
42
+ util$1.joinValues = joinValues;
43
+ util$1.jsonStringifyReplacer = (_, value) => {
44
+ if (typeof value === "bigint") return value.toString();
45
+ return value;
46
+ };
47
+ })(util || (util = {}));
48
+ var objectUtil;
49
+ (function(objectUtil$1) {
50
+ objectUtil$1.mergeShapes = (first, second) => {
51
+ return {
52
+ ...first,
53
+ ...second
54
+ };
55
+ };
56
+ })(objectUtil || (objectUtil = {}));
57
+ const ZodParsedType = util.arrayToEnum([
58
+ "string",
59
+ "nan",
60
+ "number",
61
+ "integer",
62
+ "float",
63
+ "boolean",
64
+ "date",
65
+ "bigint",
66
+ "symbol",
67
+ "function",
68
+ "undefined",
69
+ "null",
70
+ "array",
71
+ "object",
72
+ "unknown",
73
+ "promise",
74
+ "void",
75
+ "never",
76
+ "map",
77
+ "set"
78
+ ]);
79
+ const getParsedType = (data) => {
80
+ const t = typeof data;
81
+ switch (t) {
82
+ case "undefined": return ZodParsedType.undefined;
83
+ case "string": return ZodParsedType.string;
84
+ case "number": return Number.isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
85
+ case "boolean": return ZodParsedType.boolean;
86
+ case "function": return ZodParsedType.function;
87
+ case "bigint": return ZodParsedType.bigint;
88
+ case "symbol": return ZodParsedType.symbol;
89
+ case "object":
90
+ if (Array.isArray(data)) return ZodParsedType.array;
91
+ if (data === null) return ZodParsedType.null;
92
+ if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") return ZodParsedType.promise;
93
+ if (typeof Map !== "undefined" && data instanceof Map) return ZodParsedType.map;
94
+ if (typeof Set !== "undefined" && data instanceof Set) return ZodParsedType.set;
95
+ if (typeof Date !== "undefined" && data instanceof Date) return ZodParsedType.date;
96
+ return ZodParsedType.object;
97
+ default: return ZodParsedType.unknown;
98
+ }
99
+ };
100
+
101
+ //#endregion
102
+ //#region ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/ZodError.js
103
+ const ZodIssueCode = util.arrayToEnum([
104
+ "invalid_type",
105
+ "invalid_literal",
106
+ "custom",
107
+ "invalid_union",
108
+ "invalid_union_discriminator",
109
+ "invalid_enum_value",
110
+ "unrecognized_keys",
111
+ "invalid_arguments",
112
+ "invalid_return_type",
113
+ "invalid_date",
114
+ "invalid_string",
115
+ "too_small",
116
+ "too_big",
117
+ "invalid_intersection_types",
118
+ "not_multiple_of",
119
+ "not_finite"
120
+ ]);
121
+ const quotelessJson = (obj) => {
122
+ const json = JSON.stringify(obj, null, 2);
123
+ return json.replace(/"([^"]+)":/g, "$1:");
124
+ };
125
+ var ZodError = class ZodError extends Error {
126
+ get errors() {
127
+ return this.issues;
128
+ }
129
+ constructor(issues) {
130
+ super();
131
+ this.issues = [];
132
+ this.addIssue = (sub) => {
133
+ this.issues = [...this.issues, sub];
134
+ };
135
+ this.addIssues = (subs = []) => {
136
+ this.issues = [...this.issues, ...subs];
137
+ };
138
+ const actualProto = new.target.prototype;
139
+ if (Object.setPrototypeOf) Object.setPrototypeOf(this, actualProto);
140
+ else this.__proto__ = actualProto;
141
+ this.name = "ZodError";
142
+ this.issues = issues;
143
+ }
144
+ format(_mapper) {
145
+ const mapper = _mapper || function(issue) {
146
+ return issue.message;
147
+ };
148
+ const fieldErrors = { _errors: [] };
149
+ const processError = (error) => {
150
+ for (const issue of error.issues) if (issue.code === "invalid_union") issue.unionErrors.map(processError);
151
+ else if (issue.code === "invalid_return_type") processError(issue.returnTypeError);
152
+ else if (issue.code === "invalid_arguments") processError(issue.argumentsError);
153
+ else if (issue.path.length === 0) fieldErrors._errors.push(mapper(issue));
154
+ else {
155
+ let curr = fieldErrors;
156
+ let i = 0;
157
+ while (i < issue.path.length) {
158
+ const el = issue.path[i];
159
+ const terminal = i === issue.path.length - 1;
160
+ if (!terminal) curr[el] = curr[el] || { _errors: [] };
161
+ else {
162
+ curr[el] = curr[el] || { _errors: [] };
163
+ curr[el]._errors.push(mapper(issue));
164
+ }
165
+ curr = curr[el];
166
+ i++;
167
+ }
168
+ }
169
+ };
170
+ processError(this);
171
+ return fieldErrors;
172
+ }
173
+ static assert(value) {
174
+ if (!(value instanceof ZodError)) throw new Error(`Not a ZodError: ${value}`);
175
+ }
176
+ toString() {
177
+ return this.message;
178
+ }
179
+ get message() {
180
+ return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
181
+ }
182
+ get isEmpty() {
183
+ return this.issues.length === 0;
184
+ }
185
+ flatten(mapper = (issue) => issue.message) {
186
+ const fieldErrors = {};
187
+ const formErrors = [];
188
+ for (const sub of this.issues) if (sub.path.length > 0) {
189
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
190
+ fieldErrors[sub.path[0]].push(mapper(sub));
191
+ } else formErrors.push(mapper(sub));
192
+ return {
193
+ formErrors,
194
+ fieldErrors
195
+ };
196
+ }
197
+ get formErrors() {
198
+ return this.flatten();
199
+ }
200
+ };
201
+ ZodError.create = (issues) => {
202
+ const error = new ZodError(issues);
203
+ return error;
204
+ };
205
+
206
+ //#endregion
207
+ //#region ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/locales/en.js
208
+ const errorMap = (issue, _ctx) => {
209
+ let message;
210
+ switch (issue.code) {
211
+ case ZodIssueCode.invalid_type:
212
+ if (issue.received === ZodParsedType.undefined) message = "Required";
213
+ else message = `Expected ${issue.expected}, received ${issue.received}`;
214
+ break;
215
+ case ZodIssueCode.invalid_literal:
216
+ message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
217
+ break;
218
+ case ZodIssueCode.unrecognized_keys:
219
+ message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
220
+ break;
221
+ case ZodIssueCode.invalid_union:
222
+ message = `Invalid input`;
223
+ break;
224
+ case ZodIssueCode.invalid_union_discriminator:
225
+ message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
226
+ break;
227
+ case ZodIssueCode.invalid_enum_value:
228
+ message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
229
+ break;
230
+ case ZodIssueCode.invalid_arguments:
231
+ message = `Invalid function arguments`;
232
+ break;
233
+ case ZodIssueCode.invalid_return_type:
234
+ message = `Invalid function return type`;
235
+ break;
236
+ case ZodIssueCode.invalid_date:
237
+ message = `Invalid date`;
238
+ break;
239
+ case ZodIssueCode.invalid_string:
240
+ if (typeof issue.validation === "object") if ("includes" in issue.validation) {
241
+ message = `Invalid input: must include "${issue.validation.includes}"`;
242
+ if (typeof issue.validation.position === "number") message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
243
+ } else if ("startsWith" in issue.validation) message = `Invalid input: must start with "${issue.validation.startsWith}"`;
244
+ else if ("endsWith" in issue.validation) message = `Invalid input: must end with "${issue.validation.endsWith}"`;
245
+ else util.assertNever(issue.validation);
246
+ else if (issue.validation !== "regex") message = `Invalid ${issue.validation}`;
247
+ else message = "Invalid";
248
+ break;
249
+ case ZodIssueCode.too_small:
250
+ if (issue.type === "array") message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
251
+ else if (issue.type === "string") message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
252
+ else if (issue.type === "number") message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
253
+ else if (issue.type === "date") message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
254
+ else message = "Invalid input";
255
+ break;
256
+ case ZodIssueCode.too_big:
257
+ if (issue.type === "array") message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
258
+ else if (issue.type === "string") message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
259
+ else if (issue.type === "number") message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
260
+ else if (issue.type === "bigint") message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
261
+ else if (issue.type === "date") message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
262
+ else message = "Invalid input";
263
+ break;
264
+ case ZodIssueCode.custom:
265
+ message = `Invalid input`;
266
+ break;
267
+ case ZodIssueCode.invalid_intersection_types:
268
+ message = `Intersection results could not be merged`;
269
+ break;
270
+ case ZodIssueCode.not_multiple_of:
271
+ message = `Number must be a multiple of ${issue.multipleOf}`;
272
+ break;
273
+ case ZodIssueCode.not_finite:
274
+ message = "Number must be finite";
275
+ break;
276
+ default:
277
+ message = _ctx.defaultError;
278
+ util.assertNever(issue);
279
+ }
280
+ return { message };
281
+ };
282
+ var en_default = errorMap;
283
+
284
+ //#endregion
285
+ //#region ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/errors.js
286
+ let overrideErrorMap = en_default;
287
+ function setErrorMap(map) {
288
+ overrideErrorMap = map;
289
+ }
290
+ function getErrorMap() {
291
+ return overrideErrorMap;
292
+ }
293
+
294
+ //#endregion
295
+ //#region ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/helpers/parseUtil.js
296
+ const makeIssue = (params) => {
297
+ const { data, path, errorMaps, issueData } = params;
298
+ const fullPath = [...path, ...issueData.path || []];
299
+ const fullIssue = {
300
+ ...issueData,
301
+ path: fullPath
302
+ };
303
+ if (issueData.message !== void 0) return {
304
+ ...issueData,
305
+ path: fullPath,
306
+ message: issueData.message
307
+ };
308
+ let errorMessage = "";
309
+ const maps = errorMaps.filter((m) => !!m).slice().reverse();
310
+ for (const map of maps) errorMessage = map(fullIssue, {
311
+ data,
312
+ defaultError: errorMessage
313
+ }).message;
314
+ return {
315
+ ...issueData,
316
+ path: fullPath,
317
+ message: errorMessage
318
+ };
319
+ };
320
+ const EMPTY_PATH = [];
321
+ function addIssueToContext(ctx, issueData) {
322
+ const overrideMap = getErrorMap();
323
+ const issue = makeIssue({
324
+ issueData,
325
+ data: ctx.data,
326
+ path: ctx.path,
327
+ errorMaps: [
328
+ ctx.common.contextualErrorMap,
329
+ ctx.schemaErrorMap,
330
+ overrideMap,
331
+ overrideMap === en_default ? void 0 : en_default
332
+ ].filter((x) => !!x)
333
+ });
334
+ ctx.common.issues.push(issue);
335
+ }
336
+ var ParseStatus = class ParseStatus {
337
+ constructor() {
338
+ this.value = "valid";
339
+ }
340
+ dirty() {
341
+ if (this.value === "valid") this.value = "dirty";
342
+ }
343
+ abort() {
344
+ if (this.value !== "aborted") this.value = "aborted";
345
+ }
346
+ static mergeArray(status, results) {
347
+ const arrayValue = [];
348
+ for (const s of results) {
349
+ if (s.status === "aborted") return INVALID;
350
+ if (s.status === "dirty") status.dirty();
351
+ arrayValue.push(s.value);
352
+ }
353
+ return {
354
+ status: status.value,
355
+ value: arrayValue
356
+ };
357
+ }
358
+ static async mergeObjectAsync(status, pairs) {
359
+ const syncPairs = [];
360
+ for (const pair of pairs) {
361
+ const key = await pair.key;
362
+ const value = await pair.value;
363
+ syncPairs.push({
364
+ key,
365
+ value
366
+ });
367
+ }
368
+ return ParseStatus.mergeObjectSync(status, syncPairs);
369
+ }
370
+ static mergeObjectSync(status, pairs) {
371
+ const finalObject = {};
372
+ for (const pair of pairs) {
373
+ const { key, value } = pair;
374
+ if (key.status === "aborted") return INVALID;
375
+ if (value.status === "aborted") return INVALID;
376
+ if (key.status === "dirty") status.dirty();
377
+ if (value.status === "dirty") status.dirty();
378
+ if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) finalObject[key.value] = value.value;
379
+ }
380
+ return {
381
+ status: status.value,
382
+ value: finalObject
383
+ };
384
+ }
385
+ };
386
+ const INVALID = Object.freeze({ status: "aborted" });
387
+ const DIRTY = (value) => ({
388
+ status: "dirty",
389
+ value
390
+ });
391
+ const OK = (value) => ({
392
+ status: "valid",
393
+ value
394
+ });
395
+ const isAborted = (x) => x.status === "aborted";
396
+ const isDirty = (x) => x.status === "dirty";
397
+ const isValid = (x) => x.status === "valid";
398
+ const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
399
+
400
+ //#endregion
401
+ //#region ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/helpers/errorUtil.js
402
+ var errorUtil;
403
+ (function(errorUtil$1) {
404
+ errorUtil$1.errToObj = (message) => typeof message === "string" ? { message } : message || {};
405
+ errorUtil$1.toString = (message) => typeof message === "string" ? message : message?.message;
406
+ })(errorUtil || (errorUtil = {}));
407
+
408
+ //#endregion
409
+ //#region ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/types.js
410
+ var ParseInputLazyPath = class {
411
+ constructor(parent, value, path, key) {
412
+ this._cachedPath = [];
413
+ this.parent = parent;
414
+ this.data = value;
415
+ this._path = path;
416
+ this._key = key;
417
+ }
418
+ get path() {
419
+ if (!this._cachedPath.length) if (Array.isArray(this._key)) this._cachedPath.push(...this._path, ...this._key);
420
+ else this._cachedPath.push(...this._path, this._key);
421
+ return this._cachedPath;
422
+ }
423
+ };
424
+ const handleResult = (ctx, result) => {
425
+ if (isValid(result)) return {
426
+ success: true,
427
+ data: result.value
428
+ };
429
+ else {
430
+ if (!ctx.common.issues.length) throw new Error("Validation failed but no issues detected.");
431
+ return {
432
+ success: false,
433
+ get error() {
434
+ if (this._error) return this._error;
435
+ const error = new ZodError(ctx.common.issues);
436
+ this._error = error;
437
+ return this._error;
438
+ }
439
+ };
440
+ }
441
+ };
442
+ function processCreateParams(params) {
443
+ if (!params) return {};
444
+ const { errorMap: errorMap$1, invalid_type_error, required_error, description } = params;
445
+ if (errorMap$1 && (invalid_type_error || required_error)) throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
446
+ if (errorMap$1) return {
447
+ errorMap: errorMap$1,
448
+ description
449
+ };
450
+ const customMap = (iss, ctx) => {
451
+ const { message } = params;
452
+ if (iss.code === "invalid_enum_value") return { message: message ?? ctx.defaultError };
453
+ if (typeof ctx.data === "undefined") return { message: message ?? required_error ?? ctx.defaultError };
454
+ if (iss.code !== "invalid_type") return { message: ctx.defaultError };
455
+ return { message: message ?? invalid_type_error ?? ctx.defaultError };
456
+ };
457
+ return {
458
+ errorMap: customMap,
459
+ description
460
+ };
461
+ }
462
+ var ZodType = class {
463
+ get description() {
464
+ return this._def.description;
465
+ }
466
+ _getType(input) {
467
+ return getParsedType(input.data);
468
+ }
469
+ _getOrReturnCtx(input, ctx) {
470
+ return ctx || {
471
+ common: input.parent.common,
472
+ data: input.data,
473
+ parsedType: getParsedType(input.data),
474
+ schemaErrorMap: this._def.errorMap,
475
+ path: input.path,
476
+ parent: input.parent
477
+ };
478
+ }
479
+ _processInputParams(input) {
480
+ return {
481
+ status: new ParseStatus(),
482
+ ctx: {
483
+ common: input.parent.common,
484
+ data: input.data,
485
+ parsedType: getParsedType(input.data),
486
+ schemaErrorMap: this._def.errorMap,
487
+ path: input.path,
488
+ parent: input.parent
489
+ }
490
+ };
491
+ }
492
+ _parseSync(input) {
493
+ const result = this._parse(input);
494
+ if (isAsync(result)) throw new Error("Synchronous parse encountered promise.");
495
+ return result;
496
+ }
497
+ _parseAsync(input) {
498
+ const result = this._parse(input);
499
+ return Promise.resolve(result);
500
+ }
501
+ parse(data, params) {
502
+ const result = this.safeParse(data, params);
503
+ if (result.success) return result.data;
504
+ throw result.error;
505
+ }
506
+ safeParse(data, params) {
507
+ const ctx = {
508
+ common: {
509
+ issues: [],
510
+ async: params?.async ?? false,
511
+ contextualErrorMap: params?.errorMap
512
+ },
513
+ path: params?.path || [],
514
+ schemaErrorMap: this._def.errorMap,
515
+ parent: null,
516
+ data,
517
+ parsedType: getParsedType(data)
518
+ };
519
+ const result = this._parseSync({
520
+ data,
521
+ path: ctx.path,
522
+ parent: ctx
523
+ });
524
+ return handleResult(ctx, result);
525
+ }
526
+ "~validate"(data) {
527
+ const ctx = {
528
+ common: {
529
+ issues: [],
530
+ async: !!this["~standard"].async
531
+ },
532
+ path: [],
533
+ schemaErrorMap: this._def.errorMap,
534
+ parent: null,
535
+ data,
536
+ parsedType: getParsedType(data)
537
+ };
538
+ if (!this["~standard"].async) try {
539
+ const result = this._parseSync({
540
+ data,
541
+ path: [],
542
+ parent: ctx
543
+ });
544
+ return isValid(result) ? { value: result.value } : { issues: ctx.common.issues };
545
+ } catch (err) {
546
+ if (err?.message?.toLowerCase()?.includes("encountered")) this["~standard"].async = true;
547
+ ctx.common = {
548
+ issues: [],
549
+ async: true
550
+ };
551
+ }
552
+ return this._parseAsync({
553
+ data,
554
+ path: [],
555
+ parent: ctx
556
+ }).then((result) => isValid(result) ? { value: result.value } : { issues: ctx.common.issues });
557
+ }
558
+ async parseAsync(data, params) {
559
+ const result = await this.safeParseAsync(data, params);
560
+ if (result.success) return result.data;
561
+ throw result.error;
562
+ }
563
+ async safeParseAsync(data, params) {
564
+ const ctx = {
565
+ common: {
566
+ issues: [],
567
+ contextualErrorMap: params?.errorMap,
568
+ async: true
569
+ },
570
+ path: params?.path || [],
571
+ schemaErrorMap: this._def.errorMap,
572
+ parent: null,
573
+ data,
574
+ parsedType: getParsedType(data)
575
+ };
576
+ const maybeAsyncResult = this._parse({
577
+ data,
578
+ path: ctx.path,
579
+ parent: ctx
580
+ });
581
+ const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
582
+ return handleResult(ctx, result);
583
+ }
584
+ refine(check, message) {
585
+ const getIssueProperties = (val) => {
586
+ if (typeof message === "string" || typeof message === "undefined") return { message };
587
+ else if (typeof message === "function") return message(val);
588
+ else return message;
589
+ };
590
+ return this._refinement((val, ctx) => {
591
+ const result = check(val);
592
+ const setError = () => ctx.addIssue({
593
+ code: ZodIssueCode.custom,
594
+ ...getIssueProperties(val)
595
+ });
596
+ if (typeof Promise !== "undefined" && result instanceof Promise) return result.then((data) => {
597
+ if (!data) {
598
+ setError();
599
+ return false;
600
+ } else return true;
601
+ });
602
+ if (!result) {
603
+ setError();
604
+ return false;
605
+ } else return true;
606
+ });
607
+ }
608
+ refinement(check, refinementData) {
609
+ return this._refinement((val, ctx) => {
610
+ if (!check(val)) {
611
+ ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
612
+ return false;
613
+ } else return true;
614
+ });
615
+ }
616
+ _refinement(refinement) {
617
+ return new ZodEffects({
618
+ schema: this,
619
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
620
+ effect: {
621
+ type: "refinement",
622
+ refinement
623
+ }
624
+ });
625
+ }
626
+ superRefine(refinement) {
627
+ return this._refinement(refinement);
628
+ }
629
+ constructor(def) {
630
+ /** Alias of safeParseAsync */
631
+ this.spa = this.safeParseAsync;
632
+ this._def = def;
633
+ this.parse = this.parse.bind(this);
634
+ this.safeParse = this.safeParse.bind(this);
635
+ this.parseAsync = this.parseAsync.bind(this);
636
+ this.safeParseAsync = this.safeParseAsync.bind(this);
637
+ this.spa = this.spa.bind(this);
638
+ this.refine = this.refine.bind(this);
639
+ this.refinement = this.refinement.bind(this);
640
+ this.superRefine = this.superRefine.bind(this);
641
+ this.optional = this.optional.bind(this);
642
+ this.nullable = this.nullable.bind(this);
643
+ this.nullish = this.nullish.bind(this);
644
+ this.array = this.array.bind(this);
645
+ this.promise = this.promise.bind(this);
646
+ this.or = this.or.bind(this);
647
+ this.and = this.and.bind(this);
648
+ this.transform = this.transform.bind(this);
649
+ this.brand = this.brand.bind(this);
650
+ this.default = this.default.bind(this);
651
+ this.catch = this.catch.bind(this);
652
+ this.describe = this.describe.bind(this);
653
+ this.pipe = this.pipe.bind(this);
654
+ this.readonly = this.readonly.bind(this);
655
+ this.isNullable = this.isNullable.bind(this);
656
+ this.isOptional = this.isOptional.bind(this);
657
+ this["~standard"] = {
658
+ version: 1,
659
+ vendor: "zod",
660
+ validate: (data) => this["~validate"](data)
661
+ };
662
+ }
663
+ optional() {
664
+ return ZodOptional.create(this, this._def);
665
+ }
666
+ nullable() {
667
+ return ZodNullable.create(this, this._def);
668
+ }
669
+ nullish() {
670
+ return this.nullable().optional();
671
+ }
672
+ array() {
673
+ return ZodArray.create(this);
674
+ }
675
+ promise() {
676
+ return ZodPromise.create(this, this._def);
677
+ }
678
+ or(option) {
679
+ return ZodUnion.create([this, option], this._def);
680
+ }
681
+ and(incoming) {
682
+ return ZodIntersection.create(this, incoming, this._def);
683
+ }
684
+ transform(transform) {
685
+ return new ZodEffects({
686
+ ...processCreateParams(this._def),
687
+ schema: this,
688
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
689
+ effect: {
690
+ type: "transform",
691
+ transform
692
+ }
693
+ });
694
+ }
695
+ default(def) {
696
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
697
+ return new ZodDefault({
698
+ ...processCreateParams(this._def),
699
+ innerType: this,
700
+ defaultValue: defaultValueFunc,
701
+ typeName: ZodFirstPartyTypeKind.ZodDefault
702
+ });
703
+ }
704
+ brand() {
705
+ return new ZodBranded({
706
+ typeName: ZodFirstPartyTypeKind.ZodBranded,
707
+ type: this,
708
+ ...processCreateParams(this._def)
709
+ });
710
+ }
711
+ catch(def) {
712
+ const catchValueFunc = typeof def === "function" ? def : () => def;
713
+ return new ZodCatch({
714
+ ...processCreateParams(this._def),
715
+ innerType: this,
716
+ catchValue: catchValueFunc,
717
+ typeName: ZodFirstPartyTypeKind.ZodCatch
718
+ });
719
+ }
720
+ describe(description) {
721
+ const This = this.constructor;
722
+ return new This({
723
+ ...this._def,
724
+ description
725
+ });
726
+ }
727
+ pipe(target) {
728
+ return ZodPipeline.create(this, target);
729
+ }
730
+ readonly() {
731
+ return ZodReadonly.create(this);
732
+ }
733
+ isOptional() {
734
+ return this.safeParse(void 0).success;
735
+ }
736
+ isNullable() {
737
+ return this.safeParse(null).success;
738
+ }
739
+ };
740
+ const cuidRegex = /^c[^\s-]{8,}$/i;
741
+ const cuid2Regex = /^[0-9a-z]+$/;
742
+ const ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
743
+ const uuidRegex = /^[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;
744
+ const nanoidRegex = /^[a-z0-9_-]{21}$/i;
745
+ const jwtRegex = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
746
+ const durationRegex = /^[-+]?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)?)??$/;
747
+ const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
748
+ const _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
749
+ let emojiRegex;
750
+ const ipv4Regex = /^(?:(?: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])$/;
751
+ const ipv4CidrRegex = /^(?:(?: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])$/;
752
+ const ipv6Regex = /^(([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]))$/;
753
+ const ipv6CidrRegex = /^(([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])$/;
754
+ const base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
755
+ const base64urlRegex = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
756
+ const dateRegexSource = `((\\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])))`;
757
+ const dateRegex = new RegExp(`^${dateRegexSource}$`);
758
+ function timeRegexSource(args) {
759
+ let secondsRegexSource = `[0-5]\\d`;
760
+ if (args.precision) secondsRegexSource = `${secondsRegexSource}\\.\\d{${args.precision}}`;
761
+ else if (args.precision == null) secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
762
+ const secondsQuantifier = args.precision ? "+" : "?";
763
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
764
+ }
765
+ function timeRegex(args) {
766
+ return new RegExp(`^${timeRegexSource(args)}$`);
767
+ }
768
+ function datetimeRegex(args) {
769
+ let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
770
+ const opts = [];
771
+ opts.push(args.local ? `Z?` : `Z`);
772
+ if (args.offset) opts.push(`([+-]\\d{2}:?\\d{2})`);
773
+ regex = `${regex}(${opts.join("|")})`;
774
+ return new RegExp(`^${regex}$`);
775
+ }
776
+ function isValidIP(ip, version) {
777
+ if ((version === "v4" || !version) && ipv4Regex.test(ip)) return true;
778
+ if ((version === "v6" || !version) && ipv6Regex.test(ip)) return true;
779
+ return false;
780
+ }
781
+ function isValidJWT(jwt, alg) {
782
+ if (!jwtRegex.test(jwt)) return false;
783
+ try {
784
+ const [header] = jwt.split(".");
785
+ const base64 = header.replace(/-/g, "+").replace(/_/g, "/").padEnd(header.length + (4 - header.length % 4) % 4, "=");
786
+ const decoded = JSON.parse(atob(base64));
787
+ if (typeof decoded !== "object" || decoded === null) return false;
788
+ if ("typ" in decoded && decoded?.typ !== "JWT") return false;
789
+ if (!decoded.alg) return false;
790
+ if (alg && decoded.alg !== alg) return false;
791
+ return true;
792
+ } catch {
793
+ return false;
794
+ }
795
+ }
796
+ function isValidCidr(ip, version) {
797
+ if ((version === "v4" || !version) && ipv4CidrRegex.test(ip)) return true;
798
+ if ((version === "v6" || !version) && ipv6CidrRegex.test(ip)) return true;
799
+ return false;
800
+ }
801
+ var ZodString = class ZodString extends ZodType {
802
+ _parse(input) {
803
+ if (this._def.coerce) input.data = String(input.data);
804
+ const parsedType = this._getType(input);
805
+ if (parsedType !== ZodParsedType.string) {
806
+ const ctx$1 = this._getOrReturnCtx(input);
807
+ addIssueToContext(ctx$1, {
808
+ code: ZodIssueCode.invalid_type,
809
+ expected: ZodParsedType.string,
810
+ received: ctx$1.parsedType
811
+ });
812
+ return INVALID;
813
+ }
814
+ const status = new ParseStatus();
815
+ let ctx = void 0;
816
+ for (const check of this._def.checks) if (check.kind === "min") {
817
+ if (input.data.length < check.value) {
818
+ ctx = this._getOrReturnCtx(input, ctx);
819
+ addIssueToContext(ctx, {
820
+ code: ZodIssueCode.too_small,
821
+ minimum: check.value,
822
+ type: "string",
823
+ inclusive: true,
824
+ exact: false,
825
+ message: check.message
826
+ });
827
+ status.dirty();
828
+ }
829
+ } else if (check.kind === "max") {
830
+ if (input.data.length > check.value) {
831
+ ctx = this._getOrReturnCtx(input, ctx);
832
+ addIssueToContext(ctx, {
833
+ code: ZodIssueCode.too_big,
834
+ maximum: check.value,
835
+ type: "string",
836
+ inclusive: true,
837
+ exact: false,
838
+ message: check.message
839
+ });
840
+ status.dirty();
841
+ }
842
+ } else if (check.kind === "length") {
843
+ const tooBig = input.data.length > check.value;
844
+ const tooSmall = input.data.length < check.value;
845
+ if (tooBig || tooSmall) {
846
+ ctx = this._getOrReturnCtx(input, ctx);
847
+ if (tooBig) addIssueToContext(ctx, {
848
+ code: ZodIssueCode.too_big,
849
+ maximum: check.value,
850
+ type: "string",
851
+ inclusive: true,
852
+ exact: true,
853
+ message: check.message
854
+ });
855
+ else if (tooSmall) addIssueToContext(ctx, {
856
+ code: ZodIssueCode.too_small,
857
+ minimum: check.value,
858
+ type: "string",
859
+ inclusive: true,
860
+ exact: true,
861
+ message: check.message
862
+ });
863
+ status.dirty();
864
+ }
865
+ } else if (check.kind === "email") {
866
+ if (!emailRegex.test(input.data)) {
867
+ ctx = this._getOrReturnCtx(input, ctx);
868
+ addIssueToContext(ctx, {
869
+ validation: "email",
870
+ code: ZodIssueCode.invalid_string,
871
+ message: check.message
872
+ });
873
+ status.dirty();
874
+ }
875
+ } else if (check.kind === "emoji") {
876
+ if (!emojiRegex) emojiRegex = new RegExp(_emojiRegex, "u");
877
+ if (!emojiRegex.test(input.data)) {
878
+ ctx = this._getOrReturnCtx(input, ctx);
879
+ addIssueToContext(ctx, {
880
+ validation: "emoji",
881
+ code: ZodIssueCode.invalid_string,
882
+ message: check.message
883
+ });
884
+ status.dirty();
885
+ }
886
+ } else if (check.kind === "uuid") {
887
+ if (!uuidRegex.test(input.data)) {
888
+ ctx = this._getOrReturnCtx(input, ctx);
889
+ addIssueToContext(ctx, {
890
+ validation: "uuid",
891
+ code: ZodIssueCode.invalid_string,
892
+ message: check.message
893
+ });
894
+ status.dirty();
895
+ }
896
+ } else if (check.kind === "nanoid") {
897
+ if (!nanoidRegex.test(input.data)) {
898
+ ctx = this._getOrReturnCtx(input, ctx);
899
+ addIssueToContext(ctx, {
900
+ validation: "nanoid",
901
+ code: ZodIssueCode.invalid_string,
902
+ message: check.message
903
+ });
904
+ status.dirty();
905
+ }
906
+ } else if (check.kind === "cuid") {
907
+ if (!cuidRegex.test(input.data)) {
908
+ ctx = this._getOrReturnCtx(input, ctx);
909
+ addIssueToContext(ctx, {
910
+ validation: "cuid",
911
+ code: ZodIssueCode.invalid_string,
912
+ message: check.message
913
+ });
914
+ status.dirty();
915
+ }
916
+ } else if (check.kind === "cuid2") {
917
+ if (!cuid2Regex.test(input.data)) {
918
+ ctx = this._getOrReturnCtx(input, ctx);
919
+ addIssueToContext(ctx, {
920
+ validation: "cuid2",
921
+ code: ZodIssueCode.invalid_string,
922
+ message: check.message
923
+ });
924
+ status.dirty();
925
+ }
926
+ } else if (check.kind === "ulid") {
927
+ if (!ulidRegex.test(input.data)) {
928
+ ctx = this._getOrReturnCtx(input, ctx);
929
+ addIssueToContext(ctx, {
930
+ validation: "ulid",
931
+ code: ZodIssueCode.invalid_string,
932
+ message: check.message
933
+ });
934
+ status.dirty();
935
+ }
936
+ } else if (check.kind === "url") try {
937
+ new URL(input.data);
938
+ } catch {
939
+ ctx = this._getOrReturnCtx(input, ctx);
940
+ addIssueToContext(ctx, {
941
+ validation: "url",
942
+ code: ZodIssueCode.invalid_string,
943
+ message: check.message
944
+ });
945
+ status.dirty();
946
+ }
947
+ else if (check.kind === "regex") {
948
+ check.regex.lastIndex = 0;
949
+ const testResult = check.regex.test(input.data);
950
+ if (!testResult) {
951
+ ctx = this._getOrReturnCtx(input, ctx);
952
+ addIssueToContext(ctx, {
953
+ validation: "regex",
954
+ code: ZodIssueCode.invalid_string,
955
+ message: check.message
956
+ });
957
+ status.dirty();
958
+ }
959
+ } else if (check.kind === "trim") input.data = input.data.trim();
960
+ else if (check.kind === "includes") {
961
+ if (!input.data.includes(check.value, check.position)) {
962
+ ctx = this._getOrReturnCtx(input, ctx);
963
+ addIssueToContext(ctx, {
964
+ code: ZodIssueCode.invalid_string,
965
+ validation: {
966
+ includes: check.value,
967
+ position: check.position
968
+ },
969
+ message: check.message
970
+ });
971
+ status.dirty();
972
+ }
973
+ } else if (check.kind === "toLowerCase") input.data = input.data.toLowerCase();
974
+ else if (check.kind === "toUpperCase") input.data = input.data.toUpperCase();
975
+ else if (check.kind === "startsWith") {
976
+ if (!input.data.startsWith(check.value)) {
977
+ ctx = this._getOrReturnCtx(input, ctx);
978
+ addIssueToContext(ctx, {
979
+ code: ZodIssueCode.invalid_string,
980
+ validation: { startsWith: check.value },
981
+ message: check.message
982
+ });
983
+ status.dirty();
984
+ }
985
+ } else if (check.kind === "endsWith") {
986
+ if (!input.data.endsWith(check.value)) {
987
+ ctx = this._getOrReturnCtx(input, ctx);
988
+ addIssueToContext(ctx, {
989
+ code: ZodIssueCode.invalid_string,
990
+ validation: { endsWith: check.value },
991
+ message: check.message
992
+ });
993
+ status.dirty();
994
+ }
995
+ } else if (check.kind === "datetime") {
996
+ const regex = datetimeRegex(check);
997
+ if (!regex.test(input.data)) {
998
+ ctx = this._getOrReturnCtx(input, ctx);
999
+ addIssueToContext(ctx, {
1000
+ code: ZodIssueCode.invalid_string,
1001
+ validation: "datetime",
1002
+ message: check.message
1003
+ });
1004
+ status.dirty();
1005
+ }
1006
+ } else if (check.kind === "date") {
1007
+ const regex = dateRegex;
1008
+ if (!regex.test(input.data)) {
1009
+ ctx = this._getOrReturnCtx(input, ctx);
1010
+ addIssueToContext(ctx, {
1011
+ code: ZodIssueCode.invalid_string,
1012
+ validation: "date",
1013
+ message: check.message
1014
+ });
1015
+ status.dirty();
1016
+ }
1017
+ } else if (check.kind === "time") {
1018
+ const regex = timeRegex(check);
1019
+ if (!regex.test(input.data)) {
1020
+ ctx = this._getOrReturnCtx(input, ctx);
1021
+ addIssueToContext(ctx, {
1022
+ code: ZodIssueCode.invalid_string,
1023
+ validation: "time",
1024
+ message: check.message
1025
+ });
1026
+ status.dirty();
1027
+ }
1028
+ } else if (check.kind === "duration") {
1029
+ if (!durationRegex.test(input.data)) {
1030
+ ctx = this._getOrReturnCtx(input, ctx);
1031
+ addIssueToContext(ctx, {
1032
+ validation: "duration",
1033
+ code: ZodIssueCode.invalid_string,
1034
+ message: check.message
1035
+ });
1036
+ status.dirty();
1037
+ }
1038
+ } else if (check.kind === "ip") {
1039
+ if (!isValidIP(input.data, check.version)) {
1040
+ ctx = this._getOrReturnCtx(input, ctx);
1041
+ addIssueToContext(ctx, {
1042
+ validation: "ip",
1043
+ code: ZodIssueCode.invalid_string,
1044
+ message: check.message
1045
+ });
1046
+ status.dirty();
1047
+ }
1048
+ } else if (check.kind === "jwt") {
1049
+ if (!isValidJWT(input.data, check.alg)) {
1050
+ ctx = this._getOrReturnCtx(input, ctx);
1051
+ addIssueToContext(ctx, {
1052
+ validation: "jwt",
1053
+ code: ZodIssueCode.invalid_string,
1054
+ message: check.message
1055
+ });
1056
+ status.dirty();
1057
+ }
1058
+ } else if (check.kind === "cidr") {
1059
+ if (!isValidCidr(input.data, check.version)) {
1060
+ ctx = this._getOrReturnCtx(input, ctx);
1061
+ addIssueToContext(ctx, {
1062
+ validation: "cidr",
1063
+ code: ZodIssueCode.invalid_string,
1064
+ message: check.message
1065
+ });
1066
+ status.dirty();
1067
+ }
1068
+ } else if (check.kind === "base64") {
1069
+ if (!base64Regex.test(input.data)) {
1070
+ ctx = this._getOrReturnCtx(input, ctx);
1071
+ addIssueToContext(ctx, {
1072
+ validation: "base64",
1073
+ code: ZodIssueCode.invalid_string,
1074
+ message: check.message
1075
+ });
1076
+ status.dirty();
1077
+ }
1078
+ } else if (check.kind === "base64url") {
1079
+ if (!base64urlRegex.test(input.data)) {
1080
+ ctx = this._getOrReturnCtx(input, ctx);
1081
+ addIssueToContext(ctx, {
1082
+ validation: "base64url",
1083
+ code: ZodIssueCode.invalid_string,
1084
+ message: check.message
1085
+ });
1086
+ status.dirty();
1087
+ }
1088
+ } else util.assertNever(check);
1089
+ return {
1090
+ status: status.value,
1091
+ value: input.data
1092
+ };
1093
+ }
1094
+ _regex(regex, validation, message) {
1095
+ return this.refinement((data) => regex.test(data), {
1096
+ validation,
1097
+ code: ZodIssueCode.invalid_string,
1098
+ ...errorUtil.errToObj(message)
1099
+ });
1100
+ }
1101
+ _addCheck(check) {
1102
+ return new ZodString({
1103
+ ...this._def,
1104
+ checks: [...this._def.checks, check]
1105
+ });
1106
+ }
1107
+ email(message) {
1108
+ return this._addCheck({
1109
+ kind: "email",
1110
+ ...errorUtil.errToObj(message)
1111
+ });
1112
+ }
1113
+ url(message) {
1114
+ return this._addCheck({
1115
+ kind: "url",
1116
+ ...errorUtil.errToObj(message)
1117
+ });
1118
+ }
1119
+ emoji(message) {
1120
+ return this._addCheck({
1121
+ kind: "emoji",
1122
+ ...errorUtil.errToObj(message)
1123
+ });
1124
+ }
1125
+ uuid(message) {
1126
+ return this._addCheck({
1127
+ kind: "uuid",
1128
+ ...errorUtil.errToObj(message)
1129
+ });
1130
+ }
1131
+ nanoid(message) {
1132
+ return this._addCheck({
1133
+ kind: "nanoid",
1134
+ ...errorUtil.errToObj(message)
1135
+ });
1136
+ }
1137
+ cuid(message) {
1138
+ return this._addCheck({
1139
+ kind: "cuid",
1140
+ ...errorUtil.errToObj(message)
1141
+ });
1142
+ }
1143
+ cuid2(message) {
1144
+ return this._addCheck({
1145
+ kind: "cuid2",
1146
+ ...errorUtil.errToObj(message)
1147
+ });
1148
+ }
1149
+ ulid(message) {
1150
+ return this._addCheck({
1151
+ kind: "ulid",
1152
+ ...errorUtil.errToObj(message)
1153
+ });
1154
+ }
1155
+ base64(message) {
1156
+ return this._addCheck({
1157
+ kind: "base64",
1158
+ ...errorUtil.errToObj(message)
1159
+ });
1160
+ }
1161
+ base64url(message) {
1162
+ return this._addCheck({
1163
+ kind: "base64url",
1164
+ ...errorUtil.errToObj(message)
1165
+ });
1166
+ }
1167
+ jwt(options) {
1168
+ return this._addCheck({
1169
+ kind: "jwt",
1170
+ ...errorUtil.errToObj(options)
1171
+ });
1172
+ }
1173
+ ip(options) {
1174
+ return this._addCheck({
1175
+ kind: "ip",
1176
+ ...errorUtil.errToObj(options)
1177
+ });
1178
+ }
1179
+ cidr(options) {
1180
+ return this._addCheck({
1181
+ kind: "cidr",
1182
+ ...errorUtil.errToObj(options)
1183
+ });
1184
+ }
1185
+ datetime(options) {
1186
+ if (typeof options === "string") return this._addCheck({
1187
+ kind: "datetime",
1188
+ precision: null,
1189
+ offset: false,
1190
+ local: false,
1191
+ message: options
1192
+ });
1193
+ return this._addCheck({
1194
+ kind: "datetime",
1195
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
1196
+ offset: options?.offset ?? false,
1197
+ local: options?.local ?? false,
1198
+ ...errorUtil.errToObj(options?.message)
1199
+ });
1200
+ }
1201
+ date(message) {
1202
+ return this._addCheck({
1203
+ kind: "date",
1204
+ message
1205
+ });
1206
+ }
1207
+ time(options) {
1208
+ if (typeof options === "string") return this._addCheck({
1209
+ kind: "time",
1210
+ precision: null,
1211
+ message: options
1212
+ });
1213
+ return this._addCheck({
1214
+ kind: "time",
1215
+ precision: typeof options?.precision === "undefined" ? null : options?.precision,
1216
+ ...errorUtil.errToObj(options?.message)
1217
+ });
1218
+ }
1219
+ duration(message) {
1220
+ return this._addCheck({
1221
+ kind: "duration",
1222
+ ...errorUtil.errToObj(message)
1223
+ });
1224
+ }
1225
+ regex(regex, message) {
1226
+ return this._addCheck({
1227
+ kind: "regex",
1228
+ regex,
1229
+ ...errorUtil.errToObj(message)
1230
+ });
1231
+ }
1232
+ includes(value, options) {
1233
+ return this._addCheck({
1234
+ kind: "includes",
1235
+ value,
1236
+ position: options?.position,
1237
+ ...errorUtil.errToObj(options?.message)
1238
+ });
1239
+ }
1240
+ startsWith(value, message) {
1241
+ return this._addCheck({
1242
+ kind: "startsWith",
1243
+ value,
1244
+ ...errorUtil.errToObj(message)
1245
+ });
1246
+ }
1247
+ endsWith(value, message) {
1248
+ return this._addCheck({
1249
+ kind: "endsWith",
1250
+ value,
1251
+ ...errorUtil.errToObj(message)
1252
+ });
1253
+ }
1254
+ min(minLength, message) {
1255
+ return this._addCheck({
1256
+ kind: "min",
1257
+ value: minLength,
1258
+ ...errorUtil.errToObj(message)
1259
+ });
1260
+ }
1261
+ max(maxLength, message) {
1262
+ return this._addCheck({
1263
+ kind: "max",
1264
+ value: maxLength,
1265
+ ...errorUtil.errToObj(message)
1266
+ });
1267
+ }
1268
+ length(len, message) {
1269
+ return this._addCheck({
1270
+ kind: "length",
1271
+ value: len,
1272
+ ...errorUtil.errToObj(message)
1273
+ });
1274
+ }
1275
+ /**
1276
+ * Equivalent to `.min(1)`
1277
+ */
1278
+ nonempty(message) {
1279
+ return this.min(1, errorUtil.errToObj(message));
1280
+ }
1281
+ trim() {
1282
+ return new ZodString({
1283
+ ...this._def,
1284
+ checks: [...this._def.checks, { kind: "trim" }]
1285
+ });
1286
+ }
1287
+ toLowerCase() {
1288
+ return new ZodString({
1289
+ ...this._def,
1290
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
1291
+ });
1292
+ }
1293
+ toUpperCase() {
1294
+ return new ZodString({
1295
+ ...this._def,
1296
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
1297
+ });
1298
+ }
1299
+ get isDatetime() {
1300
+ return !!this._def.checks.find((ch) => ch.kind === "datetime");
1301
+ }
1302
+ get isDate() {
1303
+ return !!this._def.checks.find((ch) => ch.kind === "date");
1304
+ }
1305
+ get isTime() {
1306
+ return !!this._def.checks.find((ch) => ch.kind === "time");
1307
+ }
1308
+ get isDuration() {
1309
+ return !!this._def.checks.find((ch) => ch.kind === "duration");
1310
+ }
1311
+ get isEmail() {
1312
+ return !!this._def.checks.find((ch) => ch.kind === "email");
1313
+ }
1314
+ get isURL() {
1315
+ return !!this._def.checks.find((ch) => ch.kind === "url");
1316
+ }
1317
+ get isEmoji() {
1318
+ return !!this._def.checks.find((ch) => ch.kind === "emoji");
1319
+ }
1320
+ get isUUID() {
1321
+ return !!this._def.checks.find((ch) => ch.kind === "uuid");
1322
+ }
1323
+ get isNANOID() {
1324
+ return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1325
+ }
1326
+ get isCUID() {
1327
+ return !!this._def.checks.find((ch) => ch.kind === "cuid");
1328
+ }
1329
+ get isCUID2() {
1330
+ return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1331
+ }
1332
+ get isULID() {
1333
+ return !!this._def.checks.find((ch) => ch.kind === "ulid");
1334
+ }
1335
+ get isIP() {
1336
+ return !!this._def.checks.find((ch) => ch.kind === "ip");
1337
+ }
1338
+ get isCIDR() {
1339
+ return !!this._def.checks.find((ch) => ch.kind === "cidr");
1340
+ }
1341
+ get isBase64() {
1342
+ return !!this._def.checks.find((ch) => ch.kind === "base64");
1343
+ }
1344
+ get isBase64url() {
1345
+ return !!this._def.checks.find((ch) => ch.kind === "base64url");
1346
+ }
1347
+ get minLength() {
1348
+ let min = null;
1349
+ for (const ch of this._def.checks) if (ch.kind === "min") {
1350
+ if (min === null || ch.value > min) min = ch.value;
1351
+ }
1352
+ return min;
1353
+ }
1354
+ get maxLength() {
1355
+ let max = null;
1356
+ for (const ch of this._def.checks) if (ch.kind === "max") {
1357
+ if (max === null || ch.value < max) max = ch.value;
1358
+ }
1359
+ return max;
1360
+ }
1361
+ };
1362
+ ZodString.create = (params) => {
1363
+ return new ZodString({
1364
+ checks: [],
1365
+ typeName: ZodFirstPartyTypeKind.ZodString,
1366
+ coerce: params?.coerce ?? false,
1367
+ ...processCreateParams(params)
1368
+ });
1369
+ };
1370
+ function floatSafeRemainder(val, step) {
1371
+ const valDecCount = (val.toString().split(".")[1] || "").length;
1372
+ const stepDecCount = (step.toString().split(".")[1] || "").length;
1373
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1374
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
1375
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
1376
+ return valInt % stepInt / 10 ** decCount;
1377
+ }
1378
+ var ZodNumber = class ZodNumber extends ZodType {
1379
+ constructor() {
1380
+ super(...arguments);
1381
+ this.min = this.gte;
1382
+ this.max = this.lte;
1383
+ this.step = this.multipleOf;
1384
+ }
1385
+ _parse(input) {
1386
+ if (this._def.coerce) input.data = Number(input.data);
1387
+ const parsedType = this._getType(input);
1388
+ if (parsedType !== ZodParsedType.number) {
1389
+ const ctx$1 = this._getOrReturnCtx(input);
1390
+ addIssueToContext(ctx$1, {
1391
+ code: ZodIssueCode.invalid_type,
1392
+ expected: ZodParsedType.number,
1393
+ received: ctx$1.parsedType
1394
+ });
1395
+ return INVALID;
1396
+ }
1397
+ let ctx = void 0;
1398
+ const status = new ParseStatus();
1399
+ for (const check of this._def.checks) if (check.kind === "int") {
1400
+ if (!util.isInteger(input.data)) {
1401
+ ctx = this._getOrReturnCtx(input, ctx);
1402
+ addIssueToContext(ctx, {
1403
+ code: ZodIssueCode.invalid_type,
1404
+ expected: "integer",
1405
+ received: "float",
1406
+ message: check.message
1407
+ });
1408
+ status.dirty();
1409
+ }
1410
+ } else if (check.kind === "min") {
1411
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1412
+ if (tooSmall) {
1413
+ ctx = this._getOrReturnCtx(input, ctx);
1414
+ addIssueToContext(ctx, {
1415
+ code: ZodIssueCode.too_small,
1416
+ minimum: check.value,
1417
+ type: "number",
1418
+ inclusive: check.inclusive,
1419
+ exact: false,
1420
+ message: check.message
1421
+ });
1422
+ status.dirty();
1423
+ }
1424
+ } else if (check.kind === "max") {
1425
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1426
+ if (tooBig) {
1427
+ ctx = this._getOrReturnCtx(input, ctx);
1428
+ addIssueToContext(ctx, {
1429
+ code: ZodIssueCode.too_big,
1430
+ maximum: check.value,
1431
+ type: "number",
1432
+ inclusive: check.inclusive,
1433
+ exact: false,
1434
+ message: check.message
1435
+ });
1436
+ status.dirty();
1437
+ }
1438
+ } else if (check.kind === "multipleOf") {
1439
+ if (floatSafeRemainder(input.data, check.value) !== 0) {
1440
+ ctx = this._getOrReturnCtx(input, ctx);
1441
+ addIssueToContext(ctx, {
1442
+ code: ZodIssueCode.not_multiple_of,
1443
+ multipleOf: check.value,
1444
+ message: check.message
1445
+ });
1446
+ status.dirty();
1447
+ }
1448
+ } else if (check.kind === "finite") {
1449
+ if (!Number.isFinite(input.data)) {
1450
+ ctx = this._getOrReturnCtx(input, ctx);
1451
+ addIssueToContext(ctx, {
1452
+ code: ZodIssueCode.not_finite,
1453
+ message: check.message
1454
+ });
1455
+ status.dirty();
1456
+ }
1457
+ } else util.assertNever(check);
1458
+ return {
1459
+ status: status.value,
1460
+ value: input.data
1461
+ };
1462
+ }
1463
+ gte(value, message) {
1464
+ return this.setLimit("min", value, true, errorUtil.toString(message));
1465
+ }
1466
+ gt(value, message) {
1467
+ return this.setLimit("min", value, false, errorUtil.toString(message));
1468
+ }
1469
+ lte(value, message) {
1470
+ return this.setLimit("max", value, true, errorUtil.toString(message));
1471
+ }
1472
+ lt(value, message) {
1473
+ return this.setLimit("max", value, false, errorUtil.toString(message));
1474
+ }
1475
+ setLimit(kind, value, inclusive, message) {
1476
+ return new ZodNumber({
1477
+ ...this._def,
1478
+ checks: [...this._def.checks, {
1479
+ kind,
1480
+ value,
1481
+ inclusive,
1482
+ message: errorUtil.toString(message)
1483
+ }]
1484
+ });
1485
+ }
1486
+ _addCheck(check) {
1487
+ return new ZodNumber({
1488
+ ...this._def,
1489
+ checks: [...this._def.checks, check]
1490
+ });
1491
+ }
1492
+ int(message) {
1493
+ return this._addCheck({
1494
+ kind: "int",
1495
+ message: errorUtil.toString(message)
1496
+ });
1497
+ }
1498
+ positive(message) {
1499
+ return this._addCheck({
1500
+ kind: "min",
1501
+ value: 0,
1502
+ inclusive: false,
1503
+ message: errorUtil.toString(message)
1504
+ });
1505
+ }
1506
+ negative(message) {
1507
+ return this._addCheck({
1508
+ kind: "max",
1509
+ value: 0,
1510
+ inclusive: false,
1511
+ message: errorUtil.toString(message)
1512
+ });
1513
+ }
1514
+ nonpositive(message) {
1515
+ return this._addCheck({
1516
+ kind: "max",
1517
+ value: 0,
1518
+ inclusive: true,
1519
+ message: errorUtil.toString(message)
1520
+ });
1521
+ }
1522
+ nonnegative(message) {
1523
+ return this._addCheck({
1524
+ kind: "min",
1525
+ value: 0,
1526
+ inclusive: true,
1527
+ message: errorUtil.toString(message)
1528
+ });
1529
+ }
1530
+ multipleOf(value, message) {
1531
+ return this._addCheck({
1532
+ kind: "multipleOf",
1533
+ value,
1534
+ message: errorUtil.toString(message)
1535
+ });
1536
+ }
1537
+ finite(message) {
1538
+ return this._addCheck({
1539
+ kind: "finite",
1540
+ message: errorUtil.toString(message)
1541
+ });
1542
+ }
1543
+ safe(message) {
1544
+ return this._addCheck({
1545
+ kind: "min",
1546
+ inclusive: true,
1547
+ value: Number.MIN_SAFE_INTEGER,
1548
+ message: errorUtil.toString(message)
1549
+ })._addCheck({
1550
+ kind: "max",
1551
+ inclusive: true,
1552
+ value: Number.MAX_SAFE_INTEGER,
1553
+ message: errorUtil.toString(message)
1554
+ });
1555
+ }
1556
+ get minValue() {
1557
+ let min = null;
1558
+ for (const ch of this._def.checks) if (ch.kind === "min") {
1559
+ if (min === null || ch.value > min) min = ch.value;
1560
+ }
1561
+ return min;
1562
+ }
1563
+ get maxValue() {
1564
+ let max = null;
1565
+ for (const ch of this._def.checks) if (ch.kind === "max") {
1566
+ if (max === null || ch.value < max) max = ch.value;
1567
+ }
1568
+ return max;
1569
+ }
1570
+ get isInt() {
1571
+ return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
1572
+ }
1573
+ get isFinite() {
1574
+ let max = null;
1575
+ let min = null;
1576
+ for (const ch of this._def.checks) if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") return true;
1577
+ else if (ch.kind === "min") {
1578
+ if (min === null || ch.value > min) min = ch.value;
1579
+ } else if (ch.kind === "max") {
1580
+ if (max === null || ch.value < max) max = ch.value;
1581
+ }
1582
+ return Number.isFinite(min) && Number.isFinite(max);
1583
+ }
1584
+ };
1585
+ ZodNumber.create = (params) => {
1586
+ return new ZodNumber({
1587
+ checks: [],
1588
+ typeName: ZodFirstPartyTypeKind.ZodNumber,
1589
+ coerce: params?.coerce || false,
1590
+ ...processCreateParams(params)
1591
+ });
1592
+ };
1593
+ var ZodBigInt = class ZodBigInt extends ZodType {
1594
+ constructor() {
1595
+ super(...arguments);
1596
+ this.min = this.gte;
1597
+ this.max = this.lte;
1598
+ }
1599
+ _parse(input) {
1600
+ if (this._def.coerce) try {
1601
+ input.data = BigInt(input.data);
1602
+ } catch {
1603
+ return this._getInvalidInput(input);
1604
+ }
1605
+ const parsedType = this._getType(input);
1606
+ if (parsedType !== ZodParsedType.bigint) return this._getInvalidInput(input);
1607
+ let ctx = void 0;
1608
+ const status = new ParseStatus();
1609
+ for (const check of this._def.checks) if (check.kind === "min") {
1610
+ const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1611
+ if (tooSmall) {
1612
+ ctx = this._getOrReturnCtx(input, ctx);
1613
+ addIssueToContext(ctx, {
1614
+ code: ZodIssueCode.too_small,
1615
+ type: "bigint",
1616
+ minimum: check.value,
1617
+ inclusive: check.inclusive,
1618
+ message: check.message
1619
+ });
1620
+ status.dirty();
1621
+ }
1622
+ } else if (check.kind === "max") {
1623
+ const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1624
+ if (tooBig) {
1625
+ ctx = this._getOrReturnCtx(input, ctx);
1626
+ addIssueToContext(ctx, {
1627
+ code: ZodIssueCode.too_big,
1628
+ type: "bigint",
1629
+ maximum: check.value,
1630
+ inclusive: check.inclusive,
1631
+ message: check.message
1632
+ });
1633
+ status.dirty();
1634
+ }
1635
+ } else if (check.kind === "multipleOf") {
1636
+ if (input.data % check.value !== BigInt(0)) {
1637
+ ctx = this._getOrReturnCtx(input, ctx);
1638
+ addIssueToContext(ctx, {
1639
+ code: ZodIssueCode.not_multiple_of,
1640
+ multipleOf: check.value,
1641
+ message: check.message
1642
+ });
1643
+ status.dirty();
1644
+ }
1645
+ } else util.assertNever(check);
1646
+ return {
1647
+ status: status.value,
1648
+ value: input.data
1649
+ };
1650
+ }
1651
+ _getInvalidInput(input) {
1652
+ const ctx = this._getOrReturnCtx(input);
1653
+ addIssueToContext(ctx, {
1654
+ code: ZodIssueCode.invalid_type,
1655
+ expected: ZodParsedType.bigint,
1656
+ received: ctx.parsedType
1657
+ });
1658
+ return INVALID;
1659
+ }
1660
+ gte(value, message) {
1661
+ return this.setLimit("min", value, true, errorUtil.toString(message));
1662
+ }
1663
+ gt(value, message) {
1664
+ return this.setLimit("min", value, false, errorUtil.toString(message));
1665
+ }
1666
+ lte(value, message) {
1667
+ return this.setLimit("max", value, true, errorUtil.toString(message));
1668
+ }
1669
+ lt(value, message) {
1670
+ return this.setLimit("max", value, false, errorUtil.toString(message));
1671
+ }
1672
+ setLimit(kind, value, inclusive, message) {
1673
+ return new ZodBigInt({
1674
+ ...this._def,
1675
+ checks: [...this._def.checks, {
1676
+ kind,
1677
+ value,
1678
+ inclusive,
1679
+ message: errorUtil.toString(message)
1680
+ }]
1681
+ });
1682
+ }
1683
+ _addCheck(check) {
1684
+ return new ZodBigInt({
1685
+ ...this._def,
1686
+ checks: [...this._def.checks, check]
1687
+ });
1688
+ }
1689
+ positive(message) {
1690
+ return this._addCheck({
1691
+ kind: "min",
1692
+ value: BigInt(0),
1693
+ inclusive: false,
1694
+ message: errorUtil.toString(message)
1695
+ });
1696
+ }
1697
+ negative(message) {
1698
+ return this._addCheck({
1699
+ kind: "max",
1700
+ value: BigInt(0),
1701
+ inclusive: false,
1702
+ message: errorUtil.toString(message)
1703
+ });
1704
+ }
1705
+ nonpositive(message) {
1706
+ return this._addCheck({
1707
+ kind: "max",
1708
+ value: BigInt(0),
1709
+ inclusive: true,
1710
+ message: errorUtil.toString(message)
1711
+ });
1712
+ }
1713
+ nonnegative(message) {
1714
+ return this._addCheck({
1715
+ kind: "min",
1716
+ value: BigInt(0),
1717
+ inclusive: true,
1718
+ message: errorUtil.toString(message)
1719
+ });
1720
+ }
1721
+ multipleOf(value, message) {
1722
+ return this._addCheck({
1723
+ kind: "multipleOf",
1724
+ value,
1725
+ message: errorUtil.toString(message)
1726
+ });
1727
+ }
1728
+ get minValue() {
1729
+ let min = null;
1730
+ for (const ch of this._def.checks) if (ch.kind === "min") {
1731
+ if (min === null || ch.value > min) min = ch.value;
1732
+ }
1733
+ return min;
1734
+ }
1735
+ get maxValue() {
1736
+ let max = null;
1737
+ for (const ch of this._def.checks) if (ch.kind === "max") {
1738
+ if (max === null || ch.value < max) max = ch.value;
1739
+ }
1740
+ return max;
1741
+ }
1742
+ };
1743
+ ZodBigInt.create = (params) => {
1744
+ return new ZodBigInt({
1745
+ checks: [],
1746
+ typeName: ZodFirstPartyTypeKind.ZodBigInt,
1747
+ coerce: params?.coerce ?? false,
1748
+ ...processCreateParams(params)
1749
+ });
1750
+ };
1751
+ var ZodBoolean = class extends ZodType {
1752
+ _parse(input) {
1753
+ if (this._def.coerce) input.data = Boolean(input.data);
1754
+ const parsedType = this._getType(input);
1755
+ if (parsedType !== ZodParsedType.boolean) {
1756
+ const ctx = this._getOrReturnCtx(input);
1757
+ addIssueToContext(ctx, {
1758
+ code: ZodIssueCode.invalid_type,
1759
+ expected: ZodParsedType.boolean,
1760
+ received: ctx.parsedType
1761
+ });
1762
+ return INVALID;
1763
+ }
1764
+ return OK(input.data);
1765
+ }
1766
+ };
1767
+ ZodBoolean.create = (params) => {
1768
+ return new ZodBoolean({
1769
+ typeName: ZodFirstPartyTypeKind.ZodBoolean,
1770
+ coerce: params?.coerce || false,
1771
+ ...processCreateParams(params)
1772
+ });
1773
+ };
1774
+ var ZodDate = class ZodDate extends ZodType {
1775
+ _parse(input) {
1776
+ if (this._def.coerce) input.data = new Date(input.data);
1777
+ const parsedType = this._getType(input);
1778
+ if (parsedType !== ZodParsedType.date) {
1779
+ const ctx$1 = this._getOrReturnCtx(input);
1780
+ addIssueToContext(ctx$1, {
1781
+ code: ZodIssueCode.invalid_type,
1782
+ expected: ZodParsedType.date,
1783
+ received: ctx$1.parsedType
1784
+ });
1785
+ return INVALID;
1786
+ }
1787
+ if (Number.isNaN(input.data.getTime())) {
1788
+ const ctx$1 = this._getOrReturnCtx(input);
1789
+ addIssueToContext(ctx$1, { code: ZodIssueCode.invalid_date });
1790
+ return INVALID;
1791
+ }
1792
+ const status = new ParseStatus();
1793
+ let ctx = void 0;
1794
+ for (const check of this._def.checks) if (check.kind === "min") {
1795
+ if (input.data.getTime() < check.value) {
1796
+ ctx = this._getOrReturnCtx(input, ctx);
1797
+ addIssueToContext(ctx, {
1798
+ code: ZodIssueCode.too_small,
1799
+ message: check.message,
1800
+ inclusive: true,
1801
+ exact: false,
1802
+ minimum: check.value,
1803
+ type: "date"
1804
+ });
1805
+ status.dirty();
1806
+ }
1807
+ } else if (check.kind === "max") {
1808
+ if (input.data.getTime() > check.value) {
1809
+ ctx = this._getOrReturnCtx(input, ctx);
1810
+ addIssueToContext(ctx, {
1811
+ code: ZodIssueCode.too_big,
1812
+ message: check.message,
1813
+ inclusive: true,
1814
+ exact: false,
1815
+ maximum: check.value,
1816
+ type: "date"
1817
+ });
1818
+ status.dirty();
1819
+ }
1820
+ } else util.assertNever(check);
1821
+ return {
1822
+ status: status.value,
1823
+ value: new Date(input.data.getTime())
1824
+ };
1825
+ }
1826
+ _addCheck(check) {
1827
+ return new ZodDate({
1828
+ ...this._def,
1829
+ checks: [...this._def.checks, check]
1830
+ });
1831
+ }
1832
+ min(minDate, message) {
1833
+ return this._addCheck({
1834
+ kind: "min",
1835
+ value: minDate.getTime(),
1836
+ message: errorUtil.toString(message)
1837
+ });
1838
+ }
1839
+ max(maxDate, message) {
1840
+ return this._addCheck({
1841
+ kind: "max",
1842
+ value: maxDate.getTime(),
1843
+ message: errorUtil.toString(message)
1844
+ });
1845
+ }
1846
+ get minDate() {
1847
+ let min = null;
1848
+ for (const ch of this._def.checks) if (ch.kind === "min") {
1849
+ if (min === null || ch.value > min) min = ch.value;
1850
+ }
1851
+ return min != null ? new Date(min) : null;
1852
+ }
1853
+ get maxDate() {
1854
+ let max = null;
1855
+ for (const ch of this._def.checks) if (ch.kind === "max") {
1856
+ if (max === null || ch.value < max) max = ch.value;
1857
+ }
1858
+ return max != null ? new Date(max) : null;
1859
+ }
1860
+ };
1861
+ ZodDate.create = (params) => {
1862
+ return new ZodDate({
1863
+ checks: [],
1864
+ coerce: params?.coerce || false,
1865
+ typeName: ZodFirstPartyTypeKind.ZodDate,
1866
+ ...processCreateParams(params)
1867
+ });
1868
+ };
1869
+ var ZodSymbol = class extends ZodType {
1870
+ _parse(input) {
1871
+ const parsedType = this._getType(input);
1872
+ if (parsedType !== ZodParsedType.symbol) {
1873
+ const ctx = this._getOrReturnCtx(input);
1874
+ addIssueToContext(ctx, {
1875
+ code: ZodIssueCode.invalid_type,
1876
+ expected: ZodParsedType.symbol,
1877
+ received: ctx.parsedType
1878
+ });
1879
+ return INVALID;
1880
+ }
1881
+ return OK(input.data);
1882
+ }
1883
+ };
1884
+ ZodSymbol.create = (params) => {
1885
+ return new ZodSymbol({
1886
+ typeName: ZodFirstPartyTypeKind.ZodSymbol,
1887
+ ...processCreateParams(params)
1888
+ });
1889
+ };
1890
+ var ZodUndefined = class extends ZodType {
1891
+ _parse(input) {
1892
+ const parsedType = this._getType(input);
1893
+ if (parsedType !== ZodParsedType.undefined) {
1894
+ const ctx = this._getOrReturnCtx(input);
1895
+ addIssueToContext(ctx, {
1896
+ code: ZodIssueCode.invalid_type,
1897
+ expected: ZodParsedType.undefined,
1898
+ received: ctx.parsedType
1899
+ });
1900
+ return INVALID;
1901
+ }
1902
+ return OK(input.data);
1903
+ }
1904
+ };
1905
+ ZodUndefined.create = (params) => {
1906
+ return new ZodUndefined({
1907
+ typeName: ZodFirstPartyTypeKind.ZodUndefined,
1908
+ ...processCreateParams(params)
1909
+ });
1910
+ };
1911
+ var ZodNull = class extends ZodType {
1912
+ _parse(input) {
1913
+ const parsedType = this._getType(input);
1914
+ if (parsedType !== ZodParsedType.null) {
1915
+ const ctx = this._getOrReturnCtx(input);
1916
+ addIssueToContext(ctx, {
1917
+ code: ZodIssueCode.invalid_type,
1918
+ expected: ZodParsedType.null,
1919
+ received: ctx.parsedType
1920
+ });
1921
+ return INVALID;
1922
+ }
1923
+ return OK(input.data);
1924
+ }
1925
+ };
1926
+ ZodNull.create = (params) => {
1927
+ return new ZodNull({
1928
+ typeName: ZodFirstPartyTypeKind.ZodNull,
1929
+ ...processCreateParams(params)
1930
+ });
1931
+ };
1932
+ var ZodAny = class extends ZodType {
1933
+ constructor() {
1934
+ super(...arguments);
1935
+ this._any = true;
1936
+ }
1937
+ _parse(input) {
1938
+ return OK(input.data);
1939
+ }
1940
+ };
1941
+ ZodAny.create = (params) => {
1942
+ return new ZodAny({
1943
+ typeName: ZodFirstPartyTypeKind.ZodAny,
1944
+ ...processCreateParams(params)
1945
+ });
1946
+ };
1947
+ var ZodUnknown = class extends ZodType {
1948
+ constructor() {
1949
+ super(...arguments);
1950
+ this._unknown = true;
1951
+ }
1952
+ _parse(input) {
1953
+ return OK(input.data);
1954
+ }
1955
+ };
1956
+ ZodUnknown.create = (params) => {
1957
+ return new ZodUnknown({
1958
+ typeName: ZodFirstPartyTypeKind.ZodUnknown,
1959
+ ...processCreateParams(params)
1960
+ });
1961
+ };
1962
+ var ZodNever = class extends ZodType {
1963
+ _parse(input) {
1964
+ const ctx = this._getOrReturnCtx(input);
1965
+ addIssueToContext(ctx, {
1966
+ code: ZodIssueCode.invalid_type,
1967
+ expected: ZodParsedType.never,
1968
+ received: ctx.parsedType
1969
+ });
1970
+ return INVALID;
1971
+ }
1972
+ };
1973
+ ZodNever.create = (params) => {
1974
+ return new ZodNever({
1975
+ typeName: ZodFirstPartyTypeKind.ZodNever,
1976
+ ...processCreateParams(params)
1977
+ });
1978
+ };
1979
+ var ZodVoid = class extends ZodType {
1980
+ _parse(input) {
1981
+ const parsedType = this._getType(input);
1982
+ if (parsedType !== ZodParsedType.undefined) {
1983
+ const ctx = this._getOrReturnCtx(input);
1984
+ addIssueToContext(ctx, {
1985
+ code: ZodIssueCode.invalid_type,
1986
+ expected: ZodParsedType.void,
1987
+ received: ctx.parsedType
1988
+ });
1989
+ return INVALID;
1990
+ }
1991
+ return OK(input.data);
1992
+ }
1993
+ };
1994
+ ZodVoid.create = (params) => {
1995
+ return new ZodVoid({
1996
+ typeName: ZodFirstPartyTypeKind.ZodVoid,
1997
+ ...processCreateParams(params)
1998
+ });
1999
+ };
2000
+ var ZodArray = class ZodArray extends ZodType {
2001
+ _parse(input) {
2002
+ const { ctx, status } = this._processInputParams(input);
2003
+ const def = this._def;
2004
+ if (ctx.parsedType !== ZodParsedType.array) {
2005
+ addIssueToContext(ctx, {
2006
+ code: ZodIssueCode.invalid_type,
2007
+ expected: ZodParsedType.array,
2008
+ received: ctx.parsedType
2009
+ });
2010
+ return INVALID;
2011
+ }
2012
+ if (def.exactLength !== null) {
2013
+ const tooBig = ctx.data.length > def.exactLength.value;
2014
+ const tooSmall = ctx.data.length < def.exactLength.value;
2015
+ if (tooBig || tooSmall) {
2016
+ addIssueToContext(ctx, {
2017
+ code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
2018
+ minimum: tooSmall ? def.exactLength.value : void 0,
2019
+ maximum: tooBig ? def.exactLength.value : void 0,
2020
+ type: "array",
2021
+ inclusive: true,
2022
+ exact: true,
2023
+ message: def.exactLength.message
2024
+ });
2025
+ status.dirty();
2026
+ }
2027
+ }
2028
+ if (def.minLength !== null) {
2029
+ if (ctx.data.length < def.minLength.value) {
2030
+ addIssueToContext(ctx, {
2031
+ code: ZodIssueCode.too_small,
2032
+ minimum: def.minLength.value,
2033
+ type: "array",
2034
+ inclusive: true,
2035
+ exact: false,
2036
+ message: def.minLength.message
2037
+ });
2038
+ status.dirty();
2039
+ }
2040
+ }
2041
+ if (def.maxLength !== null) {
2042
+ if (ctx.data.length > def.maxLength.value) {
2043
+ addIssueToContext(ctx, {
2044
+ code: ZodIssueCode.too_big,
2045
+ maximum: def.maxLength.value,
2046
+ type: "array",
2047
+ inclusive: true,
2048
+ exact: false,
2049
+ message: def.maxLength.message
2050
+ });
2051
+ status.dirty();
2052
+ }
2053
+ }
2054
+ if (ctx.common.async) return Promise.all([...ctx.data].map((item, i) => {
2055
+ return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2056
+ })).then((result$1) => {
2057
+ return ParseStatus.mergeArray(status, result$1);
2058
+ });
2059
+ const result = [...ctx.data].map((item, i) => {
2060
+ return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2061
+ });
2062
+ return ParseStatus.mergeArray(status, result);
2063
+ }
2064
+ get element() {
2065
+ return this._def.type;
2066
+ }
2067
+ min(minLength, message) {
2068
+ return new ZodArray({
2069
+ ...this._def,
2070
+ minLength: {
2071
+ value: minLength,
2072
+ message: errorUtil.toString(message)
2073
+ }
2074
+ });
2075
+ }
2076
+ max(maxLength, message) {
2077
+ return new ZodArray({
2078
+ ...this._def,
2079
+ maxLength: {
2080
+ value: maxLength,
2081
+ message: errorUtil.toString(message)
2082
+ }
2083
+ });
2084
+ }
2085
+ length(len, message) {
2086
+ return new ZodArray({
2087
+ ...this._def,
2088
+ exactLength: {
2089
+ value: len,
2090
+ message: errorUtil.toString(message)
2091
+ }
2092
+ });
2093
+ }
2094
+ nonempty(message) {
2095
+ return this.min(1, message);
2096
+ }
2097
+ };
2098
+ ZodArray.create = (schema, params) => {
2099
+ return new ZodArray({
2100
+ type: schema,
2101
+ minLength: null,
2102
+ maxLength: null,
2103
+ exactLength: null,
2104
+ typeName: ZodFirstPartyTypeKind.ZodArray,
2105
+ ...processCreateParams(params)
2106
+ });
2107
+ };
2108
+ function deepPartialify(schema) {
2109
+ if (schema instanceof ZodObject) {
2110
+ const newShape = {};
2111
+ for (const key in schema.shape) {
2112
+ const fieldSchema = schema.shape[key];
2113
+ newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
2114
+ }
2115
+ return new ZodObject({
2116
+ ...schema._def,
2117
+ shape: () => newShape
2118
+ });
2119
+ } else if (schema instanceof ZodArray) return new ZodArray({
2120
+ ...schema._def,
2121
+ type: deepPartialify(schema.element)
2122
+ });
2123
+ else if (schema instanceof ZodOptional) return ZodOptional.create(deepPartialify(schema.unwrap()));
2124
+ else if (schema instanceof ZodNullable) return ZodNullable.create(deepPartialify(schema.unwrap()));
2125
+ else if (schema instanceof ZodTuple) return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
2126
+ else return schema;
2127
+ }
2128
+ var ZodObject = class ZodObject extends ZodType {
2129
+ constructor() {
2130
+ super(...arguments);
2131
+ this._cached = null;
2132
+ /**
2133
+ * @deprecated In most cases, this is no longer needed - unknown properties are now silently stripped.
2134
+ * If you want to pass through unknown properties, use `.passthrough()` instead.
2135
+ */
2136
+ this.nonstrict = this.passthrough;
2137
+ /**
2138
+ * @deprecated Use `.extend` instead
2139
+ * */
2140
+ this.augment = this.extend;
2141
+ }
2142
+ _getCached() {
2143
+ if (this._cached !== null) return this._cached;
2144
+ const shape = this._def.shape();
2145
+ const keys = util.objectKeys(shape);
2146
+ this._cached = {
2147
+ shape,
2148
+ keys
2149
+ };
2150
+ return this._cached;
2151
+ }
2152
+ _parse(input) {
2153
+ const parsedType = this._getType(input);
2154
+ if (parsedType !== ZodParsedType.object) {
2155
+ const ctx$1 = this._getOrReturnCtx(input);
2156
+ addIssueToContext(ctx$1, {
2157
+ code: ZodIssueCode.invalid_type,
2158
+ expected: ZodParsedType.object,
2159
+ received: ctx$1.parsedType
2160
+ });
2161
+ return INVALID;
2162
+ }
2163
+ const { status, ctx } = this._processInputParams(input);
2164
+ const { shape, keys: shapeKeys } = this._getCached();
2165
+ const extraKeys = [];
2166
+ if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
2167
+ for (const key in ctx.data) if (!shapeKeys.includes(key)) extraKeys.push(key);
2168
+ }
2169
+ const pairs = [];
2170
+ for (const key of shapeKeys) {
2171
+ const keyValidator = shape[key];
2172
+ const value = ctx.data[key];
2173
+ pairs.push({
2174
+ key: {
2175
+ status: "valid",
2176
+ value: key
2177
+ },
2178
+ value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
2179
+ alwaysSet: key in ctx.data
2180
+ });
2181
+ }
2182
+ if (this._def.catchall instanceof ZodNever) {
2183
+ const unknownKeys = this._def.unknownKeys;
2184
+ if (unknownKeys === "passthrough") for (const key of extraKeys) pairs.push({
2185
+ key: {
2186
+ status: "valid",
2187
+ value: key
2188
+ },
2189
+ value: {
2190
+ status: "valid",
2191
+ value: ctx.data[key]
2192
+ }
2193
+ });
2194
+ else if (unknownKeys === "strict") {
2195
+ if (extraKeys.length > 0) {
2196
+ addIssueToContext(ctx, {
2197
+ code: ZodIssueCode.unrecognized_keys,
2198
+ keys: extraKeys
2199
+ });
2200
+ status.dirty();
2201
+ }
2202
+ } else if (unknownKeys === "strip") {} else throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2203
+ } else {
2204
+ const catchall = this._def.catchall;
2205
+ for (const key of extraKeys) {
2206
+ const value = ctx.data[key];
2207
+ pairs.push({
2208
+ key: {
2209
+ status: "valid",
2210
+ value: key
2211
+ },
2212
+ value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
2213
+ alwaysSet: key in ctx.data
2214
+ });
2215
+ }
2216
+ }
2217
+ if (ctx.common.async) return Promise.resolve().then(async () => {
2218
+ const syncPairs = [];
2219
+ for (const pair of pairs) {
2220
+ const key = await pair.key;
2221
+ const value = await pair.value;
2222
+ syncPairs.push({
2223
+ key,
2224
+ value,
2225
+ alwaysSet: pair.alwaysSet
2226
+ });
2227
+ }
2228
+ return syncPairs;
2229
+ }).then((syncPairs) => {
2230
+ return ParseStatus.mergeObjectSync(status, syncPairs);
2231
+ });
2232
+ else return ParseStatus.mergeObjectSync(status, pairs);
2233
+ }
2234
+ get shape() {
2235
+ return this._def.shape();
2236
+ }
2237
+ strict(message) {
2238
+ errorUtil.errToObj;
2239
+ return new ZodObject({
2240
+ ...this._def,
2241
+ unknownKeys: "strict",
2242
+ ...message !== void 0 ? { errorMap: (issue, ctx) => {
2243
+ const defaultError = this._def.errorMap?.(issue, ctx).message ?? ctx.defaultError;
2244
+ if (issue.code === "unrecognized_keys") return { message: errorUtil.errToObj(message).message ?? defaultError };
2245
+ return { message: defaultError };
2246
+ } } : {}
2247
+ });
2248
+ }
2249
+ strip() {
2250
+ return new ZodObject({
2251
+ ...this._def,
2252
+ unknownKeys: "strip"
2253
+ });
2254
+ }
2255
+ passthrough() {
2256
+ return new ZodObject({
2257
+ ...this._def,
2258
+ unknownKeys: "passthrough"
2259
+ });
2260
+ }
2261
+ extend(augmentation) {
2262
+ return new ZodObject({
2263
+ ...this._def,
2264
+ shape: () => ({
2265
+ ...this._def.shape(),
2266
+ ...augmentation
2267
+ })
2268
+ });
2269
+ }
2270
+ /**
2271
+ * Prior to zod@1.0.12 there was a bug in the
2272
+ * inferred type of merged objects. Please
2273
+ * upgrade if you are experiencing issues.
2274
+ */
2275
+ merge(merging) {
2276
+ const merged = new ZodObject({
2277
+ unknownKeys: merging._def.unknownKeys,
2278
+ catchall: merging._def.catchall,
2279
+ shape: () => ({
2280
+ ...this._def.shape(),
2281
+ ...merging._def.shape()
2282
+ }),
2283
+ typeName: ZodFirstPartyTypeKind.ZodObject
2284
+ });
2285
+ return merged;
2286
+ }
2287
+ setKey(key, schema) {
2288
+ return this.augment({ [key]: schema });
2289
+ }
2290
+ catchall(index) {
2291
+ return new ZodObject({
2292
+ ...this._def,
2293
+ catchall: index
2294
+ });
2295
+ }
2296
+ pick(mask) {
2297
+ const shape = {};
2298
+ for (const key of util.objectKeys(mask)) if (mask[key] && this.shape[key]) shape[key] = this.shape[key];
2299
+ return new ZodObject({
2300
+ ...this._def,
2301
+ shape: () => shape
2302
+ });
2303
+ }
2304
+ omit(mask) {
2305
+ const shape = {};
2306
+ for (const key of util.objectKeys(this.shape)) if (!mask[key]) shape[key] = this.shape[key];
2307
+ return new ZodObject({
2308
+ ...this._def,
2309
+ shape: () => shape
2310
+ });
2311
+ }
2312
+ /**
2313
+ * @deprecated
2314
+ */
2315
+ deepPartial() {
2316
+ return deepPartialify(this);
2317
+ }
2318
+ partial(mask) {
2319
+ const newShape = {};
2320
+ for (const key of util.objectKeys(this.shape)) {
2321
+ const fieldSchema = this.shape[key];
2322
+ if (mask && !mask[key]) newShape[key] = fieldSchema;
2323
+ else newShape[key] = fieldSchema.optional();
2324
+ }
2325
+ return new ZodObject({
2326
+ ...this._def,
2327
+ shape: () => newShape
2328
+ });
2329
+ }
2330
+ required(mask) {
2331
+ const newShape = {};
2332
+ for (const key of util.objectKeys(this.shape)) if (mask && !mask[key]) newShape[key] = this.shape[key];
2333
+ else {
2334
+ const fieldSchema = this.shape[key];
2335
+ let newField = fieldSchema;
2336
+ while (newField instanceof ZodOptional) newField = newField._def.innerType;
2337
+ newShape[key] = newField;
2338
+ }
2339
+ return new ZodObject({
2340
+ ...this._def,
2341
+ shape: () => newShape
2342
+ });
2343
+ }
2344
+ keyof() {
2345
+ return createZodEnum(util.objectKeys(this.shape));
2346
+ }
2347
+ };
2348
+ ZodObject.create = (shape, params) => {
2349
+ return new ZodObject({
2350
+ shape: () => shape,
2351
+ unknownKeys: "strip",
2352
+ catchall: ZodNever.create(),
2353
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2354
+ ...processCreateParams(params)
2355
+ });
2356
+ };
2357
+ ZodObject.strictCreate = (shape, params) => {
2358
+ return new ZodObject({
2359
+ shape: () => shape,
2360
+ unknownKeys: "strict",
2361
+ catchall: ZodNever.create(),
2362
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2363
+ ...processCreateParams(params)
2364
+ });
2365
+ };
2366
+ ZodObject.lazycreate = (shape, params) => {
2367
+ return new ZodObject({
2368
+ shape,
2369
+ unknownKeys: "strip",
2370
+ catchall: ZodNever.create(),
2371
+ typeName: ZodFirstPartyTypeKind.ZodObject,
2372
+ ...processCreateParams(params)
2373
+ });
2374
+ };
2375
+ var ZodUnion = class extends ZodType {
2376
+ _parse(input) {
2377
+ const { ctx } = this._processInputParams(input);
2378
+ const options = this._def.options;
2379
+ function handleResults(results) {
2380
+ for (const result of results) if (result.result.status === "valid") return result.result;
2381
+ for (const result of results) if (result.result.status === "dirty") {
2382
+ ctx.common.issues.push(...result.ctx.common.issues);
2383
+ return result.result;
2384
+ }
2385
+ const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
2386
+ addIssueToContext(ctx, {
2387
+ code: ZodIssueCode.invalid_union,
2388
+ unionErrors
2389
+ });
2390
+ return INVALID;
2391
+ }
2392
+ if (ctx.common.async) return Promise.all(options.map(async (option) => {
2393
+ const childCtx = {
2394
+ ...ctx,
2395
+ common: {
2396
+ ...ctx.common,
2397
+ issues: []
2398
+ },
2399
+ parent: null
2400
+ };
2401
+ return {
2402
+ result: await option._parseAsync({
2403
+ data: ctx.data,
2404
+ path: ctx.path,
2405
+ parent: childCtx
2406
+ }),
2407
+ ctx: childCtx
2408
+ };
2409
+ })).then(handleResults);
2410
+ else {
2411
+ let dirty = void 0;
2412
+ const issues = [];
2413
+ for (const option of options) {
2414
+ const childCtx = {
2415
+ ...ctx,
2416
+ common: {
2417
+ ...ctx.common,
2418
+ issues: []
2419
+ },
2420
+ parent: null
2421
+ };
2422
+ const result = option._parseSync({
2423
+ data: ctx.data,
2424
+ path: ctx.path,
2425
+ parent: childCtx
2426
+ });
2427
+ if (result.status === "valid") return result;
2428
+ else if (result.status === "dirty" && !dirty) dirty = {
2429
+ result,
2430
+ ctx: childCtx
2431
+ };
2432
+ if (childCtx.common.issues.length) issues.push(childCtx.common.issues);
2433
+ }
2434
+ if (dirty) {
2435
+ ctx.common.issues.push(...dirty.ctx.common.issues);
2436
+ return dirty.result;
2437
+ }
2438
+ const unionErrors = issues.map((issues$1) => new ZodError(issues$1));
2439
+ addIssueToContext(ctx, {
2440
+ code: ZodIssueCode.invalid_union,
2441
+ unionErrors
2442
+ });
2443
+ return INVALID;
2444
+ }
2445
+ }
2446
+ get options() {
2447
+ return this._def.options;
2448
+ }
2449
+ };
2450
+ ZodUnion.create = (types, params) => {
2451
+ return new ZodUnion({
2452
+ options: types,
2453
+ typeName: ZodFirstPartyTypeKind.ZodUnion,
2454
+ ...processCreateParams(params)
2455
+ });
2456
+ };
2457
+ const getDiscriminator = (type) => {
2458
+ if (type instanceof ZodLazy) return getDiscriminator(type.schema);
2459
+ else if (type instanceof ZodEffects) return getDiscriminator(type.innerType());
2460
+ else if (type instanceof ZodLiteral) return [type.value];
2461
+ else if (type instanceof ZodEnum) return type.options;
2462
+ else if (type instanceof ZodNativeEnum) return util.objectValues(type.enum);
2463
+ else if (type instanceof ZodDefault) return getDiscriminator(type._def.innerType);
2464
+ else if (type instanceof ZodUndefined) return [void 0];
2465
+ else if (type instanceof ZodNull) return [null];
2466
+ else if (type instanceof ZodOptional) return [void 0, ...getDiscriminator(type.unwrap())];
2467
+ else if (type instanceof ZodNullable) return [null, ...getDiscriminator(type.unwrap())];
2468
+ else if (type instanceof ZodBranded) return getDiscriminator(type.unwrap());
2469
+ else if (type instanceof ZodReadonly) return getDiscriminator(type.unwrap());
2470
+ else if (type instanceof ZodCatch) return getDiscriminator(type._def.innerType);
2471
+ else return [];
2472
+ };
2473
+ var ZodDiscriminatedUnion = class ZodDiscriminatedUnion extends ZodType {
2474
+ _parse(input) {
2475
+ const { ctx } = this._processInputParams(input);
2476
+ if (ctx.parsedType !== ZodParsedType.object) {
2477
+ addIssueToContext(ctx, {
2478
+ code: ZodIssueCode.invalid_type,
2479
+ expected: ZodParsedType.object,
2480
+ received: ctx.parsedType
2481
+ });
2482
+ return INVALID;
2483
+ }
2484
+ const discriminator = this.discriminator;
2485
+ const discriminatorValue = ctx.data[discriminator];
2486
+ const option = this.optionsMap.get(discriminatorValue);
2487
+ if (!option) {
2488
+ addIssueToContext(ctx, {
2489
+ code: ZodIssueCode.invalid_union_discriminator,
2490
+ options: Array.from(this.optionsMap.keys()),
2491
+ path: [discriminator]
2492
+ });
2493
+ return INVALID;
2494
+ }
2495
+ if (ctx.common.async) return option._parseAsync({
2496
+ data: ctx.data,
2497
+ path: ctx.path,
2498
+ parent: ctx
2499
+ });
2500
+ else return option._parseSync({
2501
+ data: ctx.data,
2502
+ path: ctx.path,
2503
+ parent: ctx
2504
+ });
2505
+ }
2506
+ get discriminator() {
2507
+ return this._def.discriminator;
2508
+ }
2509
+ get options() {
2510
+ return this._def.options;
2511
+ }
2512
+ get optionsMap() {
2513
+ return this._def.optionsMap;
2514
+ }
2515
+ /**
2516
+ * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
2517
+ * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
2518
+ * have a different value for each object in the union.
2519
+ * @param discriminator the name of the discriminator property
2520
+ * @param types an array of object schemas
2521
+ * @param params
2522
+ */
2523
+ static create(discriminator, options, params) {
2524
+ const optionsMap = /* @__PURE__ */ new Map();
2525
+ for (const type of options) {
2526
+ const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2527
+ if (!discriminatorValues.length) throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2528
+ for (const value of discriminatorValues) {
2529
+ if (optionsMap.has(value)) throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
2530
+ optionsMap.set(value, type);
2531
+ }
2532
+ }
2533
+ return new ZodDiscriminatedUnion({
2534
+ typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2535
+ discriminator,
2536
+ options,
2537
+ optionsMap,
2538
+ ...processCreateParams(params)
2539
+ });
2540
+ }
2541
+ };
2542
+ function mergeValues(a, b) {
2543
+ const aType = getParsedType(a);
2544
+ const bType = getParsedType(b);
2545
+ if (a === b) return {
2546
+ valid: true,
2547
+ data: a
2548
+ };
2549
+ else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
2550
+ const bKeys = util.objectKeys(b);
2551
+ const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
2552
+ const newObj = {
2553
+ ...a,
2554
+ ...b
2555
+ };
2556
+ for (const key of sharedKeys) {
2557
+ const sharedValue = mergeValues(a[key], b[key]);
2558
+ if (!sharedValue.valid) return { valid: false };
2559
+ newObj[key] = sharedValue.data;
2560
+ }
2561
+ return {
2562
+ valid: true,
2563
+ data: newObj
2564
+ };
2565
+ } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
2566
+ if (a.length !== b.length) return { valid: false };
2567
+ const newArray = [];
2568
+ for (let index = 0; index < a.length; index++) {
2569
+ const itemA = a[index];
2570
+ const itemB = b[index];
2571
+ const sharedValue = mergeValues(itemA, itemB);
2572
+ if (!sharedValue.valid) return { valid: false };
2573
+ newArray.push(sharedValue.data);
2574
+ }
2575
+ return {
2576
+ valid: true,
2577
+ data: newArray
2578
+ };
2579
+ } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) return {
2580
+ valid: true,
2581
+ data: a
2582
+ };
2583
+ else return { valid: false };
2584
+ }
2585
+ var ZodIntersection = class extends ZodType {
2586
+ _parse(input) {
2587
+ const { status, ctx } = this._processInputParams(input);
2588
+ const handleParsed = (parsedLeft, parsedRight) => {
2589
+ if (isAborted(parsedLeft) || isAborted(parsedRight)) return INVALID;
2590
+ const merged = mergeValues(parsedLeft.value, parsedRight.value);
2591
+ if (!merged.valid) {
2592
+ addIssueToContext(ctx, { code: ZodIssueCode.invalid_intersection_types });
2593
+ return INVALID;
2594
+ }
2595
+ if (isDirty(parsedLeft) || isDirty(parsedRight)) status.dirty();
2596
+ return {
2597
+ status: status.value,
2598
+ value: merged.data
2599
+ };
2600
+ };
2601
+ if (ctx.common.async) return Promise.all([this._def.left._parseAsync({
2602
+ data: ctx.data,
2603
+ path: ctx.path,
2604
+ parent: ctx
2605
+ }), this._def.right._parseAsync({
2606
+ data: ctx.data,
2607
+ path: ctx.path,
2608
+ parent: ctx
2609
+ })]).then(([left, right]) => handleParsed(left, right));
2610
+ else return handleParsed(this._def.left._parseSync({
2611
+ data: ctx.data,
2612
+ path: ctx.path,
2613
+ parent: ctx
2614
+ }), this._def.right._parseSync({
2615
+ data: ctx.data,
2616
+ path: ctx.path,
2617
+ parent: ctx
2618
+ }));
2619
+ }
2620
+ };
2621
+ ZodIntersection.create = (left, right, params) => {
2622
+ return new ZodIntersection({
2623
+ left,
2624
+ right,
2625
+ typeName: ZodFirstPartyTypeKind.ZodIntersection,
2626
+ ...processCreateParams(params)
2627
+ });
2628
+ };
2629
+ var ZodTuple = class ZodTuple extends ZodType {
2630
+ _parse(input) {
2631
+ const { status, ctx } = this._processInputParams(input);
2632
+ if (ctx.parsedType !== ZodParsedType.array) {
2633
+ addIssueToContext(ctx, {
2634
+ code: ZodIssueCode.invalid_type,
2635
+ expected: ZodParsedType.array,
2636
+ received: ctx.parsedType
2637
+ });
2638
+ return INVALID;
2639
+ }
2640
+ if (ctx.data.length < this._def.items.length) {
2641
+ addIssueToContext(ctx, {
2642
+ code: ZodIssueCode.too_small,
2643
+ minimum: this._def.items.length,
2644
+ inclusive: true,
2645
+ exact: false,
2646
+ type: "array"
2647
+ });
2648
+ return INVALID;
2649
+ }
2650
+ const rest = this._def.rest;
2651
+ if (!rest && ctx.data.length > this._def.items.length) {
2652
+ addIssueToContext(ctx, {
2653
+ code: ZodIssueCode.too_big,
2654
+ maximum: this._def.items.length,
2655
+ inclusive: true,
2656
+ exact: false,
2657
+ type: "array"
2658
+ });
2659
+ status.dirty();
2660
+ }
2661
+ const items = [...ctx.data].map((item, itemIndex) => {
2662
+ const schema = this._def.items[itemIndex] || this._def.rest;
2663
+ if (!schema) return null;
2664
+ return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
2665
+ }).filter((x) => !!x);
2666
+ if (ctx.common.async) return Promise.all(items).then((results) => {
2667
+ return ParseStatus.mergeArray(status, results);
2668
+ });
2669
+ else return ParseStatus.mergeArray(status, items);
2670
+ }
2671
+ get items() {
2672
+ return this._def.items;
2673
+ }
2674
+ rest(rest) {
2675
+ return new ZodTuple({
2676
+ ...this._def,
2677
+ rest
2678
+ });
2679
+ }
2680
+ };
2681
+ ZodTuple.create = (schemas, params) => {
2682
+ if (!Array.isArray(schemas)) throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2683
+ return new ZodTuple({
2684
+ items: schemas,
2685
+ typeName: ZodFirstPartyTypeKind.ZodTuple,
2686
+ rest: null,
2687
+ ...processCreateParams(params)
2688
+ });
2689
+ };
2690
+ var ZodRecord = class ZodRecord extends ZodType {
2691
+ get keySchema() {
2692
+ return this._def.keyType;
2693
+ }
2694
+ get valueSchema() {
2695
+ return this._def.valueType;
2696
+ }
2697
+ _parse(input) {
2698
+ const { status, ctx } = this._processInputParams(input);
2699
+ if (ctx.parsedType !== ZodParsedType.object) {
2700
+ addIssueToContext(ctx, {
2701
+ code: ZodIssueCode.invalid_type,
2702
+ expected: ZodParsedType.object,
2703
+ received: ctx.parsedType
2704
+ });
2705
+ return INVALID;
2706
+ }
2707
+ const pairs = [];
2708
+ const keyType = this._def.keyType;
2709
+ const valueType = this._def.valueType;
2710
+ for (const key in ctx.data) pairs.push({
2711
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2712
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
2713
+ alwaysSet: key in ctx.data
2714
+ });
2715
+ if (ctx.common.async) return ParseStatus.mergeObjectAsync(status, pairs);
2716
+ else return ParseStatus.mergeObjectSync(status, pairs);
2717
+ }
2718
+ get element() {
2719
+ return this._def.valueType;
2720
+ }
2721
+ static create(first, second, third) {
2722
+ if (second instanceof ZodType) return new ZodRecord({
2723
+ keyType: first,
2724
+ valueType: second,
2725
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
2726
+ ...processCreateParams(third)
2727
+ });
2728
+ return new ZodRecord({
2729
+ keyType: ZodString.create(),
2730
+ valueType: first,
2731
+ typeName: ZodFirstPartyTypeKind.ZodRecord,
2732
+ ...processCreateParams(second)
2733
+ });
2734
+ }
2735
+ };
2736
+ var ZodMap = class extends ZodType {
2737
+ get keySchema() {
2738
+ return this._def.keyType;
2739
+ }
2740
+ get valueSchema() {
2741
+ return this._def.valueType;
2742
+ }
2743
+ _parse(input) {
2744
+ const { status, ctx } = this._processInputParams(input);
2745
+ if (ctx.parsedType !== ZodParsedType.map) {
2746
+ addIssueToContext(ctx, {
2747
+ code: ZodIssueCode.invalid_type,
2748
+ expected: ZodParsedType.map,
2749
+ received: ctx.parsedType
2750
+ });
2751
+ return INVALID;
2752
+ }
2753
+ const keyType = this._def.keyType;
2754
+ const valueType = this._def.valueType;
2755
+ const pairs = [...ctx.data.entries()].map(([key, value], index) => {
2756
+ return {
2757
+ key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
2758
+ value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
2759
+ };
2760
+ });
2761
+ if (ctx.common.async) {
2762
+ const finalMap = /* @__PURE__ */ new Map();
2763
+ return Promise.resolve().then(async () => {
2764
+ for (const pair of pairs) {
2765
+ const key = await pair.key;
2766
+ const value = await pair.value;
2767
+ if (key.status === "aborted" || value.status === "aborted") return INVALID;
2768
+ if (key.status === "dirty" || value.status === "dirty") status.dirty();
2769
+ finalMap.set(key.value, value.value);
2770
+ }
2771
+ return {
2772
+ status: status.value,
2773
+ value: finalMap
2774
+ };
2775
+ });
2776
+ } else {
2777
+ const finalMap = /* @__PURE__ */ new Map();
2778
+ for (const pair of pairs) {
2779
+ const key = pair.key;
2780
+ const value = pair.value;
2781
+ if (key.status === "aborted" || value.status === "aborted") return INVALID;
2782
+ if (key.status === "dirty" || value.status === "dirty") status.dirty();
2783
+ finalMap.set(key.value, value.value);
2784
+ }
2785
+ return {
2786
+ status: status.value,
2787
+ value: finalMap
2788
+ };
2789
+ }
2790
+ }
2791
+ };
2792
+ ZodMap.create = (keyType, valueType, params) => {
2793
+ return new ZodMap({
2794
+ valueType,
2795
+ keyType,
2796
+ typeName: ZodFirstPartyTypeKind.ZodMap,
2797
+ ...processCreateParams(params)
2798
+ });
2799
+ };
2800
+ var ZodSet = class ZodSet extends ZodType {
2801
+ _parse(input) {
2802
+ const { status, ctx } = this._processInputParams(input);
2803
+ if (ctx.parsedType !== ZodParsedType.set) {
2804
+ addIssueToContext(ctx, {
2805
+ code: ZodIssueCode.invalid_type,
2806
+ expected: ZodParsedType.set,
2807
+ received: ctx.parsedType
2808
+ });
2809
+ return INVALID;
2810
+ }
2811
+ const def = this._def;
2812
+ if (def.minSize !== null) {
2813
+ if (ctx.data.size < def.minSize.value) {
2814
+ addIssueToContext(ctx, {
2815
+ code: ZodIssueCode.too_small,
2816
+ minimum: def.minSize.value,
2817
+ type: "set",
2818
+ inclusive: true,
2819
+ exact: false,
2820
+ message: def.minSize.message
2821
+ });
2822
+ status.dirty();
2823
+ }
2824
+ }
2825
+ if (def.maxSize !== null) {
2826
+ if (ctx.data.size > def.maxSize.value) {
2827
+ addIssueToContext(ctx, {
2828
+ code: ZodIssueCode.too_big,
2829
+ maximum: def.maxSize.value,
2830
+ type: "set",
2831
+ inclusive: true,
2832
+ exact: false,
2833
+ message: def.maxSize.message
2834
+ });
2835
+ status.dirty();
2836
+ }
2837
+ }
2838
+ const valueType = this._def.valueType;
2839
+ function finalizeSet(elements$1) {
2840
+ const parsedSet = /* @__PURE__ */ new Set();
2841
+ for (const element of elements$1) {
2842
+ if (element.status === "aborted") return INVALID;
2843
+ if (element.status === "dirty") status.dirty();
2844
+ parsedSet.add(element.value);
2845
+ }
2846
+ return {
2847
+ status: status.value,
2848
+ value: parsedSet
2849
+ };
2850
+ }
2851
+ const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
2852
+ if (ctx.common.async) return Promise.all(elements).then((elements$1) => finalizeSet(elements$1));
2853
+ else return finalizeSet(elements);
2854
+ }
2855
+ min(minSize, message) {
2856
+ return new ZodSet({
2857
+ ...this._def,
2858
+ minSize: {
2859
+ value: minSize,
2860
+ message: errorUtil.toString(message)
2861
+ }
2862
+ });
2863
+ }
2864
+ max(maxSize, message) {
2865
+ return new ZodSet({
2866
+ ...this._def,
2867
+ maxSize: {
2868
+ value: maxSize,
2869
+ message: errorUtil.toString(message)
2870
+ }
2871
+ });
2872
+ }
2873
+ size(size, message) {
2874
+ return this.min(size, message).max(size, message);
2875
+ }
2876
+ nonempty(message) {
2877
+ return this.min(1, message);
2878
+ }
2879
+ };
2880
+ ZodSet.create = (valueType, params) => {
2881
+ return new ZodSet({
2882
+ valueType,
2883
+ minSize: null,
2884
+ maxSize: null,
2885
+ typeName: ZodFirstPartyTypeKind.ZodSet,
2886
+ ...processCreateParams(params)
2887
+ });
2888
+ };
2889
+ var ZodFunction = class ZodFunction extends ZodType {
2890
+ constructor() {
2891
+ super(...arguments);
2892
+ this.validate = this.implement;
2893
+ }
2894
+ _parse(input) {
2895
+ const { ctx } = this._processInputParams(input);
2896
+ if (ctx.parsedType !== ZodParsedType.function) {
2897
+ addIssueToContext(ctx, {
2898
+ code: ZodIssueCode.invalid_type,
2899
+ expected: ZodParsedType.function,
2900
+ received: ctx.parsedType
2901
+ });
2902
+ return INVALID;
2903
+ }
2904
+ function makeArgsIssue(args, error) {
2905
+ return makeIssue({
2906
+ data: args,
2907
+ path: ctx.path,
2908
+ errorMaps: [
2909
+ ctx.common.contextualErrorMap,
2910
+ ctx.schemaErrorMap,
2911
+ getErrorMap(),
2912
+ en_default
2913
+ ].filter((x) => !!x),
2914
+ issueData: {
2915
+ code: ZodIssueCode.invalid_arguments,
2916
+ argumentsError: error
2917
+ }
2918
+ });
2919
+ }
2920
+ function makeReturnsIssue(returns, error) {
2921
+ return makeIssue({
2922
+ data: returns,
2923
+ path: ctx.path,
2924
+ errorMaps: [
2925
+ ctx.common.contextualErrorMap,
2926
+ ctx.schemaErrorMap,
2927
+ getErrorMap(),
2928
+ en_default
2929
+ ].filter((x) => !!x),
2930
+ issueData: {
2931
+ code: ZodIssueCode.invalid_return_type,
2932
+ returnTypeError: error
2933
+ }
2934
+ });
2935
+ }
2936
+ const params = { errorMap: ctx.common.contextualErrorMap };
2937
+ const fn = ctx.data;
2938
+ if (this._def.returns instanceof ZodPromise) {
2939
+ const me = this;
2940
+ return OK(async function(...args) {
2941
+ const error = new ZodError([]);
2942
+ const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
2943
+ error.addIssue(makeArgsIssue(args, e));
2944
+ throw error;
2945
+ });
2946
+ const result = await Reflect.apply(fn, this, parsedArgs);
2947
+ const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
2948
+ error.addIssue(makeReturnsIssue(result, e));
2949
+ throw error;
2950
+ });
2951
+ return parsedReturns;
2952
+ });
2953
+ } else {
2954
+ const me = this;
2955
+ return OK(function(...args) {
2956
+ const parsedArgs = me._def.args.safeParse(args, params);
2957
+ if (!parsedArgs.success) throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
2958
+ const result = Reflect.apply(fn, this, parsedArgs.data);
2959
+ const parsedReturns = me._def.returns.safeParse(result, params);
2960
+ if (!parsedReturns.success) throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
2961
+ return parsedReturns.data;
2962
+ });
2963
+ }
2964
+ }
2965
+ parameters() {
2966
+ return this._def.args;
2967
+ }
2968
+ returnType() {
2969
+ return this._def.returns;
2970
+ }
2971
+ args(...items) {
2972
+ return new ZodFunction({
2973
+ ...this._def,
2974
+ args: ZodTuple.create(items).rest(ZodUnknown.create())
2975
+ });
2976
+ }
2977
+ returns(returnType) {
2978
+ return new ZodFunction({
2979
+ ...this._def,
2980
+ returns: returnType
2981
+ });
2982
+ }
2983
+ implement(func) {
2984
+ const validatedFunc = this.parse(func);
2985
+ return validatedFunc;
2986
+ }
2987
+ strictImplement(func) {
2988
+ const validatedFunc = this.parse(func);
2989
+ return validatedFunc;
2990
+ }
2991
+ static create(args, returns, params) {
2992
+ return new ZodFunction({
2993
+ args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
2994
+ returns: returns || ZodUnknown.create(),
2995
+ typeName: ZodFirstPartyTypeKind.ZodFunction,
2996
+ ...processCreateParams(params)
2997
+ });
2998
+ }
2999
+ };
3000
+ var ZodLazy = class extends ZodType {
3001
+ get schema() {
3002
+ return this._def.getter();
3003
+ }
3004
+ _parse(input) {
3005
+ const { ctx } = this._processInputParams(input);
3006
+ const lazySchema = this._def.getter();
3007
+ return lazySchema._parse({
3008
+ data: ctx.data,
3009
+ path: ctx.path,
3010
+ parent: ctx
3011
+ });
3012
+ }
3013
+ };
3014
+ ZodLazy.create = (getter, params) => {
3015
+ return new ZodLazy({
3016
+ getter,
3017
+ typeName: ZodFirstPartyTypeKind.ZodLazy,
3018
+ ...processCreateParams(params)
3019
+ });
3020
+ };
3021
+ var ZodLiteral = class extends ZodType {
3022
+ _parse(input) {
3023
+ if (input.data !== this._def.value) {
3024
+ const ctx = this._getOrReturnCtx(input);
3025
+ addIssueToContext(ctx, {
3026
+ received: ctx.data,
3027
+ code: ZodIssueCode.invalid_literal,
3028
+ expected: this._def.value
3029
+ });
3030
+ return INVALID;
3031
+ }
3032
+ return {
3033
+ status: "valid",
3034
+ value: input.data
3035
+ };
3036
+ }
3037
+ get value() {
3038
+ return this._def.value;
3039
+ }
3040
+ };
3041
+ ZodLiteral.create = (value, params) => {
3042
+ return new ZodLiteral({
3043
+ value,
3044
+ typeName: ZodFirstPartyTypeKind.ZodLiteral,
3045
+ ...processCreateParams(params)
3046
+ });
3047
+ };
3048
+ function createZodEnum(values, params) {
3049
+ return new ZodEnum({
3050
+ values,
3051
+ typeName: ZodFirstPartyTypeKind.ZodEnum,
3052
+ ...processCreateParams(params)
3053
+ });
3054
+ }
3055
+ var ZodEnum = class ZodEnum extends ZodType {
3056
+ _parse(input) {
3057
+ if (typeof input.data !== "string") {
3058
+ const ctx = this._getOrReturnCtx(input);
3059
+ const expectedValues = this._def.values;
3060
+ addIssueToContext(ctx, {
3061
+ expected: util.joinValues(expectedValues),
3062
+ received: ctx.parsedType,
3063
+ code: ZodIssueCode.invalid_type
3064
+ });
3065
+ return INVALID;
3066
+ }
3067
+ if (!this._cache) this._cache = new Set(this._def.values);
3068
+ if (!this._cache.has(input.data)) {
3069
+ const ctx = this._getOrReturnCtx(input);
3070
+ const expectedValues = this._def.values;
3071
+ addIssueToContext(ctx, {
3072
+ received: ctx.data,
3073
+ code: ZodIssueCode.invalid_enum_value,
3074
+ options: expectedValues
3075
+ });
3076
+ return INVALID;
3077
+ }
3078
+ return OK(input.data);
3079
+ }
3080
+ get options() {
3081
+ return this._def.values;
3082
+ }
3083
+ get enum() {
3084
+ const enumValues = {};
3085
+ for (const val of this._def.values) enumValues[val] = val;
3086
+ return enumValues;
3087
+ }
3088
+ get Values() {
3089
+ const enumValues = {};
3090
+ for (const val of this._def.values) enumValues[val] = val;
3091
+ return enumValues;
3092
+ }
3093
+ get Enum() {
3094
+ const enumValues = {};
3095
+ for (const val of this._def.values) enumValues[val] = val;
3096
+ return enumValues;
3097
+ }
3098
+ extract(values, newDef = this._def) {
3099
+ return ZodEnum.create(values, {
3100
+ ...this._def,
3101
+ ...newDef
3102
+ });
3103
+ }
3104
+ exclude(values, newDef = this._def) {
3105
+ return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3106
+ ...this._def,
3107
+ ...newDef
3108
+ });
3109
+ }
3110
+ };
3111
+ ZodEnum.create = createZodEnum;
3112
+ var ZodNativeEnum = class extends ZodType {
3113
+ _parse(input) {
3114
+ const nativeEnumValues = util.getValidEnumValues(this._def.values);
3115
+ const ctx = this._getOrReturnCtx(input);
3116
+ if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
3117
+ const expectedValues = util.objectValues(nativeEnumValues);
3118
+ addIssueToContext(ctx, {
3119
+ expected: util.joinValues(expectedValues),
3120
+ received: ctx.parsedType,
3121
+ code: ZodIssueCode.invalid_type
3122
+ });
3123
+ return INVALID;
3124
+ }
3125
+ if (!this._cache) this._cache = new Set(util.getValidEnumValues(this._def.values));
3126
+ if (!this._cache.has(input.data)) {
3127
+ const expectedValues = util.objectValues(nativeEnumValues);
3128
+ addIssueToContext(ctx, {
3129
+ received: ctx.data,
3130
+ code: ZodIssueCode.invalid_enum_value,
3131
+ options: expectedValues
3132
+ });
3133
+ return INVALID;
3134
+ }
3135
+ return OK(input.data);
3136
+ }
3137
+ get enum() {
3138
+ return this._def.values;
3139
+ }
3140
+ };
3141
+ ZodNativeEnum.create = (values, params) => {
3142
+ return new ZodNativeEnum({
3143
+ values,
3144
+ typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
3145
+ ...processCreateParams(params)
3146
+ });
3147
+ };
3148
+ var ZodPromise = class extends ZodType {
3149
+ unwrap() {
3150
+ return this._def.type;
3151
+ }
3152
+ _parse(input) {
3153
+ const { ctx } = this._processInputParams(input);
3154
+ if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
3155
+ addIssueToContext(ctx, {
3156
+ code: ZodIssueCode.invalid_type,
3157
+ expected: ZodParsedType.promise,
3158
+ received: ctx.parsedType
3159
+ });
3160
+ return INVALID;
3161
+ }
3162
+ const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3163
+ return OK(promisified.then((data) => {
3164
+ return this._def.type.parseAsync(data, {
3165
+ path: ctx.path,
3166
+ errorMap: ctx.common.contextualErrorMap
3167
+ });
3168
+ }));
3169
+ }
3170
+ };
3171
+ ZodPromise.create = (schema, params) => {
3172
+ return new ZodPromise({
3173
+ type: schema,
3174
+ typeName: ZodFirstPartyTypeKind.ZodPromise,
3175
+ ...processCreateParams(params)
3176
+ });
3177
+ };
3178
+ var ZodEffects = class extends ZodType {
3179
+ innerType() {
3180
+ return this._def.schema;
3181
+ }
3182
+ sourceType() {
3183
+ return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
3184
+ }
3185
+ _parse(input) {
3186
+ const { status, ctx } = this._processInputParams(input);
3187
+ const effect = this._def.effect || null;
3188
+ const checkCtx = {
3189
+ addIssue: (arg) => {
3190
+ addIssueToContext(ctx, arg);
3191
+ if (arg.fatal) status.abort();
3192
+ else status.dirty();
3193
+ },
3194
+ get path() {
3195
+ return ctx.path;
3196
+ }
3197
+ };
3198
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3199
+ if (effect.type === "preprocess") {
3200
+ const processed = effect.transform(ctx.data, checkCtx);
3201
+ if (ctx.common.async) return Promise.resolve(processed).then(async (processed$1) => {
3202
+ if (status.value === "aborted") return INVALID;
3203
+ const result = await this._def.schema._parseAsync({
3204
+ data: processed$1,
3205
+ path: ctx.path,
3206
+ parent: ctx
3207
+ });
3208
+ if (result.status === "aborted") return INVALID;
3209
+ if (result.status === "dirty") return DIRTY(result.value);
3210
+ if (status.value === "dirty") return DIRTY(result.value);
3211
+ return result;
3212
+ });
3213
+ else {
3214
+ if (status.value === "aborted") return INVALID;
3215
+ const result = this._def.schema._parseSync({
3216
+ data: processed,
3217
+ path: ctx.path,
3218
+ parent: ctx
3219
+ });
3220
+ if (result.status === "aborted") return INVALID;
3221
+ if (result.status === "dirty") return DIRTY(result.value);
3222
+ if (status.value === "dirty") return DIRTY(result.value);
3223
+ return result;
3224
+ }
3225
+ }
3226
+ if (effect.type === "refinement") {
3227
+ const executeRefinement = (acc) => {
3228
+ const result = effect.refinement(acc, checkCtx);
3229
+ if (ctx.common.async) return Promise.resolve(result);
3230
+ if (result instanceof Promise) throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3231
+ return acc;
3232
+ };
3233
+ if (ctx.common.async === false) {
3234
+ const inner = this._def.schema._parseSync({
3235
+ data: ctx.data,
3236
+ path: ctx.path,
3237
+ parent: ctx
3238
+ });
3239
+ if (inner.status === "aborted") return INVALID;
3240
+ if (inner.status === "dirty") status.dirty();
3241
+ executeRefinement(inner.value);
3242
+ return {
3243
+ status: status.value,
3244
+ value: inner.value
3245
+ };
3246
+ } else return this._def.schema._parseAsync({
3247
+ data: ctx.data,
3248
+ path: ctx.path,
3249
+ parent: ctx
3250
+ }).then((inner) => {
3251
+ if (inner.status === "aborted") return INVALID;
3252
+ if (inner.status === "dirty") status.dirty();
3253
+ return executeRefinement(inner.value).then(() => {
3254
+ return {
3255
+ status: status.value,
3256
+ value: inner.value
3257
+ };
3258
+ });
3259
+ });
3260
+ }
3261
+ if (effect.type === "transform") if (ctx.common.async === false) {
3262
+ const base = this._def.schema._parseSync({
3263
+ data: ctx.data,
3264
+ path: ctx.path,
3265
+ parent: ctx
3266
+ });
3267
+ if (!isValid(base)) return INVALID;
3268
+ const result = effect.transform(base.value, checkCtx);
3269
+ if (result instanceof Promise) throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3270
+ return {
3271
+ status: status.value,
3272
+ value: result
3273
+ };
3274
+ } else return this._def.schema._parseAsync({
3275
+ data: ctx.data,
3276
+ path: ctx.path,
3277
+ parent: ctx
3278
+ }).then((base) => {
3279
+ if (!isValid(base)) return INVALID;
3280
+ return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({
3281
+ status: status.value,
3282
+ value: result
3283
+ }));
3284
+ });
3285
+ util.assertNever(effect);
3286
+ }
3287
+ };
3288
+ ZodEffects.create = (schema, effect, params) => {
3289
+ return new ZodEffects({
3290
+ schema,
3291
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
3292
+ effect,
3293
+ ...processCreateParams(params)
3294
+ });
3295
+ };
3296
+ ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
3297
+ return new ZodEffects({
3298
+ schema,
3299
+ effect: {
3300
+ type: "preprocess",
3301
+ transform: preprocess
3302
+ },
3303
+ typeName: ZodFirstPartyTypeKind.ZodEffects,
3304
+ ...processCreateParams(params)
3305
+ });
3306
+ };
3307
+ var ZodOptional = class extends ZodType {
3308
+ _parse(input) {
3309
+ const parsedType = this._getType(input);
3310
+ if (parsedType === ZodParsedType.undefined) return OK(void 0);
3311
+ return this._def.innerType._parse(input);
3312
+ }
3313
+ unwrap() {
3314
+ return this._def.innerType;
3315
+ }
3316
+ };
3317
+ ZodOptional.create = (type, params) => {
3318
+ return new ZodOptional({
3319
+ innerType: type,
3320
+ typeName: ZodFirstPartyTypeKind.ZodOptional,
3321
+ ...processCreateParams(params)
3322
+ });
3323
+ };
3324
+ var ZodNullable = class extends ZodType {
3325
+ _parse(input) {
3326
+ const parsedType = this._getType(input);
3327
+ if (parsedType === ZodParsedType.null) return OK(null);
3328
+ return this._def.innerType._parse(input);
3329
+ }
3330
+ unwrap() {
3331
+ return this._def.innerType;
3332
+ }
3333
+ };
3334
+ ZodNullable.create = (type, params) => {
3335
+ return new ZodNullable({
3336
+ innerType: type,
3337
+ typeName: ZodFirstPartyTypeKind.ZodNullable,
3338
+ ...processCreateParams(params)
3339
+ });
3340
+ };
3341
+ var ZodDefault = class extends ZodType {
3342
+ _parse(input) {
3343
+ const { ctx } = this._processInputParams(input);
3344
+ let data = ctx.data;
3345
+ if (ctx.parsedType === ZodParsedType.undefined) data = this._def.defaultValue();
3346
+ return this._def.innerType._parse({
3347
+ data,
3348
+ path: ctx.path,
3349
+ parent: ctx
3350
+ });
3351
+ }
3352
+ removeDefault() {
3353
+ return this._def.innerType;
3354
+ }
3355
+ };
3356
+ ZodDefault.create = (type, params) => {
3357
+ return new ZodDefault({
3358
+ innerType: type,
3359
+ typeName: ZodFirstPartyTypeKind.ZodDefault,
3360
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3361
+ ...processCreateParams(params)
3362
+ });
3363
+ };
3364
+ var ZodCatch = class extends ZodType {
3365
+ _parse(input) {
3366
+ const { ctx } = this._processInputParams(input);
3367
+ const newCtx = {
3368
+ ...ctx,
3369
+ common: {
3370
+ ...ctx.common,
3371
+ issues: []
3372
+ }
3373
+ };
3374
+ const result = this._def.innerType._parse({
3375
+ data: newCtx.data,
3376
+ path: newCtx.path,
3377
+ parent: { ...newCtx }
3378
+ });
3379
+ if (isAsync(result)) return result.then((result$1) => {
3380
+ return {
3381
+ status: "valid",
3382
+ value: result$1.status === "valid" ? result$1.value : this._def.catchValue({
3383
+ get error() {
3384
+ return new ZodError(newCtx.common.issues);
3385
+ },
3386
+ input: newCtx.data
3387
+ })
3388
+ };
3389
+ });
3390
+ else return {
3391
+ status: "valid",
3392
+ value: result.status === "valid" ? result.value : this._def.catchValue({
3393
+ get error() {
3394
+ return new ZodError(newCtx.common.issues);
3395
+ },
3396
+ input: newCtx.data
3397
+ })
3398
+ };
3399
+ }
3400
+ removeCatch() {
3401
+ return this._def.innerType;
3402
+ }
3403
+ };
3404
+ ZodCatch.create = (type, params) => {
3405
+ return new ZodCatch({
3406
+ innerType: type,
3407
+ typeName: ZodFirstPartyTypeKind.ZodCatch,
3408
+ catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
3409
+ ...processCreateParams(params)
3410
+ });
3411
+ };
3412
+ var ZodNaN = class extends ZodType {
3413
+ _parse(input) {
3414
+ const parsedType = this._getType(input);
3415
+ if (parsedType !== ZodParsedType.nan) {
3416
+ const ctx = this._getOrReturnCtx(input);
3417
+ addIssueToContext(ctx, {
3418
+ code: ZodIssueCode.invalid_type,
3419
+ expected: ZodParsedType.nan,
3420
+ received: ctx.parsedType
3421
+ });
3422
+ return INVALID;
3423
+ }
3424
+ return {
3425
+ status: "valid",
3426
+ value: input.data
3427
+ };
3428
+ }
3429
+ };
3430
+ ZodNaN.create = (params) => {
3431
+ return new ZodNaN({
3432
+ typeName: ZodFirstPartyTypeKind.ZodNaN,
3433
+ ...processCreateParams(params)
3434
+ });
3435
+ };
3436
+ const BRAND = Symbol("zod_brand");
3437
+ var ZodBranded = class extends ZodType {
3438
+ _parse(input) {
3439
+ const { ctx } = this._processInputParams(input);
3440
+ const data = ctx.data;
3441
+ return this._def.type._parse({
3442
+ data,
3443
+ path: ctx.path,
3444
+ parent: ctx
3445
+ });
3446
+ }
3447
+ unwrap() {
3448
+ return this._def.type;
3449
+ }
3450
+ };
3451
+ var ZodPipeline = class ZodPipeline extends ZodType {
3452
+ _parse(input) {
3453
+ const { status, ctx } = this._processInputParams(input);
3454
+ if (ctx.common.async) {
3455
+ const handleAsync = async () => {
3456
+ const inResult = await this._def.in._parseAsync({
3457
+ data: ctx.data,
3458
+ path: ctx.path,
3459
+ parent: ctx
3460
+ });
3461
+ if (inResult.status === "aborted") return INVALID;
3462
+ if (inResult.status === "dirty") {
3463
+ status.dirty();
3464
+ return DIRTY(inResult.value);
3465
+ } else return this._def.out._parseAsync({
3466
+ data: inResult.value,
3467
+ path: ctx.path,
3468
+ parent: ctx
3469
+ });
3470
+ };
3471
+ return handleAsync();
3472
+ } else {
3473
+ const inResult = this._def.in._parseSync({
3474
+ data: ctx.data,
3475
+ path: ctx.path,
3476
+ parent: ctx
3477
+ });
3478
+ if (inResult.status === "aborted") return INVALID;
3479
+ if (inResult.status === "dirty") {
3480
+ status.dirty();
3481
+ return {
3482
+ status: "dirty",
3483
+ value: inResult.value
3484
+ };
3485
+ } else return this._def.out._parseSync({
3486
+ data: inResult.value,
3487
+ path: ctx.path,
3488
+ parent: ctx
3489
+ });
3490
+ }
3491
+ }
3492
+ static create(a, b) {
3493
+ return new ZodPipeline({
3494
+ in: a,
3495
+ out: b,
3496
+ typeName: ZodFirstPartyTypeKind.ZodPipeline
3497
+ });
3498
+ }
3499
+ };
3500
+ var ZodReadonly = class extends ZodType {
3501
+ _parse(input) {
3502
+ const result = this._def.innerType._parse(input);
3503
+ const freeze = (data) => {
3504
+ if (isValid(data)) data.value = Object.freeze(data.value);
3505
+ return data;
3506
+ };
3507
+ return isAsync(result) ? result.then((data) => freeze(data)) : freeze(result);
3508
+ }
3509
+ unwrap() {
3510
+ return this._def.innerType;
3511
+ }
3512
+ };
3513
+ ZodReadonly.create = (type, params) => {
3514
+ return new ZodReadonly({
3515
+ innerType: type,
3516
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
3517
+ ...processCreateParams(params)
3518
+ });
3519
+ };
3520
+ function cleanParams(params, data) {
3521
+ const p = typeof params === "function" ? params(data) : typeof params === "string" ? { message: params } : params;
3522
+ const p2 = typeof p === "string" ? { message: p } : p;
3523
+ return p2;
3524
+ }
3525
+ function custom(check, _params = {}, fatal) {
3526
+ if (check) return ZodAny.create().superRefine((data, ctx) => {
3527
+ const r = check(data);
3528
+ if (r instanceof Promise) return r.then((r$1) => {
3529
+ if (!r$1) {
3530
+ const params = cleanParams(_params, data);
3531
+ const _fatal = params.fatal ?? fatal ?? true;
3532
+ ctx.addIssue({
3533
+ code: "custom",
3534
+ ...params,
3535
+ fatal: _fatal
3536
+ });
3537
+ }
3538
+ });
3539
+ if (!r) {
3540
+ const params = cleanParams(_params, data);
3541
+ const _fatal = params.fatal ?? fatal ?? true;
3542
+ ctx.addIssue({
3543
+ code: "custom",
3544
+ ...params,
3545
+ fatal: _fatal
3546
+ });
3547
+ }
3548
+ return;
3549
+ });
3550
+ return ZodAny.create();
3551
+ }
3552
+ const late = { object: ZodObject.lazycreate };
3553
+ var ZodFirstPartyTypeKind;
3554
+ (function(ZodFirstPartyTypeKind$1) {
3555
+ ZodFirstPartyTypeKind$1["ZodString"] = "ZodString";
3556
+ ZodFirstPartyTypeKind$1["ZodNumber"] = "ZodNumber";
3557
+ ZodFirstPartyTypeKind$1["ZodNaN"] = "ZodNaN";
3558
+ ZodFirstPartyTypeKind$1["ZodBigInt"] = "ZodBigInt";
3559
+ ZodFirstPartyTypeKind$1["ZodBoolean"] = "ZodBoolean";
3560
+ ZodFirstPartyTypeKind$1["ZodDate"] = "ZodDate";
3561
+ ZodFirstPartyTypeKind$1["ZodSymbol"] = "ZodSymbol";
3562
+ ZodFirstPartyTypeKind$1["ZodUndefined"] = "ZodUndefined";
3563
+ ZodFirstPartyTypeKind$1["ZodNull"] = "ZodNull";
3564
+ ZodFirstPartyTypeKind$1["ZodAny"] = "ZodAny";
3565
+ ZodFirstPartyTypeKind$1["ZodUnknown"] = "ZodUnknown";
3566
+ ZodFirstPartyTypeKind$1["ZodNever"] = "ZodNever";
3567
+ ZodFirstPartyTypeKind$1["ZodVoid"] = "ZodVoid";
3568
+ ZodFirstPartyTypeKind$1["ZodArray"] = "ZodArray";
3569
+ ZodFirstPartyTypeKind$1["ZodObject"] = "ZodObject";
3570
+ ZodFirstPartyTypeKind$1["ZodUnion"] = "ZodUnion";
3571
+ ZodFirstPartyTypeKind$1["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
3572
+ ZodFirstPartyTypeKind$1["ZodIntersection"] = "ZodIntersection";
3573
+ ZodFirstPartyTypeKind$1["ZodTuple"] = "ZodTuple";
3574
+ ZodFirstPartyTypeKind$1["ZodRecord"] = "ZodRecord";
3575
+ ZodFirstPartyTypeKind$1["ZodMap"] = "ZodMap";
3576
+ ZodFirstPartyTypeKind$1["ZodSet"] = "ZodSet";
3577
+ ZodFirstPartyTypeKind$1["ZodFunction"] = "ZodFunction";
3578
+ ZodFirstPartyTypeKind$1["ZodLazy"] = "ZodLazy";
3579
+ ZodFirstPartyTypeKind$1["ZodLiteral"] = "ZodLiteral";
3580
+ ZodFirstPartyTypeKind$1["ZodEnum"] = "ZodEnum";
3581
+ ZodFirstPartyTypeKind$1["ZodEffects"] = "ZodEffects";
3582
+ ZodFirstPartyTypeKind$1["ZodNativeEnum"] = "ZodNativeEnum";
3583
+ ZodFirstPartyTypeKind$1["ZodOptional"] = "ZodOptional";
3584
+ ZodFirstPartyTypeKind$1["ZodNullable"] = "ZodNullable";
3585
+ ZodFirstPartyTypeKind$1["ZodDefault"] = "ZodDefault";
3586
+ ZodFirstPartyTypeKind$1["ZodCatch"] = "ZodCatch";
3587
+ ZodFirstPartyTypeKind$1["ZodPromise"] = "ZodPromise";
3588
+ ZodFirstPartyTypeKind$1["ZodBranded"] = "ZodBranded";
3589
+ ZodFirstPartyTypeKind$1["ZodPipeline"] = "ZodPipeline";
3590
+ ZodFirstPartyTypeKind$1["ZodReadonly"] = "ZodReadonly";
3591
+ })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3592
+ const instanceOfType = (cls, params = { message: `Input not instance of ${cls.name}` }) => custom((data) => data instanceof cls, params);
3593
+ const stringType = ZodString.create;
3594
+ const numberType = ZodNumber.create;
3595
+ const nanType = ZodNaN.create;
3596
+ const bigIntType = ZodBigInt.create;
3597
+ const booleanType = ZodBoolean.create;
3598
+ const dateType = ZodDate.create;
3599
+ const symbolType = ZodSymbol.create;
3600
+ const undefinedType = ZodUndefined.create;
3601
+ const nullType = ZodNull.create;
3602
+ const anyType = ZodAny.create;
3603
+ const unknownType = ZodUnknown.create;
3604
+ const neverType = ZodNever.create;
3605
+ const voidType = ZodVoid.create;
3606
+ const arrayType = ZodArray.create;
3607
+ const objectType = ZodObject.create;
3608
+ const strictObjectType = ZodObject.strictCreate;
3609
+ const unionType = ZodUnion.create;
3610
+ const discriminatedUnionType = ZodDiscriminatedUnion.create;
3611
+ const intersectionType = ZodIntersection.create;
3612
+ const tupleType = ZodTuple.create;
3613
+ const recordType = ZodRecord.create;
3614
+ const mapType = ZodMap.create;
3615
+ const setType = ZodSet.create;
3616
+ const functionType = ZodFunction.create;
3617
+ const lazyType = ZodLazy.create;
3618
+ const literalType = ZodLiteral.create;
3619
+ const enumType = ZodEnum.create;
3620
+ const nativeEnumType = ZodNativeEnum.create;
3621
+ const promiseType = ZodPromise.create;
3622
+ const effectsType = ZodEffects.create;
3623
+ const optionalType = ZodOptional.create;
3624
+ const nullableType = ZodNullable.create;
3625
+ const preprocessType = ZodEffects.createWithPreprocess;
3626
+ const pipelineType = ZodPipeline.create;
3627
+ const ostring = () => stringType().optional();
3628
+ const onumber = () => numberType().optional();
3629
+ const oboolean = () => booleanType().optional();
3630
+ const coerce = {
3631
+ string: (arg) => ZodString.create({
3632
+ ...arg,
3633
+ coerce: true
3634
+ }),
3635
+ number: (arg) => ZodNumber.create({
3636
+ ...arg,
3637
+ coerce: true
3638
+ }),
3639
+ boolean: (arg) => ZodBoolean.create({
3640
+ ...arg,
3641
+ coerce: true
3642
+ }),
3643
+ bigint: (arg) => ZodBigInt.create({
3644
+ ...arg,
3645
+ coerce: true
3646
+ }),
3647
+ date: (arg) => ZodDate.create({
3648
+ ...arg,
3649
+ coerce: true
3650
+ })
3651
+ };
3652
+ const NEVER = INVALID;
3653
+
3654
+ //#endregion
3655
+ //#region ../../node_modules/.pnpm/zod@3.25.67/node_modules/zod/dist/esm/v3/external.js
3656
+ var external_exports = {};
3657
+ require_chunk.__export(external_exports, {
3658
+ BRAND: () => BRAND,
3659
+ DIRTY: () => DIRTY,
3660
+ EMPTY_PATH: () => EMPTY_PATH,
3661
+ INVALID: () => INVALID,
3662
+ NEVER: () => NEVER,
3663
+ OK: () => OK,
3664
+ ParseStatus: () => ParseStatus,
3665
+ Schema: () => ZodType,
3666
+ ZodAny: () => ZodAny,
3667
+ ZodArray: () => ZodArray,
3668
+ ZodBigInt: () => ZodBigInt,
3669
+ ZodBoolean: () => ZodBoolean,
3670
+ ZodBranded: () => ZodBranded,
3671
+ ZodCatch: () => ZodCatch,
3672
+ ZodDate: () => ZodDate,
3673
+ ZodDefault: () => ZodDefault,
3674
+ ZodDiscriminatedUnion: () => ZodDiscriminatedUnion,
3675
+ ZodEffects: () => ZodEffects,
3676
+ ZodEnum: () => ZodEnum,
3677
+ ZodError: () => ZodError,
3678
+ ZodFirstPartyTypeKind: () => ZodFirstPartyTypeKind,
3679
+ ZodFunction: () => ZodFunction,
3680
+ ZodIntersection: () => ZodIntersection,
3681
+ ZodIssueCode: () => ZodIssueCode,
3682
+ ZodLazy: () => ZodLazy,
3683
+ ZodLiteral: () => ZodLiteral,
3684
+ ZodMap: () => ZodMap,
3685
+ ZodNaN: () => ZodNaN,
3686
+ ZodNativeEnum: () => ZodNativeEnum,
3687
+ ZodNever: () => ZodNever,
3688
+ ZodNull: () => ZodNull,
3689
+ ZodNullable: () => ZodNullable,
3690
+ ZodNumber: () => ZodNumber,
3691
+ ZodObject: () => ZodObject,
3692
+ ZodOptional: () => ZodOptional,
3693
+ ZodParsedType: () => ZodParsedType,
3694
+ ZodPipeline: () => ZodPipeline,
3695
+ ZodPromise: () => ZodPromise,
3696
+ ZodReadonly: () => ZodReadonly,
3697
+ ZodRecord: () => ZodRecord,
3698
+ ZodSchema: () => ZodType,
3699
+ ZodSet: () => ZodSet,
3700
+ ZodString: () => ZodString,
3701
+ ZodSymbol: () => ZodSymbol,
3702
+ ZodTransformer: () => ZodEffects,
3703
+ ZodTuple: () => ZodTuple,
3704
+ ZodType: () => ZodType,
3705
+ ZodUndefined: () => ZodUndefined,
3706
+ ZodUnion: () => ZodUnion,
3707
+ ZodUnknown: () => ZodUnknown,
3708
+ ZodVoid: () => ZodVoid,
3709
+ addIssueToContext: () => addIssueToContext,
3710
+ any: () => anyType,
3711
+ array: () => arrayType,
3712
+ bigint: () => bigIntType,
3713
+ boolean: () => booleanType,
3714
+ coerce: () => coerce,
3715
+ custom: () => custom,
3716
+ date: () => dateType,
3717
+ datetimeRegex: () => datetimeRegex,
3718
+ defaultErrorMap: () => en_default,
3719
+ discriminatedUnion: () => discriminatedUnionType,
3720
+ effect: () => effectsType,
3721
+ enum: () => enumType,
3722
+ function: () => functionType,
3723
+ getErrorMap: () => getErrorMap,
3724
+ getParsedType: () => getParsedType,
3725
+ instanceof: () => instanceOfType,
3726
+ intersection: () => intersectionType,
3727
+ isAborted: () => isAborted,
3728
+ isAsync: () => isAsync,
3729
+ isDirty: () => isDirty,
3730
+ isValid: () => isValid,
3731
+ late: () => late,
3732
+ lazy: () => lazyType,
3733
+ literal: () => literalType,
3734
+ makeIssue: () => makeIssue,
3735
+ map: () => mapType,
3736
+ nan: () => nanType,
3737
+ nativeEnum: () => nativeEnumType,
3738
+ never: () => neverType,
3739
+ null: () => nullType,
3740
+ nullable: () => nullableType,
3741
+ number: () => numberType,
3742
+ object: () => objectType,
3743
+ objectUtil: () => objectUtil,
3744
+ oboolean: () => oboolean,
3745
+ onumber: () => onumber,
3746
+ optional: () => optionalType,
3747
+ ostring: () => ostring,
3748
+ pipeline: () => pipelineType,
3749
+ preprocess: () => preprocessType,
3750
+ promise: () => promiseType,
3751
+ quotelessJson: () => quotelessJson,
3752
+ record: () => recordType,
3753
+ set: () => setType,
3754
+ setErrorMap: () => setErrorMap,
3755
+ strictObject: () => strictObjectType,
3756
+ string: () => stringType,
3757
+ symbol: () => symbolType,
3758
+ transformer: () => effectsType,
3759
+ tuple: () => tupleType,
3760
+ undefined: () => undefinedType,
3761
+ union: () => unionType,
3762
+ unknown: () => unknownType,
3763
+ util: () => util,
3764
+ void: () => voidType
3765
+ });
3766
+
3767
+ //#endregion
3768
+ Object.defineProperty(exports, 'BRAND', {
3769
+ enumerable: true,
3770
+ get: function () {
3771
+ return BRAND;
3772
+ }
3773
+ });
3774
+ Object.defineProperty(exports, 'DIRTY', {
3775
+ enumerable: true,
3776
+ get: function () {
3777
+ return DIRTY;
3778
+ }
3779
+ });
3780
+ Object.defineProperty(exports, 'EMPTY_PATH', {
3781
+ enumerable: true,
3782
+ get: function () {
3783
+ return EMPTY_PATH;
3784
+ }
3785
+ });
3786
+ Object.defineProperty(exports, 'INVALID', {
3787
+ enumerable: true,
3788
+ get: function () {
3789
+ return INVALID;
3790
+ }
3791
+ });
3792
+ Object.defineProperty(exports, 'NEVER', {
3793
+ enumerable: true,
3794
+ get: function () {
3795
+ return NEVER;
3796
+ }
3797
+ });
3798
+ Object.defineProperty(exports, 'OK', {
3799
+ enumerable: true,
3800
+ get: function () {
3801
+ return OK;
3802
+ }
3803
+ });
3804
+ Object.defineProperty(exports, 'ParseStatus', {
3805
+ enumerable: true,
3806
+ get: function () {
3807
+ return ParseStatus;
3808
+ }
3809
+ });
3810
+ Object.defineProperty(exports, 'ZodAny', {
3811
+ enumerable: true,
3812
+ get: function () {
3813
+ return ZodAny;
3814
+ }
3815
+ });
3816
+ Object.defineProperty(exports, 'ZodArray', {
3817
+ enumerable: true,
3818
+ get: function () {
3819
+ return ZodArray;
3820
+ }
3821
+ });
3822
+ Object.defineProperty(exports, 'ZodBigInt', {
3823
+ enumerable: true,
3824
+ get: function () {
3825
+ return ZodBigInt;
3826
+ }
3827
+ });
3828
+ Object.defineProperty(exports, 'ZodBoolean', {
3829
+ enumerable: true,
3830
+ get: function () {
3831
+ return ZodBoolean;
3832
+ }
3833
+ });
3834
+ Object.defineProperty(exports, 'ZodBranded', {
3835
+ enumerable: true,
3836
+ get: function () {
3837
+ return ZodBranded;
3838
+ }
3839
+ });
3840
+ Object.defineProperty(exports, 'ZodCatch', {
3841
+ enumerable: true,
3842
+ get: function () {
3843
+ return ZodCatch;
3844
+ }
3845
+ });
3846
+ Object.defineProperty(exports, 'ZodDate', {
3847
+ enumerable: true,
3848
+ get: function () {
3849
+ return ZodDate;
3850
+ }
3851
+ });
3852
+ Object.defineProperty(exports, 'ZodDefault', {
3853
+ enumerable: true,
3854
+ get: function () {
3855
+ return ZodDefault;
3856
+ }
3857
+ });
3858
+ Object.defineProperty(exports, 'ZodDiscriminatedUnion', {
3859
+ enumerable: true,
3860
+ get: function () {
3861
+ return ZodDiscriminatedUnion;
3862
+ }
3863
+ });
3864
+ Object.defineProperty(exports, 'ZodEffects', {
3865
+ enumerable: true,
3866
+ get: function () {
3867
+ return ZodEffects;
3868
+ }
3869
+ });
3870
+ Object.defineProperty(exports, 'ZodEnum', {
3871
+ enumerable: true,
3872
+ get: function () {
3873
+ return ZodEnum;
3874
+ }
3875
+ });
3876
+ Object.defineProperty(exports, 'ZodError', {
3877
+ enumerable: true,
3878
+ get: function () {
3879
+ return ZodError;
3880
+ }
3881
+ });
3882
+ Object.defineProperty(exports, 'ZodFirstPartyTypeKind', {
3883
+ enumerable: true,
3884
+ get: function () {
3885
+ return ZodFirstPartyTypeKind;
3886
+ }
3887
+ });
3888
+ Object.defineProperty(exports, 'ZodFunction', {
3889
+ enumerable: true,
3890
+ get: function () {
3891
+ return ZodFunction;
3892
+ }
3893
+ });
3894
+ Object.defineProperty(exports, 'ZodIntersection', {
3895
+ enumerable: true,
3896
+ get: function () {
3897
+ return ZodIntersection;
3898
+ }
3899
+ });
3900
+ Object.defineProperty(exports, 'ZodIssueCode', {
3901
+ enumerable: true,
3902
+ get: function () {
3903
+ return ZodIssueCode;
3904
+ }
3905
+ });
3906
+ Object.defineProperty(exports, 'ZodLazy', {
3907
+ enumerable: true,
3908
+ get: function () {
3909
+ return ZodLazy;
3910
+ }
3911
+ });
3912
+ Object.defineProperty(exports, 'ZodLiteral', {
3913
+ enumerable: true,
3914
+ get: function () {
3915
+ return ZodLiteral;
3916
+ }
3917
+ });
3918
+ Object.defineProperty(exports, 'ZodMap', {
3919
+ enumerable: true,
3920
+ get: function () {
3921
+ return ZodMap;
3922
+ }
3923
+ });
3924
+ Object.defineProperty(exports, 'ZodNaN', {
3925
+ enumerable: true,
3926
+ get: function () {
3927
+ return ZodNaN;
3928
+ }
3929
+ });
3930
+ Object.defineProperty(exports, 'ZodNativeEnum', {
3931
+ enumerable: true,
3932
+ get: function () {
3933
+ return ZodNativeEnum;
3934
+ }
3935
+ });
3936
+ Object.defineProperty(exports, 'ZodNever', {
3937
+ enumerable: true,
3938
+ get: function () {
3939
+ return ZodNever;
3940
+ }
3941
+ });
3942
+ Object.defineProperty(exports, 'ZodNull', {
3943
+ enumerable: true,
3944
+ get: function () {
3945
+ return ZodNull;
3946
+ }
3947
+ });
3948
+ Object.defineProperty(exports, 'ZodNullable', {
3949
+ enumerable: true,
3950
+ get: function () {
3951
+ return ZodNullable;
3952
+ }
3953
+ });
3954
+ Object.defineProperty(exports, 'ZodNumber', {
3955
+ enumerable: true,
3956
+ get: function () {
3957
+ return ZodNumber;
3958
+ }
3959
+ });
3960
+ Object.defineProperty(exports, 'ZodObject', {
3961
+ enumerable: true,
3962
+ get: function () {
3963
+ return ZodObject;
3964
+ }
3965
+ });
3966
+ Object.defineProperty(exports, 'ZodOptional', {
3967
+ enumerable: true,
3968
+ get: function () {
3969
+ return ZodOptional;
3970
+ }
3971
+ });
3972
+ Object.defineProperty(exports, 'ZodParsedType', {
3973
+ enumerable: true,
3974
+ get: function () {
3975
+ return ZodParsedType;
3976
+ }
3977
+ });
3978
+ Object.defineProperty(exports, 'ZodPipeline', {
3979
+ enumerable: true,
3980
+ get: function () {
3981
+ return ZodPipeline;
3982
+ }
3983
+ });
3984
+ Object.defineProperty(exports, 'ZodPromise', {
3985
+ enumerable: true,
3986
+ get: function () {
3987
+ return ZodPromise;
3988
+ }
3989
+ });
3990
+ Object.defineProperty(exports, 'ZodReadonly', {
3991
+ enumerable: true,
3992
+ get: function () {
3993
+ return ZodReadonly;
3994
+ }
3995
+ });
3996
+ Object.defineProperty(exports, 'ZodRecord', {
3997
+ enumerable: true,
3998
+ get: function () {
3999
+ return ZodRecord;
4000
+ }
4001
+ });
4002
+ Object.defineProperty(exports, 'ZodSet', {
4003
+ enumerable: true,
4004
+ get: function () {
4005
+ return ZodSet;
4006
+ }
4007
+ });
4008
+ Object.defineProperty(exports, 'ZodString', {
4009
+ enumerable: true,
4010
+ get: function () {
4011
+ return ZodString;
4012
+ }
4013
+ });
4014
+ Object.defineProperty(exports, 'ZodSymbol', {
4015
+ enumerable: true,
4016
+ get: function () {
4017
+ return ZodSymbol;
4018
+ }
4019
+ });
4020
+ Object.defineProperty(exports, 'ZodTuple', {
4021
+ enumerable: true,
4022
+ get: function () {
4023
+ return ZodTuple;
4024
+ }
4025
+ });
4026
+ Object.defineProperty(exports, 'ZodType', {
4027
+ enumerable: true,
4028
+ get: function () {
4029
+ return ZodType;
4030
+ }
4031
+ });
4032
+ Object.defineProperty(exports, 'ZodUndefined', {
4033
+ enumerable: true,
4034
+ get: function () {
4035
+ return ZodUndefined;
4036
+ }
4037
+ });
4038
+ Object.defineProperty(exports, 'ZodUnion', {
4039
+ enumerable: true,
4040
+ get: function () {
4041
+ return ZodUnion;
4042
+ }
4043
+ });
4044
+ Object.defineProperty(exports, 'ZodUnknown', {
4045
+ enumerable: true,
4046
+ get: function () {
4047
+ return ZodUnknown;
4048
+ }
4049
+ });
4050
+ Object.defineProperty(exports, 'ZodVoid', {
4051
+ enumerable: true,
4052
+ get: function () {
4053
+ return ZodVoid;
4054
+ }
4055
+ });
4056
+ Object.defineProperty(exports, 'addIssueToContext', {
4057
+ enumerable: true,
4058
+ get: function () {
4059
+ return addIssueToContext;
4060
+ }
4061
+ });
4062
+ Object.defineProperty(exports, 'anyType', {
4063
+ enumerable: true,
4064
+ get: function () {
4065
+ return anyType;
4066
+ }
4067
+ });
4068
+ Object.defineProperty(exports, 'arrayType', {
4069
+ enumerable: true,
4070
+ get: function () {
4071
+ return arrayType;
4072
+ }
4073
+ });
4074
+ Object.defineProperty(exports, 'bigIntType', {
4075
+ enumerable: true,
4076
+ get: function () {
4077
+ return bigIntType;
4078
+ }
4079
+ });
4080
+ Object.defineProperty(exports, 'booleanType', {
4081
+ enumerable: true,
4082
+ get: function () {
4083
+ return booleanType;
4084
+ }
4085
+ });
4086
+ Object.defineProperty(exports, 'coerce', {
4087
+ enumerable: true,
4088
+ get: function () {
4089
+ return coerce;
4090
+ }
4091
+ });
4092
+ Object.defineProperty(exports, 'custom', {
4093
+ enumerable: true,
4094
+ get: function () {
4095
+ return custom;
4096
+ }
4097
+ });
4098
+ Object.defineProperty(exports, 'dateType', {
4099
+ enumerable: true,
4100
+ get: function () {
4101
+ return dateType;
4102
+ }
4103
+ });
4104
+ Object.defineProperty(exports, 'datetimeRegex', {
4105
+ enumerable: true,
4106
+ get: function () {
4107
+ return datetimeRegex;
4108
+ }
4109
+ });
4110
+ Object.defineProperty(exports, 'discriminatedUnionType', {
4111
+ enumerable: true,
4112
+ get: function () {
4113
+ return discriminatedUnionType;
4114
+ }
4115
+ });
4116
+ Object.defineProperty(exports, 'effectsType', {
4117
+ enumerable: true,
4118
+ get: function () {
4119
+ return effectsType;
4120
+ }
4121
+ });
4122
+ Object.defineProperty(exports, 'en_default', {
4123
+ enumerable: true,
4124
+ get: function () {
4125
+ return en_default;
4126
+ }
4127
+ });
4128
+ Object.defineProperty(exports, 'enumType', {
4129
+ enumerable: true,
4130
+ get: function () {
4131
+ return enumType;
4132
+ }
4133
+ });
4134
+ Object.defineProperty(exports, 'external_exports', {
4135
+ enumerable: true,
4136
+ get: function () {
4137
+ return external_exports;
4138
+ }
4139
+ });
4140
+ Object.defineProperty(exports, 'functionType', {
4141
+ enumerable: true,
4142
+ get: function () {
4143
+ return functionType;
4144
+ }
4145
+ });
4146
+ Object.defineProperty(exports, 'getErrorMap', {
4147
+ enumerable: true,
4148
+ get: function () {
4149
+ return getErrorMap;
4150
+ }
4151
+ });
4152
+ Object.defineProperty(exports, 'getParsedType', {
4153
+ enumerable: true,
4154
+ get: function () {
4155
+ return getParsedType;
4156
+ }
4157
+ });
4158
+ Object.defineProperty(exports, 'instanceOfType', {
4159
+ enumerable: true,
4160
+ get: function () {
4161
+ return instanceOfType;
4162
+ }
4163
+ });
4164
+ Object.defineProperty(exports, 'intersectionType', {
4165
+ enumerable: true,
4166
+ get: function () {
4167
+ return intersectionType;
4168
+ }
4169
+ });
4170
+ Object.defineProperty(exports, 'isAborted', {
4171
+ enumerable: true,
4172
+ get: function () {
4173
+ return isAborted;
4174
+ }
4175
+ });
4176
+ Object.defineProperty(exports, 'isAsync', {
4177
+ enumerable: true,
4178
+ get: function () {
4179
+ return isAsync;
4180
+ }
4181
+ });
4182
+ Object.defineProperty(exports, 'isDirty', {
4183
+ enumerable: true,
4184
+ get: function () {
4185
+ return isDirty;
4186
+ }
4187
+ });
4188
+ Object.defineProperty(exports, 'isValid', {
4189
+ enumerable: true,
4190
+ get: function () {
4191
+ return isValid;
4192
+ }
4193
+ });
4194
+ Object.defineProperty(exports, 'late', {
4195
+ enumerable: true,
4196
+ get: function () {
4197
+ return late;
4198
+ }
4199
+ });
4200
+ Object.defineProperty(exports, 'lazyType', {
4201
+ enumerable: true,
4202
+ get: function () {
4203
+ return lazyType;
4204
+ }
4205
+ });
4206
+ Object.defineProperty(exports, 'literalType', {
4207
+ enumerable: true,
4208
+ get: function () {
4209
+ return literalType;
4210
+ }
4211
+ });
4212
+ Object.defineProperty(exports, 'makeIssue', {
4213
+ enumerable: true,
4214
+ get: function () {
4215
+ return makeIssue;
4216
+ }
4217
+ });
4218
+ Object.defineProperty(exports, 'mapType', {
4219
+ enumerable: true,
4220
+ get: function () {
4221
+ return mapType;
4222
+ }
4223
+ });
4224
+ Object.defineProperty(exports, 'nanType', {
4225
+ enumerable: true,
4226
+ get: function () {
4227
+ return nanType;
4228
+ }
4229
+ });
4230
+ Object.defineProperty(exports, 'nativeEnumType', {
4231
+ enumerable: true,
4232
+ get: function () {
4233
+ return nativeEnumType;
4234
+ }
4235
+ });
4236
+ Object.defineProperty(exports, 'neverType', {
4237
+ enumerable: true,
4238
+ get: function () {
4239
+ return neverType;
4240
+ }
4241
+ });
4242
+ Object.defineProperty(exports, 'nullType', {
4243
+ enumerable: true,
4244
+ get: function () {
4245
+ return nullType;
4246
+ }
4247
+ });
4248
+ Object.defineProperty(exports, 'nullableType', {
4249
+ enumerable: true,
4250
+ get: function () {
4251
+ return nullableType;
4252
+ }
4253
+ });
4254
+ Object.defineProperty(exports, 'numberType', {
4255
+ enumerable: true,
4256
+ get: function () {
4257
+ return numberType;
4258
+ }
4259
+ });
4260
+ Object.defineProperty(exports, 'objectType', {
4261
+ enumerable: true,
4262
+ get: function () {
4263
+ return objectType;
4264
+ }
4265
+ });
4266
+ Object.defineProperty(exports, 'objectUtil', {
4267
+ enumerable: true,
4268
+ get: function () {
4269
+ return objectUtil;
4270
+ }
4271
+ });
4272
+ Object.defineProperty(exports, 'oboolean', {
4273
+ enumerable: true,
4274
+ get: function () {
4275
+ return oboolean;
4276
+ }
4277
+ });
4278
+ Object.defineProperty(exports, 'onumber', {
4279
+ enumerable: true,
4280
+ get: function () {
4281
+ return onumber;
4282
+ }
4283
+ });
4284
+ Object.defineProperty(exports, 'optionalType', {
4285
+ enumerable: true,
4286
+ get: function () {
4287
+ return optionalType;
4288
+ }
4289
+ });
4290
+ Object.defineProperty(exports, 'ostring', {
4291
+ enumerable: true,
4292
+ get: function () {
4293
+ return ostring;
4294
+ }
4295
+ });
4296
+ Object.defineProperty(exports, 'pipelineType', {
4297
+ enumerable: true,
4298
+ get: function () {
4299
+ return pipelineType;
4300
+ }
4301
+ });
4302
+ Object.defineProperty(exports, 'preprocessType', {
4303
+ enumerable: true,
4304
+ get: function () {
4305
+ return preprocessType;
4306
+ }
4307
+ });
4308
+ Object.defineProperty(exports, 'promiseType', {
4309
+ enumerable: true,
4310
+ get: function () {
4311
+ return promiseType;
4312
+ }
4313
+ });
4314
+ Object.defineProperty(exports, 'quotelessJson', {
4315
+ enumerable: true,
4316
+ get: function () {
4317
+ return quotelessJson;
4318
+ }
4319
+ });
4320
+ Object.defineProperty(exports, 'recordType', {
4321
+ enumerable: true,
4322
+ get: function () {
4323
+ return recordType;
4324
+ }
4325
+ });
4326
+ Object.defineProperty(exports, 'setErrorMap', {
4327
+ enumerable: true,
4328
+ get: function () {
4329
+ return setErrorMap;
4330
+ }
4331
+ });
4332
+ Object.defineProperty(exports, 'setType', {
4333
+ enumerable: true,
4334
+ get: function () {
4335
+ return setType;
4336
+ }
4337
+ });
4338
+ Object.defineProperty(exports, 'strictObjectType', {
4339
+ enumerable: true,
4340
+ get: function () {
4341
+ return strictObjectType;
4342
+ }
4343
+ });
4344
+ Object.defineProperty(exports, 'stringType', {
4345
+ enumerable: true,
4346
+ get: function () {
4347
+ return stringType;
4348
+ }
4349
+ });
4350
+ Object.defineProperty(exports, 'symbolType', {
4351
+ enumerable: true,
4352
+ get: function () {
4353
+ return symbolType;
4354
+ }
4355
+ });
4356
+ Object.defineProperty(exports, 'tupleType', {
4357
+ enumerable: true,
4358
+ get: function () {
4359
+ return tupleType;
4360
+ }
4361
+ });
4362
+ Object.defineProperty(exports, 'undefinedType', {
4363
+ enumerable: true,
4364
+ get: function () {
4365
+ return undefinedType;
4366
+ }
4367
+ });
4368
+ Object.defineProperty(exports, 'unionType', {
4369
+ enumerable: true,
4370
+ get: function () {
4371
+ return unionType;
4372
+ }
4373
+ });
4374
+ Object.defineProperty(exports, 'unknownType', {
4375
+ enumerable: true,
4376
+ get: function () {
4377
+ return unknownType;
4378
+ }
4379
+ });
4380
+ Object.defineProperty(exports, 'util', {
4381
+ enumerable: true,
4382
+ get: function () {
4383
+ return util;
4384
+ }
4385
+ });
4386
+ Object.defineProperty(exports, 'voidType', {
4387
+ enumerable: true,
4388
+ get: function () {
4389
+ return voidType;
4390
+ }
4391
+ });
4392
+ //# sourceMappingURL=esm-Crmo4h9t.cjs.map