claude-scope 0.1.6 → 0.1.8

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 (747) hide show
  1. package/dist/data/stdin-provider.d.ts +1 -1
  2. package/dist/data/stdin-provider.d.ts.map +1 -1
  3. package/dist/data/stdin-provider.js +7 -18
  4. package/dist/data/stdin-provider.js.map +1 -1
  5. package/dist/schemas/stdin-schema.d.ts +80 -119
  6. package/dist/schemas/stdin-schema.d.ts.map +1 -1
  7. package/dist/schemas/stdin-schema.js +35 -68
  8. package/dist/schemas/stdin-schema.js.map +1 -1
  9. package/dist/validation/combinators.d.ts +10 -0
  10. package/dist/validation/combinators.d.ts.map +1 -0
  11. package/dist/validation/combinators.js +49 -0
  12. package/dist/validation/combinators.js.map +1 -0
  13. package/dist/validation/core.d.ts +30 -0
  14. package/dist/validation/core.d.ts.map +1 -0
  15. package/dist/validation/core.js +2 -0
  16. package/dist/validation/core.js.map +1 -0
  17. package/dist/validation/index.d.ts +4 -0
  18. package/dist/validation/index.d.ts.map +1 -0
  19. package/dist/validation/index.js +4 -0
  20. package/dist/validation/index.js.map +1 -0
  21. package/dist/validation/result.d.ts +5 -0
  22. package/dist/validation/result.d.ts.map +1 -0
  23. package/dist/validation/result.js +11 -0
  24. package/dist/validation/result.js.map +1 -0
  25. package/dist/validation/validators.d.ts +7 -0
  26. package/dist/validation/validators.d.ts.map +1 -0
  27. package/dist/validation/validators.js +41 -0
  28. package/dist/validation/validators.js.map +1 -0
  29. package/package.json +4 -6
  30. package/dist/core/stdin-data-widget.d.ts +0 -85
  31. package/dist/core/stdin-data-widget.d.ts.map +0 -1
  32. package/dist/core/stdin-data-widget.js +0 -75
  33. package/dist/core/stdin-data-widget.js.map +0 -1
  34. package/dist/providers/stdin-provider.d.ts +0 -44
  35. package/dist/providers/stdin-provider.d.ts.map +0 -1
  36. package/dist/providers/stdin-provider.js +0 -83
  37. package/dist/providers/stdin-provider.js.map +0 -1
  38. package/dist/utils/colors.d.ts +0 -52
  39. package/dist/utils/colors.d.ts.map +0 -1
  40. package/dist/utils/colors.js +0 -54
  41. package/dist/utils/colors.js.map +0 -1
  42. package/dist/utils/formatters.d.ts +0 -56
  43. package/dist/utils/formatters.d.ts.map +0 -1
  44. package/dist/utils/formatters.js +0 -114
  45. package/dist/utils/formatters.js.map +0 -1
  46. package/dist/widgets/git-changes-widget.d.ts +0 -16
  47. package/dist/widgets/git-changes-widget.d.ts.map +0 -1
  48. package/dist/widgets/git-changes-widget.js +0 -37
  49. package/dist/widgets/git-changes-widget.js.map +0 -1
  50. package/dist/widgets/git-widget.d.ts +0 -35
  51. package/dist/widgets/git-widget.d.ts.map +0 -1
  52. package/dist/widgets/git-widget.js +0 -51
  53. package/dist/widgets/git-widget.js.map +0 -1
  54. package/node_modules/zod/LICENSE +0 -21
  55. package/node_modules/zod/README.md +0 -208
  56. package/node_modules/zod/index.cjs +0 -33
  57. package/node_modules/zod/index.d.cts +0 -4
  58. package/node_modules/zod/index.d.ts +0 -4
  59. package/node_modules/zod/index.js +0 -4
  60. package/node_modules/zod/locales/index.cjs +0 -17
  61. package/node_modules/zod/locales/index.d.cts +0 -1
  62. package/node_modules/zod/locales/index.d.ts +0 -1
  63. package/node_modules/zod/locales/index.js +0 -1
  64. package/node_modules/zod/locales/package.json +0 -6
  65. package/node_modules/zod/mini/index.cjs +0 -17
  66. package/node_modules/zod/mini/index.d.cts +0 -1
  67. package/node_modules/zod/mini/index.d.ts +0 -1
  68. package/node_modules/zod/mini/index.js +0 -1
  69. package/node_modules/zod/mini/package.json +0 -6
  70. package/node_modules/zod/package.json +0 -135
  71. package/node_modules/zod/src/index.ts +0 -4
  72. package/node_modules/zod/src/locales/index.ts +0 -1
  73. package/node_modules/zod/src/mini/index.ts +0 -1
  74. package/node_modules/zod/src/v3/ZodError.ts +0 -330
  75. package/node_modules/zod/src/v3/benchmarks/datetime.ts +0 -58
  76. package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +0 -80
  77. package/node_modules/zod/src/v3/benchmarks/index.ts +0 -59
  78. package/node_modules/zod/src/v3/benchmarks/ipv4.ts +0 -57
  79. package/node_modules/zod/src/v3/benchmarks/object.ts +0 -69
  80. package/node_modules/zod/src/v3/benchmarks/primitives.ts +0 -162
  81. package/node_modules/zod/src/v3/benchmarks/realworld.ts +0 -63
  82. package/node_modules/zod/src/v3/benchmarks/string.ts +0 -55
  83. package/node_modules/zod/src/v3/benchmarks/union.ts +0 -80
  84. package/node_modules/zod/src/v3/errors.ts +0 -13
  85. package/node_modules/zod/src/v3/external.ts +0 -6
  86. package/node_modules/zod/src/v3/helpers/enumUtil.ts +0 -17
  87. package/node_modules/zod/src/v3/helpers/errorUtil.ts +0 -8
  88. package/node_modules/zod/src/v3/helpers/parseUtil.ts +0 -176
  89. package/node_modules/zod/src/v3/helpers/partialUtil.ts +0 -34
  90. package/node_modules/zod/src/v3/helpers/typeAliases.ts +0 -2
  91. package/node_modules/zod/src/v3/helpers/util.ts +0 -224
  92. package/node_modules/zod/src/v3/index.ts +0 -4
  93. package/node_modules/zod/src/v3/locales/en.ts +0 -124
  94. package/node_modules/zod/src/v3/standard-schema.ts +0 -113
  95. package/node_modules/zod/src/v3/tests/Mocker.ts +0 -54
  96. package/node_modules/zod/src/v3/tests/all-errors.test.ts +0 -157
  97. package/node_modules/zod/src/v3/tests/anyunknown.test.ts +0 -28
  98. package/node_modules/zod/src/v3/tests/array.test.ts +0 -71
  99. package/node_modules/zod/src/v3/tests/async-parsing.test.ts +0 -388
  100. package/node_modules/zod/src/v3/tests/async-refinements.test.ts +0 -46
  101. package/node_modules/zod/src/v3/tests/base.test.ts +0 -29
  102. package/node_modules/zod/src/v3/tests/bigint.test.ts +0 -55
  103. package/node_modules/zod/src/v3/tests/branded.test.ts +0 -53
  104. package/node_modules/zod/src/v3/tests/catch.test.ts +0 -220
  105. package/node_modules/zod/src/v3/tests/coerce.test.ts +0 -133
  106. package/node_modules/zod/src/v3/tests/complex.test.ts +0 -70
  107. package/node_modules/zod/src/v3/tests/custom.test.ts +0 -31
  108. package/node_modules/zod/src/v3/tests/date.test.ts +0 -32
  109. package/node_modules/zod/src/v3/tests/deepmasking.test.ts +0 -186
  110. package/node_modules/zod/src/v3/tests/default.test.ts +0 -112
  111. package/node_modules/zod/src/v3/tests/description.test.ts +0 -33
  112. package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +0 -315
  113. package/node_modules/zod/src/v3/tests/enum.test.ts +0 -80
  114. package/node_modules/zod/src/v3/tests/error.test.ts +0 -551
  115. package/node_modules/zod/src/v3/tests/firstparty.test.ts +0 -87
  116. package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +0 -21
  117. package/node_modules/zod/src/v3/tests/function.test.ts +0 -261
  118. package/node_modules/zod/src/v3/tests/generics.test.ts +0 -48
  119. package/node_modules/zod/src/v3/tests/instanceof.test.ts +0 -37
  120. package/node_modules/zod/src/v3/tests/intersection.test.ts +0 -110
  121. package/node_modules/zod/src/v3/tests/language-server.source.ts +0 -76
  122. package/node_modules/zod/src/v3/tests/language-server.test.ts +0 -207
  123. package/node_modules/zod/src/v3/tests/literal.test.ts +0 -36
  124. package/node_modules/zod/src/v3/tests/map.test.ts +0 -110
  125. package/node_modules/zod/src/v3/tests/masking.test.ts +0 -4
  126. package/node_modules/zod/src/v3/tests/mocker.test.ts +0 -19
  127. package/node_modules/zod/src/v3/tests/nan.test.ts +0 -24
  128. package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +0 -87
  129. package/node_modules/zod/src/v3/tests/nullable.test.ts +0 -42
  130. package/node_modules/zod/src/v3/tests/number.test.ts +0 -176
  131. package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +0 -29
  132. package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +0 -29
  133. package/node_modules/zod/src/v3/tests/object.test.ts +0 -434
  134. package/node_modules/zod/src/v3/tests/optional.test.ts +0 -42
  135. package/node_modules/zod/src/v3/tests/parseUtil.test.ts +0 -23
  136. package/node_modules/zod/src/v3/tests/parser.test.ts +0 -41
  137. package/node_modules/zod/src/v3/tests/partials.test.ts +0 -243
  138. package/node_modules/zod/src/v3/tests/pickomit.test.ts +0 -111
  139. package/node_modules/zod/src/v3/tests/pipeline.test.ts +0 -29
  140. package/node_modules/zod/src/v3/tests/preprocess.test.ts +0 -186
  141. package/node_modules/zod/src/v3/tests/primitive.test.ts +0 -440
  142. package/node_modules/zod/src/v3/tests/promise.test.ts +0 -90
  143. package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -194
  144. package/node_modules/zod/src/v3/tests/record.test.ts +0 -171
  145. package/node_modules/zod/src/v3/tests/recursive.test.ts +0 -197
  146. package/node_modules/zod/src/v3/tests/refine.test.ts +0 -313
  147. package/node_modules/zod/src/v3/tests/safeparse.test.ts +0 -27
  148. package/node_modules/zod/src/v3/tests/set.test.ts +0 -142
  149. package/node_modules/zod/src/v3/tests/standard-schema.test.ts +0 -83
  150. package/node_modules/zod/src/v3/tests/string.test.ts +0 -916
  151. package/node_modules/zod/src/v3/tests/transformer.test.ts +0 -233
  152. package/node_modules/zod/src/v3/tests/tuple.test.ts +0 -90
  153. package/node_modules/zod/src/v3/tests/unions.test.ts +0 -57
  154. package/node_modules/zod/src/v3/tests/validations.test.ts +0 -133
  155. package/node_modules/zod/src/v3/tests/void.test.ts +0 -15
  156. package/node_modules/zod/src/v3/types.ts +0 -5138
  157. package/node_modules/zod/src/v4/classic/checks.ts +0 -32
  158. package/node_modules/zod/src/v4/classic/coerce.ts +0 -27
  159. package/node_modules/zod/src/v4/classic/compat.ts +0 -70
  160. package/node_modules/zod/src/v4/classic/errors.ts +0 -82
  161. package/node_modules/zod/src/v4/classic/external.ts +0 -51
  162. package/node_modules/zod/src/v4/classic/from-json-schema.ts +0 -643
  163. package/node_modules/zod/src/v4/classic/index.ts +0 -5
  164. package/node_modules/zod/src/v4/classic/iso.ts +0 -90
  165. package/node_modules/zod/src/v4/classic/parse.ts +0 -82
  166. package/node_modules/zod/src/v4/classic/schemas.ts +0 -2409
  167. package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +0 -26
  168. package/node_modules/zod/src/v4/classic/tests/apply.test.ts +0 -59
  169. package/node_modules/zod/src/v4/classic/tests/array.test.ts +0 -264
  170. package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +0 -210
  171. package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +0 -381
  172. package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +0 -68
  173. package/node_modules/zod/src/v4/classic/tests/base.test.ts +0 -7
  174. package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +0 -54
  175. package/node_modules/zod/src/v4/classic/tests/brand.test.ts +0 -106
  176. package/node_modules/zod/src/v4/classic/tests/catch.test.ts +0 -276
  177. package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +0 -20
  178. package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +0 -573
  179. package/node_modules/zod/src/v4/classic/tests/codec.test.ts +0 -562
  180. package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +0 -160
  181. package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +0 -374
  182. package/node_modules/zod/src/v4/classic/tests/custom.test.ts +0 -40
  183. package/node_modules/zod/src/v4/classic/tests/date.test.ts +0 -62
  184. package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +0 -302
  185. package/node_modules/zod/src/v4/classic/tests/default.test.ts +0 -365
  186. package/node_modules/zod/src/v4/classic/tests/describe-meta-checks.test.ts +0 -27
  187. package/node_modules/zod/src/v4/classic/tests/description.test.ts +0 -32
  188. package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +0 -661
  189. package/node_modules/zod/src/v4/classic/tests/enum.test.ts +0 -285
  190. package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +0 -595
  191. package/node_modules/zod/src/v4/classic/tests/error.test.ts +0 -711
  192. package/node_modules/zod/src/v4/classic/tests/file.test.ts +0 -96
  193. package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +0 -179
  194. package/node_modules/zod/src/v4/classic/tests/fix-json-issue.test.ts +0 -26
  195. package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +0 -734
  196. package/node_modules/zod/src/v4/classic/tests/function.test.ts +0 -360
  197. package/node_modules/zod/src/v4/classic/tests/generics.test.ts +0 -72
  198. package/node_modules/zod/src/v4/classic/tests/hash.test.ts +0 -68
  199. package/node_modules/zod/src/v4/classic/tests/index.test.ts +0 -939
  200. package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +0 -60
  201. package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +0 -198
  202. package/node_modules/zod/src/v4/classic/tests/json.test.ts +0 -109
  203. package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +0 -227
  204. package/node_modules/zod/src/v4/classic/tests/literal.test.ts +0 -117
  205. package/node_modules/zod/src/v4/classic/tests/map.test.ts +0 -330
  206. package/node_modules/zod/src/v4/classic/tests/nan.test.ts +0 -21
  207. package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +0 -168
  208. package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +0 -101
  209. package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +0 -22
  210. package/node_modules/zod/src/v4/classic/tests/number.test.ts +0 -270
  211. package/node_modules/zod/src/v4/classic/tests/object.test.ts +0 -640
  212. package/node_modules/zod/src/v4/classic/tests/optional.test.ts +0 -223
  213. package/node_modules/zod/src/v4/classic/tests/partial.test.ts +0 -427
  214. package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +0 -211
  215. package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +0 -101
  216. package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +0 -74
  217. package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +0 -282
  218. package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +0 -175
  219. package/node_modules/zod/src/v4/classic/tests/promise.test.ts +0 -81
  220. package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +0 -23
  221. package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -252
  222. package/node_modules/zod/src/v4/classic/tests/record.test.ts +0 -600
  223. package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +0 -582
  224. package/node_modules/zod/src/v4/classic/tests/refine.test.ts +0 -570
  225. package/node_modules/zod/src/v4/classic/tests/registries.test.ts +0 -243
  226. package/node_modules/zod/src/v4/classic/tests/set.test.ts +0 -181
  227. package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +0 -134
  228. package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +0 -125
  229. package/node_modules/zod/src/v4/classic/tests/string.test.ts +0 -1175
  230. package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +0 -106
  231. package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +0 -771
  232. package/node_modules/zod/src/v4/classic/tests/to-json-schema-methods.test.ts +0 -438
  233. package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +0 -2975
  234. package/node_modules/zod/src/v4/classic/tests/transform.test.ts +0 -361
  235. package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +0 -183
  236. package/node_modules/zod/src/v4/classic/tests/union.test.ts +0 -219
  237. package/node_modules/zod/src/v4/classic/tests/url.test.ts +0 -13
  238. package/node_modules/zod/src/v4/classic/tests/validations.test.ts +0 -283
  239. package/node_modules/zod/src/v4/classic/tests/void.test.ts +0 -12
  240. package/node_modules/zod/src/v4/core/api.ts +0 -1798
  241. package/node_modules/zod/src/v4/core/checks.ts +0 -1293
  242. package/node_modules/zod/src/v4/core/config.ts +0 -15
  243. package/node_modules/zod/src/v4/core/core.ts +0 -138
  244. package/node_modules/zod/src/v4/core/doc.ts +0 -44
  245. package/node_modules/zod/src/v4/core/errors.ts +0 -448
  246. package/node_modules/zod/src/v4/core/index.ts +0 -16
  247. package/node_modules/zod/src/v4/core/json-schema-generator.ts +0 -126
  248. package/node_modules/zod/src/v4/core/json-schema-processors.ts +0 -667
  249. package/node_modules/zod/src/v4/core/json-schema.ts +0 -147
  250. package/node_modules/zod/src/v4/core/parse.ts +0 -195
  251. package/node_modules/zod/src/v4/core/regexes.ts +0 -183
  252. package/node_modules/zod/src/v4/core/registries.ts +0 -105
  253. package/node_modules/zod/src/v4/core/schemas.ts +0 -4543
  254. package/node_modules/zod/src/v4/core/standard-schema.ts +0 -159
  255. package/node_modules/zod/src/v4/core/tests/extend.test.ts +0 -59
  256. package/node_modules/zod/src/v4/core/tests/index.test.ts +0 -46
  257. package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +0 -124
  258. package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +0 -22
  259. package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +0 -181
  260. package/node_modules/zod/src/v4/core/tests/locales/he.test.ts +0 -379
  261. package/node_modules/zod/src/v4/core/tests/locales/nl.test.ts +0 -46
  262. package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +0 -128
  263. package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +0 -69
  264. package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +0 -83
  265. package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +0 -67
  266. package/node_modules/zod/src/v4/core/tests/recursive-tuples.test.ts +0 -45
  267. package/node_modules/zod/src/v4/core/to-json-schema.ts +0 -613
  268. package/node_modules/zod/src/v4/core/util.ts +0 -966
  269. package/node_modules/zod/src/v4/core/versions.ts +0 -5
  270. package/node_modules/zod/src/v4/core/zsf.ts +0 -323
  271. package/node_modules/zod/src/v4/index.ts +0 -4
  272. package/node_modules/zod/src/v4/locales/ar.ts +0 -115
  273. package/node_modules/zod/src/v4/locales/az.ts +0 -111
  274. package/node_modules/zod/src/v4/locales/be.ts +0 -176
  275. package/node_modules/zod/src/v4/locales/bg.ts +0 -128
  276. package/node_modules/zod/src/v4/locales/ca.ts +0 -116
  277. package/node_modules/zod/src/v4/locales/cs.ts +0 -118
  278. package/node_modules/zod/src/v4/locales/da.ts +0 -123
  279. package/node_modules/zod/src/v4/locales/de.ts +0 -116
  280. package/node_modules/zod/src/v4/locales/en.ts +0 -119
  281. package/node_modules/zod/src/v4/locales/eo.ts +0 -118
  282. package/node_modules/zod/src/v4/locales/es.ts +0 -141
  283. package/node_modules/zod/src/v4/locales/fa.ts +0 -126
  284. package/node_modules/zod/src/v4/locales/fi.ts +0 -121
  285. package/node_modules/zod/src/v4/locales/fr-CA.ts +0 -116
  286. package/node_modules/zod/src/v4/locales/fr.ts +0 -116
  287. package/node_modules/zod/src/v4/locales/he.ts +0 -246
  288. package/node_modules/zod/src/v4/locales/hu.ts +0 -117
  289. package/node_modules/zod/src/v4/locales/hy.ts +0 -164
  290. package/node_modules/zod/src/v4/locales/id.ts +0 -115
  291. package/node_modules/zod/src/v4/locales/index.ts +0 -49
  292. package/node_modules/zod/src/v4/locales/is.ts +0 -119
  293. package/node_modules/zod/src/v4/locales/it.ts +0 -116
  294. package/node_modules/zod/src/v4/locales/ja.ts +0 -114
  295. package/node_modules/zod/src/v4/locales/ka.ts +0 -123
  296. package/node_modules/zod/src/v4/locales/kh.ts +0 -7
  297. package/node_modules/zod/src/v4/locales/km.ts +0 -119
  298. package/node_modules/zod/src/v4/locales/ko.ts +0 -121
  299. package/node_modules/zod/src/v4/locales/lt.ts +0 -239
  300. package/node_modules/zod/src/v4/locales/mk.ts +0 -118
  301. package/node_modules/zod/src/v4/locales/ms.ts +0 -115
  302. package/node_modules/zod/src/v4/locales/nl.ts +0 -121
  303. package/node_modules/zod/src/v4/locales/no.ts +0 -116
  304. package/node_modules/zod/src/v4/locales/ota.ts +0 -117
  305. package/node_modules/zod/src/v4/locales/pl.ts +0 -118
  306. package/node_modules/zod/src/v4/locales/ps.ts +0 -126
  307. package/node_modules/zod/src/v4/locales/pt.ts +0 -116
  308. package/node_modules/zod/src/v4/locales/ru.ts +0 -176
  309. package/node_modules/zod/src/v4/locales/sl.ts +0 -118
  310. package/node_modules/zod/src/v4/locales/sv.ts +0 -119
  311. package/node_modules/zod/src/v4/locales/ta.ts +0 -118
  312. package/node_modules/zod/src/v4/locales/th.ts +0 -119
  313. package/node_modules/zod/src/v4/locales/tr.ts +0 -111
  314. package/node_modules/zod/src/v4/locales/ua.ts +0 -7
  315. package/node_modules/zod/src/v4/locales/uk.ts +0 -117
  316. package/node_modules/zod/src/v4/locales/ur.ts +0 -119
  317. package/node_modules/zod/src/v4/locales/uz.ts +0 -116
  318. package/node_modules/zod/src/v4/locales/vi.ts +0 -117
  319. package/node_modules/zod/src/v4/locales/yo.ts +0 -124
  320. package/node_modules/zod/src/v4/locales/zh-CN.ts +0 -116
  321. package/node_modules/zod/src/v4/locales/zh-TW.ts +0 -115
  322. package/node_modules/zod/src/v4/mini/checks.ts +0 -32
  323. package/node_modules/zod/src/v4/mini/coerce.ts +0 -27
  324. package/node_modules/zod/src/v4/mini/external.ts +0 -40
  325. package/node_modules/zod/src/v4/mini/index.ts +0 -3
  326. package/node_modules/zod/src/v4/mini/iso.ts +0 -66
  327. package/node_modules/zod/src/v4/mini/parse.ts +0 -14
  328. package/node_modules/zod/src/v4/mini/schemas.ts +0 -1916
  329. package/node_modules/zod/src/v4/mini/tests/apply.test.ts +0 -24
  330. package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +0 -129
  331. package/node_modules/zod/src/v4/mini/tests/brand.test.ts +0 -94
  332. package/node_modules/zod/src/v4/mini/tests/checks.test.ts +0 -144
  333. package/node_modules/zod/src/v4/mini/tests/codec.test.ts +0 -529
  334. package/node_modules/zod/src/v4/mini/tests/computed.test.ts +0 -36
  335. package/node_modules/zod/src/v4/mini/tests/error.test.ts +0 -22
  336. package/node_modules/zod/src/v4/mini/tests/functions.test.ts +0 -5
  337. package/node_modules/zod/src/v4/mini/tests/index.test.ts +0 -963
  338. package/node_modules/zod/src/v4/mini/tests/number.test.ts +0 -95
  339. package/node_modules/zod/src/v4/mini/tests/object.test.ts +0 -227
  340. package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +0 -43
  341. package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +0 -275
  342. package/node_modules/zod/src/v4/mini/tests/standard-schema.test.ts +0 -50
  343. package/node_modules/zod/src/v4/mini/tests/string.test.ts +0 -347
  344. package/node_modules/zod/src/v4-mini/index.ts +0 -1
  345. package/node_modules/zod/v3/ZodError.cjs +0 -138
  346. package/node_modules/zod/v3/ZodError.d.cts +0 -164
  347. package/node_modules/zod/v3/ZodError.d.ts +0 -164
  348. package/node_modules/zod/v3/ZodError.js +0 -133
  349. package/node_modules/zod/v3/errors.cjs +0 -17
  350. package/node_modules/zod/v3/errors.d.cts +0 -5
  351. package/node_modules/zod/v3/errors.d.ts +0 -5
  352. package/node_modules/zod/v3/errors.js +0 -9
  353. package/node_modules/zod/v3/external.cjs +0 -22
  354. package/node_modules/zod/v3/external.d.cts +0 -6
  355. package/node_modules/zod/v3/external.d.ts +0 -6
  356. package/node_modules/zod/v3/external.js +0 -6
  357. package/node_modules/zod/v3/helpers/enumUtil.cjs +0 -2
  358. package/node_modules/zod/v3/helpers/enumUtil.d.cts +0 -8
  359. package/node_modules/zod/v3/helpers/enumUtil.d.ts +0 -8
  360. package/node_modules/zod/v3/helpers/enumUtil.js +0 -1
  361. package/node_modules/zod/v3/helpers/errorUtil.cjs +0 -9
  362. package/node_modules/zod/v3/helpers/errorUtil.d.cts +0 -9
  363. package/node_modules/zod/v3/helpers/errorUtil.d.ts +0 -9
  364. package/node_modules/zod/v3/helpers/errorUtil.js +0 -6
  365. package/node_modules/zod/v3/helpers/parseUtil.cjs +0 -124
  366. package/node_modules/zod/v3/helpers/parseUtil.d.cts +0 -78
  367. package/node_modules/zod/v3/helpers/parseUtil.d.ts +0 -78
  368. package/node_modules/zod/v3/helpers/parseUtil.js +0 -109
  369. package/node_modules/zod/v3/helpers/partialUtil.cjs +0 -2
  370. package/node_modules/zod/v3/helpers/partialUtil.d.cts +0 -8
  371. package/node_modules/zod/v3/helpers/partialUtil.d.ts +0 -8
  372. package/node_modules/zod/v3/helpers/partialUtil.js +0 -1
  373. package/node_modules/zod/v3/helpers/typeAliases.cjs +0 -2
  374. package/node_modules/zod/v3/helpers/typeAliases.d.cts +0 -2
  375. package/node_modules/zod/v3/helpers/typeAliases.d.ts +0 -2
  376. package/node_modules/zod/v3/helpers/typeAliases.js +0 -1
  377. package/node_modules/zod/v3/helpers/util.cjs +0 -137
  378. package/node_modules/zod/v3/helpers/util.d.cts +0 -85
  379. package/node_modules/zod/v3/helpers/util.d.ts +0 -85
  380. package/node_modules/zod/v3/helpers/util.js +0 -133
  381. package/node_modules/zod/v3/index.cjs +0 -33
  382. package/node_modules/zod/v3/index.d.cts +0 -4
  383. package/node_modules/zod/v3/index.d.ts +0 -4
  384. package/node_modules/zod/v3/index.js +0 -4
  385. package/node_modules/zod/v3/locales/en.cjs +0 -112
  386. package/node_modules/zod/v3/locales/en.d.cts +0 -3
  387. package/node_modules/zod/v3/locales/en.d.ts +0 -3
  388. package/node_modules/zod/v3/locales/en.js +0 -109
  389. package/node_modules/zod/v3/package.json +0 -6
  390. package/node_modules/zod/v3/standard-schema.cjs +0 -2
  391. package/node_modules/zod/v3/standard-schema.d.cts +0 -102
  392. package/node_modules/zod/v3/standard-schema.d.ts +0 -102
  393. package/node_modules/zod/v3/standard-schema.js +0 -1
  394. package/node_modules/zod/v3/types.cjs +0 -3777
  395. package/node_modules/zod/v3/types.d.cts +0 -1034
  396. package/node_modules/zod/v3/types.d.ts +0 -1034
  397. package/node_modules/zod/v3/types.js +0 -3695
  398. package/node_modules/zod/v4/classic/checks.cjs +0 -33
  399. package/node_modules/zod/v4/classic/checks.d.cts +0 -1
  400. package/node_modules/zod/v4/classic/checks.d.ts +0 -1
  401. package/node_modules/zod/v4/classic/checks.js +0 -1
  402. package/node_modules/zod/v4/classic/coerce.cjs +0 -47
  403. package/node_modules/zod/v4/classic/coerce.d.cts +0 -17
  404. package/node_modules/zod/v4/classic/coerce.d.ts +0 -17
  405. package/node_modules/zod/v4/classic/coerce.js +0 -17
  406. package/node_modules/zod/v4/classic/compat.cjs +0 -61
  407. package/node_modules/zod/v4/classic/compat.d.cts +0 -50
  408. package/node_modules/zod/v4/classic/compat.d.ts +0 -50
  409. package/node_modules/zod/v4/classic/compat.js +0 -31
  410. package/node_modules/zod/v4/classic/errors.cjs +0 -74
  411. package/node_modules/zod/v4/classic/errors.d.cts +0 -30
  412. package/node_modules/zod/v4/classic/errors.d.ts +0 -30
  413. package/node_modules/zod/v4/classic/errors.js +0 -48
  414. package/node_modules/zod/v4/classic/external.cjs +0 -73
  415. package/node_modules/zod/v4/classic/external.d.cts +0 -15
  416. package/node_modules/zod/v4/classic/external.d.ts +0 -15
  417. package/node_modules/zod/v4/classic/external.js +0 -20
  418. package/node_modules/zod/v4/classic/from-json-schema.cjs +0 -610
  419. package/node_modules/zod/v4/classic/from-json-schema.d.cts +0 -12
  420. package/node_modules/zod/v4/classic/from-json-schema.d.ts +0 -12
  421. package/node_modules/zod/v4/classic/from-json-schema.js +0 -584
  422. package/node_modules/zod/v4/classic/index.cjs +0 -33
  423. package/node_modules/zod/v4/classic/index.d.cts +0 -4
  424. package/node_modules/zod/v4/classic/index.d.ts +0 -4
  425. package/node_modules/zod/v4/classic/index.js +0 -4
  426. package/node_modules/zod/v4/classic/iso.cjs +0 -60
  427. package/node_modules/zod/v4/classic/iso.d.cts +0 -22
  428. package/node_modules/zod/v4/classic/iso.d.ts +0 -22
  429. package/node_modules/zod/v4/classic/iso.js +0 -30
  430. package/node_modules/zod/v4/classic/package.json +0 -6
  431. package/node_modules/zod/v4/classic/parse.cjs +0 -41
  432. package/node_modules/zod/v4/classic/parse.d.cts +0 -31
  433. package/node_modules/zod/v4/classic/parse.d.ts +0 -31
  434. package/node_modules/zod/v4/classic/parse.js +0 -15
  435. package/node_modules/zod/v4/classic/schemas.cjs +0 -1272
  436. package/node_modules/zod/v4/classic/schemas.d.cts +0 -739
  437. package/node_modules/zod/v4/classic/schemas.d.ts +0 -739
  438. package/node_modules/zod/v4/classic/schemas.js +0 -1157
  439. package/node_modules/zod/v4/core/api.cjs +0 -1222
  440. package/node_modules/zod/v4/core/api.d.cts +0 -304
  441. package/node_modules/zod/v4/core/api.d.ts +0 -304
  442. package/node_modules/zod/v4/core/api.js +0 -1082
  443. package/node_modules/zod/v4/core/checks.cjs +0 -601
  444. package/node_modules/zod/v4/core/checks.d.cts +0 -278
  445. package/node_modules/zod/v4/core/checks.d.ts +0 -278
  446. package/node_modules/zod/v4/core/checks.js +0 -575
  447. package/node_modules/zod/v4/core/core.cjs +0 -83
  448. package/node_modules/zod/v4/core/core.d.cts +0 -70
  449. package/node_modules/zod/v4/core/core.d.ts +0 -70
  450. package/node_modules/zod/v4/core/core.js +0 -76
  451. package/node_modules/zod/v4/core/doc.cjs +0 -39
  452. package/node_modules/zod/v4/core/doc.d.cts +0 -14
  453. package/node_modules/zod/v4/core/doc.d.ts +0 -14
  454. package/node_modules/zod/v4/core/doc.js +0 -35
  455. package/node_modules/zod/v4/core/errors.cjs +0 -213
  456. package/node_modules/zod/v4/core/errors.d.cts +0 -220
  457. package/node_modules/zod/v4/core/errors.d.ts +0 -220
  458. package/node_modules/zod/v4/core/errors.js +0 -182
  459. package/node_modules/zod/v4/core/index.cjs +0 -47
  460. package/node_modules/zod/v4/core/index.d.cts +0 -16
  461. package/node_modules/zod/v4/core/index.d.ts +0 -16
  462. package/node_modules/zod/v4/core/index.js +0 -16
  463. package/node_modules/zod/v4/core/json-schema-generator.cjs +0 -99
  464. package/node_modules/zod/v4/core/json-schema-generator.d.cts +0 -65
  465. package/node_modules/zod/v4/core/json-schema-generator.d.ts +0 -65
  466. package/node_modules/zod/v4/core/json-schema-generator.js +0 -95
  467. package/node_modules/zod/v4/core/json-schema-processors.cjs +0 -648
  468. package/node_modules/zod/v4/core/json-schema-processors.d.cts +0 -49
  469. package/node_modules/zod/v4/core/json-schema-processors.d.ts +0 -49
  470. package/node_modules/zod/v4/core/json-schema-processors.js +0 -605
  471. package/node_modules/zod/v4/core/json-schema.cjs +0 -2
  472. package/node_modules/zod/v4/core/json-schema.d.cts +0 -88
  473. package/node_modules/zod/v4/core/json-schema.d.ts +0 -88
  474. package/node_modules/zod/v4/core/json-schema.js +0 -1
  475. package/node_modules/zod/v4/core/package.json +0 -6
  476. package/node_modules/zod/v4/core/parse.cjs +0 -131
  477. package/node_modules/zod/v4/core/parse.d.cts +0 -49
  478. package/node_modules/zod/v4/core/parse.d.ts +0 -49
  479. package/node_modules/zod/v4/core/parse.js +0 -93
  480. package/node_modules/zod/v4/core/regexes.cjs +0 -166
  481. package/node_modules/zod/v4/core/regexes.d.cts +0 -79
  482. package/node_modules/zod/v4/core/regexes.d.ts +0 -79
  483. package/node_modules/zod/v4/core/regexes.js +0 -133
  484. package/node_modules/zod/v4/core/registries.cjs +0 -56
  485. package/node_modules/zod/v4/core/registries.d.cts +0 -35
  486. package/node_modules/zod/v4/core/registries.d.ts +0 -35
  487. package/node_modules/zod/v4/core/registries.js +0 -51
  488. package/node_modules/zod/v4/core/schemas.cjs +0 -2126
  489. package/node_modules/zod/v4/core/schemas.d.cts +0 -1146
  490. package/node_modules/zod/v4/core/schemas.d.ts +0 -1146
  491. package/node_modules/zod/v4/core/schemas.js +0 -2095
  492. package/node_modules/zod/v4/core/standard-schema.cjs +0 -2
  493. package/node_modules/zod/v4/core/standard-schema.d.cts +0 -126
  494. package/node_modules/zod/v4/core/standard-schema.d.ts +0 -126
  495. package/node_modules/zod/v4/core/standard-schema.js +0 -1
  496. package/node_modules/zod/v4/core/to-json-schema.cjs +0 -446
  497. package/node_modules/zod/v4/core/to-json-schema.d.cts +0 -114
  498. package/node_modules/zod/v4/core/to-json-schema.d.ts +0 -114
  499. package/node_modules/zod/v4/core/to-json-schema.js +0 -437
  500. package/node_modules/zod/v4/core/util.cjs +0 -710
  501. package/node_modules/zod/v4/core/util.d.cts +0 -199
  502. package/node_modules/zod/v4/core/util.d.ts +0 -199
  503. package/node_modules/zod/v4/core/util.js +0 -651
  504. package/node_modules/zod/v4/core/versions.cjs +0 -8
  505. package/node_modules/zod/v4/core/versions.d.cts +0 -5
  506. package/node_modules/zod/v4/core/versions.d.ts +0 -5
  507. package/node_modules/zod/v4/core/versions.js +0 -5
  508. package/node_modules/zod/v4/index.cjs +0 -22
  509. package/node_modules/zod/v4/index.d.cts +0 -3
  510. package/node_modules/zod/v4/index.d.ts +0 -3
  511. package/node_modules/zod/v4/index.js +0 -3
  512. package/node_modules/zod/v4/locales/ar.cjs +0 -133
  513. package/node_modules/zod/v4/locales/ar.d.cts +0 -5
  514. package/node_modules/zod/v4/locales/ar.d.ts +0 -4
  515. package/node_modules/zod/v4/locales/ar.js +0 -106
  516. package/node_modules/zod/v4/locales/az.cjs +0 -132
  517. package/node_modules/zod/v4/locales/az.d.cts +0 -5
  518. package/node_modules/zod/v4/locales/az.d.ts +0 -4
  519. package/node_modules/zod/v4/locales/az.js +0 -105
  520. package/node_modules/zod/v4/locales/be.cjs +0 -183
  521. package/node_modules/zod/v4/locales/be.d.cts +0 -5
  522. package/node_modules/zod/v4/locales/be.d.ts +0 -4
  523. package/node_modules/zod/v4/locales/be.js +0 -156
  524. package/node_modules/zod/v4/locales/bg.cjs +0 -147
  525. package/node_modules/zod/v4/locales/bg.d.cts +0 -5
  526. package/node_modules/zod/v4/locales/bg.d.ts +0 -4
  527. package/node_modules/zod/v4/locales/bg.js +0 -120
  528. package/node_modules/zod/v4/locales/ca.cjs +0 -134
  529. package/node_modules/zod/v4/locales/ca.d.cts +0 -5
  530. package/node_modules/zod/v4/locales/ca.d.ts +0 -4
  531. package/node_modules/zod/v4/locales/ca.js +0 -107
  532. package/node_modules/zod/v4/locales/cs.cjs +0 -138
  533. package/node_modules/zod/v4/locales/cs.d.cts +0 -5
  534. package/node_modules/zod/v4/locales/cs.d.ts +0 -4
  535. package/node_modules/zod/v4/locales/cs.js +0 -111
  536. package/node_modules/zod/v4/locales/da.cjs +0 -142
  537. package/node_modules/zod/v4/locales/da.d.cts +0 -5
  538. package/node_modules/zod/v4/locales/da.d.ts +0 -4
  539. package/node_modules/zod/v4/locales/da.js +0 -115
  540. package/node_modules/zod/v4/locales/de.cjs +0 -135
  541. package/node_modules/zod/v4/locales/de.d.cts +0 -5
  542. package/node_modules/zod/v4/locales/de.d.ts +0 -4
  543. package/node_modules/zod/v4/locales/de.js +0 -108
  544. package/node_modules/zod/v4/locales/en.cjs +0 -136
  545. package/node_modules/zod/v4/locales/en.d.cts +0 -5
  546. package/node_modules/zod/v4/locales/en.d.ts +0 -4
  547. package/node_modules/zod/v4/locales/en.js +0 -109
  548. package/node_modules/zod/v4/locales/eo.cjs +0 -136
  549. package/node_modules/zod/v4/locales/eo.d.cts +0 -5
  550. package/node_modules/zod/v4/locales/eo.d.ts +0 -4
  551. package/node_modules/zod/v4/locales/eo.js +0 -109
  552. package/node_modules/zod/v4/locales/es.cjs +0 -159
  553. package/node_modules/zod/v4/locales/es.d.cts +0 -5
  554. package/node_modules/zod/v4/locales/es.d.ts +0 -4
  555. package/node_modules/zod/v4/locales/es.js +0 -132
  556. package/node_modules/zod/v4/locales/fa.cjs +0 -141
  557. package/node_modules/zod/v4/locales/fa.d.cts +0 -5
  558. package/node_modules/zod/v4/locales/fa.d.ts +0 -4
  559. package/node_modules/zod/v4/locales/fa.js +0 -114
  560. package/node_modules/zod/v4/locales/fi.cjs +0 -139
  561. package/node_modules/zod/v4/locales/fi.d.cts +0 -5
  562. package/node_modules/zod/v4/locales/fi.d.ts +0 -4
  563. package/node_modules/zod/v4/locales/fi.js +0 -112
  564. package/node_modules/zod/v4/locales/fr-CA.cjs +0 -134
  565. package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -5
  566. package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
  567. package/node_modules/zod/v4/locales/fr-CA.js +0 -107
  568. package/node_modules/zod/v4/locales/fr.cjs +0 -135
  569. package/node_modules/zod/v4/locales/fr.d.cts +0 -5
  570. package/node_modules/zod/v4/locales/fr.d.ts +0 -4
  571. package/node_modules/zod/v4/locales/fr.js +0 -108
  572. package/node_modules/zod/v4/locales/he.cjs +0 -241
  573. package/node_modules/zod/v4/locales/he.d.cts +0 -5
  574. package/node_modules/zod/v4/locales/he.d.ts +0 -4
  575. package/node_modules/zod/v4/locales/he.js +0 -214
  576. package/node_modules/zod/v4/locales/hu.cjs +0 -135
  577. package/node_modules/zod/v4/locales/hu.d.cts +0 -5
  578. package/node_modules/zod/v4/locales/hu.d.ts +0 -4
  579. package/node_modules/zod/v4/locales/hu.js +0 -108
  580. package/node_modules/zod/v4/locales/hy.cjs +0 -174
  581. package/node_modules/zod/v4/locales/hy.d.cts +0 -5
  582. package/node_modules/zod/v4/locales/hy.d.ts +0 -4
  583. package/node_modules/zod/v4/locales/hy.js +0 -147
  584. package/node_modules/zod/v4/locales/id.cjs +0 -133
  585. package/node_modules/zod/v4/locales/id.d.cts +0 -5
  586. package/node_modules/zod/v4/locales/id.d.ts +0 -4
  587. package/node_modules/zod/v4/locales/id.js +0 -106
  588. package/node_modules/zod/v4/locales/index.cjs +0 -104
  589. package/node_modules/zod/v4/locales/index.d.cts +0 -49
  590. package/node_modules/zod/v4/locales/index.d.ts +0 -49
  591. package/node_modules/zod/v4/locales/index.js +0 -49
  592. package/node_modules/zod/v4/locales/is.cjs +0 -136
  593. package/node_modules/zod/v4/locales/is.d.cts +0 -5
  594. package/node_modules/zod/v4/locales/is.d.ts +0 -4
  595. package/node_modules/zod/v4/locales/is.js +0 -109
  596. package/node_modules/zod/v4/locales/it.cjs +0 -135
  597. package/node_modules/zod/v4/locales/it.d.cts +0 -5
  598. package/node_modules/zod/v4/locales/it.d.ts +0 -4
  599. package/node_modules/zod/v4/locales/it.js +0 -108
  600. package/node_modules/zod/v4/locales/ja.cjs +0 -134
  601. package/node_modules/zod/v4/locales/ja.d.cts +0 -5
  602. package/node_modules/zod/v4/locales/ja.d.ts +0 -4
  603. package/node_modules/zod/v4/locales/ja.js +0 -107
  604. package/node_modules/zod/v4/locales/ka.cjs +0 -139
  605. package/node_modules/zod/v4/locales/ka.d.cts +0 -5
  606. package/node_modules/zod/v4/locales/ka.d.ts +0 -4
  607. package/node_modules/zod/v4/locales/ka.js +0 -112
  608. package/node_modules/zod/v4/locales/kh.cjs +0 -12
  609. package/node_modules/zod/v4/locales/kh.d.cts +0 -5
  610. package/node_modules/zod/v4/locales/kh.d.ts +0 -5
  611. package/node_modules/zod/v4/locales/kh.js +0 -5
  612. package/node_modules/zod/v4/locales/km.cjs +0 -137
  613. package/node_modules/zod/v4/locales/km.d.cts +0 -5
  614. package/node_modules/zod/v4/locales/km.d.ts +0 -4
  615. package/node_modules/zod/v4/locales/km.js +0 -110
  616. package/node_modules/zod/v4/locales/ko.cjs +0 -138
  617. package/node_modules/zod/v4/locales/ko.d.cts +0 -5
  618. package/node_modules/zod/v4/locales/ko.d.ts +0 -4
  619. package/node_modules/zod/v4/locales/ko.js +0 -111
  620. package/node_modules/zod/v4/locales/lt.cjs +0 -230
  621. package/node_modules/zod/v4/locales/lt.d.cts +0 -5
  622. package/node_modules/zod/v4/locales/lt.d.ts +0 -4
  623. package/node_modules/zod/v4/locales/lt.js +0 -203
  624. package/node_modules/zod/v4/locales/mk.cjs +0 -136
  625. package/node_modules/zod/v4/locales/mk.d.cts +0 -5
  626. package/node_modules/zod/v4/locales/mk.d.ts +0 -4
  627. package/node_modules/zod/v4/locales/mk.js +0 -109
  628. package/node_modules/zod/v4/locales/ms.cjs +0 -134
  629. package/node_modules/zod/v4/locales/ms.d.cts +0 -5
  630. package/node_modules/zod/v4/locales/ms.d.ts +0 -4
  631. package/node_modules/zod/v4/locales/ms.js +0 -107
  632. package/node_modules/zod/v4/locales/nl.cjs +0 -137
  633. package/node_modules/zod/v4/locales/nl.d.cts +0 -5
  634. package/node_modules/zod/v4/locales/nl.d.ts +0 -4
  635. package/node_modules/zod/v4/locales/nl.js +0 -110
  636. package/node_modules/zod/v4/locales/no.cjs +0 -135
  637. package/node_modules/zod/v4/locales/no.d.cts +0 -5
  638. package/node_modules/zod/v4/locales/no.d.ts +0 -4
  639. package/node_modules/zod/v4/locales/no.js +0 -108
  640. package/node_modules/zod/v4/locales/ota.cjs +0 -136
  641. package/node_modules/zod/v4/locales/ota.d.cts +0 -5
  642. package/node_modules/zod/v4/locales/ota.d.ts +0 -4
  643. package/node_modules/zod/v4/locales/ota.js +0 -109
  644. package/node_modules/zod/v4/locales/package.json +0 -6
  645. package/node_modules/zod/v4/locales/pl.cjs +0 -136
  646. package/node_modules/zod/v4/locales/pl.d.cts +0 -5
  647. package/node_modules/zod/v4/locales/pl.d.ts +0 -4
  648. package/node_modules/zod/v4/locales/pl.js +0 -109
  649. package/node_modules/zod/v4/locales/ps.cjs +0 -141
  650. package/node_modules/zod/v4/locales/ps.d.cts +0 -5
  651. package/node_modules/zod/v4/locales/ps.d.ts +0 -4
  652. package/node_modules/zod/v4/locales/ps.js +0 -114
  653. package/node_modules/zod/v4/locales/pt.cjs +0 -135
  654. package/node_modules/zod/v4/locales/pt.d.cts +0 -5
  655. package/node_modules/zod/v4/locales/pt.d.ts +0 -4
  656. package/node_modules/zod/v4/locales/pt.js +0 -108
  657. package/node_modules/zod/v4/locales/ru.cjs +0 -183
  658. package/node_modules/zod/v4/locales/ru.d.cts +0 -5
  659. package/node_modules/zod/v4/locales/ru.d.ts +0 -4
  660. package/node_modules/zod/v4/locales/ru.js +0 -156
  661. package/node_modules/zod/v4/locales/sl.cjs +0 -136
  662. package/node_modules/zod/v4/locales/sl.d.cts +0 -5
  663. package/node_modules/zod/v4/locales/sl.d.ts +0 -4
  664. package/node_modules/zod/v4/locales/sl.js +0 -109
  665. package/node_modules/zod/v4/locales/sv.cjs +0 -137
  666. package/node_modules/zod/v4/locales/sv.d.cts +0 -5
  667. package/node_modules/zod/v4/locales/sv.d.ts +0 -4
  668. package/node_modules/zod/v4/locales/sv.js +0 -110
  669. package/node_modules/zod/v4/locales/ta.cjs +0 -137
  670. package/node_modules/zod/v4/locales/ta.d.cts +0 -5
  671. package/node_modules/zod/v4/locales/ta.d.ts +0 -4
  672. package/node_modules/zod/v4/locales/ta.js +0 -110
  673. package/node_modules/zod/v4/locales/th.cjs +0 -137
  674. package/node_modules/zod/v4/locales/th.d.cts +0 -5
  675. package/node_modules/zod/v4/locales/th.d.ts +0 -4
  676. package/node_modules/zod/v4/locales/th.js +0 -110
  677. package/node_modules/zod/v4/locales/tr.cjs +0 -132
  678. package/node_modules/zod/v4/locales/tr.d.cts +0 -5
  679. package/node_modules/zod/v4/locales/tr.d.ts +0 -4
  680. package/node_modules/zod/v4/locales/tr.js +0 -105
  681. package/node_modules/zod/v4/locales/ua.cjs +0 -12
  682. package/node_modules/zod/v4/locales/ua.d.cts +0 -5
  683. package/node_modules/zod/v4/locales/ua.d.ts +0 -5
  684. package/node_modules/zod/v4/locales/ua.js +0 -5
  685. package/node_modules/zod/v4/locales/uk.cjs +0 -135
  686. package/node_modules/zod/v4/locales/uk.d.cts +0 -5
  687. package/node_modules/zod/v4/locales/uk.d.ts +0 -4
  688. package/node_modules/zod/v4/locales/uk.js +0 -108
  689. package/node_modules/zod/v4/locales/ur.cjs +0 -137
  690. package/node_modules/zod/v4/locales/ur.d.cts +0 -5
  691. package/node_modules/zod/v4/locales/ur.d.ts +0 -4
  692. package/node_modules/zod/v4/locales/ur.js +0 -110
  693. package/node_modules/zod/v4/locales/uz.cjs +0 -136
  694. package/node_modules/zod/v4/locales/uz.d.cts +0 -5
  695. package/node_modules/zod/v4/locales/uz.d.ts +0 -4
  696. package/node_modules/zod/v4/locales/uz.js +0 -109
  697. package/node_modules/zod/v4/locales/vi.cjs +0 -135
  698. package/node_modules/zod/v4/locales/vi.d.cts +0 -5
  699. package/node_modules/zod/v4/locales/vi.d.ts +0 -4
  700. package/node_modules/zod/v4/locales/vi.js +0 -108
  701. package/node_modules/zod/v4/locales/yo.cjs +0 -134
  702. package/node_modules/zod/v4/locales/yo.d.cts +0 -5
  703. package/node_modules/zod/v4/locales/yo.d.ts +0 -4
  704. package/node_modules/zod/v4/locales/yo.js +0 -107
  705. package/node_modules/zod/v4/locales/zh-CN.cjs +0 -136
  706. package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -5
  707. package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
  708. package/node_modules/zod/v4/locales/zh-CN.js +0 -109
  709. package/node_modules/zod/v4/locales/zh-TW.cjs +0 -134
  710. package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -5
  711. package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
  712. package/node_modules/zod/v4/locales/zh-TW.js +0 -107
  713. package/node_modules/zod/v4/mini/checks.cjs +0 -34
  714. package/node_modules/zod/v4/mini/checks.d.cts +0 -1
  715. package/node_modules/zod/v4/mini/checks.d.ts +0 -1
  716. package/node_modules/zod/v4/mini/checks.js +0 -1
  717. package/node_modules/zod/v4/mini/coerce.cjs +0 -52
  718. package/node_modules/zod/v4/mini/coerce.d.cts +0 -7
  719. package/node_modules/zod/v4/mini/coerce.d.ts +0 -7
  720. package/node_modules/zod/v4/mini/coerce.js +0 -22
  721. package/node_modules/zod/v4/mini/external.cjs +0 -63
  722. package/node_modules/zod/v4/mini/external.d.cts +0 -12
  723. package/node_modules/zod/v4/mini/external.d.ts +0 -12
  724. package/node_modules/zod/v4/mini/external.js +0 -14
  725. package/node_modules/zod/v4/mini/index.cjs +0 -32
  726. package/node_modules/zod/v4/mini/index.d.cts +0 -3
  727. package/node_modules/zod/v4/mini/index.d.ts +0 -3
  728. package/node_modules/zod/v4/mini/index.js +0 -3
  729. package/node_modules/zod/v4/mini/iso.cjs +0 -64
  730. package/node_modules/zod/v4/mini/iso.d.cts +0 -22
  731. package/node_modules/zod/v4/mini/iso.d.ts +0 -22
  732. package/node_modules/zod/v4/mini/iso.js +0 -34
  733. package/node_modules/zod/v4/mini/package.json +0 -6
  734. package/node_modules/zod/v4/mini/parse.cjs +0 -16
  735. package/node_modules/zod/v4/mini/parse.d.cts +0 -1
  736. package/node_modules/zod/v4/mini/parse.d.ts +0 -1
  737. package/node_modules/zod/v4/mini/parse.js +0 -1
  738. package/node_modules/zod/v4/mini/schemas.cjs +0 -1046
  739. package/node_modules/zod/v4/mini/schemas.d.cts +0 -427
  740. package/node_modules/zod/v4/mini/schemas.d.ts +0 -427
  741. package/node_modules/zod/v4/mini/schemas.js +0 -925
  742. package/node_modules/zod/v4/package.json +0 -6
  743. package/node_modules/zod/v4-mini/index.cjs +0 -17
  744. package/node_modules/zod/v4-mini/index.d.cts +0 -1
  745. package/node_modules/zod/v4-mini/index.d.ts +0 -1
  746. package/node_modules/zod/v4-mini/index.js +0 -1
  747. package/node_modules/zod/v4-mini/package.json +0 -6
