lkd-web-kit 0.4.8 → 0.4.10

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 (138) hide show
  1. package/dist/components/MyDateInput/index.cjs +19 -0
  2. package/dist/components/MyDateInput/index.js +15 -0
  3. package/dist/form/base/FormDateInput.cjs +17 -0
  4. package/dist/form/base/FormDateInput.js +13 -0
  5. package/dist/hooks/useZodConfig.cjs +2 -2
  6. package/dist/hooks/useZodConfig.js +2 -2
  7. package/dist/index.cjs +11 -7
  8. package/dist/index.d.ts +14 -4
  9. package/dist/index.js +2 -0
  10. package/package.json +8 -8
  11. package/dist/node_modules/zod/v4/classic/coerce.cjs +0 -28
  12. package/dist/node_modules/zod/v4/classic/coerce.js +0 -20
  13. package/dist/node_modules/zod/v4/classic/compat.cjs +0 -37
  14. package/dist/node_modules/zod/v4/classic/compat.js +0 -30
  15. package/dist/node_modules/zod/v4/classic/errors.cjs +0 -49
  16. package/dist/node_modules/zod/v4/classic/errors.js +0 -44
  17. package/dist/node_modules/zod/v4/classic/external.cjs +0 -231
  18. package/dist/node_modules/zod/v4/classic/external.js +0 -28
  19. package/dist/node_modules/zod/v4/classic/index.cjs +0 -10
  20. package/dist/node_modules/zod/v4/classic/index.js +0 -5
  21. package/dist/node_modules/zod/v4/classic/iso.cjs +0 -46
  22. package/dist/node_modules/zod/v4/classic/iso.js +0 -35
  23. package/dist/node_modules/zod/v4/classic/parse.cjs +0 -16
  24. package/dist/node_modules/zod/v4/classic/parse.js +0 -9
  25. package/dist/node_modules/zod/v4/classic/schemas.cjs +0 -1155
  26. package/dist/node_modules/zod/v4/classic/schemas.js +0 -1006
  27. package/dist/node_modules/zod/v4/core/api.cjs +0 -1016
  28. package/dist/node_modules/zod/v4/core/api.js +0 -903
  29. package/dist/node_modules/zod/v4/core/checks.cjs +0 -587
  30. package/dist/node_modules/zod/v4/core/checks.js +0 -562
  31. package/dist/node_modules/zod/v4/core/core.cjs +0 -72
  32. package/dist/node_modules/zod/v4/core/core.js +0 -63
  33. package/dist/node_modules/zod/v4/core/doc.cjs +0 -41
  34. package/dist/node_modules/zod/v4/core/doc.js +0 -37
  35. package/dist/node_modules/zod/v4/core/errors.cjs +0 -204
  36. package/dist/node_modules/zod/v4/core/errors.js +0 -194
  37. package/dist/node_modules/zod/v4/core/function.cjs +0 -81
  38. package/dist/node_modules/zod/v4/core/function.js +0 -76
  39. package/dist/node_modules/zod/v4/core/index.cjs +0 -261
  40. package/dist/node_modules/zod/v4/core/index.js +0 -20
  41. package/dist/node_modules/zod/v4/core/json-schema.cjs +0 -2
  42. package/dist/node_modules/zod/v4/core/json-schema.js +0 -1
  43. package/dist/node_modules/zod/v4/core/parse.cjs +0 -71
  44. package/dist/node_modules/zod/v4/core/parse.js +0 -60
  45. package/dist/node_modules/zod/v4/core/regexes.cjs +0 -139
  46. package/dist/node_modules/zod/v4/core/regexes.js +0 -95
  47. package/dist/node_modules/zod/v4/core/registries.cjs +0 -52
  48. package/dist/node_modules/zod/v4/core/registries.js +0 -44
  49. package/dist/node_modules/zod/v4/core/schemas.cjs +0 -1793
  50. package/dist/node_modules/zod/v4/core/schemas.js +0 -1720
  51. package/dist/node_modules/zod/v4/core/to-json-schema.cjs +0 -823
  52. package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -818
  53. package/dist/node_modules/zod/v4/core/util.cjs +0 -543
  54. package/dist/node_modules/zod/v4/core/util.js +0 -491
  55. package/dist/node_modules/zod/v4/core/versions.cjs +0 -11
  56. package/dist/node_modules/zod/v4/core/versions.js +0 -7
  57. package/dist/node_modules/zod/v4/index.cjs +0 -10
  58. package/dist/node_modules/zod/v4/index.js +0 -5
  59. package/dist/node_modules/zod/v4/locales/ar.cjs +0 -121
  60. package/dist/node_modules/zod/v4/locales/ar.js +0 -119
  61. package/dist/node_modules/zod/v4/locales/az.cjs +0 -120
  62. package/dist/node_modules/zod/v4/locales/az.js +0 -118
  63. package/dist/node_modules/zod/v4/locales/be.cjs +0 -169
  64. package/dist/node_modules/zod/v4/locales/be.js +0 -167
  65. package/dist/node_modules/zod/v4/locales/ca.cjs +0 -123
  66. package/dist/node_modules/zod/v4/locales/ca.js +0 -121
  67. package/dist/node_modules/zod/v4/locales/cs.cjs +0 -140
  68. package/dist/node_modules/zod/v4/locales/cs.js +0 -138
  69. package/dist/node_modules/zod/v4/locales/de.cjs +0 -121
  70. package/dist/node_modules/zod/v4/locales/de.js +0 -119
  71. package/dist/node_modules/zod/v4/locales/en.cjs +0 -125
  72. package/dist/node_modules/zod/v4/locales/en.js +0 -120
  73. package/dist/node_modules/zod/v4/locales/eo.cjs +0 -124
  74. package/dist/node_modules/zod/v4/locales/eo.js +0 -119
  75. package/dist/node_modules/zod/v4/locales/es.cjs +0 -122
  76. package/dist/node_modules/zod/v4/locales/es.js +0 -120
  77. package/dist/node_modules/zod/v4/locales/fa.cjs +0 -127
  78. package/dist/node_modules/zod/v4/locales/fa.js +0 -125
  79. package/dist/node_modules/zod/v4/locales/fi.cjs +0 -127
  80. package/dist/node_modules/zod/v4/locales/fi.js +0 -125
  81. package/dist/node_modules/zod/v4/locales/fr-CA.cjs +0 -122
  82. package/dist/node_modules/zod/v4/locales/fr-CA.js +0 -120
  83. package/dist/node_modules/zod/v4/locales/fr.cjs +0 -121
  84. package/dist/node_modules/zod/v4/locales/fr.js +0 -119
  85. package/dist/node_modules/zod/v4/locales/he.cjs +0 -122
  86. package/dist/node_modules/zod/v4/locales/he.js +0 -120
  87. package/dist/node_modules/zod/v4/locales/hu.cjs +0 -122
  88. package/dist/node_modules/zod/v4/locales/hu.js +0 -120
  89. package/dist/node_modules/zod/v4/locales/id.cjs +0 -121
  90. package/dist/node_modules/zod/v4/locales/id.js +0 -119
  91. package/dist/node_modules/zod/v4/locales/index.cjs +0 -85
  92. package/dist/node_modules/zod/v4/locales/index.js +0 -39
  93. package/dist/node_modules/zod/v4/locales/it.cjs +0 -122
  94. package/dist/node_modules/zod/v4/locales/it.js +0 -120
  95. package/dist/node_modules/zod/v4/locales/ja.cjs +0 -120
  96. package/dist/node_modules/zod/v4/locales/ja.js +0 -118
  97. package/dist/node_modules/zod/v4/locales/kh.cjs +0 -122
  98. package/dist/node_modules/zod/v4/locales/kh.js +0 -120
  99. package/dist/node_modules/zod/v4/locales/ko.cjs +0 -126
  100. package/dist/node_modules/zod/v4/locales/ko.js +0 -124
  101. package/dist/node_modules/zod/v4/locales/mk.cjs +0 -123
  102. package/dist/node_modules/zod/v4/locales/mk.js +0 -121
  103. package/dist/node_modules/zod/v4/locales/ms.cjs +0 -121
  104. package/dist/node_modules/zod/v4/locales/ms.js +0 -119
  105. package/dist/node_modules/zod/v4/locales/nl.cjs +0 -122
  106. package/dist/node_modules/zod/v4/locales/nl.js +0 -120
  107. package/dist/node_modules/zod/v4/locales/no.cjs +0 -121
  108. package/dist/node_modules/zod/v4/locales/no.js +0 -119
  109. package/dist/node_modules/zod/v4/locales/ota.cjs +0 -122
  110. package/dist/node_modules/zod/v4/locales/ota.js +0 -120
  111. package/dist/node_modules/zod/v4/locales/pl.cjs +0 -122
  112. package/dist/node_modules/zod/v4/locales/pl.js +0 -120
  113. package/dist/node_modules/zod/v4/locales/ps.cjs +0 -127
  114. package/dist/node_modules/zod/v4/locales/ps.js +0 -125
  115. package/dist/node_modules/zod/v4/locales/pt.cjs +0 -121
  116. package/dist/node_modules/zod/v4/locales/pt.js +0 -119
  117. package/dist/node_modules/zod/v4/locales/ru.cjs +0 -169
  118. package/dist/node_modules/zod/v4/locales/ru.js +0 -167
  119. package/dist/node_modules/zod/v4/locales/sl.cjs +0 -122
  120. package/dist/node_modules/zod/v4/locales/sl.js +0 -120
  121. package/dist/node_modules/zod/v4/locales/sv.cjs +0 -123
  122. package/dist/node_modules/zod/v4/locales/sv.js +0 -121
  123. package/dist/node_modules/zod/v4/locales/ta.cjs +0 -122
  124. package/dist/node_modules/zod/v4/locales/ta.js +0 -120
  125. package/dist/node_modules/zod/v4/locales/th.cjs +0 -122
  126. package/dist/node_modules/zod/v4/locales/th.js +0 -120
  127. package/dist/node_modules/zod/v4/locales/tr.cjs +0 -123
  128. package/dist/node_modules/zod/v4/locales/tr.js +0 -118
  129. package/dist/node_modules/zod/v4/locales/ua.cjs +0 -122
  130. package/dist/node_modules/zod/v4/locales/ua.js +0 -120
  131. package/dist/node_modules/zod/v4/locales/ur.cjs +0 -122
  132. package/dist/node_modules/zod/v4/locales/ur.js +0 -120
  133. package/dist/node_modules/zod/v4/locales/vi.cjs +0 -121
  134. package/dist/node_modules/zod/v4/locales/vi.js +0 -119
  135. package/dist/node_modules/zod/v4/locales/zh-CN.cjs +0 -121
  136. package/dist/node_modules/zod/v4/locales/zh-CN.js +0 -119
  137. package/dist/node_modules/zod/v4/locales/zh-TW.cjs +0 -122
  138. package/dist/node_modules/zod/v4/locales/zh-TW.js +0 -120
