makecoder 1.0.25

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 (656) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +281 -0
  3. package/claude/commands/dev/ultra-think.md +153 -0
  4. package/claude/commands/docs/generate-api-documentation.md +80 -0
  5. package/claude/commands/git/commit.md +63 -0
  6. package/claude/commands/git/status.md +39 -0
  7. package/claude/commands/setup/migrate-to-typescript.md +76 -0
  8. package/claude/commands/test/generate-test-cases.md +76 -0
  9. package/dist/cc.mjs +4654 -0
  10. package/dist/coder.js +201 -0
  11. package/dist/codex +0 -0
  12. package/dist/codex.exe +0 -0
  13. package/dist/codex.mjs +162 -0
  14. package/dist/gcli.mjs +3162 -0
  15. package/dist/vendor/claude-code-jetbrains-plugin/lib/annotations-23.0.0.jar +0 -0
  16. package/dist/vendor/claude-code-jetbrains-plugin/lib/claude-code-jetbrains-plugin-0.1.12-beta-searchableOptions.jar +0 -0
  17. package/dist/vendor/claude-code-jetbrains-plugin/lib/claude-code-jetbrains-plugin-0.1.12-beta.jar +0 -0
  18. package/dist/vendor/claude-code-jetbrains-plugin/lib/config-1.4.3.jar +0 -0
  19. package/dist/vendor/claude-code-jetbrains-plugin/lib/jansi-2.4.1.jar +0 -0
  20. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlin-logging-jvm-7.0.0.jar +0 -0
  21. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlin-reflect-2.0.21.jar +0 -0
  22. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlin-sdk-jvm-0.4.0.jar +0 -0
  23. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlin-stdlib-2.1.20.jar +0 -0
  24. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-coroutines-core-jvm-1.9.0.jar +0 -0
  25. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-coroutines-slf4j-1.9.0.jar +0 -0
  26. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-io-bytestring-jvm-0.5.4.jar +0 -0
  27. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-io-core-jvm-0.5.4.jar +0 -0
  28. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-serialization-core-jvm-1.8.1.jar +0 -0
  29. package/dist/vendor/claude-code-jetbrains-plugin/lib/kotlinx-serialization-json-jvm-1.8.1.jar +0 -0
  30. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-client-cio-jvm-3.0.2.jar +0 -0
  31. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-client-core-jvm-3.0.2.jar +0 -0
  32. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-events-jvm-3.0.2.jar +0 -0
  33. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-http-cio-jvm-3.0.2.jar +0 -0
  34. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-http-jvm-3.0.2.jar +0 -0
  35. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-io-jvm-3.0.2.jar +0 -0
  36. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-network-jvm-3.0.2.jar +0 -0
  37. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-network-tls-jvm-3.0.2.jar +0 -0
  38. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-serialization-jvm-3.0.2.jar +0 -0
  39. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-server-cio-jvm-3.0.2.jar +0 -0
  40. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-server-core-jvm-3.0.2.jar +0 -0
  41. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-server-sse-jvm-3.0.2.jar +0 -0
  42. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-server-websockets-jvm-3.0.2.jar +0 -0
  43. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-sse-jvm-3.0.2.jar +0 -0
  44. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-utils-jvm-3.0.2.jar +0 -0
  45. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-websocket-serialization-jvm-3.0.2.jar +0 -0
  46. package/dist/vendor/claude-code-jetbrains-plugin/lib/ktor-websockets-jvm-3.0.2.jar +0 -0
  47. package/dist/vendor/claude-code-jetbrains-plugin/lib/slf4j-api-2.0.16.jar +0 -0
  48. package/dist/vendor/ripgrep/COPYING +3 -0
  49. package/dist/vendor/ripgrep/arm64-darwin/rg +0 -0
  50. package/dist/vendor/ripgrep/arm64-darwin/ripgrep.node +0 -0
  51. package/dist/vendor/ripgrep/arm64-linux/rg +0 -0
  52. package/dist/vendor/ripgrep/arm64-linux/ripgrep.node +0 -0
  53. package/dist/vendor/ripgrep/x64-darwin/rg +0 -0
  54. package/dist/vendor/ripgrep/x64-darwin/ripgrep.node +0 -0
  55. package/dist/vendor/ripgrep/x64-linux/rg +0 -0
  56. package/dist/vendor/ripgrep/x64-linux/ripgrep.node +0 -0
  57. package/dist/vendor/ripgrep/x64-win32/rg.exe +0 -0
  58. package/dist/vendor/ripgrep/x64-win32/ripgrep.node +0 -0
  59. package/dist/zod/LICENSE +21 -0
  60. package/dist/zod/README.md +208 -0
  61. package/dist/zod/index.cjs +33 -0
  62. package/dist/zod/index.d.cts +4 -0
  63. package/dist/zod/index.d.ts +4 -0
  64. package/dist/zod/index.js +4 -0
  65. package/dist/zod/package.json +118 -0
  66. package/dist/zod/src/index.ts +4 -0
  67. package/dist/zod/src/v3/ZodError.ts +330 -0
  68. package/dist/zod/src/v3/benchmarks/datetime.ts +58 -0
  69. package/dist/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
  70. package/dist/zod/src/v3/benchmarks/index.ts +59 -0
  71. package/dist/zod/src/v3/benchmarks/ipv4.ts +57 -0
  72. package/dist/zod/src/v3/benchmarks/object.ts +69 -0
  73. package/dist/zod/src/v3/benchmarks/primitives.ts +162 -0
  74. package/dist/zod/src/v3/benchmarks/realworld.ts +63 -0
  75. package/dist/zod/src/v3/benchmarks/string.ts +55 -0
  76. package/dist/zod/src/v3/benchmarks/union.ts +80 -0
  77. package/dist/zod/src/v3/errors.ts +13 -0
  78. package/dist/zod/src/v3/external.ts +6 -0
  79. package/dist/zod/src/v3/helpers/enumUtil.ts +17 -0
  80. package/dist/zod/src/v3/helpers/errorUtil.ts +8 -0
  81. package/dist/zod/src/v3/helpers/parseUtil.ts +176 -0
  82. package/dist/zod/src/v3/helpers/partialUtil.ts +34 -0
  83. package/dist/zod/src/v3/helpers/typeAliases.ts +2 -0
  84. package/dist/zod/src/v3/helpers/util.ts +224 -0
  85. package/dist/zod/src/v3/index.ts +4 -0
  86. package/dist/zod/src/v3/locales/en.ts +124 -0
  87. package/dist/zod/src/v3/standard-schema.ts +113 -0
  88. package/dist/zod/src/v3/tests/Mocker.ts +54 -0
  89. package/dist/zod/src/v3/tests/all-errors.test.ts +157 -0
  90. package/dist/zod/src/v3/tests/anyunknown.test.ts +28 -0
  91. package/dist/zod/src/v3/tests/array.test.ts +71 -0
  92. package/dist/zod/src/v3/tests/async-parsing.test.ts +388 -0
  93. package/dist/zod/src/v3/tests/async-refinements.test.ts +46 -0
  94. package/dist/zod/src/v3/tests/base.test.ts +29 -0
  95. package/dist/zod/src/v3/tests/bigint.test.ts +55 -0
  96. package/dist/zod/src/v3/tests/branded.test.ts +53 -0
  97. package/dist/zod/src/v3/tests/catch.test.ts +220 -0
  98. package/dist/zod/src/v3/tests/coerce.test.ts +133 -0
  99. package/dist/zod/src/v3/tests/complex.test.ts +56 -0
  100. package/dist/zod/src/v3/tests/custom.test.ts +31 -0
  101. package/dist/zod/src/v3/tests/date.test.ts +32 -0
  102. package/dist/zod/src/v3/tests/deepmasking.test.ts +186 -0
  103. package/dist/zod/src/v3/tests/default.test.ts +112 -0
  104. package/dist/zod/src/v3/tests/description.test.ts +33 -0
  105. package/dist/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
  106. package/dist/zod/src/v3/tests/enum.test.ts +80 -0
  107. package/dist/zod/src/v3/tests/error.test.ts +551 -0
  108. package/dist/zod/src/v3/tests/firstparty.test.ts +87 -0
  109. package/dist/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
  110. package/dist/zod/src/v3/tests/function.test.ts +257 -0
  111. package/dist/zod/src/v3/tests/generics.test.ts +48 -0
  112. package/dist/zod/src/v3/tests/instanceof.test.ts +37 -0
  113. package/dist/zod/src/v3/tests/intersection.test.ts +110 -0
  114. package/dist/zod/src/v3/tests/language-server.source.ts +76 -0
  115. package/dist/zod/src/v3/tests/language-server.test.ts +207 -0
  116. package/dist/zod/src/v3/tests/literal.test.ts +36 -0
  117. package/dist/zod/src/v3/tests/map.test.ts +110 -0
  118. package/dist/zod/src/v3/tests/masking.test.ts +4 -0
  119. package/dist/zod/src/v3/tests/mocker.test.ts +19 -0
  120. package/dist/zod/src/v3/tests/nan.test.ts +21 -0
  121. package/dist/zod/src/v3/tests/nativeEnum.test.ts +87 -0
  122. package/dist/zod/src/v3/tests/nullable.test.ts +42 -0
  123. package/dist/zod/src/v3/tests/number.test.ts +176 -0
  124. package/dist/zod/src/v3/tests/object-augmentation.test.ts +29 -0
  125. package/dist/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
  126. package/dist/zod/src/v3/tests/object.test.ts +434 -0
  127. package/dist/zod/src/v3/tests/optional.test.ts +42 -0
  128. package/dist/zod/src/v3/tests/parseUtil.test.ts +23 -0
  129. package/dist/zod/src/v3/tests/parser.test.ts +41 -0
  130. package/dist/zod/src/v3/tests/partials.test.ts +243 -0
  131. package/dist/zod/src/v3/tests/pickomit.test.ts +111 -0
  132. package/dist/zod/src/v3/tests/pipeline.test.ts +29 -0
  133. package/dist/zod/src/v3/tests/preprocess.test.ts +186 -0
  134. package/dist/zod/src/v3/tests/primitive.test.ts +440 -0
  135. package/dist/zod/src/v3/tests/promise.test.ts +90 -0
  136. package/dist/zod/src/v3/tests/readonly.test.ts +194 -0
  137. package/dist/zod/src/v3/tests/record.test.ts +171 -0
  138. package/dist/zod/src/v3/tests/recursive.test.ts +197 -0
  139. package/dist/zod/src/v3/tests/refine.test.ts +313 -0
  140. package/dist/zod/src/v3/tests/safeparse.test.ts +27 -0
  141. package/dist/zod/src/v3/tests/set.test.ts +142 -0
  142. package/dist/zod/src/v3/tests/standard-schema.test.ts +83 -0
  143. package/dist/zod/src/v3/tests/string.test.ts +916 -0
  144. package/dist/zod/src/v3/tests/transformer.test.ts +233 -0
  145. package/dist/zod/src/v3/tests/tuple.test.ts +90 -0
  146. package/dist/zod/src/v3/tests/unions.test.ts +57 -0
  147. package/dist/zod/src/v3/tests/validations.test.ts +133 -0
  148. package/dist/zod/src/v3/tests/void.test.ts +15 -0
  149. package/dist/zod/src/v3/types.ts +5136 -0
  150. package/dist/zod/src/v4/classic/checks.ts +30 -0
  151. package/dist/zod/src/v4/classic/coerce.ts +27 -0
  152. package/dist/zod/src/v4/classic/compat.ts +66 -0
  153. package/dist/zod/src/v4/classic/errors.ts +75 -0
  154. package/dist/zod/src/v4/classic/external.ts +50 -0
  155. package/dist/zod/src/v4/classic/index.ts +5 -0
  156. package/dist/zod/src/v4/classic/iso.ts +90 -0
  157. package/dist/zod/src/v4/classic/parse.ts +33 -0
  158. package/dist/zod/src/v4/classic/schemas.ts +2054 -0
  159. package/dist/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
  160. package/dist/zod/src/v4/classic/tests/array.test.ts +264 -0
  161. package/dist/zod/src/v4/classic/tests/assignability.test.ts +210 -0
  162. package/dist/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
  163. package/dist/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
  164. package/dist/zod/src/v4/classic/tests/base.test.ts +7 -0
  165. package/dist/zod/src/v4/classic/tests/bigint.test.ts +54 -0
  166. package/dist/zod/src/v4/classic/tests/brand.test.ts +63 -0
  167. package/dist/zod/src/v4/classic/tests/catch.test.ts +252 -0
  168. package/dist/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
  169. package/dist/zod/src/v4/classic/tests/coerce.test.ts +160 -0
  170. package/dist/zod/src/v4/classic/tests/continuability.test.ts +352 -0
  171. package/dist/zod/src/v4/classic/tests/custom.test.ts +40 -0
  172. package/dist/zod/src/v4/classic/tests/date.test.ts +31 -0
  173. package/dist/zod/src/v4/classic/tests/datetime.test.ts +296 -0
  174. package/dist/zod/src/v4/classic/tests/default.test.ts +313 -0
  175. package/dist/zod/src/v4/classic/tests/description.test.ts +32 -0
  176. package/dist/zod/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
  177. package/dist/zod/src/v4/classic/tests/enum.test.ts +285 -0
  178. package/dist/zod/src/v4/classic/tests/error-utils.test.ts +527 -0
  179. package/dist/zod/src/v4/classic/tests/error.test.ts +711 -0
  180. package/dist/zod/src/v4/classic/tests/file.test.ts +91 -0
  181. package/dist/zod/src/v4/classic/tests/firstparty.test.ts +175 -0
  182. package/dist/zod/src/v4/classic/tests/function.test.ts +268 -0
  183. package/dist/zod/src/v4/classic/tests/generics.test.ts +72 -0
  184. package/dist/zod/src/v4/classic/tests/index.test.ts +829 -0
  185. package/dist/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
  186. package/dist/zod/src/v4/classic/tests/intersection.test.ts +171 -0
  187. package/dist/zod/src/v4/classic/tests/json.test.ts +108 -0
  188. package/dist/zod/src/v4/classic/tests/lazy.test.ts +227 -0
  189. package/dist/zod/src/v4/classic/tests/literal.test.ts +92 -0
  190. package/dist/zod/src/v4/classic/tests/map.test.ts +196 -0
  191. package/dist/zod/src/v4/classic/tests/nan.test.ts +21 -0
  192. package/dist/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
  193. package/dist/zod/src/v4/classic/tests/nonoptional.test.ts +86 -0
  194. package/dist/zod/src/v4/classic/tests/nullable.test.ts +22 -0
  195. package/dist/zod/src/v4/classic/tests/number.test.ts +247 -0
  196. package/dist/zod/src/v4/classic/tests/object.test.ts +563 -0
  197. package/dist/zod/src/v4/classic/tests/optional.test.ts +123 -0
  198. package/dist/zod/src/v4/classic/tests/partial.test.ts +147 -0
  199. package/dist/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
  200. package/dist/zod/src/v4/classic/tests/pipe.test.ts +81 -0
  201. package/dist/zod/src/v4/classic/tests/prefault.test.ts +37 -0
  202. package/dist/zod/src/v4/classic/tests/preprocess.test.ts +298 -0
  203. package/dist/zod/src/v4/classic/tests/primitive.test.ts +175 -0
  204. package/dist/zod/src/v4/classic/tests/promise.test.ts +81 -0
  205. package/dist/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
  206. package/dist/zod/src/v4/classic/tests/readonly.test.ts +252 -0
  207. package/dist/zod/src/v4/classic/tests/record.test.ts +342 -0
  208. package/dist/zod/src/v4/classic/tests/recursive-types.test.ts +356 -0
  209. package/dist/zod/src/v4/classic/tests/refine.test.ts +532 -0
  210. package/dist/zod/src/v4/classic/tests/registries.test.ts +204 -0
  211. package/dist/zod/src/v4/classic/tests/set.test.ts +179 -0
  212. package/dist/zod/src/v4/classic/tests/standard-schema.test.ts +57 -0
  213. package/dist/zod/src/v4/classic/tests/string-formats.test.ts +109 -0
  214. package/dist/zod/src/v4/classic/tests/string.test.ts +881 -0
  215. package/dist/zod/src/v4/classic/tests/stringbool.test.ts +66 -0
  216. package/dist/zod/src/v4/classic/tests/template-literal.test.ts +758 -0
  217. package/dist/zod/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
  218. package/dist/zod/src/v4/classic/tests/transform.test.ts +250 -0
  219. package/dist/zod/src/v4/classic/tests/tuple.test.ts +163 -0
  220. package/dist/zod/src/v4/classic/tests/union.test.ts +94 -0
  221. package/dist/zod/src/v4/classic/tests/validations.test.ts +283 -0
  222. package/dist/zod/src/v4/classic/tests/void.test.ts +12 -0
  223. package/dist/zod/src/v4/core/api.ts +1594 -0
  224. package/dist/zod/src/v4/core/checks.ts +1283 -0
  225. package/dist/zod/src/v4/core/config.ts +15 -0
  226. package/dist/zod/src/v4/core/core.ts +134 -0
  227. package/dist/zod/src/v4/core/doc.ts +44 -0
  228. package/dist/zod/src/v4/core/errors.ts +424 -0
  229. package/dist/zod/src/v4/core/function.ts +176 -0
  230. package/dist/zod/src/v4/core/index.ts +15 -0
  231. package/dist/zod/src/v4/core/json-schema.ts +143 -0
  232. package/dist/zod/src/v4/core/parse.ts +94 -0
  233. package/dist/zod/src/v4/core/regexes.ts +135 -0
  234. package/dist/zod/src/v4/core/registries.ts +96 -0
  235. package/dist/zod/src/v4/core/schemas.ts +3842 -0
  236. package/dist/zod/src/v4/core/standard-schema.ts +64 -0
  237. package/dist/zod/src/v4/core/tests/index.test.ts +46 -0
  238. package/dist/zod/src/v4/core/tests/locales/be.test.ts +124 -0
  239. package/dist/zod/src/v4/core/tests/locales/en.test.ts +22 -0
  240. package/dist/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
  241. package/dist/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
  242. package/dist/zod/src/v4/core/to-json-schema.ts +977 -0
  243. package/dist/zod/src/v4/core/util.ts +775 -0
  244. package/dist/zod/src/v4/core/versions.ts +5 -0
  245. package/dist/zod/src/v4/core/zsf.ts +323 -0
  246. package/dist/zod/src/v4/index.ts +4 -0
  247. package/dist/zod/src/v4/locales/ar.ts +125 -0
  248. package/dist/zod/src/v4/locales/az.ts +121 -0
  249. package/dist/zod/src/v4/locales/be.ts +184 -0
  250. package/dist/zod/src/v4/locales/ca.ts +127 -0
  251. package/dist/zod/src/v4/locales/cs.ts +142 -0
  252. package/dist/zod/src/v4/locales/de.ts +124 -0
  253. package/dist/zod/src/v4/locales/en.ts +127 -0
  254. package/dist/zod/src/v4/locales/eo.ts +125 -0
  255. package/dist/zod/src/v4/locales/es.ts +125 -0
  256. package/dist/zod/src/v4/locales/fa.ts +134 -0
  257. package/dist/zod/src/v4/locales/fi.ts +131 -0
  258. package/dist/zod/src/v4/locales/fr-CA.ts +126 -0
  259. package/dist/zod/src/v4/locales/fr.ts +124 -0
  260. package/dist/zod/src/v4/locales/he.ts +125 -0
  261. package/dist/zod/src/v4/locales/hu.ts +126 -0
  262. package/dist/zod/src/v4/locales/id.ts +125 -0
  263. package/dist/zod/src/v4/locales/index.ts +39 -0
  264. package/dist/zod/src/v4/locales/it.ts +125 -0
  265. package/dist/zod/src/v4/locales/ja.ts +122 -0
  266. package/dist/zod/src/v4/locales/kh.ts +126 -0
  267. package/dist/zod/src/v4/locales/ko.ts +131 -0
  268. package/dist/zod/src/v4/locales/mk.ts +127 -0
  269. package/dist/zod/src/v4/locales/ms.ts +124 -0
  270. package/dist/zod/src/v4/locales/nl.ts +126 -0
  271. package/dist/zod/src/v4/locales/no.ts +124 -0
  272. package/dist/zod/src/v4/locales/ota.ts +125 -0
  273. package/dist/zod/src/v4/locales/pl.ts +126 -0
  274. package/dist/zod/src/v4/locales/ps.ts +133 -0
  275. package/dist/zod/src/v4/locales/pt.ts +123 -0
  276. package/dist/zod/src/v4/locales/ru.ts +184 -0
  277. package/dist/zod/src/v4/locales/sl.ts +126 -0
  278. package/dist/zod/src/v4/locales/sv.ts +127 -0
  279. package/dist/zod/src/v4/locales/ta.ts +125 -0
  280. package/dist/zod/src/v4/locales/th.ts +126 -0
  281. package/dist/zod/src/v4/locales/tr.ts +121 -0
  282. package/dist/zod/src/v4/locales/ua.ts +126 -0
  283. package/dist/zod/src/v4/locales/ur.ts +126 -0
  284. package/dist/zod/src/v4/locales/vi.ts +125 -0
  285. package/dist/zod/src/v4/locales/zh-CN.ts +123 -0
  286. package/dist/zod/src/v4/locales/zh-TW.ts +125 -0
  287. package/dist/zod/src/v4/mini/checks.ts +32 -0
  288. package/dist/zod/src/v4/mini/coerce.ts +22 -0
  289. package/dist/zod/src/v4/mini/external.ts +40 -0
  290. package/dist/zod/src/v4/mini/index.ts +3 -0
  291. package/dist/zod/src/v4/mini/iso.ts +62 -0
  292. package/dist/zod/src/v4/mini/parse.ts +1 -0
  293. package/dist/zod/src/v4/mini/schemas.ts +1579 -0
  294. package/dist/zod/src/v4/mini/tests/assignability.test.ts +129 -0
  295. package/dist/zod/src/v4/mini/tests/brand.test.ts +51 -0
  296. package/dist/zod/src/v4/mini/tests/checks.test.ts +144 -0
  297. package/dist/zod/src/v4/mini/tests/computed.test.ts +36 -0
  298. package/dist/zod/src/v4/mini/tests/error.test.ts +22 -0
  299. package/dist/zod/src/v4/mini/tests/functions.test.ts +43 -0
  300. package/dist/zod/src/v4/mini/tests/index.test.ts +871 -0
  301. package/dist/zod/src/v4/mini/tests/number.test.ts +95 -0
  302. package/dist/zod/src/v4/mini/tests/object.test.ts +185 -0
  303. package/dist/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
  304. package/dist/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
  305. package/dist/zod/src/v4/mini/tests/string.test.ts +299 -0
  306. package/dist/zod/src/v4-mini/index.ts +1 -0
  307. package/dist/zod/v3/ZodError.cjs +138 -0
  308. package/dist/zod/v3/ZodError.d.cts +164 -0
  309. package/dist/zod/v3/ZodError.d.ts +164 -0
  310. package/dist/zod/v3/ZodError.js +133 -0
  311. package/dist/zod/v3/errors.cjs +17 -0
  312. package/dist/zod/v3/errors.d.cts +5 -0
  313. package/dist/zod/v3/errors.d.ts +5 -0
  314. package/dist/zod/v3/errors.js +9 -0
  315. package/dist/zod/v3/external.cjs +22 -0
  316. package/dist/zod/v3/external.d.cts +6 -0
  317. package/dist/zod/v3/external.d.ts +6 -0
  318. package/dist/zod/v3/external.js +6 -0
  319. package/dist/zod/v3/helpers/enumUtil.cjs +2 -0
  320. package/dist/zod/v3/helpers/enumUtil.d.cts +8 -0
  321. package/dist/zod/v3/helpers/enumUtil.d.ts +8 -0
  322. package/dist/zod/v3/helpers/enumUtil.js +1 -0
  323. package/dist/zod/v3/helpers/errorUtil.cjs +9 -0
  324. package/dist/zod/v3/helpers/errorUtil.d.cts +9 -0
  325. package/dist/zod/v3/helpers/errorUtil.d.ts +9 -0
  326. package/dist/zod/v3/helpers/errorUtil.js +6 -0
  327. package/dist/zod/v3/helpers/parseUtil.cjs +124 -0
  328. package/dist/zod/v3/helpers/parseUtil.d.cts +78 -0
  329. package/dist/zod/v3/helpers/parseUtil.d.ts +78 -0
  330. package/dist/zod/v3/helpers/parseUtil.js +109 -0
  331. package/dist/zod/v3/helpers/partialUtil.cjs +2 -0
  332. package/dist/zod/v3/helpers/partialUtil.d.cts +8 -0
  333. package/dist/zod/v3/helpers/partialUtil.d.ts +8 -0
  334. package/dist/zod/v3/helpers/partialUtil.js +1 -0
  335. package/dist/zod/v3/helpers/typeAliases.cjs +2 -0
  336. package/dist/zod/v3/helpers/typeAliases.d.cts +2 -0
  337. package/dist/zod/v3/helpers/typeAliases.d.ts +2 -0
  338. package/dist/zod/v3/helpers/typeAliases.js +1 -0
  339. package/dist/zod/v3/helpers/util.cjs +137 -0
  340. package/dist/zod/v3/helpers/util.d.cts +85 -0
  341. package/dist/zod/v3/helpers/util.d.ts +85 -0
  342. package/dist/zod/v3/helpers/util.js +133 -0
  343. package/dist/zod/v3/index.cjs +33 -0
  344. package/dist/zod/v3/index.d.cts +4 -0
  345. package/dist/zod/v3/index.d.ts +4 -0
  346. package/dist/zod/v3/index.js +4 -0
  347. package/dist/zod/v3/locales/en.cjs +111 -0
  348. package/dist/zod/v3/locales/en.d.cts +3 -0
  349. package/dist/zod/v3/locales/en.d.ts +3 -0
  350. package/dist/zod/v3/locales/en.js +109 -0
  351. package/dist/zod/v3/standard-schema.cjs +2 -0
  352. package/dist/zod/v3/standard-schema.d.cts +102 -0
  353. package/dist/zod/v3/standard-schema.d.ts +102 -0
  354. package/dist/zod/v3/standard-schema.js +1 -0
  355. package/dist/zod/v3/types.cjs +3775 -0
  356. package/dist/zod/v3/types.d.cts +1031 -0
  357. package/dist/zod/v3/types.d.ts +1031 -0
  358. package/dist/zod/v3/types.js +3693 -0
  359. package/dist/zod/v4/classic/checks.cjs +32 -0
  360. package/dist/zod/v4/classic/checks.d.cts +1 -0
  361. package/dist/zod/v4/classic/checks.d.ts +1 -0
  362. package/dist/zod/v4/classic/checks.js +1 -0
  363. package/dist/zod/v4/classic/coerce.cjs +47 -0
  364. package/dist/zod/v4/classic/coerce.d.cts +17 -0
  365. package/dist/zod/v4/classic/coerce.d.ts +17 -0
  366. package/dist/zod/v4/classic/coerce.js +17 -0
  367. package/dist/zod/v4/classic/compat.cjs +57 -0
  368. package/dist/zod/v4/classic/compat.d.cts +46 -0
  369. package/dist/zod/v4/classic/compat.d.ts +46 -0
  370. package/dist/zod/v4/classic/compat.js +27 -0
  371. package/dist/zod/v4/classic/errors.cjs +67 -0
  372. package/dist/zod/v4/classic/errors.d.cts +30 -0
  373. package/dist/zod/v4/classic/errors.d.ts +30 -0
  374. package/dist/zod/v4/classic/errors.js +41 -0
  375. package/dist/zod/v4/classic/external.cjs +70 -0
  376. package/dist/zod/v4/classic/external.d.cts +13 -0
  377. package/dist/zod/v4/classic/external.d.ts +13 -0
  378. package/dist/zod/v4/classic/external.js +18 -0
  379. package/dist/zod/v4/classic/index.cjs +33 -0
  380. package/dist/zod/v4/classic/index.d.cts +4 -0
  381. package/dist/zod/v4/classic/index.d.ts +4 -0
  382. package/dist/zod/v4/classic/index.js +4 -0
  383. package/dist/zod/v4/classic/iso.cjs +60 -0
  384. package/dist/zod/v4/classic/iso.d.cts +22 -0
  385. package/dist/zod/v4/classic/iso.d.ts +22 -0
  386. package/dist/zod/v4/classic/iso.js +30 -0
  387. package/dist/zod/v4/classic/parse.cjs +32 -0
  388. package/dist/zod/v4/classic/parse.d.cts +23 -0
  389. package/dist/zod/v4/classic/parse.d.ts +23 -0
  390. package/dist/zod/v4/classic/parse.js +6 -0
  391. package/dist/zod/v4/classic/schemas.cjs +1109 -0
  392. package/dist/zod/v4/classic/schemas.d.cts +630 -0
  393. package/dist/zod/v4/classic/schemas.d.ts +630 -0
  394. package/dist/zod/v4/classic/schemas.js +1006 -0
  395. package/dist/zod/v4/core/api.cjs +1039 -0
  396. package/dist/zod/v4/core/api.d.cts +284 -0
  397. package/dist/zod/v4/core/api.d.ts +284 -0
  398. package/dist/zod/v4/core/api.js +906 -0
  399. package/dist/zod/v4/core/checks.cjs +591 -0
  400. package/dist/zod/v4/core/checks.d.cts +278 -0
  401. package/dist/zod/v4/core/checks.d.ts +278 -0
  402. package/dist/zod/v4/core/checks.js +565 -0
  403. package/dist/zod/v4/core/core.cjs +67 -0
  404. package/dist/zod/v4/core/core.d.cts +49 -0
  405. package/dist/zod/v4/core/core.d.ts +49 -0
  406. package/dist/zod/v4/core/core.js +61 -0
  407. package/dist/zod/v4/core/doc.cjs +39 -0
  408. package/dist/zod/v4/core/doc.d.cts +14 -0
  409. package/dist/zod/v4/core/doc.d.ts +14 -0
  410. package/dist/zod/v4/core/doc.js +35 -0
  411. package/dist/zod/v4/core/errors.cjs +226 -0
  412. package/dist/zod/v4/core/errors.d.cts +208 -0
  413. package/dist/zod/v4/core/errors.d.ts +208 -0
  414. package/dist/zod/v4/core/errors.js +195 -0
  415. package/dist/zod/v4/core/function.cjs +102 -0
  416. package/dist/zod/v4/core/function.d.cts +52 -0
  417. package/dist/zod/v4/core/function.d.ts +52 -0
  418. package/dist/zod/v4/core/function.js +75 -0
  419. package/dist/zod/v4/core/index.cjs +44 -0
  420. package/dist/zod/v4/core/index.d.cts +15 -0
  421. package/dist/zod/v4/core/index.d.ts +15 -0
  422. package/dist/zod/v4/core/index.js +15 -0
  423. package/dist/zod/v4/core/json-schema.cjs +2 -0
  424. package/dist/zod/v4/core/json-schema.d.cts +87 -0
  425. package/dist/zod/v4/core/json-schema.d.ts +87 -0
  426. package/dist/zod/v4/core/json-schema.js +1 -0
  427. package/dist/zod/v4/core/parse.cjs +87 -0
  428. package/dist/zod/v4/core/parse.d.cts +25 -0
  429. package/dist/zod/v4/core/parse.d.ts +25 -0
  430. package/dist/zod/v4/core/parse.js +57 -0
  431. package/dist/zod/v4/core/regexes.cjs +103 -0
  432. package/dist/zod/v4/core/regexes.d.cts +62 -0
  433. package/dist/zod/v4/core/regexes.d.ts +62 -0
  434. package/dist/zod/v4/core/regexes.js +95 -0
  435. package/dist/zod/v4/core/registries.cjs +56 -0
  436. package/dist/zod/v4/core/registries.d.cts +35 -0
  437. package/dist/zod/v4/core/registries.d.ts +35 -0
  438. package/dist/zod/v4/core/registries.js +51 -0
  439. package/dist/zod/v4/core/schemas.cjs +1748 -0
  440. package/dist/zod/v4/core/schemas.d.cts +1041 -0
  441. package/dist/zod/v4/core/schemas.d.ts +1041 -0
  442. package/dist/zod/v4/core/schemas.js +1717 -0
  443. package/dist/zod/v4/core/standard-schema.cjs +2 -0
  444. package/dist/zod/v4/core/standard-schema.d.cts +55 -0
  445. package/dist/zod/v4/core/standard-schema.d.ts +55 -0
  446. package/dist/zod/v4/core/standard-schema.js +1 -0
  447. package/dist/zod/v4/core/to-json-schema.cjs +854 -0
  448. package/dist/zod/v4/core/to-json-schema.d.cts +88 -0
  449. package/dist/zod/v4/core/to-json-schema.d.ts +88 -0
  450. package/dist/zod/v4/core/to-json-schema.js +849 -0
  451. package/dist/zod/v4/core/util.cjs +539 -0
  452. package/dist/zod/v4/core/util.d.cts +183 -0
  453. package/dist/zod/v4/core/util.d.ts +183 -0
  454. package/dist/zod/v4/core/util.js +493 -0
  455. package/dist/zod/v4/core/versions.cjs +8 -0
  456. package/dist/zod/v4/core/versions.d.cts +5 -0
  457. package/dist/zod/v4/core/versions.d.ts +5 -0
  458. package/dist/zod/v4/core/versions.js +5 -0
  459. package/dist/zod/v4/index.cjs +22 -0
  460. package/dist/zod/v4/index.d.cts +3 -0
  461. package/dist/zod/v4/index.d.ts +3 -0
  462. package/dist/zod/v4/index.js +3 -0
  463. package/dist/zod/v4/locales/ar.cjs +142 -0
  464. package/dist/zod/v4/locales/ar.d.cts +4 -0
  465. package/dist/zod/v4/locales/ar.d.ts +4 -0
  466. package/dist/zod/v4/locales/ar.js +116 -0
  467. package/dist/zod/v4/locales/az.cjs +141 -0
  468. package/dist/zod/v4/locales/az.d.cts +4 -0
  469. package/dist/zod/v4/locales/az.d.ts +4 -0
  470. package/dist/zod/v4/locales/az.js +115 -0
  471. package/dist/zod/v4/locales/be.cjs +190 -0
  472. package/dist/zod/v4/locales/be.d.cts +4 -0
  473. package/dist/zod/v4/locales/be.d.ts +4 -0
  474. package/dist/zod/v4/locales/be.js +164 -0
  475. package/dist/zod/v4/locales/ca.cjs +144 -0
  476. package/dist/zod/v4/locales/ca.d.cts +4 -0
  477. package/dist/zod/v4/locales/ca.d.ts +4 -0
  478. package/dist/zod/v4/locales/ca.js +118 -0
  479. package/dist/zod/v4/locales/cs.cjs +161 -0
  480. package/dist/zod/v4/locales/cs.d.cts +4 -0
  481. package/dist/zod/v4/locales/cs.d.ts +4 -0
  482. package/dist/zod/v4/locales/cs.js +135 -0
  483. package/dist/zod/v4/locales/de.cjs +142 -0
  484. package/dist/zod/v4/locales/de.d.cts +4 -0
  485. package/dist/zod/v4/locales/de.d.ts +4 -0
  486. package/dist/zod/v4/locales/de.js +116 -0
  487. package/dist/zod/v4/locales/en.cjs +145 -0
  488. package/dist/zod/v4/locales/en.d.cts +5 -0
  489. package/dist/zod/v4/locales/en.d.ts +5 -0
  490. package/dist/zod/v4/locales/en.js +117 -0
  491. package/dist/zod/v4/locales/eo.cjs +144 -0
  492. package/dist/zod/v4/locales/eo.d.cts +5 -0
  493. package/dist/zod/v4/locales/eo.d.ts +5 -0
  494. package/dist/zod/v4/locales/eo.js +116 -0
  495. package/dist/zod/v4/locales/es.cjs +143 -0
  496. package/dist/zod/v4/locales/es.d.cts +4 -0
  497. package/dist/zod/v4/locales/es.d.ts +4 -0
  498. package/dist/zod/v4/locales/es.js +117 -0
  499. package/dist/zod/v4/locales/fa.cjs +148 -0
  500. package/dist/zod/v4/locales/fa.d.cts +4 -0
  501. package/dist/zod/v4/locales/fa.d.ts +4 -0
  502. package/dist/zod/v4/locales/fa.js +122 -0
  503. package/dist/zod/v4/locales/fi.cjs +148 -0
  504. package/dist/zod/v4/locales/fi.d.cts +4 -0
  505. package/dist/zod/v4/locales/fi.d.ts +4 -0
  506. package/dist/zod/v4/locales/fi.js +122 -0
  507. package/dist/zod/v4/locales/fr-CA.cjs +143 -0
  508. package/dist/zod/v4/locales/fr-CA.d.cts +4 -0
  509. package/dist/zod/v4/locales/fr-CA.d.ts +4 -0
  510. package/dist/zod/v4/locales/fr-CA.js +117 -0
  511. package/dist/zod/v4/locales/fr.cjs +142 -0
  512. package/dist/zod/v4/locales/fr.d.cts +4 -0
  513. package/dist/zod/v4/locales/fr.d.ts +4 -0
  514. package/dist/zod/v4/locales/fr.js +116 -0
  515. package/dist/zod/v4/locales/he.cjs +143 -0
  516. package/dist/zod/v4/locales/he.d.cts +4 -0
  517. package/dist/zod/v4/locales/he.d.ts +4 -0
  518. package/dist/zod/v4/locales/he.js +117 -0
  519. package/dist/zod/v4/locales/hu.cjs +143 -0
  520. package/dist/zod/v4/locales/hu.d.cts +4 -0
  521. package/dist/zod/v4/locales/hu.d.ts +4 -0
  522. package/dist/zod/v4/locales/hu.js +117 -0
  523. package/dist/zod/v4/locales/id.cjs +142 -0
  524. package/dist/zod/v4/locales/id.d.cts +4 -0
  525. package/dist/zod/v4/locales/id.d.ts +4 -0
  526. package/dist/zod/v4/locales/id.js +116 -0
  527. package/dist/zod/v4/locales/index.cjs +84 -0
  528. package/dist/zod/v4/locales/index.d.cts +39 -0
  529. package/dist/zod/v4/locales/index.d.ts +39 -0
  530. package/dist/zod/v4/locales/index.js +39 -0
  531. package/dist/zod/v4/locales/it.cjs +143 -0
  532. package/dist/zod/v4/locales/it.d.cts +4 -0
  533. package/dist/zod/v4/locales/it.d.ts +4 -0
  534. package/dist/zod/v4/locales/it.js +117 -0
  535. package/dist/zod/v4/locales/ja.cjs +141 -0
  536. package/dist/zod/v4/locales/ja.d.cts +4 -0
  537. package/dist/zod/v4/locales/ja.d.ts +4 -0
  538. package/dist/zod/v4/locales/ja.js +115 -0
  539. package/dist/zod/v4/locales/kh.cjs +143 -0
  540. package/dist/zod/v4/locales/kh.d.cts +4 -0
  541. package/dist/zod/v4/locales/kh.d.ts +4 -0
  542. package/dist/zod/v4/locales/kh.js +117 -0
  543. package/dist/zod/v4/locales/ko.cjs +147 -0
  544. package/dist/zod/v4/locales/ko.d.cts +4 -0
  545. package/dist/zod/v4/locales/ko.d.ts +4 -0
  546. package/dist/zod/v4/locales/ko.js +121 -0
  547. package/dist/zod/v4/locales/mk.cjs +144 -0
  548. package/dist/zod/v4/locales/mk.d.cts +4 -0
  549. package/dist/zod/v4/locales/mk.d.ts +4 -0
  550. package/dist/zod/v4/locales/mk.js +118 -0
  551. package/dist/zod/v4/locales/ms.cjs +142 -0
  552. package/dist/zod/v4/locales/ms.d.cts +4 -0
  553. package/dist/zod/v4/locales/ms.d.ts +4 -0
  554. package/dist/zod/v4/locales/ms.js +116 -0
  555. package/dist/zod/v4/locales/nl.cjs +143 -0
  556. package/dist/zod/v4/locales/nl.d.cts +4 -0
  557. package/dist/zod/v4/locales/nl.d.ts +4 -0
  558. package/dist/zod/v4/locales/nl.js +117 -0
  559. package/dist/zod/v4/locales/no.cjs +142 -0
  560. package/dist/zod/v4/locales/no.d.cts +4 -0
  561. package/dist/zod/v4/locales/no.d.ts +4 -0
  562. package/dist/zod/v4/locales/no.js +116 -0
  563. package/dist/zod/v4/locales/ota.cjs +143 -0
  564. package/dist/zod/v4/locales/ota.d.cts +4 -0
  565. package/dist/zod/v4/locales/ota.d.ts +4 -0
  566. package/dist/zod/v4/locales/ota.js +117 -0
  567. package/dist/zod/v4/locales/pl.cjs +143 -0
  568. package/dist/zod/v4/locales/pl.d.cts +4 -0
  569. package/dist/zod/v4/locales/pl.d.ts +4 -0
  570. package/dist/zod/v4/locales/pl.js +117 -0
  571. package/dist/zod/v4/locales/ps.cjs +148 -0
  572. package/dist/zod/v4/locales/ps.d.cts +4 -0
  573. package/dist/zod/v4/locales/ps.d.ts +4 -0
  574. package/dist/zod/v4/locales/ps.js +122 -0
  575. package/dist/zod/v4/locales/pt.cjs +142 -0
  576. package/dist/zod/v4/locales/pt.d.cts +4 -0
  577. package/dist/zod/v4/locales/pt.d.ts +4 -0
  578. package/dist/zod/v4/locales/pt.js +116 -0
  579. package/dist/zod/v4/locales/ru.cjs +190 -0
  580. package/dist/zod/v4/locales/ru.d.cts +4 -0
  581. package/dist/zod/v4/locales/ru.d.ts +4 -0
  582. package/dist/zod/v4/locales/ru.js +164 -0
  583. package/dist/zod/v4/locales/sl.cjs +143 -0
  584. package/dist/zod/v4/locales/sl.d.cts +4 -0
  585. package/dist/zod/v4/locales/sl.d.ts +4 -0
  586. package/dist/zod/v4/locales/sl.js +117 -0
  587. package/dist/zod/v4/locales/sv.cjs +144 -0
  588. package/dist/zod/v4/locales/sv.d.cts +4 -0
  589. package/dist/zod/v4/locales/sv.d.ts +4 -0
  590. package/dist/zod/v4/locales/sv.js +118 -0
  591. package/dist/zod/v4/locales/ta.cjs +143 -0
  592. package/dist/zod/v4/locales/ta.d.cts +4 -0
  593. package/dist/zod/v4/locales/ta.d.ts +4 -0
  594. package/dist/zod/v4/locales/ta.js +117 -0
  595. package/dist/zod/v4/locales/th.cjs +143 -0
  596. package/dist/zod/v4/locales/th.d.cts +4 -0
  597. package/dist/zod/v4/locales/th.d.ts +4 -0
  598. package/dist/zod/v4/locales/th.js +117 -0
  599. package/dist/zod/v4/locales/tr.cjs +143 -0
  600. package/dist/zod/v4/locales/tr.d.cts +5 -0
  601. package/dist/zod/v4/locales/tr.d.ts +5 -0
  602. package/dist/zod/v4/locales/tr.js +115 -0
  603. package/dist/zod/v4/locales/ua.cjs +143 -0
  604. package/dist/zod/v4/locales/ua.d.cts +4 -0
  605. package/dist/zod/v4/locales/ua.d.ts +4 -0
  606. package/dist/zod/v4/locales/ua.js +117 -0
  607. package/dist/zod/v4/locales/ur.cjs +143 -0
  608. package/dist/zod/v4/locales/ur.d.cts +4 -0
  609. package/dist/zod/v4/locales/ur.d.ts +4 -0
  610. package/dist/zod/v4/locales/ur.js +117 -0
  611. package/dist/zod/v4/locales/vi.cjs +142 -0
  612. package/dist/zod/v4/locales/vi.d.cts +4 -0
  613. package/dist/zod/v4/locales/vi.d.ts +4 -0
  614. package/dist/zod/v4/locales/vi.js +116 -0
  615. package/dist/zod/v4/locales/zh-CN.cjs +142 -0
  616. package/dist/zod/v4/locales/zh-CN.d.cts +4 -0
  617. package/dist/zod/v4/locales/zh-CN.d.ts +4 -0
  618. package/dist/zod/v4/locales/zh-CN.js +116 -0
  619. package/dist/zod/v4/locales/zh-TW.cjs +143 -0
  620. package/dist/zod/v4/locales/zh-TW.d.cts +4 -0
  621. package/dist/zod/v4/locales/zh-TW.d.ts +4 -0
  622. package/dist/zod/v4/locales/zh-TW.js +117 -0
  623. package/dist/zod/v4/mini/checks.cjs +34 -0
  624. package/dist/zod/v4/mini/checks.d.cts +1 -0
  625. package/dist/zod/v4/mini/checks.d.ts +1 -0
  626. package/dist/zod/v4/mini/checks.js +1 -0
  627. package/dist/zod/v4/mini/coerce.cjs +47 -0
  628. package/dist/zod/v4/mini/coerce.d.cts +7 -0
  629. package/dist/zod/v4/mini/coerce.d.ts +7 -0
  630. package/dist/zod/v4/mini/coerce.js +17 -0
  631. package/dist/zod/v4/mini/external.cjs +62 -0
  632. package/dist/zod/v4/mini/external.d.cts +11 -0
  633. package/dist/zod/v4/mini/external.d.ts +11 -0
  634. package/dist/zod/v4/mini/external.js +13 -0
  635. package/dist/zod/v4/mini/index.cjs +32 -0
  636. package/dist/zod/v4/mini/index.d.cts +3 -0
  637. package/dist/zod/v4/mini/index.d.ts +3 -0
  638. package/dist/zod/v4/mini/index.js +3 -0
  639. package/dist/zod/v4/mini/iso.cjs +60 -0
  640. package/dist/zod/v4/mini/iso.d.cts +22 -0
  641. package/dist/zod/v4/mini/iso.d.ts +22 -0
  642. package/dist/zod/v4/mini/iso.js +30 -0
  643. package/dist/zod/v4/mini/parse.cjs +8 -0
  644. package/dist/zod/v4/mini/parse.d.cts +1 -0
  645. package/dist/zod/v4/mini/parse.d.ts +1 -0
  646. package/dist/zod/v4/mini/parse.js +1 -0
  647. package/dist/zod/v4/mini/schemas.cjs +839 -0
  648. package/dist/zod/v4/mini/schemas.d.cts +356 -0
  649. package/dist/zod/v4/mini/schemas.d.ts +356 -0
  650. package/dist/zod/v4/mini/schemas.js +732 -0
  651. package/dist/zod/v4-mini/index.cjs +17 -0
  652. package/dist/zod/v4-mini/index.d.cts +1 -0
  653. package/dist/zod/v4-mini/index.d.ts +1 -0
  654. package/dist/zod/v4-mini/index.js +1 -0
  655. package/package.json +42 -0
  656. package/scripts/postinstall.js +75 -0