@@ -1,2095 +0,0 @@
1
- import * as checks from "./checks.js";
2
- import * as core from "./core.js";
3
- import { Doc } from "./doc.js";
4
- import { parse, parseAsync, 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
- for (const ch of checks) {
20
- for (const fn of ch._zod.onattach) {
21
- fn(inst);
22
- }
23
- }
24
- if (checks.length === 0) {
25
- // deferred initializer
26
- // inst._zod.parse is not yet defined
27
- (_a = inst._zod).deferred ?? (_a.deferred = []);
28
- inst._zod.deferred?.push(() => {
29
- inst._zod.run = inst._zod.parse;
30
- });
31
- }
32
- else {
33
- const runChecks = (payload, checks, ctx) => {
34
- let isAborted = util.aborted(payload);
35
- let asyncResult;
36
- for (const ch of checks) {
37
- if (ch._zod.def.when) {
38
- const shouldRun = ch._zod.def.when(payload);
39
- if (!shouldRun)
40
- continue;
41
- }
42
- else if (isAborted) {
43
- continue;
44
- }
45
- const currLen = payload.issues.length;
46
- const _ = ch._zod.check(payload);
47
- if (_ instanceof Promise && ctx?.async === false) {
48
- throw new core.$ZodAsyncError();
49
- }
50
- if (asyncResult || _ instanceof Promise) {
51
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
52
- await _;
53
- const nextLen = payload.issues.length;
54
- if (nextLen === currLen)
55
- return;
56
- if (!isAborted)
57
- isAborted = util.aborted(payload, currLen);
58
- });
59
- }
60
- else {
61
- const nextLen = payload.issues.length;
62
- if (nextLen === currLen)
63
- continue;
64
- if (!isAborted)
65
- isAborted = util.aborted(payload, currLen);
66
- }
67
- }
68
- if (asyncResult) {
69
- return asyncResult.then(() => {
70
- return payload;
71
- });
72
- }
73
- return payload;
74
- };
75
- const handleCanaryResult = (canary, payload, ctx) => {
76
- // abort if the canary is aborted
77
- if (util.aborted(canary)) {
78
- canary.aborted = true;
79
- return canary;
80
- }
81
- // run checks first, then
82
- const checkResult = runChecks(payload, checks, ctx);
83
- if (checkResult instanceof Promise) {
84
- if (ctx.async === false)
85
- throw new core.$ZodAsyncError();
86
- return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
87
- }
88
- return inst._zod.parse(checkResult, ctx);
89
- };
90
- inst._zod.run = (payload, ctx) => {
91
- if (ctx.skipChecks) {
92
- return inst._zod.parse(payload, ctx);
93
- }
94
- if (ctx.direction === "backward") {
95
- // run canary
96
- // initial pass (no checks)
97
- const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
98
- if (canary instanceof Promise) {
99
- return canary.then((canary) => {
100
- return handleCanaryResult(canary, payload, ctx);
101
- });
102
- }
103
- return handleCanaryResult(canary, payload, ctx);
104
- }
105
- // forward
106
- const result = inst._zod.parse(payload, ctx);
107
- if (result instanceof Promise) {
108
- if (ctx.async === false)
109
- throw new core.$ZodAsyncError();
110
- return result.then((result) => runChecks(result, checks, ctx));
111
- }
112
- return runChecks(result, checks, ctx);
113
- };
114
- }
115
- // Lazy initialize ~standard to avoid creating objects for every schema
116
- util.defineLazy(inst, "~standard", () => ({
117
- validate: (value) => {
118
- try {
119
- const r = safeParse(inst, value);
120
- return r.success ? { value: r.data } : { issues: r.error?.issues };
121
- }
122
- catch (_) {
123
- return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
124
- }
125
- },
126
- vendor: "zod",
127
- version: 1,
128
- }));
129
- });
130
- export { clone } from "./util.js";
131
- export const $ZodString = /*@__PURE__*/ core.$constructor("$ZodString", (inst, def) => {
132
- $ZodType.init(inst, def);
133
- inst._zod.pattern = [...(inst?._zod.bag?.patterns ?? [])].pop() ?? regexes.string(inst._zod.bag);
134
- inst._zod.parse = (payload, _) => {
135
- if (def.coerce)
136
- try {
137
- payload.value = String(payload.value);
138
- }
139
- catch (_) { }
140
- if (typeof payload.value === "string")
141
- return payload;
142
- payload.issues.push({
143
- expected: "string",
144
- code: "invalid_type",
145
- input: payload.value,
146
- inst,
147
- });
148
- return payload;
149
- };
150
- });
151
- export const $ZodStringFormat = /*@__PURE__*/ core.$constructor("$ZodStringFormat", (inst, def) => {
152
- // check initialization must come first
153
- checks.$ZodCheckStringFormat.init(inst, def);
154
- $ZodString.init(inst, def);
155
- });
156
- export const $ZodGUID = /*@__PURE__*/ core.$constructor("$ZodGUID", (inst, def) => {
157
- def.pattern ?? (def.pattern = regexes.guid);
158
- $ZodStringFormat.init(inst, def);
159
- });
160
- export const $ZodUUID = /*@__PURE__*/ core.$constructor("$ZodUUID", (inst, def) => {
161
- if (def.version) {
162
- const versionMap = {
163
- v1: 1,
164
- v2: 2,
165
- v3: 3,
166
- v4: 4,
167
- v5: 5,
168
- v6: 6,
169
- v7: 7,
170
- v8: 8,
171
- };
172
- const v = versionMap[def.version];
173
- if (v === undefined)
174
- throw new Error(`Invalid UUID version: "${def.version}"`);
175
- def.pattern ?? (def.pattern = regexes.uuid(v));
176
- }
177
- else
178
- def.pattern ?? (def.pattern = regexes.uuid());
179
- $ZodStringFormat.init(inst, def);
180
- });
181
- export const $ZodEmail = /*@__PURE__*/ core.$constructor("$ZodEmail", (inst, def) => {
182
- def.pattern ?? (def.pattern = regexes.email);
183
- $ZodStringFormat.init(inst, def);
184
- });
185
- export const $ZodURL = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) => {
186
- $ZodStringFormat.init(inst, def);
187
- inst._zod.check = (payload) => {
188
- try {
189
- // Trim whitespace from input
190
- const trimmed = payload.value.trim();
191
- // @ts-ignore
192
- const url = new URL(trimmed);
193
- if (def.hostname) {
194
- def.hostname.lastIndex = 0;
195
- if (!def.hostname.test(url.hostname)) {
196
- payload.issues.push({
197
- code: "invalid_format",
198
- format: "url",
199
- note: "Invalid hostname",
200
- pattern: def.hostname.source,
201
- input: payload.value,
202
- inst,
203
- continue: !def.abort,
204
- });
205
- }
206
- }
207
- if (def.protocol) {
208
- def.protocol.lastIndex = 0;
209
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
210
- payload.issues.push({
211
- code: "invalid_format",
212
- format: "url",
213
- note: "Invalid protocol",
214
- pattern: def.protocol.source,
215
- input: payload.value,
216
- inst,
217
- continue: !def.abort,
218
- });
219
- }
220
- }
221
- // Set the output value based on normalize flag
222
- if (def.normalize) {
223
- // Use normalized URL
224
- payload.value = url.href;
225
- }
226
- else {
227
- // Preserve the original input (trimmed)
228
- payload.value = trimmed;
229
- }
230
- return;
231
- }
232
- catch (_) {
233
- payload.issues.push({
234
- code: "invalid_format",
235
- format: "url",
236
- input: payload.value,
237
- inst,
238
- continue: !def.abort,
239
- });
240
- }
241
- };
242
- });
243
- export const $ZodEmoji = /*@__PURE__*/ core.$constructor("$ZodEmoji", (inst, def) => {
244
- def.pattern ?? (def.pattern = regexes.emoji());
245
- $ZodStringFormat.init(inst, def);
246
- });
247
- export const $ZodNanoID = /*@__PURE__*/ core.$constructor("$ZodNanoID", (inst, def) => {
248
- def.pattern ?? (def.pattern = regexes.nanoid);
249
- $ZodStringFormat.init(inst, def);
250
- });
251
- export const $ZodCUID = /*@__PURE__*/ core.$constructor("$ZodCUID", (inst, def) => {
252
- def.pattern ?? (def.pattern = regexes.cuid);
253
- $ZodStringFormat.init(inst, def);
254
- });
255
- export const $ZodCUID2 = /*@__PURE__*/ core.$constructor("$ZodCUID2", (inst, def) => {
256
- def.pattern ?? (def.pattern = regexes.cuid2);
257
- $ZodStringFormat.init(inst, def);
258
- });
259
- export const $ZodULID = /*@__PURE__*/ core.$constructor("$ZodULID", (inst, def) => {
260
- def.pattern ?? (def.pattern = regexes.ulid);
261
- $ZodStringFormat.init(inst, def);
262
- });
263
- export const $ZodXID = /*@__PURE__*/ core.$constructor("$ZodXID", (inst, def) => {
264
- def.pattern ?? (def.pattern = regexes.xid);
265
- $ZodStringFormat.init(inst, def);
266
- });
267
- export const $ZodKSUID = /*@__PURE__*/ core.$constructor("$ZodKSUID", (inst, def) => {
268
- def.pattern ?? (def.pattern = regexes.ksuid);
269
- $ZodStringFormat.init(inst, def);
270
- });
271
- export const $ZodISODateTime = /*@__PURE__*/ core.$constructor("$ZodISODateTime", (inst, def) => {
272
- def.pattern ?? (def.pattern = regexes.datetime(def));
273
- $ZodStringFormat.init(inst, def);
274
- });
275
- export const $ZodISODate = /*@__PURE__*/ core.$constructor("$ZodISODate", (inst, def) => {
276
- def.pattern ?? (def.pattern = regexes.date);
277
- $ZodStringFormat.init(inst, def);
278
- });
279
- export const $ZodISOTime = /*@__PURE__*/ core.$constructor("$ZodISOTime", (inst, def) => {
280
- def.pattern ?? (def.pattern = regexes.time(def));
281
- $ZodStringFormat.init(inst, def);
282
- });
283
- export const $ZodISODuration = /*@__PURE__*/ core.$constructor("$ZodISODuration", (inst, def) => {
284
- def.pattern ?? (def.pattern = regexes.duration);
285
- $ZodStringFormat.init(inst, def);
286
- });
287
- export const $ZodIPv4 = /*@__PURE__*/ core.$constructor("$ZodIPv4", (inst, def) => {
288
- def.pattern ?? (def.pattern = regexes.ipv4);
289
- $ZodStringFormat.init(inst, def);
290
- inst._zod.bag.format = `ipv4`;
291
- });
292
- export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def) => {
293
- def.pattern ?? (def.pattern = regexes.ipv6);
294
- $ZodStringFormat.init(inst, def);
295
- inst._zod.bag.format = `ipv6`;
296
- inst._zod.check = (payload) => {
297
- try {
298
- // @ts-ignore
299
- new URL(`http://[${payload.value}]`);
300
- // return;
301
- }
302
- catch {
303
- payload.issues.push({
304
- code: "invalid_format",
305
- format: "ipv6",
306
- input: payload.value,
307
- inst,
308
- continue: !def.abort,
309
- });
310
- }
311
- };
312
- });
313
- export const $ZodMAC = /*@__PURE__*/ core.$constructor("$ZodMAC", (inst, def) => {
314
- def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
315
- $ZodStringFormat.init(inst, def);
316
- inst._zod.bag.format = `mac`;
317
- });
318
- export const $ZodCIDRv4 = /*@__PURE__*/ core.$constructor("$ZodCIDRv4", (inst, def) => {
319
- def.pattern ?? (def.pattern = regexes.cidrv4);
320
- $ZodStringFormat.init(inst, def);
321
- });
322
- export const $ZodCIDRv6 = /*@__PURE__*/ core.$constructor("$ZodCIDRv6", (inst, def) => {
323
- def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation
324
- $ZodStringFormat.init(inst, def);
325
- inst._zod.check = (payload) => {
326
- const parts = payload.value.split("/");
327
- try {
328
- if (parts.length !== 2)
329
- throw new Error();
330
- const [address, prefix] = parts;
331
- if (!prefix)
332
- throw new Error();
333
- const prefixNum = Number(prefix);
334
- if (`${prefixNum}` !== prefix)
335
- throw new Error();
336
- if (prefixNum < 0 || prefixNum > 128)
337
- throw new Error();
338
- // @ts-ignore
339
- new URL(`http://[${address}]`);
340
- }
341
- catch {
342
- payload.issues.push({
343
- code: "invalid_format",
344
- format: "cidrv6",
345
- input: payload.value,
346
- inst,
347
- continue: !def.abort,
348
- });
349
- }
350
- };
351
- });
352
- ////////////////////////////// ZodBase64 //////////////////////////////
353
- export function isValidBase64(data) {
354
- if (data === "")
355
- return true;
356
- if (data.length % 4 !== 0)
357
- return false;
358
- try {
359
- // @ts-ignore
360
- atob(data);
361
- return true;
362
- }
363
- catch {
364
- return false;
365
- }
366
- }
367
- export const $ZodBase64 = /*@__PURE__*/ core.$constructor("$ZodBase64", (inst, def) => {
368
- def.pattern ?? (def.pattern = regexes.base64);
369
- $ZodStringFormat.init(inst, def);
370
- inst._zod.bag.contentEncoding = "base64";
371
- inst._zod.check = (payload) => {
372
- if (isValidBase64(payload.value))
373
- return;
374
- payload.issues.push({
375
- code: "invalid_format",
376
- format: "base64",
377
- input: payload.value,
378
- inst,
379
- continue: !def.abort,
380
- });
381
- };
382
- });
383
- ////////////////////////////// ZodBase64 //////////////////////////////
384
- export function isValidBase64URL(data) {
385
- if (!regexes.base64url.test(data))
386
- return false;
387
- const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
388
- const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
389
- return isValidBase64(padded);
390
- }
391
- export const $ZodBase64URL = /*@__PURE__*/ core.$constructor("$ZodBase64URL", (inst, def) => {
392
- def.pattern ?? (def.pattern = regexes.base64url);
393
- $ZodStringFormat.init(inst, def);
394
- inst._zod.bag.contentEncoding = "base64url";
395
- inst._zod.check = (payload) => {
396
- if (isValidBase64URL(payload.value))
397
- return;
398
- payload.issues.push({
399
- code: "invalid_format",
400
- format: "base64url",
401
- input: payload.value,
402
- inst,
403
- continue: !def.abort,
404
- });
405
- };
406
- });
407
- export const $ZodE164 = /*@__PURE__*/ core.$constructor("$ZodE164", (inst, def) => {
408
- def.pattern ?? (def.pattern = regexes.e164);
409
- $ZodStringFormat.init(inst, def);
410
- });
411
- ////////////////////////////// ZodJWT //////////////////////////////
412
- export function isValidJWT(token, algorithm = null) {
413
- try {
414
- const tokensParts = token.split(".");
415
- if (tokensParts.length !== 3)
416
- return false;
417
- const [header] = tokensParts;
418
- if (!header)
419
- return false;
420
- // @ts-ignore
421
- const parsedHeader = JSON.parse(atob(header));
422
- if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
423
- return false;
424
- if (!parsedHeader.alg)
425
- return false;
426
- if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
427
- return false;
428
- return true;
429
- }
430
- catch {
431
- return false;
432
- }
433
- }
434
- export const $ZodJWT = /*@__PURE__*/ core.$constructor("$ZodJWT", (inst, def) => {
435
- $ZodStringFormat.init(inst, def);
436
- inst._zod.check = (payload) => {
437
- if (isValidJWT(payload.value, def.alg))
438
- return;
439
- payload.issues.push({
440
- code: "invalid_format",
441
- format: "jwt",
442
- input: payload.value,
443
- inst,
444
- continue: !def.abort,
445
- });
446
- };
447
- });
448
- export const $ZodCustomStringFormat = /*@__PURE__*/ core.$constructor("$ZodCustomStringFormat", (inst, def) => {
449
- $ZodStringFormat.init(inst, def);
450
- inst._zod.check = (payload) => {
451
- if (def.fn(payload.value))
452
- return;
453
- payload.issues.push({
454
- code: "invalid_format",
455
- format: def.format,
456
- input: payload.value,
457
- inst,
458
- continue: !def.abort,
459
- });
460
- };
461
- });
462
- export const $ZodNumber = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, def) => {
463
- $ZodType.init(inst, def);
464
- inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;
465
- inst._zod.parse = (payload, _ctx) => {
466
- if (def.coerce)
467
- try {
468
- payload.value = Number(payload.value);
469
- }
470
- catch (_) { }
471
- const input = payload.value;
472
- if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
473
- return payload;
474
- }
475
- const received = typeof input === "number"
476
- ? Number.isNaN(input)
477
- ? "NaN"
478
- : !Number.isFinite(input)
479
- ? "Infinity"
480
- : undefined
481
- : undefined;
482
- payload.issues.push({
483
- expected: "number",
484
- code: "invalid_type",
485
- input,
486
- inst,
487
- ...(received ? { received } : {}),
488
- });
489
- return payload;
490
- };
491
- });
492
- export const $ZodNumberFormat = /*@__PURE__*/ core.$constructor("$ZodNumberFormat", (inst, def) => {
493
- checks.$ZodCheckNumberFormat.init(inst, def);
494
- $ZodNumber.init(inst, def); // no format checks
495
- });
496
- export const $ZodBoolean = /*@__PURE__*/ core.$constructor("$ZodBoolean", (inst, def) => {
497
- $ZodType.init(inst, def);
498
- inst._zod.pattern = regexes.boolean;
499
- inst._zod.parse = (payload, _ctx) => {
500
- if (def.coerce)
501
- try {
502
- payload.value = Boolean(payload.value);
503
- }
504
- catch (_) { }
505
- const input = payload.value;
506
- if (typeof input === "boolean")
507
- return payload;
508
- payload.issues.push({
509
- expected: "boolean",
510
- code: "invalid_type",
511
- input,
512
- inst,
513
- });
514
- return payload;
515
- };
516
- });
517
- export const $ZodBigInt = /*@__PURE__*/ core.$constructor("$ZodBigInt", (inst, def) => {
518
- $ZodType.init(inst, def);
519
- inst._zod.pattern = regexes.bigint;
520
- inst._zod.parse = (payload, _ctx) => {
521
- if (def.coerce)
522
- try {
523
- payload.value = BigInt(payload.value);
524
- }
525
- catch (_) { }
526
- if (typeof payload.value === "bigint")
527
- return payload;
528
- payload.issues.push({
529
- expected: "bigint",
530
- code: "invalid_type",
531
- input: payload.value,
532
- inst,
533
- });
534
- return payload;
535
- };
536
- });
537
- export const $ZodBigIntFormat = /*@__PURE__*/ core.$constructor("$ZodBigIntFormat", (inst, def) => {
538
- checks.$ZodCheckBigIntFormat.init(inst, def);
539
- $ZodBigInt.init(inst, def); // no format checks
540
- });
541
- export const $ZodSymbol = /*@__PURE__*/ core.$constructor("$ZodSymbol", (inst, def) => {
542
- $ZodType.init(inst, def);
543
- inst._zod.parse = (payload, _ctx) => {
544
- const input = payload.value;
545
- if (typeof input === "symbol")
546
- return payload;
547
- payload.issues.push({
548
- expected: "symbol",
549
- code: "invalid_type",
550
- input,
551
- inst,
552
- });
553
- return payload;
554
- };
555
- });
556
- export const $ZodUndefined = /*@__PURE__*/ core.$constructor("$ZodUndefined", (inst, def) => {
557
- $ZodType.init(inst, def);
558
- inst._zod.pattern = regexes.undefined;
559
- inst._zod.values = new Set([undefined]);
560
- inst._zod.optin = "optional";
561
- inst._zod.optout = "optional";
562
- inst._zod.parse = (payload, _ctx) => {
563
- const input = payload.value;
564
- if (typeof input === "undefined")
565
- return payload;
566
- payload.issues.push({
567
- expected: "undefined",
568
- code: "invalid_type",
569
- input,
570
- inst,
571
- });
572
- return payload;
573
- };
574
- });
575
- export const $ZodNull = /*@__PURE__*/ core.$constructor("$ZodNull", (inst, def) => {
576
- $ZodType.init(inst, def);
577
- inst._zod.pattern = regexes.null;
578
- inst._zod.values = new Set([null]);
579
- inst._zod.parse = (payload, _ctx) => {
580
- const input = payload.value;
581
- if (input === null)
582
- return payload;
583
- payload.issues.push({
584
- expected: "null",
585
- code: "invalid_type",
586
- input,
587
- inst,
588
- });
589
- return payload;
590
- };
591
- });
592
- export const $ZodAny = /*@__PURE__*/ core.$constructor("$ZodAny", (inst, def) => {
593
- $ZodType.init(inst, def);
594
- inst._zod.parse = (payload) => payload;
595
- });
596
- export const $ZodUnknown = /*@__PURE__*/ core.$constructor("$ZodUnknown", (inst, def) => {
597
- $ZodType.init(inst, def);
598
- inst._zod.parse = (payload) => payload;
599
- });
600
- export const $ZodNever = /*@__PURE__*/ core.$constructor("$ZodNever", (inst, def) => {
601
- $ZodType.init(inst, def);
602
- inst._zod.parse = (payload, _ctx) => {
603
- payload.issues.push({
604
- expected: "never",
605
- code: "invalid_type",
606
- input: payload.value,
607
- inst,
608
- });
609
- return payload;
610
- };
611
- });
612
- export const $ZodVoid = /*@__PURE__*/ core.$constructor("$ZodVoid", (inst, def) => {
613
- $ZodType.init(inst, def);
614
- inst._zod.parse = (payload, _ctx) => {
615
- const input = payload.value;
616
- if (typeof input === "undefined")
617
- return payload;
618
- payload.issues.push({
619
- expected: "void",
620
- code: "invalid_type",
621
- input,
622
- inst,
623
- });
624
- return payload;
625
- };
626
- });
627
- export const $ZodDate = /*@__PURE__*/ core.$constructor("$ZodDate", (inst, def) => {
628
- $ZodType.init(inst, def);
629
- inst._zod.parse = (payload, _ctx) => {
630
- if (def.coerce) {
631
- try {
632
- payload.value = new Date(payload.value);
633
- }
634
- catch (_err) { }
635
- }
636
- const input = payload.value;
637
- const isDate = input instanceof Date;
638
- const isValidDate = isDate && !Number.isNaN(input.getTime());
639
- if (isValidDate)
640
- return payload;
641
- payload.issues.push({
642
- expected: "date",
643
- code: "invalid_type",
644
- input,
645
- ...(isDate ? { received: "Invalid Date" } : {}),
646
- inst,
647
- });
648
- return payload;
649
- };
650
- });
651
- function handleArrayResult(result, final, index) {
652
- if (result.issues.length) {
653
- final.issues.push(...util.prefixIssues(index, result.issues));
654
- }
655
- final.value[index] = result.value;
656
- }
657
- export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def) => {
658
- $ZodType.init(inst, def);
659
- inst._zod.parse = (payload, ctx) => {
660
- const input = payload.value;
661
- if (!Array.isArray(input)) {
662
- payload.issues.push({
663
- expected: "array",
664
- code: "invalid_type",
665
- input,
666
- inst,
667
- });
668
- return payload;
669
- }
670
- payload.value = Array(input.length);
671
- const proms = [];
672
- for (let i = 0; i < input.length; i++) {
673
- const item = input[i];
674
- const result = def.element._zod.run({
675
- value: item,
676
- issues: [],
677
- }, ctx);
678
- if (result instanceof Promise) {
679
- proms.push(result.then((result) => handleArrayResult(result, payload, i)));
680
- }
681
- else {
682
- handleArrayResult(result, payload, i);
683
- }
684
- }
685
- if (proms.length) {
686
- return Promise.all(proms).then(() => payload);
687
- }
688
- return payload; //handleArrayResultsAsync(parseResults, final);
689
- };
690
- });
691
- function handlePropertyResult(result, final, key, input, isOptionalOut) {
692
- if (result.issues.length) {
693
- // For optional-out schemas, ignore errors on absent keys
694
- if (isOptionalOut && !(key in input)) {
695
- return;
696
- }
697
- final.issues.push(...util.prefixIssues(key, result.issues));
698
- }
699
- if (result.value === undefined) {
700
- if (key in input) {
701
- final.value[key] = undefined;
702
- }
703
- }
704
- else {
705
- final.value[key] = result.value;
706
- }
707
- }
708
- function normalizeDef(def) {
709
- const keys = Object.keys(def.shape);
710
- for (const k of keys) {
711
- if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
712
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
713
- }
714
- }
715
- const okeys = util.optionalKeys(def.shape);
716
- return {
717
- ...def,
718
- keys,
719
- keySet: new Set(keys),
720
- numKeys: keys.length,
721
- optionalKeys: new Set(okeys),
722
- };
723
- }
724
- function handleCatchall(proms, input, payload, ctx, def, inst) {
725
- const unrecognized = [];
726
- // iterate over input keys
727
- const keySet = def.keySet;
728
- const _catchall = def.catchall._zod;
729
- const t = _catchall.def.type;
730
- const isOptionalOut = _catchall.optout === "optional";
731
- for (const key in input) {
732
- if (keySet.has(key))
733
- continue;
734
- if (t === "never") {
735
- unrecognized.push(key);
736
- continue;
737
- }
738
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
739
- if (r instanceof Promise) {
740
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
741
- }
742
- else {
743
- handlePropertyResult(r, payload, key, input, isOptionalOut);
744
- }
745
- }
746
- if (unrecognized.length) {
747
- payload.issues.push({
748
- code: "unrecognized_keys",
749
- keys: unrecognized,
750
- input,
751
- inst,
752
- });
753
- }
754
- if (!proms.length)
755
- return payload;
756
- return Promise.all(proms).then(() => {
757
- return payload;
758
- });
759
- }
760
- export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, def) => {
761
- // requires cast because technically $ZodObject doesn't extend
762
- $ZodType.init(inst, def);
763
- // const sh = def.shape;
764
- const desc = Object.getOwnPropertyDescriptor(def, "shape");
765
- if (!desc?.get) {
766
- const sh = def.shape;
767
- Object.defineProperty(def, "shape", {
768
- get: () => {
769
- const newSh = { ...sh };
770
- Object.defineProperty(def, "shape", {
771
- value: newSh,
772
- });
773
- return newSh;
774
- },
775
- });
776
- }
777
- const _normalized = util.cached(() => normalizeDef(def));
778
- util.defineLazy(inst._zod, "propValues", () => {
779
- const shape = def.shape;
780
- const propValues = {};
781
- for (const key in shape) {
782
- const field = shape[key]._zod;
783
- if (field.values) {
784
- propValues[key] ?? (propValues[key] = new Set());
785
- for (const v of field.values)
786
- propValues[key].add(v);
787
- }
788
- }
789
- return propValues;
790
- });
791
- const isObject = util.isObject;
792
- const catchall = def.catchall;
793
- let value;
794
- inst._zod.parse = (payload, ctx) => {
795
- value ?? (value = _normalized.value);
796
- const input = payload.value;
797
- if (!isObject(input)) {
798
- payload.issues.push({
799
- expected: "object",
800
- code: "invalid_type",
801
- input,
802
- inst,
803
- });
804
- return payload;
805
- }
806
- payload.value = {};
807
- const proms = [];
808
- const shape = value.shape;
809
- for (const key of value.keys) {
810
- const el = shape[key];
811
- const isOptionalOut = el._zod.optout === "optional";
812
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
813
- if (r instanceof Promise) {
814
- proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
815
- }
816
- else {
817
- handlePropertyResult(r, payload, key, input, isOptionalOut);
818
- }
819
- }
820
- if (!catchall) {
821
- return proms.length ? Promise.all(proms).then(() => payload) : payload;
822
- }
823
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
824
- };
825
- });
826
- export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (inst, def) => {
827
- // requires cast because technically $ZodObject doesn't extend
828
- $ZodObject.init(inst, def);
829
- const superParse = inst._zod.parse;
830
- const _normalized = util.cached(() => normalizeDef(def));
831
- const generateFastpass = (shape) => {
832
- const doc = new Doc(["shape", "payload", "ctx"]);
833
- const normalized = _normalized.value;
834
- const parseStr = (key) => {
835
- const k = util.esc(key);
836
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
837
- };
838
- doc.write(`const input = payload.value;`);
839
- const ids = Object.create(null);
840
- let counter = 0;
841
- for (const key of normalized.keys) {
842
- ids[key] = `key_${counter++}`;
843
- }
844
- // A: preserve key order {
845
- doc.write(`const newResult = {};`);
846
- for (const key of normalized.keys) {
847
- const id = ids[key];
848
- const k = util.esc(key);
849
- const schema = shape[key];
850
- const isOptionalOut = schema?._zod?.optout === "optional";
851
- doc.write(`const ${id} = ${parseStr(key)};`);
852
- if (isOptionalOut) {
853
- // For optional-out schemas, ignore errors on absent keys
854
- doc.write(`
855
- if (${id}.issues.length) {
856
- if (${k} in input) {
857
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
858
- ...iss,
859
- path: iss.path ? [${k}, ...iss.path] : [${k}]
860
- })));
861
- }
862
- }
863
-
864
- if (${id}.value === undefined) {
865
- if (${k} in input) {
866
- newResult[${k}] = undefined;
867
- }
868
- } else {
869
- newResult[${k}] = ${id}.value;
870
- }
871
-
872
- `);
873
- }
874
- else {
875
- doc.write(`
876
- if (${id}.issues.length) {
877
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
878
- ...iss,
879
- path: iss.path ? [${k}, ...iss.path] : [${k}]
880
- })));
881
- }
882
-
883
- if (${id}.value === undefined) {
884
- if (${k} in input) {
885
- newResult[${k}] = undefined;
886
- }
887
- } else {
888
- newResult[${k}] = ${id}.value;
889
- }
890
-
891
- `);
892
- }
893
- }
894
- doc.write(`payload.value = newResult;`);
895
- doc.write(`return payload;`);
896
- const fn = doc.compile();
897
- return (payload, ctx) => fn(shape, payload, ctx);
898
- };
899
- let fastpass;
900
- const isObject = util.isObject;
901
- const jit = !core.globalConfig.jitless;
902
- const allowsEval = util.allowsEval;
903
- const fastEnabled = jit && allowsEval.value; // && !def.catchall;
904
- const catchall = def.catchall;
905
- let value;
906
- inst._zod.parse = (payload, ctx) => {
907
- value ?? (value = _normalized.value);
908
- const input = payload.value;
909
- if (!isObject(input)) {
910
- payload.issues.push({
911
- expected: "object",
912
- code: "invalid_type",
913
- input,
914
- inst,
915
- });
916
- return payload;
917
- }
918
- if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
919
- // always synchronous
920
- if (!fastpass)
921
- fastpass = generateFastpass(def.shape);
922
- payload = fastpass(payload, ctx);
923
- if (!catchall)
924
- return payload;
925
- return handleCatchall([], input, payload, ctx, value, inst);
926
- }
927
- return superParse(payload, ctx);
928
- };
929
- });
930
- function handleUnionResults(results, final, inst, ctx) {
931
- for (const result of results) {
932
- if (result.issues.length === 0) {
933
- final.value = result.value;
934
- return final;
935
- }
936
- }
937
- const nonaborted = results.filter((r) => !util.aborted(r));
938
- if (nonaborted.length === 1) {
939
- final.value = nonaborted[0].value;
940
- return nonaborted[0];
941
- }
942
- final.issues.push({
943
- code: "invalid_union",
944
- input: final.value,
945
- inst,
946
- errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
947
- });
948
- return final;
949
- }
950
- export const $ZodUnion = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def) => {
951
- $ZodType.init(inst, def);
952
- util.defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : undefined);
953
- util.defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
954
- util.defineLazy(inst._zod, "values", () => {
955
- if (def.options.every((o) => o._zod.values)) {
956
- return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
957
- }
958
- return undefined;
959
- });
960
- util.defineLazy(inst._zod, "pattern", () => {
961
- if (def.options.every((o) => o._zod.pattern)) {
962
- const patterns = def.options.map((o) => o._zod.pattern);
963
- return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join("|")})$`);
964
- }
965
- return undefined;
966
- });
967
- const single = def.options.length === 1;
968
- const first = def.options[0]._zod.run;
969
- inst._zod.parse = (payload, ctx) => {
970
- if (single) {
971
- return first(payload, ctx);
972
- }
973
- let async = false;
974
- const results = [];
975
- for (const option of def.options) {
976
- const result = option._zod.run({
977
- value: payload.value,
978
- issues: [],
979
- }, ctx);
980
- if (result instanceof Promise) {
981
- results.push(result);
982
- async = true;
983
- }
984
- else {
985
- if (result.issues.length === 0)
986
- return result;
987
- results.push(result);
988
- }
989
- }
990
- if (!async)
991
- return handleUnionResults(results, payload, inst, ctx);
992
- return Promise.all(results).then((results) => {
993
- return handleUnionResults(results, payload, inst, ctx);
994
- });
995
- };
996
- });
997
- function handleExclusiveUnionResults(results, final, inst, ctx) {
998
- const successes = results.filter((r) => r.issues.length === 0);
999
- if (successes.length === 1) {
1000
- final.value = successes[0].value;
1001
- return final;
1002
- }
1003
- if (successes.length === 0) {
1004
- // No matches - same as regular union
1005
- final.issues.push({
1006
- code: "invalid_union",
1007
- input: final.value,
1008
- inst,
1009
- errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))),
1010
- });
1011
- }
1012
- else {
1013
- // Multiple matches - exclusive union failure
1014
- final.issues.push({
1015
- code: "invalid_union",
1016
- input: final.value,
1017
- inst,
1018
- errors: [],
1019
- inclusive: false,
1020
- });
1021
- }
1022
- return final;
1023
- }
1024
- export const $ZodXor = /*@__PURE__*/ core.$constructor("$ZodXor", (inst, def) => {
1025
- $ZodUnion.init(inst, def);
1026
- def.inclusive = false;
1027
- const single = def.options.length === 1;
1028
- const first = def.options[0]._zod.run;
1029
- inst._zod.parse = (payload, ctx) => {
1030
- if (single) {
1031
- return first(payload, ctx);
1032
- }
1033
- let async = false;
1034
- const results = [];
1035
- for (const option of def.options) {
1036
- const result = option._zod.run({
1037
- value: payload.value,
1038
- issues: [],
1039
- }, ctx);
1040
- if (result instanceof Promise) {
1041
- results.push(result);
1042
- async = true;
1043
- }
1044
- else {
1045
- results.push(result);
1046
- }
1047
- }
1048
- if (!async)
1049
- return handleExclusiveUnionResults(results, payload, inst, ctx);
1050
- return Promise.all(results).then((results) => {
1051
- return handleExclusiveUnionResults(results, payload, inst, ctx);
1052
- });
1053
- };
1054
- });
1055
- export const $ZodDiscriminatedUnion =
1056
- /*@__PURE__*/
1057
- core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
1058
- def.inclusive = false;
1059
- $ZodUnion.init(inst, def);
1060
- const _super = inst._zod.parse;
1061
- util.defineLazy(inst._zod, "propValues", () => {
1062
- const propValues = {};
1063
- for (const option of def.options) {
1064
- const pv = option._zod.propValues;
1065
- if (!pv || Object.keys(pv).length === 0)
1066
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
1067
- for (const [k, v] of Object.entries(pv)) {
1068
- if (!propValues[k])
1069
- propValues[k] = new Set();
1070
- for (const val of v) {
1071
- propValues[k].add(val);
1072
- }
1073
- }
1074
- }
1075
- return propValues;
1076
- });
1077
- const disc = util.cached(() => {
1078
- const opts = def.options;
1079
- const map = new Map();
1080
- for (const o of opts) {
1081
- const values = o._zod.propValues?.[def.discriminator];
1082
- if (!values || values.size === 0)
1083
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
1084
- for (const v of values) {
1085
- if (map.has(v)) {
1086
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
1087
- }
1088
- map.set(v, o);
1089
- }
1090
- }
1091
- return map;
1092
- });
1093
- inst._zod.parse = (payload, ctx) => {
1094
- const input = payload.value;
1095
- if (!util.isObject(input)) {
1096
- payload.issues.push({
1097
- code: "invalid_type",
1098
- expected: "object",
1099
- input,
1100
- inst,
1101
- });
1102
- return payload;
1103
- }
1104
- const opt = disc.value.get(input?.[def.discriminator]);
1105
- if (opt) {
1106
- return opt._zod.run(payload, ctx);
1107
- }
1108
- if (def.unionFallback) {
1109
- return _super(payload, ctx);
1110
- }
1111
- // no matching discriminator
1112
- payload.issues.push({
1113
- code: "invalid_union",
1114
- errors: [],
1115
- note: "No matching discriminator",
1116
- discriminator: def.discriminator,
1117
- input,
1118
- path: [def.discriminator],
1119
- inst,
1120
- });
1121
- return payload;
1122
- };
1123
- });
1124
- export const $ZodIntersection = /*@__PURE__*/ core.$constructor("$ZodIntersection", (inst, def) => {
1125
- $ZodType.init(inst, def);
1126
- inst._zod.parse = (payload, ctx) => {
1127
- const input = payload.value;
1128
- const left = def.left._zod.run({ value: input, issues: [] }, ctx);
1129
- const right = def.right._zod.run({ value: input, issues: [] }, ctx);
1130
- const async = left instanceof Promise || right instanceof Promise;
1131
- if (async) {
1132
- return Promise.all([left, right]).then(([left, right]) => {
1133
- return handleIntersectionResults(payload, left, right);
1134
- });
1135
- }
1136
- return handleIntersectionResults(payload, left, right);
1137
- };
1138
- });
1139
- function mergeValues(a, b) {
1140
- // const aType = parse.t(a);
1141
- // const bType = parse.t(b);
1142
- if (a === b) {
1143
- return { valid: true, data: a };
1144
- }
1145
- if (a instanceof Date && b instanceof Date && +a === +b) {
1146
- return { valid: true, data: a };
1147
- }
1148
- if (util.isPlainObject(a) && util.isPlainObject(b)) {
1149
- const bKeys = Object.keys(b);
1150
- const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
1151
- const newObj = { ...a, ...b };
1152
- for (const key of sharedKeys) {
1153
- const sharedValue = mergeValues(a[key], b[key]);
1154
- if (!sharedValue.valid) {
1155
- return {
1156
- valid: false,
1157
- mergeErrorPath: [key, ...sharedValue.mergeErrorPath],
1158
- };
1159
- }
1160
- newObj[key] = sharedValue.data;
1161
- }
1162
- return { valid: true, data: newObj };
1163
- }
1164
- if (Array.isArray(a) && Array.isArray(b)) {
1165
- if (a.length !== b.length) {
1166
- return { valid: false, mergeErrorPath: [] };
1167
- }
1168
- const newArray = [];
1169
- for (let index = 0; index < a.length; index++) {
1170
- const itemA = a[index];
1171
- const itemB = b[index];
1172
- const sharedValue = mergeValues(itemA, itemB);
1173
- if (!sharedValue.valid) {
1174
- return {
1175
- valid: false,
1176
- mergeErrorPath: [index, ...sharedValue.mergeErrorPath],
1177
- };
1178
- }
1179
- newArray.push(sharedValue.data);
1180
- }
1181
- return { valid: true, data: newArray };
1182
- }
1183
- return { valid: false, mergeErrorPath: [] };
1184
- }
1185
- function handleIntersectionResults(result, left, right) {
1186
- // Track which side(s) report each key as unrecognized
1187
- const unrecKeys = new Map();
1188
- let unrecIssue;
1189
- for (const iss of left.issues) {
1190
- if (iss.code === "unrecognized_keys") {
1191
- unrecIssue ?? (unrecIssue = iss);
1192
- for (const k of iss.keys) {
1193
- if (!unrecKeys.has(k))
1194
- unrecKeys.set(k, {});
1195
- unrecKeys.get(k).l = true;
1196
- }
1197
- }
1198
- else {
1199
- result.issues.push(iss);
1200
- }
1201
- }
1202
- for (const iss of right.issues) {
1203
- if (iss.code === "unrecognized_keys") {
1204
- for (const k of iss.keys) {
1205
- if (!unrecKeys.has(k))
1206
- unrecKeys.set(k, {});
1207
- unrecKeys.get(k).r = true;
1208
- }
1209
- }
1210
- else {
1211
- result.issues.push(iss);
1212
- }
1213
- }
1214
- // Report only keys unrecognized by BOTH sides
1215
- const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1216
- if (bothKeys.length && unrecIssue) {
1217
- result.issues.push({ ...unrecIssue, keys: bothKeys });
1218
- }
1219
- if (util.aborted(result))
1220
- return result;
1221
- const merged = mergeValues(left.value, right.value);
1222
- if (!merged.valid) {
1223
- throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
1224
- }
1225
- result.value = merged.data;
1226
- return result;
1227
- }
1228
- export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def) => {
1229
- $ZodType.init(inst, def);
1230
- const items = def.items;
1231
- inst._zod.parse = (payload, ctx) => {
1232
- const input = payload.value;
1233
- if (!Array.isArray(input)) {
1234
- payload.issues.push({
1235
- input,
1236
- inst,
1237
- expected: "tuple",
1238
- code: "invalid_type",
1239
- });
1240
- return payload;
1241
- }
1242
- payload.value = [];
1243
- const proms = [];
1244
- const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
1245
- const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
1246
- if (!def.rest) {
1247
- const tooBig = input.length > items.length;
1248
- const tooSmall = input.length < optStart - 1;
1249
- if (tooBig || tooSmall) {
1250
- payload.issues.push({
1251
- ...(tooBig
1252
- ? { code: "too_big", maximum: items.length, inclusive: true }
1253
- : { code: "too_small", minimum: items.length }),
1254
- input,
1255
- inst,
1256
- origin: "array",
1257
- });
1258
- return payload;
1259
- }
1260
- }
1261
- let i = -1;
1262
- for (const item of items) {
1263
- i++;
1264
- if (i >= input.length)
1265
- if (i >= optStart)
1266
- continue;
1267
- const result = item._zod.run({
1268
- value: input[i],
1269
- issues: [],
1270
- }, ctx);
1271
- if (result instanceof Promise) {
1272
- proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1273
- }
1274
- else {
1275
- handleTupleResult(result, payload, i);
1276
- }
1277
- }
1278
- if (def.rest) {
1279
- const rest = input.slice(items.length);
1280
- for (const el of rest) {
1281
- i++;
1282
- const result = def.rest._zod.run({
1283
- value: el,
1284
- issues: [],
1285
- }, ctx);
1286
- if (result instanceof Promise) {
1287
- proms.push(result.then((result) => handleTupleResult(result, payload, i)));
1288
- }
1289
- else {
1290
- handleTupleResult(result, payload, i);
1291
- }
1292
- }
1293
- }
1294
- if (proms.length)
1295
- return Promise.all(proms).then(() => payload);
1296
- return payload;
1297
- };
1298
- });
1299
- function handleTupleResult(result, final, index) {
1300
- if (result.issues.length) {
1301
- final.issues.push(...util.prefixIssues(index, result.issues));
1302
- }
1303
- final.value[index] = result.value;
1304
- }
1305
- export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, def) => {
1306
- $ZodType.init(inst, def);
1307
- inst._zod.parse = (payload, ctx) => {
1308
- const input = payload.value;
1309
- if (!util.isPlainObject(input)) {
1310
- payload.issues.push({
1311
- expected: "record",
1312
- code: "invalid_type",
1313
- input,
1314
- inst,
1315
- });
1316
- return payload;
1317
- }
1318
- const proms = [];
1319
- const values = def.keyType._zod.values;
1320
- if (values) {
1321
- payload.value = {};
1322
- const recordKeys = new Set();
1323
- for (const key of values) {
1324
- if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1325
- recordKeys.add(typeof key === "number" ? key.toString() : key);
1326
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1327
- if (result instanceof Promise) {
1328
- proms.push(result.then((result) => {
1329
- if (result.issues.length) {
1330
- payload.issues.push(...util.prefixIssues(key, result.issues));
1331
- }
1332
- payload.value[key] = result.value;
1333
- }));
1334
- }
1335
- else {
1336
- if (result.issues.length) {
1337
- payload.issues.push(...util.prefixIssues(key, result.issues));
1338
- }
1339
- payload.value[key] = result.value;
1340
- }
1341
- }
1342
- }
1343
- let unrecognized;
1344
- for (const key in input) {
1345
- if (!recordKeys.has(key)) {
1346
- unrecognized = unrecognized ?? [];
1347
- unrecognized.push(key);
1348
- }
1349
- }
1350
- if (unrecognized && unrecognized.length > 0) {
1351
- payload.issues.push({
1352
- code: "unrecognized_keys",
1353
- input,
1354
- inst,
1355
- keys: unrecognized,
1356
- });
1357
- }
1358
- }
1359
- else {
1360
- payload.value = {};
1361
- for (const key of Reflect.ownKeys(input)) {
1362
- if (key === "__proto__")
1363
- continue;
1364
- let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1365
- if (keyResult instanceof Promise) {
1366
- throw new Error("Async schemas not supported in object keys currently");
1367
- }
1368
- // Numeric string fallback: if key failed with "expected number", retry with Number(key)
1369
- const checkNumericKey = typeof key === "string" &&
1370
- regexes.number.test(key) &&
1371
- keyResult.issues.length &&
1372
- keyResult.issues.some((iss) => iss.code === "invalid_type" && iss.expected === "number");
1373
- if (checkNumericKey) {
1374
- const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
1375
- if (retryResult instanceof Promise) {
1376
- throw new Error("Async schemas not supported in object keys currently");
1377
- }
1378
- if (retryResult.issues.length === 0) {
1379
- keyResult = retryResult;
1380
- }
1381
- }
1382
- if (keyResult.issues.length) {
1383
- if (def.mode === "loose") {
1384
- // Pass through unchanged
1385
- payload.value[key] = input[key];
1386
- }
1387
- else {
1388
- // Default "strict" behavior: error on invalid key
1389
- payload.issues.push({
1390
- code: "invalid_key",
1391
- origin: "record",
1392
- issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1393
- input: key,
1394
- path: [key],
1395
- inst,
1396
- });
1397
- }
1398
- continue;
1399
- }
1400
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1401
- if (result instanceof Promise) {
1402
- proms.push(result.then((result) => {
1403
- if (result.issues.length) {
1404
- payload.issues.push(...util.prefixIssues(key, result.issues));
1405
- }
1406
- payload.value[keyResult.value] = result.value;
1407
- }));
1408
- }
1409
- else {
1410
- if (result.issues.length) {
1411
- payload.issues.push(...util.prefixIssues(key, result.issues));
1412
- }
1413
- payload.value[keyResult.value] = result.value;
1414
- }
1415
- }
1416
- }
1417
- if (proms.length) {
1418
- return Promise.all(proms).then(() => payload);
1419
- }
1420
- return payload;
1421
- };
1422
- });
1423
- export const $ZodMap = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) => {
1424
- $ZodType.init(inst, def);
1425
- inst._zod.parse = (payload, ctx) => {
1426
- const input = payload.value;
1427
- if (!(input instanceof Map)) {
1428
- payload.issues.push({
1429
- expected: "map",
1430
- code: "invalid_type",
1431
- input,
1432
- inst,
1433
- });
1434
- return payload;
1435
- }
1436
- const proms = [];
1437
- payload.value = new Map();
1438
- for (const [key, value] of input) {
1439
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1440
- const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
1441
- if (keyResult instanceof Promise || valueResult instanceof Promise) {
1442
- proms.push(Promise.all([keyResult, valueResult]).then(([keyResult, valueResult]) => {
1443
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
1444
- }));
1445
- }
1446
- else {
1447
- handleMapResult(keyResult, valueResult, payload, key, input, inst, ctx);
1448
- }
1449
- }
1450
- if (proms.length)
1451
- return Promise.all(proms).then(() => payload);
1452
- return payload;
1453
- };
1454
- });
1455
- function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
1456
- if (keyResult.issues.length) {
1457
- if (util.propertyKeyTypes.has(typeof key)) {
1458
- final.issues.push(...util.prefixIssues(key, keyResult.issues));
1459
- }
1460
- else {
1461
- final.issues.push({
1462
- code: "invalid_key",
1463
- origin: "map",
1464
- input,
1465
- inst,
1466
- issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1467
- });
1468
- }
1469
- }
1470
- if (valueResult.issues.length) {
1471
- if (util.propertyKeyTypes.has(typeof key)) {
1472
- final.issues.push(...util.prefixIssues(key, valueResult.issues));
1473
- }
1474
- else {
1475
- final.issues.push({
1476
- origin: "map",
1477
- code: "invalid_element",
1478
- input,
1479
- inst,
1480
- key: key,
1481
- issues: valueResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1482
- });
1483
- }
1484
- }
1485
- final.value.set(keyResult.value, valueResult.value);
1486
- }
1487
- export const $ZodSet = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) => {
1488
- $ZodType.init(inst, def);
1489
- inst._zod.parse = (payload, ctx) => {
1490
- const input = payload.value;
1491
- if (!(input instanceof Set)) {
1492
- payload.issues.push({
1493
- input,
1494
- inst,
1495
- expected: "set",
1496
- code: "invalid_type",
1497
- });
1498
- return payload;
1499
- }
1500
- const proms = [];
1501
- payload.value = new Set();
1502
- for (const item of input) {
1503
- const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
1504
- if (result instanceof Promise) {
1505
- proms.push(result.then((result) => handleSetResult(result, payload)));
1506
- }
1507
- else
1508
- handleSetResult(result, payload);
1509
- }
1510
- if (proms.length)
1511
- return Promise.all(proms).then(() => payload);
1512
- return payload;
1513
- };
1514
- });
1515
- function handleSetResult(result, final) {
1516
- if (result.issues.length) {
1517
- final.issues.push(...result.issues);
1518
- }
1519
- final.value.add(result.value);
1520
- }
1521
- export const $ZodEnum = /*@__PURE__*/ core.$constructor("$ZodEnum", (inst, def) => {
1522
- $ZodType.init(inst, def);
1523
- const values = util.getEnumValues(def.entries);
1524
- const valuesSet = new Set(values);
1525
- inst._zod.values = valuesSet;
1526
- inst._zod.pattern = new RegExp(`^(${values
1527
- .filter((k) => util.propertyKeyTypes.has(typeof k))
1528
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o.toString()))
1529
- .join("|")})$`);
1530
- inst._zod.parse = (payload, _ctx) => {
1531
- const input = payload.value;
1532
- if (valuesSet.has(input)) {
1533
- return payload;
1534
- }
1535
- payload.issues.push({
1536
- code: "invalid_value",
1537
- values,
1538
- input,
1539
- inst,
1540
- });
1541
- return payload;
1542
- };
1543
- });
1544
- export const $ZodLiteral = /*@__PURE__*/ core.$constructor("$ZodLiteral", (inst, def) => {
1545
- $ZodType.init(inst, def);
1546
- if (def.values.length === 0) {
1547
- throw new Error("Cannot create literal schema with no valid values");
1548
- }
1549
- const values = new Set(def.values);
1550
- inst._zod.values = values;
1551
- inst._zod.pattern = new RegExp(`^(${def.values
1552
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))
1553
- .join("|")})$`);
1554
- inst._zod.parse = (payload, _ctx) => {
1555
- const input = payload.value;
1556
- if (values.has(input)) {
1557
- return payload;
1558
- }
1559
- payload.issues.push({
1560
- code: "invalid_value",
1561
- values: def.values,
1562
- input,
1563
- inst,
1564
- });
1565
- return payload;
1566
- };
1567
- });
1568
- export const $ZodFile = /*@__PURE__*/ core.$constructor("$ZodFile", (inst, def) => {
1569
- $ZodType.init(inst, def);
1570
- inst._zod.parse = (payload, _ctx) => {
1571
- const input = payload.value;
1572
- // @ts-ignore
1573
- if (input instanceof File)
1574
- return payload;
1575
- payload.issues.push({
1576
- expected: "file",
1577
- code: "invalid_type",
1578
- input,
1579
- inst,
1580
- });
1581
- return payload;
1582
- };
1583
- });
1584
- export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (inst, def) => {
1585
- $ZodType.init(inst, def);
1586
- inst._zod.parse = (payload, ctx) => {
1587
- if (ctx.direction === "backward") {
1588
- throw new core.$ZodEncodeError(inst.constructor.name);
1589
- }
1590
- const _out = def.transform(payload.value, payload);
1591
- if (ctx.async) {
1592
- const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1593
- return output.then((output) => {
1594
- payload.value = output;
1595
- return payload;
1596
- });
1597
- }
1598
- if (_out instanceof Promise) {
1599
- throw new core.$ZodAsyncError();
1600
- }
1601
- payload.value = _out;
1602
- return payload;
1603
- };
1604
- });
1605
- function handleOptionalResult(result, input) {
1606
- if (result.issues.length && input === undefined) {
1607
- return { issues: [], value: undefined };
1608
- }
1609
- return result;
1610
- }
1611
- export const $ZodOptional = /*@__PURE__*/ core.$constructor("$ZodOptional", (inst, def) => {
1612
- $ZodType.init(inst, def);
1613
- inst._zod.optin = "optional";
1614
- inst._zod.optout = "optional";
1615
- util.defineLazy(inst._zod, "values", () => {
1616
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, undefined]) : undefined;
1617
- });
1618
- util.defineLazy(inst._zod, "pattern", () => {
1619
- const pattern = def.innerType._zod.pattern;
1620
- return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
1621
- });
1622
- inst._zod.parse = (payload, ctx) => {
1623
- if (def.innerType._zod.optin === "optional") {
1624
- const result = def.innerType._zod.run(payload, ctx);
1625
- if (result instanceof Promise)
1626
- return result.then((r) => handleOptionalResult(r, payload.value));
1627
- return handleOptionalResult(result, payload.value);
1628
- }
1629
- if (payload.value === undefined) {
1630
- return payload;
1631
- }
1632
- return def.innerType._zod.run(payload, ctx);
1633
- };
1634
- });
1635
- export const $ZodExactOptional = /*@__PURE__*/ core.$constructor("$ZodExactOptional", (inst, def) => {
1636
- // Call parent init - inherits optin/optout = "optional"
1637
- $ZodOptional.init(inst, def);
1638
- // Override values/pattern to NOT add undefined
1639
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1640
- util.defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
1641
- // Override parse to just delegate (no undefined handling)
1642
- inst._zod.parse = (payload, ctx) => {
1643
- return def.innerType._zod.run(payload, ctx);
1644
- };
1645
- });
1646
- export const $ZodNullable = /*@__PURE__*/ core.$constructor("$ZodNullable", (inst, def) => {
1647
- $ZodType.init(inst, def);
1648
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1649
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1650
- util.defineLazy(inst._zod, "pattern", () => {
1651
- const pattern = def.innerType._zod.pattern;
1652
- return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
1653
- });
1654
- util.defineLazy(inst._zod, "values", () => {
1655
- return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
1656
- });
1657
- inst._zod.parse = (payload, ctx) => {
1658
- // Forward direction (decode): allow null to pass through
1659
- if (payload.value === null)
1660
- return payload;
1661
- return def.innerType._zod.run(payload, ctx);
1662
- };
1663
- });
1664
- export const $ZodDefault = /*@__PURE__*/ core.$constructor("$ZodDefault", (inst, def) => {
1665
- $ZodType.init(inst, def);
1666
- // inst._zod.qin = "true";
1667
- inst._zod.optin = "optional";
1668
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1669
- inst._zod.parse = (payload, ctx) => {
1670
- if (ctx.direction === "backward") {
1671
- return def.innerType._zod.run(payload, ctx);
1672
- }
1673
- // Forward direction (decode): apply defaults for undefined input
1674
- if (payload.value === undefined) {
1675
- payload.value = def.defaultValue;
1676
- /**
1677
- * $ZodDefault returns the default value immediately in forward direction.
1678
- * 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. */
1679
- return payload;
1680
- }
1681
- // Forward direction: continue with default handling
1682
- const result = def.innerType._zod.run(payload, ctx);
1683
- if (result instanceof Promise) {
1684
- return result.then((result) => handleDefaultResult(result, def));
1685
- }
1686
- return handleDefaultResult(result, def);
1687
- };
1688
- });
1689
- function handleDefaultResult(payload, def) {
1690
- if (payload.value === undefined) {
1691
- payload.value = def.defaultValue;
1692
- }
1693
- return payload;
1694
- }
1695
- export const $ZodPrefault = /*@__PURE__*/ core.$constructor("$ZodPrefault", (inst, def) => {
1696
- $ZodType.init(inst, def);
1697
- inst._zod.optin = "optional";
1698
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1699
- inst._zod.parse = (payload, ctx) => {
1700
- if (ctx.direction === "backward") {
1701
- return def.innerType._zod.run(payload, ctx);
1702
- }
1703
- // Forward direction (decode): apply prefault for undefined input
1704
- if (payload.value === undefined) {
1705
- payload.value = def.defaultValue;
1706
- }
1707
- return def.innerType._zod.run(payload, ctx);
1708
- };
1709
- });
1710
- export const $ZodNonOptional = /*@__PURE__*/ core.$constructor("$ZodNonOptional", (inst, def) => {
1711
- $ZodType.init(inst, def);
1712
- util.defineLazy(inst._zod, "values", () => {
1713
- const v = def.innerType._zod.values;
1714
- return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
1715
- });
1716
- inst._zod.parse = (payload, ctx) => {
1717
- const result = def.innerType._zod.run(payload, ctx);
1718
- if (result instanceof Promise) {
1719
- return result.then((result) => handleNonOptionalResult(result, inst));
1720
- }
1721
- return handleNonOptionalResult(result, inst);
1722
- };
1723
- });
1724
- function handleNonOptionalResult(payload, inst) {
1725
- if (!payload.issues.length && payload.value === undefined) {
1726
- payload.issues.push({
1727
- code: "invalid_type",
1728
- expected: "nonoptional",
1729
- input: payload.value,
1730
- inst,
1731
- });
1732
- }
1733
- return payload;
1734
- }
1735
- export const $ZodSuccess = /*@__PURE__*/ core.$constructor("$ZodSuccess", (inst, def) => {
1736
- $ZodType.init(inst, def);
1737
- inst._zod.parse = (payload, ctx) => {
1738
- if (ctx.direction === "backward") {
1739
- throw new core.$ZodEncodeError("ZodSuccess");
1740
- }
1741
- const result = def.innerType._zod.run(payload, ctx);
1742
- if (result instanceof Promise) {
1743
- return result.then((result) => {
1744
- payload.value = result.issues.length === 0;
1745
- return payload;
1746
- });
1747
- }
1748
- payload.value = result.issues.length === 0;
1749
- return payload;
1750
- };
1751
- });
1752
- export const $ZodCatch = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def) => {
1753
- $ZodType.init(inst, def);
1754
- util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1755
- util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1756
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1757
- inst._zod.parse = (payload, ctx) => {
1758
- if (ctx.direction === "backward") {
1759
- return def.innerType._zod.run(payload, ctx);
1760
- }
1761
- // Forward direction (decode): apply catch logic
1762
- const result = def.innerType._zod.run(payload, ctx);
1763
- if (result instanceof Promise) {
1764
- return result.then((result) => {
1765
- payload.value = result.value;
1766
- if (result.issues.length) {
1767
- payload.value = def.catchValue({
1768
- ...payload,
1769
- error: {
1770
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1771
- },
1772
- input: payload.value,
1773
- });
1774
- payload.issues = [];
1775
- }
1776
- return payload;
1777
- });
1778
- }
1779
- payload.value = result.value;
1780
- if (result.issues.length) {
1781
- payload.value = def.catchValue({
1782
- ...payload,
1783
- error: {
1784
- issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
1785
- },
1786
- input: payload.value,
1787
- });
1788
- payload.issues = [];
1789
- }
1790
- return payload;
1791
- };
1792
- });
1793
- export const $ZodNaN = /*@__PURE__*/ core.$constructor("$ZodNaN", (inst, def) => {
1794
- $ZodType.init(inst, def);
1795
- inst._zod.parse = (payload, _ctx) => {
1796
- if (typeof payload.value !== "number" || !Number.isNaN(payload.value)) {
1797
- payload.issues.push({
1798
- input: payload.value,
1799
- inst,
1800
- expected: "nan",
1801
- code: "invalid_type",
1802
- });
1803
- return payload;
1804
- }
1805
- return payload;
1806
- };
1807
- });
1808
- export const $ZodPipe = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def) => {
1809
- $ZodType.init(inst, def);
1810
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
1811
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1812
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1813
- util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
1814
- inst._zod.parse = (payload, ctx) => {
1815
- if (ctx.direction === "backward") {
1816
- const right = def.out._zod.run(payload, ctx);
1817
- if (right instanceof Promise) {
1818
- return right.then((right) => handlePipeResult(right, def.in, ctx));
1819
- }
1820
- return handlePipeResult(right, def.in, ctx);
1821
- }
1822
- const left = def.in._zod.run(payload, ctx);
1823
- if (left instanceof Promise) {
1824
- return left.then((left) => handlePipeResult(left, def.out, ctx));
1825
- }
1826
- return handlePipeResult(left, def.out, ctx);
1827
- };
1828
- });
1829
- function handlePipeResult(left, next, ctx) {
1830
- if (left.issues.length) {
1831
- // prevent further checks
1832
- left.aborted = true;
1833
- return left;
1834
- }
1835
- return next._zod.run({ value: left.value, issues: left.issues }, ctx);
1836
- }
1837
- export const $ZodCodec = /*@__PURE__*/ core.$constructor("$ZodCodec", (inst, def) => {
1838
- $ZodType.init(inst, def);
1839
- util.defineLazy(inst._zod, "values", () => def.in._zod.values);
1840
- util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1841
- util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1842
- util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
1843
- inst._zod.parse = (payload, ctx) => {
1844
- const direction = ctx.direction || "forward";
1845
- if (direction === "forward") {
1846
- const left = def.in._zod.run(payload, ctx);
1847
- if (left instanceof Promise) {
1848
- return left.then((left) => handleCodecAResult(left, def, ctx));
1849
- }
1850
- return handleCodecAResult(left, def, ctx);
1851
- }
1852
- else {
1853
- const right = def.out._zod.run(payload, ctx);
1854
- if (right instanceof Promise) {
1855
- return right.then((right) => handleCodecAResult(right, def, ctx));
1856
- }
1857
- return handleCodecAResult(right, def, ctx);
1858
- }
1859
- };
1860
- });
1861
- function handleCodecAResult(result, def, ctx) {
1862
- if (result.issues.length) {
1863
- // prevent further checks
1864
- result.aborted = true;
1865
- return result;
1866
- }
1867
- const direction = ctx.direction || "forward";
1868
- if (direction === "forward") {
1869
- const transformed = def.transform(result.value, result);
1870
- if (transformed instanceof Promise) {
1871
- return transformed.then((value) => handleCodecTxResult(result, value, def.out, ctx));
1872
- }
1873
- return handleCodecTxResult(result, transformed, def.out, ctx);
1874
- }
1875
- else {
1876
- const transformed = def.reverseTransform(result.value, result);
1877
- if (transformed instanceof Promise) {
1878
- return transformed.then((value) => handleCodecTxResult(result, value, def.in, ctx));
1879
- }
1880
- return handleCodecTxResult(result, transformed, def.in, ctx);
1881
- }
1882
- }
1883
- function handleCodecTxResult(left, value, nextSchema, ctx) {
1884
- // Check if transform added any issues
1885
- if (left.issues.length) {
1886
- left.aborted = true;
1887
- return left;
1888
- }
1889
- return nextSchema._zod.run({ value, issues: left.issues }, ctx);
1890
- }
1891
- export const $ZodReadonly = /*@__PURE__*/ core.$constructor("$ZodReadonly", (inst, def) => {
1892
- $ZodType.init(inst, def);
1893
- util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1894
- util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1895
- util.defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
1896
- util.defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
1897
- inst._zod.parse = (payload, ctx) => {
1898
- if (ctx.direction === "backward") {
1899
- return def.innerType._zod.run(payload, ctx);
1900
- }
1901
- const result = def.innerType._zod.run(payload, ctx);
1902
- if (result instanceof Promise) {
1903
- return result.then(handleReadonlyResult);
1904
- }
1905
- return handleReadonlyResult(result);
1906
- };
1907
- });
1908
- function handleReadonlyResult(payload) {
1909
- payload.value = Object.freeze(payload.value);
1910
- return payload;
1911
- }
1912
- export const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor("$ZodTemplateLiteral", (inst, def) => {
1913
- $ZodType.init(inst, def);
1914
- const regexParts = [];
1915
- for (const part of def.parts) {
1916
- if (typeof part === "object" && part !== null) {
1917
- // is Zod schema
1918
- if (!part._zod.pattern) {
1919
- // if (!source)
1920
- throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
1921
- }
1922
- const source = part._zod.pattern instanceof RegExp ? part._zod.pattern.source : part._zod.pattern;
1923
- if (!source)
1924
- throw new Error(`Invalid template literal part: ${part._zod.traits}`);
1925
- const start = source.startsWith("^") ? 1 : 0;
1926
- const end = source.endsWith("$") ? source.length - 1 : source.length;
1927
- regexParts.push(source.slice(start, end));
1928
- }
1929
- else if (part === null || util.primitiveTypes.has(typeof part)) {
1930
- regexParts.push(util.escapeRegex(`${part}`));
1931
- }
1932
- else {
1933
- throw new Error(`Invalid template literal part: ${part}`);
1934
- }
1935
- }
1936
- inst._zod.pattern = new RegExp(`^${regexParts.join("")}$`);
1937
- inst._zod.parse = (payload, _ctx) => {
1938
- if (typeof payload.value !== "string") {
1939
- payload.issues.push({
1940
- input: payload.value,
1941
- inst,
1942
- expected: "string",
1943
- code: "invalid_type",
1944
- });
1945
- return payload;
1946
- }
1947
- inst._zod.pattern.lastIndex = 0;
1948
- if (!inst._zod.pattern.test(payload.value)) {
1949
- payload.issues.push({
1950
- input: payload.value,
1951
- inst,
1952
- code: "invalid_format",
1953
- format: def.format ?? "template_literal",
1954
- pattern: inst._zod.pattern.source,
1955
- });
1956
- return payload;
1957
- }
1958
- return payload;
1959
- };
1960
- });
1961
- export const $ZodFunction = /*@__PURE__*/ core.$constructor("$ZodFunction", (inst, def) => {
1962
- $ZodType.init(inst, def);
1963
- inst._def = def;
1964
- inst._zod.def = def;
1965
- inst.implement = (func) => {
1966
- if (typeof func !== "function") {
1967
- throw new Error("implement() must be called with a function");
1968
- }
1969
- return function (...args) {
1970
- const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
1971
- const result = Reflect.apply(func, this, parsedArgs);
1972
- if (inst._def.output) {
1973
- return parse(inst._def.output, result);
1974
- }
1975
- return result;
1976
- };
1977
- };
1978
- inst.implementAsync = (func) => {
1979
- if (typeof func !== "function") {
1980
- throw new Error("implementAsync() must be called with a function");
1981
- }
1982
- return async function (...args) {
1983
- const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
1984
- const result = await Reflect.apply(func, this, parsedArgs);
1985
- if (inst._def.output) {
1986
- return await parseAsync(inst._def.output, result);
1987
- }
1988
- return result;
1989
- };
1990
- };
1991
- inst._zod.parse = (payload, _ctx) => {
1992
- if (typeof payload.value !== "function") {
1993
- payload.issues.push({
1994
- code: "invalid_type",
1995
- expected: "function",
1996
- input: payload.value,
1997
- inst,
1998
- });
1999
- return payload;
2000
- }
2001
- // Check if output is a promise type to determine if we should use async implementation
2002
- const hasPromiseOutput = inst._def.output && inst._def.output._zod.def.type === "promise";
2003
- if (hasPromiseOutput) {
2004
- payload.value = inst.implementAsync(payload.value);
2005
- }
2006
- else {
2007
- payload.value = inst.implement(payload.value);
2008
- }
2009
- return payload;
2010
- };
2011
- inst.input = (...args) => {
2012
- const F = inst.constructor;
2013
- if (Array.isArray(args[0])) {
2014
- return new F({
2015
- type: "function",
2016
- input: new $ZodTuple({
2017
- type: "tuple",
2018
- items: args[0],
2019
- rest: args[1],
2020
- }),
2021
- output: inst._def.output,
2022
- });
2023
- }
2024
- return new F({
2025
- type: "function",
2026
- input: args[0],
2027
- output: inst._def.output,
2028
- });
2029
- };
2030
- inst.output = (output) => {
2031
- const F = inst.constructor;
2032
- return new F({
2033
- type: "function",
2034
- input: inst._def.input,
2035
- output,
2036
- });
2037
- };
2038
- return inst;
2039
- });
2040
- export const $ZodPromise = /*@__PURE__*/ core.$constructor("$ZodPromise", (inst, def) => {
2041
- $ZodType.init(inst, def);
2042
- inst._zod.parse = (payload, ctx) => {
2043
- return Promise.resolve(payload.value).then((inner) => def.innerType._zod.run({ value: inner, issues: [] }, ctx));
2044
- };
2045
- });
2046
- export const $ZodLazy = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
2047
- $ZodType.init(inst, def);
2048
- // let _innerType!: any;
2049
- // util.defineLazy(def, "getter", () => {
2050
- // if (!_innerType) {
2051
- // _innerType = def.getter();
2052
- // }
2053
- // return () => _innerType;
2054
- // });
2055
- util.defineLazy(inst._zod, "innerType", () => def.getter());
2056
- util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
2057
- util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
2058
- util.defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
2059
- util.defineLazy(inst._zod, "optout", () => inst._zod.innerType?._zod?.optout ?? undefined);
2060
- inst._zod.parse = (payload, ctx) => {
2061
- const inner = inst._zod.innerType;
2062
- return inner._zod.run(payload, ctx);
2063
- };
2064
- });
2065
- export const $ZodCustom = /*@__PURE__*/ core.$constructor("$ZodCustom", (inst, def) => {
2066
- checks.$ZodCheck.init(inst, def);
2067
- $ZodType.init(inst, def);
2068
- inst._zod.parse = (payload, _) => {
2069
- return payload;
2070
- };
2071
- inst._zod.check = (payload) => {
2072
- const input = payload.value;
2073
- const r = def.fn(input);
2074
- if (r instanceof Promise) {
2075
- return r.then((r) => handleRefineResult(r, payload, input, inst));
2076
- }
2077
- handleRefineResult(r, payload, input, inst);
2078
- return;
2079
- };
2080
- });
2081
- function handleRefineResult(result, payload, input, inst) {
2082
- if (!result) {
2083
- const _iss = {
2084
- code: "custom",
2085
- input,
2086
- inst, // incorporates params.error into issue reporting
2087
- path: [...(inst._zod.def.path ?? [])], // incorporates params.error into issue reporting
2088
- continue: !inst._zod.def.abort,
2089
- // params: inst._zod.def.params,
2090
- };
2091
- if (inst._zod.def.params)
2092
- _iss.params = inst._zod.def.params;
2093
- payload.issues.push(util.issue(_iss));
2094
- }
2095
- }