@anthonyalayo/zod 0.0.0-stage → 4.7.1

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 (842) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +217 -2
  3. package/compile.cjs +96 -0
  4. package/compile.d.cts +1 -0
  5. package/compile.d.ts +1 -0
  6. package/compile.js +52 -0
  7. package/index.cjs +52 -0
  8. package/index.d.cts +3 -0
  9. package/index.d.ts +3 -0
  10. package/index.js +7 -0
  11. package/locales/index.cjs +36 -0
  12. package/locales/index.d.cts +1 -0
  13. package/locales/index.d.ts +1 -0
  14. package/locales/index.js +1 -0
  15. package/locales/package.json +7 -0
  16. package/mini/index.cjs +51 -0
  17. package/mini/index.d.cts +3 -0
  18. package/mini/index.d.ts +3 -0
  19. package/mini/index.js +3 -0
  20. package/mini/package.json +7 -0
  21. package/package.json +144 -4
  22. package/src/compile.ts +56 -0
  23. package/src/index.ts +7 -0
  24. package/src/locales/index.ts +1 -0
  25. package/src/mini/index.ts +3 -0
  26. package/src/v3/ZodError.ts +340 -0
  27. package/src/v3/benchmarks/datetime.ts +58 -0
  28. package/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  29. package/src/v3/benchmarks/index.ts +59 -0
  30. package/src/v3/benchmarks/ipv4.ts +57 -0
  31. package/src/v3/benchmarks/object.ts +69 -0
  32. package/src/v3/benchmarks/primitives.ts +162 -0
  33. package/src/v3/benchmarks/realworld.ts +63 -0
  34. package/src/v3/benchmarks/string.ts +55 -0
  35. package/src/v3/benchmarks/union.ts +80 -0
  36. package/src/v3/errors.ts +13 -0
  37. package/src/v3/external.ts +6 -0
  38. package/src/v3/helpers/enumUtil.ts +17 -0
  39. package/src/v3/helpers/errorUtil.ts +8 -0
  40. package/src/v3/helpers/parseUtil.ts +176 -0
  41. package/src/v3/helpers/partialUtil.ts +34 -0
  42. package/src/v3/helpers/typeAliases.ts +2 -0
  43. package/src/v3/helpers/util.ts +224 -0
  44. package/src/v3/index.ts +4 -0
  45. package/src/v3/locales/en.ts +124 -0
  46. package/src/v3/standard-schema.ts +113 -0
  47. package/src/v3/tests/Mocker.ts +54 -0
  48. package/src/v3/tests/all-errors.test.ts +157 -0
  49. package/src/v3/tests/anyunknown.test.ts +28 -0
  50. package/src/v3/tests/array.test.ts +92 -0
  51. package/src/v3/tests/async-parsing.test.ts +388 -0
  52. package/src/v3/tests/async-refinements.test.ts +46 -0
  53. package/src/v3/tests/base.test.ts +29 -0
  54. package/src/v3/tests/bigint.test.ts +55 -0
  55. package/src/v3/tests/branded.test.ts +53 -0
  56. package/src/v3/tests/catch.test.ts +220 -0
  57. package/src/v3/tests/coerce.test.ts +133 -0
  58. package/src/v3/tests/complex.test.ts +70 -0
  59. package/src/v3/tests/custom.test.ts +31 -0
  60. package/src/v3/tests/date.test.ts +32 -0
  61. package/src/v3/tests/deepmasking.test.ts +186 -0
  62. package/src/v3/tests/default.test.ts +112 -0
  63. package/src/v3/tests/description.test.ts +33 -0
  64. package/src/v3/tests/discriminated-unions.test.ts +315 -0
  65. package/src/v3/tests/enum.test.ts +80 -0
  66. package/src/v3/tests/error.test.ts +586 -0
  67. package/src/v3/tests/firstparty.test.ts +87 -0
  68. package/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  69. package/src/v3/tests/function.test.ts +261 -0
  70. package/src/v3/tests/generics.test.ts +48 -0
  71. package/src/v3/tests/instanceof.test.ts +37 -0
  72. package/src/v3/tests/intersection.test.ts +136 -0
  73. package/src/v3/tests/language-server.source.ts +76 -0
  74. package/src/v3/tests/language-server.test.ts +206 -0
  75. package/src/v3/tests/literal.test.ts +36 -0
  76. package/src/v3/tests/map.test.ts +110 -0
  77. package/src/v3/tests/masking.test.ts +4 -0
  78. package/src/v3/tests/mocker.test.ts +19 -0
  79. package/src/v3/tests/nan.test.ts +24 -0
  80. package/src/v3/tests/nativeEnum.test.ts +87 -0
  81. package/src/v3/tests/nullable.test.ts +42 -0
  82. package/src/v3/tests/number.test.ts +176 -0
  83. package/src/v3/tests/object-augmentation.test.ts +29 -0
  84. package/src/v3/tests/object-in-es5-env.test.ts +29 -0
  85. package/src/v3/tests/object.test.ts +431 -0
  86. package/src/v3/tests/optional.test.ts +42 -0
  87. package/src/v3/tests/parseUtil.test.ts +23 -0
  88. package/src/v3/tests/parser.test.ts +41 -0
  89. package/src/v3/tests/partials.test.ts +243 -0
  90. package/src/v3/tests/pickomit.test.ts +111 -0
  91. package/src/v3/tests/pipeline.test.ts +29 -0
  92. package/src/v3/tests/preprocess.test.ts +186 -0
  93. package/src/v3/tests/primitive.test.ts +440 -0
  94. package/src/v3/tests/promise.test.ts +90 -0
  95. package/src/v3/tests/readonly.test.ts +114 -0
  96. package/src/v3/tests/record.test.ts +171 -0
  97. package/src/v3/tests/recursive.test.ts +197 -0
  98. package/src/v3/tests/refine.test.ts +313 -0
  99. package/src/v3/tests/safeparse.test.ts +27 -0
  100. package/src/v3/tests/set.test.ts +148 -0
  101. package/src/v3/tests/standard-schema.test.ts +83 -0
  102. package/src/v3/tests/string.test.ts +922 -0
  103. package/src/v3/tests/transformer.test.ts +233 -0
  104. package/src/v3/tests/tuple.test.ts +90 -0
  105. package/src/v3/tests/unions.test.ts +57 -0
  106. package/src/v3/tests/validations.test.ts +133 -0
  107. package/src/v3/tests/void.test.ts +15 -0
  108. package/src/v3/types.ts +5149 -0
  109. package/src/v4/classic/checks.ts +33 -0
  110. package/src/v4/classic/coerce.ts +27 -0
  111. package/src/v4/classic/compat.ts +78 -0
  112. package/src/v4/classic/deep-partial.ts +76 -0
  113. package/src/v4/classic/errors.ts +97 -0
  114. package/src/v4/classic/external.ts +57 -0
  115. package/src/v4/classic/from-json-schema.ts +944 -0
  116. package/src/v4/classic/in-out.ts +45 -0
  117. package/src/v4/classic/index.ts +5 -0
  118. package/src/v4/classic/iso.ts +20 -0
  119. package/src/v4/classic/parse.ts +88 -0
  120. package/src/v4/classic/schemas.ts +3010 -0
  121. package/src/v4/classic/tests/anyunknown.test.ts +26 -0
  122. package/src/v4/classic/tests/apply.test.ts +86 -0
  123. package/src/v4/classic/tests/array.test.ts +339 -0
  124. package/src/v4/classic/tests/assignability.test.ts +402 -0
  125. package/src/v4/classic/tests/async-parsing.test.ts +381 -0
  126. package/src/v4/classic/tests/async-refinements.test.ts +68 -0
  127. package/src/v4/classic/tests/base.test.ts +7 -0
  128. package/src/v4/classic/tests/bigint.test.ts +89 -0
  129. package/src/v4/classic/tests/brand.test.ts +106 -0
  130. package/src/v4/classic/tests/catch.test.ts +604 -0
  131. package/src/v4/classic/tests/coalesce.test.ts +20 -0
  132. package/src/v4/classic/tests/codec-examples.test.ts +572 -0
  133. package/src/v4/classic/tests/codec.test.ts +704 -0
  134. package/src/v4/classic/tests/coerce.test.ts +160 -0
  135. package/src/v4/classic/tests/continuability.test.ts +374 -0
  136. package/src/v4/classic/tests/credit-card.test.ts +76 -0
  137. package/src/v4/classic/tests/custom.test.ts +40 -0
  138. package/src/v4/classic/tests/cyclic-data.test.ts +1248 -0
  139. package/src/v4/classic/tests/date.test.ts +92 -0
  140. package/src/v4/classic/tests/datetime.test.ts +316 -0
  141. package/src/v4/classic/tests/deep-partial.test.ts +380 -0
  142. package/src/v4/classic/tests/default-locale.test.ts +32 -0
  143. package/src/v4/classic/tests/default.test.ts +455 -0
  144. package/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
  145. package/src/v4/classic/tests/description.test.ts +32 -0
  146. package/src/v4/classic/tests/detached-methods.test.ts +221 -0
  147. package/src/v4/classic/tests/discriminated-unions.test.ts +942 -0
  148. package/src/v4/classic/tests/enum.test.ts +305 -0
  149. package/src/v4/classic/tests/error-utils.test.ts +917 -0
  150. package/src/v4/classic/tests/error.test.ts +1108 -0
  151. package/src/v4/classic/tests/file.test.ts +96 -0
  152. package/src/v4/classic/tests/firstparty.test.ts +179 -0
  153. package/src/v4/classic/tests/fix-json-issue.test.ts +26 -0
  154. package/src/v4/classic/tests/from-json-schema.test.ts +1467 -0
  155. package/src/v4/classic/tests/function.test.ts +391 -0
  156. package/src/v4/classic/tests/generics.test.ts +72 -0
  157. package/src/v4/classic/tests/global-config.test.ts +32 -0
  158. package/src/v4/classic/tests/hash.test.ts +67 -0
  159. package/src/v4/classic/tests/iban.test.ts +81 -0
  160. package/src/v4/classic/tests/in-out.test.ts +159 -0
  161. package/src/v4/classic/tests/index.test.ts +958 -0
  162. package/src/v4/classic/tests/instance-footprint.test.ts +319 -0
  163. package/src/v4/classic/tests/instanceof.test.ts +127 -0
  164. package/src/v4/classic/tests/intersection.test.ts +368 -0
  165. package/src/v4/classic/tests/issue-schema.test.ts +215 -0
  166. package/src/v4/classic/tests/jitless-allows-eval.test.ts +39 -0
  167. package/src/v4/classic/tests/json.test.ts +109 -0
  168. package/src/v4/classic/tests/lazy.test.ts +276 -0
  169. package/src/v4/classic/tests/literal.test.ts +128 -0
  170. package/src/v4/classic/tests/locales_ka.test.ts +29 -0
  171. package/src/v4/classic/tests/locales_ro.test.ts +24 -0
  172. package/src/v4/classic/tests/map.test.ts +349 -0
  173. package/src/v4/classic/tests/nan.test.ts +21 -0
  174. package/src/v4/classic/tests/nested-refine.test.ts +168 -0
  175. package/src/v4/classic/tests/nonoptional.test.ts +101 -0
  176. package/src/v4/classic/tests/nullable.test.ts +22 -0
  177. package/src/v4/classic/tests/number.test.ts +401 -0
  178. package/src/v4/classic/tests/object.test.ts +1015 -0
  179. package/src/v4/classic/tests/optin-ladder.test.ts +235 -0
  180. package/src/v4/classic/tests/optional.test.ts +366 -0
  181. package/src/v4/classic/tests/partial.test.ts +497 -0
  182. package/src/v4/classic/tests/pickomit.test.ts +211 -0
  183. package/src/v4/classic/tests/pipe.test.ts +101 -0
  184. package/src/v4/classic/tests/prefault.test.ts +144 -0
  185. package/src/v4/classic/tests/preprocess-types.test.ts +44 -0
  186. package/src/v4/classic/tests/preprocess.test.ts +351 -0
  187. package/src/v4/classic/tests/primitive.test.ts +175 -0
  188. package/src/v4/classic/tests/promise.test.ts +81 -0
  189. package/src/v4/classic/tests/properties.test.ts +141 -0
  190. package/src/v4/classic/tests/prototypes.test.ts +23 -0
  191. package/src/v4/classic/tests/readonly.test.ts +184 -0
  192. package/src/v4/classic/tests/record.test.ts +901 -0
  193. package/src/v4/classic/tests/recursive-types.test.ts +707 -0
  194. package/src/v4/classic/tests/redos.test.ts +68 -0
  195. package/src/v4/classic/tests/refine.test.ts +720 -0
  196. package/src/v4/classic/tests/registries.test.ts +243 -0
  197. package/src/v4/classic/tests/set.test.ts +196 -0
  198. package/src/v4/classic/tests/standard-schema.test.ts +153 -0
  199. package/src/v4/classic/tests/string-formats.test.ts +125 -0
  200. package/src/v4/classic/tests/string.test.ts +1440 -0
  201. package/src/v4/classic/tests/stringbool.test.ts +124 -0
  202. package/src/v4/classic/tests/template-literal.test.ts +864 -0
  203. package/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
  204. package/src/v4/classic/tests/to-json-schema.test.ts +4811 -0
  205. package/src/v4/classic/tests/transform.test.ts +414 -0
  206. package/src/v4/classic/tests/tuple.test.ts +520 -0
  207. package/src/v4/classic/tests/union.test.ts +358 -0
  208. package/src/v4/classic/tests/update.test.ts +108 -0
  209. package/src/v4/classic/tests/url.test.ts +13 -0
  210. package/src/v4/classic/tests/validate.test.ts +645 -0
  211. package/src/v4/classic/tests/validations.test.ts +283 -0
  212. package/src/v4/classic/tests/void.test.ts +12 -0
  213. package/src/v4/core/api.ts +1875 -0
  214. package/src/v4/core/checks.ts +1268 -0
  215. package/src/v4/core/compile.ts +2323 -0
  216. package/src/v4/core/core.ts +230 -0
  217. package/src/v4/core/doc.ts +52 -0
  218. package/src/v4/core/errors.ts +543 -0
  219. package/src/v4/core/index.ts +19 -0
  220. package/src/v4/core/json-schema-generator.ts +131 -0
  221. package/src/v4/core/json-schema-processors.ts +944 -0
  222. package/src/v4/core/json-schema.ts +148 -0
  223. package/src/v4/core/memoizer.ts +404 -0
  224. package/src/v4/core/parse.ts +309 -0
  225. package/src/v4/core/regexes.ts +217 -0
  226. package/src/v4/core/registries.ts +105 -0
  227. package/src/v4/core/schemas.ts +5271 -0
  228. package/src/v4/core/standard-schema.ts +159 -0
  229. package/src/v4/core/tests/cached.test.ts +54 -0
  230. package/src/v4/core/tests/compile-differential.test.ts +1004 -0
  231. package/src/v4/core/tests/compile-generative.test.ts +445 -0
  232. package/src/v4/core/tests/compile-global.test.ts +89 -0
  233. package/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
  234. package/src/v4/core/tests/compile-stats.test.ts +34 -0
  235. package/src/v4/core/tests/compile.test.ts +2056 -0
  236. package/src/v4/core/tests/email-regex.test.ts +140 -0
  237. package/src/v4/core/tests/extend.test.ts +59 -0
  238. package/src/v4/core/tests/index.test.ts +46 -0
  239. package/src/v4/core/tests/locales/be.test.ts +124 -0
  240. package/src/v4/core/tests/locales/el.test.ts +214 -0
  241. package/src/v4/core/tests/locales/en.test.ts +22 -0
  242. package/src/v4/core/tests/locales/es.test.ts +180 -0
  243. package/src/v4/core/tests/locales/fr.test.ts +72 -0
  244. package/src/v4/core/tests/locales/he.test.ts +391 -0
  245. package/src/v4/core/tests/locales/hr.test.ts +163 -0
  246. package/src/v4/core/tests/locales/hy.test.ts +15 -0
  247. package/src/v4/core/tests/locales/nl.test.ts +46 -0
  248. package/src/v4/core/tests/locales/parity.test.ts +67 -0
  249. package/src/v4/core/tests/locales/ru.test.ts +128 -0
  250. package/src/v4/core/tests/locales/tg.test.ts +85 -0
  251. package/src/v4/core/tests/locales/tk.test.ts +69 -0
  252. package/src/v4/core/tests/locales/tr.test.ts +69 -0
  253. package/src/v4/core/tests/locales/uz.test.ts +105 -0
  254. package/src/v4/core/tests/polyfill-collision.test.ts +46 -0
  255. package/src/v4/core/tests/record-constructor.test.ts +125 -0
  256. package/src/v4/core/tests/recursive-tuples.test.ts +45 -0
  257. package/src/v4/core/tests/treeshake.test.ts +51 -0
  258. package/src/v4/core/tests/url-no-canparse.test.ts +133 -0
  259. package/src/v4/core/to-json-schema.ts +857 -0
  260. package/src/v4/core/util.ts +1322 -0
  261. package/src/v4/core/versions.ts +5 -0
  262. package/src/v4/core/visit.ts +193 -0
  263. package/src/v4/core/zsf.ts +323 -0
  264. package/src/v4/index.ts +4 -0
  265. package/src/v4/locales/ar.ts +120 -0
  266. package/src/v4/locales/az.ts +116 -0
  267. package/src/v4/locales/be.ts +188 -0
  268. package/src/v4/locales/bg.ts +133 -0
  269. package/src/v4/locales/bn.ts +123 -0
  270. package/src/v4/locales/ca.ts +121 -0
  271. package/src/v4/locales/ckb.ts +140 -0
  272. package/src/v4/locales/cs.ts +123 -0
  273. package/src/v4/locales/da.ts +128 -0
  274. package/src/v4/locales/de.ts +121 -0
  275. package/src/v4/locales/el.ts +124 -0
  276. package/src/v4/locales/en.ts +136 -0
  277. package/src/v4/locales/eo.ts +123 -0
  278. package/src/v4/locales/es.ts +146 -0
  279. package/src/v4/locales/fa.ts +131 -0
  280. package/src/v4/locales/fi.ts +126 -0
  281. package/src/v4/locales/fr-CA.ts +121 -0
  282. package/src/v4/locales/fr.ts +140 -0
  283. package/src/v4/locales/gu.ts +123 -0
  284. package/src/v4/locales/he.ts +254 -0
  285. package/src/v4/locales/hi.ts +126 -0
  286. package/src/v4/locales/hr.ts +136 -0
  287. package/src/v4/locales/hu.ts +122 -0
  288. package/src/v4/locales/hy.ts +175 -0
  289. package/src/v4/locales/id.ts +120 -0
  290. package/src/v4/locales/index.ts +63 -0
  291. package/src/v4/locales/is.ts +124 -0
  292. package/src/v4/locales/it.ts +121 -0
  293. package/src/v4/locales/ja.ts +119 -0
  294. package/src/v4/locales/ka.ts +128 -0
  295. package/src/v4/locales/kh.ts +7 -0
  296. package/src/v4/locales/km.ts +124 -0
  297. package/src/v4/locales/kn.ts +126 -0
  298. package/src/v4/locales/ko.ts +126 -0
  299. package/src/v4/locales/lt.ts +260 -0
  300. package/src/v4/locales/mk.ts +123 -0
  301. package/src/v4/locales/ms.ts +120 -0
  302. package/src/v4/locales/ne.ts +128 -0
  303. package/src/v4/locales/nl.ts +126 -0
  304. package/src/v4/locales/nn.ts +121 -0
  305. package/src/v4/locales/no.ts +121 -0
  306. package/src/v4/locales/ota.ts +122 -0
  307. package/src/v4/locales/pl.ts +123 -0
  308. package/src/v4/locales/ps.ts +131 -0
  309. package/src/v4/locales/pt-BR.ts +161 -0
  310. package/src/v4/locales/pt.ts +159 -0
  311. package/src/v4/locales/ro.ts +132 -0
  312. package/src/v4/locales/ru.ts +188 -0
  313. package/src/v4/locales/sk.ts +123 -0
  314. package/src/v4/locales/sl.ts +123 -0
  315. package/src/v4/locales/sv.ts +124 -0
  316. package/src/v4/locales/ta.ts +123 -0
  317. package/src/v4/locales/tg.ts +135 -0
  318. package/src/v4/locales/th.ts +124 -0
  319. package/src/v4/locales/tk.ts +113 -0
  320. package/src/v4/locales/tr.ts +116 -0
  321. package/src/v4/locales/ua.ts +7 -0
  322. package/src/v4/locales/uk.ts +122 -0
  323. package/src/v4/locales/ur.ts +124 -0
  324. package/src/v4/locales/uz.ts +120 -0
  325. package/src/v4/locales/vi.ts +122 -0
  326. package/src/v4/locales/yo.ts +129 -0
  327. package/src/v4/locales/zh-CN.ts +121 -0
  328. package/src/v4/locales/zh-TW.ts +120 -0
  329. package/src/v4/mini/checks.ts +33 -0
  330. package/src/v4/mini/coerce.ts +27 -0
  331. package/src/v4/mini/deep-partial.ts +73 -0
  332. package/src/v4/mini/external.ts +52 -0
  333. package/src/v4/mini/in-out.ts +45 -0
  334. package/src/v4/mini/index.ts +3 -0
  335. package/src/v4/mini/iso.ts +66 -0
  336. package/src/v4/mini/parse.ts +16 -0
  337. package/src/v4/mini/schemas.ts +2051 -0
  338. package/src/v4/mini/tests/apply.test.ts +57 -0
  339. package/src/v4/mini/tests/assignability.test.ts +190 -0
  340. package/src/v4/mini/tests/brand.test.ts +94 -0
  341. package/src/v4/mini/tests/checks.test.ts +158 -0
  342. package/src/v4/mini/tests/codec.test.ts +582 -0
  343. package/src/v4/mini/tests/computed.test.ts +30 -0
  344. package/src/v4/mini/tests/cyclic-data.test.ts +97 -0
  345. package/src/v4/mini/tests/deep-partial.test.ts +54 -0
  346. package/src/v4/mini/tests/error.test.ts +41 -0
  347. package/src/v4/mini/tests/functions.test.ts +14 -0
  348. package/src/v4/mini/tests/index.test.ts +1175 -0
  349. package/src/v4/mini/tests/number.test.ts +109 -0
  350. package/src/v4/mini/tests/object.test.ts +292 -0
  351. package/src/v4/mini/tests/prototypes.test.ts +43 -0
  352. package/src/v4/mini/tests/recursive-types.test.ts +341 -0
  353. package/src/v4/mini/tests/standard-schema.test.ts +50 -0
  354. package/src/v4/mini/tests/string.test.ts +396 -0
  355. package/src/v4-mini/index.ts +3 -0
  356. package/v3/ZodError.cjs +167 -0
  357. package/v3/ZodError.d.cts +164 -0
  358. package/v3/ZodError.d.ts +164 -0
  359. package/v3/ZodError.js +143 -0
  360. package/v3/errors.cjs +36 -0
  361. package/v3/errors.d.cts +5 -0
  362. package/v3/errors.d.ts +5 -0
  363. package/v3/errors.js +9 -0
  364. package/v3/external.cjs +41 -0
  365. package/v3/external.d.cts +6 -0
  366. package/v3/external.d.ts +6 -0
  367. package/v3/external.js +6 -0
  368. package/v3/helpers/enumUtil.cjs +21 -0
  369. package/v3/helpers/enumUtil.d.cts +8 -0
  370. package/v3/helpers/enumUtil.d.ts +8 -0
  371. package/v3/helpers/enumUtil.js +1 -0
  372. package/v3/helpers/errorUtil.cjs +28 -0
  373. package/v3/helpers/errorUtil.d.cts +9 -0
  374. package/v3/helpers/errorUtil.d.ts +9 -0
  375. package/v3/helpers/errorUtil.js +6 -0
  376. package/v3/helpers/parseUtil.cjs +143 -0
  377. package/v3/helpers/parseUtil.d.cts +78 -0
  378. package/v3/helpers/parseUtil.d.ts +78 -0
  379. package/v3/helpers/parseUtil.js +109 -0
  380. package/v3/helpers/partialUtil.cjs +21 -0
  381. package/v3/helpers/partialUtil.d.cts +8 -0
  382. package/v3/helpers/partialUtil.d.ts +8 -0
  383. package/v3/helpers/partialUtil.js +1 -0
  384. package/v3/helpers/typeAliases.cjs +21 -0
  385. package/v3/helpers/typeAliases.d.cts +2 -0
  386. package/v3/helpers/typeAliases.d.ts +2 -0
  387. package/v3/helpers/typeAliases.js +1 -0
  388. package/v3/helpers/util.cjs +156 -0
  389. package/v3/helpers/util.d.cts +85 -0
  390. package/v3/helpers/util.d.ts +85 -0
  391. package/v3/helpers/util.js +133 -0
  392. package/v3/index.cjs +52 -0
  393. package/v3/index.d.cts +4 -0
  394. package/v3/index.d.ts +4 -0
  395. package/v3/index.js +4 -0
  396. package/v3/locales/en.cjs +112 -0
  397. package/v3/locales/en.d.cts +3 -0
  398. package/v3/locales/en.d.ts +3 -0
  399. package/v3/locales/en.js +109 -0
  400. package/v3/package.json +7 -0
  401. package/v3/standard-schema.cjs +21 -0
  402. package/v3/standard-schema.d.cts +102 -0
  403. package/v3/standard-schema.d.ts +102 -0
  404. package/v3/standard-schema.js +1 -0
  405. package/v3/types.cjs +3806 -0
  406. package/v3/types.d.cts +1034 -0
  407. package/v3/types.d.ts +1034 -0
  408. package/v3/types.js +3705 -0
  409. package/v4/classic/checks.cjs +53 -0
  410. package/v4/classic/checks.d.cts +1 -0
  411. package/v4/classic/checks.d.ts +1 -0
  412. package/v4/classic/checks.js +1 -0
  413. package/v4/classic/coerce.cjs +66 -0
  414. package/v4/classic/coerce.d.cts +17 -0
  415. package/v4/classic/coerce.d.ts +17 -0
  416. package/v4/classic/coerce.js +17 -0
  417. package/v4/classic/compat.cjs +80 -0
  418. package/v4/classic/compat.d.cts +48 -0
  419. package/v4/classic/compat.d.ts +48 -0
  420. package/v4/classic/compat.js +31 -0
  421. package/v4/classic/deep-partial.cjs +58 -0
  422. package/v4/classic/deep-partial.d.cts +14 -0
  423. package/v4/classic/deep-partial.d.ts +14 -0
  424. package/v4/classic/deep-partial.js +13 -0
  425. package/v4/classic/errors.cjs +102 -0
  426. package/v4/classic/errors.d.cts +29 -0
  427. package/v4/classic/errors.d.ts +29 -0
  428. package/v4/classic/errors.js +57 -0
  429. package/v4/classic/external.cjs +97 -0
  430. package/v4/classic/external.d.cts +19 -0
  431. package/v4/classic/external.d.ts +19 -0
  432. package/v4/classic/external.js +17 -0
  433. package/v4/classic/from-json-schema.cjs +926 -0
  434. package/v4/classic/from-json-schema.d.cts +12 -0
  435. package/v4/classic/from-json-schema.d.ts +12 -0
  436. package/v4/classic/from-json-schema.js +881 -0
  437. package/v4/classic/in-out.cjs +82 -0
  438. package/v4/classic/in-out.d.cts +8 -0
  439. package/v4/classic/in-out.d.ts +8 -0
  440. package/v4/classic/in-out.js +36 -0
  441. package/v4/classic/index.cjs +52 -0
  442. package/v4/classic/index.d.cts +3 -0
  443. package/v4/classic/index.d.ts +3 -0
  444. package/v4/classic/index.js +4 -0
  445. package/v4/classic/iso.cjs +68 -0
  446. package/v4/classic/iso.d.cts +7 -0
  447. package/v4/classic/iso.d.ts +7 -0
  448. package/v4/classic/iso.js +15 -0
  449. package/v4/classic/package.json +7 -0
  450. package/v4/classic/parse.cjs +63 -0
  451. package/v4/classic/parse.d.cts +44 -0
  452. package/v4/classic/parse.d.ts +44 -0
  453. package/v4/classic/parse.js +16 -0
  454. package/v4/classic/schemas.cjs +1752 -0
  455. package/v4/classic/schemas.d.cts +819 -0
  456. package/v4/classic/schemas.d.ts +819 -0
  457. package/v4/classic/schemas.js +1611 -0
  458. package/v4/core/api.cjs +1269 -0
  459. package/v4/core/api.d.cts +335 -0
  460. package/v4/core/api.d.ts +335 -0
  461. package/v4/core/api.js +1107 -0
  462. package/v4/core/checks.cjs +561 -0
  463. package/v4/core/checks.d.cts +296 -0
  464. package/v4/core/checks.d.ts +296 -0
  465. package/v4/core/checks.js +516 -0
  466. package/v4/core/compile.cjs +1915 -0
  467. package/v4/core/compile.d.cts +65 -0
  468. package/v4/core/compile.d.ts +65 -0
  469. package/v4/core/compile.js +1865 -0
  470. package/v4/core/core.cjs +167 -0
  471. package/v4/core/core.d.cts +82 -0
  472. package/v4/core/core.d.ts +82 -0
  473. package/v4/core/core.js +141 -0
  474. package/v4/core/doc.cjs +61 -0
  475. package/v4/core/doc.d.cts +16 -0
  476. package/v4/core/doc.d.ts +16 -0
  477. package/v4/core/doc.js +38 -0
  478. package/v4/core/errors.cjs +317 -0
  479. package/v4/core/errors.d.cts +225 -0
  480. package/v4/core/errors.d.ts +225 -0
  481. package/v4/core/errors.js +267 -0
  482. package/v4/core/index.cjs +70 -0
  483. package/v4/core/index.d.cts +19 -0
  484. package/v4/core/index.d.ts +19 -0
  485. package/v4/core/index.js +19 -0
  486. package/v4/core/json-schema-generator.cjs +122 -0
  487. package/v4/core/json-schema-generator.d.cts +65 -0
  488. package/v4/core/json-schema-generator.d.ts +65 -0
  489. package/v4/core/json-schema-generator.js +99 -0
  490. package/v4/core/json-schema-processors.cjs +945 -0
  491. package/v4/core/json-schema-processors.d.cts +65 -0
  492. package/v4/core/json-schema-processors.d.ts +65 -0
  493. package/v4/core/json-schema-processors.js +859 -0
  494. package/v4/core/json-schema.cjs +21 -0
  495. package/v4/core/json-schema.d.cts +89 -0
  496. package/v4/core/json-schema.d.ts +89 -0
  497. package/v4/core/json-schema.js +1 -0
  498. package/v4/core/memoizer.cjs +424 -0
  499. package/v4/core/memoizer.d.cts +15 -0
  500. package/v4/core/memoizer.d.ts +15 -0
  501. package/v4/core/memoizer.js +375 -0
  502. package/v4/core/package.json +7 -0
  503. package/v4/core/parse.cjs +233 -0
  504. package/v4/core/parse.d.cts +52 -0
  505. package/v4/core/parse.d.ts +52 -0
  506. package/v4/core/parse.js +175 -0
  507. package/v4/core/regexes.cjs +209 -0
  508. package/v4/core/regexes.d.cts +90 -0
  509. package/v4/core/regexes.d.ts +90 -0
  510. package/v4/core/regexes.js +156 -0
  511. package/v4/core/registries.cjs +75 -0
  512. package/v4/core/registries.d.cts +35 -0
  513. package/v4/core/registries.d.ts +35 -0
  514. package/v4/core/registries.js +51 -0
  515. package/v4/core/schemas.cjs +2754 -0
  516. package/v4/core/schemas.d.cts +1277 -0
  517. package/v4/core/schemas.d.ts +1277 -0
  518. package/v4/core/schemas.js +2691 -0
  519. package/v4/core/standard-schema.cjs +21 -0
  520. package/v4/core/standard-schema.d.cts +126 -0
  521. package/v4/core/standard-schema.d.ts +126 -0
  522. package/v4/core/standard-schema.js +1 -0
  523. package/v4/core/to-json-schema.cjs +681 -0
  524. package/v4/core/to-json-schema.d.cts +154 -0
  525. package/v4/core/to-json-schema.d.ts +154 -0
  526. package/v4/core/to-json-schema.js +651 -0
  527. package/v4/core/util.cjs +997 -0
  528. package/v4/core/util.d.cts +284 -0
  529. package/v4/core/util.d.ts +284 -0
  530. package/v4/core/util.js +904 -0
  531. package/v4/core/versions.cjs +27 -0
  532. package/v4/core/versions.d.cts +5 -0
  533. package/v4/core/versions.d.ts +5 -0
  534. package/v4/core/versions.js +5 -0
  535. package/v4/core/visit.cjs +214 -0
  536. package/v4/core/visit.d.cts +30 -0
  537. package/v4/core/visit.d.ts +30 -0
  538. package/v4/core/visit.js +169 -0
  539. package/v4/index.cjs +51 -0
  540. package/v4/index.d.cts +3 -0
  541. package/v4/index.d.ts +3 -0
  542. package/v4/index.js +4 -0
  543. package/v4/locales/ar.cjs +138 -0
  544. package/v4/locales/ar.d.cts +5 -0
  545. package/v4/locales/ar.d.ts +4 -0
  546. package/v4/locales/ar.js +111 -0
  547. package/v4/locales/az.cjs +137 -0
  548. package/v4/locales/az.d.cts +5 -0
  549. package/v4/locales/az.d.ts +4 -0
  550. package/v4/locales/az.js +110 -0
  551. package/v4/locales/be.cjs +195 -0
  552. package/v4/locales/be.d.cts +5 -0
  553. package/v4/locales/be.d.ts +4 -0
  554. package/v4/locales/be.js +168 -0
  555. package/v4/locales/bg.cjs +152 -0
  556. package/v4/locales/bg.d.cts +5 -0
  557. package/v4/locales/bg.d.ts +4 -0
  558. package/v4/locales/bg.js +125 -0
  559. package/v4/locales/bn.cjs +140 -0
  560. package/v4/locales/bn.d.cts +5 -0
  561. package/v4/locales/bn.d.ts +4 -0
  562. package/v4/locales/bn.js +113 -0
  563. package/v4/locales/ca.cjs +139 -0
  564. package/v4/locales/ca.d.cts +5 -0
  565. package/v4/locales/ca.d.ts +4 -0
  566. package/v4/locales/ca.js +112 -0
  567. package/v4/locales/ckb.cjs +160 -0
  568. package/v4/locales/ckb.d.cts +5 -0
  569. package/v4/locales/ckb.d.ts +4 -0
  570. package/v4/locales/ckb.js +133 -0
  571. package/v4/locales/cs.cjs +143 -0
  572. package/v4/locales/cs.d.cts +5 -0
  573. package/v4/locales/cs.d.ts +4 -0
  574. package/v4/locales/cs.js +116 -0
  575. package/v4/locales/da.cjs +147 -0
  576. package/v4/locales/da.d.cts +5 -0
  577. package/v4/locales/da.d.ts +4 -0
  578. package/v4/locales/da.js +120 -0
  579. package/v4/locales/de.cjs +140 -0
  580. package/v4/locales/de.d.cts +5 -0
  581. package/v4/locales/de.d.ts +4 -0
  582. package/v4/locales/de.js +113 -0
  583. package/v4/locales/el.cjs +139 -0
  584. package/v4/locales/el.d.cts +5 -0
  585. package/v4/locales/el.d.ts +4 -0
  586. package/v4/locales/el.js +112 -0
  587. package/v4/locales/en.cjs +152 -0
  588. package/v4/locales/en.d.cts +5 -0
  589. package/v4/locales/en.d.ts +4 -0
  590. package/v4/locales/en.js +125 -0
  591. package/v4/locales/eo.cjs +141 -0
  592. package/v4/locales/eo.d.cts +5 -0
  593. package/v4/locales/eo.d.ts +4 -0
  594. package/v4/locales/eo.js +114 -0
  595. package/v4/locales/es.cjs +164 -0
  596. package/v4/locales/es.d.cts +5 -0
  597. package/v4/locales/es.d.ts +4 -0
  598. package/v4/locales/es.js +137 -0
  599. package/v4/locales/fa.cjs +146 -0
  600. package/v4/locales/fa.d.cts +5 -0
  601. package/v4/locales/fa.d.ts +4 -0
  602. package/v4/locales/fa.js +119 -0
  603. package/v4/locales/fi.cjs +144 -0
  604. package/v4/locales/fi.d.cts +5 -0
  605. package/v4/locales/fi.d.ts +4 -0
  606. package/v4/locales/fi.js +117 -0
  607. package/v4/locales/fr-CA.cjs +139 -0
  608. package/v4/locales/fr-CA.d.cts +5 -0
  609. package/v4/locales/fr-CA.d.ts +4 -0
  610. package/v4/locales/fr-CA.js +112 -0
  611. package/v4/locales/fr.cjs +157 -0
  612. package/v4/locales/fr.d.cts +5 -0
  613. package/v4/locales/fr.d.ts +4 -0
  614. package/v4/locales/fr.js +130 -0
  615. package/v4/locales/gu.cjs +140 -0
  616. package/v4/locales/gu.d.cts +5 -0
  617. package/v4/locales/gu.d.ts +4 -0
  618. package/v4/locales/gu.js +113 -0
  619. package/v4/locales/he.cjs +249 -0
  620. package/v4/locales/he.d.cts +5 -0
  621. package/v4/locales/he.d.ts +4 -0
  622. package/v4/locales/he.js +222 -0
  623. package/v4/locales/hi.cjs +138 -0
  624. package/v4/locales/hi.d.cts +5 -0
  625. package/v4/locales/hi.d.ts +4 -0
  626. package/v4/locales/hi.js +111 -0
  627. package/v4/locales/hr.cjs +154 -0
  628. package/v4/locales/hr.d.cts +5 -0
  629. package/v4/locales/hr.d.ts +4 -0
  630. package/v4/locales/hr.js +127 -0
  631. package/v4/locales/hu.cjs +140 -0
  632. package/v4/locales/hu.d.cts +5 -0
  633. package/v4/locales/hu.d.ts +4 -0
  634. package/v4/locales/hu.js +113 -0
  635. package/v4/locales/hy.cjs +185 -0
  636. package/v4/locales/hy.d.cts +5 -0
  637. package/v4/locales/hy.d.ts +4 -0
  638. package/v4/locales/hy.js +158 -0
  639. package/v4/locales/id.cjs +138 -0
  640. package/v4/locales/id.d.cts +5 -0
  641. package/v4/locales/id.d.ts +4 -0
  642. package/v4/locales/id.js +111 -0
  643. package/v4/locales/index.cjs +152 -0
  644. package/v4/locales/index.d.cts +63 -0
  645. package/v4/locales/index.d.ts +63 -0
  646. package/v4/locales/index.js +63 -0
  647. package/v4/locales/is.cjs +141 -0
  648. package/v4/locales/is.d.cts +5 -0
  649. package/v4/locales/is.d.ts +4 -0
  650. package/v4/locales/is.js +114 -0
  651. package/v4/locales/it.cjs +140 -0
  652. package/v4/locales/it.d.cts +5 -0
  653. package/v4/locales/it.d.ts +4 -0
  654. package/v4/locales/it.js +113 -0
  655. package/v4/locales/ja.cjs +139 -0
  656. package/v4/locales/ja.d.cts +5 -0
  657. package/v4/locales/ja.d.ts +4 -0
  658. package/v4/locales/ja.js +112 -0
  659. package/v4/locales/ka.cjs +144 -0
  660. package/v4/locales/ka.d.cts +5 -0
  661. package/v4/locales/ka.d.ts +4 -0
  662. package/v4/locales/ka.js +117 -0
  663. package/v4/locales/kh.cjs +12 -0
  664. package/v4/locales/kh.d.cts +5 -0
  665. package/v4/locales/kh.d.ts +5 -0
  666. package/v4/locales/kh.js +5 -0
  667. package/v4/locales/km.cjs +142 -0
  668. package/v4/locales/km.d.cts +5 -0
  669. package/v4/locales/km.d.ts +4 -0
  670. package/v4/locales/km.js +115 -0
  671. package/v4/locales/kn.cjs +143 -0
  672. package/v4/locales/kn.d.cts +5 -0
  673. package/v4/locales/kn.d.ts +4 -0
  674. package/v4/locales/kn.js +116 -0
  675. package/v4/locales/ko.cjs +143 -0
  676. package/v4/locales/ko.d.cts +5 -0
  677. package/v4/locales/ko.d.ts +4 -0
  678. package/v4/locales/ko.js +116 -0
  679. package/v4/locales/lt.cjs +251 -0
  680. package/v4/locales/lt.d.cts +5 -0
  681. package/v4/locales/lt.d.ts +4 -0
  682. package/v4/locales/lt.js +224 -0
  683. package/v4/locales/mk.cjs +141 -0
  684. package/v4/locales/mk.d.cts +5 -0
  685. package/v4/locales/mk.d.ts +4 -0
  686. package/v4/locales/mk.js +114 -0
  687. package/v4/locales/ms.cjs +139 -0
  688. package/v4/locales/ms.d.cts +5 -0
  689. package/v4/locales/ms.d.ts +4 -0
  690. package/v4/locales/ms.js +112 -0
  691. package/v4/locales/ne.cjs +138 -0
  692. package/v4/locales/ne.d.cts +5 -0
  693. package/v4/locales/ne.d.ts +4 -0
  694. package/v4/locales/ne.js +111 -0
  695. package/v4/locales/nl.cjs +142 -0
  696. package/v4/locales/nl.d.cts +5 -0
  697. package/v4/locales/nl.d.ts +4 -0
  698. package/v4/locales/nl.js +115 -0
  699. package/v4/locales/nn.cjs +140 -0
  700. package/v4/locales/nn.d.cts +5 -0
  701. package/v4/locales/nn.d.ts +4 -0
  702. package/v4/locales/nn.js +113 -0
  703. package/v4/locales/no.cjs +140 -0
  704. package/v4/locales/no.d.cts +5 -0
  705. package/v4/locales/no.d.ts +4 -0
  706. package/v4/locales/no.js +113 -0
  707. package/v4/locales/ota.cjs +141 -0
  708. package/v4/locales/ota.d.cts +5 -0
  709. package/v4/locales/ota.d.ts +4 -0
  710. package/v4/locales/ota.js +114 -0
  711. package/v4/locales/package.json +7 -0
  712. package/v4/locales/pl.cjs +141 -0
  713. package/v4/locales/pl.d.cts +5 -0
  714. package/v4/locales/pl.d.ts +4 -0
  715. package/v4/locales/pl.js +114 -0
  716. package/v4/locales/ps.cjs +146 -0
  717. package/v4/locales/ps.d.cts +5 -0
  718. package/v4/locales/ps.d.ts +4 -0
  719. package/v4/locales/ps.js +119 -0
  720. package/v4/locales/pt-BR.cjs +170 -0
  721. package/v4/locales/pt-BR.d.cts +5 -0
  722. package/v4/locales/pt-BR.d.ts +4 -0
  723. package/v4/locales/pt-BR.js +143 -0
  724. package/v4/locales/pt.cjs +169 -0
  725. package/v4/locales/pt.d.cts +5 -0
  726. package/v4/locales/pt.d.ts +4 -0
  727. package/v4/locales/pt.js +142 -0
  728. package/v4/locales/ro.cjs +149 -0
  729. package/v4/locales/ro.d.cts +5 -0
  730. package/v4/locales/ro.d.ts +4 -0
  731. package/v4/locales/ro.js +122 -0
  732. package/v4/locales/ru.cjs +195 -0
  733. package/v4/locales/ru.d.cts +5 -0
  734. package/v4/locales/ru.d.ts +4 -0
  735. package/v4/locales/ru.js +168 -0
  736. package/v4/locales/sk.cjs +143 -0
  737. package/v4/locales/sk.d.cts +5 -0
  738. package/v4/locales/sk.d.ts +4 -0
  739. package/v4/locales/sk.js +116 -0
  740. package/v4/locales/sl.cjs +141 -0
  741. package/v4/locales/sl.d.cts +5 -0
  742. package/v4/locales/sl.d.ts +4 -0
  743. package/v4/locales/sl.js +114 -0
  744. package/v4/locales/sv.cjs +142 -0
  745. package/v4/locales/sv.d.cts +5 -0
  746. package/v4/locales/sv.d.ts +4 -0
  747. package/v4/locales/sv.js +115 -0
  748. package/v4/locales/ta.cjs +142 -0
  749. package/v4/locales/ta.d.cts +5 -0
  750. package/v4/locales/ta.d.ts +4 -0
  751. package/v4/locales/ta.js +115 -0
  752. package/v4/locales/tg.cjs +144 -0
  753. package/v4/locales/tg.d.cts +5 -0
  754. package/v4/locales/tg.d.ts +4 -0
  755. package/v4/locales/tg.js +117 -0
  756. package/v4/locales/th.cjs +142 -0
  757. package/v4/locales/th.d.cts +5 -0
  758. package/v4/locales/th.d.ts +4 -0
  759. package/v4/locales/th.js +115 -0
  760. package/v4/locales/tk.cjs +134 -0
  761. package/v4/locales/tk.d.cts +5 -0
  762. package/v4/locales/tk.d.ts +4 -0
  763. package/v4/locales/tk.js +107 -0
  764. package/v4/locales/tr.cjs +137 -0
  765. package/v4/locales/tr.d.cts +5 -0
  766. package/v4/locales/tr.d.ts +4 -0
  767. package/v4/locales/tr.js +110 -0
  768. package/v4/locales/ua.cjs +12 -0
  769. package/v4/locales/ua.d.cts +5 -0
  770. package/v4/locales/ua.d.ts +5 -0
  771. package/v4/locales/ua.js +5 -0
  772. package/v4/locales/uk.cjs +140 -0
  773. package/v4/locales/uk.d.cts +5 -0
  774. package/v4/locales/uk.d.ts +4 -0
  775. package/v4/locales/uk.js +113 -0
  776. package/v4/locales/ur.cjs +142 -0
  777. package/v4/locales/ur.d.cts +5 -0
  778. package/v4/locales/ur.d.ts +4 -0
  779. package/v4/locales/ur.js +115 -0
  780. package/v4/locales/uz.cjs +140 -0
  781. package/v4/locales/uz.d.cts +5 -0
  782. package/v4/locales/uz.d.ts +4 -0
  783. package/v4/locales/uz.js +113 -0
  784. package/v4/locales/vi.cjs +140 -0
  785. package/v4/locales/vi.d.cts +5 -0
  786. package/v4/locales/vi.d.ts +4 -0
  787. package/v4/locales/vi.js +113 -0
  788. package/v4/locales/yo.cjs +139 -0
  789. package/v4/locales/yo.d.cts +5 -0
  790. package/v4/locales/yo.d.ts +4 -0
  791. package/v4/locales/yo.js +112 -0
  792. package/v4/locales/zh-CN.cjs +141 -0
  793. package/v4/locales/zh-CN.d.cts +5 -0
  794. package/v4/locales/zh-CN.d.ts +4 -0
  795. package/v4/locales/zh-CN.js +114 -0
  796. package/v4/locales/zh-TW.cjs +139 -0
  797. package/v4/locales/zh-TW.d.cts +5 -0
  798. package/v4/locales/zh-TW.d.ts +4 -0
  799. package/v4/locales/zh-TW.js +112 -0
  800. package/v4/mini/checks.cjs +54 -0
  801. package/v4/mini/checks.d.cts +1 -0
  802. package/v4/mini/checks.d.ts +1 -0
  803. package/v4/mini/checks.js +1 -0
  804. package/v4/mini/coerce.cjs +71 -0
  805. package/v4/mini/coerce.d.cts +7 -0
  806. package/v4/mini/coerce.d.ts +7 -0
  807. package/v4/mini/coerce.js +22 -0
  808. package/v4/mini/deep-partial.cjs +58 -0
  809. package/v4/mini/deep-partial.d.cts +14 -0
  810. package/v4/mini/deep-partial.d.ts +14 -0
  811. package/v4/mini/deep-partial.js +13 -0
  812. package/v4/mini/external.cjs +95 -0
  813. package/v4/mini/external.d.cts +16 -0
  814. package/v4/mini/external.d.ts +16 -0
  815. package/v4/mini/external.js +16 -0
  816. package/v4/mini/in-out.cjs +82 -0
  817. package/v4/mini/in-out.d.cts +8 -0
  818. package/v4/mini/in-out.d.ts +8 -0
  819. package/v4/mini/in-out.js +36 -0
  820. package/v4/mini/index.cjs +51 -0
  821. package/v4/mini/index.d.cts +3 -0
  822. package/v4/mini/index.d.ts +3 -0
  823. package/v4/mini/index.js +3 -0
  824. package/v4/mini/iso.cjs +83 -0
  825. package/v4/mini/iso.d.cts +22 -0
  826. package/v4/mini/iso.d.ts +22 -0
  827. package/v4/mini/iso.js +34 -0
  828. package/v4/mini/package.json +7 -0
  829. package/v4/mini/parse.cjs +37 -0
  830. package/v4/mini/parse.d.cts +1 -0
  831. package/v4/mini/parse.d.ts +1 -0
  832. package/v4/mini/parse.js +1 -0
  833. package/v4/mini/schemas.cjs +1147 -0
  834. package/v4/mini/schemas.d.cts +480 -0
  835. package/v4/mini/schemas.d.ts +480 -0
  836. package/v4/mini/schemas.js +1002 -0
  837. package/v4/package.json +7 -0
  838. package/v4-mini/index.cjs +51 -0
  839. package/v4-mini/index.d.cts +3 -0
  840. package/v4-mini/index.d.ts +3 -0
  841. package/v4-mini/index.js +3 -0
  842. package/v4-mini/package.json +7 -0