@@ -0,0 +1,1717 @@
1
+ import * as checks from "./checks.js";
2
+ import * as core from "./core.js";
3
+ import { Doc } from "./doc.js";
4
+ import { safeParse, safeParseAsync } from "./parse.js";
5
+ import * as regexes from "./regexes.js";
6
+ import * as util from "./util.js";
7
+ import { version } from "./versions.js";
8
+ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def) => {
9
+ var _a;
10
+ inst ?? (inst = {});
11
+ inst._zod.def = def; // set _def property
12
+ inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
13
+ inst._zod.version = version;
14
+ const checks = [...(inst._zod.def.checks ?? [])];
15
+ // if inst is itself a checks.$ZodCheck, run it as a check
16
+ if (inst._zod.traits.has("$ZodCheck")) {
17
+ checks.unshift(inst);
18
+ }
19
+ //
20
+ for (const ch of checks) {
21
+ for (const fn of ch._zod.onattach) {
22
+ fn(inst);
23
+ }
24
+ }
25
+ if (checks.length === 0) {
26
+ // deferred initializer
27
+ // inst._zod.parse is not yet defined
28
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
29
+ inst._zod.deferred?.push(() => {
30
+ inst._zod.run = inst._zod.parse;
31
+ });
32
+ }
33
+ else {
34
+ const runChecks = (payload, checks, ctx) => {
35
+ let isAborted = util.aborted(payload);
36
+ let asyncResult;
37
+ for (const ch of checks) {
38
+ if (ch._zod.def.when) {
39
+ const shouldRun = ch._zod.def.when(payload);
40
+ if (!shouldRun)
41
+ continue;
42
+ }
43
+ else if (isAborted) {
44
+ continue;
45
+ }
46
+ const currLen = payload.issues.length;
47
+ const _ = ch._zod.check(payload);
48
+ if (_ instanceof Promise && ctx?.async === false) {
49
+ throw new core.$ZodAsyncError();
50
+ }
51
+ if (asyncResult || _ instanceof Promise) {
52
+ asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
53
+ await _;
54
+ const nextLen = payload.issues.length;
55
+ if (nextLen === currLen)
56
+ return;
57
+ if (!isAborted)
58
+ isAborted = util.aborted(payload, currLen);
59
+ });
60
+ }
61
+ else {
62
+ const nextLen = payload.issues.length;
63
+ if (nextLen === currLen)
64
+ continue;
65
+ if (!isAborted)
66
+ isAborted = util.aborted(payload, currLen);
67
+ }
68
+ }
69
+ if (asyncResult) {
70
+ return asyncResult.then(() => {
71
+ return payload;
72
+ });
73
+ }
74
+ return payload;
75
+ };
76
+ inst._zod.run = (payload, ctx) => {
77
+ const result = inst._zod.parse(payload, ctx);
78
+ if (result instanceof Promise) {
79
+ if (ctx.async === false)
80
+ throw new core.$ZodAsyncError();
81
+ return result.then((result) => runChecks(result, checks, ctx));
82
+ }
83
+ return runChecks(result, checks, ctx);
84
+ };
85
+ }
86
+ inst["~standard"] = {
87
+ validate: (value) => {
88
+ try {
89
+ const r = safeParse(inst, value);
90
+ return r.success ? { value: r.data } : { issues: r.error?.issues };
91
+ }
92
+ catch (_) {
93
+ return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
94
+ }
95
+ },
96
+ vendor: "zod",
97
+ version: 1,
98
+ };
99
+ });
100
+ export { clone } from "./util.js";
101
+ export const $ZodString = /*@__PURE__*/ core.$constructor("$ZodString", (inst, def) => {
102
+ $ZodType.init(inst, def);
103
+ inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);
104
+ inst._zod.parse = (payload, _) => {
105
+ if (def.coerce)
106
+ try {
107
+ payload.value = String(payload.value);
108
+ }
109
+ catch (_) { }
110
+ if (typeof payload.value === "string")
111
+ return payload;
112
+ payload.issues.push({
113
+ expected: "string",
114
+ code: "invalid_type",
115
+ input: payload.value,
116
+ inst,
117
+ });
118
+ return payload;
119
+ };
120
+ });
121
+ export const $ZodStringFormat = /*@__PURE__*/ core.$constructor("$ZodStringFormat", (inst, def) => {
122
+ // check initialization must come first
123
+ checks.$ZodCheckStringFormat.init(inst, def);
124
+ $ZodString.init(inst, def);
125
+ });
126
+ export const $ZodGUID = /*@__PURE__*/ core.$constructor("$ZodGUID", (inst, def) => {
127
+ def.pattern ?? (def.pattern = regexes.guid);
128
+ $ZodStringFormat.init(inst, def);
129
+ });
130
+ export const $ZodUUID = /*@__PURE__*/ core.$constructor("$ZodUUID", (inst, def) => {
131
+ if (def.version) {
132
+ const versionMap = {
133
+ v1: 1,
134
+ v2: 2,
135
+ v3: 3,
136
+ v4: 4,
137
+ v5: 5,
138
+ v6: 6,
139
+ v7: 7,
140
+ v8: 8,
141
+ };
142
+ const v = versionMap[def.version];
143
+ if (v === undefined)
144
+ throw new Error(`Invalid UUID version: "${def.version}"`);
145
+ def.pattern ?? (def.pattern = regexes.uuid(v));
146
+ }
147
+ else
148
+ def.pattern ?? (def.pattern = regexes.uuid());
149
+ $ZodStringFormat.init(inst, def);
150
+ });
151
+ export const $ZodEmail = /*@__PURE__*/ core.$constructor("$ZodEmail", (inst, def) => {
152
+ def.pattern ?? (def.pattern = regexes.email);
153
+ $ZodStringFormat.init(inst, def);
154
+ });
155
+ export const $ZodURL = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) => {
156
+ $ZodStringFormat.init(inst, def);
157
+ inst._zod.check = (payload) => {
158
+ try {
159
+ const orig = payload.value;
160
+ const url = new URL(orig);
161
+ const href = url.href;
162
+ if (def.hostname) {
163
+ def.hostname.lastIndex = 0;
164
+ if (!def.hostname.test(url.hostname)) {
165
+ payload.issues.push({
166
+ code: "invalid_format",
167
+ format: "url",
168
+ note: "Invalid hostname",
169
+ pattern: regexes.hostname.source,
170
+ input: payload.value,
171
+ inst,
172
+ continue: !def.abort,
173
+ });
174
+ }
175
+ }
176
+ if (def.protocol) {
177
+ def.protocol.lastIndex = 0;
178
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
179
+ payload.issues.push({
180
+ code: "invalid_format",
181
+ format: "url",
182
+ note: "Invalid protocol",
183
+ pattern: def.protocol.source,
184
+ input: payload.value,
185
+ inst,
186
+ continue: !def.abort,
187
+ });
188
+ }
189
+ }
190
+ // payload.value = url.href;
191
+ if (!orig.endsWith("/") && href.endsWith("/")) {
192
+ payload.value = href.slice(0, -1);
193
+ }
194
+ else {
195
+ payload.value = href;
196
+ }
197
+ return;
198
+ }
199
+ catch (_) {
200
+ payload.issues.push({
201
+ code: "invalid_format",
202
+ format: "url",
203
+ input: payload.value,
204
+ inst,
205
+ continue: !def.abort,
206
+ });
207
+ }
208
+ };
209
+ });
210
+ export const $ZodEmoji = /*@__PURE__*/ core.$constructor("$ZodEmoji", (inst, def) => {
211
+ def.pattern ?? (def.pattern = regexes.emoji());
212
+ $ZodStringFormat.init(inst, def);
213
+ });
214
+ export const $ZodNanoID = /*@__PURE__*/ core.$constructor("$ZodNanoID", (inst, def) => {
215
+ def.pattern ?? (def.pattern = regexes.nanoid);
216
+ $ZodStringFormat.init(inst, def);
217
+ });
218
+ export const $ZodCUID = /*@__PURE__*/ core.$constructor("$ZodCUID", (inst, def) => {
219
+ def.pattern ?? (def.pattern = regexes.cuid);
220
+ $ZodStringFormat.init(inst, def);
221
+ });
222
+ export const $ZodCUID2 = /*@__PURE__*/ core.$constructor("$ZodCUID2", (inst, def) => {
223
+ def.pattern ?? (def.pattern = regexes.cuid2);
224
+ $ZodStringFormat.init(inst, def);
225
+ });
226
+ export const $ZodULID = /*@__PURE__*/ core.$constructor("$ZodULID", (inst, def) => {
227
+ def.pattern ?? (def.pattern = regexes.ulid);
228
+ $ZodStringFormat.init(inst, def);
229
+ });
230
+ export const $ZodXID = /*@__PURE__*/ core.$constructor("$ZodXID", (inst, def) => {
231
+ def.pattern ?? (def.pattern = regexes.xid);
232
+ $ZodStringFormat.init(inst, def);
233
+ });
234
+ export const $ZodKSUID = /*@__PURE__*/ core.$constructor("$ZodKSUID", (inst, def) => {
235
+ def.pattern ?? (def.pattern = regexes.ksuid);
236
+ $ZodStringFormat.init(inst, def);
237
+ });
238
+ export const $ZodISODateTime = /*@__PURE__*/ core.$constructor("$ZodISODateTime", (inst, def) => {
239
+ def.pattern ?? (def.pattern = regexes.datetime(def));
240
+ $ZodStringFormat.init(inst, def);
241
+ });
242
+ export const $ZodISODate = /*@__PURE__*/ core.$constructor("$ZodISODate", (inst, def) => {
243
+ def.pattern ?? (def.pattern = regexes.date);
244
+ $ZodStringFormat.init(inst, def);
245
+ });
246
+ export const $ZodISOTime = /*@__PURE__*/ core.$constructor("$ZodISOTime", (inst, def) => {
247
+ def.pattern ?? (def.pattern = regexes.time(def));
248
+ $ZodStringFormat.init(inst, def);
249
+ });
250
+ export const $ZodISODuration = /*@__PURE__*/ core.$constructor("$ZodISODuration", (inst, def) => {
251
+ def.pattern ?? (def.pattern = regexes.duration);
252
+ $ZodStringFormat.init(inst, def);
253
+ });
254
+ export const $ZodIPv4 = /*@__PURE__*/ core.$constructor("$ZodIPv4", (inst, def) => {
255
+ def.pattern ?? (def.pattern = regexes.ipv4);
256
+ $ZodStringFormat.init(inst, def);
257
+ inst._zod.onattach.push((inst) => {
258
+ const bag = inst._zod.bag;
259
+ bag.format = `ipv4`;
260
+ });
261
+ });
262
+ export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def) => {
263
+ def.pattern ?? (def.pattern = regexes.ipv6);
264
+ $ZodStringFormat.init(inst, def);
265
+ inst._zod.onattach.push((inst) => {
266
+ const bag = inst._zod.bag;
267
+ bag.format = `ipv6`;
268
+ });
269
+ inst._zod.check = (payload) => {
270
+ try {
271
+ new URL(`http://[${payload.value}]`);
272
+ // return;
273
+ }
274
+ catch {
275
+ payload.issues.push({
276
+ code: "invalid_format",
277
+ format: "ipv6",
278
+ input: payload.value,
279
+ inst,
280
+ continue: !def.abort,
281
+ });
282
+ }
283
+ };
284
+ });
285
+ export const $ZodCIDRv4 = /*@__PURE__*/ core.$constructor("$ZodCIDRv4", (inst, def) => {
286
+ def.pattern ?? (def.pattern = regexes.cidrv4);
287
+ $ZodStringFormat.init(inst, def);
288
+ });
289
+ export const $ZodCIDRv6 = /*@__PURE__*/ core.$constructor("$ZodCIDRv6", (inst, def) => {
290
+ def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation
291
+ $ZodStringFormat.init(inst, def);
292
+ inst._zod.check = (payload) => {
293
+ const [address, prefix] = payload.value.split("/");
294
+ try {
295
+ if (!prefix)
296
+ throw new Error();
297
+ const prefixNum = Number(prefix);
298
+ if (`${prefixNum}` !== prefix)
299
+ throw new Error();
300
+ if (prefixNum < 0 || prefixNum > 128)
301
+ throw new Error();
302
+ new URL(`http://[${address}]`);
303
+ }
304
+ catch {
305
+ payload.issues.push({
306
+ code: "invalid_format",
307
+ format: "cidrv6",
308
+ input: payload.value,
309
+ inst,
310
+ continue: !def.abort,
311
+ });
312
+ }
313
+ };
314
+ });
315
+ ////////////////////////////// ZodBase64 //////////////////////////////
316
+ export function isValidBase64(data) {
317
+ if (data === "")
318
+ return true;
319
+ if (data.length % 4 !== 0)
320
+ return false;
321
+ try {
322
+ atob(data);
323
+ return true;
324
+ }
325
+ catch {
326
+ return false;
327
+ }
328
+ }
329
+ export const $ZodBase64 = /*@__PURE__*/ core.$constructor("$ZodBase64", (inst, def) => {
330
+ def.pattern ?? (def.pattern = regexes.base64);
331
+ $ZodStringFormat.init(inst, def);
332
+ inst._zod.onattach.push((inst) => {
333
+ inst._zod.bag.contentEncoding = "base64";
334
+ });
335
+ inst._zod.check = (payload) => {
336
+ if (isValidBase64(payload.value))
337
+ return;
338
+ payload.issues.push({
339
+ code: "invalid_format",
340
+ format: "base64",
341
+ input: payload.value,
342
+ inst,
343
+ continue: !def.abort,
344
+ });
345
+ };
346
+ });
347
+ ////////////////////////////// ZodBase64 //////////////////////////////
348
+ export function isValidBase64URL(data) {
349
+ if (!regexes.base64url.test(data))
350
+ return false;
351
+ const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
352
+ const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
353
+ return isValidBase64(padded);
354
+ }
355
+ export const $ZodBase64URL = /*@__PURE__*/ core.$constructor("$ZodBase64URL", (inst, def) => {
356
+ def.pattern ?? (def.pattern = regexes.base64url);
357
+ $ZodStringFormat.init(inst, def);
358
+ inst._zod.onattach.push((inst) => {
359
+ inst._zod.bag.contentEncoding = "base64url";
360
+ });
361
+ inst._zod.check = (payload) => {
362
+ if (isValidBase64URL(payload.value))
363
+ return;
364
+ payload.issues.push({
365
+ code: "invalid_format",
366
+ format: "base64url",
367
+ input: payload.value,
368
+ inst,
369
+ continue: !def.abort,
370
+ });
371
+ };
372
+ });
373
+ export const $ZodE164 = /*@__PURE__*/ core.$constructor("$ZodE164", (inst, def) => {
374
+ def.pattern ?? (def.pattern = regexes.e164);
375
+ $ZodStringFormat.init(inst, def);
376
+ });
377
+ ////////////////////////////// ZodJWT //////////////////////////////
378
+ export function isValidJWT(token, algorithm = null) {
379
+ try {
380
+ const tokensParts = token.split(".");
381
+ if (tokensParts.length !== 3)
382
+ return false;
383
+ const [header] = tokensParts;
384
+ if (!header)
385
+ return false;
386
+ const parsedHeader = JSON.parse(atob(header));
387
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
388
+ return false;
389
+ if (!parsedHeader.alg)
390
+ return false;
391
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
392
+ return false;
393
+ return true;
394
+ }
395
+ catch {
396
+ return false;
397
+ }
398
+ }
399
+ export const $ZodJWT = /*@__PURE__*/ core.$constructor("$ZodJWT", (inst, def) => {
400
+ $ZodStringFormat.init(inst, def);
401
+ inst._zod.check = (payload) => {
402
+ if (isValidJWT(payload.value, def.alg))
403
+ return;
404
+ payload.issues.push({
405
+ code: "invalid_format",
406
+ format: "jwt",
407
+ input: payload.value,
408
+ inst,
409
+ continue: !def.abort,
410
+ });
411
+ };
412
+ });
413
+ export const $ZodCustomStringFormat = /*@__PURE__*/ core.$constructor("$ZodCustomStringFormat", (inst, def) => {
414
+ $ZodStringFormat.init(inst, def);
415
+ inst._zod.check = (payload) => {
416
+ if (def.fn(payload.value))
417
+ return;
418
+ payload.issues.push({
419
+ code: "invalid_format",
420
+ format: def.format,
421
+ input: payload.value,
422
+ inst,
423
+ continue: !def.abort,
424
+ });
425
+ };
426
+ });
427
+ export const $ZodNumber = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, def) => {
428
+ $ZodType.init(inst, def);
429
+ inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;
430
+ inst._zod.parse = (payload, _ctx) => {
431
+ if (def.coerce)
432
+ try {
433
+ payload.value = Number(payload.value);
434
+ }
435
+ catch (_) { }
436
+ const input = payload.value;
437
+ if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
438
+ return payload;
439
+ }
440
+ const received = typeof input === "number"
441
+ ? Number.isNaN(input)
442
+ ? "NaN"
443
+ : !Number.isFinite(input)
444
+ ? "Infinity"
445
+ : undefined
446
+ : undefined;
447
+ payload.issues.push({
448
+ expected: "number",
449
+ code: "invalid_type",
450
+ input,
451
+ inst,
452
+ ...(received ? { received } : {}),
453
+ });
454
+ return payload;
455
+ };
456
+ });
457
+ export const $ZodNumberFormat = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, def) => {
458
+ checks.$ZodCheckNumberFormat.init(inst, def);
459
+ $ZodNumber.init(inst, def); // no format checksp
460
+ });
461
+ export const $ZodBoolean = /*@__PURE__*/ core.$constructor("$ZodBoolean", (inst, def) => {
462
+ $ZodType.init(inst, def);
463
+ inst._zod.pattern = regexes.boolean;
464
+ inst._zod.parse = (payload, _ctx) => {
465
+ if (def.coerce)
466
+ try {
467
+ payload.value = Boolean(payload.value);
468
+ }
469
+ catch (_) { }
470
+ const input = payload.value;
471
+ if (typeof input === "boolean")
472
+ return payload;
473
+ payload.issues.push({
474
+ expected: "boolean",
475
+ code: "invalid_type",
476
+ input,
477
+ inst,
478
+ });
479
+ return payload;
480
+ };
481
+ });
482
+ export const $ZodBigInt = /*@__PURE__*/ core.$constructor("$ZodBigInt", (inst, def) => {
483
+ $ZodType.init(inst, def);
484
+ inst._zod.pattern = regexes.bigint;
485
+ inst._zod.parse = (payload, _ctx) => {
486
+ if (def.coerce)
487
+ try {
488
+ payload.value = BigInt(payload.value);
489
+ }
490
+ catch (_) { }
491
+ if (typeof payload.value === "bigint")
492
+ return payload;
493
+ payload.issues.push({
494
+ expected: "bigint",
495
+ code: "invalid_type",
496
+ input: payload.value,
497
+ inst,
498
+ });
499
+ return payload;
500
+ };
501
+ });
502
+ export const $ZodBigIntFormat = /*@__PURE__*/ core.$constructor("$ZodBigInt", (inst, def) => {
503
+ checks.$ZodCheckBigIntFormat.init(inst, def);
504
+ $ZodBigInt.init(inst, def); // no format checks
505
+ });
506
+ export const $ZodSymbol = /*@__PURE__*/ core.$constructor("$ZodSymbol", (inst, def) => {
507
+ $ZodType.init(inst, def);
508
+ inst._zod.parse = (payload, _ctx) => {
509
+ const input = payload.value;
510
+ if (typeof input === "symbol")
511
+ return payload;
512
+ payload.issues.push({
513
+ expected: "symbol",
514
+ code: "invalid_type",
515
+ input,
516
+ inst,
517
+ });
518
+ return payload;
519
+ };
520
+ });
521
+ export const $ZodUndefined = /*@__PURE__*/ core.$constructor("$ZodUndefined", (inst, def) => {
522
+ $ZodType.init(inst, def);
523
+ inst._zod.pattern = regexes.undefined;
524
+ inst._zod.values = new Set([undefined]);
525
+ inst._zod.optin = "optional";
526
+ inst._zod.optout = "optional";
527
+ inst._zod.parse = (payload, _ctx) => {
528
+ const input = payload.value;
529
+ if (typeof input === "undefined")
530
+ return payload;
531
+ payload.issues.push({
532
+ expected: "undefined",
533
+ code: "invalid_type",
534
+ input,
535
+ inst,
536
+ });
537
+ return payload;
538
+ };
539
+ });
540
+ export const $ZodNull = /*@__PURE__*/ core.$constructor("$ZodNull", (inst, def) => {
541
+ $ZodType.init(inst, def);
542
+ inst._zod.pattern = regexes.null;
543
+ inst._zod.values = new Set([null]);
544
+ inst._zod.parse = (payload, _ctx) => {
545
+ const input = payload.value;
546
+ if (input === null)
547
+ return payload;
548
+ payload.issues.push({
549
+ expected: "null",
550
+ code: "invalid_type",
551
+ input,
552
+ inst,
553
+ });
554
+ return payload;
555
+ };
556
+ });
557
+ export const $ZodAny = /*@__PURE__*/ core.$constructor("$ZodAny", (inst, def) => {
558
+ $ZodType.init(inst, def);
559
+ inst._zod.parse = (payload) => payload;
560
+ });
561
+ export const $ZodUnknown = /*@__PURE__*/ core.$constructor("$ZodUnknown", (inst, def) => {
562
+ $ZodType.init(inst, def);
563
+ inst._zod.parse = (payload) => payload;
564
+ });
565
+ export const $ZodNever = /*@__PURE__*/ core.$constructor("$ZodNever", (inst, def) => {
566
+ $ZodType.init(inst, def);
567
+ inst._zod.parse = (payload, _ctx) => {
568
+ payload.issues.push({
569
+ expected: "never",
570
+ code: "invalid_type",
571
+ input: payload.value,
572
+ inst,
573
+ });
574
+ return payload;
575
+ };
576
+ });
577
+ export const $ZodVoid = /*@__PURE__*/ core.$constructor("$ZodVoid", (inst, def) => {
578
+ $ZodType.init(inst, def);
579
+ inst._zod.parse = (payload, _ctx) => {
580
+ const input = payload.value;
581
+ if (typeof input === "undefined")
582
+ return payload;
583
+ payload.issues.push({
584
+ expected: "void",
585
+ code: "invalid_type",
586
+ input,
587
+ inst,
588
+ });
589
+ return payload;
590
+ };
591
+ });
592
+ export const $ZodDate = /*@__PURE__*/ core.$constructor("$ZodDate", (inst, def) => {
593
+ $ZodType.init(inst, def);
594
+ inst._zod.parse = (payload, _ctx) => {
595
+ if (def.coerce) {
596
+ try {
597
+ payload.value = new Date(payload.value);
598
+ }
599
+ catch (_err) { }
600
+ }
601
+ const input = payload.value;
602
+ const isDate = input instanceof Date;
603
+ const isValidDate = isDate && !Number.isNaN(input.getTime());
604
+ if (isValidDate)
605
+ return payload;
606
+ payload.issues.push({
607
+ expected: "date",
608
+ code: "invalid_type",
609
+ input,
610
+ ...(isDate ? { received: "Invalid Date" } : {}),
611
+ inst,
612
+ });
613
+ return payload;
614
+ };
615
+ });
616
+ function handleArrayResult(result, final, index) {
617
+ if (result.issues.length) {
618
+ final.issues.push(...util.prefixIssues(index, result.issues));
619
+ }
620
+ final.value[index] = result.value;
621
+ }
622
+ export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def) => {
623
+ $ZodType.init(inst, def);
624
+ inst._zod.parse = (payload, ctx) => {
625
+ const input = payload.value;
626
+ if (!Array.isArray(input)) {
627
+ payload.issues.push({
628
+ expected: "array",
629
+ code: "invalid_type",
630
+ input,
631
+ inst,
632
+ });
633
+ return payload;
634
+ }
635
+ payload.value = Array(input.length);
636
+ const proms = [];
637
+ for (let i = 0; i < input.length; i++) {
638
+ const item = input[i];
639
+ const result = def.element._zod.run({
640
+ value: item,
641
+ issues: [],
642
+ }, ctx);
643
+ if (result instanceof Promise) {
644
+ proms.push(result.then((result) => handleArrayResult(result, payload, i)));
645
+ }
646
+ else {
647
+ handleArrayResult(result, payload, i);
648
+ }
649
+ }
650
+ if (proms.length) {
651
+ return Promise.all(proms).then(() => payload);
652
+ }
653
+ return payload; //handleArrayResultsAsync(parseResults, final);
654
+ };
655
+ });
656
+ function handleObjectResult(result, final, key) {
657
+ // if(isOptional)
658
+ if (result.issues.length) {
659
+ final.issues.push(...util.prefixIssues(key, result.issues));
660
+ }
661
+ final.value[key] = result.value;
662
+ }
663
+ function handleOptionalObjectResult(result, final, key, input) {
664
+ if (result.issues.length) {
665
+ // validation failed against value schema
666
+ if (input[key] === undefined) {
667
+ // if input was undefined, ignore the error
668
+ if (key in input) {
669
+ final.value[key] = undefined;
670
+ }
671
+ else {
672
+ final.value[key] = result.value;
673
+ }
674
+ }
675
+ else {
676
+ final.issues.push(...util.prefixIssues(key, result.issues));
677
+ }
678
+ }
679
+ else if (result.value === undefined) {
680
+ // validation returned `undefined`
681
+ if (key in input)
682
+ final.value[key] = undefined;
683
+ }
684
+ else {
685
+ // non-undefined value
686
+ final.value[key] = result.value;
687
+ }
688
+ }
689
+ export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, def) => {
690
+ // requires cast because technically $ZodObject doesn't extend
691
+ $ZodType.init(inst, def);
692
+ const _normalized = util.cached(() => {
693
+ const keys = Object.keys(def.shape);
694
+ for (const k of keys) {
695
+ if (!(def.shape[k] instanceof $ZodType)) {
696
+ throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
697
+ }
698
+ }
699
+ const okeys = util.optionalKeys(def.shape);
700
+ return {
701
+ shape: def.shape,
702
+ keys,
703
+ keySet: new Set(keys),
704
+ numKeys: keys.length,
705
+ optionalKeys: new Set(okeys),
706
+ };
707
+ });
708
+ util.defineLazy(inst._zod, "propValues", () => {
709
+ const shape = def.shape;
710
+ const propValues = {};
711
+ for (const key in shape) {
712
+ const field = shape[key]._zod;
713
+ if (field.values) {
714
+ propValues[key] ?? (propValues[key] = new Set());
715
+ for (const v of field.values)
716
+ propValues[key].add(v);
717
+ }
718
+ }
719
+ return propValues;
720
+ });
721
+ const generateFastpass = (shape) => {
722
+ const doc = new Doc(["shape", "payload", "ctx"]);
723
+ const normalized = _normalized.value;
724
+ const parseStr = (key) => {
725
+ const k = util.esc(key);
726
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
727
+ };
728
+ doc.write(`const input = payload.value;`);
729
+ const ids = Object.create(null);
730
+ let counter = 0;
731
+ for (const key of normalized.keys) {
732
+ ids[key] = `key_${counter++}`;
733
+ }
734
+ // A: preserve key order {
735
+ doc.write(`const newResult = {}`);
736
+ for (const key of normalized.keys) {
737
+ if (normalized.optionalKeys.has(key)) {
738
+ const id = ids[key];
739
+ doc.write(`const ${id} = ${parseStr(key)};`);
740
+ const k = util.esc(key);
741
+ doc.write(`
742
+ if (${id}.issues.length) {
743
+ if (input[${k}] === undefined) {
744
+ if (${k} in input) {
745
+ newResult[${k}] = undefined;
746
+ }
747
+ } else {
748
+ payload.issues = payload.issues.concat(
749
+ ${id}.issues.map((iss) => ({
750
+ ...iss,
751
+ path: iss.path ? [${k}, ...iss.path] : [${k}],
752
+ }))
753
+ );
754
+ }
755
+ } else if (${id}.value === undefined) {
756
+ if (${k} in input) newResult[${k}] = undefined;
757
+ } else {
758
+ newResult[${k}] = ${id}.value;
759
+ }
760
+ `);
761
+ }
762
+ else {
763
+ const id = ids[key];
764
+ // const id = ids[key];
765
+ doc.write(`const ${id} = ${parseStr(key)};`);
766
+ doc.write(`
767
+ if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
768
+ ...iss,
769
+ path: iss.path ? [${util.esc(key)}, ...iss.path] : [${util.esc(key)}]
770
+ })));`);
771
+ doc.write(`newResult[${util.esc(key)}] = ${id}.value`);
772
+ }
773
+ }
774
+ doc.write(`payload.value = newResult;`);
775
+ doc.write(`return payload;`);
776
+ const fn = doc.compile();
777
+ return (payload, ctx) => fn(shape, payload, ctx);
778
+ };
779
+ let fastpass;
780
+ const isObject = util.isObject;
781
+ const jit = !core.globalConfig.jitless;
782
+ const allowsEval = util.allowsEval;
783
+ const fastEnabled = jit && allowsEval.value; // && !def.catchall;
784
+ const catchall = def.catchall;
785
+ let value;
786
+ inst._zod.parse = (payload, ctx) => {
787
+ value ?? (value = _normalized.value);
788
+ const input = payload.value;
789
+ if (!isObject(input)) {
790
+ payload.issues.push({
791
+ expected: "object",
792
+ code: "invalid_type",
793
+ input,
794
+ inst,
795
+ });
796
+ return payload;
797
+ }
798
+ const proms = [];
799
+ if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
800
+ // always synchronous
801
+ if (!fastpass)
802
+ fastpass = generateFastpass(def.shape);
803
+ payload = fastpass(payload, ctx);
804
+ }
805
+ else {
806
+ payload.value = {};
807
+ const shape = value.shape;
808
+ for (const key of value.keys) {
809
+ const el = shape[key];
810
+ // do not add omitted optional keys
811
+ // if (!(key in input)) {
812
+ // if (optionalKeys.has(key)) continue;
813
+ // payload.issues.push({
814
+ // code: "invalid_type",
815
+ // path: [key],
816
+ // expected: "nonoptional",
817
+ // note: `Missing required key: "${key}"`,
818
+ // input,
819
+ // inst,
820
+ // });
821
+ // }
822
+ const r = el._zod.run({ value: input[key], issues: [] }, ctx);
823
+ const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
824
+ if (r instanceof Promise) {
825
+ proms.push(r.then((r) => isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key)));
826
+ }
827
+ else if (isOptional) {
828
+ handleOptionalObjectResult(r, payload, key, input);
829
+ }
830
+ else {
831
+ handleObjectResult(r, payload, key);
832
+ }
833
+ }
834
+ }
835
+ if (!catchall) {
836
+ // return payload;
837
+ return proms.length ? Promise.all(proms).then(() => payload) : payload;
838
+ }
839
+ const unrecognized = [];
840
+ // iterate over input keys
841
+ const keySet = value.keySet;
842
+ const _catchall = catchall._zod;
843
+ const t = _catchall.def.type;
844
+ for (const key of Object.keys(input)) {
845
+ if (keySet.has(key))
846
+ continue;
847
+ if (t === "never") {
848
+ unrecognized.push(key);
849
+ continue;
850
+ }
851
+ const r = _catchall.run({ value: input[key], issues: [] }, ctx);
852
+ if (r instanceof Promise) {
853
+ proms.push(r.then((r) => handleObjectResult(r, payload, key)));
854
+ }
855
+ else {
856
+ handleObjectResult(r, payload, key);
857
+ }
858
+ }
859
+ if (unrecognized.length) {
860
+ payload.issues.push({
861
+ code: "unrecognized_keys",
862
+ keys: unrecognized,
863
+ input,
864
+ inst,
865
+ });
866
+ }
867
+ if (!proms.length)
868
+ return payload;
869
+ return Promise.all(proms).then(() => {
870
+ return payload;
871
+ });
872
+ };
873
+ });
874
+ function handleUnionResults(results, final, inst, ctx) {
875
+ for (const result of results) {
876
+ if (result.issues.length === 0) {
877
+ final.value = result.value;
878
+ return final;
879
+ }
880
+ }
881
+ final.issues.push({
882
+ code: "invalid_union",
883
+ input: final.value,
884
+ inst,
885
+ errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
886
+ });
887
+ return final;
888
+ }
889
+ export const $ZodUnion = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def) => {
890
+ $ZodType.init(inst, def);
891
+ util.defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined);
892
+ util.defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
893
+ util.defineLazy(inst._zod, "values", () => {
894
+ if (def.options.every((o) => o._zod.values)) {
895
+ return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
896
+ }
897
+ return undefined;
898
+ });
899
+ util.defineLazy(inst._zod, "pattern", () => {
900
+ if (def.options.every((o) => o._zod.pattern)) {
901
+ const patterns = def.options.map((o) => o._zod.pattern);
902
+ return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join("|")})$`);
903
+ }
904
+ return undefined;
905
+ });
906
+ inst._zod.parse = (payload, ctx) => {
907
+ let async = false;
908
+ const results = [];
909
+ for (const option of def.options) {
910
+ const result = option._zod.run({
911
+ value: payload.value,
912
+ issues: [],
913
+ }, ctx);
914
+ if (result instanceof Promise) {
915
+ results.push(result);
916
+ async = true;
917
+ }
918
+ else {
919
+ if (result.issues.length === 0)
920
+ return result;
921
+ results.push(result);
922
+ }
923
+ }
924
+ if (!async)
925
+ return handleUnionResults(results, payload, inst, ctx);
926
+ return Promise.all(results).then((results) => {
927
+ return handleUnionResults(results, payload, inst, ctx);
928
+ });
929
+ };
930
+ });
931
+ export const $ZodDiscriminatedUnion =
932
+ /*@__PURE__*/
933
+ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
934
+ $ZodUnion.init(inst, def);
935
+ const _super = inst._zod.parse;
936
+ util.defineLazy(inst._zod, "propValues", () => {
937
+ const propValues = {};
938
+ for (const option of def.options) {
939
+ const pv = option._zod.propValues;
940
+ if (!pv || Object.keys(pv).length === 0)
941
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
942
+ for (const [k, v] of Object.entries(pv)) {
943
+ if (!propValues[k])
944
+ propValues[k] = new Set();
945
+ for (const val of v) {
946
+ propValues[k].add(val);
947
+ }
948
+ }
949
+ }
950
+ return propValues;
951
+ });
952
+ const disc = util.cached(() => {
953
+ const opts = def.options;
954
+ const map = new Map();
955
+ for (const o of opts) {
956
+ const values = o._zod.propValues[def.discriminator];
957
+ if (!values || values.size === 0)
958
+ throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
959
+ for (const v of values) {
960
+ if (map.has(v)) {
961
+ throw new Error(`Duplicate discriminator value "${String(v)}"`);
962
+ }
963
+ map.set(v, o);
964
+ }
965
+ }
966
+ return map;
967
+ });
968
+ inst._zod.parse = (payload, ctx) => {
969
+ const input = payload.value;
970
+ if (!util.isObject(input)) {
971
+ payload.issues.push({
972
+ code: "invalid_type",
973
+ expected: "object",
974
+ input,
975
+ inst,
976
+ });
977
+ return payload;
978
+ }
979
+ const opt = disc.value.get(input?.[def.discriminator]);
980
+ if (opt) {
981
+ return opt._zod.run(payload, ctx);
982
+ }
983
+ if (def.unionFallback) {
984
+ return _super(payload, ctx);
985
+ }
986
+ // no matching discriminator
987
+ payload.issues.push({
988
+ code: "invalid_union",
989
+ errors: [],
990
+ note: "No matching discriminator",
991
+ input,
992
+ path: [def.discriminator],
993
+ inst,
994
+ });
995
+ return payload;
996
+ };
997
+ });
998
+ export const $ZodIntersection = /*@__PURE__*/ core.$constructor("$ZodIntersection", (inst, def) => {
999
+ $ZodType.init(inst, def);
1000
+ inst._zod.parse = (payload, ctx) => {
1001
+ const input = payload.value;
1002
+ const left = def.left._zod.run({ value: input, issues: [] }, ctx);
1003
+ const right = def.right._zod.run({ value: input, issues: [] }, ctx);
1004
+ const async = left instanceof Promise || right instanceof Promise;
1005
+ if (async) {
1006
+ return Promise.all([left, right]).then(([left, right]) => {
1007
+ return handleIntersectionResults(payload, left, right);
1008
+ });
1009
+ }
1010
+ return handleIntersectionResults(payload, left, right);
1011
+ };
1012
+ });
1013
+ function mergeValues(a, b) {
1014
+ // const aType = parse.t(a);
1015
+ // const bType = parse.t(b);
1016
+ if (a === b) {
1017
+ return { valid: true, data: a };
1018
+ }
1019
+ if (a instanceof Date && b instanceof Date && +a === +b) {
1020
+ return { valid: true, data: a };
1021
+ }
1022
+ if (util.isPlainObject(a) && util.isPlainObject(b)) {
1023
+ const bKeys = Object.keys(b);
1024
+ const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1025
+ const newObj = { ...a, ...b };
1026
+ for (const key of sharedKeys) {
1027
+ const sharedValue = mergeValues(a[key], b[key]);
1028
+ if (!sharedValue.valid) {
1029
+ return {
1030
+ valid: false,
1031
+ mergeErrorPath: [key, ...sharedValue.mergeErrorPath],
1032
+ };
1033
+ }
1034
+ newObj[key] = sharedValue.data;
1035
+ }
1036
+ return { valid: true, data: newObj };
1037
+ }
1038
+ if (Array.isArray(a) && Array.isArray(b)) {
1039
+ if (a.length !== b.length) {
1040
+ return { valid: false, mergeErrorPath: [] };
1041
+ }
1042
+ const newArray = [];
1043
+ for (let index = 0; index < a.length; index++) {
1044
+ const itemA = a[index];
1045
+ const itemB = b[index];
1046
+ const sharedValue = mergeValues(itemA, itemB);
1047
+ if (!sharedValue.valid) {
1048
+ return {
1049
+ valid: false,
1050
+ mergeErrorPath: [index, ...sharedValue.mergeErrorPath],
1051
+ };
1052
+ }
1053
+ newArray.push(sharedValue.data);
1054
+ }
1055
+ return { valid: true, data: newArray };
1056
+ }
1057
+ return { valid: false, mergeErrorPath: [] };
1058
+ }
1059
+ function handleIntersectionResults(result, left, right) {
1060
+ if (left.issues.length) {
1061
+ result.issues.push(...left.issues);
1062
+ }
1063
+ if (right.issues.length) {
1064
+ result.issues.push(...right.issues);
1065
+ }
1066
+ if (util.aborted(result))
1067
+ return result;
1068
+ const merged = mergeValues(left.value, right.value);
1069
+ if (!merged.valid) {
1070
+ throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
1071
+ }
1072
+ result.value = merged.data;
1073
+ return result;
1074
+ }
1075
+ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def) => {
1076
+ $ZodType.init(inst, def);
1077
+ const items = def.items;
1078
+ const optStart = items.length - [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
1079
+ inst._zod.parse = (payload, ctx) => {
1080
+ const input = payload.value;
1081
+ if (!Array.isArray(input)) {
1082
+ payload.issues.push({
1083
+ input,
1084
+ inst,
1085
+ expected: "tuple",
1086
+ code: "invalid_type",
1087
+ });
1088
+ return payload;
1089
+ }
1090
+ payload.value = [];
1091
+ const proms = [];
1092
+ if (!def.rest) {
1093
+ const tooBig = input.length > items.length;
1094
+ const tooSmall = input.length < optStart - 1;
1095
+ if (tooBig || tooSmall) {
1096
+ payload.issues.push({
1097
+ input,
1098
+ inst,
1099
+ origin: "array",
1100
+ ...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
1101
+ });
1102
+ return payload;
1103
+ }
1104
+ }
1105
+ let i = -1;
1106
+ for (const item of items) {
1107
+ i++;
1108
+ if (i >= input.length)
1109
+ if (i >= optStart)
1110
+ continue;
1111
+ const result = item._zod.run({
1112
+ value: input[i],
1113
+ issues: [],
1114
+ }, ctx);
1115
+ if (result instanceof Promise) {
1116
+ proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1117
+ }
1118
+ else {
1119
+ handleTupleResult(result, payload, i);
1120
+ }
1121
+ }
1122
+ if (def.rest) {
1123
+ const rest = input.slice(items.length);
1124
+ for (const el of rest) {
1125
+ i++;
1126
+ const result = def.rest._zod.run({
1127
+ value: el,
1128
+ issues: [],
1129
+ }, ctx);
1130
+ if (result instanceof Promise) {
1131
+ proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1132
+ }
1133
+ else {
1134
+ handleTupleResult(result, payload, i);
1135
+ }
1136
+ }
1137
+ }
1138
+ if (proms.length)
1139
+ return Promise.all(proms).then(() => payload);
1140
+ return payload;
1141
+ };
1142
+ });
1143
+ function handleTupleResult(result, final, index) {
1144
+ if (result.issues.length) {
1145
+ final.issues.push(...util.prefixIssues(index, result.issues));
1146
+ }
1147
+ final.value[index] = result.value;
1148
+ }
1149
+ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, def) => {
1150
+ $ZodType.init(inst, def);
1151
+ inst._zod.parse = (payload, ctx) => {
1152
+ const input = payload.value;
1153
+ if (!util.isPlainObject(input)) {
1154
+ payload.issues.push({
1155
+ expected: "record",
1156
+ code: "invalid_type",
1157
+ input,
1158
+ inst,
1159
+ });
1160
+ return payload;
1161
+ }
1162
+ const proms = [];
1163
+ if (def.keyType._zod.values) {
1164
+ const values = def.keyType._zod.values;
1165
+ payload.value = {};
1166
+ for (const key of values) {
1167
+ if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1168
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1169
+ if (result instanceof Promise) {
1170
+ proms.push(result.then((result) => {
1171
+ if (result.issues.length) {
1172
+ payload.issues.push(...util.prefixIssues(key, result.issues));
1173
+ }
1174
+ payload.value[key] = result.value;
1175
+ }));
1176
+ }
1177
+ else {
1178
+ if (result.issues.length) {
1179
+ payload.issues.push(...util.prefixIssues(key, result.issues));
1180
+ }
1181
+ payload.value[key] = result.value;
1182
+ }
1183
+ }
1184
+ }
1185
+ let unrecognized;
1186
+ for (const key in input) {
1187
+ if (!values.has(key)) {
1188
+ unrecognized = unrecognized ?? [];
1189
+ unrecognized.push(key);
1190
+ }
1191
+ }
1192
+ if (unrecognized && unrecognized.length > 0) {
1193
+ payload.issues.push({
1194
+ code: "unrecognized_keys",
1195
+ input,
1196
+ inst,
1197
+ keys: unrecognized,
1198
+ });
1199
+ }
1200
+ }
1201
+ else {
1202
+ payload.value = {};
1203
+ for (const key of Reflect.ownKeys(input)) {
1204
+ if (key === "__proto__")
1205
+ continue;
1206
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1207
+ if (keyResult instanceof Promise) {
1208
+ throw new Error("Async schemas not supported in object keys currently");
1209
+ }
1210
+ if (keyResult.issues.length) {
1211
+ payload.issues.push({
1212
+ origin: "record",
1213
+ code: "invalid_key",
1214
+ issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1215
+ input: key,
1216
+ path: [key],
1217
+ inst,
1218
+ });
1219
+ payload.value[keyResult.value] = keyResult.value;
1220
+ continue;
1221
+ }
1222
+ const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1223
+ if (result instanceof Promise) {
1224
+ proms.push(result.then((result) => {
1225
+ if (result.issues.length) {
1226
+ payload.issues.push(...util.prefixIssues(key, result.issues));
1227
+ }
1228
+ payload.value[keyResult.value] = result.value;
1229
+ }));
1230
+ }
1231
+ else {
1232
+ if (result.issues.length) {
1233
+ payload.issues.push(...util.prefixIssues(key, result.issues));
1234
+ }
1235
+ payload.value[keyResult.value] = result.value;
1236
+ }
1237
+ }
1238
+ }
1239
+ if (proms.length) {
1240
+ return Promise.all(proms).then(() => payload);
1241
+ }
1242
+ return payload;
1243
+ };
1244
+ });
1245
+ export const $ZodMap = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) => {
1246
+ $ZodType.init(inst, def);
1247
+ inst._zod.parse = (payload, ctx) => {
1248
+ const input = payload.value;
1249
+ if (!(input instanceof Map)) {
1250
+ payload.issues.push({
1251
+ expected: "map",
1252
+ code: "invalid_type",
1253
+ input,
1254
+ inst,
1255
+ });
1256
+ return payload;
1257
+ }
1258
+ const proms = [];
1259
+ payload.value = new Map();
1260
+ for (const [key, value] of input) {
1261
+ const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1262
+ const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
1263
+ if (keyResult instanceof Promise || valueResult instanceof Promise) {
1264
+ proms.push(Promise.all([keyResult, valueResult]).then(([keyResult, valueResult]) => {
1265
+ handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
1266
+ }));
1267
+ }
1268
+ else {
1269
+ handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
1270
+ }
1271
+ }
1272
+ if (proms.length)
1273
+ return Promise.all(proms).then(() => payload);
1274
+ return payload;
1275
+ };
1276
+ });
1277
+ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
1278
+ if (keyResult.issues.length) {
1279
+ if (util.propertyKeyTypes.has(typeof key)) {
1280
+ final.issues.push(...util.prefixIssues(key, keyResult.issues));
1281
+ }
1282
+ else {
1283
+ final.issues.push({
1284
+ origin: "map",
1285
+ code: "invalid_key",
1286
+ input,
1287
+ inst,
1288
+ issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1289
+ });
1290
+ }
1291
+ }
1292
+ if (valueResult.issues.length) {
1293
+ if (util.propertyKeyTypes.has(typeof key)) {
1294
+ final.issues.push(...util.prefixIssues(key, valueResult.issues));
1295
+ }
1296
+ else {
1297
+ final.issues.push({
1298
+ origin: "map",
1299
+ code: "invalid_element",
1300
+ input,
1301
+ inst,
1302
+ key: key,
1303
+ issues: valueResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1304
+ });
1305
+ }
1306
+ }
1307
+ final.value.set(keyResult.value, valueResult.value);
1308
+ }
1309
+ export const $ZodSet = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) => {
1310
+ $ZodType.init(inst, def);
1311
+ inst._zod.parse = (payload, ctx) => {
1312
+ const input = payload.value;
1313
+ if (!(input instanceof Set)) {
1314
+ payload.issues.push({
1315
+ input,
1316
+ inst,
1317
+ expected: "set",
1318
+ code: "invalid_type",
1319
+ });
1320
+ return payload;
1321
+ }
1322
+ const proms = [];
1323
+ payload.value = new Set();
1324
+ for (const item of input) {
1325
+ const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
1326
+ if (result instanceof Promise) {
1327
+ proms.push(result.then((result) => handleSetResult(result, payload)));
1328
+ }
1329
+ else
1330
+ handleSetResult(result, payload);
1331
+ }
1332
+ if (proms.length)
1333
+ return Promise.all(proms).then(() => payload);
1334
+ return payload;
1335
+ };
1336
+ });
1337
+ function handleSetResult(result, final) {
1338
+ if (result.issues.length) {
1339
+ final.issues.push(...result.issues);
1340
+ }
1341
+ final.value.add(result.value);
1342
+ }
1343
+ export const $ZodEnum = /*@__PURE__*/ core.$constructor("$ZodEnum", (inst, def) => {
1344
+ $ZodType.init(inst, def);
1345
+ const values = util.getEnumValues(def.entries);
1346
+ inst._zod.values = new Set(values);
1347
+ inst._zod.pattern = new RegExp(`^(${values
1348
+ .filter((k) => util.propertyKeyTypes.has(typeof k))
1349
+ .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o.toString()))
1350
+ .join("|")})$`);
1351
+ inst._zod.parse = (payload, _ctx) => {
1352
+ const input = payload.value;
1353
+ if (inst._zod.values.has(input)) {
1354
+ return payload;
1355
+ }
1356
+ payload.issues.push({
1357
+ code: "invalid_value",
1358
+ values,
1359
+ input,
1360
+ inst,
1361
+ });
1362
+ return payload;
1363
+ };
1364
+ });
1365
+ export const $ZodLiteral = /*@__PURE__*/ core.$constructor("$ZodLiteral", (inst, def) => {
1366
+ $ZodType.init(inst, def);
1367
+ inst._zod.values = new Set(def.values);
1368
+ inst._zod.pattern = new RegExp(`^(${def.values
1369
+ .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? o.toString() : String(o)))
1370
+ .join("|")})$`);
1371
+ inst._zod.parse = (payload, _ctx) => {
1372
+ const input = payload.value;
1373
+ if (inst._zod.values.has(input)) {
1374
+ return payload;
1375
+ }
1376
+ payload.issues.push({
1377
+ code: "invalid_value",
1378
+ values: def.values,
1379
+ input,
1380
+ inst,
1381
+ });
1382
+ return payload;
1383
+ };
1384
+ });
1385
+ export const $ZodFile = /*@__PURE__*/ core.$constructor("$ZodFile", (inst, def) => {
1386
+ $ZodType.init(inst, def);
1387
+ inst._zod.parse = (payload, _ctx) => {
1388
+ const input = payload.value;
1389
+ if (input instanceof File)
1390
+ return payload;
1391
+ payload.issues.push({
1392
+ expected: "file",
1393
+ code: "invalid_type",
1394
+ input,
1395
+ inst,
1396
+ });
1397
+ return payload;
1398
+ };
1399
+ });
1400
+ export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (inst, def) => {
1401
+ $ZodType.init(inst, def);
1402
+ inst._zod.parse = (payload, _ctx) => {
1403
+ const _out = def.transform(payload.value, payload);
1404
+ if (_ctx.async) {
1405
+ const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1406
+ return output.then((output) => {
1407
+ payload.value = output;
1408
+ return payload;
1409
+ });
1410
+ }
1411
+ if (_out instanceof Promise) {
1412
+ throw new core.$ZodAsyncError();
1413
+ }
1414
+ payload.value = _out;
1415
+ return payload;
1416
+ };
1417
+ });
1418
+ export const $ZodOptional = /*@__PURE__*/ core.$constructor("$ZodOptional", (inst, def) => {
1419
+ $ZodType.init(inst, def);
1420
+ inst._zod.optin = "optional";
1421
+ inst._zod.optout = "optional";
1422
+ util.defineLazy(inst._zod, "values", () => {
1423
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
1424
+ });
1425
+ util.defineLazy(inst._zod, "pattern", () => {
1426
+ const pattern = def.innerType._zod.pattern;
1427
+ return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
1428
+ });
1429
+ inst._zod.parse = (payload, ctx) => {
1430
+ if (def.innerType._zod.optin === "optional") {
1431
+ return def.innerType._zod.run(payload, ctx);
1432
+ }
1433
+ if (payload.value === undefined) {
1434
+ return payload;
1435
+ }
1436
+ return def.innerType._zod.run(payload, ctx);
1437
+ };
1438
+ });
1439
+ export const $ZodNullable = /*@__PURE__*/ core.$constructor("$ZodNullable", (inst, def) => {
1440
+ $ZodType.init(inst, def);
1441
+ util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1442
+ util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1443
+ util.defineLazy(inst._zod, "pattern", () => {
1444
+ const pattern = def.innerType._zod.pattern;
1445
+ return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
1446
+ });
1447
+ util.defineLazy(inst._zod, "values", () => {
1448
+ return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
1449
+ });
1450
+ inst._zod.parse = (payload, ctx) => {
1451
+ if (payload.value === null)
1452
+ return payload;
1453
+ return def.innerType._zod.run(payload, ctx);
1454
+ };
1455
+ });
1456
+ export const $ZodDefault = /*@__PURE__*/ core.$constructor("$ZodDefault", (inst, def) => {
1457
+ $ZodType.init(inst, def);
1458
+ // inst._zod.qin = "true";
1459
+ inst._zod.optin = "optional";
1460
+ util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1461
+ inst._zod.parse = (payload, ctx) => {
1462
+ if (payload.value === undefined) {
1463
+ payload.value = def.defaultValue;
1464
+ /**
1465
+ * $ZodDefault always returns the default value immediately.
1466
+ * It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
1467
+ return payload;
1468
+ }
1469
+ const result = def.innerType._zod.run(payload, ctx);
1470
+ if (result instanceof Promise) {
1471
+ return result.then((result) => handleDefaultResult(result, def));
1472
+ }
1473
+ return handleDefaultResult(result, def);
1474
+ };
1475
+ });
1476
+ function handleDefaultResult(payload, def) {
1477
+ if (payload.value === undefined) {
1478
+ payload.value = def.defaultValue;
1479
+ }
1480
+ return payload;
1481
+ }
1482
+ export const $ZodPrefault = /*@__PURE__*/ core.$constructor("$ZodPrefault", (inst, def) => {
1483
+ $ZodType.init(inst, def);
1484
+ inst._zod.optin = "optional";
1485
+ util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1486
+ inst._zod.parse = (payload, ctx) => {
1487
+ if (payload.value === undefined) {
1488
+ payload.value = def.defaultValue;
1489
+ }
1490
+ return def.innerType._zod.run(payload, ctx);
1491
+ };
1492
+ });
1493
+ export const $ZodNonOptional = /*@__PURE__*/ core.$constructor("$ZodNonOptional", (inst, def) => {
1494
+ $ZodType.init(inst, def);
1495
+ util.defineLazy(inst._zod, "values", () => {
1496
+ const v = def.innerType._zod.values;
1497
+ return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
1498
+ });
1499
+ inst._zod.parse = (payload, ctx) => {
1500
+ const result = def.innerType._zod.run(payload, ctx);
1501
+ if (result instanceof Promise) {
1502
+ return result.then((result) => handleNonOptionalResult(result, inst));
1503
+ }
1504
+ return handleNonOptionalResult(result, inst);
1505
+ };
1506
+ });
1507
+ function handleNonOptionalResult(payload, inst) {
1508
+ if (!payload.issues.length && payload.value === undefined) {
1509
+ payload.issues.push({
1510
+ code: "invalid_type",
1511
+ expected: "nonoptional",
1512
+ input: payload.value,
1513
+ inst,
1514
+ });
1515
+ }
1516
+ return payload;
1517
+ }
1518
+ export const $ZodSuccess = /*@__PURE__*/ core.$constructor("$ZodSuccess", (inst, def) => {
1519
+ $ZodType.init(inst, def);
1520
+ inst._zod.parse = (payload, ctx) => {
1521
+ const result = def.innerType._zod.run(payload, ctx);
1522
+ if (result instanceof Promise) {
1523
+ return result.then((result) => {
1524
+ payload.value = result.issues.length === 0;
1525
+ return payload;
1526
+ });
1527
+ }
1528
+ payload.value = result.issues.length === 0;
1529
+ return payload;
1530
+ };
1531
+ });
1532
+ export const $ZodCatch = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def) => {
1533
+ $ZodType.init(inst, def);
1534
+ inst._zod.optin = "optional";
1535
+ util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1536
+ util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1537
+ inst._zod.parse = (payload, ctx) => {
1538
+ const result = def.innerType._zod.run(payload, ctx);
1539
+ if (result instanceof Promise) {
1540
+ return result.then((result) => {
1541
+ payload.value = result.value;
1542
+ if (result.issues.length) {
1543
+ payload.value = def.catchValue({
1544
+ ...payload,
1545
+ error: {
1546
+ issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1547
+ },
1548
+ input: payload.value,
1549
+ });
1550
+ payload.issues = [];
1551
+ }
1552
+ return payload;
1553
+ });
1554
+ }
1555
+ payload.value = result.value;
1556
+ if (result.issues.length) {
1557
+ payload.value = def.catchValue({
1558
+ ...payload,
1559
+ error: {
1560
+ issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1561
+ },
1562
+ input: payload.value,
1563
+ });
1564
+ payload.issues = [];
1565
+ }
1566
+ return payload;
1567
+ };
1568
+ });
1569
+ export const $ZodNaN = /*@__PURE__*/ core.$constructor("$ZodNaN", (inst, def) => {
1570
+ $ZodType.init(inst, def);
1571
+ inst._zod.parse = (payload, _ctx) => {
1572
+ if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {
1573
+ payload.issues.push({
1574
+ input: payload.value,
1575
+ inst,
1576
+ expected: "nan",
1577
+ code: "invalid_type",
1578
+ });
1579
+ return payload;
1580
+ }
1581
+ return payload;
1582
+ };
1583
+ });
1584
+ export const $ZodPipe = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def) => {
1585
+ $ZodType.init(inst, def);
1586
+ util.defineLazy(inst._zod, "values", () => def.in._zod.values);
1587
+ util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1588
+ util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1589
+ inst._zod.parse = (payload, ctx) => {
1590
+ const left = def.in._zod.run(payload, ctx);
1591
+ if (left instanceof Promise) {
1592
+ return left.then((left) => handlePipeResult(left, def, ctx));
1593
+ }
1594
+ return handlePipeResult(left, def, ctx);
1595
+ };
1596
+ });
1597
+ function handlePipeResult(left, def, ctx) {
1598
+ if (util.aborted(left)) {
1599
+ return left;
1600
+ }
1601
+ return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
1602
+ }
1603
+ export const $ZodReadonly = /*@__PURE__*/ core.$constructor("$ZodReadonly", (inst, def) => {
1604
+ $ZodType.init(inst, def);
1605
+ util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1606
+ util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1607
+ util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1608
+ util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1609
+ inst._zod.parse = (payload, ctx) => {
1610
+ const result = def.innerType._zod.run(payload, ctx);
1611
+ if (result instanceof Promise) {
1612
+ return result.then(handleReadonlyResult);
1613
+ }
1614
+ return handleReadonlyResult(result);
1615
+ };
1616
+ });
1617
+ function handleReadonlyResult(payload) {
1618
+ payload.value = Object.freeze(payload.value);
1619
+ return payload;
1620
+ }
1621
+ export const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor("$ZodTemplateLiteral", (inst, def) => {
1622
+ $ZodType.init(inst, def);
1623
+ const regexParts = [];
1624
+ for (const part of def.parts) {
1625
+ if (part instanceof $ZodType) {
1626
+ if (!part._zod.pattern) {
1627
+ // if (!source)
1628
+ throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
1629
+ }
1630
+ const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
1631
+ if (!source)
1632
+ throw new Error(`Invalid template literal part: ${part._zod.traits}`);
1633
+ const start = source.startsWith("^") ? 1 : 0;
1634
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
1635
+ regexParts.push(source.slice(start, end));
1636
+ }
1637
+ else if (part === null || util.primitiveTypes.has(typeof part)) {
1638
+ regexParts.push(util.escapeRegex(`${part}`));
1639
+ }
1640
+ else {
1641
+ throw new Error(`Invalid template literal part: ${part}`);
1642
+ }
1643
+ }
1644
+ inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
1645
+ inst._zod.parse = (payload, _ctx) => {
1646
+ if (typeof payload.value !== "string") {
1647
+ payload.issues.push({
1648
+ input: payload.value,
1649
+ inst,
1650
+ expected: "template_literal",
1651
+ code: "invalid_type",
1652
+ });
1653
+ return payload;
1654
+ }
1655
+ inst._zod.pattern.lastIndex = 0;
1656
+ if (!inst._zod.pattern.test(payload.value)) {
1657
+ payload.issues.push({
1658
+ input: payload.value,
1659
+ inst,
1660
+ code: "invalid_format",
1661
+ format: "template_literal",
1662
+ pattern: inst._zod.pattern.source,
1663
+ });
1664
+ return payload;
1665
+ }
1666
+ return payload;
1667
+ };
1668
+ });
1669
+ export const $ZodPromise = /*@__PURE__*/ core.$constructor("$ZodPromise", (inst, def) => {
1670
+ $ZodType.init(inst, def);
1671
+ inst._zod.parse = (payload, ctx) => {
1672
+ return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
1673
+ };
1674
+ });
1675
+ export const $ZodLazy = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
1676
+ $ZodType.init(inst, def);
1677
+ util.defineLazy(inst._zod, "innerType", () => def.getter());
1678
+ util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
1679
+ util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
1680
+ util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin);
1681
+ util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout);
1682
+ inst._zod.parse = (payload, ctx) => {
1683
+ const inner = inst._zod.innerType;
1684
+ return inner._zod.run(payload, ctx);
1685
+ };
1686
+ });
1687
+ export const $ZodCustom = /*@__PURE__*/ core.$constructor("$ZodCustom", (inst, def) => {
1688
+ checks.$ZodCheck.init(inst, def);
1689
+ $ZodType.init(inst, def);
1690
+ inst._zod.parse = (payload, _) => {
1691
+ return payload;
1692
+ };
1693
+ inst._zod.check = (payload) => {
1694
+ const input = payload.value;
1695
+ const r = def.fn(input);
1696
+ if (r instanceof Promise) {
1697
+ return r.then((r) => handleRefineResult(r, payload, input, inst));
1698
+ }
1699
+ handleRefineResult(r, payload, input, inst);
1700
+ return;
1701
+ };
1702
+ });
1703
+ function handleRefineResult(result, payload, input, inst) {
1704
+ if (!result) {
1705
+ const _iss = {
1706
+ code: "custom",
1707
+ input,
1708
+ inst, // incorporates params.error into issue reporting
1709
+ path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting
1710
+ continue: !inst._zod.def.abort,
1711
+ // params: inst._zod.def.params,
1712
+ };
1713
+ if (inst._zod.def.params)
1714
+ _iss.params = inst._zod.def.params;
1715
+ payload.issues.push(util.issue(_iss));
1716
+ }
1717
+ }