drizzle-kit 0.20.17-b4f119e → 0.20.17-c057923

Sign up to get free protection for your applications and to get access to all the features.
package/utils-studio.mjs CHANGED
@@ -34,6 +34,516 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
34
34
  mod
35
35
  ));
36
36
 
37
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js
38
+ function assembleStyles() {
39
+ const codes = /* @__PURE__ */ new Map();
40
+ for (const [groupName, group] of Object.entries(styles)) {
41
+ for (const [styleName, style] of Object.entries(group)) {
42
+ styles[styleName] = {
43
+ open: `\x1B[${style[0]}m`,
44
+ close: `\x1B[${style[1]}m`
45
+ };
46
+ group[styleName] = styles[styleName];
47
+ codes.set(style[0], style[1]);
48
+ }
49
+ Object.defineProperty(styles, groupName, {
50
+ value: group,
51
+ enumerable: false
52
+ });
53
+ }
54
+ Object.defineProperty(styles, "codes", {
55
+ value: codes,
56
+ enumerable: false
57
+ });
58
+ styles.color.close = "\x1B[39m";
59
+ styles.bgColor.close = "\x1B[49m";
60
+ styles.color.ansi = wrapAnsi16();
61
+ styles.color.ansi256 = wrapAnsi256();
62
+ styles.color.ansi16m = wrapAnsi16m();
63
+ styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
64
+ styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
65
+ styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
66
+ Object.defineProperties(styles, {
67
+ rgbToAnsi256: {
68
+ value(red, green, blue) {
69
+ if (red === green && green === blue) {
70
+ if (red < 8) {
71
+ return 16;
72
+ }
73
+ if (red > 248) {
74
+ return 231;
75
+ }
76
+ return Math.round((red - 8) / 247 * 24) + 232;
77
+ }
78
+ return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
79
+ },
80
+ enumerable: false
81
+ },
82
+ hexToRgb: {
83
+ value(hex) {
84
+ const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
85
+ if (!matches) {
86
+ return [0, 0, 0];
87
+ }
88
+ let [colorString] = matches;
89
+ if (colorString.length === 3) {
90
+ colorString = [...colorString].map((character) => character + character).join("");
91
+ }
92
+ const integer = Number.parseInt(colorString, 16);
93
+ return [
94
+ /* eslint-disable no-bitwise */
95
+ integer >> 16 & 255,
96
+ integer >> 8 & 255,
97
+ integer & 255
98
+ /* eslint-enable no-bitwise */
99
+ ];
100
+ },
101
+ enumerable: false
102
+ },
103
+ hexToAnsi256: {
104
+ value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
105
+ enumerable: false
106
+ },
107
+ ansi256ToAnsi: {
108
+ value(code) {
109
+ if (code < 8) {
110
+ return 30 + code;
111
+ }
112
+ if (code < 16) {
113
+ return 90 + (code - 8);
114
+ }
115
+ let red;
116
+ let green;
117
+ let blue;
118
+ if (code >= 232) {
119
+ red = ((code - 232) * 10 + 8) / 255;
120
+ green = red;
121
+ blue = red;
122
+ } else {
123
+ code -= 16;
124
+ const remainder = code % 36;
125
+ red = Math.floor(code / 36) / 5;
126
+ green = Math.floor(remainder / 6) / 5;
127
+ blue = remainder % 6 / 5;
128
+ }
129
+ const value = Math.max(red, green, blue) * 2;
130
+ if (value === 0) {
131
+ return 30;
132
+ }
133
+ let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
134
+ if (value === 2) {
135
+ result += 60;
136
+ }
137
+ return result;
138
+ },
139
+ enumerable: false
140
+ },
141
+ rgbToAnsi: {
142
+ value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
143
+ enumerable: false
144
+ },
145
+ hexToAnsi: {
146
+ value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
147
+ enumerable: false
148
+ }
149
+ });
150
+ return styles;
151
+ }
152
+ var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
153
+ var init_ansi_styles = __esm({
154
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
155
+ ANSI_BACKGROUND_OFFSET = 10;
156
+ wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
157
+ wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
158
+ wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
159
+ styles = {
160
+ modifier: {
161
+ reset: [0, 0],
162
+ // 21 isn't widely supported and 22 does the same thing
163
+ bold: [1, 22],
164
+ dim: [2, 22],
165
+ italic: [3, 23],
166
+ underline: [4, 24],
167
+ overline: [53, 55],
168
+ inverse: [7, 27],
169
+ hidden: [8, 28],
170
+ strikethrough: [9, 29]
171
+ },
172
+ color: {
173
+ black: [30, 39],
174
+ red: [31, 39],
175
+ green: [32, 39],
176
+ yellow: [33, 39],
177
+ blue: [34, 39],
178
+ magenta: [35, 39],
179
+ cyan: [36, 39],
180
+ white: [37, 39],
181
+ // Bright color
182
+ blackBright: [90, 39],
183
+ gray: [90, 39],
184
+ // Alias of `blackBright`
185
+ grey: [90, 39],
186
+ // Alias of `blackBright`
187
+ redBright: [91, 39],
188
+ greenBright: [92, 39],
189
+ yellowBright: [93, 39],
190
+ blueBright: [94, 39],
191
+ magentaBright: [95, 39],
192
+ cyanBright: [96, 39],
193
+ whiteBright: [97, 39]
194
+ },
195
+ bgColor: {
196
+ bgBlack: [40, 49],
197
+ bgRed: [41, 49],
198
+ bgGreen: [42, 49],
199
+ bgYellow: [43, 49],
200
+ bgBlue: [44, 49],
201
+ bgMagenta: [45, 49],
202
+ bgCyan: [46, 49],
203
+ bgWhite: [47, 49],
204
+ // Bright color
205
+ bgBlackBright: [100, 49],
206
+ bgGray: [100, 49],
207
+ // Alias of `bgBlackBright`
208
+ bgGrey: [100, 49],
209
+ // Alias of `bgBlackBright`
210
+ bgRedBright: [101, 49],
211
+ bgGreenBright: [102, 49],
212
+ bgYellowBright: [103, 49],
213
+ bgBlueBright: [104, 49],
214
+ bgMagentaBright: [105, 49],
215
+ bgCyanBright: [106, 49],
216
+ bgWhiteBright: [107, 49]
217
+ }
218
+ };
219
+ modifierNames = Object.keys(styles.modifier);
220
+ foregroundColorNames = Object.keys(styles.color);
221
+ backgroundColorNames = Object.keys(styles.bgColor);
222
+ colorNames = [...foregroundColorNames, ...backgroundColorNames];
223
+ ansiStyles = assembleStyles();
224
+ ansi_styles_default = ansiStyles;
225
+ }
226
+ });
227
+
228
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js
229
+ import process2 from "node:process";
230
+ import os from "node:os";
231
+ import tty from "node:tty";
232
+ function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
233
+ const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
234
+ const position = argv.indexOf(prefix + flag);
235
+ const terminatorPosition = argv.indexOf("--");
236
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
237
+ }
238
+ function envForceColor() {
239
+ if ("FORCE_COLOR" in env) {
240
+ if (env.FORCE_COLOR === "true") {
241
+ return 1;
242
+ }
243
+ if (env.FORCE_COLOR === "false") {
244
+ return 0;
245
+ }
246
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
247
+ }
248
+ }
249
+ function translateLevel(level) {
250
+ if (level === 0) {
251
+ return false;
252
+ }
253
+ return {
254
+ level,
255
+ hasBasic: true,
256
+ has256: level >= 2,
257
+ has16m: level >= 3
258
+ };
259
+ }
260
+ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
261
+ const noFlagForceColor = envForceColor();
262
+ if (noFlagForceColor !== void 0) {
263
+ flagForceColor = noFlagForceColor;
264
+ }
265
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
266
+ if (forceColor === 0) {
267
+ return 0;
268
+ }
269
+ if (sniffFlags) {
270
+ if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
271
+ return 3;
272
+ }
273
+ if (hasFlag("color=256")) {
274
+ return 2;
275
+ }
276
+ }
277
+ if ("TF_BUILD" in env && "AGENT_NAME" in env) {
278
+ return 1;
279
+ }
280
+ if (haveStream && !streamIsTTY && forceColor === void 0) {
281
+ return 0;
282
+ }
283
+ const min = forceColor || 0;
284
+ if (env.TERM === "dumb") {
285
+ return min;
286
+ }
287
+ if (process2.platform === "win32") {
288
+ const osRelease = os.release().split(".");
289
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
290
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
291
+ }
292
+ return 1;
293
+ }
294
+ if ("CI" in env) {
295
+ if ("GITHUB_ACTIONS" in env) {
296
+ return 3;
297
+ }
298
+ if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
299
+ return 1;
300
+ }
301
+ return min;
302
+ }
303
+ if ("TEAMCITY_VERSION" in env) {
304
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
305
+ }
306
+ if (env.COLORTERM === "truecolor") {
307
+ return 3;
308
+ }
309
+ if (env.TERM === "xterm-kitty") {
310
+ return 3;
311
+ }
312
+ if ("TERM_PROGRAM" in env) {
313
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
314
+ switch (env.TERM_PROGRAM) {
315
+ case "iTerm.app": {
316
+ return version >= 3 ? 3 : 2;
317
+ }
318
+ case "Apple_Terminal": {
319
+ return 2;
320
+ }
321
+ }
322
+ }
323
+ if (/-256(color)?$/i.test(env.TERM)) {
324
+ return 2;
325
+ }
326
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
327
+ return 1;
328
+ }
329
+ if ("COLORTERM" in env) {
330
+ return 1;
331
+ }
332
+ return min;
333
+ }
334
+ function createSupportsColor(stream, options = {}) {
335
+ const level = _supportsColor(stream, {
336
+ streamIsTTY: stream && stream.isTTY,
337
+ ...options
338
+ });
339
+ return translateLevel(level);
340
+ }
341
+ var env, flagForceColor, supportsColor, supports_color_default;
342
+ var init_supports_color = __esm({
343
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/vendor/supports-color/index.js"() {
344
+ ({ env } = process2);
345
+ if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
346
+ flagForceColor = 0;
347
+ } else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
348
+ flagForceColor = 1;
349
+ }
350
+ supportsColor = {
351
+ stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
352
+ stderr: createSupportsColor({ isTTY: tty.isatty(2) })
353
+ };
354
+ supports_color_default = supportsColor;
355
+ }
356
+ });
357
+
358
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js
359
+ function stringReplaceAll(string, substring, replacer) {
360
+ let index4 = string.indexOf(substring);
361
+ if (index4 === -1) {
362
+ return string;
363
+ }
364
+ const substringLength = substring.length;
365
+ let endIndex = 0;
366
+ let returnValue = "";
367
+ do {
368
+ returnValue += string.slice(endIndex, index4) + substring + replacer;
369
+ endIndex = index4 + substringLength;
370
+ index4 = string.indexOf(substring, endIndex);
371
+ } while (index4 !== -1);
372
+ returnValue += string.slice(endIndex);
373
+ return returnValue;
374
+ }
375
+ function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index4) {
376
+ let endIndex = 0;
377
+ let returnValue = "";
378
+ do {
379
+ const gotCR = string[index4 - 1] === "\r";
380
+ returnValue += string.slice(endIndex, gotCR ? index4 - 1 : index4) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
381
+ endIndex = index4 + 1;
382
+ index4 = string.indexOf("\n", endIndex);
383
+ } while (index4 !== -1);
384
+ returnValue += string.slice(endIndex);
385
+ return returnValue;
386
+ }
387
+ var init_utilities = __esm({
388
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/utilities.js"() {
389
+ }
390
+ });
391
+
392
+ // node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js
393
+ function createChalk(options) {
394
+ return chalkFactory(options);
395
+ }
396
+ var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr;
397
+ var init_source = __esm({
398
+ "node_modules/.pnpm/chalk@5.2.0/node_modules/chalk/source/index.js"() {
399
+ init_ansi_styles();
400
+ init_supports_color();
401
+ init_utilities();
402
+ init_ansi_styles();
403
+ ({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
404
+ GENERATOR = Symbol("GENERATOR");
405
+ STYLER = Symbol("STYLER");
406
+ IS_EMPTY = Symbol("IS_EMPTY");
407
+ levelMapping = [
408
+ "ansi",
409
+ "ansi",
410
+ "ansi256",
411
+ "ansi16m"
412
+ ];
413
+ styles2 = /* @__PURE__ */ Object.create(null);
414
+ applyOptions = (object, options = {}) => {
415
+ if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
416
+ throw new Error("The `level` option should be an integer from 0 to 3");
417
+ }
418
+ const colorLevel = stdoutColor ? stdoutColor.level : 0;
419
+ object.level = options.level === void 0 ? colorLevel : options.level;
420
+ };
421
+ chalkFactory = (options) => {
422
+ const chalk2 = (...strings) => strings.join(" ");
423
+ applyOptions(chalk2, options);
424
+ Object.setPrototypeOf(chalk2, createChalk.prototype);
425
+ return chalk2;
426
+ };
427
+ Object.setPrototypeOf(createChalk.prototype, Function.prototype);
428
+ for (const [styleName, style] of Object.entries(ansi_styles_default)) {
429
+ styles2[styleName] = {
430
+ get() {
431
+ const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
432
+ Object.defineProperty(this, styleName, { value: builder });
433
+ return builder;
434
+ }
435
+ };
436
+ }
437
+ styles2.visible = {
438
+ get() {
439
+ const builder = createBuilder(this, this[STYLER], true);
440
+ Object.defineProperty(this, "visible", { value: builder });
441
+ return builder;
442
+ }
443
+ };
444
+ getModelAnsi = (model, level, type, ...arguments_) => {
445
+ if (model === "rgb") {
446
+ if (level === "ansi16m") {
447
+ return ansi_styles_default[type].ansi16m(...arguments_);
448
+ }
449
+ if (level === "ansi256") {
450
+ return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
451
+ }
452
+ return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
453
+ }
454
+ if (model === "hex") {
455
+ return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
456
+ }
457
+ return ansi_styles_default[type][model](...arguments_);
458
+ };
459
+ usedModels = ["rgb", "hex", "ansi256"];
460
+ for (const model of usedModels) {
461
+ styles2[model] = {
462
+ get() {
463
+ const { level } = this;
464
+ return function(...arguments_) {
465
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
466
+ return createBuilder(this, styler, this[IS_EMPTY]);
467
+ };
468
+ }
469
+ };
470
+ const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
471
+ styles2[bgModel] = {
472
+ get() {
473
+ const { level } = this;
474
+ return function(...arguments_) {
475
+ const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
476
+ return createBuilder(this, styler, this[IS_EMPTY]);
477
+ };
478
+ }
479
+ };
480
+ }
481
+ proto = Object.defineProperties(() => {
482
+ }, {
483
+ ...styles2,
484
+ level: {
485
+ enumerable: true,
486
+ get() {
487
+ return this[GENERATOR].level;
488
+ },
489
+ set(level) {
490
+ this[GENERATOR].level = level;
491
+ }
492
+ }
493
+ });
494
+ createStyler = (open, close, parent) => {
495
+ let openAll;
496
+ let closeAll;
497
+ if (parent === void 0) {
498
+ openAll = open;
499
+ closeAll = close;
500
+ } else {
501
+ openAll = parent.openAll + open;
502
+ closeAll = close + parent.closeAll;
503
+ }
504
+ return {
505
+ open,
506
+ close,
507
+ openAll,
508
+ closeAll,
509
+ parent
510
+ };
511
+ };
512
+ createBuilder = (self2, _styler, _isEmpty) => {
513
+ const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
514
+ Object.setPrototypeOf(builder, proto);
515
+ builder[GENERATOR] = self2;
516
+ builder[STYLER] = _styler;
517
+ builder[IS_EMPTY] = _isEmpty;
518
+ return builder;
519
+ };
520
+ applyStyle = (self2, string) => {
521
+ if (self2.level <= 0 || !string) {
522
+ return self2[IS_EMPTY] ? "" : string;
523
+ }
524
+ let styler = self2[STYLER];
525
+ if (styler === void 0) {
526
+ return string;
527
+ }
528
+ const { openAll, closeAll } = styler;
529
+ if (string.includes("\x1B")) {
530
+ while (styler !== void 0) {
531
+ string = stringReplaceAll(string, styler.close, styler.open);
532
+ styler = styler.parent;
533
+ }
534
+ }
535
+ const lfIndex = string.indexOf("\n");
536
+ if (lfIndex !== -1) {
537
+ string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
538
+ }
539
+ return openAll + string + closeAll;
540
+ };
541
+ Object.defineProperties(createChalk.prototype, styles2);
542
+ chalk = createChalk();
543
+ chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
544
+ }
545
+ });
546
+
37
547
  // node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js
38
548
  var require_readline = __commonJS({
39
549
  "node_modules/.pnpm/hanji@0.0.5/node_modules/hanji/readline.js"(exports) {
@@ -574,12 +1084,11 @@ var init_global = __esm({
574
1084
  }
575
1085
  });
576
1086
 
577
- // node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs
1087
+ // node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
578
1088
  function getErrorMap() {
579
1089
  return overrideErrorMap;
580
1090
  }
581
1091
  function addIssueToContext(ctx, issueData) {
582
- const overrideMap = getErrorMap();
583
1092
  const issue = makeIssue({
584
1093
  issueData,
585
1094
  data: ctx.data,
@@ -587,29 +1096,13 @@ function addIssueToContext(ctx, issueData) {
587
1096
  errorMaps: [
588
1097
  ctx.common.contextualErrorMap,
589
1098
  ctx.schemaErrorMap,
590
- overrideMap,
591
- overrideMap === errorMap ? void 0 : errorMap
1099
+ getErrorMap(),
1100
+ errorMap
592
1101
  // then global default map
593
1102
  ].filter((x) => !!x)
594
1103
  });
595
1104
  ctx.common.issues.push(issue);
596
1105
  }
597
- function __classPrivateFieldGet(receiver, state, kind, f) {
598
- if (kind === "a" && !f)
599
- throw new TypeError("Private accessor was defined without a getter");
600
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
601
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
602
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
603
- }
604
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
605
- if (kind === "m")
606
- throw new TypeError("Private method is not writable");
607
- if (kind === "a" && !f)
608
- throw new TypeError("Private accessor was defined without a setter");
609
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
610
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
611
- return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
612
- }
613
1106
  function processCreateParams(params) {
614
1107
  if (!params)
615
1108
  return {};
@@ -620,50 +1113,15 @@ function processCreateParams(params) {
620
1113
  if (errorMap2)
621
1114
  return { errorMap: errorMap2, description };
622
1115
  const customMap = (iss, ctx) => {
623
- var _a, _b;
624
- const { message } = params;
625
- if (iss.code === "invalid_enum_value") {
626
- return { message: message !== null && message !== void 0 ? message : ctx.defaultError };
627
- }
628
- if (typeof ctx.data === "undefined") {
629
- return { message: (_a = message !== null && message !== void 0 ? message : required_error) !== null && _a !== void 0 ? _a : ctx.defaultError };
630
- }
631
1116
  if (iss.code !== "invalid_type")
632
1117
  return { message: ctx.defaultError };
633
- return { message: (_b = message !== null && message !== void 0 ? message : invalid_type_error) !== null && _b !== void 0 ? _b : ctx.defaultError };
1118
+ if (typeof ctx.data === "undefined") {
1119
+ return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
1120
+ }
1121
+ return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
634
1122
  };
635
1123
  return { errorMap: customMap, description };
636
1124
  }
637
- function timeRegexSource(args) {
638
- let regex = `([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d`;
639
- if (args.precision) {
640
- regex = `${regex}\\.\\d{${args.precision}}`;
641
- } else if (args.precision == null) {
642
- regex = `${regex}(\\.\\d+)?`;
643
- }
644
- return regex;
645
- }
646
- function timeRegex(args) {
647
- return new RegExp(`^${timeRegexSource(args)}$`);
648
- }
649
- function datetimeRegex(args) {
650
- let regex = `${dateRegexSource}T${timeRegexSource(args)}`;
651
- const opts = [];
652
- opts.push(args.local ? `Z?` : `Z`);
653
- if (args.offset)
654
- opts.push(`([+-]\\d{2}:?\\d{2})`);
655
- regex = `${regex}(${opts.join("|")})`;
656
- return new RegExp(`^${regex}$`);
657
- }
658
- function isValidIP(ip, version) {
659
- if ((version === "v4" || !version) && ipv4Regex.test(ip)) {
660
- return true;
661
- }
662
- if ((version === "v6" || !version) && ipv6Regex.test(ip)) {
663
- return true;
664
- }
665
- return false;
666
- }
667
1125
  function floatSafeRemainder(val, step) {
668
1126
  const valDecCount = (val.toString().split(".")[1] || "").length;
669
1127
  const stepDecCount = (step.toString().split(".")[1] || "").length;
@@ -684,10 +1142,7 @@ function deepPartialify(schema3) {
684
1142
  shape: () => newShape
685
1143
  });
686
1144
  } else if (schema3 instanceof ZodArray) {
687
- return new ZodArray({
688
- ...schema3._def,
689
- type: deepPartialify(schema3.element)
690
- });
1145
+ return ZodArray.create(deepPartialify(schema3.element));
691
1146
  } else if (schema3 instanceof ZodOptional) {
692
1147
  return ZodOptional.create(deepPartialify(schema3.unwrap()));
693
1148
  } else if (schema3 instanceof ZodNullable) {
@@ -743,9 +1198,9 @@ function createZodEnum(values, params) {
743
1198
  ...processCreateParams(params)
744
1199
  });
745
1200
  }
746
- var util, objectUtil, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, _ZodEnum_cache, _ZodNativeEnum_cache, ParseInputLazyPath, handleResult, ZodType, cuidRegex, cuid2Regex, ulidRegex, uuidRegex, nanoidRegex, durationRegex, emailRegex, _emojiRegex, emojiRegex, ipv4Regex, ipv6Regex, base64Regex, dateRegexSource, dateRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, ZodReadonly, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType;
1201
+ var util, ZodParsedType, getParsedType, ZodIssueCode, ZodError, errorMap, overrideErrorMap, makeIssue, ParseStatus, INVALID, DIRTY, OK, isAborted, isDirty, isValid, isAsync, errorUtil, ParseInputLazyPath, handleResult, ZodType, cuidRegex, uuidRegex, emailRegex, datetimeRegex, ZodString, ZodNumber, ZodBigInt, ZodBoolean, ZodDate, ZodSymbol, ZodUndefined, ZodNull, ZodAny, ZodUnknown, ZodNever, ZodVoid, ZodArray, objectUtil, AugmentFactory, ZodObject, ZodUnion, getDiscriminator, ZodDiscriminatedUnion, ZodIntersection, ZodTuple, ZodRecord, ZodMap, ZodSet, ZodFunction, ZodLazy, ZodLiteral, ZodEnum, ZodNativeEnum, ZodPromise, ZodEffects, ZodOptional, ZodNullable, ZodDefault, ZodCatch, ZodNaN, BRAND, ZodBranded, ZodPipeline, late, ZodFirstPartyTypeKind, stringType, numberType, nanType, bigIntType, booleanType, dateType, symbolType, undefinedType, nullType, anyType, unknownType, neverType, voidType, arrayType, objectType, strictObjectType, unionType, discriminatedUnionType, intersectionType, tupleType, recordType, mapType, setType, functionType, lazyType, literalType, enumType, nativeEnumType, promiseType, effectsType, optionalType, nullableType, preprocessType, pipelineType;
747
1202
  var init_lib = __esm({
748
- "node_modules/.pnpm/zod@3.23.4/node_modules/zod/lib/index.mjs"() {
1203
+ "node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs"() {
749
1204
  (function(util2) {
750
1205
  util2.assertEqual = (val) => val;
751
1206
  function assertIs(_arg) {
@@ -803,15 +1258,6 @@ var init_lib = __esm({
803
1258
  return value;
804
1259
  };
805
1260
  })(util || (util = {}));
806
- (function(objectUtil2) {
807
- objectUtil2.mergeShapes = (first, second) => {
808
- return {
809
- ...first,
810
- ...second
811
- // second overwrites first
812
- };
813
- };
814
- })(objectUtil || (objectUtil = {}));
815
1261
  ZodParsedType = util.arrayToEnum([
816
1262
  "string",
817
1263
  "nan",
@@ -893,7 +1339,7 @@ var init_lib = __esm({
893
1339
  "not_multiple_of",
894
1340
  "not_finite"
895
1341
  ]);
896
- ZodError = class _ZodError extends Error {
1342
+ ZodError = class extends Error {
897
1343
  constructor(issues) {
898
1344
  super();
899
1345
  this.issues = [];
@@ -951,11 +1397,6 @@ var init_lib = __esm({
951
1397
  processError(this);
952
1398
  return fieldErrors;
953
1399
  }
954
- static assert(value) {
955
- if (!(value instanceof _ZodError)) {
956
- throw new Error(`Not a ZodError: ${value}`);
957
- }
958
- }
959
1400
  toString() {
960
1401
  return this.message;
961
1402
  }
@@ -1022,12 +1463,7 @@ var init_lib = __esm({
1022
1463
  break;
1023
1464
  case ZodIssueCode.invalid_string:
1024
1465
  if (typeof issue.validation === "object") {
1025
- if ("includes" in issue.validation) {
1026
- message = `Invalid input: must include "${issue.validation.includes}"`;
1027
- if (typeof issue.validation.position === "number") {
1028
- message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;
1029
- }
1030
- } else if ("startsWith" in issue.validation) {
1466
+ if ("startsWith" in issue.validation) {
1031
1467
  message = `Invalid input: must start with "${issue.validation.startsWith}"`;
1032
1468
  } else if ("endsWith" in issue.validation) {
1033
1469
  message = `Invalid input: must end with "${issue.validation.endsWith}"`;
@@ -1048,7 +1484,7 @@ var init_lib = __esm({
1048
1484
  else if (issue.type === "number")
1049
1485
  message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
1050
1486
  else if (issue.type === "date")
1051
- message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue.minimum))}`;
1487
+ message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
1052
1488
  else
1053
1489
  message = "Invalid input";
1054
1490
  break;
@@ -1059,10 +1495,8 @@ var init_lib = __esm({
1059
1495
  message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
1060
1496
  else if (issue.type === "number")
1061
1497
  message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
1062
- else if (issue.type === "bigint")
1063
- message = `BigInt must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
1064
1498
  else if (issue.type === "date")
1065
- message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue.maximum))}`;
1499
+ message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
1066
1500
  else
1067
1501
  message = "Invalid input";
1068
1502
  break;
@@ -1092,13 +1526,6 @@ var init_lib = __esm({
1092
1526
  ...issueData,
1093
1527
  path: fullPath
1094
1528
  };
1095
- if (issueData.message !== void 0) {
1096
- return {
1097
- ...issueData,
1098
- path: fullPath,
1099
- message: issueData.message
1100
- };
1101
- }
1102
1529
  let errorMessage = "";
1103
1530
  const maps = errorMaps.filter((m) => !!m).slice().reverse();
1104
1531
  for (const map of maps) {
@@ -1107,7 +1534,7 @@ var init_lib = __esm({
1107
1534
  return {
1108
1535
  ...issueData,
1109
1536
  path: fullPath,
1110
- message: errorMessage
1537
+ message: issueData.message || errorMessage
1111
1538
  };
1112
1539
  };
1113
1540
  ParseStatus = class _ParseStatus {
@@ -1136,11 +1563,9 @@ var init_lib = __esm({
1136
1563
  static async mergeObjectAsync(status, pairs) {
1137
1564
  const syncPairs = [];
1138
1565
  for (const pair of pairs) {
1139
- const key = await pair.key;
1140
- const value = await pair.value;
1141
1566
  syncPairs.push({
1142
- key,
1143
- value
1567
+ key: await pair.key,
1568
+ value: await pair.value
1144
1569
  });
1145
1570
  }
1146
1571
  return _ParseStatus.mergeObjectSync(status, syncPairs);
@@ -1157,7 +1582,7 @@ var init_lib = __esm({
1157
1582
  status.dirty();
1158
1583
  if (value.status === "dirty")
1159
1584
  status.dirty();
1160
- if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
1585
+ if (typeof value.value !== "undefined" || pair.alwaysSet) {
1161
1586
  finalObject[key.value] = value.value;
1162
1587
  }
1163
1588
  }
@@ -1172,28 +1597,20 @@ var init_lib = __esm({
1172
1597
  isAborted = (x) => x.status === "aborted";
1173
1598
  isDirty = (x) => x.status === "dirty";
1174
1599
  isValid = (x) => x.status === "valid";
1175
- isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
1600
+ isAsync = (x) => typeof Promise !== void 0 && x instanceof Promise;
1176
1601
  (function(errorUtil2) {
1177
1602
  errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
1178
1603
  errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
1179
1604
  })(errorUtil || (errorUtil = {}));
1180
1605
  ParseInputLazyPath = class {
1181
1606
  constructor(parent, value, path2, key) {
1182
- this._cachedPath = [];
1183
1607
  this.parent = parent;
1184
1608
  this.data = value;
1185
1609
  this._path = path2;
1186
1610
  this._key = key;
1187
1611
  }
1188
1612
  get path() {
1189
- if (!this._cachedPath.length) {
1190
- if (this._key instanceof Array) {
1191
- this._cachedPath.push(...this._path, ...this._key);
1192
- } else {
1193
- this._cachedPath.push(...this._path, this._key);
1194
- }
1195
- }
1196
- return this._cachedPath;
1613
+ return this._path.concat(this._key);
1197
1614
  }
1198
1615
  };
1199
1616
  handleResult = (ctx, result) => {
@@ -1203,16 +1620,8 @@ var init_lib = __esm({
1203
1620
  if (!ctx.common.issues.length) {
1204
1621
  throw new Error("Validation failed but no issues detected.");
1205
1622
  }
1206
- return {
1207
- success: false,
1208
- get error() {
1209
- if (this._error)
1210
- return this._error;
1211
- const error2 = new ZodError(ctx.common.issues);
1212
- this._error = error2;
1213
- return this._error;
1214
- }
1215
- };
1623
+ const error2 = new ZodError(ctx.common.issues);
1624
+ return { success: false, error: error2 };
1216
1625
  }
1217
1626
  };
1218
1627
  ZodType = class {
@@ -1240,7 +1649,6 @@ var init_lib = __esm({
1240
1649
  this.catch = this.catch.bind(this);
1241
1650
  this.describe = this.describe.bind(this);
1242
1651
  this.pipe = this.pipe.bind(this);
1243
- this.readonly = this.readonly.bind(this);
1244
1652
  this.isNullable = this.isNullable.bind(this);
1245
1653
  this.isOptional = this.isOptional.bind(this);
1246
1654
  }
@@ -1385,29 +1793,28 @@ var init_lib = __esm({
1385
1793
  return this._refinement(refinement);
1386
1794
  }
1387
1795
  optional() {
1388
- return ZodOptional.create(this, this._def);
1796
+ return ZodOptional.create(this);
1389
1797
  }
1390
1798
  nullable() {
1391
- return ZodNullable.create(this, this._def);
1799
+ return ZodNullable.create(this);
1392
1800
  }
1393
1801
  nullish() {
1394
- return this.nullable().optional();
1802
+ return this.optional().nullable();
1395
1803
  }
1396
1804
  array() {
1397
- return ZodArray.create(this, this._def);
1805
+ return ZodArray.create(this);
1398
1806
  }
1399
1807
  promise() {
1400
- return ZodPromise.create(this, this._def);
1808
+ return ZodPromise.create(this);
1401
1809
  }
1402
1810
  or(option) {
1403
- return ZodUnion.create([this, option], this._def);
1811
+ return ZodUnion.create([this, option]);
1404
1812
  }
1405
1813
  and(incoming) {
1406
- return ZodIntersection.create(this, incoming, this._def);
1814
+ return ZodIntersection.create(this, incoming);
1407
1815
  }
1408
1816
  transform(transform) {
1409
1817
  return new ZodEffects({
1410
- ...processCreateParams(this._def),
1411
1818
  schema: this,
1412
1819
  typeName: ZodFirstPartyTypeKind.ZodEffects,
1413
1820
  effect: { type: "transform", transform }
@@ -1416,7 +1823,6 @@ var init_lib = __esm({
1416
1823
  default(def) {
1417
1824
  const defaultValueFunc = typeof def === "function" ? def : () => def;
1418
1825
  return new ZodDefault({
1419
- ...processCreateParams(this._def),
1420
1826
  innerType: this,
1421
1827
  defaultValue: defaultValueFunc,
1422
1828
  typeName: ZodFirstPartyTypeKind.ZodDefault
@@ -1426,15 +1832,14 @@ var init_lib = __esm({
1426
1832
  return new ZodBranded({
1427
1833
  typeName: ZodFirstPartyTypeKind.ZodBranded,
1428
1834
  type: this,
1429
- ...processCreateParams(this._def)
1835
+ ...processCreateParams(void 0)
1430
1836
  });
1431
1837
  }
1432
1838
  catch(def) {
1433
- const catchValueFunc = typeof def === "function" ? def : () => def;
1839
+ const defaultValueFunc = typeof def === "function" ? def : () => def;
1434
1840
  return new ZodCatch({
1435
- ...processCreateParams(this._def),
1436
1841
  innerType: this,
1437
- catchValue: catchValueFunc,
1842
+ defaultValue: defaultValueFunc,
1438
1843
  typeName: ZodFirstPartyTypeKind.ZodCatch
1439
1844
  });
1440
1845
  }
@@ -1448,9 +1853,6 @@ var init_lib = __esm({
1448
1853
  pipe(target) {
1449
1854
  return ZodPipeline.create(this, target);
1450
1855
  }
1451
- readonly() {
1452
- return ZodReadonly.create(this);
1453
- }
1454
1856
  isOptional() {
1455
1857
  return this.safeParse(void 0).success;
1456
1858
  }
@@ -1459,19 +1861,43 @@ var init_lib = __esm({
1459
1861
  }
1460
1862
  };
1461
1863
  cuidRegex = /^c[^\s-]{8,}$/i;
1462
- cuid2Regex = /^[0-9a-z]+$/;
1463
- ulidRegex = /^[0-9A-HJKMNP-TV-Z]{26}$/;
1464
- 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;
1465
- nanoidRegex = /^[a-z0-9_-]{21}$/i;
1466
- 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)?)??$/;
1467
- emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
1468
- _emojiRegex = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
1469
- 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])$/;
1470
- ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
1471
- base64Regex = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
1472
- 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])))`;
1473
- dateRegex = new RegExp(`^${dateRegexSource}$`);
1864
+ uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
1865
+ emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
1866
+ datetimeRegex = (args) => {
1867
+ if (args.precision) {
1868
+ if (args.offset) {
1869
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
1870
+ } else {
1871
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
1872
+ }
1873
+ } else if (args.precision === 0) {
1874
+ if (args.offset) {
1875
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
1876
+ } else {
1877
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
1878
+ }
1879
+ } else {
1880
+ if (args.offset) {
1881
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
1882
+ } else {
1883
+ return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
1884
+ }
1885
+ }
1886
+ };
1474
1887
  ZodString = class _ZodString extends ZodType {
1888
+ constructor() {
1889
+ super(...arguments);
1890
+ this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
1891
+ validation,
1892
+ code: ZodIssueCode.invalid_string,
1893
+ ...errorUtil.errToObj(message)
1894
+ });
1895
+ this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
1896
+ this.trim = () => new _ZodString({
1897
+ ...this._def,
1898
+ checks: [...this._def.checks, { kind: "trim" }]
1899
+ });
1900
+ }
1475
1901
  _parse(input) {
1476
1902
  if (this._def.coerce) {
1477
1903
  input.data = String(input.data);
@@ -1479,11 +1905,15 @@ var init_lib = __esm({
1479
1905
  const parsedType = this._getType(input);
1480
1906
  if (parsedType !== ZodParsedType.string) {
1481
1907
  const ctx2 = this._getOrReturnCtx(input);
1482
- addIssueToContext(ctx2, {
1483
- code: ZodIssueCode.invalid_type,
1484
- expected: ZodParsedType.string,
1485
- received: ctx2.parsedType
1486
- });
1908
+ addIssueToContext(
1909
+ ctx2,
1910
+ {
1911
+ code: ZodIssueCode.invalid_type,
1912
+ expected: ZodParsedType.string,
1913
+ received: ctx2.parsedType
1914
+ }
1915
+ //
1916
+ );
1487
1917
  return INVALID;
1488
1918
  }
1489
1919
  const status = new ParseStatus();
@@ -1551,19 +1981,6 @@ var init_lib = __esm({
1551
1981
  });
1552
1982
  status.dirty();
1553
1983
  }
1554
- } else if (check.kind === "emoji") {
1555
- if (!emojiRegex) {
1556
- emojiRegex = new RegExp(_emojiRegex, "u");
1557
- }
1558
- if (!emojiRegex.test(input.data)) {
1559
- ctx = this._getOrReturnCtx(input, ctx);
1560
- addIssueToContext(ctx, {
1561
- validation: "emoji",
1562
- code: ZodIssueCode.invalid_string,
1563
- message: check.message
1564
- });
1565
- status.dirty();
1566
- }
1567
1984
  } else if (check.kind === "uuid") {
1568
1985
  if (!uuidRegex.test(input.data)) {
1569
1986
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1574,16 +1991,6 @@ var init_lib = __esm({
1574
1991
  });
1575
1992
  status.dirty();
1576
1993
  }
1577
- } else if (check.kind === "nanoid") {
1578
- if (!nanoidRegex.test(input.data)) {
1579
- ctx = this._getOrReturnCtx(input, ctx);
1580
- addIssueToContext(ctx, {
1581
- validation: "nanoid",
1582
- code: ZodIssueCode.invalid_string,
1583
- message: check.message
1584
- });
1585
- status.dirty();
1586
- }
1587
1994
  } else if (check.kind === "cuid") {
1588
1995
  if (!cuidRegex.test(input.data)) {
1589
1996
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1594,26 +2001,6 @@ var init_lib = __esm({
1594
2001
  });
1595
2002
  status.dirty();
1596
2003
  }
1597
- } else if (check.kind === "cuid2") {
1598
- if (!cuid2Regex.test(input.data)) {
1599
- ctx = this._getOrReturnCtx(input, ctx);
1600
- addIssueToContext(ctx, {
1601
- validation: "cuid2",
1602
- code: ZodIssueCode.invalid_string,
1603
- message: check.message
1604
- });
1605
- status.dirty();
1606
- }
1607
- } else if (check.kind === "ulid") {
1608
- if (!ulidRegex.test(input.data)) {
1609
- ctx = this._getOrReturnCtx(input, ctx);
1610
- addIssueToContext(ctx, {
1611
- validation: "ulid",
1612
- code: ZodIssueCode.invalid_string,
1613
- message: check.message
1614
- });
1615
- status.dirty();
1616
- }
1617
2004
  } else if (check.kind === "url") {
1618
2005
  try {
1619
2006
  new URL(input.data);
@@ -1640,20 +2027,6 @@ var init_lib = __esm({
1640
2027
  }
1641
2028
  } else if (check.kind === "trim") {
1642
2029
  input.data = input.data.trim();
1643
- } else if (check.kind === "includes") {
1644
- if (!input.data.includes(check.value, check.position)) {
1645
- ctx = this._getOrReturnCtx(input, ctx);
1646
- addIssueToContext(ctx, {
1647
- code: ZodIssueCode.invalid_string,
1648
- validation: { includes: check.value, position: check.position },
1649
- message: check.message
1650
- });
1651
- status.dirty();
1652
- }
1653
- } else if (check.kind === "toLowerCase") {
1654
- input.data = input.data.toLowerCase();
1655
- } else if (check.kind === "toUpperCase") {
1656
- input.data = input.data.toUpperCase();
1657
2030
  } else if (check.kind === "startsWith") {
1658
2031
  if (!input.data.startsWith(check.value)) {
1659
2032
  ctx = this._getOrReturnCtx(input, ctx);
@@ -1685,71 +2058,12 @@ var init_lib = __esm({
1685
2058
  });
1686
2059
  status.dirty();
1687
2060
  }
1688
- } else if (check.kind === "date") {
1689
- const regex = dateRegex;
1690
- if (!regex.test(input.data)) {
1691
- ctx = this._getOrReturnCtx(input, ctx);
1692
- addIssueToContext(ctx, {
1693
- code: ZodIssueCode.invalid_string,
1694
- validation: "date",
1695
- message: check.message
1696
- });
1697
- status.dirty();
1698
- }
1699
- } else if (check.kind === "time") {
1700
- const regex = timeRegex(check);
1701
- if (!regex.test(input.data)) {
1702
- ctx = this._getOrReturnCtx(input, ctx);
1703
- addIssueToContext(ctx, {
1704
- code: ZodIssueCode.invalid_string,
1705
- validation: "time",
1706
- message: check.message
1707
- });
1708
- status.dirty();
1709
- }
1710
- } else if (check.kind === "duration") {
1711
- if (!durationRegex.test(input.data)) {
1712
- ctx = this._getOrReturnCtx(input, ctx);
1713
- addIssueToContext(ctx, {
1714
- validation: "duration",
1715
- code: ZodIssueCode.invalid_string,
1716
- message: check.message
1717
- });
1718
- status.dirty();
1719
- }
1720
- } else if (check.kind === "ip") {
1721
- if (!isValidIP(input.data, check.version)) {
1722
- ctx = this._getOrReturnCtx(input, ctx);
1723
- addIssueToContext(ctx, {
1724
- validation: "ip",
1725
- code: ZodIssueCode.invalid_string,
1726
- message: check.message
1727
- });
1728
- status.dirty();
1729
- }
1730
- } else if (check.kind === "base64") {
1731
- if (!base64Regex.test(input.data)) {
1732
- ctx = this._getOrReturnCtx(input, ctx);
1733
- addIssueToContext(ctx, {
1734
- validation: "base64",
1735
- code: ZodIssueCode.invalid_string,
1736
- message: check.message
1737
- });
1738
- status.dirty();
1739
- }
1740
2061
  } else {
1741
2062
  util.assertNever(check);
1742
2063
  }
1743
2064
  }
1744
2065
  return { status: status.value, value: input.data };
1745
2066
  }
1746
- _regex(regex, validation, message) {
1747
- return this.refinement((data) => regex.test(data), {
1748
- validation,
1749
- code: ZodIssueCode.invalid_string,
1750
- ...errorUtil.errToObj(message)
1751
- });
1752
- }
1753
2067
  _addCheck(check) {
1754
2068
  return new _ZodString({
1755
2069
  ...this._def,
@@ -1762,38 +2076,19 @@ var init_lib = __esm({
1762
2076
  url(message) {
1763
2077
  return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
1764
2078
  }
1765
- emoji(message) {
1766
- return this._addCheck({ kind: "emoji", ...errorUtil.errToObj(message) });
1767
- }
1768
2079
  uuid(message) {
1769
2080
  return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
1770
2081
  }
1771
- nanoid(message) {
1772
- return this._addCheck({ kind: "nanoid", ...errorUtil.errToObj(message) });
1773
- }
1774
2082
  cuid(message) {
1775
2083
  return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1776
2084
  }
1777
- cuid2(message) {
1778
- return this._addCheck({ kind: "cuid2", ...errorUtil.errToObj(message) });
1779
- }
1780
- ulid(message) {
1781
- return this._addCheck({ kind: "ulid", ...errorUtil.errToObj(message) });
1782
- }
1783
- base64(message) {
1784
- return this._addCheck({ kind: "base64", ...errorUtil.errToObj(message) });
1785
- }
1786
- ip(options) {
1787
- return this._addCheck({ kind: "ip", ...errorUtil.errToObj(options) });
1788
- }
1789
2085
  datetime(options) {
1790
- var _a, _b;
2086
+ var _a;
1791
2087
  if (typeof options === "string") {
1792
2088
  return this._addCheck({
1793
2089
  kind: "datetime",
1794
2090
  precision: null,
1795
2091
  offset: false,
1796
- local: false,
1797
2092
  message: options
1798
2093
  });
1799
2094
  }
@@ -1801,30 +2096,9 @@ var init_lib = __esm({
1801
2096
  kind: "datetime",
1802
2097
  precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1803
2098
  offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1804
- local: (_b = options === null || options === void 0 ? void 0 : options.local) !== null && _b !== void 0 ? _b : false,
1805
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1806
- });
1807
- }
1808
- date(message) {
1809
- return this._addCheck({ kind: "date", message });
1810
- }
1811
- time(options) {
1812
- if (typeof options === "string") {
1813
- return this._addCheck({
1814
- kind: "time",
1815
- precision: null,
1816
- message: options
1817
- });
1818
- }
1819
- return this._addCheck({
1820
- kind: "time",
1821
- precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1822
2099
  ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1823
2100
  });
1824
2101
  }
1825
- duration(message) {
1826
- return this._addCheck({ kind: "duration", ...errorUtil.errToObj(message) });
1827
- }
1828
2102
  regex(regex, message) {
1829
2103
  return this._addCheck({
1830
2104
  kind: "regex",
@@ -1832,14 +2106,6 @@ var init_lib = __esm({
1832
2106
  ...errorUtil.errToObj(message)
1833
2107
  });
1834
2108
  }
1835
- includes(value, options) {
1836
- return this._addCheck({
1837
- kind: "includes",
1838
- value,
1839
- position: options === null || options === void 0 ? void 0 : options.position,
1840
- ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1841
- });
1842
- }
1843
2109
  startsWith(value, message) {
1844
2110
  return this._addCheck({
1845
2111
  kind: "startsWith",
@@ -1864,299 +2130,33 @@ var init_lib = __esm({
1864
2130
  max(maxLength, message) {
1865
2131
  return this._addCheck({
1866
2132
  kind: "max",
1867
- value: maxLength,
1868
- ...errorUtil.errToObj(message)
1869
- });
1870
- }
1871
- length(len, message) {
1872
- return this._addCheck({
1873
- kind: "length",
1874
- value: len,
1875
- ...errorUtil.errToObj(message)
1876
- });
1877
- }
1878
- /**
1879
- * @deprecated Use z.string().min(1) instead.
1880
- * @see {@link ZodString.min}
1881
- */
1882
- nonempty(message) {
1883
- return this.min(1, errorUtil.errToObj(message));
1884
- }
1885
- trim() {
1886
- return new _ZodString({
1887
- ...this._def,
1888
- checks: [...this._def.checks, { kind: "trim" }]
1889
- });
1890
- }
1891
- toLowerCase() {
1892
- return new _ZodString({
1893
- ...this._def,
1894
- checks: [...this._def.checks, { kind: "toLowerCase" }]
1895
- });
1896
- }
1897
- toUpperCase() {
1898
- return new _ZodString({
1899
- ...this._def,
1900
- checks: [...this._def.checks, { kind: "toUpperCase" }]
1901
- });
1902
- }
1903
- get isDatetime() {
1904
- return !!this._def.checks.find((ch) => ch.kind === "datetime");
1905
- }
1906
- get isDate() {
1907
- return !!this._def.checks.find((ch) => ch.kind === "date");
1908
- }
1909
- get isTime() {
1910
- return !!this._def.checks.find((ch) => ch.kind === "time");
1911
- }
1912
- get isDuration() {
1913
- return !!this._def.checks.find((ch) => ch.kind === "duration");
1914
- }
1915
- get isEmail() {
1916
- return !!this._def.checks.find((ch) => ch.kind === "email");
1917
- }
1918
- get isURL() {
1919
- return !!this._def.checks.find((ch) => ch.kind === "url");
1920
- }
1921
- get isEmoji() {
1922
- return !!this._def.checks.find((ch) => ch.kind === "emoji");
1923
- }
1924
- get isUUID() {
1925
- return !!this._def.checks.find((ch) => ch.kind === "uuid");
1926
- }
1927
- get isNANOID() {
1928
- return !!this._def.checks.find((ch) => ch.kind === "nanoid");
1929
- }
1930
- get isCUID() {
1931
- return !!this._def.checks.find((ch) => ch.kind === "cuid");
1932
- }
1933
- get isCUID2() {
1934
- return !!this._def.checks.find((ch) => ch.kind === "cuid2");
1935
- }
1936
- get isULID() {
1937
- return !!this._def.checks.find((ch) => ch.kind === "ulid");
1938
- }
1939
- get isIP() {
1940
- return !!this._def.checks.find((ch) => ch.kind === "ip");
1941
- }
1942
- get isBase64() {
1943
- return !!this._def.checks.find((ch) => ch.kind === "base64");
1944
- }
1945
- get minLength() {
1946
- let min = null;
1947
- for (const ch of this._def.checks) {
1948
- if (ch.kind === "min") {
1949
- if (min === null || ch.value > min)
1950
- min = ch.value;
1951
- }
1952
- }
1953
- return min;
1954
- }
1955
- get maxLength() {
1956
- let max = null;
1957
- for (const ch of this._def.checks) {
1958
- if (ch.kind === "max") {
1959
- if (max === null || ch.value < max)
1960
- max = ch.value;
1961
- }
1962
- }
1963
- return max;
1964
- }
1965
- };
1966
- ZodString.create = (params) => {
1967
- var _a;
1968
- return new ZodString({
1969
- checks: [],
1970
- typeName: ZodFirstPartyTypeKind.ZodString,
1971
- coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1972
- ...processCreateParams(params)
1973
- });
1974
- };
1975
- ZodNumber = class _ZodNumber extends ZodType {
1976
- constructor() {
1977
- super(...arguments);
1978
- this.min = this.gte;
1979
- this.max = this.lte;
1980
- this.step = this.multipleOf;
1981
- }
1982
- _parse(input) {
1983
- if (this._def.coerce) {
1984
- input.data = Number(input.data);
1985
- }
1986
- const parsedType = this._getType(input);
1987
- if (parsedType !== ZodParsedType.number) {
1988
- const ctx2 = this._getOrReturnCtx(input);
1989
- addIssueToContext(ctx2, {
1990
- code: ZodIssueCode.invalid_type,
1991
- expected: ZodParsedType.number,
1992
- received: ctx2.parsedType
1993
- });
1994
- return INVALID;
1995
- }
1996
- let ctx = void 0;
1997
- const status = new ParseStatus();
1998
- for (const check of this._def.checks) {
1999
- if (check.kind === "int") {
2000
- if (!util.isInteger(input.data)) {
2001
- ctx = this._getOrReturnCtx(input, ctx);
2002
- addIssueToContext(ctx, {
2003
- code: ZodIssueCode.invalid_type,
2004
- expected: "integer",
2005
- received: "float",
2006
- message: check.message
2007
- });
2008
- status.dirty();
2009
- }
2010
- } else if (check.kind === "min") {
2011
- const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
2012
- if (tooSmall) {
2013
- ctx = this._getOrReturnCtx(input, ctx);
2014
- addIssueToContext(ctx, {
2015
- code: ZodIssueCode.too_small,
2016
- minimum: check.value,
2017
- type: "number",
2018
- inclusive: check.inclusive,
2019
- exact: false,
2020
- message: check.message
2021
- });
2022
- status.dirty();
2023
- }
2024
- } else if (check.kind === "max") {
2025
- const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
2026
- if (tooBig) {
2027
- ctx = this._getOrReturnCtx(input, ctx);
2028
- addIssueToContext(ctx, {
2029
- code: ZodIssueCode.too_big,
2030
- maximum: check.value,
2031
- type: "number",
2032
- inclusive: check.inclusive,
2033
- exact: false,
2034
- message: check.message
2035
- });
2036
- status.dirty();
2037
- }
2038
- } else if (check.kind === "multipleOf") {
2039
- if (floatSafeRemainder(input.data, check.value) !== 0) {
2040
- ctx = this._getOrReturnCtx(input, ctx);
2041
- addIssueToContext(ctx, {
2042
- code: ZodIssueCode.not_multiple_of,
2043
- multipleOf: check.value,
2044
- message: check.message
2045
- });
2046
- status.dirty();
2047
- }
2048
- } else if (check.kind === "finite") {
2049
- if (!Number.isFinite(input.data)) {
2050
- ctx = this._getOrReturnCtx(input, ctx);
2051
- addIssueToContext(ctx, {
2052
- code: ZodIssueCode.not_finite,
2053
- message: check.message
2054
- });
2055
- status.dirty();
2056
- }
2057
- } else {
2058
- util.assertNever(check);
2059
- }
2060
- }
2061
- return { status: status.value, value: input.data };
2062
- }
2063
- gte(value, message) {
2064
- return this.setLimit("min", value, true, errorUtil.toString(message));
2065
- }
2066
- gt(value, message) {
2067
- return this.setLimit("min", value, false, errorUtil.toString(message));
2068
- }
2069
- lte(value, message) {
2070
- return this.setLimit("max", value, true, errorUtil.toString(message));
2071
- }
2072
- lt(value, message) {
2073
- return this.setLimit("max", value, false, errorUtil.toString(message));
2074
- }
2075
- setLimit(kind, value, inclusive, message) {
2076
- return new _ZodNumber({
2077
- ...this._def,
2078
- checks: [
2079
- ...this._def.checks,
2080
- {
2081
- kind,
2082
- value,
2083
- inclusive,
2084
- message: errorUtil.toString(message)
2085
- }
2086
- ]
2087
- });
2088
- }
2089
- _addCheck(check) {
2090
- return new _ZodNumber({
2091
- ...this._def,
2092
- checks: [...this._def.checks, check]
2093
- });
2094
- }
2095
- int(message) {
2096
- return this._addCheck({
2097
- kind: "int",
2098
- message: errorUtil.toString(message)
2099
- });
2100
- }
2101
- positive(message) {
2102
- return this._addCheck({
2103
- kind: "min",
2104
- value: 0,
2105
- inclusive: false,
2106
- message: errorUtil.toString(message)
2107
- });
2108
- }
2109
- negative(message) {
2110
- return this._addCheck({
2111
- kind: "max",
2112
- value: 0,
2113
- inclusive: false,
2114
- message: errorUtil.toString(message)
2115
- });
2116
- }
2117
- nonpositive(message) {
2118
- return this._addCheck({
2119
- kind: "max",
2120
- value: 0,
2121
- inclusive: true,
2122
- message: errorUtil.toString(message)
2123
- });
2124
- }
2125
- nonnegative(message) {
2126
- return this._addCheck({
2127
- kind: "min",
2128
- value: 0,
2129
- inclusive: true,
2130
- message: errorUtil.toString(message)
2131
- });
2132
- }
2133
- multipleOf(value, message) {
2134
- return this._addCheck({
2135
- kind: "multipleOf",
2136
- value,
2137
- message: errorUtil.toString(message)
2138
- });
2139
- }
2140
- finite(message) {
2141
- return this._addCheck({
2142
- kind: "finite",
2143
- message: errorUtil.toString(message)
2133
+ value: maxLength,
2134
+ ...errorUtil.errToObj(message)
2144
2135
  });
2145
2136
  }
2146
- safe(message) {
2137
+ length(len, message) {
2147
2138
  return this._addCheck({
2148
- kind: "min",
2149
- inclusive: true,
2150
- value: Number.MIN_SAFE_INTEGER,
2151
- message: errorUtil.toString(message)
2152
- })._addCheck({
2153
- kind: "max",
2154
- inclusive: true,
2155
- value: Number.MAX_SAFE_INTEGER,
2156
- message: errorUtil.toString(message)
2139
+ kind: "length",
2140
+ value: len,
2141
+ ...errorUtil.errToObj(message)
2157
2142
  });
2158
2143
  }
2159
- get minValue() {
2144
+ get isDatetime() {
2145
+ return !!this._def.checks.find((ch) => ch.kind === "datetime");
2146
+ }
2147
+ get isEmail() {
2148
+ return !!this._def.checks.find((ch) => ch.kind === "email");
2149
+ }
2150
+ get isURL() {
2151
+ return !!this._def.checks.find((ch) => ch.kind === "url");
2152
+ }
2153
+ get isUUID() {
2154
+ return !!this._def.checks.find((ch) => ch.kind === "uuid");
2155
+ }
2156
+ get isCUID() {
2157
+ return !!this._def.checks.find((ch) => ch.kind === "cuid");
2158
+ }
2159
+ get minLength() {
2160
2160
  let min = null;
2161
2161
  for (const ch of this._def.checks) {
2162
2162
  if (ch.kind === "min") {
@@ -2166,7 +2166,7 @@ var init_lib = __esm({
2166
2166
  }
2167
2167
  return min;
2168
2168
  }
2169
- get maxValue() {
2169
+ get maxLength() {
2170
2170
  let max = null;
2171
2171
  for (const ch of this._def.checks) {
2172
2172
  if (ch.kind === "max") {
@@ -2176,49 +2176,33 @@ var init_lib = __esm({
2176
2176
  }
2177
2177
  return max;
2178
2178
  }
2179
- get isInt() {
2180
- return !!this._def.checks.find((ch) => ch.kind === "int" || ch.kind === "multipleOf" && util.isInteger(ch.value));
2181
- }
2182
- get isFinite() {
2183
- let max = null, min = null;
2184
- for (const ch of this._def.checks) {
2185
- if (ch.kind === "finite" || ch.kind === "int" || ch.kind === "multipleOf") {
2186
- return true;
2187
- } else if (ch.kind === "min") {
2188
- if (min === null || ch.value > min)
2189
- min = ch.value;
2190
- } else if (ch.kind === "max") {
2191
- if (max === null || ch.value < max)
2192
- max = ch.value;
2193
- }
2194
- }
2195
- return Number.isFinite(min) && Number.isFinite(max);
2196
- }
2197
2179
  };
2198
- ZodNumber.create = (params) => {
2199
- return new ZodNumber({
2180
+ ZodString.create = (params) => {
2181
+ var _a;
2182
+ return new ZodString({
2200
2183
  checks: [],
2201
- typeName: ZodFirstPartyTypeKind.ZodNumber,
2202
- coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2184
+ typeName: ZodFirstPartyTypeKind.ZodString,
2185
+ coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2203
2186
  ...processCreateParams(params)
2204
2187
  });
2205
2188
  };
2206
- ZodBigInt = class _ZodBigInt extends ZodType {
2189
+ ZodNumber = class _ZodNumber extends ZodType {
2207
2190
  constructor() {
2208
2191
  super(...arguments);
2209
2192
  this.min = this.gte;
2210
2193
  this.max = this.lte;
2194
+ this.step = this.multipleOf;
2211
2195
  }
2212
2196
  _parse(input) {
2213
2197
  if (this._def.coerce) {
2214
- input.data = BigInt(input.data);
2198
+ input.data = Number(input.data);
2215
2199
  }
2216
2200
  const parsedType = this._getType(input);
2217
- if (parsedType !== ZodParsedType.bigint) {
2201
+ if (parsedType !== ZodParsedType.number) {
2218
2202
  const ctx2 = this._getOrReturnCtx(input);
2219
2203
  addIssueToContext(ctx2, {
2220
2204
  code: ZodIssueCode.invalid_type,
2221
- expected: ZodParsedType.bigint,
2205
+ expected: ZodParsedType.number,
2222
2206
  received: ctx2.parsedType
2223
2207
  });
2224
2208
  return INVALID;
@@ -2226,15 +2210,27 @@ var init_lib = __esm({
2226
2210
  let ctx = void 0;
2227
2211
  const status = new ParseStatus();
2228
2212
  for (const check of this._def.checks) {
2229
- if (check.kind === "min") {
2213
+ if (check.kind === "int") {
2214
+ if (!util.isInteger(input.data)) {
2215
+ ctx = this._getOrReturnCtx(input, ctx);
2216
+ addIssueToContext(ctx, {
2217
+ code: ZodIssueCode.invalid_type,
2218
+ expected: "integer",
2219
+ received: "float",
2220
+ message: check.message
2221
+ });
2222
+ status.dirty();
2223
+ }
2224
+ } else if (check.kind === "min") {
2230
2225
  const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
2231
2226
  if (tooSmall) {
2232
2227
  ctx = this._getOrReturnCtx(input, ctx);
2233
2228
  addIssueToContext(ctx, {
2234
2229
  code: ZodIssueCode.too_small,
2235
- type: "bigint",
2236
2230
  minimum: check.value,
2231
+ type: "number",
2237
2232
  inclusive: check.inclusive,
2233
+ exact: false,
2238
2234
  message: check.message
2239
2235
  });
2240
2236
  status.dirty();
@@ -2245,15 +2241,16 @@ var init_lib = __esm({
2245
2241
  ctx = this._getOrReturnCtx(input, ctx);
2246
2242
  addIssueToContext(ctx, {
2247
2243
  code: ZodIssueCode.too_big,
2248
- type: "bigint",
2249
2244
  maximum: check.value,
2245
+ type: "number",
2250
2246
  inclusive: check.inclusive,
2247
+ exact: false,
2251
2248
  message: check.message
2252
2249
  });
2253
2250
  status.dirty();
2254
2251
  }
2255
2252
  } else if (check.kind === "multipleOf") {
2256
- if (input.data % check.value !== BigInt(0)) {
2253
+ if (floatSafeRemainder(input.data, check.value) !== 0) {
2257
2254
  ctx = this._getOrReturnCtx(input, ctx);
2258
2255
  addIssueToContext(ctx, {
2259
2256
  code: ZodIssueCode.not_multiple_of,
@@ -2262,6 +2259,15 @@ var init_lib = __esm({
2262
2259
  });
2263
2260
  status.dirty();
2264
2261
  }
2262
+ } else if (check.kind === "finite") {
2263
+ if (!Number.isFinite(input.data)) {
2264
+ ctx = this._getOrReturnCtx(input, ctx);
2265
+ addIssueToContext(ctx, {
2266
+ code: ZodIssueCode.not_finite,
2267
+ message: check.message
2268
+ });
2269
+ status.dirty();
2270
+ }
2265
2271
  } else {
2266
2272
  util.assertNever(check);
2267
2273
  }
@@ -2281,7 +2287,7 @@ var init_lib = __esm({
2281
2287
  return this.setLimit("max", value, false, errorUtil.toString(message));
2282
2288
  }
2283
2289
  setLimit(kind, value, inclusive, message) {
2284
- return new _ZodBigInt({
2290
+ return new _ZodNumber({
2285
2291
  ...this._def,
2286
2292
  checks: [
2287
2293
  ...this._def.checks,
@@ -2295,15 +2301,21 @@ var init_lib = __esm({
2295
2301
  });
2296
2302
  }
2297
2303
  _addCheck(check) {
2298
- return new _ZodBigInt({
2304
+ return new _ZodNumber({
2299
2305
  ...this._def,
2300
2306
  checks: [...this._def.checks, check]
2301
2307
  });
2302
2308
  }
2309
+ int(message) {
2310
+ return this._addCheck({
2311
+ kind: "int",
2312
+ message: errorUtil.toString(message)
2313
+ });
2314
+ }
2303
2315
  positive(message) {
2304
2316
  return this._addCheck({
2305
2317
  kind: "min",
2306
- value: BigInt(0),
2318
+ value: 0,
2307
2319
  inclusive: false,
2308
2320
  message: errorUtil.toString(message)
2309
2321
  });
@@ -2311,7 +2323,7 @@ var init_lib = __esm({
2311
2323
  negative(message) {
2312
2324
  return this._addCheck({
2313
2325
  kind: "max",
2314
- value: BigInt(0),
2326
+ value: 0,
2315
2327
  inclusive: false,
2316
2328
  message: errorUtil.toString(message)
2317
2329
  });
@@ -2319,7 +2331,7 @@ var init_lib = __esm({
2319
2331
  nonpositive(message) {
2320
2332
  return this._addCheck({
2321
2333
  kind: "max",
2322
- value: BigInt(0),
2334
+ value: 0,
2323
2335
  inclusive: true,
2324
2336
  message: errorUtil.toString(message)
2325
2337
  });
@@ -2327,7 +2339,7 @@ var init_lib = __esm({
2327
2339
  nonnegative(message) {
2328
2340
  return this._addCheck({
2329
2341
  kind: "min",
2330
- value: BigInt(0),
2342
+ value: 0,
2331
2343
  inclusive: true,
2332
2344
  message: errorUtil.toString(message)
2333
2345
  });
@@ -2339,6 +2351,12 @@ var init_lib = __esm({
2339
2351
  message: errorUtil.toString(message)
2340
2352
  });
2341
2353
  }
2354
+ finite(message) {
2355
+ return this._addCheck({
2356
+ kind: "finite",
2357
+ message: errorUtil.toString(message)
2358
+ });
2359
+ }
2342
2360
  get minValue() {
2343
2361
  let min = null;
2344
2362
  for (const ch of this._def.checks) {
@@ -2359,11 +2377,39 @@ var init_lib = __esm({
2359
2377
  }
2360
2378
  return max;
2361
2379
  }
2380
+ get isInt() {
2381
+ return !!this._def.checks.find((ch) => ch.kind === "int");
2382
+ }
2383
+ };
2384
+ ZodNumber.create = (params) => {
2385
+ return new ZodNumber({
2386
+ checks: [],
2387
+ typeName: ZodFirstPartyTypeKind.ZodNumber,
2388
+ coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
2389
+ ...processCreateParams(params)
2390
+ });
2391
+ };
2392
+ ZodBigInt = class extends ZodType {
2393
+ _parse(input) {
2394
+ if (this._def.coerce) {
2395
+ input.data = BigInt(input.data);
2396
+ }
2397
+ const parsedType = this._getType(input);
2398
+ if (parsedType !== ZodParsedType.bigint) {
2399
+ const ctx = this._getOrReturnCtx(input);
2400
+ addIssueToContext(ctx, {
2401
+ code: ZodIssueCode.invalid_type,
2402
+ expected: ZodParsedType.bigint,
2403
+ received: ctx.parsedType
2404
+ });
2405
+ return INVALID;
2406
+ }
2407
+ return OK(input.data);
2408
+ }
2362
2409
  };
2363
2410
  ZodBigInt.create = (params) => {
2364
2411
  var _a;
2365
2412
  return new ZodBigInt({
2366
- checks: [],
2367
2413
  typeName: ZodFirstPartyTypeKind.ZodBigInt,
2368
2414
  coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
2369
2415
  ...processCreateParams(params)
@@ -2689,13 +2735,13 @@ var init_lib = __esm({
2689
2735
  }
2690
2736
  }
2691
2737
  if (ctx.common.async) {
2692
- return Promise.all([...ctx.data].map((item, i) => {
2738
+ return Promise.all(ctx.data.map((item, i) => {
2693
2739
  return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2694
2740
  })).then((result2) => {
2695
2741
  return ParseStatus.mergeArray(status, result2);
2696
2742
  });
2697
2743
  }
2698
- const result = [...ctx.data].map((item, i) => {
2744
+ const result = ctx.data.map((item, i) => {
2699
2745
  return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2700
2746
  });
2701
2747
  return ParseStatus.mergeArray(status, result);
@@ -2735,12 +2781,31 @@ var init_lib = __esm({
2735
2781
  ...processCreateParams(params)
2736
2782
  });
2737
2783
  };
2784
+ (function(objectUtil2) {
2785
+ objectUtil2.mergeShapes = (first, second) => {
2786
+ return {
2787
+ ...first,
2788
+ ...second
2789
+ // second overwrites first
2790
+ };
2791
+ };
2792
+ })(objectUtil || (objectUtil = {}));
2793
+ AugmentFactory = (def) => (augmentation) => {
2794
+ return new ZodObject({
2795
+ ...def,
2796
+ shape: () => ({
2797
+ ...def.shape(),
2798
+ ...augmentation
2799
+ })
2800
+ });
2801
+ };
2738
2802
  ZodObject = class _ZodObject extends ZodType {
2739
2803
  constructor() {
2740
2804
  super(...arguments);
2741
2805
  this._cached = null;
2742
2806
  this.nonstrict = this.passthrough;
2743
- this.augment = this.extend;
2807
+ this.augment = AugmentFactory(this._def);
2808
+ this.extend = AugmentFactory(this._def);
2744
2809
  }
2745
2810
  _getCached() {
2746
2811
  if (this._cached !== null)
@@ -2821,10 +2886,9 @@ var init_lib = __esm({
2821
2886
  const syncPairs = [];
2822
2887
  for (const pair of pairs) {
2823
2888
  const key = await pair.key;
2824
- const value = await pair.value;
2825
2889
  syncPairs.push({
2826
2890
  key,
2827
- value,
2891
+ value: await pair.value,
2828
2892
  alwaysSet: pair.alwaysSet
2829
2893
  });
2830
2894
  }
@@ -2871,31 +2935,8 @@ var init_lib = __esm({
2871
2935
  unknownKeys: "passthrough"
2872
2936
  });
2873
2937
  }
2874
- // const AugmentFactory =
2875
- // <Def extends ZodObjectDef>(def: Def) =>
2876
- // <Augmentation extends ZodRawShape>(
2877
- // augmentation: Augmentation
2878
- // ): ZodObject<
2879
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
2880
- // Def["unknownKeys"],
2881
- // Def["catchall"]
2882
- // > => {
2883
- // return new ZodObject({
2884
- // ...def,
2885
- // shape: () => ({
2886
- // ...def.shape(),
2887
- // ...augmentation,
2888
- // }),
2889
- // }) as any;
2890
- // };
2891
- extend(augmentation) {
2892
- return new _ZodObject({
2893
- ...this._def,
2894
- shape: () => ({
2895
- ...this._def.shape(),
2896
- ...augmentation
2897
- })
2898
- });
2938
+ setKey(key, schema3) {
2939
+ return this.augment({ [key]: schema3 });
2899
2940
  }
2900
2941
  /**
2901
2942
  * Prior to zod@1.0.12 there was a bug in the
@@ -2906,73 +2947,11 @@ var init_lib = __esm({
2906
2947
  const merged = new _ZodObject({
2907
2948
  unknownKeys: merging._def.unknownKeys,
2908
2949
  catchall: merging._def.catchall,
2909
- shape: () => ({
2910
- ...this._def.shape(),
2911
- ...merging._def.shape()
2912
- }),
2950
+ shape: () => objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2913
2951
  typeName: ZodFirstPartyTypeKind.ZodObject
2914
2952
  });
2915
2953
  return merged;
2916
2954
  }
2917
- // merge<
2918
- // Incoming extends AnyZodObject,
2919
- // Augmentation extends Incoming["shape"],
2920
- // NewOutput extends {
2921
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
2922
- // ? Augmentation[k]["_output"]
2923
- // : k extends keyof Output
2924
- // ? Output[k]
2925
- // : never;
2926
- // },
2927
- // NewInput extends {
2928
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
2929
- // ? Augmentation[k]["_input"]
2930
- // : k extends keyof Input
2931
- // ? Input[k]
2932
- // : never;
2933
- // }
2934
- // >(
2935
- // merging: Incoming
2936
- // ): ZodObject<
2937
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2938
- // Incoming["_def"]["unknownKeys"],
2939
- // Incoming["_def"]["catchall"],
2940
- // NewOutput,
2941
- // NewInput
2942
- // > {
2943
- // const merged: any = new ZodObject({
2944
- // unknownKeys: merging._def.unknownKeys,
2945
- // catchall: merging._def.catchall,
2946
- // shape: () =>
2947
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2948
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2949
- // }) as any;
2950
- // return merged;
2951
- // }
2952
- setKey(key, schema3) {
2953
- return this.augment({ [key]: schema3 });
2954
- }
2955
- // merge<Incoming extends AnyZodObject>(
2956
- // merging: Incoming
2957
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
2958
- // ZodObject<
2959
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
2960
- // Incoming["_def"]["unknownKeys"],
2961
- // Incoming["_def"]["catchall"]
2962
- // > {
2963
- // // const mergedShape = objectUtil.mergeShapes(
2964
- // // this._def.shape(),
2965
- // // merging._def.shape()
2966
- // // );
2967
- // const merged: any = new ZodObject({
2968
- // unknownKeys: merging._def.unknownKeys,
2969
- // catchall: merging._def.catchall,
2970
- // shape: () =>
2971
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2972
- // typeName: ZodFirstPartyTypeKind.ZodObject,
2973
- // }) as any;
2974
- // return merged;
2975
- // }
2976
2955
  catchall(index4) {
2977
2956
  return new _ZodObject({
2978
2957
  ...this._def,
@@ -2981,10 +2960,9 @@ var init_lib = __esm({
2981
2960
  }
2982
2961
  pick(mask) {
2983
2962
  const shape = {};
2984
- util.objectKeys(mask).forEach((key) => {
2985
- if (mask[key] && this.shape[key]) {
2963
+ util.objectKeys(mask).map((key) => {
2964
+ if (this.shape[key])
2986
2965
  shape[key] = this.shape[key];
2987
- }
2988
2966
  });
2989
2967
  return new _ZodObject({
2990
2968
  ...this._def,
@@ -2993,8 +2971,8 @@ var init_lib = __esm({
2993
2971
  }
2994
2972
  omit(mask) {
2995
2973
  const shape = {};
2996
- util.objectKeys(this.shape).forEach((key) => {
2997
- if (!mask[key]) {
2974
+ util.objectKeys(this.shape).map((key) => {
2975
+ if (util.objectKeys(mask).indexOf(key) === -1) {
2998
2976
  shape[key] = this.shape[key];
2999
2977
  }
3000
2978
  });
@@ -3003,22 +2981,29 @@ var init_lib = __esm({
3003
2981
  shape: () => shape
3004
2982
  });
3005
2983
  }
3006
- /**
3007
- * @deprecated
3008
- */
3009
2984
  deepPartial() {
3010
2985
  return deepPartialify(this);
3011
2986
  }
3012
2987
  partial(mask) {
3013
2988
  const newShape = {};
3014
- util.objectKeys(this.shape).forEach((key) => {
3015
- const fieldSchema = this.shape[key];
3016
- if (mask && !mask[key]) {
3017
- newShape[key] = fieldSchema;
3018
- } else {
2989
+ if (mask) {
2990
+ util.objectKeys(this.shape).map((key) => {
2991
+ if (util.objectKeys(mask).indexOf(key) === -1) {
2992
+ newShape[key] = this.shape[key];
2993
+ } else {
2994
+ newShape[key] = this.shape[key].optional();
2995
+ }
2996
+ });
2997
+ return new _ZodObject({
2998
+ ...this._def,
2999
+ shape: () => newShape
3000
+ });
3001
+ } else {
3002
+ for (const key in this.shape) {
3003
+ const fieldSchema = this.shape[key];
3019
3004
  newShape[key] = fieldSchema.optional();
3020
3005
  }
3021
- });
3006
+ }
3022
3007
  return new _ZodObject({
3023
3008
  ...this._def,
3024
3009
  shape: () => newShape
@@ -3026,10 +3011,21 @@ var init_lib = __esm({
3026
3011
  }
3027
3012
  required(mask) {
3028
3013
  const newShape = {};
3029
- util.objectKeys(this.shape).forEach((key) => {
3030
- if (mask && !mask[key]) {
3031
- newShape[key] = this.shape[key];
3032
- } else {
3014
+ if (mask) {
3015
+ util.objectKeys(this.shape).map((key) => {
3016
+ if (util.objectKeys(mask).indexOf(key) === -1) {
3017
+ newShape[key] = this.shape[key];
3018
+ } else {
3019
+ const fieldSchema = this.shape[key];
3020
+ let newField = fieldSchema;
3021
+ while (newField instanceof ZodOptional) {
3022
+ newField = newField._def.innerType;
3023
+ }
3024
+ newShape[key] = newField;
3025
+ }
3026
+ });
3027
+ } else {
3028
+ for (const key in this.shape) {
3033
3029
  const fieldSchema = this.shape[key];
3034
3030
  let newField = fieldSchema;
3035
3031
  while (newField instanceof ZodOptional) {
@@ -3037,7 +3033,7 @@ var init_lib = __esm({
3037
3033
  }
3038
3034
  newShape[key] = newField;
3039
3035
  }
3040
- });
3036
+ }
3041
3037
  return new _ZodObject({
3042
3038
  ...this._def,
3043
3039
  shape: () => newShape
@@ -3175,25 +3171,15 @@ var init_lib = __esm({
3175
3171
  } else if (type instanceof ZodEnum) {
3176
3172
  return type.options;
3177
3173
  } else if (type instanceof ZodNativeEnum) {
3178
- return util.objectValues(type.enum);
3174
+ return Object.keys(type.enum);
3179
3175
  } else if (type instanceof ZodDefault) {
3180
3176
  return getDiscriminator(type._def.innerType);
3181
3177
  } else if (type instanceof ZodUndefined) {
3182
3178
  return [void 0];
3183
3179
  } else if (type instanceof ZodNull) {
3184
3180
  return [null];
3185
- } else if (type instanceof ZodOptional) {
3186
- return [void 0, ...getDiscriminator(type.unwrap())];
3187
- } else if (type instanceof ZodNullable) {
3188
- return [null, ...getDiscriminator(type.unwrap())];
3189
- } else if (type instanceof ZodBranded) {
3190
- return getDiscriminator(type.unwrap());
3191
- } else if (type instanceof ZodReadonly) {
3192
- return getDiscriminator(type.unwrap());
3193
- } else if (type instanceof ZodCatch) {
3194
- return getDiscriminator(type._def.innerType);
3195
3181
  } else {
3196
- return [];
3182
+ return null;
3197
3183
  }
3198
3184
  };
3199
3185
  ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
@@ -3253,7 +3239,7 @@ var init_lib = __esm({
3253
3239
  const optionsMap = /* @__PURE__ */ new Map();
3254
3240
  for (const type of options) {
3255
3241
  const discriminatorValues = getDiscriminator(type.shape[discriminator]);
3256
- if (!discriminatorValues.length) {
3242
+ if (!discriminatorValues) {
3257
3243
  throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
3258
3244
  }
3259
3245
  for (const value of discriminatorValues) {
@@ -3357,7 +3343,7 @@ var init_lib = __esm({
3357
3343
  });
3358
3344
  status.dirty();
3359
3345
  }
3360
- const items = [...ctx.data].map((item, itemIndex) => {
3346
+ const items = ctx.data.map((item, itemIndex) => {
3361
3347
  const schema3 = this._def.items[itemIndex] || this._def.rest;
3362
3348
  if (!schema3)
3363
3349
  return null;
@@ -3415,8 +3401,7 @@ var init_lib = __esm({
3415
3401
  for (const key in ctx.data) {
3416
3402
  pairs.push({
3417
3403
  key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
3418
- value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),
3419
- alwaysSet: key in ctx.data
3404
+ value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
3420
3405
  });
3421
3406
  }
3422
3407
  if (ctx.common.async) {
@@ -3446,12 +3431,6 @@ var init_lib = __esm({
3446
3431
  }
3447
3432
  };
3448
3433
  ZodMap = class extends ZodType {
3449
- get keySchema() {
3450
- return this._def.keyType;
3451
- }
3452
- get valueSchema() {
3453
- return this._def.valueType;
3454
- }
3455
3434
  _parse(input) {
3456
3435
  const { status, ctx } = this._processInputParams(input);
3457
3436
  if (ctx.parsedType !== ZodParsedType.map) {
@@ -3646,29 +3625,27 @@ var init_lib = __esm({
3646
3625
  const params = { errorMap: ctx.common.contextualErrorMap };
3647
3626
  const fn = ctx.data;
3648
3627
  if (this._def.returns instanceof ZodPromise) {
3649
- const me = this;
3650
- return OK(async function(...args) {
3628
+ return OK(async (...args) => {
3651
3629
  const error2 = new ZodError([]);
3652
- const parsedArgs = await me._def.args.parseAsync(args, params).catch((e) => {
3630
+ const parsedArgs = await this._def.args.parseAsync(args, params).catch((e) => {
3653
3631
  error2.addIssue(makeArgsIssue(args, e));
3654
3632
  throw error2;
3655
3633
  });
3656
- const result = await Reflect.apply(fn, this, parsedArgs);
3657
- const parsedReturns = await me._def.returns._def.type.parseAsync(result, params).catch((e) => {
3634
+ const result = await fn(...parsedArgs);
3635
+ const parsedReturns = await this._def.returns._def.type.parseAsync(result, params).catch((e) => {
3658
3636
  error2.addIssue(makeReturnsIssue(result, e));
3659
3637
  throw error2;
3660
3638
  });
3661
3639
  return parsedReturns;
3662
3640
  });
3663
3641
  } else {
3664
- const me = this;
3665
- return OK(function(...args) {
3666
- const parsedArgs = me._def.args.safeParse(args, params);
3642
+ return OK((...args) => {
3643
+ const parsedArgs = this._def.args.safeParse(args, params);
3667
3644
  if (!parsedArgs.success) {
3668
3645
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3669
3646
  }
3670
- const result = Reflect.apply(fn, this, parsedArgs.data);
3671
- const parsedReturns = me._def.returns.safeParse(result, params);
3647
+ const result = fn(...parsedArgs.data);
3648
+ const parsedReturns = this._def.returns.safeParse(result, params);
3672
3649
  if (!parsedReturns.success) {
3673
3650
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3674
3651
  }
@@ -3733,7 +3710,6 @@ var init_lib = __esm({
3733
3710
  if (input.data !== this._def.value) {
3734
3711
  const ctx = this._getOrReturnCtx(input);
3735
3712
  addIssueToContext(ctx, {
3736
- received: ctx.data,
3737
3713
  code: ZodIssueCode.invalid_literal,
3738
3714
  expected: this._def.value
3739
3715
  });
@@ -3752,11 +3728,7 @@ var init_lib = __esm({
3752
3728
  ...processCreateParams(params)
3753
3729
  });
3754
3730
  };
3755
- ZodEnum = class _ZodEnum extends ZodType {
3756
- constructor() {
3757
- super(...arguments);
3758
- _ZodEnum_cache.set(this, void 0);
3759
- }
3731
+ ZodEnum = class extends ZodType {
3760
3732
  _parse(input) {
3761
3733
  if (typeof input.data !== "string") {
3762
3734
  const ctx = this._getOrReturnCtx(input);
@@ -3768,10 +3740,7 @@ var init_lib = __esm({
3768
3740
  });
3769
3741
  return INVALID;
3770
3742
  }
3771
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f")) {
3772
- __classPrivateFieldSet(this, _ZodEnum_cache, new Set(this._def.values), "f");
3773
- }
3774
- if (!__classPrivateFieldGet(this, _ZodEnum_cache, "f").has(input.data)) {
3743
+ if (this._def.values.indexOf(input.data) === -1) {
3775
3744
  const ctx = this._getOrReturnCtx(input);
3776
3745
  const expectedValues = this._def.values;
3777
3746
  addIssueToContext(ctx, {
@@ -3807,26 +3776,9 @@ var init_lib = __esm({
3807
3776
  }
3808
3777
  return enumValues;
3809
3778
  }
3810
- extract(values, newDef = this._def) {
3811
- return _ZodEnum.create(values, {
3812
- ...this._def,
3813
- ...newDef
3814
- });
3815
- }
3816
- exclude(values, newDef = this._def) {
3817
- return _ZodEnum.create(this.options.filter((opt) => !values.includes(opt)), {
3818
- ...this._def,
3819
- ...newDef
3820
- });
3821
- }
3822
3779
  };
3823
- _ZodEnum_cache = /* @__PURE__ */ new WeakMap();
3824
3780
  ZodEnum.create = createZodEnum;
3825
3781
  ZodNativeEnum = class extends ZodType {
3826
- constructor() {
3827
- super(...arguments);
3828
- _ZodNativeEnum_cache.set(this, void 0);
3829
- }
3830
3782
  _parse(input) {
3831
3783
  const nativeEnumValues = util.getValidEnumValues(this._def.values);
3832
3784
  const ctx = this._getOrReturnCtx(input);
@@ -3839,10 +3791,7 @@ var init_lib = __esm({
3839
3791
  });
3840
3792
  return INVALID;
3841
3793
  }
3842
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f")) {
3843
- __classPrivateFieldSet(this, _ZodNativeEnum_cache, new Set(util.getValidEnumValues(this._def.values)), "f");
3844
- }
3845
- if (!__classPrivateFieldGet(this, _ZodNativeEnum_cache, "f").has(input.data)) {
3794
+ if (nativeEnumValues.indexOf(input.data) === -1) {
3846
3795
  const expectedValues = util.objectValues(nativeEnumValues);
3847
3796
  addIssueToContext(ctx, {
3848
3797
  received: ctx.data,
@@ -3857,7 +3806,6 @@ var init_lib = __esm({
3857
3806
  return this._def.values;
3858
3807
  }
3859
3808
  };
3860
- _ZodNativeEnum_cache = /* @__PURE__ */ new WeakMap();
3861
3809
  ZodNativeEnum.create = (values, params) => {
3862
3810
  return new ZodNativeEnum({
3863
3811
  values,
@@ -3866,9 +3814,6 @@ var init_lib = __esm({
3866
3814
  });
3867
3815
  };
3868
3816
  ZodPromise = class extends ZodType {
3869
- unwrap() {
3870
- return this._def.type;
3871
- }
3872
3817
  _parse(input) {
3873
3818
  const { ctx } = this._processInputParams(input);
3874
3819
  if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
@@ -3905,56 +3850,38 @@ var init_lib = __esm({
3905
3850
  _parse(input) {
3906
3851
  const { status, ctx } = this._processInputParams(input);
3907
3852
  const effect = this._def.effect || null;
3908
- const checkCtx = {
3909
- addIssue: (arg) => {
3910
- addIssueToContext(ctx, arg);
3911
- if (arg.fatal) {
3912
- status.abort();
3913
- } else {
3914
- status.dirty();
3915
- }
3916
- },
3917
- get path() {
3918
- return ctx.path;
3919
- }
3920
- };
3921
- checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3922
3853
  if (effect.type === "preprocess") {
3923
- const processed = effect.transform(ctx.data, checkCtx);
3854
+ const processed = effect.transform(ctx.data);
3924
3855
  if (ctx.common.async) {
3925
- return Promise.resolve(processed).then(async (processed2) => {
3926
- if (status.value === "aborted")
3927
- return INVALID;
3928
- const result = await this._def.schema._parseAsync({
3856
+ return Promise.resolve(processed).then((processed2) => {
3857
+ return this._def.schema._parseAsync({
3929
3858
  data: processed2,
3930
3859
  path: ctx.path,
3931
3860
  parent: ctx
3932
3861
  });
3933
- if (result.status === "aborted")
3934
- return INVALID;
3935
- if (result.status === "dirty")
3936
- return DIRTY(result.value);
3937
- if (status.value === "dirty")
3938
- return DIRTY(result.value);
3939
- return result;
3940
3862
  });
3941
3863
  } else {
3942
- if (status.value === "aborted")
3943
- return INVALID;
3944
- const result = this._def.schema._parseSync({
3864
+ return this._def.schema._parseSync({
3945
3865
  data: processed,
3946
3866
  path: ctx.path,
3947
3867
  parent: ctx
3948
3868
  });
3949
- if (result.status === "aborted")
3950
- return INVALID;
3951
- if (result.status === "dirty")
3952
- return DIRTY(result.value);
3953
- if (status.value === "dirty")
3954
- return DIRTY(result.value);
3955
- return result;
3956
3869
  }
3957
3870
  }
3871
+ const checkCtx = {
3872
+ addIssue: (arg) => {
3873
+ addIssueToContext(ctx, arg);
3874
+ if (arg.fatal) {
3875
+ status.abort();
3876
+ } else {
3877
+ status.dirty();
3878
+ }
3879
+ },
3880
+ get path() {
3881
+ return ctx.path;
3882
+ }
3883
+ };
3884
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3958
3885
  if (effect.type === "refinement") {
3959
3886
  const executeRefinement = (acc) => {
3960
3887
  const result = effect.refinement(acc, checkCtx);
@@ -4097,45 +4024,26 @@ var init_lib = __esm({
4097
4024
  ZodCatch = class extends ZodType {
4098
4025
  _parse(input) {
4099
4026
  const { ctx } = this._processInputParams(input);
4100
- const newCtx = {
4101
- ...ctx,
4102
- common: {
4103
- ...ctx.common,
4104
- issues: []
4105
- }
4106
- };
4107
4027
  const result = this._def.innerType._parse({
4108
- data: newCtx.data,
4109
- path: newCtx.path,
4110
- parent: {
4111
- ...newCtx
4112
- }
4028
+ data: ctx.data,
4029
+ path: ctx.path,
4030
+ parent: ctx
4113
4031
  });
4114
4032
  if (isAsync(result)) {
4115
4033
  return result.then((result2) => {
4116
4034
  return {
4117
4035
  status: "valid",
4118
- value: result2.status === "valid" ? result2.value : this._def.catchValue({
4119
- get error() {
4120
- return new ZodError(newCtx.common.issues);
4121
- },
4122
- input: newCtx.data
4123
- })
4036
+ value: result2.status === "valid" ? result2.value : this._def.defaultValue()
4124
4037
  };
4125
4038
  });
4126
4039
  } else {
4127
4040
  return {
4128
4041
  status: "valid",
4129
- value: result.status === "valid" ? result.value : this._def.catchValue({
4130
- get error() {
4131
- return new ZodError(newCtx.common.issues);
4132
- },
4133
- input: newCtx.data
4134
- })
4042
+ value: result.status === "valid" ? result.value : this._def.defaultValue()
4135
4043
  };
4136
4044
  }
4137
4045
  }
4138
- removeCatch() {
4046
+ removeDefault() {
4139
4047
  return this._def.innerType;
4140
4048
  }
4141
4049
  };
@@ -4143,7 +4051,7 @@ var init_lib = __esm({
4143
4051
  return new ZodCatch({
4144
4052
  innerType: type,
4145
4053
  typeName: ZodFirstPartyTypeKind.ZodCatch,
4146
- catchValue: typeof params.catch === "function" ? params.catch : () => params.catch,
4054
+ defaultValue: typeof params.default === "function" ? params.default : () => params.default,
4147
4055
  ...processCreateParams(params)
4148
4056
  });
4149
4057
  };
@@ -4238,25 +4146,6 @@ var init_lib = __esm({
4238
4146
  });
4239
4147
  }
4240
4148
  };
4241
- ZodReadonly = class extends ZodType {
4242
- _parse(input) {
4243
- const result = this._def.innerType._parse(input);
4244
- if (isValid(result)) {
4245
- result.value = Object.freeze(result.value);
4246
- }
4247
- return result;
4248
- }
4249
- unwrap() {
4250
- return this._def.innerType;
4251
- }
4252
- };
4253
- ZodReadonly.create = (type, params) => {
4254
- return new ZodReadonly({
4255
- innerType: type,
4256
- typeName: ZodFirstPartyTypeKind.ZodReadonly,
4257
- ...processCreateParams(params)
4258
- });
4259
- };
4260
4149
  late = {
4261
4150
  object: ZodObject.lazycreate
4262
4151
  };
@@ -4296,7 +4185,6 @@ var init_lib = __esm({
4296
4185
  ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
4297
4186
  ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
4298
4187
  ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
4299
- ZodFirstPartyTypeKind2["ZodReadonly"] = "ZodReadonly";
4300
4188
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
4301
4189
  stringType = ZodString.create;
4302
4190
  numberType = ZodNumber.create;
@@ -4863,6 +4751,7 @@ var init_utils = __esm({
4863
4751
  init_mysqlSchema();
4864
4752
  init_pgSchema();
4865
4753
  init_sqliteSchema();
4754
+ init_source();
4866
4755
  init_global();
4867
4756
  }
4868
4757
  });
@@ -4872,6 +4761,7 @@ var import_hanji;
4872
4761
  var init_views = __esm({
4873
4762
  "src/cli/views.ts"() {
4874
4763
  "use strict";
4764
+ init_source();
4875
4765
  import_hanji = __toESM(require_hanji());
4876
4766
  init_utils();
4877
4767
  }
@@ -4882,6 +4772,7 @@ import * as glob from "glob";
4882
4772
  var init_serializer = __esm({
4883
4773
  "src/serializer/index.ts"() {
4884
4774
  "use strict";
4775
+ init_source();
4885
4776
  init_views();
4886
4777
  }
4887
4778
  });
@@ -4890,6 +4781,7 @@ var init_serializer = __esm({
4890
4781
  var init_outputs = __esm({
4891
4782
  "src/cli/validations/outputs.ts"() {
4892
4783
  "use strict";
4784
+ init_source();
4893
4785
  }
4894
4786
  });
4895
4787
 
@@ -4946,6 +4838,7 @@ var init_sqliteSerializer = __esm({
4946
4838
  "use strict";
4947
4839
  init_serializer();
4948
4840
  init_outputs();
4841
+ init_source();
4949
4842
  dialect3 = new SQLiteSyncDialect();
4950
4843
  fromDatabase = async (db, tablesFilter = (table4) => true, progressCallback) => {
4951
4844
  const result = {};
@@ -5368,6 +5261,7 @@ var init_pgSerializer = __esm({
5368
5261
  "src/serializer/pgSerializer.ts"() {
5369
5262
  "use strict";
5370
5263
  init_serializer();
5264
+ init_source();
5371
5265
  init_outputs();
5372
5266
  dialect4 = new PgDialect();
5373
5267
  trimChar = (str, char) => {
@@ -6082,10 +5976,10 @@ Array.prototype.random = function() {
6082
5976
  return this[~~(Math.random() * this.length)];
6083
5977
  };
6084
5978
 
6085
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/index.js
5979
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/index.js
6086
5980
  var import_brace_expansion = __toESM(require_brace_expansion(), 1);
6087
5981
 
6088
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/brace-expressions.js
5982
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/brace-expressions.js
6089
5983
  var posixClasses = {
6090
5984
  "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
6091
5985
  "[:alpha:]": ["\\p{L}\\p{Nl}", true],
@@ -6195,17 +6089,17 @@ var parseClass = (glob2, position) => {
6195
6089
  return [comb, uflag, endPos - pos, true];
6196
6090
  };
6197
6091
 
6198
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/escape.js
6092
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/escape.js
6199
6093
  var escape = (s, { windowsPathsNoEscape = false } = {}) => {
6200
6094
  return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
6201
6095
  };
6202
6096
 
6203
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/unescape.js
6097
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/unescape.js
6204
6098
  var unescape = (s, { windowsPathsNoEscape = false } = {}) => {
6205
6099
  return windowsPathsNoEscape ? s.replace(/\[([^\/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
6206
6100
  };
6207
6101
 
6208
- // node_modules/.pnpm/minimatch@7.4.6/node_modules/minimatch/dist/mjs/index.js
6102
+ // node_modules/.pnpm/minimatch@7.4.3/node_modules/minimatch/dist/mjs/index.js
6209
6103
  var minimatch = (p, pattern, options = {}) => {
6210
6104
  assertValidPattern(pattern);
6211
6105
  if (!options.nocomment && pattern.charAt(0) === "#") {