@@ -1,1155 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const iso = require('./iso.cjs');
6
- const parse = require('./parse.cjs');
7
- const core = require('../core/core.cjs');
8
- const api = require('../core/api.cjs');
9
- const util = require('../core/util.cjs');
10
- const checks = require('../core/checks.cjs');
11
- const schemas = require('../core/schemas.cjs');
12
- const registries = require('../core/registries.cjs');
13
-
14
- const ZodType = /*@__PURE__*/ core.$constructor("ZodType", (inst, def) => {
15
- schemas.$ZodType.init(inst, def);
16
- inst.def = def;
17
- Object.defineProperty(inst, "_def", { value: def });
18
- // base methods
19
- inst.check = (...checks) => {
20
- return inst.clone({
21
- ...def,
22
- checks: [
23
- ...(def.checks ?? []),
24
- ...checks.map((ch) => typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch),
25
- ],
26
- }
27
- // { parent: true }
28
- );
29
- };
30
- inst.clone = (def, params) => util.clone(inst, def, params);
31
- inst.brand = () => inst;
32
- inst.register = ((reg, meta) => {
33
- reg.add(inst, meta);
34
- return inst;
35
- });
36
- // parsing
37
- inst.parse = (data, params) => parse.parse(inst, data, params, { callee: inst.parse });
38
- inst.safeParse = (data, params) => parse.safeParse(inst, data, params);
39
- inst.parseAsync = async (data, params) => parse.parseAsync(inst, data, params, { callee: inst.parseAsync });
40
- inst.safeParseAsync = async (data, params) => parse.safeParseAsync(inst, data, params);
41
- inst.spa = inst.safeParseAsync;
42
- // refinements
43
- inst.refine = (check, params) => inst.check(refine(check, params));
44
- inst.superRefine = (refinement) => inst.check(superRefine(refinement));
45
- inst.overwrite = (fn) => inst.check(api._overwrite(fn));
46
- // wrappers
47
- inst.optional = () => optional(inst);
48
- inst.nullable = () => nullable(inst);
49
- inst.nullish = () => optional(nullable(inst));
50
- inst.nonoptional = (params) => nonoptional(inst, params);
51
- inst.array = () => array(inst);
52
- inst.or = (arg) => union([inst, arg]);
53
- inst.and = (arg) => intersection(inst, arg);
54
- inst.transform = (tx) => pipe(inst, transform(tx));
55
- inst.default = (def) => _default(inst, def);
56
- inst.prefault = (def) => prefault(inst, def);
57
- // inst.coalesce = (def, params) => coalesce(inst, def, params);
58
- inst.catch = (params) => _catch(inst, params);
59
- inst.pipe = (target) => pipe(inst, target);
60
- inst.readonly = () => readonly(inst);
61
- // meta
62
- inst.describe = (description) => {
63
- const cl = inst.clone();
64
- registries.globalRegistry.add(cl, { description });
65
- return cl;
66
- };
67
- Object.defineProperty(inst, "description", {
68
- get() {
69
- return registries.globalRegistry.get(inst)?.description;
70
- },
71
- configurable: true,
72
- });
73
- inst.meta = (...args) => {
74
- if (args.length === 0) {
75
- return registries.globalRegistry.get(inst);
76
- }
77
- const cl = inst.clone();
78
- registries.globalRegistry.add(cl, args[0]);
79
- return cl;
80
- };
81
- // helpers
82
- inst.isOptional = () => inst.safeParse(undefined).success;
83
- inst.isNullable = () => inst.safeParse(null).success;
84
- return inst;
85
- });
86
- /** @internal */
87
- const _ZodString = /*@__PURE__*/ core.$constructor("_ZodString", (inst, def) => {
88
- schemas.$ZodString.init(inst, def);
89
- ZodType.init(inst, def);
90
- const bag = inst._zod.bag;
91
- inst.format = bag.format ?? null;
92
- inst.minLength = bag.minimum ?? null;
93
- inst.maxLength = bag.maximum ?? null;
94
- // validations
95
- inst.regex = (...args) => inst.check(api._regex(...args));
96
- inst.includes = (...args) => inst.check(api._includes(...args));
97
- inst.startsWith = (...args) => inst.check(api._startsWith(...args));
98
- inst.endsWith = (...args) => inst.check(api._endsWith(...args));
99
- inst.min = (...args) => inst.check(api._minLength(...args));
100
- inst.max = (...args) => inst.check(api._maxLength(...args));
101
- inst.length = (...args) => inst.check(api._length(...args));
102
- inst.nonempty = (...args) => inst.check(api._minLength(1, ...args));
103
- inst.lowercase = (params) => inst.check(api._lowercase(params));
104
- inst.uppercase = (params) => inst.check(api._uppercase(params));
105
- // transforms
106
- inst.trim = () => inst.check(api._trim());
107
- inst.normalize = (...args) => inst.check(api._normalize(...args));
108
- inst.toLowerCase = () => inst.check(api._toLowerCase());
109
- inst.toUpperCase = () => inst.check(api._toUpperCase());
110
- });
111
- const ZodString = /*@__PURE__*/ core.$constructor("ZodString", (inst, def) => {
112
- schemas.$ZodString.init(inst, def);
113
- _ZodString.init(inst, def);
114
- inst.email = (params) => inst.check(api._email(ZodEmail, params));
115
- inst.url = (params) => inst.check(api._url(ZodURL, params));
116
- inst.jwt = (params) => inst.check(api._jwt(ZodJWT, params));
117
- inst.emoji = (params) => inst.check(api._emoji(ZodEmoji, params));
118
- inst.guid = (params) => inst.check(api._guid(ZodGUID, params));
119
- inst.uuid = (params) => inst.check(api._uuid(ZodUUID, params));
120
- inst.uuidv4 = (params) => inst.check(api._uuidv4(ZodUUID, params));
121
- inst.uuidv6 = (params) => inst.check(api._uuidv6(ZodUUID, params));
122
- inst.uuidv7 = (params) => inst.check(api._uuidv7(ZodUUID, params));
123
- inst.nanoid = (params) => inst.check(api._nanoid(ZodNanoID, params));
124
- inst.guid = (params) => inst.check(api._guid(ZodGUID, params));
125
- inst.cuid = (params) => inst.check(api._cuid(ZodCUID, params));
126
- inst.cuid2 = (params) => inst.check(api._cuid2(ZodCUID2, params));
127
- inst.ulid = (params) => inst.check(api._ulid(ZodULID, params));
128
- inst.base64 = (params) => inst.check(api._base64(ZodBase64, params));
129
- inst.base64url = (params) => inst.check(api._base64url(ZodBase64URL, params));
130
- inst.xid = (params) => inst.check(api._xid(ZodXID, params));
131
- inst.ksuid = (params) => inst.check(api._ksuid(ZodKSUID, params));
132
- inst.ipv4 = (params) => inst.check(api._ipv4(ZodIPv4, params));
133
- inst.ipv6 = (params) => inst.check(api._ipv6(ZodIPv6, params));
134
- inst.cidrv4 = (params) => inst.check(api._cidrv4(ZodCIDRv4, params));
135
- inst.cidrv6 = (params) => inst.check(api._cidrv6(ZodCIDRv6, params));
136
- inst.e164 = (params) => inst.check(api._e164(ZodE164, params));
137
- // iso
138
- inst.datetime = (params) => inst.check(iso.datetime(params));
139
- inst.date = (params) => inst.check(iso.date(params));
140
- inst.time = (params) => inst.check(iso.time(params));
141
- inst.duration = (params) => inst.check(iso.duration(params));
142
- });
143
- function string(params) {
144
- return api._string(ZodString, params);
145
- }
146
- const ZodStringFormat = /*@__PURE__*/ core.$constructor("ZodStringFormat", (inst, def) => {
147
- schemas.$ZodStringFormat.init(inst, def);
148
- _ZodString.init(inst, def);
149
- });
150
- const ZodEmail = /*@__PURE__*/ core.$constructor("ZodEmail", (inst, def) => {
151
- // ZodStringFormat.init(inst, def);
152
- schemas.$ZodEmail.init(inst, def);
153
- ZodStringFormat.init(inst, def);
154
- });
155
- function email(params) {
156
- return api._email(ZodEmail, params);
157
- }
158
- const ZodGUID = /*@__PURE__*/ core.$constructor("ZodGUID", (inst, def) => {
159
- // ZodStringFormat.init(inst, def);
160
- schemas.$ZodGUID.init(inst, def);
161
- ZodStringFormat.init(inst, def);
162
- });
163
- function guid(params) {
164
- return api._guid(ZodGUID, params);
165
- }
166
- const ZodUUID = /*@__PURE__*/ core.$constructor("ZodUUID", (inst, def) => {
167
- // ZodStringFormat.init(inst, def);
168
- schemas.$ZodUUID.init(inst, def);
169
- ZodStringFormat.init(inst, def);
170
- });
171
- function uuid(params) {
172
- return api._uuid(ZodUUID, params);
173
- }
174
- function uuidv4(params) {
175
- return api._uuidv4(ZodUUID, params);
176
- }
177
- // ZodUUIDv6
178
- function uuidv6(params) {
179
- return api._uuidv6(ZodUUID, params);
180
- }
181
- // ZodUUIDv7
182
- function uuidv7(params) {
183
- return api._uuidv7(ZodUUID, params);
184
- }
185
- const ZodURL = /*@__PURE__*/ core.$constructor("ZodURL", (inst, def) => {
186
- // ZodStringFormat.init(inst, def);
187
- schemas.$ZodURL.init(inst, def);
188
- ZodStringFormat.init(inst, def);
189
- });
190
- function url(params) {
191
- return api._url(ZodURL, params);
192
- }
193
- const ZodEmoji = /*@__PURE__*/ core.$constructor("ZodEmoji", (inst, def) => {
194
- // ZodStringFormat.init(inst, def);
195
- schemas.$ZodEmoji.init(inst, def);
196
- ZodStringFormat.init(inst, def);
197
- });
198
- function emoji(params) {
199
- return api._emoji(ZodEmoji, params);
200
- }
201
- const ZodNanoID = /*@__PURE__*/ core.$constructor("ZodNanoID", (inst, def) => {
202
- // ZodStringFormat.init(inst, def);
203
- schemas.$ZodNanoID.init(inst, def);
204
- ZodStringFormat.init(inst, def);
205
- });
206
- function nanoid(params) {
207
- return api._nanoid(ZodNanoID, params);
208
- }
209
- const ZodCUID = /*@__PURE__*/ core.$constructor("ZodCUID", (inst, def) => {
210
- // ZodStringFormat.init(inst, def);
211
- schemas.$ZodCUID.init(inst, def);
212
- ZodStringFormat.init(inst, def);
213
- });
214
- function cuid(params) {
215
- return api._cuid(ZodCUID, params);
216
- }
217
- const ZodCUID2 = /*@__PURE__*/ core.$constructor("ZodCUID2", (inst, def) => {
218
- // ZodStringFormat.init(inst, def);
219
- schemas.$ZodCUID2.init(inst, def);
220
- ZodStringFormat.init(inst, def);
221
- });
222
- function cuid2(params) {
223
- return api._cuid2(ZodCUID2, params);
224
- }
225
- const ZodULID = /*@__PURE__*/ core.$constructor("ZodULID", (inst, def) => {
226
- // ZodStringFormat.init(inst, def);
227
- schemas.$ZodULID.init(inst, def);
228
- ZodStringFormat.init(inst, def);
229
- });
230
- function ulid(params) {
231
- return api._ulid(ZodULID, params);
232
- }
233
- const ZodXID = /*@__PURE__*/ core.$constructor("ZodXID", (inst, def) => {
234
- // ZodStringFormat.init(inst, def);
235
- schemas.$ZodXID.init(inst, def);
236
- ZodStringFormat.init(inst, def);
237
- });
238
- function xid(params) {
239
- return api._xid(ZodXID, params);
240
- }
241
- const ZodKSUID = /*@__PURE__*/ core.$constructor("ZodKSUID", (inst, def) => {
242
- // ZodStringFormat.init(inst, def);
243
- schemas.$ZodKSUID.init(inst, def);
244
- ZodStringFormat.init(inst, def);
245
- });
246
- function ksuid(params) {
247
- return api._ksuid(ZodKSUID, params);
248
- }
249
- const ZodIPv4 = /*@__PURE__*/ core.$constructor("ZodIPv4", (inst, def) => {
250
- // ZodStringFormat.init(inst, def);
251
- schemas.$ZodIPv4.init(inst, def);
252
- ZodStringFormat.init(inst, def);
253
- });
254
- function ipv4(params) {
255
- return api._ipv4(ZodIPv4, params);
256
- }
257
- const ZodIPv6 = /*@__PURE__*/ core.$constructor("ZodIPv6", (inst, def) => {
258
- // ZodStringFormat.init(inst, def);
259
- schemas.$ZodIPv6.init(inst, def);
260
- ZodStringFormat.init(inst, def);
261
- });
262
- function ipv6(params) {
263
- return api._ipv6(ZodIPv6, params);
264
- }
265
- const ZodCIDRv4 = /*@__PURE__*/ core.$constructor("ZodCIDRv4", (inst, def) => {
266
- schemas.$ZodCIDRv4.init(inst, def);
267
- ZodStringFormat.init(inst, def);
268
- });
269
- function cidrv4(params) {
270
- return api._cidrv4(ZodCIDRv4, params);
271
- }
272
- const ZodCIDRv6 = /*@__PURE__*/ core.$constructor("ZodCIDRv6", (inst, def) => {
273
- schemas.$ZodCIDRv6.init(inst, def);
274
- ZodStringFormat.init(inst, def);
275
- });
276
- function cidrv6(params) {
277
- return api._cidrv6(ZodCIDRv6, params);
278
- }
279
- const ZodBase64 = /*@__PURE__*/ core.$constructor("ZodBase64", (inst, def) => {
280
- // ZodStringFormat.init(inst, def);
281
- schemas.$ZodBase64.init(inst, def);
282
- ZodStringFormat.init(inst, def);
283
- });
284
- function base64(params) {
285
- return api._base64(ZodBase64, params);
286
- }
287
- const ZodBase64URL = /*@__PURE__*/ core.$constructor("ZodBase64URL", (inst, def) => {
288
- // ZodStringFormat.init(inst, def);
289
- schemas.$ZodBase64URL.init(inst, def);
290
- ZodStringFormat.init(inst, def);
291
- });
292
- function base64url(params) {
293
- return api._base64url(ZodBase64URL, params);
294
- }
295
- const ZodE164 = /*@__PURE__*/ core.$constructor("ZodE164", (inst, def) => {
296
- // ZodStringFormat.init(inst, def);
297
- schemas.$ZodE164.init(inst, def);
298
- ZodStringFormat.init(inst, def);
299
- });
300
- function e164(params) {
301
- return api._e164(ZodE164, params);
302
- }
303
- const ZodJWT = /*@__PURE__*/ core.$constructor("ZodJWT", (inst, def) => {
304
- // ZodStringFormat.init(inst, def);
305
- schemas.$ZodJWT.init(inst, def);
306
- ZodStringFormat.init(inst, def);
307
- });
308
- function jwt(params) {
309
- return api._jwt(ZodJWT, params);
310
- }
311
- const ZodCustomStringFormat = /*@__PURE__*/ core.$constructor("ZodCustomStringFormat", (inst, def) => {
312
- // ZodStringFormat.init(inst, def);
313
- schemas.$ZodCustomStringFormat.init(inst, def);
314
- ZodStringFormat.init(inst, def);
315
- });
316
- function stringFormat(format, fnOrRegex, _params = {}) {
317
- return api._stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
318
- }
319
- const ZodNumber = /*@__PURE__*/ core.$constructor("ZodNumber", (inst, def) => {
320
- schemas.$ZodNumber.init(inst, def);
321
- ZodType.init(inst, def);
322
- inst.gt = (value, params) => inst.check(api._gt(value, params));
323
- inst.gte = (value, params) => inst.check(api._gte(value, params));
324
- inst.min = (value, params) => inst.check(api._gte(value, params));
325
- inst.lt = (value, params) => inst.check(api._lt(value, params));
326
- inst.lte = (value, params) => inst.check(api._lte(value, params));
327
- inst.max = (value, params) => inst.check(api._lte(value, params));
328
- inst.int = (params) => inst.check(int(params));
329
- inst.safe = (params) => inst.check(int(params));
330
- inst.positive = (params) => inst.check(api._gt(0, params));
331
- inst.nonnegative = (params) => inst.check(api._gte(0, params));
332
- inst.negative = (params) => inst.check(api._lt(0, params));
333
- inst.nonpositive = (params) => inst.check(api._lte(0, params));
334
- inst.multipleOf = (value, params) => inst.check(api._multipleOf(value, params));
335
- inst.step = (value, params) => inst.check(api._multipleOf(value, params));
336
- // inst.finite = (params) => inst.check(core.finite(params));
337
- inst.finite = () => inst;
338
- const bag = inst._zod.bag;
339
- inst.minValue =
340
- Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
341
- inst.maxValue =
342
- Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
343
- inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
344
- inst.isFinite = true;
345
- inst.format = bag.format ?? null;
346
- });
347
- function number(params) {
348
- return api._number(ZodNumber, params);
349
- }
350
- const ZodNumberFormat = /*@__PURE__*/ core.$constructor("ZodNumberFormat", (inst, def) => {
351
- schemas.$ZodNumberFormat.init(inst, def);
352
- ZodNumber.init(inst, def);
353
- });
354
- function int(params) {
355
- return api._int(ZodNumberFormat, params);
356
- }
357
- function float32(params) {
358
- return api._float32(ZodNumberFormat, params);
359
- }
360
- function float64(params) {
361
- return api._float64(ZodNumberFormat, params);
362
- }
363
- function int32(params) {
364
- return api._int32(ZodNumberFormat, params);
365
- }
366
- function uint32(params) {
367
- return api._uint32(ZodNumberFormat, params);
368
- }
369
- const ZodBoolean = /*@__PURE__*/ core.$constructor("ZodBoolean", (inst, def) => {
370
- schemas.$ZodBoolean.init(inst, def);
371
- ZodType.init(inst, def);
372
- });
373
- function boolean(params) {
374
- return api._boolean(ZodBoolean, params);
375
- }
376
- const ZodBigInt = /*@__PURE__*/ core.$constructor("ZodBigInt", (inst, def) => {
377
- schemas.$ZodBigInt.init(inst, def);
378
- ZodType.init(inst, def);
379
- inst.gte = (value, params) => inst.check(api._gte(value, params));
380
- inst.min = (value, params) => inst.check(api._gte(value, params));
381
- inst.gt = (value, params) => inst.check(api._gt(value, params));
382
- inst.gte = (value, params) => inst.check(api._gte(value, params));
383
- inst.min = (value, params) => inst.check(api._gte(value, params));
384
- inst.lt = (value, params) => inst.check(api._lt(value, params));
385
- inst.lte = (value, params) => inst.check(api._lte(value, params));
386
- inst.max = (value, params) => inst.check(api._lte(value, params));
387
- inst.positive = (params) => inst.check(api._gt(BigInt(0), params));
388
- inst.negative = (params) => inst.check(api._lt(BigInt(0), params));
389
- inst.nonpositive = (params) => inst.check(api._lte(BigInt(0), params));
390
- inst.nonnegative = (params) => inst.check(api._gte(BigInt(0), params));
391
- inst.multipleOf = (value, params) => inst.check(api._multipleOf(value, params));
392
- const bag = inst._zod.bag;
393
- inst.minValue = bag.minimum ?? null;
394
- inst.maxValue = bag.maximum ?? null;
395
- inst.format = bag.format ?? null;
396
- });
397
- function bigint(params) {
398
- return api._bigint(ZodBigInt, params);
399
- }
400
- const ZodBigIntFormat = /*@__PURE__*/ core.$constructor("ZodBigIntFormat", (inst, def) => {
401
- schemas.$ZodBigIntFormat.init(inst, def);
402
- ZodBigInt.init(inst, def);
403
- });
404
- // int64
405
- function int64(params) {
406
- return api._int64(ZodBigIntFormat, params);
407
- }
408
- // uint64
409
- function uint64(params) {
410
- return api._uint64(ZodBigIntFormat, params);
411
- }
412
- const ZodSymbol = /*@__PURE__*/ core.$constructor("ZodSymbol", (inst, def) => {
413
- schemas.$ZodSymbol.init(inst, def);
414
- ZodType.init(inst, def);
415
- });
416
- function symbol(params) {
417
- return api._symbol(ZodSymbol, params);
418
- }
419
- const ZodUndefined = /*@__PURE__*/ core.$constructor("ZodUndefined", (inst, def) => {
420
- schemas.$ZodUndefined.init(inst, def);
421
- ZodType.init(inst, def);
422
- });
423
- function _undefined(params) {
424
- return api._undefined(ZodUndefined, params);
425
- }
426
- const ZodNull = /*@__PURE__*/ core.$constructor("ZodNull", (inst, def) => {
427
- schemas.$ZodNull.init(inst, def);
428
- ZodType.init(inst, def);
429
- });
430
- function _null(params) {
431
- return api._null(ZodNull, params);
432
- }
433
- const ZodAny = /*@__PURE__*/ core.$constructor("ZodAny", (inst, def) => {
434
- schemas.$ZodAny.init(inst, def);
435
- ZodType.init(inst, def);
436
- });
437
- function any() {
438
- return api._any(ZodAny);
439
- }
440
- const ZodUnknown = /*@__PURE__*/ core.$constructor("ZodUnknown", (inst, def) => {
441
- schemas.$ZodUnknown.init(inst, def);
442
- ZodType.init(inst, def);
443
- });
444
- function unknown() {
445
- return api._unknown(ZodUnknown);
446
- }
447
- const ZodNever = /*@__PURE__*/ core.$constructor("ZodNever", (inst, def) => {
448
- schemas.$ZodNever.init(inst, def);
449
- ZodType.init(inst, def);
450
- });
451
- function never(params) {
452
- return api._never(ZodNever, params);
453
- }
454
- const ZodVoid = /*@__PURE__*/ core.$constructor("ZodVoid", (inst, def) => {
455
- schemas.$ZodVoid.init(inst, def);
456
- ZodType.init(inst, def);
457
- });
458
- function _void(params) {
459
- return api._void(ZodVoid, params);
460
- }
461
- const ZodDate = /*@__PURE__*/ core.$constructor("ZodDate", (inst, def) => {
462
- schemas.$ZodDate.init(inst, def);
463
- ZodType.init(inst, def);
464
- inst.min = (value, params) => inst.check(api._gte(value, params));
465
- inst.max = (value, params) => inst.check(api._lte(value, params));
466
- const c = inst._zod.bag;
467
- inst.minDate = c.minimum ? new Date(c.minimum) : null;
468
- inst.maxDate = c.maximum ? new Date(c.maximum) : null;
469
- });
470
- function date(params) {
471
- return api._date(ZodDate, params);
472
- }
473
- const ZodArray = /*@__PURE__*/ core.$constructor("ZodArray", (inst, def) => {
474
- schemas.$ZodArray.init(inst, def);
475
- ZodType.init(inst, def);
476
- inst.element = def.element;
477
- inst.min = (minLength, params) => inst.check(api._minLength(minLength, params));
478
- inst.nonempty = (params) => inst.check(api._minLength(1, params));
479
- inst.max = (maxLength, params) => inst.check(api._maxLength(maxLength, params));
480
- inst.length = (len, params) => inst.check(api._length(len, params));
481
- inst.unwrap = () => inst.element;
482
- });
483
- function array(element, params) {
484
- return api._array(ZodArray, element, params);
485
- }
486
- // .keyof
487
- function keyof(schema) {
488
- const shape = schema._zod.def.shape;
489
- return literal(Object.keys(shape));
490
- }
491
- const ZodObject = /*@__PURE__*/ core.$constructor("ZodObject", (inst, def) => {
492
- schemas.$ZodObject.init(inst, def);
493
- ZodType.init(inst, def);
494
- util.defineLazy(inst, "shape", () => def.shape);
495
- inst.keyof = () => _enum(Object.keys(inst._zod.def.shape));
496
- inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall: catchall });
497
- inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
498
- // inst.nonstrict = () => inst.clone({ ...inst._zod.def, catchall: api.unknown() });
499
- inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
500
- inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
501
- inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
502
- inst.extend = (incoming) => {
503
- return util.extend(inst, incoming);
504
- };
505
- inst.merge = (other) => util.merge(inst, other);
506
- inst.pick = (mask) => util.pick(inst, mask);
507
- inst.omit = (mask) => util.omit(inst, mask);
508
- inst.partial = (...args) => util.partial(ZodOptional, inst, args[0]);
509
- inst.required = (...args) => util.required(ZodNonOptional, inst, args[0]);
510
- });
511
- function object(shape, params) {
512
- const def = {
513
- type: "object",
514
- get shape() {
515
- util.assignProp(this, "shape", { ...shape });
516
- return this.shape;
517
- },
518
- ...util.normalizeParams(params),
519
- };
520
- return new ZodObject(def);
521
- }
522
- // strictObject
523
- function strictObject(shape, params) {
524
- return new ZodObject({
525
- type: "object",
526
- get shape() {
527
- util.assignProp(this, "shape", { ...shape });
528
- return this.shape;
529
- },
530
- catchall: never(),
531
- ...util.normalizeParams(params),
532
- });
533
- }
534
- // looseObject
535
- function looseObject(shape, params) {
536
- return new ZodObject({
537
- type: "object",
538
- get shape() {
539
- util.assignProp(this, "shape", { ...shape });
540
- return this.shape;
541
- },
542
- catchall: unknown(),
543
- ...util.normalizeParams(params),
544
- });
545
- }
546
- const ZodUnion = /*@__PURE__*/ core.$constructor("ZodUnion", (inst, def) => {
547
- schemas.$ZodUnion.init(inst, def);
548
- ZodType.init(inst, def);
549
- inst.options = def.options;
550
- });
551
- function union(options, params) {
552
- return new ZodUnion({
553
- type: "union",
554
- options: options,
555
- ...util.normalizeParams(params),
556
- });
557
- }
558
- const ZodDiscriminatedUnion = /*@__PURE__*/ core.$constructor("ZodDiscriminatedUnion", (inst, def) => {
559
- ZodUnion.init(inst, def);
560
- schemas.$ZodDiscriminatedUnion.init(inst, def);
561
- });
562
- function discriminatedUnion(discriminator, options, params) {
563
- // const [options, params] = args;
564
- return new ZodDiscriminatedUnion({
565
- type: "union",
566
- options,
567
- discriminator,
568
- ...util.normalizeParams(params),
569
- });
570
- }
571
- const ZodIntersection = /*@__PURE__*/ core.$constructor("ZodIntersection", (inst, def) => {
572
- schemas.$ZodIntersection.init(inst, def);
573
- ZodType.init(inst, def);
574
- });
575
- function intersection(left, right) {
576
- return new ZodIntersection({
577
- type: "intersection",
578
- left: left,
579
- right: right,
580
- });
581
- }
582
- const ZodTuple = /*@__PURE__*/ core.$constructor("ZodTuple", (inst, def) => {
583
- schemas.$ZodTuple.init(inst, def);
584
- ZodType.init(inst, def);
585
- inst.rest = (rest) => inst.clone({
586
- ...inst._zod.def,
587
- rest: rest,
588
- });
589
- });
590
- function tuple(items, _paramsOrRest, _params) {
591
- const hasRest = _paramsOrRest instanceof schemas.$ZodType;
592
- const params = hasRest ? _params : _paramsOrRest;
593
- const rest = hasRest ? _paramsOrRest : null;
594
- return new ZodTuple({
595
- type: "tuple",
596
- items: items,
597
- rest,
598
- ...util.normalizeParams(params),
599
- });
600
- }
601
- const ZodRecord = /*@__PURE__*/ core.$constructor("ZodRecord", (inst, def) => {
602
- schemas.$ZodRecord.init(inst, def);
603
- ZodType.init(inst, def);
604
- inst.keyType = def.keyType;
605
- inst.valueType = def.valueType;
606
- });
607
- function record(keyType, valueType, params) {
608
- return new ZodRecord({
609
- type: "record",
610
- keyType,
611
- valueType: valueType,
612
- ...util.normalizeParams(params),
613
- });
614
- }
615
- // type alksjf = core.output<core.$ZodRecordKey>;
616
- function partialRecord(keyType, valueType, params) {
617
- return new ZodRecord({
618
- type: "record",
619
- keyType: union([keyType, never()]),
620
- valueType: valueType,
621
- ...util.normalizeParams(params),
622
- });
623
- }
624
- const ZodMap = /*@__PURE__*/ core.$constructor("ZodMap", (inst, def) => {
625
- schemas.$ZodMap.init(inst, def);
626
- ZodType.init(inst, def);
627
- inst.keyType = def.keyType;
628
- inst.valueType = def.valueType;
629
- });
630
- function map(keyType, valueType, params) {
631
- return new ZodMap({
632
- type: "map",
633
- keyType: keyType,
634
- valueType: valueType,
635
- ...util.normalizeParams(params),
636
- });
637
- }
638
- const ZodSet = /*@__PURE__*/ core.$constructor("ZodSet", (inst, def) => {
639
- schemas.$ZodSet.init(inst, def);
640
- ZodType.init(inst, def);
641
- inst.min = (...args) => inst.check(api._minSize(...args));
642
- inst.nonempty = (params) => inst.check(api._minSize(1, params));
643
- inst.max = (...args) => inst.check(api._maxSize(...args));
644
- inst.size = (...args) => inst.check(api._size(...args));
645
- });
646
- function set(valueType, params) {
647
- return new ZodSet({
648
- type: "set",
649
- valueType: valueType,
650
- ...util.normalizeParams(params),
651
- });
652
- }
653
- const ZodEnum = /*@__PURE__*/ core.$constructor("ZodEnum", (inst, def) => {
654
- schemas.$ZodEnum.init(inst, def);
655
- ZodType.init(inst, def);
656
- inst.enum = def.entries;
657
- inst.options = Object.values(def.entries);
658
- const keys = new Set(Object.keys(def.entries));
659
- inst.extract = (values, params) => {
660
- const newEntries = {};
661
- for (const value of values) {
662
- if (keys.has(value)) {
663
- newEntries[value] = def.entries[value];
664
- }
665
- else
666
- throw new Error(`Key ${value} not found in enum`);
667
- }
668
- return new ZodEnum({
669
- ...def,
670
- checks: [],
671
- ...util.normalizeParams(params),
672
- entries: newEntries,
673
- });
674
- };
675
- inst.exclude = (values, params) => {
676
- const newEntries = { ...def.entries };
677
- for (const value of values) {
678
- if (keys.has(value)) {
679
- delete newEntries[value];
680
- }
681
- else
682
- throw new Error(`Key ${value} not found in enum`);
683
- }
684
- return new ZodEnum({
685
- ...def,
686
- checks: [],
687
- ...util.normalizeParams(params),
688
- entries: newEntries,
689
- });
690
- };
691
- });
692
- function _enum(values, params) {
693
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
694
- return new ZodEnum({
695
- type: "enum",
696
- entries,
697
- ...util.normalizeParams(params),
698
- });
699
- }
700
- /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
701
- *
702
- * ```ts
703
- * enum Colors { red, green, blue }
704
- * z.enum(Colors);
705
- * ```
706
- */
707
- function nativeEnum(entries, params) {
708
- return new ZodEnum({
709
- type: "enum",
710
- entries,
711
- ...util.normalizeParams(params),
712
- });
713
- }
714
- const ZodLiteral = /*@__PURE__*/ core.$constructor("ZodLiteral", (inst, def) => {
715
- schemas.$ZodLiteral.init(inst, def);
716
- ZodType.init(inst, def);
717
- inst.values = new Set(def.values);
718
- Object.defineProperty(inst, "value", {
719
- get() {
720
- if (def.values.length > 1) {
721
- throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
722
- }
723
- return def.values[0];
724
- },
725
- });
726
- });
727
- function literal(value, params) {
728
- return new ZodLiteral({
729
- type: "literal",
730
- values: Array.isArray(value) ? value : [value],
731
- ...util.normalizeParams(params),
732
- });
733
- }
734
- const ZodFile = /*@__PURE__*/ core.$constructor("ZodFile", (inst, def) => {
735
- schemas.$ZodFile.init(inst, def);
736
- ZodType.init(inst, def);
737
- inst.min = (size, params) => inst.check(api._minSize(size, params));
738
- inst.max = (size, params) => inst.check(api._maxSize(size, params));
739
- inst.mime = (types, params) => inst.check(api._mime(Array.isArray(types) ? types : [types], params));
740
- });
741
- function file(params) {
742
- return api._file(ZodFile, params);
743
- }
744
- const ZodTransform = /*@__PURE__*/ core.$constructor("ZodTransform", (inst, def) => {
745
- schemas.$ZodTransform.init(inst, def);
746
- ZodType.init(inst, def);
747
- inst._zod.parse = (payload, _ctx) => {
748
- payload.addIssue = (issue) => {
749
- if (typeof issue === "string") {
750
- payload.issues.push(util.issue(issue, payload.value, def));
751
- }
752
- else {
753
- // for Zod 3 backwards compatibility
754
- const _issue = issue;
755
- if (_issue.fatal)
756
- _issue.continue = false;
757
- _issue.code ?? (_issue.code = "custom");
758
- _issue.input ?? (_issue.input = payload.value);
759
- _issue.inst ?? (_issue.inst = inst);
760
- _issue.continue ?? (_issue.continue = true);
761
- payload.issues.push(util.issue(_issue));
762
- }
763
- };
764
- const output = def.transform(payload.value, payload);
765
- if (output instanceof Promise) {
766
- return output.then((output) => {
767
- payload.value = output;
768
- return payload;
769
- });
770
- }
771
- payload.value = output;
772
- return payload;
773
- };
774
- });
775
- function transform(fn) {
776
- return new ZodTransform({
777
- type: "transform",
778
- transform: fn,
779
- });
780
- }
781
- const ZodOptional = /*@__PURE__*/ core.$constructor("ZodOptional", (inst, def) => {
782
- schemas.$ZodOptional.init(inst, def);
783
- ZodType.init(inst, def);
784
- inst.unwrap = () => inst._zod.def.innerType;
785
- });
786
- function optional(innerType) {
787
- return new ZodOptional({
788
- type: "optional",
789
- innerType: innerType,
790
- });
791
- }
792
- const ZodNullable = /*@__PURE__*/ core.$constructor("ZodNullable", (inst, def) => {
793
- schemas.$ZodNullable.init(inst, def);
794
- ZodType.init(inst, def);
795
- inst.unwrap = () => inst._zod.def.innerType;
796
- });
797
- function nullable(innerType) {
798
- return new ZodNullable({
799
- type: "nullable",
800
- innerType: innerType,
801
- });
802
- }
803
- // nullish
804
- function nullish(innerType) {
805
- return optional(nullable(innerType));
806
- }
807
- const ZodDefault = /*@__PURE__*/ core.$constructor("ZodDefault", (inst, def) => {
808
- schemas.$ZodDefault.init(inst, def);
809
- ZodType.init(inst, def);
810
- inst.unwrap = () => inst._zod.def.innerType;
811
- inst.removeDefault = inst.unwrap;
812
- });
813
- function _default(innerType, defaultValue) {
814
- return new ZodDefault({
815
- type: "default",
816
- innerType: innerType,
817
- get defaultValue() {
818
- return typeof defaultValue === "function" ? defaultValue() : defaultValue;
819
- },
820
- });
821
- }
822
- const ZodPrefault = /*@__PURE__*/ core.$constructor("ZodPrefault", (inst, def) => {
823
- schemas.$ZodPrefault.init(inst, def);
824
- ZodType.init(inst, def);
825
- inst.unwrap = () => inst._zod.def.innerType;
826
- });
827
- function prefault(innerType, defaultValue) {
828
- return new ZodPrefault({
829
- type: "prefault",
830
- innerType: innerType,
831
- get defaultValue() {
832
- return typeof defaultValue === "function" ? defaultValue() : defaultValue;
833
- },
834
- });
835
- }
836
- const ZodNonOptional = /*@__PURE__*/ core.$constructor("ZodNonOptional", (inst, def) => {
837
- schemas.$ZodNonOptional.init(inst, def);
838
- ZodType.init(inst, def);
839
- inst.unwrap = () => inst._zod.def.innerType;
840
- });
841
- function nonoptional(innerType, params) {
842
- return new ZodNonOptional({
843
- type: "nonoptional",
844
- innerType: innerType,
845
- ...util.normalizeParams(params),
846
- });
847
- }
848
- const ZodSuccess = /*@__PURE__*/ core.$constructor("ZodSuccess", (inst, def) => {
849
- schemas.$ZodSuccess.init(inst, def);
850
- ZodType.init(inst, def);
851
- inst.unwrap = () => inst._zod.def.innerType;
852
- });
853
- function success(innerType) {
854
- return new ZodSuccess({
855
- type: "success",
856
- innerType: innerType,
857
- });
858
- }
859
- const ZodCatch = /*@__PURE__*/ core.$constructor("ZodCatch", (inst, def) => {
860
- schemas.$ZodCatch.init(inst, def);
861
- ZodType.init(inst, def);
862
- inst.unwrap = () => inst._zod.def.innerType;
863
- inst.removeCatch = inst.unwrap;
864
- });
865
- function _catch(innerType, catchValue) {
866
- return new ZodCatch({
867
- type: "catch",
868
- innerType: innerType,
869
- catchValue: (typeof catchValue === "function" ? catchValue : () => catchValue),
870
- });
871
- }
872
- const ZodNaN = /*@__PURE__*/ core.$constructor("ZodNaN", (inst, def) => {
873
- schemas.$ZodNaN.init(inst, def);
874
- ZodType.init(inst, def);
875
- });
876
- function nan(params) {
877
- return api._nan(ZodNaN, params);
878
- }
879
- const ZodPipe = /*@__PURE__*/ core.$constructor("ZodPipe", (inst, def) => {
880
- schemas.$ZodPipe.init(inst, def);
881
- ZodType.init(inst, def);
882
- inst.in = def.in;
883
- inst.out = def.out;
884
- });
885
- function pipe(in_, out) {
886
- return new ZodPipe({
887
- type: "pipe",
888
- in: in_,
889
- out: out,
890
- // ...util.normalizeParams(params),
891
- });
892
- }
893
- const ZodReadonly = /*@__PURE__*/ core.$constructor("ZodReadonly", (inst, def) => {
894
- schemas.$ZodReadonly.init(inst, def);
895
- ZodType.init(inst, def);
896
- });
897
- function readonly(innerType) {
898
- return new ZodReadonly({
899
- type: "readonly",
900
- innerType: innerType,
901
- });
902
- }
903
- const ZodTemplateLiteral = /*@__PURE__*/ core.$constructor("ZodTemplateLiteral", (inst, def) => {
904
- schemas.$ZodTemplateLiteral.init(inst, def);
905
- ZodType.init(inst, def);
906
- });
907
- function templateLiteral(parts, params) {
908
- return new ZodTemplateLiteral({
909
- type: "template_literal",
910
- parts,
911
- ...util.normalizeParams(params),
912
- });
913
- }
914
- const ZodLazy = /*@__PURE__*/ core.$constructor("ZodLazy", (inst, def) => {
915
- schemas.$ZodLazy.init(inst, def);
916
- ZodType.init(inst, def);
917
- inst.unwrap = () => inst._zod.def.getter();
918
- });
919
- function lazy(getter) {
920
- return new ZodLazy({
921
- type: "lazy",
922
- getter: getter,
923
- });
924
- }
925
- const ZodPromise = /*@__PURE__*/ core.$constructor("ZodPromise", (inst, def) => {
926
- schemas.$ZodPromise.init(inst, def);
927
- ZodType.init(inst, def);
928
- inst.unwrap = () => inst._zod.def.innerType;
929
- });
930
- function promise(innerType) {
931
- return new ZodPromise({
932
- type: "promise",
933
- innerType: innerType,
934
- });
935
- }
936
- const ZodCustom = /*@__PURE__*/ core.$constructor("ZodCustom", (inst, def) => {
937
- schemas.$ZodCustom.init(inst, def);
938
- ZodType.init(inst, def);
939
- });
940
- // custom checks
941
- function check(fn, params) {
942
- const ch = new checks.$ZodCheck({
943
- check: "custom",
944
- ...util.normalizeParams(params),
945
- });
946
- ch._zod.check = fn;
947
- return ch;
948
- }
949
- function custom(fn, _params) {
950
- return api._custom(ZodCustom, fn ?? (() => true), _params);
951
- }
952
- function refine(fn, _params = {}) {
953
- return api._refine(ZodCustom, fn, _params);
954
- }
955
- // superRefine
956
- function superRefine(fn, params) {
957
- const ch = check((payload) => {
958
- payload.addIssue = (issue) => {
959
- if (typeof issue === "string") {
960
- payload.issues.push(util.issue(issue, payload.value, ch._zod.def));
961
- }
962
- else {
963
- // for Zod 3 backwards compatibility
964
- const _issue = issue;
965
- if (_issue.fatal)
966
- _issue.continue = false;
967
- _issue.code ?? (_issue.code = "custom");
968
- _issue.input ?? (_issue.input = payload.value);
969
- _issue.inst ?? (_issue.inst = ch);
970
- _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
971
- payload.issues.push(util.issue(_issue));
972
- }
973
- };
974
- return fn(payload.value, payload);
975
- }, params);
976
- return ch;
977
- }
978
- function _instanceof(cls, params = {
979
- error: `Input not instance of ${cls.name}`,
980
- }) {
981
- const inst = new ZodCustom({
982
- type: "custom",
983
- check: "custom",
984
- fn: (data) => data instanceof cls,
985
- abort: true,
986
- ...util.normalizeParams(params),
987
- });
988
- inst._zod.bag.Class = cls;
989
- return inst;
990
- }
991
- // stringbool
992
- const stringbool = (...args) => api._stringbool({
993
- Pipe: ZodPipe,
994
- Boolean: ZodBoolean,
995
- String: ZodString,
996
- Transform: ZodTransform,
997
- }, ...args);
998
- function json(params) {
999
- const jsonSchema = lazy(() => {
1000
- return union([string(params), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
1001
- });
1002
- return jsonSchema;
1003
- }
1004
- // preprocess
1005
- // /** @deprecated Use `z.pipe()` and `z.transform()` instead. */
1006
- function preprocess(fn, schema) {
1007
- return pipe(transform(fn), schema);
1008
- }
1009
-
1010
- exports.ZodAny = ZodAny;
1011
- exports.ZodArray = ZodArray;
1012
- exports.ZodBase64 = ZodBase64;
1013
- exports.ZodBase64URL = ZodBase64URL;
1014
- exports.ZodBigInt = ZodBigInt;
1015
- exports.ZodBigIntFormat = ZodBigIntFormat;
1016
- exports.ZodBoolean = ZodBoolean;
1017
- exports.ZodCIDRv4 = ZodCIDRv4;
1018
- exports.ZodCIDRv6 = ZodCIDRv6;
1019
- exports.ZodCUID = ZodCUID;
1020
- exports.ZodCUID2 = ZodCUID2;
1021
- exports.ZodCatch = ZodCatch;
1022
- exports.ZodCustom = ZodCustom;
1023
- exports.ZodCustomStringFormat = ZodCustomStringFormat;
1024
- exports.ZodDate = ZodDate;
1025
- exports.ZodDefault = ZodDefault;
1026
- exports.ZodDiscriminatedUnion = ZodDiscriminatedUnion;
1027
- exports.ZodE164 = ZodE164;
1028
- exports.ZodEmail = ZodEmail;
1029
- exports.ZodEmoji = ZodEmoji;
1030
- exports.ZodEnum = ZodEnum;
1031
- exports.ZodFile = ZodFile;
1032
- exports.ZodGUID = ZodGUID;
1033
- exports.ZodIPv4 = ZodIPv4;
1034
- exports.ZodIPv6 = ZodIPv6;
1035
- exports.ZodIntersection = ZodIntersection;
1036
- exports.ZodJWT = ZodJWT;
1037
- exports.ZodKSUID = ZodKSUID;
1038
- exports.ZodLazy = ZodLazy;
1039
- exports.ZodLiteral = ZodLiteral;
1040
- exports.ZodMap = ZodMap;
1041
- exports.ZodNaN = ZodNaN;
1042
- exports.ZodNanoID = ZodNanoID;
1043
- exports.ZodNever = ZodNever;
1044
- exports.ZodNonOptional = ZodNonOptional;
1045
- exports.ZodNull = ZodNull;
1046
- exports.ZodNullable = ZodNullable;
1047
- exports.ZodNumber = ZodNumber;
1048
- exports.ZodNumberFormat = ZodNumberFormat;
1049
- exports.ZodObject = ZodObject;
1050
- exports.ZodOptional = ZodOptional;
1051
- exports.ZodPipe = ZodPipe;
1052
- exports.ZodPrefault = ZodPrefault;
1053
- exports.ZodPromise = ZodPromise;
1054
- exports.ZodReadonly = ZodReadonly;
1055
- exports.ZodRecord = ZodRecord;
1056
- exports.ZodSet = ZodSet;
1057
- exports.ZodString = ZodString;
1058
- exports.ZodStringFormat = ZodStringFormat;
1059
- exports.ZodSuccess = ZodSuccess;
1060
- exports.ZodSymbol = ZodSymbol;
1061
- exports.ZodTemplateLiteral = ZodTemplateLiteral;
1062
- exports.ZodTransform = ZodTransform;
1063
- exports.ZodTuple = ZodTuple;
1064
- exports.ZodType = ZodType;
1065
- exports.ZodULID = ZodULID;
1066
- exports.ZodURL = ZodURL;
1067
- exports.ZodUUID = ZodUUID;
1068
- exports.ZodUndefined = ZodUndefined;
1069
- exports.ZodUnion = ZodUnion;
1070
- exports.ZodUnknown = ZodUnknown;
1071
- exports.ZodVoid = ZodVoid;
1072
- exports.ZodXID = ZodXID;
1073
- exports._ZodString = _ZodString;
1074
- exports._default = _default;
1075
- exports.any = any;
1076
- exports.array = array;
1077
- exports.base64 = base64;
1078
- exports.base64url = base64url;
1079
- exports.bigint = bigint;
1080
- exports.boolean = boolean;
1081
- exports.catch = _catch;
1082
- exports.check = check;
1083
- exports.cidrv4 = cidrv4;
1084
- exports.cidrv6 = cidrv6;
1085
- exports.cuid = cuid;
1086
- exports.cuid2 = cuid2;
1087
- exports.custom = custom;
1088
- exports.date = date;
1089
- exports.discriminatedUnion = discriminatedUnion;
1090
- exports.e164 = e164;
1091
- exports.email = email;
1092
- exports.emoji = emoji;
1093
- exports.enum = _enum;
1094
- exports.file = file;
1095
- exports.float32 = float32;
1096
- exports.float64 = float64;
1097
- exports.guid = guid;
1098
- exports.instanceof = _instanceof;
1099
- exports.int = int;
1100
- exports.int32 = int32;
1101
- exports.int64 = int64;
1102
- exports.intersection = intersection;
1103
- exports.ipv4 = ipv4;
1104
- exports.ipv6 = ipv6;
1105
- exports.json = json;
1106
- exports.jwt = jwt;
1107
- exports.keyof = keyof;
1108
- exports.ksuid = ksuid;
1109
- exports.lazy = lazy;
1110
- exports.literal = literal;
1111
- exports.looseObject = looseObject;
1112
- exports.map = map;
1113
- exports.nan = nan;
1114
- exports.nanoid = nanoid;
1115
- exports.nativeEnum = nativeEnum;
1116
- exports.never = never;
1117
- exports.nonoptional = nonoptional;
1118
- exports.null = _null;
1119
- exports.nullable = nullable;
1120
- exports.nullish = nullish;
1121
- exports.number = number;
1122
- exports.object = object;
1123
- exports.optional = optional;
1124
- exports.partialRecord = partialRecord;
1125
- exports.pipe = pipe;
1126
- exports.prefault = prefault;
1127
- exports.preprocess = preprocess;
1128
- exports.promise = promise;
1129
- exports.readonly = readonly;
1130
- exports.record = record;
1131
- exports.refine = refine;
1132
- exports.set = set;
1133
- exports.strictObject = strictObject;
1134
- exports.string = string;
1135
- exports.stringFormat = stringFormat;
1136
- exports.stringbool = stringbool;
1137
- exports.success = success;
1138
- exports.superRefine = superRefine;
1139
- exports.symbol = symbol;
1140
- exports.templateLiteral = templateLiteral;
1141
- exports.transform = transform;
1142
- exports.tuple = tuple;
1143
- exports.uint32 = uint32;
1144
- exports.uint64 = uint64;
1145
- exports.ulid = ulid;
1146
- exports.undefined = _undefined;
1147
- exports.union = union;
1148
- exports.unknown = unknown;
1149
- exports.url = url;
1150
- exports.uuid = uuid;
1151
- exports.uuidv4 = uuidv4;
1152
- exports.uuidv6 = uuidv6;
1153
- exports.uuidv7 = uuidv7;
1154
- exports.void = _void;
1155
- exports.xid = xid;