@@ -0,0 +1,3010 @@
1
+ import type { $ZodBigIntFormats } from "../core/checks.js";
2
+ import * as core from "../core/index.js";
3
+ import { util, type $ZodNumberFormats } from "../core/index.js";
4
+ import * as processors from "../core/json-schema-processors.js";
5
+ import * as regexes from "../core/regexes.js";
6
+ import type { StandardSchemaWithJSONProps } from "../core/standard-schema.js";
7
+ import { createStandardJSONSchemaMethod, createToJSONSchemaMethod } from "../core/to-json-schema.js";
8
+ import en from "../locales/en.js";
9
+
10
+ import * as checks from "./checks.js";
11
+ import * as parse from "./parse.js";
12
+
13
+ // Register English as the default locale on first ZodType construction. Hooked into the `ZodType` `$constructor` (rather than a top-level `config(en())` in `external.ts`) so bundlers honoring `sideEffects: false` can't tree-shake it out — see #5953, #5725. An explicit `z.config(z.locales.xx())` call wins regardless of order, since this only sets the default when none is present.
14
+ function _ensureDefaultLocale(): void {
15
+ if (!core.globalConfig.localeError) core.config(en());
16
+ }
17
+
18
+ // the default memoizer is read by the core container init, which runs before `ZodType.init`, so each container calls this first
19
+ function _ensureDefaultMemoizer(): void {
20
+ if (!core.globalConfig.memoizer) core.config({ memoizer: core.memoizer() });
21
+ }
22
+
23
+ // Methods live on each concrete constructor's prototype and materialize per instance on first access, so a schema only pays for what it is asked for.
24
+
25
+ ///////////////////////////////////////////
26
+ ///////////////////////////////////////////
27
+ //////////// ////////////
28
+ //////////// ZodType ////////////
29
+ //////////// ////////////
30
+ ///////////////////////////////////////////
31
+ ///////////////////////////////////////////
32
+
33
+ export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
34
+ export interface ZodType<
35
+ out Output = unknown,
36
+ out Input = unknown,
37
+ out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>,
38
+ > extends core.$ZodType<Output, Input, Internals> {
39
+ def: Internals["def"];
40
+ type: Internals["def"]["type"];
41
+
42
+ /** @deprecated Use `.def` instead. */
43
+ _def: Internals["def"];
44
+ /** @deprecated Use `z.output<typeof schema>` instead. */
45
+ _output: Internals["output"];
46
+ /** @deprecated Use `z.input<typeof schema>` instead. */
47
+ _input: Internals["input"];
48
+
49
+ "~standard": ZodStandardSchemaWithJSON<this>;
50
+ /** Converts this schema to a JSON Schema representation. */
51
+ toJSONSchema(params?: core.ToJSONSchemaParams): core.ZodStandardJSONSchemaPayload<this>;
52
+
53
+ // base methods
54
+ check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
55
+ with(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
56
+ clone(def?: Internals["def"], params?: { parent: boolean }): this;
57
+ register<R extends core.$ZodRegistry>(
58
+ registry: R,
59
+ ...meta: this extends R["_schema"]
60
+ ? undefined extends R["_meta"]
61
+ ? [core.$replace<R["_meta"], this>?]
62
+ : [core.$replace<R["_meta"], this>]
63
+ : ["Incompatible schema"]
64
+ ): this;
65
+
66
+ brand<T extends PropertyKey = PropertyKey, Dir extends "in" | "out" | "inout" = "out">(
67
+ value?: T
68
+ ): PropertyKey extends T ? this : core.$ZodBranded<this, T, Dir>;
69
+
70
+ // parsing
71
+ parse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
72
+ safeParse(data: unknown, params?: core.ParseContext<core.$ZodIssue>): parse.ZodSafeParseResult<core.output<this>>;
73
+ parseAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>;
74
+ safeParseAsync(
75
+ data: unknown,
76
+ params?: core.ParseContext<core.$ZodIssue>
77
+ ): Promise<parse.ZodSafeParseResult<core.output<this>>>;
78
+ spa: (
79
+ data: unknown,
80
+ params?: core.ParseContext<core.$ZodIssue>
81
+ ) => Promise<parse.ZodSafeParseResult<core.output<this>>>;
82
+ validate(data: unknown, params?: core.ParseContext<core.$ZodIssue>): data is core.input<this>;
83
+ validateAsync(data: unknown, params?: core.ParseContext<core.$ZodIssue>): Promise<boolean>;
84
+
85
+ // encoding/decoding
86
+ encode(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): core.input<this>;
87
+ decode(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): core.output<this>;
88
+ encodeAsync(data: core.output<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<core.input<this>>;
89
+ decodeAsync(data: core.input<this>, params?: core.ParseContext<core.$ZodIssue>): Promise<core.output<this>>;
90
+ safeEncode(
91
+ data: core.output<this>,
92
+ params?: core.ParseContext<core.$ZodIssue>
93
+ ): parse.ZodSafeParseResult<core.input<this>>;
94
+ safeDecode(
95
+ data: core.input<this>,
96
+ params?: core.ParseContext<core.$ZodIssue>
97
+ ): parse.ZodSafeParseResult<core.output<this>>;
98
+ safeEncodeAsync(
99
+ data: core.output<this>,
100
+ params?: core.ParseContext<core.$ZodIssue>
101
+ ): Promise<parse.ZodSafeParseResult<core.input<this>>>;
102
+ safeDecodeAsync(
103
+ data: core.input<this>,
104
+ params?: core.ParseContext<core.$ZodIssue>
105
+ ): Promise<parse.ZodSafeParseResult<core.output<this>>>;
106
+
107
+ // refinements
108
+ refine<Ch extends (arg: core.output<this>) => unknown | Promise<unknown>>(
109
+ check: Ch,
110
+ params?: string | core.$ZodCustomParams
111
+ ): Ch extends (arg: any) => arg is infer R ? this & ZodType<R, core.input<this>> : this;
112
+ superRefine(
113
+ refinement: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => void | Promise<void>,
114
+ params?: core.$ZodSuperRefineParams
115
+ ): this;
116
+ overwrite(fn: (x: core.output<this>) => core.output<this>): this;
117
+
118
+ // wrappers
119
+ optional(): ZodOptional<this>;
120
+ exactOptional(): ZodExactOptional<this>;
121
+ nonoptional(params?: string | core.$ZodNonOptionalParams): ZodNonOptional<this>;
122
+ nullable(): ZodNullable<this>;
123
+ nullish(): ZodOptional<ZodNullable<this>>;
124
+ default(def: util.NoUndefined<core.output<this>>): ZodDefault<this>;
125
+ default(def: () => util.NoUndefined<core.output<this>>): ZodDefault<this>;
126
+ prefault(def: () => core.input<this>): ZodPrefault<this>;
127
+ prefault(def: core.input<this>): ZodPrefault<this>;
128
+ array(): ZodArray<this>;
129
+ or<T extends core.SomeType>(option: T): ZodUnion<[this, T]>;
130
+ and<T extends core.SomeType>(incoming: T): ZodIntersection<this, T>;
131
+ transform<NewOut>(
132
+ transform: (arg: core.output<this>, ctx: core.$RefinementCtx<core.output<this>>) => NewOut | Promise<NewOut>
133
+ ): ZodPipe<this, ZodTransform<Awaited<NewOut>, core.output<this>>>;
134
+ catch(def: core.output<this>): ZodCatch<this>;
135
+ catch(def: (ctx: core.$ZodCatchCtx) => core.output<this>): ZodCatch<this>;
136
+ pipe<T extends core.$ZodType<any, core.output<this>>>(
137
+ target: T | core.$ZodType<any, core.output<this>>
138
+ ): ZodPipe<this, T>;
139
+ readonly(): ZodReadonly<this>;
140
+
141
+ /** Returns a new instance that has been registered in `z.globalRegistry` with the specified description */
142
+ describe(description: string): this;
143
+ description?: string;
144
+ /** Returns the metadata associated with this instance in `z.globalRegistry` */
145
+ meta(): core.$replace<core.GlobalMeta, this> | undefined;
146
+ /** Returns a new instance that has been registered in `z.globalRegistry` with the specified metadata */
147
+ meta(data: core.$replace<core.GlobalMeta, this>): this;
148
+
149
+ // helpers
150
+ /** @deprecated Try safe-parsing `undefined` (this is what `isOptional` does internally):
151
+ *
152
+ * ```ts
153
+ * const schema = z.string().optional();
154
+ * const isOptional = schema.safeParse(undefined).success; // true
155
+ * ```
156
+ */
157
+ isOptional(): boolean;
158
+ /**
159
+ * @deprecated Try safe-parsing `null` (this is what `isNullable` does internally):
160
+ *
161
+ * ```ts
162
+ * const schema = z.string().nullable();
163
+ * const isNullable = schema.safeParse(null).success; // true
164
+ * ```
165
+ */
166
+ isNullable(): boolean;
167
+ apply<T, TArgs extends unknown[] = []>(fn: (schema: this, ...args: TArgs) => T, ...args: TArgs): T;
168
+ /** Returns a copy whose error messages are replaced, keyed by `"path.check"` (a check's method or `name`), `"path.check.value"` or `"path"` for the schema's own type error. */
169
+ update(messages: ZodUpdateMessages): this;
170
+ }
171
+
172
+ export type ZodUpdateMessages = Record<string, string | core.$ZodErrorMap>;
173
+
174
+ // path segments descend through object shapes, `[]` into array elements, and transparently through wrappers that expose `innerType`; whatever remains selects checks by name and optional value
175
+ function _updateMessage(node: core.$ZodType, key: string, segs: string[], error: core.$ZodErrorMap): core.$ZodType {
176
+ const def = node._zod.def as any;
177
+ if (def.innerType)
178
+ return core.clone(node, { ...def, innerType: _updateMessage(def.innerType, key, segs, error) }, { parent: true });
179
+
180
+ const [seg, ...rest] = segs;
181
+ if (seg !== undefined && def.shape && Object.prototype.hasOwnProperty.call(def.shape, seg)) {
182
+ return core.clone(
183
+ node,
184
+ { ...def, shape: { ...def.shape, [seg]: _updateMessage(def.shape[seg], key, rest, error) } },
185
+ { parent: true }
186
+ );
187
+ }
188
+ if (seg === "[]" && def.element)
189
+ return core.clone(node, { ...def, element: _updateMessage(def.element, key, rest, error) }, { parent: true });
190
+ if (seg === undefined) return core.clone(node, { ...def, error }, { parent: true });
191
+ if (rest.length > 1) throw new Error(`update(): cannot resolve "${key}"`);
192
+ // schemas that act as their own check, e.g. z.int() or z.email()
193
+ if (def.check && _checkMatches(def, seg, rest[0])) return core.clone(node, { ...def, error }, { parent: true });
194
+
195
+ let matched = false;
196
+ const nextChecks = (def.checks ?? []).map((ch: core.$ZodCheck) => {
197
+ if (!_checkMatches(ch._zod.def as any, seg, rest[0])) return ch;
198
+ matched = true;
199
+ return core.clone(ch as any, { ...ch._zod.def, error } as any);
200
+ });
201
+ if (!matched) throw new Error(`update(): no "${seg}" check found for "${key}"`);
202
+ return core.clone(node, { ...def, checks: nextChecks }, { parent: true });
203
+ }
204
+
205
+ function _checkMatches(def: any, name: string, value: string | undefined): boolean {
206
+ if (def.name !== undefined && def.name === name && value === undefined) return true;
207
+ const kind: string = def.check;
208
+ let names: string[];
209
+ let val: unknown;
210
+ if (kind === "min_length" || kind === "min_size") [names, val] = [["min"], def.minimum];
211
+ else if (kind === "max_length" || kind === "max_size") [names, val] = [["max"], def.maximum];
212
+ else if (kind === "length_equals") [names, val] = [["length"], def.length];
213
+ else if (kind === "size_equals") [names, val] = [["size"], def.size];
214
+ else if (kind === "greater_than") [names, val] = [def.inclusive ? ["gte", "min"] : ["gt"], def.value];
215
+ else if (kind === "less_than") [names, val] = [def.inclusive ? ["lte", "max"] : ["lt"], def.value];
216
+ else if (kind === "multiple_of") [names, val] = [["multipleOf", "step"], def.value];
217
+ else if (kind === "string_format" || kind === "number_format" || kind === "bigint_format") {
218
+ names = [def.format, def.format.replace(/_([a-z])/g, (_: string, c: string) => c.toUpperCase())];
219
+ if (kind !== "string_format" && def.format.includes("int")) names.push("int");
220
+ } else if (kind === "custom") names = ["refine"];
221
+ else names = [];
222
+ names.push(kind);
223
+ if (!names.includes(name)) return false;
224
+ return value === undefined || ((typeof val === "number" || typeof val === "bigint") && String(val) === value);
225
+ }
226
+
227
+ export interface _ZodType<out Internals extends core.$ZodTypeInternals = core.$ZodTypeInternals>
228
+ extends ZodType<any, any, Internals> {}
229
+
230
+ export const ZodType: core.$constructor<ZodType> = /*@__PURE__*/ core.$constructor<ZodType>(
231
+ "ZodType",
232
+ (inst, def) => {
233
+ _ensureDefaultLocale();
234
+ core.$ZodType.init(inst, def);
235
+
236
+ inst.def = def;
237
+ inst.type = def.type;
238
+
239
+ return inst;
240
+ },
241
+ {
242
+ check(...chks) {
243
+ const def = this.def;
244
+ return this.clone(
245
+ util.mergeDefs(def, {
246
+ checks: [
247
+ ...(def.checks ?? []),
248
+ ...chks.map((ch) =>
249
+ typeof ch === "function" ? { _zod: { check: ch, def: { check: "custom" }, onattach: [] } } : ch
250
+ ),
251
+ ],
252
+ }),
253
+ { parent: true }
254
+ );
255
+ },
256
+ with(...chks) {
257
+ return this.check(...chks);
258
+ },
259
+ clone(def, params) {
260
+ return core.clone(this, def, params);
261
+ },
262
+ brand() {
263
+ return this;
264
+ },
265
+ register(reg, meta) {
266
+ reg.add(this, meta);
267
+ return this;
268
+ },
269
+ refine(check, params) {
270
+ return this.check(refine(check, params));
271
+ },
272
+ superRefine(refinement, params) {
273
+ return this.check(superRefine(refinement, params));
274
+ },
275
+ overwrite(fn) {
276
+ return this.check(checks.overwrite(fn));
277
+ },
278
+ optional() {
279
+ return optional(this);
280
+ },
281
+ exactOptional() {
282
+ return exactOptional(this);
283
+ },
284
+ nullable() {
285
+ return nullable(this);
286
+ },
287
+ nullish() {
288
+ return optional(nullable(this));
289
+ },
290
+ nonoptional(params) {
291
+ return nonoptional(this, params);
292
+ },
293
+ array() {
294
+ return array(this);
295
+ },
296
+ or(arg) {
297
+ return union([this, arg]);
298
+ },
299
+ and(arg) {
300
+ return intersection(this, arg);
301
+ },
302
+ transform(tx) {
303
+ return pipe(this, transform(tx));
304
+ },
305
+ default(d) {
306
+ return _default(this, d);
307
+ },
308
+ prefault(d) {
309
+ return prefault(this, d);
310
+ },
311
+ catch(params) {
312
+ return _catch(this, params);
313
+ },
314
+ pipe(target) {
315
+ return pipe(this, target);
316
+ },
317
+ readonly() {
318
+ return readonly(this);
319
+ },
320
+ describe(description) {
321
+ const cl = this.clone();
322
+ core.globalRegistry.add(cl, { description });
323
+ return cl;
324
+ },
325
+ meta(...args: any[]): any {
326
+ // overloaded: meta() returns the registered metadata, meta(data) returns a clone with `data` registered. The mapped type picks up the second overload, so we accept variadic any-args and return `any` to satisfy both at runtime.
327
+ if (args.length === 0) return core.globalRegistry.get(this);
328
+ const cl = this.clone();
329
+ core.globalRegistry.add(cl, args[0]);
330
+ return cl;
331
+ },
332
+ isOptional() {
333
+ return this.safeParse(undefined).success;
334
+ },
335
+ isNullable() {
336
+ return this.safeParse(null).success;
337
+ },
338
+ apply(fn, ...args) {
339
+ return args.length === 0 ? fn(this) : fn(this, ...args);
340
+ },
341
+ update(messages) {
342
+ let out: core.$ZodType = this;
343
+ for (const key in messages) {
344
+ const message = messages[key]!;
345
+ out = _updateMessage(
346
+ out,
347
+ key,
348
+ key.split("."),
349
+ (typeof message === "string" ? () => message : message) as core.$ZodErrorMap
350
+ );
351
+ }
352
+ return out as any;
353
+ },
354
+ // Overrides core's `~standard` to add `jsonSchema`. Must stay a prototype entry: redefining it per instance demotes instances to dictionary mode.
355
+ get "~standard"(): ZodType["~standard"] {
356
+ return util.hide(this, "~standard", {
357
+ ...core.standardProps(this),
358
+ jsonSchema: {
359
+ input: createStandardJSONSchemaMethod(this, "input"),
360
+ output: createStandardJSONSchemaMethod(this, "output"),
361
+ },
362
+ } as ZodType["~standard"]);
363
+ },
364
+ set "~standard"(value: ZodType["~standard"]) {
365
+ util.own(this, "~standard", value);
366
+ },
367
+ parse: function _parse(data, params) {
368
+ return parse.parse(this, data, params, { callee: _parse });
369
+ },
370
+ parseAsync: async function _parseAsync(data, params) {
371
+ return await parse.parseAsync(this, data, params, { callee: _parseAsync });
372
+ },
373
+ safeParse(data, params) {
374
+ return parse.safeParse(this, data, params);
375
+ },
376
+ async safeParseAsync(data, params) {
377
+ return parse.safeParseAsync(this, data, params);
378
+ },
379
+ // `spa` is an alias: same function object as `safeParseAsync`, as before.
380
+ get spa(): ZodType["safeParseAsync"] {
381
+ return this?.safeParseAsync;
382
+ },
383
+ set spa(value: ZodType["safeParseAsync"]) {
384
+ util.own(this, "spa", value);
385
+ },
386
+ validate(data, params) {
387
+ return parse.validate(this, data, params);
388
+ },
389
+ validateAsync(data, params) {
390
+ return parse.validateAsync(this, data, params);
391
+ },
392
+ encode: function _encode(data, params) {
393
+ return parse.encode(this, data, params, { callee: _encode });
394
+ },
395
+ decode: function _decode(data, params) {
396
+ return parse.decode(this, data, params, { callee: _decode });
397
+ },
398
+ encodeAsync: async function _encodeAsync(data, params) {
399
+ return await parse.encodeAsync(this, data, params, { callee: _encodeAsync });
400
+ },
401
+ decodeAsync: async function _decodeAsync(data, params) {
402
+ return await parse.decodeAsync(this, data, params, { callee: _decodeAsync });
403
+ },
404
+ safeEncode(data, params) {
405
+ return parse.safeEncode(this, data, params);
406
+ },
407
+ safeDecode(data, params) {
408
+ return parse.safeDecode(this, data, params);
409
+ },
410
+ async safeEncodeAsync(data, params) {
411
+ return parse.safeEncodeAsync(this, data, params);
412
+ },
413
+ async safeDecodeAsync(data, params) {
414
+ return parse.safeDecodeAsync(this, data, params);
415
+ },
416
+ toJSONSchema(params) {
417
+ return createToJSONSchemaMethod(this, {})(params);
418
+ },
419
+ // Reads through to the registry on every access, so it must not cache.
420
+ get description(): string | undefined {
421
+ return core.globalRegistry.get(this as unknown as ZodType)?.description;
422
+ },
423
+ // No setter: `schema._def = x` throws, as it did when `_def` was a non-writable own property.
424
+ get _def(): core.$ZodTypeDef {
425
+ return (this as unknown as ZodType)._zod.def;
426
+ },
427
+ }
428
+ );
429
+
430
+ // ZodString
431
+ export interface _ZodString<T extends core.$ZodStringInternals<unknown> = core.$ZodStringInternals<unknown>>
432
+ extends _ZodType<T> {
433
+ format: string | null;
434
+ minLength: number | null;
435
+ maxLength: number | null;
436
+
437
+ // miscellaneous checks
438
+ regex(regex: RegExp, params?: string | core.$ZodCheckRegexParams): this;
439
+ includes(value: string, params?: string | core.$ZodCheckIncludesParams): this;
440
+ startsWith(value: string, params?: string | core.$ZodCheckStartsWithParams): this;
441
+ endsWith(value: string, params?: string | core.$ZodCheckEndsWithParams): this;
442
+ min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
443
+ max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
444
+ length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
445
+ nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
446
+ lowercase(params?: string | core.$ZodCheckLowerCaseParams): this;
447
+ uppercase(params?: string | core.$ZodCheckUpperCaseParams): this;
448
+
449
+ // transforms
450
+ trim(): this;
451
+ normalize(form?: "NFC" | "NFD" | "NFKC" | "NFKD" | (string & {})): this;
452
+ toLowerCase(): this;
453
+ toUpperCase(): this;
454
+ slugify(): this;
455
+ }
456
+
457
+ /** @internal */
458
+ export const _ZodString: core.$constructor<_ZodString> = /*@__PURE__*/ core.$constructor<_ZodString>(
459
+ "_ZodString",
460
+ (inst, def) => {
461
+ core.$ZodString.init(inst, def);
462
+ ZodType.init(inst, def);
463
+
464
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.stringProcessor(inst, ctx, json, params);
465
+ },
466
+ /*@__PURE__*/ util.derived<_ZodString>(
467
+ {
468
+ format: (inst) => processors.aggregateChecks(inst).format ?? null,
469
+ minLength: (inst) => processors.aggregateChecks<number>(inst).minimum ?? null,
470
+ maxLength: (inst) => processors.aggregateChecks<number>(inst).maximum ?? null,
471
+ },
472
+ {
473
+ regex(...args) {
474
+ return this.check((checks.regex as any)(...args));
475
+ },
476
+ includes(...args) {
477
+ return this.check((checks.includes as any)(...args));
478
+ },
479
+ startsWith(...args) {
480
+ return this.check((checks.startsWith as any)(...args));
481
+ },
482
+ endsWith(...args) {
483
+ return this.check((checks.endsWith as any)(...args));
484
+ },
485
+ min(...args) {
486
+ return this.check((checks.minLength as any)(...args));
487
+ },
488
+ max(...args) {
489
+ return this.check((checks.maxLength as any)(...args));
490
+ },
491
+ length(...args) {
492
+ return this.check((checks.length as any)(...args));
493
+ },
494
+ nonempty(...args) {
495
+ return this.check((checks.minLength as any)(1, ...args));
496
+ },
497
+ lowercase(params) {
498
+ return this.check(checks.lowercase(params));
499
+ },
500
+ uppercase(params) {
501
+ return this.check(checks.uppercase(params));
502
+ },
503
+ trim() {
504
+ return this.check(checks.trim());
505
+ },
506
+ normalize(...args) {
507
+ return this.check(checks.normalize(...args));
508
+ },
509
+ toLowerCase() {
510
+ return this.check(checks.toLowerCase());
511
+ },
512
+ toUpperCase() {
513
+ return this.check(checks.toUpperCase());
514
+ },
515
+ slugify() {
516
+ return this.check(checks.slugify());
517
+ },
518
+ }
519
+ )
520
+ );
521
+
522
+ export interface ZodString extends _ZodString<core.$ZodStringInternals<string>> {
523
+ // string format checks
524
+
525
+ /** @deprecated Use `z.email()` instead. */
526
+ email(params?: string | core.$ZodCheckEmailParams): this;
527
+ /** @deprecated Use `z.url()` instead. */
528
+ url(params?: string | core.$ZodCheckURLParams): this;
529
+ /** @deprecated Use `z.jwt()` instead. */
530
+ jwt(params?: string | core.$ZodCheckJWTParams): this;
531
+ /** @deprecated Use `z.emoji()` instead. */
532
+ emoji(params?: string | core.$ZodCheckEmojiParams): this;
533
+ /** @deprecated Use `z.guid()` instead. */
534
+ guid(params?: string | core.$ZodCheckGUIDParams): this;
535
+ /** @deprecated Use `z.uuid()` instead. */
536
+ uuid(params?: string | core.$ZodCheckUUIDParams): this;
537
+ /** @deprecated Use `z.uuid()` instead. */
538
+ uuidv4(params?: string | core.$ZodCheckUUIDParams): this;
539
+ /** @deprecated Use `z.uuid()` instead. */
540
+ uuidv6(params?: string | core.$ZodCheckUUIDParams): this;
541
+ /** @deprecated Use `z.uuid()` instead. */
542
+ uuidv7(params?: string | core.$ZodCheckUUIDParams): this;
543
+ /** @deprecated Use `z.nanoid()` instead. */
544
+ nanoid(params?: string | core.$ZodCheckNanoIDParams): this;
545
+ /** @deprecated Use `z.guid()` instead. */
546
+ guid(params?: string | core.$ZodCheckGUIDParams): this;
547
+ /**
548
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
549
+ * (timestamps embedded in the id). Use `z.cuid2()` instead.
550
+ * See https://github.com/paralleldrive/cuid.
551
+ */
552
+ cuid(params?: string | core.$ZodCheckCUIDParams): this;
553
+ /** @deprecated Use `z.cuid2()` instead. */
554
+ cuid2(params?: string | core.$ZodCheckCUID2Params): this;
555
+ /** @deprecated Use `z.ulid()` instead. */
556
+ ulid(params?: string | core.$ZodCheckULIDParams): this;
557
+ /** @deprecated Use `z.base64()` instead. */
558
+ base64(params?: string | core.$ZodCheckBase64Params): this;
559
+ /** @deprecated Use `z.base64url()` instead. */
560
+ base64url(params?: string | core.$ZodCheckBase64URLParams): this;
561
+ // /** @deprecated Use `z.jsonString()` instead. */
562
+ // jsonString(params?: string | core.$ZodCheckJSONStringParams): this;
563
+ /** @deprecated Use `z.xid()` instead. */
564
+ xid(params?: string | core.$ZodCheckXIDParams): this;
565
+ /** @deprecated Use `z.ksuid()` instead. */
566
+ ksuid(params?: string | core.$ZodCheckKSUIDParams): this;
567
+ // /** @deprecated Use `z.ipv4()` or `z.ipv6()` instead. */
568
+ // ip(params?: string | (core.$ZodCheckIPv4Params & { version?: "v4" | "v6" })): ZodUnion<[this, this]>;
569
+ /** @deprecated Use `z.ipv4()` instead. */
570
+ ipv4(params?: string | core.$ZodCheckIPv4Params): this;
571
+ /** @deprecated Use `z.ipv6()` instead. */
572
+ ipv6(params?: string | core.$ZodCheckIPv6Params): this;
573
+ /** @deprecated Use `z.cidrv4()` instead. */
574
+ cidrv4(params?: string | core.$ZodCheckCIDRv4Params): this;
575
+ /** @deprecated Use `z.cidrv6()` instead. */
576
+ cidrv6(params?: string | core.$ZodCheckCIDRv6Params): this;
577
+ /** @deprecated Use `z.e164()` instead. */
578
+ e164(params?: string | core.$ZodCheckE164Params): this;
579
+
580
+ // ISO 8601 checks
581
+ /** @deprecated Use `z.iso.datetime()` instead. */
582
+ datetime(params?: string | core.$ZodCheckISODateTimeParams): this;
583
+ /** @deprecated Use `z.iso.date()` instead. */
584
+ date(params?: string | core.$ZodCheckISODateParams): this;
585
+ /** @deprecated Use `z.iso.time()` instead. */
586
+ time(
587
+ params?:
588
+ | string
589
+ // | {
590
+ // message?: string | undefined;
591
+ // precision?: number | null;
592
+ // }
593
+ | core.$ZodCheckISOTimeParams
594
+ ): this;
595
+ /** @deprecated Use `z.iso.duration()` instead. */
596
+ duration(params?: string | core.$ZodCheckISODurationParams): this;
597
+ }
598
+
599
+ export const ZodString: core.$constructor<ZodString> = /*@__PURE__*/ core.$constructor<ZodString>(
600
+ "ZodString",
601
+ (inst, def) => {
602
+ core.$ZodString.init(inst, def);
603
+ _ZodString.init(inst, def);
604
+ },
605
+ {
606
+ email(params) {
607
+ return this.check(core._email(ZodEmail, params));
608
+ },
609
+ url(params) {
610
+ return this.check(core._url(ZodURL, params));
611
+ },
612
+ jwt(params) {
613
+ return this.check(core._jwt(ZodJWT, params));
614
+ },
615
+ emoji(params) {
616
+ return this.check(core._emoji(ZodEmoji, params));
617
+ },
618
+ guid(params) {
619
+ return this.check(core._guid(ZodGUID, params));
620
+ },
621
+ uuid(params) {
622
+ return this.check(core._uuid(ZodUUID, params));
623
+ },
624
+ uuidv4(params) {
625
+ return this.check(core._uuidv4(ZodUUID, params));
626
+ },
627
+ uuidv6(params) {
628
+ return this.check(core._uuidv6(ZodUUID, params));
629
+ },
630
+ uuidv7(params) {
631
+ return this.check(core._uuidv7(ZodUUID, params));
632
+ },
633
+ nanoid(params) {
634
+ return this.check(core._nanoid(ZodNanoID, params));
635
+ },
636
+ cuid(params) {
637
+ return this.check(core._cuid(ZodCUID, params));
638
+ },
639
+ cuid2(params) {
640
+ return this.check(core._cuid2(ZodCUID2, params));
641
+ },
642
+ ulid(params) {
643
+ return this.check(core._ulid(ZodULID, params));
644
+ },
645
+ base64(params) {
646
+ return this.check(core._base64(ZodBase64, params));
647
+ },
648
+ base64url(params) {
649
+ return this.check(core._base64url(ZodBase64URL, params));
650
+ },
651
+ xid(params) {
652
+ return this.check(core._xid(ZodXID, params));
653
+ },
654
+ ksuid(params) {
655
+ return this.check(core._ksuid(ZodKSUID, params));
656
+ },
657
+ ipv4(params) {
658
+ return this.check(core._ipv4(ZodIPv4, params));
659
+ },
660
+ ipv6(params) {
661
+ return this.check(core._ipv6(ZodIPv6, params));
662
+ },
663
+ cidrv4(params) {
664
+ return this.check(core._cidrv4(ZodCIDRv4, params));
665
+ },
666
+ cidrv6(params) {
667
+ return this.check(core._cidrv6(ZodCIDRv6, params));
668
+ },
669
+ e164(params) {
670
+ return this.check(core._e164(ZodE164, params));
671
+ },
672
+ datetime(params) {
673
+ return this.check(core._isoDateTime(ZodISODateTime, params as any));
674
+ },
675
+ date(params) {
676
+ return this.check(core._isoDate(ZodISODate, params as any));
677
+ },
678
+ time(params) {
679
+ return this.check(core._isoTime(ZodISOTime, params as any));
680
+ },
681
+ duration(params) {
682
+ return this.check(core._isoDuration(ZodISODuration, params as any));
683
+ },
684
+ }
685
+ );
686
+
687
+ export function string(params?: string | core.$ZodStringParams): ZodString;
688
+ export function string<T extends string>(params?: string | core.$ZodStringParams): core.$ZodType<T, T>;
689
+ export function string(params?: string | core.$ZodStringParams): ZodString {
690
+ return core._string(ZodString, params);
691
+ }
692
+
693
+ // ZodStringFormat
694
+ export interface ZodStringFormat<Format extends string = string>
695
+ extends _ZodString<core.$ZodStringFormatInternals<Format>> {}
696
+ export const ZodStringFormat: core.$constructor<ZodStringFormat> = /*@__PURE__*/ core.$constructor(
697
+ "ZodStringFormat",
698
+ (inst, def) => {
699
+ core.$ZodStringFormat.init(inst, def);
700
+ _ZodString.init(inst, def);
701
+ }
702
+ );
703
+
704
+ //////////////////////////////////////////////
705
+ //////////////////////////////////////////////
706
+ ////////// //////////
707
+ ////////// ZodISODateTime //////////
708
+ ////////// //////////
709
+ //////////////////////////////////////////////
710
+ //////////////////////////////////////////////
711
+ export interface ZodISODateTime extends ZodStringFormat {
712
+ _zod: core.$ZodISODateTimeInternals;
713
+ }
714
+ export const ZodISODateTime: core.$constructor<ZodISODateTime> = /*@__PURE__*/ core.$constructor(
715
+ "ZodISODateTime",
716
+ (inst, def) => {
717
+ core.$ZodISODateTime.init(inst, def);
718
+ ZodStringFormat.init(inst, def);
719
+ }
720
+ );
721
+
722
+ //////////////////////////////////////////
723
+ //////////////////////////////////////////
724
+ ////////// //////////
725
+ ////////// ZodISODate //////////
726
+ ////////// //////////
727
+ //////////////////////////////////////////
728
+ //////////////////////////////////////////
729
+ export interface ZodISODate extends ZodStringFormat {
730
+ _zod: core.$ZodISODateInternals;
731
+ }
732
+ export const ZodISODate: core.$constructor<ZodISODate> = /*@__PURE__*/ core.$constructor("ZodISODate", (inst, def) => {
733
+ core.$ZodISODate.init(inst, def);
734
+ ZodStringFormat.init(inst, def);
735
+ });
736
+
737
+ //////////////////////////////////////////
738
+ //////////////////////////////////////////
739
+ ////////// //////////
740
+ ////////// ZodISOTime //////////
741
+ ////////// //////////
742
+ //////////////////////////////////////////
743
+ //////////////////////////////////////////
744
+ export interface ZodISOTime extends ZodStringFormat {
745
+ _zod: core.$ZodISOTimeInternals;
746
+ }
747
+ export const ZodISOTime: core.$constructor<ZodISOTime> = /*@__PURE__*/ core.$constructor("ZodISOTime", (inst, def) => {
748
+ core.$ZodISOTime.init(inst, def);
749
+ ZodStringFormat.init(inst, def);
750
+ });
751
+
752
+ //////////////////////////////////////////////
753
+ //////////////////////////////////////////////
754
+ ////////// //////////
755
+ ////////// ZodISODuration //////////
756
+ ////////// //////////
757
+ //////////////////////////////////////////////
758
+ //////////////////////////////////////////////
759
+ export interface ZodISODuration extends ZodStringFormat {
760
+ _zod: core.$ZodISODurationInternals;
761
+ }
762
+ export const ZodISODuration: core.$constructor<ZodISODuration> = /*@__PURE__*/ core.$constructor(
763
+ "ZodISODuration",
764
+ (inst, def) => {
765
+ core.$ZodISODuration.init(inst, def);
766
+ ZodStringFormat.init(inst, def);
767
+ }
768
+ );
769
+
770
+ // ZodEmail
771
+ export interface ZodEmail extends ZodStringFormat<"email"> {
772
+ _zod: core.$ZodEmailInternals;
773
+ }
774
+ export const ZodEmail: core.$constructor<ZodEmail> = /*@__PURE__*/ core.$constructor("ZodEmail", (inst, def) => {
775
+ // ZodStringFormat.init(inst, def);
776
+ core.$ZodEmail.init(inst, def);
777
+ ZodStringFormat.init(inst, def);
778
+ });
779
+
780
+ export function email(params?: string | core.$ZodEmailParams): ZodEmail {
781
+ return core._email(ZodEmail, params);
782
+ }
783
+
784
+ // ZodGUID
785
+ export interface ZodGUID extends ZodStringFormat<"guid"> {
786
+ _zod: core.$ZodGUIDInternals;
787
+ }
788
+ export const ZodGUID: core.$constructor<ZodGUID> = /*@__PURE__*/ core.$constructor("ZodGUID", (inst, def) => {
789
+ // ZodStringFormat.init(inst, def);
790
+ core.$ZodGUID.init(inst, def);
791
+ ZodStringFormat.init(inst, def);
792
+ });
793
+
794
+ export function guid(params?: string | core.$ZodGUIDParams): ZodGUID {
795
+ return core._guid(ZodGUID, params);
796
+ }
797
+
798
+ // ZodUUID
799
+ export interface ZodUUID extends ZodStringFormat<"uuid"> {
800
+ _zod: core.$ZodUUIDInternals;
801
+ }
802
+ export const ZodUUID: core.$constructor<ZodUUID> = /*@__PURE__*/ core.$constructor("ZodUUID", (inst, def) => {
803
+ // ZodStringFormat.init(inst, def);
804
+ core.$ZodUUID.init(inst, def);
805
+ ZodStringFormat.init(inst, def);
806
+ });
807
+
808
+ export function uuid(params?: string | core.$ZodUUIDParams): ZodUUID {
809
+ return core._uuid(ZodUUID, params);
810
+ }
811
+
812
+ export function uuidv4(params?: string | core.$ZodUUIDv4Params): ZodUUID {
813
+ return core._uuidv4(ZodUUID, params);
814
+ }
815
+
816
+ // ZodUUIDv6
817
+
818
+ export function uuidv6(params?: string | core.$ZodUUIDv6Params): ZodUUID {
819
+ return core._uuidv6(ZodUUID, params);
820
+ }
821
+
822
+ // ZodUUIDv7
823
+
824
+ export function uuidv7(params?: string | core.$ZodUUIDv7Params): ZodUUID {
825
+ return core._uuidv7(ZodUUID, params);
826
+ }
827
+
828
+ // ZodURL
829
+ export interface ZodURL extends ZodStringFormat<"url"> {
830
+ _zod: core.$ZodURLInternals;
831
+ }
832
+ export const ZodURL: core.$constructor<ZodURL> = /*@__PURE__*/ core.$constructor("ZodURL", (inst, def) => {
833
+ // ZodStringFormat.init(inst, def);
834
+ core.$ZodURL.init(inst, def);
835
+ ZodStringFormat.init(inst, def);
836
+ });
837
+
838
+ export function url(params?: string | core.$ZodURLParams): ZodURL {
839
+ return core._url(ZodURL, params);
840
+ }
841
+
842
+ export function httpUrl(params?: string | Omit<core.$ZodURLParams, "protocol" | "hostname">): ZodURL {
843
+ return core._url(ZodURL, {
844
+ protocol: regexes.httpProtocol,
845
+ hostname: regexes.domain,
846
+ ...util.normalizeParams(params),
847
+ });
848
+ }
849
+
850
+ // ZodEmoji
851
+ export interface ZodEmoji extends ZodStringFormat<"emoji"> {
852
+ _zod: core.$ZodEmojiInternals;
853
+ }
854
+ export const ZodEmoji: core.$constructor<ZodEmoji> = /*@__PURE__*/ core.$constructor("ZodEmoji", (inst, def) => {
855
+ // ZodStringFormat.init(inst, def);
856
+ core.$ZodEmoji.init(inst, def);
857
+ ZodStringFormat.init(inst, def);
858
+ });
859
+
860
+ export function emoji(params?: string | core.$ZodEmojiParams): ZodEmoji {
861
+ return core._emoji(ZodEmoji, params);
862
+ }
863
+
864
+ // ZodNanoID
865
+ export interface ZodNanoID extends ZodStringFormat<"nanoid"> {
866
+ _zod: core.$ZodNanoIDInternals;
867
+ }
868
+ export const ZodNanoID: core.$constructor<ZodNanoID> = /*@__PURE__*/ core.$constructor("ZodNanoID", (inst, def) => {
869
+ // ZodStringFormat.init(inst, def);
870
+ core.$ZodNanoID.init(inst, def);
871
+ ZodStringFormat.init(inst, def);
872
+ });
873
+
874
+ export function nanoid(params?: string | core.$ZodNanoIDParams): ZodNanoID {
875
+ return core._nanoid(ZodNanoID, params);
876
+ }
877
+
878
+ // ZodCUID
879
+ /**
880
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
881
+ * (timestamps embedded in the id). Use {@link ZodCUID2} instead.
882
+ * See https://github.com/paralleldrive/cuid.
883
+ */
884
+ export interface ZodCUID extends ZodStringFormat<"cuid"> {
885
+ _zod: core.$ZodCUIDInternals;
886
+ }
887
+ /**
888
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
889
+ * (timestamps embedded in the id). Use {@link ZodCUID2} instead.
890
+ * See https://github.com/paralleldrive/cuid.
891
+ */
892
+ export const ZodCUID: core.$constructor<ZodCUID> = /*@__PURE__*/ core.$constructor("ZodCUID", (inst, def) => {
893
+ // ZodStringFormat.init(inst, def);
894
+ core.$ZodCUID.init(inst, def);
895
+ ZodStringFormat.init(inst, def);
896
+ });
897
+
898
+ /**
899
+ * Validates a CUID v1 string.
900
+ *
901
+ * @deprecated CUID v1 is deprecated by its authors due to information leakage
902
+ * (timestamps embedded in the id). Use {@link cuid2 | `z.cuid2()`} instead.
903
+ * See https://github.com/paralleldrive/cuid.
904
+ */
905
+ export function cuid(params?: string | core.$ZodCUIDParams): ZodCUID {
906
+ return core._cuid(ZodCUID, params);
907
+ }
908
+
909
+ // ZodCUID2
910
+ export interface ZodCUID2 extends ZodStringFormat<"cuid2"> {
911
+ _zod: core.$ZodCUID2Internals;
912
+ }
913
+ export const ZodCUID2: core.$constructor<ZodCUID2> = /*@__PURE__*/ core.$constructor("ZodCUID2", (inst, def) => {
914
+ // ZodStringFormat.init(inst, def);
915
+ core.$ZodCUID2.init(inst, def);
916
+ ZodStringFormat.init(inst, def);
917
+ });
918
+
919
+ export function cuid2(params?: string | core.$ZodCUID2Params): ZodCUID2 {
920
+ return core._cuid2(ZodCUID2, params);
921
+ }
922
+
923
+ // ZodULID
924
+ export interface ZodULID extends ZodStringFormat<"ulid"> {
925
+ _zod: core.$ZodULIDInternals;
926
+ }
927
+ export const ZodULID: core.$constructor<ZodULID> = /*@__PURE__*/ core.$constructor("ZodULID", (inst, def) => {
928
+ // ZodStringFormat.init(inst, def);
929
+ core.$ZodULID.init(inst, def);
930
+ ZodStringFormat.init(inst, def);
931
+ });
932
+
933
+ export function ulid(params?: string | core.$ZodULIDParams): ZodULID {
934
+ return core._ulid(ZodULID, params);
935
+ }
936
+
937
+ // ZodXID
938
+ export interface ZodXID extends ZodStringFormat<"xid"> {
939
+ _zod: core.$ZodXIDInternals;
940
+ }
941
+ export const ZodXID: core.$constructor<ZodXID> = /*@__PURE__*/ core.$constructor("ZodXID", (inst, def) => {
942
+ // ZodStringFormat.init(inst, def);
943
+ core.$ZodXID.init(inst, def);
944
+ ZodStringFormat.init(inst, def);
945
+ });
946
+
947
+ export function xid(params?: string | core.$ZodXIDParams): ZodXID {
948
+ return core._xid(ZodXID, params);
949
+ }
950
+
951
+ // ZodKSUID
952
+ export interface ZodKSUID extends ZodStringFormat<"ksuid"> {
953
+ _zod: core.$ZodKSUIDInternals;
954
+ }
955
+ export const ZodKSUID: core.$constructor<ZodKSUID> = /*@__PURE__*/ core.$constructor("ZodKSUID", (inst, def) => {
956
+ // ZodStringFormat.init(inst, def);
957
+ core.$ZodKSUID.init(inst, def);
958
+ ZodStringFormat.init(inst, def);
959
+ });
960
+
961
+ export function ksuid(params?: string | core.$ZodKSUIDParams): ZodKSUID {
962
+ return core._ksuid(ZodKSUID, params);
963
+ }
964
+
965
+ // ZodIP
966
+ // export interface ZodIP extends ZodStringFormat<"ip"> {
967
+ // _zod: core.$ZodIPInternals;
968
+ // }
969
+ // export const ZodIP: core.$constructor<ZodIP> = /*@__PURE__*/ core.$constructor("ZodIP", (inst, def) => {
970
+ // // ZodStringFormat.init(inst, def);
971
+ // core.$ZodIP.init(inst, def);
972
+ // ZodStringFormat.init(inst, def);
973
+ // });
974
+
975
+ // export function ip(params?: string | core.$ZodIPParams): ZodIP {
976
+ // return core._ip(ZodIP, params);
977
+ // }
978
+
979
+ // ZodIPv4
980
+ export interface ZodIPv4 extends ZodStringFormat<"ipv4"> {
981
+ _zod: core.$ZodIPv4Internals;
982
+ }
983
+ export const ZodIPv4: core.$constructor<ZodIPv4> = /*@__PURE__*/ core.$constructor("ZodIPv4", (inst, def) => {
984
+ // ZodStringFormat.init(inst, def);
985
+ core.$ZodIPv4.init(inst, def);
986
+ ZodStringFormat.init(inst, def);
987
+ });
988
+
989
+ export function ipv4(params?: string | core.$ZodIPv4Params): ZodIPv4 {
990
+ return core._ipv4(ZodIPv4, params);
991
+ }
992
+
993
+ // ZodMAC
994
+ export interface ZodMAC extends ZodStringFormat<"mac"> {
995
+ _zod: core.$ZodMACInternals;
996
+ }
997
+ export const ZodMAC: core.$constructor<ZodMAC> = /*@__PURE__*/ core.$constructor("ZodMAC", (inst, def) => {
998
+ // ZodStringFormat.init(inst, def);
999
+ core.$ZodMAC.init(inst, def);
1000
+ ZodStringFormat.init(inst, def);
1001
+ });
1002
+ export function mac(params?: string | core.$ZodMACParams): ZodMAC {
1003
+ return core._mac(ZodMAC, params);
1004
+ }
1005
+
1006
+ // ZodIPv6
1007
+ export interface ZodIPv6 extends ZodStringFormat<"ipv6"> {
1008
+ _zod: core.$ZodIPv6Internals;
1009
+ }
1010
+ export const ZodIPv6: core.$constructor<ZodIPv6> = /*@__PURE__*/ core.$constructor("ZodIPv6", (inst, def) => {
1011
+ // ZodStringFormat.init(inst, def);
1012
+ core.$ZodIPv6.init(inst, def);
1013
+ ZodStringFormat.init(inst, def);
1014
+ });
1015
+ export function ipv6(params?: string | core.$ZodIPv6Params): ZodIPv6 {
1016
+ return core._ipv6(ZodIPv6, params);
1017
+ }
1018
+
1019
+ // ZodCIDRv4
1020
+ export interface ZodCIDRv4 extends ZodStringFormat<"cidrv4"> {
1021
+ _zod: core.$ZodCIDRv4Internals;
1022
+ }
1023
+ export const ZodCIDRv4: core.$constructor<ZodCIDRv4> = /*@__PURE__*/ core.$constructor("ZodCIDRv4", (inst, def) => {
1024
+ core.$ZodCIDRv4.init(inst, def);
1025
+ ZodStringFormat.init(inst, def);
1026
+ });
1027
+
1028
+ export function cidrv4(params?: string | core.$ZodCIDRv4Params): ZodCIDRv4 {
1029
+ return core._cidrv4(ZodCIDRv4, params);
1030
+ }
1031
+
1032
+ // ZodCIDRv6
1033
+ export interface ZodCIDRv6 extends ZodStringFormat<"cidrv6"> {
1034
+ _zod: core.$ZodCIDRv6Internals;
1035
+ }
1036
+ export const ZodCIDRv6: core.$constructor<ZodCIDRv6> = /*@__PURE__*/ core.$constructor("ZodCIDRv6", (inst, def) => {
1037
+ core.$ZodCIDRv6.init(inst, def);
1038
+ ZodStringFormat.init(inst, def);
1039
+ });
1040
+
1041
+ export function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodCIDRv6 {
1042
+ return core._cidrv6(ZodCIDRv6, params);
1043
+ }
1044
+
1045
+ // ZodBase64
1046
+ export interface ZodBase64 extends ZodStringFormat<"base64"> {
1047
+ _zod: core.$ZodBase64Internals;
1048
+ }
1049
+ export const ZodBase64: core.$constructor<ZodBase64> = /*@__PURE__*/ core.$constructor("ZodBase64", (inst, def) => {
1050
+ // ZodStringFormat.init(inst, def);
1051
+ core.$ZodBase64.init(inst, def);
1052
+ ZodStringFormat.init(inst, def);
1053
+ });
1054
+ export function base64(params?: string | core.$ZodBase64Params): ZodBase64 {
1055
+ return core._base64(ZodBase64, params);
1056
+ }
1057
+
1058
+ // ZodBase64URL
1059
+ export interface ZodBase64URL extends ZodStringFormat<"base64url"> {
1060
+ _zod: core.$ZodBase64URLInternals;
1061
+ }
1062
+ export const ZodBase64URL: core.$constructor<ZodBase64URL> = /*@__PURE__*/ core.$constructor(
1063
+ "ZodBase64URL",
1064
+ (inst, def) => {
1065
+ // ZodStringFormat.init(inst, def);
1066
+ core.$ZodBase64URL.init(inst, def);
1067
+ ZodStringFormat.init(inst, def);
1068
+ }
1069
+ );
1070
+ export function base64url(params?: string | core.$ZodBase64URLParams): ZodBase64URL {
1071
+ return core._base64url(ZodBase64URL, params);
1072
+ }
1073
+
1074
+ // ZodE164
1075
+ export interface ZodE164 extends ZodStringFormat<"e164"> {
1076
+ _zod: core.$ZodE164Internals;
1077
+ }
1078
+ export const ZodE164: core.$constructor<ZodE164> = /*@__PURE__*/ core.$constructor("ZodE164", (inst, def) => {
1079
+ // ZodStringFormat.init(inst, def);
1080
+ core.$ZodE164.init(inst, def);
1081
+ ZodStringFormat.init(inst, def);
1082
+ });
1083
+
1084
+ export function e164(params?: string | core.$ZodE164Params): ZodE164 {
1085
+ return core._e164(ZodE164, params);
1086
+ }
1087
+
1088
+ // ZodCreditCard
1089
+ export interface ZodCreditCard extends ZodStringFormat<"credit_card"> {
1090
+ _zod: core.$ZodCreditCardInternals;
1091
+ }
1092
+ export const ZodCreditCard: core.$constructor<ZodCreditCard> = /*@__PURE__*/ core.$constructor(
1093
+ "ZodCreditCard",
1094
+ (inst, def) => {
1095
+ core.$ZodCreditCard.init(inst, def);
1096
+ ZodStringFormat.init(inst, def);
1097
+ }
1098
+ );
1099
+
1100
+ export function creditCard(params?: string | core.$ZodCreditCardParams): ZodCreditCard {
1101
+ return core._creditCard(ZodCreditCard, params);
1102
+ }
1103
+
1104
+ // ZodIBAN
1105
+ export interface ZodIBAN extends ZodStringFormat<"iban"> {
1106
+ _zod: core.$ZodIBANInternals;
1107
+ }
1108
+ export const ZodIBAN: core.$constructor<ZodIBAN> = /*@__PURE__*/ core.$constructor("ZodIBAN", (inst, def) => {
1109
+ core.$ZodIBAN.init(inst, def);
1110
+ ZodStringFormat.init(inst, def);
1111
+ });
1112
+
1113
+ export function iban(params?: string | core.$ZodIBANParams): ZodIBAN {
1114
+ return core._iban(ZodIBAN, params);
1115
+ }
1116
+
1117
+ // ZodJWT
1118
+ export interface ZodJWT extends ZodStringFormat<"jwt"> {
1119
+ _zod: core.$ZodJWTInternals;
1120
+ }
1121
+ export const ZodJWT: core.$constructor<ZodJWT> = /*@__PURE__*/ core.$constructor("ZodJWT", (inst, def) => {
1122
+ // ZodStringFormat.init(inst, def);
1123
+ core.$ZodJWT.init(inst, def);
1124
+ ZodStringFormat.init(inst, def);
1125
+ });
1126
+
1127
+ export function jwt(params?: string | core.$ZodJWTParams): ZodJWT {
1128
+ return core._jwt(ZodJWT, params);
1129
+ }
1130
+
1131
+ // ZodCustomStringFormat
1132
+ export interface ZodCustomStringFormat<Format extends string = string>
1133
+ extends ZodStringFormat<Format>,
1134
+ core.$ZodCustomStringFormat<Format> {
1135
+ _zod: core.$ZodCustomStringFormatInternals<Format>;
1136
+ "~standard": ZodStandardSchemaWithJSON<this>;
1137
+ }
1138
+ export const ZodCustomStringFormat: core.$constructor<ZodCustomStringFormat> = /*@__PURE__*/ core.$constructor(
1139
+ "ZodCustomStringFormat",
1140
+ (inst, def) => {
1141
+ // ZodStringFormat.init(inst, def);
1142
+ core.$ZodCustomStringFormat.init(inst, def);
1143
+ ZodStringFormat.init(inst, def);
1144
+ }
1145
+ );
1146
+ export function stringFormat<Format extends string>(
1147
+ format: Format,
1148
+ fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp,
1149
+ _params: string | core.$ZodStringFormatParams = {}
1150
+ ): ZodCustomStringFormat<Format> {
1151
+ return core._stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params) as any;
1152
+ }
1153
+
1154
+ export function hostname(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"hostname"> {
1155
+ return core._stringFormat(ZodCustomStringFormat, "hostname", regexes.hostname, _params) as any;
1156
+ }
1157
+
1158
+ export function hex(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"hex"> {
1159
+ return core._stringFormat(ZodCustomStringFormat, "hex", regexes.hex, _params) as any;
1160
+ }
1161
+
1162
+ export function currencyCode(_params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<"currency_code"> {
1163
+ return core._stringFormat(ZodCustomStringFormat, "currency_code", regexes.currencyCode, _params) as any;
1164
+ }
1165
+
1166
+ export function hash<Alg extends util.HashAlgorithm, Enc extends util.HashEncoding = "hex">(
1167
+ alg: Alg,
1168
+ params?: {
1169
+ enc?: Enc;
1170
+ } & core.$ZodStringFormatParams
1171
+ ): ZodCustomStringFormat<`${Alg}_${Enc}`> {
1172
+ const enc = params?.enc ?? "hex";
1173
+ const format = `${alg}_${enc}` as const;
1174
+ const regex = core.regexes[format as keyof typeof core.regexes] as RegExp;
1175
+ if (!regex) throw new Error(`Unrecognized hash format: ${format}`);
1176
+ return core._stringFormat(ZodCustomStringFormat, format, regex, params) as any;
1177
+ }
1178
+
1179
+ // ZodNumber
1180
+ export interface _ZodNumber<Internals extends core.$ZodNumberInternals = core.$ZodNumberInternals>
1181
+ extends _ZodType<Internals> {
1182
+ gt(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
1183
+ /** Identical to .min() */
1184
+ gte(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
1185
+ min(value: number, params?: string | core.$ZodCheckGreaterThanParams): this;
1186
+ lt(value: number, params?: string | core.$ZodCheckLessThanParams): this;
1187
+ /** Identical to .max() */
1188
+ lte(value: number, params?: string | core.$ZodCheckLessThanParams): this;
1189
+ max(value: number, params?: string | core.$ZodCheckLessThanParams): this;
1190
+ /** Consider `z.int()` instead. This API is considered *legacy*; it will never be removed but a better alternative exists. */
1191
+ int(params?: string | core.$ZodCheckNumberFormatParams): this;
1192
+ /** @deprecated This is now identical to `.int()`. Only numbers in the safe integer range are accepted. */
1193
+ safe(params?: string | core.$ZodCheckNumberFormatParams): this;
1194
+ positive(params?: string | core.$ZodCheckGreaterThanParams): this;
1195
+ nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
1196
+ negative(params?: string | core.$ZodCheckLessThanParams): this;
1197
+ nonpositive(params?: string | core.$ZodCheckLessThanParams): this;
1198
+ multipleOf(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
1199
+ /** @deprecated Use `.multipleOf()` instead. */
1200
+ step(value: number, params?: string | core.$ZodCheckMultipleOfParams): this;
1201
+
1202
+ /** @deprecated In v4 and later, z.number() does not allow infinite values by default. This is a no-op. */
1203
+ finite(params?: unknown): this;
1204
+
1205
+ minValue: number | null;
1206
+ maxValue: number | null;
1207
+ /** @deprecated Check the `format` property instead. */
1208
+ isInt: boolean;
1209
+ /** @deprecated Number schemas no longer accept infinite values, so this always returns `true`. */
1210
+ isFinite: boolean;
1211
+ format: string | null;
1212
+ }
1213
+
1214
+ export interface ZodNumber extends _ZodNumber<core.$ZodNumberInternals<number>> {}
1215
+
1216
+ export const ZodNumber: core.$constructor<ZodNumber> = /*@__PURE__*/ core.$constructor<ZodNumber>(
1217
+ "ZodNumber",
1218
+ (inst, def) => {
1219
+ core.$ZodNumber.init(inst, def);
1220
+
1221
+ ZodType.init(inst, def);
1222
+
1223
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.numberProcessor(inst, ctx, json, params);
1224
+ inst.isFinite = true;
1225
+ },
1226
+ /*@__PURE__*/ util.derived<ZodNumber>(
1227
+ {
1228
+ minValue: (inst) => {
1229
+ const { minimum, exclusiveMinimum } = processors.aggregateChecks<number>(inst);
1230
+ return Math.max(minimum ?? Number.NEGATIVE_INFINITY, exclusiveMinimum ?? Number.NEGATIVE_INFINITY);
1231
+ },
1232
+ maxValue: (inst) => {
1233
+ const { maximum, exclusiveMaximum } = processors.aggregateChecks<number>(inst);
1234
+ return Math.min(maximum ?? Number.POSITIVE_INFINITY, exclusiveMaximum ?? Number.POSITIVE_INFINITY);
1235
+ },
1236
+ isInt: (inst) => {
1237
+ const { isInt, multipleOf } = processors.aggregateChecks(inst);
1238
+ return !!isInt || !!multipleOf?.some(Number.isSafeInteger);
1239
+ },
1240
+ format: (inst) => processors.aggregateChecks(inst).format ?? null,
1241
+ },
1242
+ {
1243
+ gt(value, params) {
1244
+ return this.check(checks.gt(value, params));
1245
+ },
1246
+ gte(value, params) {
1247
+ return this.check(checks.gte(value, params));
1248
+ },
1249
+ min(value, params) {
1250
+ return this.check(checks.gte(value, params));
1251
+ },
1252
+ lt(value, params) {
1253
+ return this.check(checks.lt(value, params));
1254
+ },
1255
+ lte(value, params) {
1256
+ return this.check(checks.lte(value, params));
1257
+ },
1258
+ max(value, params) {
1259
+ return this.check(checks.lte(value, params));
1260
+ },
1261
+ int(params) {
1262
+ return this.check(int(params));
1263
+ },
1264
+ safe(params) {
1265
+ return this.check(int(params));
1266
+ },
1267
+ positive(params) {
1268
+ return this.check(checks.gt(0, params));
1269
+ },
1270
+ nonnegative(params) {
1271
+ return this.check(checks.gte(0, params));
1272
+ },
1273
+ negative(params) {
1274
+ return this.check(checks.lt(0, params));
1275
+ },
1276
+ nonpositive(params) {
1277
+ return this.check(checks.lte(0, params));
1278
+ },
1279
+ multipleOf(value, params) {
1280
+ return this.check(checks.multipleOf(value, params));
1281
+ },
1282
+ step(value, params) {
1283
+ return this.check(checks.multipleOf(value, params));
1284
+ },
1285
+ finite() {
1286
+ return this;
1287
+ },
1288
+ }
1289
+ )
1290
+ );
1291
+
1292
+ export function number(params?: string | core.$ZodNumberParams): ZodNumber {
1293
+ return core._number(ZodNumber, params);
1294
+ }
1295
+
1296
+ // ZodNumberFormat
1297
+ export interface ZodNumberFormat<Format extends $ZodNumberFormats = $ZodNumberFormats> extends ZodNumber {
1298
+ _zod: core.$ZodNumberFormatInternals<Format>;
1299
+ }
1300
+ export const ZodNumberFormat: core.$constructor<ZodNumberFormat> = /*@__PURE__*/ core.$constructor(
1301
+ "ZodNumberFormat",
1302
+ (inst, def) => {
1303
+ core.$ZodNumberFormat.init(inst, def);
1304
+ ZodNumber.init(inst, def);
1305
+ }
1306
+ );
1307
+
1308
+ // int
1309
+ export interface ZodInt extends ZodNumberFormat<"safeint"> {}
1310
+ export function int(params?: string | core.$ZodCheckNumberFormatParams): ZodInt {
1311
+ return core._int(ZodNumberFormat, params) as ZodInt;
1312
+ }
1313
+
1314
+ // float32
1315
+ export interface ZodFloat32 extends ZodNumberFormat<"float32"> {}
1316
+ export function float32(params?: string | core.$ZodCheckNumberFormatParams): ZodFloat32 {
1317
+ return core._float32(ZodNumberFormat, params) as ZodFloat32;
1318
+ }
1319
+
1320
+ // float64
1321
+ export interface ZodFloat64 extends ZodNumberFormat<"float64"> {}
1322
+ export function float64(params?: string | core.$ZodCheckNumberFormatParams): ZodFloat64 {
1323
+ return core._float64(ZodNumberFormat, params) as ZodFloat64;
1324
+ }
1325
+
1326
+ // int32
1327
+ export interface ZodInt32 extends ZodNumberFormat<"int32"> {}
1328
+ export function int32(params?: string | core.$ZodCheckNumberFormatParams): ZodInt32 {
1329
+ return core._int32(ZodNumberFormat, params) as ZodInt32;
1330
+ }
1331
+
1332
+ // uint32
1333
+ export interface ZodUInt32 extends ZodNumberFormat<"uint32"> {}
1334
+ export function uint32(params?: string | core.$ZodCheckNumberFormatParams): ZodUInt32 {
1335
+ return core._uint32(ZodNumberFormat, params) as ZodUInt32;
1336
+ }
1337
+
1338
+ // boolean
1339
+ export interface _ZodBoolean<T extends core.$ZodBooleanInternals = core.$ZodBooleanInternals> extends _ZodType<T> {}
1340
+ export interface ZodBoolean extends _ZodBoolean<core.$ZodBooleanInternals<boolean>> {}
1341
+ export const ZodBoolean: core.$constructor<ZodBoolean> = /*@__PURE__*/ core.$constructor("ZodBoolean", (inst, def) => {
1342
+ core.$ZodBoolean.init(inst, def);
1343
+ ZodType.init(inst, def);
1344
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.booleanProcessor(inst, ctx, json, params);
1345
+ });
1346
+
1347
+ export function boolean(params?: string | core.$ZodBooleanParams): ZodBoolean {
1348
+ return core._boolean(ZodBoolean, params);
1349
+ }
1350
+
1351
+ // bigint
1352
+ export interface _ZodBigInt<T extends core.$ZodBigIntInternals = core.$ZodBigIntInternals> extends _ZodType<T> {
1353
+ gte(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
1354
+ /** Alias of `.gte()` */
1355
+ min(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
1356
+ gt(value: bigint, params?: string | core.$ZodCheckGreaterThanParams): this;
1357
+ /** Alias of `.lte()` */
1358
+ lte(value: bigint, params?: string | core.$ZodCheckLessThanParams): this;
1359
+ max(value: bigint, params?: string | core.$ZodCheckLessThanParams): this;
1360
+ lt(value: bigint, params?: string | core.$ZodCheckLessThanParams): this;
1361
+ positive(params?: string | core.$ZodCheckGreaterThanParams): this;
1362
+ negative(params?: string | core.$ZodCheckLessThanParams): this;
1363
+ nonpositive(params?: string | core.$ZodCheckLessThanParams): this;
1364
+ nonnegative(params?: string | core.$ZodCheckGreaterThanParams): this;
1365
+ multipleOf(value: bigint, params?: string | core.$ZodCheckMultipleOfParams): this;
1366
+
1367
+ minValue: bigint | null;
1368
+ maxValue: bigint | null;
1369
+ format: string | null;
1370
+ }
1371
+
1372
+ export interface ZodBigInt extends _ZodBigInt<core.$ZodBigIntInternals<bigint>> {}
1373
+ export const ZodBigInt: core.$constructor<ZodBigInt> = /*@__PURE__*/ core.$constructor<ZodBigInt>(
1374
+ "ZodBigInt",
1375
+ (inst, def) => {
1376
+ core.$ZodBigInt.init(inst, def);
1377
+ ZodType.init(inst, def);
1378
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.bigintProcessor(inst, ctx, json, params);
1379
+ },
1380
+ /*@__PURE__*/ util.derived<ZodBigInt>(
1381
+ {
1382
+ minValue: (inst) => processors.aggregateChecks<bigint>(inst).minimum ?? null,
1383
+ maxValue: (inst) => processors.aggregateChecks<bigint>(inst).maximum ?? null,
1384
+ format: (inst) => processors.aggregateChecks(inst).format ?? null,
1385
+ },
1386
+ {
1387
+ gte(value, params) {
1388
+ return this.check(checks.gte(value, params));
1389
+ },
1390
+ min(value, params) {
1391
+ return this.check(checks.gte(value, params));
1392
+ },
1393
+ gt(value, params) {
1394
+ return this.check(checks.gt(value, params));
1395
+ },
1396
+ lt(value, params) {
1397
+ return this.check(checks.lt(value, params));
1398
+ },
1399
+ lte(value, params) {
1400
+ return this.check(checks.lte(value, params));
1401
+ },
1402
+ max(value, params) {
1403
+ return this.check(checks.lte(value, params));
1404
+ },
1405
+ positive(params) {
1406
+ return this.check(checks.gt(BigInt(0), params));
1407
+ },
1408
+ negative(params) {
1409
+ return this.check(checks.lt(BigInt(0), params));
1410
+ },
1411
+ nonpositive(params) {
1412
+ return this.check(checks.lte(BigInt(0), params));
1413
+ },
1414
+ nonnegative(params) {
1415
+ return this.check(checks.gte(BigInt(0), params));
1416
+ },
1417
+ multipleOf(value, params) {
1418
+ return this.check(checks.multipleOf(value, params));
1419
+ },
1420
+ }
1421
+ )
1422
+ );
1423
+
1424
+ export function bigint(params?: string | core.$ZodBigIntParams): ZodBigInt {
1425
+ return core._bigint(ZodBigInt, params);
1426
+ }
1427
+ // bigint formats
1428
+
1429
+ // ZodBigIntFormat
1430
+ export interface ZodBigIntFormat<Format extends $ZodBigIntFormats = $ZodBigIntFormats> extends ZodBigInt {
1431
+ _zod: core.$ZodBigIntFormatInternals<Format>;
1432
+ }
1433
+ export const ZodBigIntFormat: core.$constructor<ZodBigIntFormat> = /*@__PURE__*/ core.$constructor(
1434
+ "ZodBigIntFormat",
1435
+ (inst, def) => {
1436
+ core.$ZodBigIntFormat.init(inst, def);
1437
+ ZodBigInt.init(inst, def);
1438
+ }
1439
+ );
1440
+
1441
+ // int64
1442
+ export interface ZodInt64 extends ZodBigIntFormat<"int64"> {}
1443
+ export function int64(params?: string | core.$ZodBigIntFormatParams): ZodInt64 {
1444
+ return core._int64(ZodBigIntFormat, params) as ZodInt64;
1445
+ }
1446
+
1447
+ // uint64
1448
+ export interface ZodUInt64 extends ZodBigIntFormat<"uint64"> {}
1449
+ export function uint64(params?: string | core.$ZodBigIntFormatParams): ZodUInt64 {
1450
+ return core._uint64(ZodBigIntFormat, params) as ZodUInt64;
1451
+ }
1452
+
1453
+ // symbol
1454
+ export interface ZodSymbol extends _ZodType<core.$ZodSymbolInternals> {}
1455
+ export const ZodSymbol: core.$constructor<ZodSymbol> = /*@__PURE__*/ core.$constructor("ZodSymbol", (inst, def) => {
1456
+ core.$ZodSymbol.init(inst, def);
1457
+ ZodType.init(inst, def);
1458
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.symbolProcessor(inst, ctx, json, params);
1459
+ });
1460
+
1461
+ export function symbol(params?: string | core.$ZodSymbolParams): ZodSymbol {
1462
+ return core._symbol(ZodSymbol, params);
1463
+ }
1464
+
1465
+ // ZodUndefined
1466
+ export interface ZodUndefined extends _ZodType<core.$ZodUndefinedInternals> {}
1467
+ export const ZodUndefined: core.$constructor<ZodUndefined> = /*@__PURE__*/ core.$constructor(
1468
+ "ZodUndefined",
1469
+ (inst, def) => {
1470
+ core.$ZodUndefined.init(inst, def);
1471
+ ZodType.init(inst, def);
1472
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.undefinedProcessor(inst, ctx, json, params);
1473
+ }
1474
+ );
1475
+
1476
+ function _undefined(params?: string | core.$ZodUndefinedParams): ZodUndefined {
1477
+ return core._undefined(ZodUndefined, params);
1478
+ }
1479
+ export { _undefined as undefined };
1480
+
1481
+ // ZodNull
1482
+ export interface ZodNull extends _ZodType<core.$ZodNullInternals> {}
1483
+ export const ZodNull: core.$constructor<ZodNull> = /*@__PURE__*/ core.$constructor("ZodNull", (inst, def) => {
1484
+ core.$ZodNull.init(inst, def);
1485
+ ZodType.init(inst, def);
1486
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.nullProcessor(inst, ctx, json, params);
1487
+ });
1488
+
1489
+ function _null(params?: string | core.$ZodNullParams): ZodNull {
1490
+ return core._null(ZodNull, params);
1491
+ }
1492
+ export { _null as null };
1493
+
1494
+ // ZodAny
1495
+ export interface ZodAny extends _ZodType<core.$ZodAnyInternals> {}
1496
+ export const ZodAny: core.$constructor<ZodAny> = /*@__PURE__*/ core.$constructor("ZodAny", (inst, def) => {
1497
+ core.$ZodAny.init(inst, def);
1498
+ ZodType.init(inst, def);
1499
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.anyProcessor(inst, ctx, json, params);
1500
+ });
1501
+
1502
+ export function any(): ZodAny {
1503
+ return core._any(ZodAny);
1504
+ }
1505
+
1506
+ // ZodUnknown
1507
+ export interface ZodUnknown extends _ZodType<core.$ZodUnknownInternals> {}
1508
+ export const ZodUnknown: core.$constructor<ZodUnknown> = /*@__PURE__*/ core.$constructor("ZodUnknown", (inst, def) => {
1509
+ core.$ZodUnknown.init(inst, def);
1510
+ ZodType.init(inst, def);
1511
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.unknownProcessor(inst, ctx, json, params);
1512
+ });
1513
+
1514
+ export function unknown(): ZodUnknown {
1515
+ return core._unknown(ZodUnknown);
1516
+ }
1517
+
1518
+ // ZodNever
1519
+ export interface ZodNever extends _ZodType<core.$ZodNeverInternals> {}
1520
+ export const ZodNever: core.$constructor<ZodNever> = /*@__PURE__*/ core.$constructor("ZodNever", (inst, def) => {
1521
+ core.$ZodNever.init(inst, def);
1522
+ ZodType.init(inst, def);
1523
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.neverProcessor(inst, ctx, json, params);
1524
+ });
1525
+
1526
+ export function never(params?: string | core.$ZodNeverParams): ZodNever {
1527
+ return core._never(ZodNever, params);
1528
+ }
1529
+
1530
+ // ZodVoid
1531
+ export interface ZodVoid extends _ZodType<core.$ZodVoidInternals> {}
1532
+ export const ZodVoid: core.$constructor<ZodVoid> = /*@__PURE__*/ core.$constructor("ZodVoid", (inst, def) => {
1533
+ core.$ZodVoid.init(inst, def);
1534
+ ZodType.init(inst, def);
1535
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.voidProcessor(inst, ctx, json, params);
1536
+ });
1537
+
1538
+ function _void(params?: string | core.$ZodVoidParams): ZodVoid {
1539
+ return core._void(ZodVoid, params);
1540
+ }
1541
+ export { _void as void };
1542
+
1543
+ // ZodDate
1544
+ export interface _ZodDate<T extends core.$ZodDateInternals = core.$ZodDateInternals> extends _ZodType<T> {
1545
+ min(value: number | Date, params?: string | core.$ZodCheckGreaterThanParams): this;
1546
+ max(value: number | Date, params?: string | core.$ZodCheckLessThanParams): this;
1547
+
1548
+ /** @deprecated Not recommended. */
1549
+ minDate: Date | null;
1550
+ /** @deprecated Not recommended. */
1551
+ maxDate: Date | null;
1552
+ }
1553
+
1554
+ export interface ZodDate extends _ZodDate<core.$ZodDateInternals<Date>> {}
1555
+ export const ZodDate: core.$constructor<ZodDate> = /*@__PURE__*/ core.$constructor<ZodDate>(
1556
+ "ZodDate",
1557
+ (inst, def) => {
1558
+ core.$ZodDate.init(inst, def);
1559
+ ZodType.init(inst, def);
1560
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.dateProcessor(inst, ctx, json, params);
1561
+
1562
+ inst.min = (value, params) => inst.check(checks.gte(value, params));
1563
+ inst.max = (value, params) => inst.check(checks.lte(value, params));
1564
+ },
1565
+ /*@__PURE__*/ util.derived<ZodDate>(
1566
+ {
1567
+ minDate: (inst) => {
1568
+ const { minimum } = processors.aggregateChecks<Date>(inst);
1569
+ return minimum ? new Date(minimum) : null;
1570
+ },
1571
+ maxDate: (inst) => {
1572
+ const { maximum } = processors.aggregateChecks<Date>(inst);
1573
+ return maximum ? new Date(maximum) : null;
1574
+ },
1575
+ },
1576
+ {}
1577
+ )
1578
+ );
1579
+
1580
+ export function date(params?: string | core.$ZodDateParams): ZodDate {
1581
+ return core._date(ZodDate, params);
1582
+ }
1583
+
1584
+ // ZodArray
1585
+ export interface ZodArray<T extends core.SomeType = core.$ZodType>
1586
+ extends _ZodType<core.$ZodArrayInternals<T>>,
1587
+ core.$ZodArray<T> {
1588
+ element: T;
1589
+ min(minLength: number, params?: string | core.$ZodCheckMinLengthParams): this;
1590
+ nonempty(params?: string | core.$ZodCheckMinLengthParams): this;
1591
+ max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
1592
+ length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
1593
+
1594
+ unwrap(): T;
1595
+ "~standard": ZodStandardSchemaWithJSON<this>;
1596
+ }
1597
+ export const ZodArray: core.$constructor<ZodArray> = /*@__PURE__*/ core.$constructor<ZodArray>(
1598
+ "ZodArray",
1599
+ (inst, def) => {
1600
+ _ensureDefaultMemoizer();
1601
+ core.$ZodArray.init(inst, def);
1602
+ ZodType.init(inst, def);
1603
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.arrayProcessor(inst, ctx, json, params);
1604
+
1605
+ inst.element = def.element;
1606
+ },
1607
+ {
1608
+ min(n, params) {
1609
+ return this.check(checks.minLength(n, params));
1610
+ },
1611
+ nonempty(params) {
1612
+ return this.check(checks.minLength(1, params));
1613
+ },
1614
+ max(n, params) {
1615
+ return this.check(checks.maxLength(n, params));
1616
+ },
1617
+ length(n, params) {
1618
+ return this.check(checks.length(n, params));
1619
+ },
1620
+ unwrap() {
1621
+ return this.element;
1622
+ },
1623
+ }
1624
+ );
1625
+
1626
+ export function array<T extends core.SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T> {
1627
+ return core._array(ZodArray, element as any, params) as any;
1628
+ }
1629
+
1630
+ // .keyof
1631
+ export function keyof<T extends ZodObject>(schema: T): ZodEnum<util.KeysEnum<T["_zod"]["output"]>> {
1632
+ const shape = schema._zod.def.shape;
1633
+ return _enum(Object.keys(shape)) as any;
1634
+ }
1635
+
1636
+ // ZodObject
1637
+
1638
+ export type SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLooseShape> = {
1639
+ [K in keyof Ext]: K extends keyof Base
1640
+ ? core.output<Ext[K]> extends core.output<Base[K]>
1641
+ ? core.input<Ext[K]> extends core.input<Base[K]>
1642
+ ? Ext[K]
1643
+ : never
1644
+ : never
1645
+ : Ext[K];
1646
+ };
1647
+
1648
+ export interface ZodObject<
1649
+ /** @ts-ignore Cast variance */
1650
+ out Shape extends core.$ZodShape = core.$ZodLooseShape,
1651
+ out Config extends core.$ZodObjectConfig = core.$strip,
1652
+ > extends _ZodType<core.$ZodObjectInternals<Shape, Config>>,
1653
+ core.$ZodObject<Shape, Config> {
1654
+ "~standard": ZodStandardSchemaWithJSON<this>;
1655
+ shape: Shape;
1656
+
1657
+ keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
1658
+ /** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
1659
+ catchall<T extends core.SomeType>(schema: T): ZodObject<Shape, core.$catchall<T>>;
1660
+
1661
+ /** @deprecated Use `z.looseObject()` or `.loose()` instead. */
1662
+ passthrough(): ZodObject<Shape, core.$loose>;
1663
+ /** Consider `z.looseObject(A.shape)` instead */
1664
+ loose(): ZodObject<Shape, core.$loose>;
1665
+
1666
+ /** Consider `z.strictObject(A.shape)` instead */
1667
+ strict(): ZodObject<Shape, core.$strict>;
1668
+
1669
+ /** This is the default behavior. This method call is likely unnecessary. */
1670
+ strip(): ZodObject<Shape, core.$strip>;
1671
+
1672
+ extend<U extends core.$ZodLooseShape>(shape: U): ZodObject<util.Extend<Shape, util.Writeable<U>>, Config>;
1673
+
1674
+ safeExtend<U extends core.$ZodLooseShape>(
1675
+ shape: SafeExtendShape<Shape, U> & Partial<Record<keyof Shape, core.SomeType>>
1676
+ ): ZodObject<util.Extend<Shape, util.Writeable<U>>, Config>;
1677
+
1678
+ /**
1679
+ * @deprecated Use [`A.extend(B.shape)`](https://zod.dev/api?id=extend) instead.
1680
+ */
1681
+ merge<U extends ZodObject>(other: U): ZodObject<util.Extend<Shape, U["shape"]>, U["_zod"]["config"]>;
1682
+
1683
+ pick<M extends util.Mask<keyof Shape>>(
1684
+ mask: M & Record<Exclude<keyof M, keyof Shape>, never>
1685
+ ): ZodObject<util.Flatten<Pick<Shape, Extract<keyof Shape, keyof M>>>, Config>;
1686
+
1687
+ omit<M extends util.Mask<keyof Shape>>(
1688
+ mask: M & Record<Exclude<keyof M, keyof Shape>, never>
1689
+ ): ZodObject<util.Flatten<Omit<Shape, Extract<keyof Shape, keyof M>>>, Config>;
1690
+
1691
+ partial(): ZodObject<
1692
+ {
1693
+ -readonly [k in keyof Shape]: ZodOptional<Shape[k]>;
1694
+ },
1695
+ Config
1696
+ >;
1697
+ partial<M extends util.Mask<keyof Shape>>(
1698
+ mask: M & Record<Exclude<keyof M, keyof Shape>, never>
1699
+ ): ZodObject<
1700
+ {
1701
+ -readonly [k in keyof Shape]: k extends keyof M
1702
+ ? // Shape[k] extends OptionalInSchema
1703
+ // ? Shape[k]
1704
+ // :
1705
+ ZodOptional<Shape[k]>
1706
+ : Shape[k];
1707
+ },
1708
+ Config
1709
+ >;
1710
+
1711
+ // exactPartial
1712
+ exactPartial(): ZodObject<
1713
+ {
1714
+ -readonly [k in keyof Shape]: ZodExactOptional<Shape[k]>;
1715
+ },
1716
+ Config
1717
+ >;
1718
+ exactPartial<M extends util.Mask<keyof Shape>>(
1719
+ mask: M & Record<Exclude<keyof M, keyof Shape>, never>
1720
+ ): ZodObject<
1721
+ {
1722
+ -readonly [k in keyof Shape]: k extends keyof M ? ZodExactOptional<Shape[k]> : Shape[k];
1723
+ },
1724
+ Config
1725
+ >;
1726
+
1727
+ // required
1728
+ required(): ZodObject<
1729
+ {
1730
+ -readonly [k in keyof Shape]: ZodNonOptional<Shape[k]>;
1731
+ },
1732
+ Config
1733
+ >;
1734
+ required<M extends util.Mask<keyof Shape>>(
1735
+ mask: M & Record<Exclude<keyof M, keyof Shape>, never>
1736
+ ): ZodObject<
1737
+ {
1738
+ -readonly [k in keyof Shape]: k extends keyof M ? ZodNonOptional<Shape[k]> : Shape[k];
1739
+ },
1740
+ Config
1741
+ >;
1742
+ }
1743
+
1744
+ export const ZodObject: core.$constructor<ZodObject> = /*@__PURE__*/ core.$constructor<ZodObject>(
1745
+ "ZodObject",
1746
+ (inst, def) => {
1747
+ _ensureDefaultMemoizer();
1748
+ core.$ZodObjectJIT.init(inst, def);
1749
+ ZodType.init(inst, def);
1750
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.objectProcessor(inst, ctx, json, params);
1751
+
1752
+ util.installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
1753
+ },
1754
+ {
1755
+ keyof() {
1756
+ return _enum(Object.keys(this._zod.def.shape));
1757
+ },
1758
+ catchall(catchall) {
1759
+ // `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree
1760
+ return this.clone(util.mergeDefs(this._zod.def, { catchall: catchall as any }));
1761
+ },
1762
+ passthrough() {
1763
+ return this.clone(util.mergeDefs(this._zod.def, { catchall: unknown() }));
1764
+ },
1765
+ loose() {
1766
+ return this.clone(util.mergeDefs(this._zod.def, { catchall: unknown() }));
1767
+ },
1768
+ strict() {
1769
+ return this.clone(util.mergeDefs(this._zod.def, { catchall: never() }));
1770
+ },
1771
+ strip() {
1772
+ return this.clone(util.mergeDefs(this._zod.def, { catchall: undefined }));
1773
+ },
1774
+ extend(incoming) {
1775
+ return util.extend(this, incoming);
1776
+ },
1777
+ safeExtend(incoming) {
1778
+ return util.safeExtend(this, incoming);
1779
+ },
1780
+ merge(other) {
1781
+ return util.merge(this, other);
1782
+ },
1783
+ pick(mask) {
1784
+ return util.pick(this, mask);
1785
+ },
1786
+ omit(mask) {
1787
+ return util.omit(this, mask);
1788
+ },
1789
+ partial(...args) {
1790
+ return util.partial(ZodOptional, this, args[0]);
1791
+ },
1792
+ exactPartial(...args) {
1793
+ return util.partial(ZodExactOptional, this, args[0], "exactPartial");
1794
+ },
1795
+ required(...args) {
1796
+ return util.required(ZodNonOptional, this, args[0]);
1797
+ },
1798
+ }
1799
+ );
1800
+
1801
+ export function object<T extends core.$ZodLooseShape = Partial<Record<never, core.SomeType>>>(
1802
+ shape?: T,
1803
+ params?: string | core.$ZodObjectParams
1804
+ ): ZodObject<util.Writeable<T>, core.$strip> {
1805
+ const def: core.$ZodObjectDef = {
1806
+ type: "object",
1807
+ shape: shape ?? {},
1808
+ ...util.normalizeParams(params),
1809
+ };
1810
+ return new ZodObject(def) as any;
1811
+ }
1812
+
1813
+ // strictObject
1814
+
1815
+ export function strictObject<T extends core.$ZodLooseShape>(
1816
+ shape: T,
1817
+ params?: string | core.$ZodObjectParams
1818
+ ): ZodObject<util.Writeable<T>, core.$strict> {
1819
+ return new ZodObject({
1820
+ type: "object",
1821
+ shape,
1822
+ catchall: never(),
1823
+ ...util.normalizeParams(params),
1824
+ }) as any;
1825
+ }
1826
+
1827
+ // looseObject
1828
+
1829
+ export function looseObject<T extends core.$ZodLooseShape>(
1830
+ shape: T,
1831
+ params?: string | core.$ZodObjectParams
1832
+ ): ZodObject<util.Writeable<T>, core.$loose> {
1833
+ return new ZodObject({
1834
+ type: "object",
1835
+ shape,
1836
+ catchall: unknown(),
1837
+ ...util.normalizeParams(params),
1838
+ }) as any;
1839
+ }
1840
+
1841
+ // ZodUnion
1842
+ export interface ZodUnion<T extends readonly core.SomeType[] = readonly core.$ZodType[]>
1843
+ extends _ZodType<core.$ZodUnionInternals<T>>,
1844
+ core.$ZodUnion<T> {
1845
+ "~standard": ZodStandardSchemaWithJSON<this>;
1846
+ options: T;
1847
+ }
1848
+ export const ZodUnion: core.$constructor<ZodUnion> = /*@__PURE__*/ core.$constructor("ZodUnion", (inst, def) => {
1849
+ core.$ZodUnion.init(inst, def);
1850
+ ZodType.init(inst, def);
1851
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.unionProcessor(inst, ctx, json, params);
1852
+ inst.options = def.options;
1853
+ });
1854
+
1855
+ export function union<const T extends readonly core.SomeType[]>(
1856
+ options: T,
1857
+ params?: string | core.$ZodUnionParams
1858
+ ): ZodUnion<T> {
1859
+ return new ZodUnion({
1860
+ type: "union",
1861
+ options: options as any as core.$ZodType[],
1862
+ ...util.normalizeParams(params),
1863
+ }) as any;
1864
+ }
1865
+
1866
+ // ZodXor
1867
+ export interface ZodXor<T extends readonly core.SomeType[] = readonly core.$ZodType[]>
1868
+ extends _ZodType<core.$ZodXorInternals<T>>,
1869
+ core.$ZodXor<T> {
1870
+ "~standard": ZodStandardSchemaWithJSON<this>;
1871
+ options: T;
1872
+ }
1873
+ export const ZodXor: core.$constructor<ZodXor> = /*@__PURE__*/ core.$constructor("ZodXor", (inst, def) => {
1874
+ ZodUnion.init(inst, def);
1875
+ core.$ZodXor.init(inst, def);
1876
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.unionProcessor(inst, ctx, json, params);
1877
+ inst.options = def.options;
1878
+ });
1879
+
1880
+ /** Creates an exclusive union (XOR) where exactly one option must match.
1881
+ * Unlike regular unions that succeed when any option matches, xor fails if
1882
+ * zero or more than one option matches the input. */
1883
+ export function xor<const T extends readonly core.SomeType[]>(
1884
+ options: T,
1885
+ params?: string | core.$ZodXorParams
1886
+ ): ZodXor<T> {
1887
+ return new ZodXor({
1888
+ type: "union",
1889
+ options: options as any as core.$ZodType[],
1890
+ inclusive: false,
1891
+ ...util.normalizeParams(params),
1892
+ }) as any;
1893
+ }
1894
+
1895
+ // ZodDiscriminatedUnion
1896
+ export interface ZodDiscriminatedUnion<
1897
+ Options extends readonly core.SomeType[] = readonly core.$ZodType[],
1898
+ Disc extends string = string,
1899
+ > extends ZodUnion<Options>,
1900
+ core.$ZodDiscriminatedUnion<Options, Disc> {
1901
+ "~standard": ZodStandardSchemaWithJSON<this>;
1902
+ _zod: core.$ZodDiscriminatedUnionInternals<Options, Disc>;
1903
+ def: core.$ZodDiscriminatedUnionDef<Options, Disc>;
1904
+ }
1905
+ export const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion> = /*@__PURE__*/ core.$constructor(
1906
+ "ZodDiscriminatedUnion",
1907
+ (inst, def) => {
1908
+ ZodUnion.init(inst, def);
1909
+ core.$ZodDiscriminatedUnion.init(inst, def);
1910
+ }
1911
+ );
1912
+
1913
+ export function discriminatedUnion<
1914
+ Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]],
1915
+ Disc extends string,
1916
+ >(
1917
+ discriminator: Disc,
1918
+ options: Types,
1919
+ params?: string | core.$ZodDiscriminatedUnionParams
1920
+ ): ZodDiscriminatedUnion<Types, Disc> {
1921
+ // const [options, params] = args;
1922
+ return new ZodDiscriminatedUnion({
1923
+ type: "union",
1924
+ options: options as any as core.$ZodType[],
1925
+ discriminator,
1926
+ ...util.normalizeParams(params),
1927
+ }) as any;
1928
+ }
1929
+
1930
+ // ZodIntersection
1931
+ export interface ZodIntersection<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType>
1932
+ extends _ZodType<core.$ZodIntersectionInternals<A, B>>,
1933
+ core.$ZodIntersection<A, B> {
1934
+ "~standard": ZodStandardSchemaWithJSON<this>;
1935
+ }
1936
+ export const ZodIntersection: core.$constructor<ZodIntersection> = /*@__PURE__*/ core.$constructor(
1937
+ "ZodIntersection",
1938
+ (inst, def) => {
1939
+ core.$ZodIntersection.init(inst, def);
1940
+ ZodType.init(inst, def);
1941
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.intersectionProcessor(inst, ctx, json, params);
1942
+ }
1943
+ );
1944
+
1945
+ export function intersection<T extends core.SomeType, U extends core.SomeType>(
1946
+ left: T,
1947
+ right: U
1948
+ ): ZodIntersection<T, U> {
1949
+ return new ZodIntersection({
1950
+ type: "intersection",
1951
+ left: left as any as core.$ZodType,
1952
+ right: right as any as core.$ZodType,
1953
+ }) as any;
1954
+ }
1955
+
1956
+ // ZodTuple
1957
+ export interface ZodTuple<
1958
+ T extends util.TupleItems = readonly core.$ZodType[],
1959
+ Rest extends core.SomeType | null = core.$ZodType | null,
1960
+ > extends _ZodType<core.$ZodTupleInternals<T, Rest>>,
1961
+ core.$ZodTuple<T, Rest> {
1962
+ "~standard": ZodStandardSchemaWithJSON<this>;
1963
+ rest<Rest extends core.SomeType = core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
1964
+ partial(): ZodTuple<{ -readonly [k in keyof T]: ZodOptional<T[k]> }, Rest>;
1965
+ }
1966
+ export const ZodTuple: core.$constructor<ZodTuple> = /*@__PURE__*/ core.$constructor<ZodTuple>(
1967
+ "ZodTuple",
1968
+ (inst, def) => {
1969
+ _ensureDefaultMemoizer();
1970
+ core.$ZodTuple.init(inst, def);
1971
+ ZodType.init(inst, def);
1972
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.tupleProcessor(inst, ctx, json, params);
1973
+ },
1974
+ {
1975
+ rest(rest) {
1976
+ return this.clone({
1977
+ ...this._zod.def,
1978
+ rest: rest as any as core.$ZodType,
1979
+ }) as any;
1980
+ },
1981
+ partial() {
1982
+ const def = this._zod.def;
1983
+ // a refinement was authored against the full arity; partialing would run it on a shorter array
1984
+ if (def.checks?.length) throw new Error(".partial() cannot be used on tuple schemas containing refinements");
1985
+ return this.clone({
1986
+ ...def,
1987
+ items: def.items.map((item) => new ZodOptional({ type: "optional", innerType: item })),
1988
+ }) as any;
1989
+ },
1990
+ }
1991
+ );
1992
+
1993
+ export function tuple<T extends readonly [core.SomeType, ...core.SomeType[]]>(
1994
+ items: T,
1995
+ params?: string | core.$ZodTupleParams
1996
+ ): ZodTuple<T, null>;
1997
+ export function tuple<T extends readonly [core.SomeType, ...core.SomeType[]], Rest extends core.SomeType>(
1998
+ items: T,
1999
+ rest: Rest,
2000
+ params?: string | core.$ZodTupleParams
2001
+ ): ZodTuple<T, Rest>;
2002
+ export function tuple(items: [], params?: string | core.$ZodTupleParams): ZodTuple<[], null>;
2003
+ export function tuple(
2004
+ items: core.SomeType[],
2005
+ _paramsOrRest?: string | core.$ZodTupleParams | core.SomeType,
2006
+ _params?: string | core.$ZodTupleParams
2007
+ ) {
2008
+ const hasRest = _paramsOrRest instanceof core.$ZodType;
2009
+ const params = hasRest ? _params : _paramsOrRest;
2010
+ const rest = hasRest ? _paramsOrRest : null;
2011
+ return new ZodTuple({
2012
+ type: "tuple",
2013
+ items: items as any as core.$ZodType[],
2014
+ rest,
2015
+ ...util.normalizeParams(params),
2016
+ });
2017
+ }
2018
+
2019
+ // ZodRecord
2020
+ export interface ZodRecord<
2021
+ Key extends core.$ZodRecordKey = core.$ZodRecordKey,
2022
+ Value extends core.SomeType = core.$ZodType,
2023
+ > extends _ZodType<core.$ZodRecordInternals<Key, Value>>,
2024
+ core.$ZodRecord<Key, Value> {
2025
+ "~standard": ZodStandardSchemaWithJSON<this>;
2026
+ keyType: Key;
2027
+ valueType: Value;
2028
+ }
2029
+ export const ZodRecord: core.$constructor<ZodRecord> = /*@__PURE__*/ core.$constructor("ZodRecord", (inst, def) => {
2030
+ _ensureDefaultMemoizer();
2031
+ core.$ZodRecord.init(inst, def);
2032
+ ZodType.init(inst, def);
2033
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.recordProcessor(inst, ctx, json, params);
2034
+
2035
+ inst.keyType = def.keyType;
2036
+ inst.valueType = def.valueType;
2037
+ });
2038
+
2039
+ export function record<Key extends core.$ZodRecordKey, Value extends core.SomeType>(
2040
+ keyType: Key,
2041
+ valueType: Value,
2042
+ params?: string | core.$ZodRecordParams
2043
+ ): ZodRecord<Key, Value> {
2044
+ // v3-compat: z.record(valueType, params?) — defaults keyType to z.string()
2045
+ if (!valueType || !(valueType as any)._zod) {
2046
+ return new ZodRecord({
2047
+ type: "record",
2048
+ keyType: string() as any,
2049
+ valueType: keyType as any as core.$ZodType,
2050
+ ...util.normalizeParams(valueType as string | core.$ZodRecordParams | undefined),
2051
+ }) as any;
2052
+ }
2053
+ return new ZodRecord({
2054
+ type: "record",
2055
+ keyType,
2056
+ valueType: valueType as any as core.$ZodType,
2057
+ ...util.normalizeParams(params),
2058
+ }) as any;
2059
+ }
2060
+ // type alksjf = core.output<core.$ZodRecordKey>;
2061
+ export function partialRecord<Key extends core.$ZodRecordKey, Value extends core.SomeType>(
2062
+ keyType: Key,
2063
+ valueType: Value,
2064
+ params?: string | core.$ZodRecordParams
2065
+ ): ZodRecord<Key & core.$partial, Value> {
2066
+ return new ZodRecord({
2067
+ type: "record",
2068
+ keyType,
2069
+ valueType: valueType as any,
2070
+ ...util.normalizeParams(params),
2071
+ partial: true,
2072
+ }) as any;
2073
+ }
2074
+
2075
+ export function looseRecord<Key extends core.$ZodRecordKey, Value extends core.SomeType>(
2076
+ keyType: Key,
2077
+ valueType: Value,
2078
+ params?: string | core.$ZodRecordParams
2079
+ ): ZodRecord<Key, Value> {
2080
+ return new ZodRecord({
2081
+ type: "record",
2082
+ keyType,
2083
+ valueType: valueType as any as core.$ZodType,
2084
+ mode: "loose",
2085
+ ...util.normalizeParams(params),
2086
+ }) as any;
2087
+ }
2088
+
2089
+ // ZodMap
2090
+ export interface ZodMap<Key extends core.SomeType = core.$ZodType, Value extends core.SomeType = core.$ZodType>
2091
+ extends _ZodType<core.$ZodMapInternals<Key, Value>>,
2092
+ core.$ZodMap<Key, Value> {
2093
+ "~standard": ZodStandardSchemaWithJSON<this>;
2094
+ keyType: Key;
2095
+ valueType: Value;
2096
+ min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
2097
+ nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
2098
+ max(maxSize: number, params?: string | core.$ZodCheckMaxSizeParams): this;
2099
+ size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
2100
+ }
2101
+ export const ZodMap: core.$constructor<ZodMap> = /*@__PURE__*/ core.$constructor("ZodMap", (inst, def) => {
2102
+ _ensureDefaultMemoizer();
2103
+ core.$ZodMap.init(inst, def);
2104
+ ZodType.init(inst, def);
2105
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.mapProcessor(inst, ctx, json, params);
2106
+ inst.keyType = def.keyType;
2107
+ inst.valueType = def.valueType;
2108
+ inst.min = (...args) => inst.check(core._minSize(...args));
2109
+ inst.nonempty = (params) => inst.check(core._minSize(1, params));
2110
+ inst.max = (...args) => inst.check(core._maxSize(...args));
2111
+ inst.size = (...args) => inst.check(core._size(...args));
2112
+ });
2113
+
2114
+ export function map<Key extends core.SomeType, Value extends core.SomeType>(
2115
+ keyType: Key,
2116
+ valueType: Value,
2117
+ params?: string | core.$ZodMapParams
2118
+ ): ZodMap<Key, Value> {
2119
+ return new ZodMap({
2120
+ type: "map",
2121
+ keyType: keyType as any as core.$ZodType,
2122
+ valueType: valueType as any as core.$ZodType,
2123
+ ...util.normalizeParams(params),
2124
+ }) as any;
2125
+ }
2126
+
2127
+ // ZodSet
2128
+ export interface ZodSet<T extends core.SomeType = core.$ZodType>
2129
+ extends _ZodType<core.$ZodSetInternals<T>>,
2130
+ core.$ZodSet<T> {
2131
+ "~standard": ZodStandardSchemaWithJSON<this>;
2132
+ min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
2133
+ nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
2134
+ max(maxSize: number, params?: string | core.$ZodCheckMaxSizeParams): this;
2135
+ size(size: number, params?: string | core.$ZodCheckSizeEqualsParams): this;
2136
+ }
2137
+ export const ZodSet: core.$constructor<ZodSet> = /*@__PURE__*/ core.$constructor("ZodSet", (inst, def) => {
2138
+ _ensureDefaultMemoizer();
2139
+ core.$ZodSet.init(inst, def);
2140
+ ZodType.init(inst, def);
2141
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.setProcessor(inst, ctx, json, params);
2142
+
2143
+ inst.min = (...args) => inst.check(core._minSize(...args));
2144
+ inst.nonempty = (params) => inst.check(core._minSize(1, params));
2145
+ inst.max = (...args) => inst.check(core._maxSize(...args));
2146
+ inst.size = (...args) => inst.check(core._size(...args));
2147
+ });
2148
+
2149
+ export function set<Value extends core.SomeType>(
2150
+ valueType: Value,
2151
+ params?: string | core.$ZodSetParams
2152
+ ): ZodSet<Value> {
2153
+ return new ZodSet({
2154
+ type: "set",
2155
+ valueType: valueType as any as core.$ZodType,
2156
+ ...util.normalizeParams(params),
2157
+ }) as any;
2158
+ }
2159
+
2160
+ // ZodEnum
2161
+ export interface ZodEnum<
2162
+ /** @ts-ignore Cast variance */
2163
+ out T extends util.EnumLike = util.EnumLike,
2164
+ > extends _ZodType<core.$ZodEnumInternals<T>>,
2165
+ core.$ZodEnum<T> {
2166
+ "~standard": ZodStandardSchemaWithJSON<this>;
2167
+ enum: T;
2168
+ options: Array<T[keyof T]>;
2169
+
2170
+ extract<const U extends readonly (keyof T)[]>(
2171
+ values: U,
2172
+ params?: string | core.$ZodEnumParams
2173
+ ): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
2174
+ exclude<const U extends readonly (keyof T)[]>(
2175
+ values: U,
2176
+ params?: string | core.$ZodEnumParams
2177
+ ): ZodEnum<util.Flatten<Omit<T, U[number]>>>;
2178
+ }
2179
+ export const ZodEnum: core.$constructor<ZodEnum> = /*@__PURE__*/ core.$constructor("ZodEnum", (inst, def) => {
2180
+ core.$ZodEnum.init(inst, def);
2181
+ ZodType.init(inst, def);
2182
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.enumProcessor(inst, ctx, json, params);
2183
+
2184
+ inst.enum = def.entries;
2185
+ // reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out
2186
+ inst.options = [...inst._zod.values] as util.EnumValue[];
2187
+
2188
+ const keys = new Set(Object.keys(def.entries));
2189
+
2190
+ inst.extract = (values, params) => {
2191
+ const newEntries: Record<string, any> = {};
2192
+ for (const value of values) {
2193
+ if (keys.has(value)) {
2194
+ newEntries[value] = def.entries[value];
2195
+ } else throw new Error(`Key ${value} not found in enum`);
2196
+ }
2197
+ return new ZodEnum({
2198
+ ...def,
2199
+ checks: [],
2200
+ ...util.normalizeParams(params),
2201
+ entries: newEntries,
2202
+ }) as any;
2203
+ };
2204
+
2205
+ inst.exclude = (values, params) => {
2206
+ const newEntries: Record<string, any> = { ...def.entries };
2207
+ for (const value of values) {
2208
+ if (keys.has(value)) {
2209
+ delete newEntries[value];
2210
+ } else throw new Error(`Key ${value} not found in enum`);
2211
+ }
2212
+ return new ZodEnum({
2213
+ ...def,
2214
+ checks: [],
2215
+ ...util.normalizeParams(params),
2216
+ entries: newEntries,
2217
+ }) as any;
2218
+ };
2219
+ });
2220
+
2221
+ function _enum<const T extends readonly string[]>(
2222
+ values: T,
2223
+ params?: string | core.$ZodEnumParams
2224
+ ): ZodEnum<util.ToEnum<T[number]>>;
2225
+ function _enum<const T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T>;
2226
+ function _enum(values: any, params?: string | core.$ZodEnumParams) {
2227
+ const entries: any = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
2228
+
2229
+ return new ZodEnum({
2230
+ type: "enum",
2231
+ entries,
2232
+ ...util.normalizeParams(params),
2233
+ }) as any;
2234
+ }
2235
+ export { _enum as enum };
2236
+
2237
+ /** @deprecated This API has been merged into `z.enum()`. Use `z.enum()` instead.
2238
+ *
2239
+ * ```ts
2240
+ * enum Colors { red, green, blue }
2241
+ * z.enum(Colors);
2242
+ * ```
2243
+ */
2244
+ export function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T> {
2245
+ return new ZodEnum({
2246
+ type: "enum",
2247
+ entries,
2248
+ ...util.normalizeParams(params),
2249
+ }) as ZodEnum<T>;
2250
+ }
2251
+
2252
+ // ZodLiteral
2253
+ export interface ZodLiteral<T extends util.Literal = util.Literal>
2254
+ extends _ZodType<core.$ZodLiteralInternals<T>>,
2255
+ core.$ZodLiteral<T> {
2256
+ "~standard": ZodStandardSchemaWithJSON<this>;
2257
+ values: Set<T>;
2258
+ /** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
2259
+ value: T;
2260
+ }
2261
+ export const ZodLiteral: core.$constructor<ZodLiteral> = /*@__PURE__*/ core.$constructor("ZodLiteral", (inst, def) => {
2262
+ core.$ZodLiteral.init(inst, def);
2263
+ ZodType.init(inst, def);
2264
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.literalProcessor(inst, ctx, json, params);
2265
+ inst.values = new Set(def.values);
2266
+ Object.defineProperty(inst, "value", {
2267
+ get() {
2268
+ if (def.values.length > 1) {
2269
+ throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
2270
+ }
2271
+ return def.values[0];
2272
+ },
2273
+ });
2274
+ });
2275
+
2276
+ export function literal<const T extends ReadonlyArray<util.Literal>>(
2277
+ value: T,
2278
+ params?: string | core.$ZodLiteralParams
2279
+ ): ZodLiteral<T[number]>;
2280
+ export function literal<const T extends util.Literal>(
2281
+ value: T,
2282
+ params?: string | core.$ZodLiteralParams
2283
+ ): ZodLiteral<T>;
2284
+ export function literal(value: any, params: any) {
2285
+ return new ZodLiteral({
2286
+ type: "literal",
2287
+ values: Array.isArray(value) ? value : [value],
2288
+ ...util.normalizeParams(params),
2289
+ });
2290
+ }
2291
+
2292
+ // ZodFile
2293
+ export interface ZodFile extends _ZodType<core.$ZodFileInternals>, core.$ZodFile {
2294
+ "~standard": ZodStandardSchemaWithJSON<this>;
2295
+ min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
2296
+ max(size: number, params?: string | core.$ZodCheckMaxSizeParams): this;
2297
+ mime(types: util.MimeTypes | Array<util.MimeTypes>, params?: string | core.$ZodCheckMimeTypeParams): this;
2298
+ }
2299
+ export const ZodFile: core.$constructor<ZodFile> = /*@__PURE__*/ core.$constructor("ZodFile", (inst, def) => {
2300
+ core.$ZodFile.init(inst, def);
2301
+ ZodType.init(inst, def);
2302
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.fileProcessor(inst, ctx, json, params);
2303
+
2304
+ inst.min = (size, params) => inst.check(core._minSize(size, params));
2305
+ inst.max = (size, params) => inst.check(core._maxSize(size, params));
2306
+ inst.mime = (types, params) => inst.check(core._mime(Array.isArray(types) ? types : [types], params));
2307
+ });
2308
+
2309
+ export function file(params?: string | core.$ZodFileParams): ZodFile {
2310
+ return core._file(ZodFile, params) as any;
2311
+ }
2312
+
2313
+ // ZodTransform
2314
+ export interface ZodTransform<O = unknown, I = unknown>
2315
+ extends _ZodType<core.$ZodTransformInternals<O, I>>,
2316
+ core.$ZodTransform<O, I> {
2317
+ "~standard": ZodStandardSchemaWithJSON<this>;
2318
+ }
2319
+ export const ZodTransform: core.$constructor<ZodTransform> = /*@__PURE__*/ core.$constructor(
2320
+ "ZodTransform",
2321
+ (inst, def) => {
2322
+ _ensureDefaultMemoizer();
2323
+ core.$ZodTransform.init(inst, def);
2324
+ ZodType.init(inst, def);
2325
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.transformProcessor(inst, ctx, json, params);
2326
+
2327
+ inst._zod.parse = (payload, _ctx) => {
2328
+ if (_ctx.direction === "backward") {
2329
+ throw new core.$ZodEncodeError(inst.constructor.name);
2330
+ }
2331
+
2332
+ (payload as core.$RefinementCtx).addIssue = (issue) => {
2333
+ if (typeof issue === "string") {
2334
+ payload.issues.push(util.issue(issue, payload.value, def));
2335
+ } else {
2336
+ // for Zod 3 backwards compatibility
2337
+ const _issue = issue as any;
2338
+
2339
+ if (_issue.fatal) _issue.continue = false;
2340
+ _issue.code ??= "custom";
2341
+ if (!("input" in _issue)) _issue.input = payload.value;
2342
+ _issue.inst ??= inst;
2343
+ // _issue.continue ??= true;
2344
+ payload.issues.push(util.issue(_issue));
2345
+ }
2346
+ };
2347
+
2348
+ const start = payload.issues.length;
2349
+ const output = def.transform(payload.value, payload);
2350
+ if (output instanceof Promise) {
2351
+ return output.then((output) => {
2352
+ payload.value = output;
2353
+ if (payload.issues.length !== start) util.ownPaths(payload.issues, start);
2354
+ return payload;
2355
+ });
2356
+ }
2357
+ payload.value = output;
2358
+ if (payload.issues.length !== start) util.ownPaths(payload.issues, start);
2359
+ return payload;
2360
+ };
2361
+ }
2362
+ );
2363
+
2364
+ export function transform<I = unknown, O = I>(
2365
+ fn: (input: I, ctx: core.$RefinementCtx) => O
2366
+ ): ZodTransform<Awaited<O>, I> {
2367
+ return new ZodTransform({
2368
+ type: "transform",
2369
+ transform: fn as any,
2370
+ }) as any;
2371
+ }
2372
+
2373
+ // ZodOptional
2374
+ export interface ZodOptional<T extends core.SomeType = core.$ZodType>
2375
+ extends _ZodType<core.$ZodOptionalInternals<T>>,
2376
+ core.$ZodOptional<T> {
2377
+ "~standard": ZodStandardSchemaWithJSON<this>;
2378
+ unwrap(): T;
2379
+ }
2380
+ export const ZodOptional: core.$constructor<ZodOptional> = /*@__PURE__*/ core.$constructor(
2381
+ "ZodOptional",
2382
+ (inst, def) => {
2383
+ core.$ZodOptional.init(inst, def);
2384
+ ZodType.init(inst, def);
2385
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.optionalProcessor(inst, ctx, json, params);
2386
+
2387
+ inst.unwrap = () => inst._zod.def.innerType;
2388
+ }
2389
+ );
2390
+
2391
+ export function optional<T extends core.SomeType>(innerType: T): ZodOptional<T> {
2392
+ return new ZodOptional({
2393
+ type: "optional",
2394
+ innerType: innerType as any as core.$ZodType,
2395
+ }) as any;
2396
+ }
2397
+
2398
+ // ZodExactOptional
2399
+ export interface ZodExactOptional<T extends core.SomeType = core.$ZodType>
2400
+ extends _ZodType<core.$ZodExactOptionalInternals<T>>,
2401
+ core.$ZodExactOptional<T> {
2402
+ "~standard": ZodStandardSchemaWithJSON<this>;
2403
+ unwrap(): T;
2404
+ }
2405
+ export const ZodExactOptional: core.$constructor<ZodExactOptional> = /*@__PURE__*/ core.$constructor(
2406
+ "ZodExactOptional",
2407
+ (inst, def) => {
2408
+ core.$ZodExactOptional.init(inst, def);
2409
+ ZodType.init(inst, def);
2410
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.optionalProcessor(inst, ctx, json, params);
2411
+
2412
+ inst.unwrap = () => inst._zod.def.innerType;
2413
+ }
2414
+ );
2415
+
2416
+ export function exactOptional<T extends core.SomeType>(innerType: T): ZodExactOptional<T> {
2417
+ return new ZodExactOptional({
2418
+ type: "optional",
2419
+ innerType: innerType as any as core.$ZodType,
2420
+ }) as any;
2421
+ }
2422
+
2423
+ // ZodNullable
2424
+ export interface ZodNullable<T extends core.SomeType = core.$ZodType>
2425
+ extends _ZodType<core.$ZodNullableInternals<T>>,
2426
+ core.$ZodNullable<T> {
2427
+ "~standard": ZodStandardSchemaWithJSON<this>;
2428
+ unwrap(): T;
2429
+ }
2430
+ export const ZodNullable: core.$constructor<ZodNullable> = /*@__PURE__*/ core.$constructor(
2431
+ "ZodNullable",
2432
+ (inst, def) => {
2433
+ core.$ZodNullable.init(inst, def);
2434
+ ZodType.init(inst, def);
2435
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.nullableProcessor(inst, ctx, json, params);
2436
+
2437
+ inst.unwrap = () => inst._zod.def.innerType;
2438
+ }
2439
+ );
2440
+
2441
+ export function nullable<T extends core.SomeType>(innerType: T): ZodNullable<T> {
2442
+ return new ZodNullable({
2443
+ type: "nullable",
2444
+ innerType: innerType as any as core.$ZodType,
2445
+ }) as any;
2446
+ }
2447
+
2448
+ // nullish
2449
+ export function nullish<T extends core.SomeType>(innerType: T): ZodOptional<ZodNullable<T>> {
2450
+ return optional(nullable(innerType));
2451
+ }
2452
+
2453
+ // ZodDefault
2454
+ export interface ZodDefault<T extends core.SomeType = core.$ZodType>
2455
+ extends _ZodType<core.$ZodDefaultInternals<T>>,
2456
+ core.$ZodDefault<T> {
2457
+ "~standard": ZodStandardSchemaWithJSON<this>;
2458
+ unwrap(): T;
2459
+ /** @deprecated Use `.unwrap()` instead. */
2460
+ removeDefault(): T;
2461
+ }
2462
+ export const ZodDefault: core.$constructor<ZodDefault> = /*@__PURE__*/ core.$constructor("ZodDefault", (inst, def) => {
2463
+ core.$ZodDefault.init(inst, def);
2464
+ ZodType.init(inst, def);
2465
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.defaultProcessor(inst, ctx, json, params);
2466
+
2467
+ inst.unwrap = () => inst._zod.def.innerType;
2468
+ inst.removeDefault = inst.unwrap;
2469
+ });
2470
+
2471
+ export function _default<T extends core.SomeType>(
2472
+ innerType: T,
2473
+ defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>)
2474
+ ): ZodDefault<T> {
2475
+ return new ZodDefault({
2476
+ type: "default",
2477
+ innerType: innerType as any as core.$ZodType,
2478
+ get defaultValue() {
2479
+ return typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
2480
+ },
2481
+ }) as any;
2482
+ }
2483
+
2484
+ // ZodPrefault
2485
+ export interface ZodPrefault<T extends core.SomeType = core.$ZodType>
2486
+ extends _ZodType<core.$ZodPrefaultInternals<T>>,
2487
+ core.$ZodPrefault<T> {
2488
+ "~standard": ZodStandardSchemaWithJSON<this>;
2489
+ unwrap(): T;
2490
+ }
2491
+ export const ZodPrefault: core.$constructor<ZodPrefault> = /*@__PURE__*/ core.$constructor(
2492
+ "ZodPrefault",
2493
+ (inst, def) => {
2494
+ core.$ZodPrefault.init(inst, def);
2495
+ ZodType.init(inst, def);
2496
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.prefaultProcessor(inst, ctx, json, params);
2497
+ inst.unwrap = () => inst._zod.def.innerType;
2498
+ }
2499
+ );
2500
+
2501
+ export function prefault<T extends core.SomeType>(
2502
+ innerType: T,
2503
+ defaultValue: core.input<T> | (() => core.input<T>)
2504
+ ): ZodPrefault<T> {
2505
+ return new ZodPrefault({
2506
+ type: "prefault",
2507
+ innerType: innerType as any as core.$ZodType,
2508
+ get defaultValue() {
2509
+ return typeof defaultValue === "function" ? (defaultValue as Function)() : util.shallowClone(defaultValue);
2510
+ },
2511
+ }) as any;
2512
+ }
2513
+
2514
+ // ZodNonOptional
2515
+ export interface ZodNonOptional<T extends core.SomeType = core.$ZodType>
2516
+ extends _ZodType<core.$ZodNonOptionalInternals<T>>,
2517
+ core.$ZodNonOptional<T> {
2518
+ "~standard": ZodStandardSchemaWithJSON<this>;
2519
+ unwrap(): T;
2520
+ }
2521
+ export const ZodNonOptional: core.$constructor<ZodNonOptional> = /*@__PURE__*/ core.$constructor(
2522
+ "ZodNonOptional",
2523
+ (inst, def) => {
2524
+ core.$ZodNonOptional.init(inst, def);
2525
+ ZodType.init(inst, def);
2526
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.nonoptionalProcessor(inst, ctx, json, params);
2527
+
2528
+ inst.unwrap = () => inst._zod.def.innerType;
2529
+ }
2530
+ );
2531
+
2532
+ export function nonoptional<T extends core.SomeType>(
2533
+ innerType: T,
2534
+ params?: string | core.$ZodNonOptionalParams
2535
+ ): ZodNonOptional<T> {
2536
+ return new ZodNonOptional({
2537
+ type: "nonoptional",
2538
+ innerType: innerType as any as core.$ZodType,
2539
+ ...util.normalizeParams(params),
2540
+ }) as any;
2541
+ }
2542
+
2543
+ // ZodSuccess
2544
+ export interface ZodSuccess<T extends core.SomeType = core.$ZodType>
2545
+ extends _ZodType<core.$ZodSuccessInternals<T>>,
2546
+ core.$ZodSuccess<T> {
2547
+ "~standard": ZodStandardSchemaWithJSON<this>;
2548
+ unwrap(): T;
2549
+ }
2550
+ export const ZodSuccess: core.$constructor<ZodSuccess> = /*@__PURE__*/ core.$constructor("ZodSuccess", (inst, def) => {
2551
+ core.$ZodSuccess.init(inst, def);
2552
+ ZodType.init(inst, def);
2553
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.successProcessor(inst, ctx, json, params);
2554
+
2555
+ inst.unwrap = () => inst._zod.def.innerType;
2556
+ });
2557
+
2558
+ export function success<T extends core.SomeType>(innerType: T): ZodSuccess<T> {
2559
+ return new ZodSuccess({
2560
+ type: "success",
2561
+ innerType: innerType as any as core.$ZodType,
2562
+ }) as any;
2563
+ }
2564
+
2565
+ // ZodCatch
2566
+ export interface ZodCatch<T extends core.SomeType = core.$ZodType>
2567
+ extends _ZodType<core.$ZodCatchInternals<T>>,
2568
+ core.$ZodCatch<T> {
2569
+ "~standard": ZodStandardSchemaWithJSON<this>;
2570
+ unwrap(): T;
2571
+ /** @deprecated Use `.unwrap()` instead. */
2572
+ removeCatch(): T;
2573
+ }
2574
+ export const ZodCatch: core.$constructor<ZodCatch> = /*@__PURE__*/ core.$constructor("ZodCatch", (inst, def) => {
2575
+ core.$ZodCatch.init(inst, def);
2576
+ ZodType.init(inst, def);
2577
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.catchProcessor(inst, ctx, json, params);
2578
+
2579
+ inst.unwrap = () => inst._zod.def.innerType;
2580
+ inst.removeCatch = inst.unwrap;
2581
+ });
2582
+
2583
+ function _catch<T extends core.SomeType>(
2584
+ innerType: T,
2585
+ catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>)
2586
+ ): ZodCatch<T> {
2587
+ return new ZodCatch({
2588
+ type: "catch",
2589
+ innerType: innerType as any as core.$ZodType,
2590
+ catchValue: (typeof catchValue === "function" ? catchValue : core.util.constantCatch(catchValue)) as (
2591
+ ctx: core.$ZodCatchCtx
2592
+ ) => core.output<T>,
2593
+ }) as any;
2594
+ }
2595
+ export { _catch as catch };
2596
+
2597
+ // ZodNaN
2598
+ export interface ZodNaN extends _ZodType<core.$ZodNaNInternals>, core.$ZodNaN {
2599
+ "~standard": ZodStandardSchemaWithJSON<this>;
2600
+ }
2601
+ export const ZodNaN: core.$constructor<ZodNaN> = /*@__PURE__*/ core.$constructor("ZodNaN", (inst, def) => {
2602
+ core.$ZodNaN.init(inst, def);
2603
+ ZodType.init(inst, def);
2604
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.nanProcessor(inst, ctx, json, params);
2605
+ });
2606
+
2607
+ export function nan(params?: string | core.$ZodNaNParams): ZodNaN {
2608
+ return core._nan(ZodNaN, params);
2609
+ }
2610
+
2611
+ // ZodPipe
2612
+ export interface ZodPipe<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType>
2613
+ extends _ZodType<core.$ZodPipeInternals<A, B>>,
2614
+ core.$ZodPipe<A, B> {
2615
+ "~standard": ZodStandardSchemaWithJSON<this>;
2616
+ in: A;
2617
+ out: B;
2618
+ }
2619
+ export const ZodPipe: core.$constructor<ZodPipe> = /*@__PURE__*/ core.$constructor("ZodPipe", (inst, def) => {
2620
+ core.$ZodPipe.init(inst, def);
2621
+ ZodType.init(inst, def);
2622
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.pipeProcessor(inst, ctx, json, params);
2623
+
2624
+ inst.in = def.in;
2625
+ inst.out = def.out;
2626
+ });
2627
+
2628
+ export function pipe<
2629
+ const A extends core.SomeType,
2630
+ B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>,
2631
+ >(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodPipe<A, B>;
2632
+ export function pipe(in_: core.SomeType, out: core.SomeType) {
2633
+ return new ZodPipe({
2634
+ type: "pipe",
2635
+ in: in_ as unknown as core.$ZodType,
2636
+ out: out as unknown as core.$ZodType,
2637
+ // ...util.normalizeParams(params),
2638
+ });
2639
+ }
2640
+
2641
+ // ZodCodec
2642
+ export interface ZodCodec<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType>
2643
+ extends ZodPipe<A, B>,
2644
+ core.$ZodCodec<A, B> {
2645
+ "~standard": ZodStandardSchemaWithJSON<this>;
2646
+ _zod: core.$ZodCodecInternals<A, B>;
2647
+ def: core.$ZodCodecDef<A, B>;
2648
+ }
2649
+ export const ZodCodec: core.$constructor<ZodCodec> = /*@__PURE__*/ core.$constructor("ZodCodec", (inst, def) => {
2650
+ ZodPipe.init(inst, def);
2651
+ core.$ZodCodec.init(inst, def);
2652
+ });
2653
+
2654
+ export function codec<const A extends core.SomeType, B extends core.SomeType = core.$ZodType>(
2655
+ in_: A,
2656
+ out: B,
2657
+ params: {
2658
+ decode: (value: core.output<A>, payload: core.ParsePayload<core.output<A>>) => core.util.MaybeAsync<core.input<B>>;
2659
+ encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.util.MaybeAsync<core.output<A>>;
2660
+ }
2661
+ ): ZodCodec<A, B> {
2662
+ return new ZodCodec({
2663
+ type: "pipe",
2664
+ in: in_ as any as core.$ZodType,
2665
+ out: out as any as core.$ZodType,
2666
+ transform: params.decode as any,
2667
+ reverseTransform: params.encode as any,
2668
+ }) as any;
2669
+ }
2670
+
2671
+ export function invertCodec<A extends core.SomeType, B extends core.SomeType>(codec: ZodCodec<A, B>): ZodCodec<B, A> {
2672
+ const def = codec._zod.def;
2673
+ return new ZodCodec({
2674
+ type: "pipe",
2675
+ in: def.out as any,
2676
+ out: def.in as any,
2677
+ transform: def.reverseTransform as any,
2678
+ reverseTransform: def.transform as any,
2679
+ }) as any;
2680
+ }
2681
+
2682
+ // ZodPreprocess
2683
+ export interface ZodPreprocess<B extends core.SomeType = core.$ZodType, I = unknown>
2684
+ extends ZodPipe<core.$ZodTransform<unknown, I>, B>,
2685
+ core.$ZodPreprocess<B, I> {
2686
+ "~standard": ZodStandardSchemaWithJSON<this>;
2687
+ _zod: core.$ZodPreprocessInternals<B, I>;
2688
+ def: core.$ZodPreprocessDef<B, I>;
2689
+ }
2690
+ export const ZodPreprocess: core.$constructor<ZodPreprocess> = /*@__PURE__*/ core.$constructor(
2691
+ "ZodPreprocess",
2692
+ (inst, def) => {
2693
+ ZodPipe.init(inst, def);
2694
+ core.$ZodPreprocess.init(inst, def);
2695
+ }
2696
+ );
2697
+
2698
+ // ZodReadonly
2699
+ export interface ZodReadonly<T extends core.SomeType = core.$ZodType>
2700
+ extends _ZodType<core.$ZodReadonlyInternals<T>>,
2701
+ core.$ZodReadonly<T> {
2702
+ "~standard": ZodStandardSchemaWithJSON<this>;
2703
+ unwrap(): T;
2704
+ }
2705
+ export const ZodReadonly: core.$constructor<ZodReadonly> = /*@__PURE__*/ core.$constructor(
2706
+ "ZodReadonly",
2707
+ (inst, def) => {
2708
+ core.$ZodReadonly.init(inst, def);
2709
+ ZodType.init(inst, def);
2710
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.readonlyProcessor(inst, ctx, json, params);
2711
+
2712
+ inst.unwrap = () => inst._zod.def.innerType;
2713
+ }
2714
+ );
2715
+
2716
+ export function readonly<T extends core.SomeType>(innerType: T): ZodReadonly<T> {
2717
+ return new ZodReadonly({
2718
+ type: "readonly",
2719
+ innerType: innerType as any as core.$ZodType,
2720
+ }) as any;
2721
+ }
2722
+
2723
+ // ZodTemplateLiteral
2724
+ export interface ZodTemplateLiteral<Template extends string = string>
2725
+ extends _ZodType<core.$ZodTemplateLiteralInternals<Template>>,
2726
+ core.$ZodTemplateLiteral<Template> {
2727
+ "~standard": ZodStandardSchemaWithJSON<this>;
2728
+ }
2729
+ export const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral> = /*@__PURE__*/ core.$constructor(
2730
+ "ZodTemplateLiteral",
2731
+ (inst, def) => {
2732
+ core.$ZodTemplateLiteral.init(inst, def);
2733
+ ZodType.init(inst, def);
2734
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.templateLiteralProcessor(inst, ctx, json, params);
2735
+ }
2736
+ );
2737
+
2738
+ export function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart[]>(
2739
+ parts: Parts,
2740
+ params?: string | core.$ZodTemplateLiteralParams
2741
+ ): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>> {
2742
+ return new ZodTemplateLiteral({
2743
+ type: "template_literal",
2744
+ parts,
2745
+ ...util.normalizeParams(params),
2746
+ }) as any;
2747
+ }
2748
+
2749
+ // ZodLazy
2750
+ export interface ZodLazy<T extends core.SomeType = core.$ZodType>
2751
+ extends _ZodType<core.$ZodLazyInternals<T>>,
2752
+ core.$ZodLazy<T> {
2753
+ "~standard": ZodStandardSchemaWithJSON<this>;
2754
+ unwrap(): T;
2755
+ }
2756
+ export const ZodLazy: core.$constructor<ZodLazy> = /*@__PURE__*/ core.$constructor("ZodLazy", (inst, def) => {
2757
+ core.$ZodLazy.init(inst, def);
2758
+ ZodType.init(inst, def);
2759
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.lazyProcessor(inst, ctx, json, params);
2760
+
2761
+ inst.unwrap = () => inst._zod.def.getter();
2762
+ });
2763
+
2764
+ export function lazy<T extends core.SomeType>(getter: () => T): ZodLazy<T> {
2765
+ return new ZodLazy({
2766
+ type: "lazy",
2767
+ getter: getter as any,
2768
+ }) as any;
2769
+ }
2770
+
2771
+ // ZodPromise
2772
+ export interface ZodPromise<T extends core.SomeType = core.$ZodType>
2773
+ extends _ZodType<core.$ZodPromiseInternals<T>>,
2774
+ core.$ZodPromise<T> {
2775
+ "~standard": ZodStandardSchemaWithJSON<this>;
2776
+ unwrap(): T;
2777
+ }
2778
+ export const ZodPromise: core.$constructor<ZodPromise> = /*@__PURE__*/ core.$constructor("ZodPromise", (inst, def) => {
2779
+ core.$ZodPromise.init(inst, def);
2780
+ ZodType.init(inst, def);
2781
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.promiseProcessor(inst, ctx, json, params);
2782
+
2783
+ inst.unwrap = () => inst._zod.def.innerType;
2784
+ });
2785
+
2786
+ export function promise<T extends core.SomeType>(innerType: T): ZodPromise<T> {
2787
+ return new ZodPromise({
2788
+ type: "promise",
2789
+ innerType: innerType as any as core.$ZodType,
2790
+ }) as any;
2791
+ }
2792
+
2793
+ // ZodFunction
2794
+ export interface ZodFunction<
2795
+ Args extends core.$ZodFunctionIn = core.$ZodFunctionIn,
2796
+ Returns extends core.$ZodFunctionOut = core.$ZodFunctionOut,
2797
+ > extends _ZodType<core.$ZodFunctionInternals<Args, Returns>>,
2798
+ core.$ZodFunction<Args, Returns> {
2799
+ "~standard": ZodStandardSchemaWithJSON<this>;
2800
+ _def: core.$ZodFunctionDef<Args, Returns>;
2801
+ _input: core.$InferInnerFunctionType<Args, Returns>;
2802
+ _output: core.$InferOuterFunctionType<Args, Returns>;
2803
+
2804
+ input<const Items extends util.TupleItems, const Rest extends core.$ZodFunctionOut = core.$ZodFunctionOut>(
2805
+ args: Items,
2806
+ rest?: Rest
2807
+ ): ZodFunction<core.$ZodTuple<Items, Rest>, Returns>;
2808
+ input<NewArgs extends core.$ZodFunctionIn>(args: NewArgs): ZodFunction<NewArgs, Returns>;
2809
+ input(...args: any[]): ZodFunction<any, Returns>;
2810
+
2811
+ output<NewReturns extends core.$ZodType>(output: NewReturns): ZodFunction<Args, NewReturns>;
2812
+ }
2813
+
2814
+ export const ZodFunction: core.$constructor<ZodFunction> = /*@__PURE__*/ core.$constructor(
2815
+ "ZodFunction",
2816
+ (inst, def) => {
2817
+ core.$ZodFunction.init(inst, def);
2818
+ ZodType.init(inst, def);
2819
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.functionProcessor(inst, ctx, json, params);
2820
+ }
2821
+ );
2822
+
2823
+ export function _function(): ZodFunction;
2824
+ export function _function<const In extends ReadonlyArray<core.$ZodType>>(params: {
2825
+ input: In;
2826
+ }): ZodFunction<ZodTuple<In, null>, core.$ZodFunctionOut>;
2827
+ export function _function<
2828
+ const In extends ReadonlyArray<core.$ZodType>,
2829
+ const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut,
2830
+ >(params: {
2831
+ input: In;
2832
+ output: Out;
2833
+ }): ZodFunction<ZodTuple<In, null>, Out>;
2834
+ export function _function<const In extends core.$ZodFunctionIn = core.$ZodFunctionIn>(params: {
2835
+ input: In;
2836
+ }): ZodFunction<In, core.$ZodFunctionOut>;
2837
+ export function _function<const Out extends core.$ZodFunctionOut = core.$ZodFunctionOut>(params: {
2838
+ output: Out;
2839
+ }): ZodFunction<core.$ZodFunctionIn, Out>;
2840
+ export function _function<
2841
+ In extends core.$ZodFunctionIn = core.$ZodFunctionIn,
2842
+ Out extends core.$ZodType = core.$ZodType,
2843
+ >(params?: {
2844
+ input: In;
2845
+ output: Out;
2846
+ }): ZodFunction<In, Out>;
2847
+ export function _function(params?: {
2848
+ output?: core.$ZodType;
2849
+ input?: core.$ZodFunctionArgs | Array<core.$ZodType>;
2850
+ }): ZodFunction {
2851
+ return new ZodFunction({
2852
+ type: "function",
2853
+ input: Array.isArray(params?.input) ? tuple(params?.input as any) : (params?.input ?? array(unknown())),
2854
+ output: params?.output ?? unknown(),
2855
+ });
2856
+ }
2857
+
2858
+ export { _function as function };
2859
+
2860
+ // ZodCustom
2861
+ export interface ZodCustom<O = unknown, I = unknown>
2862
+ extends _ZodType<core.$ZodCustomInternals<O, I>>,
2863
+ core.$ZodCustom<O, I> {
2864
+ "~standard": ZodStandardSchemaWithJSON<this>;
2865
+ }
2866
+ export const ZodCustom: core.$constructor<ZodCustom> = /*@__PURE__*/ core.$constructor("ZodCustom", (inst, def) => {
2867
+ core.$ZodCustom.init(inst, def);
2868
+ ZodType.init(inst, def);
2869
+ inst._zod.processJSONSchema = (ctx, json, params) => processors.customProcessor(inst, ctx, json, params);
2870
+ });
2871
+
2872
+ // custom checks
2873
+ export function check<O = unknown>(fn: core.CheckFn<O>): core.$ZodCheck<O> {
2874
+ const ch = new core.$ZodCheck({
2875
+ check: "custom",
2876
+ // ...util.normalizeParams(params),
2877
+ });
2878
+
2879
+ ch._zod.check = fn;
2880
+ return ch;
2881
+ }
2882
+
2883
+ export function custom<O>(
2884
+ fn?: (data: unknown) => unknown,
2885
+ _params?: string | core.$ZodCustomParams | undefined
2886
+ ): ZodCustom<O, O> {
2887
+ return core._custom(ZodCustom, fn ?? (() => true), _params) as any;
2888
+ }
2889
+
2890
+ export function refine<T>(
2891
+ fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>,
2892
+ _params: string | core.$ZodCustomParams = {}
2893
+ ): core.$ZodCheck<T> {
2894
+ return core._refine(ZodCustom, fn, _params);
2895
+ }
2896
+
2897
+ // superRefine
2898
+ export function superRefine<T>(
2899
+ fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void>,
2900
+ params?: core.$ZodSuperRefineParams
2901
+ ): core.$ZodCheck<T> {
2902
+ return core._superRefine(fn, params);
2903
+ }
2904
+
2905
+ // Re-export describe and meta from core
2906
+ export const describe = core.describe;
2907
+ export const meta = core.meta;
2908
+
2909
+ type ZodInstanceOfParams = core.Params<
2910
+ ZodCustom,
2911
+ core.$ZodIssueCustom,
2912
+ "type" | "check" | "checks" | "fn" | "abort" | "error" | "params" | "path"
2913
+ >;
2914
+
2915
+ // ZodInstanceOf
2916
+ export interface ZodInstanceOf<T = unknown> extends ZodCustom<T, T> {
2917
+ // the shape is keyed off the instance type, so keys autocomplete and a schema that can't accept the property's type is an error. Methods are excluded: every object literal inherits Object.prototype.toString, which would otherwise collide with the constraint's own toString entry and reject every shape.
2918
+ properties<Shape extends { [k in keyof T as T[k] extends Function ? never : k]?: core.$ZodType<unknown, T[k]> }>(
2919
+ shape: Shape,
2920
+ params?: string | core.$ZodCheckPropertiesParams
2921
+ ): ZodInstanceOf<T & core.$InferObjectInput<Shape, {}>>;
2922
+ }
2923
+ export const ZodInstanceOf: core.$constructor<ZodInstanceOf> = /*@__PURE__*/ core.$constructor(
2924
+ "ZodInstanceOf",
2925
+ (inst, def) => {
2926
+ ZodCustom.init(inst, def);
2927
+ },
2928
+ {
2929
+ properties(shape: core.$ZodShape, params?: string | core.$ZodCheckPropertiesParams) {
2930
+ // asserts in place, so the narrowed output type is truthful without a wrapper
2931
+ return this.check(core._properties(shape, params)) as any;
2932
+ },
2933
+ }
2934
+ );
2935
+
2936
+ function _instanceof<T extends typeof util.Class>(
2937
+ cls: T,
2938
+ params: ZodInstanceOfParams = {}
2939
+ ): ZodInstanceOf<InstanceType<T>> {
2940
+ const inst = new ZodInstanceOf({
2941
+ type: "custom",
2942
+ check: "custom",
2943
+ fn: (data: unknown) => data instanceof cls,
2944
+ abort: true,
2945
+ ...(util.normalizeParams(params) as any),
2946
+ });
2947
+ inst._zod.bag.Class = cls;
2948
+ // Override check to emit invalid_type instead of custom
2949
+ inst._zod.check = (payload) => {
2950
+ if (!(payload.value instanceof cls)) {
2951
+ payload.issues.push({
2952
+ code: "invalid_type",
2953
+ expected: cls.name,
2954
+ input: payload.value,
2955
+ inst,
2956
+ path: [...(inst._zod.def.path ?? [])],
2957
+ });
2958
+ }
2959
+ };
2960
+ return inst as any;
2961
+ }
2962
+ export { _instanceof as instanceof };
2963
+
2964
+ // stringbool
2965
+ export const stringbool: (_params?: string | core.$ZodStringBoolParams) => ZodCodec<ZodString, ZodBoolean> = (
2966
+ ...args
2967
+ ) =>
2968
+ core._stringbool(
2969
+ {
2970
+ Codec: ZodCodec,
2971
+ Boolean: ZodBoolean,
2972
+ String: ZodString,
2973
+ },
2974
+ ...args
2975
+ ) as any;
2976
+
2977
+ // json
2978
+ type _ZodJSONSchema = ZodUnion<
2979
+ [ZodString, ZodNumber, ZodBoolean, ZodNull, ZodArray<ZodJSONSchema>, ZodRecord<ZodString, ZodJSONSchema>]
2980
+ >;
2981
+ type _ZodJSONSchemaInternals = _ZodJSONSchema["_zod"];
2982
+
2983
+ export interface ZodJSONSchemaInternals extends _ZodJSONSchemaInternals {
2984
+ output: util.JSONType;
2985
+ input: util.JSONType;
2986
+ }
2987
+ export interface ZodJSONSchema extends _ZodJSONSchema {
2988
+ _zod: ZodJSONSchemaInternals;
2989
+ }
2990
+
2991
+ export function json(params?: string | core.$ZodCustomParams): ZodJSONSchema {
2992
+ const jsonSchema: any = lazy(() => {
2993
+ return union([string(params), number(), boolean(), _null(), array(jsonSchema), record(string(), jsonSchema)]);
2994
+ });
2995
+
2996
+ return jsonSchema;
2997
+ }
2998
+
2999
+ // preprocess
3000
+
3001
+ export function preprocess<A, U extends core.SomeType, B = unknown>(
3002
+ fn: (arg: B, ctx: core.$RefinementCtx) => A,
3003
+ schema: U
3004
+ ): ZodPreprocess<U, B> {
3005
+ return new ZodPreprocess({
3006
+ type: "pipe",
3007
+ in: transform(fn as any) as any as core.$ZodTransform,
3008
+ out: schema as any as core.$ZodType,
3009
+ }) as any;
3010
+ }