@athenaintel/react 0.23.3 → 0.24.0

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 (288) hide show
  1. package/README.md +6 -0
  2. package/dist/assets/AssetPanel.cjs +1 -1
  3. package/dist/assets/AssetPanel.cjs.map +1 -1
  4. package/dist/assets/AssetPanel.js +1 -1
  5. package/dist/assets/AssetPanel.js.map +1 -1
  6. package/dist/assets/AthenaAssetEmbed.cjs +1 -1
  7. package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
  8. package/dist/assets/AthenaAssetEmbed.js +1 -1
  9. package/dist/assets/AthenaAssetEmbed.js.map +1 -1
  10. package/dist/chat/AthenaChat.cjs +15 -23
  11. package/dist/chat/AthenaChat.cjs.map +1 -1
  12. package/dist/chat/AthenaChat.d.ts +9 -4
  13. package/dist/chat/AthenaChat.js +15 -23
  14. package/dist/chat/AthenaChat.js.map +1 -1
  15. package/dist/chat/StatewireApprovalCard.cjs +3 -18
  16. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  17. package/dist/chat/StatewireApprovalCard.js +3 -18
  18. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  19. package/dist/chat/StatewireClientToolBridge.cjs +2 -16
  20. package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
  21. package/dist/chat/StatewireClientToolBridge.js +2 -16
  22. package/dist/chat/StatewireClientToolBridge.js.map +1 -1
  23. package/dist/chat/StatewireQueuedMessages.cjs +5 -16
  24. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  25. package/dist/chat/StatewireQueuedMessages.js +5 -16
  26. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  27. package/dist/chat/WaitingOnYouBanner.cjs +3 -18
  28. package/dist/chat/WaitingOnYouBanner.cjs.map +1 -1
  29. package/dist/chat/WaitingOnYouBanner.js +3 -18
  30. package/dist/chat/WaitingOnYouBanner.js.map +1 -1
  31. package/dist/chat/run-activity.cjs +0 -16
  32. package/dist/chat/run-activity.cjs.map +1 -1
  33. package/dist/chat/run-activity.js +0 -16
  34. package/dist/chat/run-activity.js.map +1 -1
  35. package/dist/chat/statewire-client-tools.cjs +1 -17
  36. package/dist/chat/statewire-client-tools.cjs.map +1 -1
  37. package/dist/chat/statewire-client-tools.js +1 -17
  38. package/dist/chat/statewire-client-tools.js.map +1 -1
  39. package/dist/chat/super-grouping/activity-timeline.cjs +0 -16
  40. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  41. package/dist/chat/super-grouping/activity-timeline.js +0 -16
  42. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  43. package/dist/chat/tiptap-text.cjs +1 -17
  44. package/dist/chat/tiptap-text.cjs.map +1 -1
  45. package/dist/chat/tiptap-text.js +1 -17
  46. package/dist/chat/tiptap-text.js.map +1 -1
  47. package/dist/chat/use-athena-run-live.cjs +0 -15
  48. package/dist/chat/use-athena-run-live.cjs.map +1 -1
  49. package/dist/chat/use-athena-run-live.js +0 -15
  50. package/dist/chat/use-athena-run-live.js.map +1 -1
  51. package/dist/chat/use-statewire-approval-request.cjs +4 -16
  52. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  53. package/dist/chat/use-statewire-approval-request.d.ts +2 -0
  54. package/dist/chat/use-statewire-approval-request.js +4 -16
  55. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  56. package/dist/chat-ui/composer/tiptap-composer.cjs +1 -16
  57. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  58. package/dist/chat-ui/composer/tiptap-composer.js +1 -16
  59. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  60. package/dist/chat-ui/index.cjs +0 -16
  61. package/dist/chat-ui/index.cjs.map +1 -1
  62. package/dist/chat-ui/index.js +0 -16
  63. package/dist/chat-ui/index.js.map +1 -1
  64. package/dist/chat-ui/mentions/mention-chip.cjs +1 -16
  65. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  66. package/dist/chat-ui/mentions/mention-chip.js +1 -16
  67. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  68. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs +4 -6
  69. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.cjs.map +1 -1
  70. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js +4 -6
  71. package/dist/chat-ui/mentions/suggestions/data/sources/asset-type-icons.js.map +1 -1
  72. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +2 -9
  73. package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
  74. package/dist/chat-ui/mentions/suggestions/data/sources/index.js +2 -9
  75. package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
  76. package/dist/chat-ui/messages/message-components.cjs +5 -19
  77. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  78. package/dist/chat-ui/messages/message-components.js +5 -19
  79. package/dist/chat-ui/messages/message-components.js.map +1 -1
  80. package/dist/chat-ui/messages/runtime-message.cjs +1 -16
  81. package/dist/chat-ui/messages/runtime-message.cjs.map +1 -1
  82. package/dist/chat-ui/messages/runtime-message.js +1 -16
  83. package/dist/chat-ui/messages/runtime-message.js.map +1 -1
  84. package/dist/chat-ui/messages/statewire-continue-run.cjs +3 -15
  85. package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -1
  86. package/dist/chat-ui/messages/statewire-continue-run.js +3 -15
  87. package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -1
  88. package/dist/chat-ui/messages/user-edit-composer.cjs +0 -16
  89. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  90. package/dist/chat-ui/messages/user-edit-composer.js +0 -16
  91. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  92. package/dist/chat-ui/messages/wake-marker.cjs +1 -16
  93. package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
  94. package/dist/chat-ui/messages/wake-marker.js +1 -16
  95. package/dist/chat-ui/messages/wake-marker.js.map +1 -1
  96. package/dist/chat-ui/statewire.cjs +0 -16
  97. package/dist/chat-ui/statewire.cjs.map +1 -1
  98. package/dist/chat-ui/statewire.js +0 -16
  99. package/dist/chat-ui/statewire.js.map +1 -1
  100. package/dist/chat-ui/thread/statewire-history-edge.cjs +2 -17
  101. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  102. package/dist/chat-ui/thread/statewire-history-edge.js +2 -17
  103. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  104. package/dist/dictation/DictationStrip.cjs +2 -1
  105. package/dist/dictation/DictationStrip.cjs.map +1 -1
  106. package/dist/dictation/DictationStrip.d.ts +2 -0
  107. package/dist/dictation/DictationStrip.js +2 -1
  108. package/dist/dictation/DictationStrip.js.map +1 -1
  109. package/dist/dictation/dictation-engine.cjs.map +1 -1
  110. package/dist/dictation/dictation-engine.d.ts +8 -0
  111. package/dist/dictation/dictation-engine.js.map +1 -1
  112. package/dist/dictation/recorded-dictation-engine.cjs +153 -0
  113. package/dist/dictation/recorded-dictation-engine.cjs.map +1 -0
  114. package/dist/dictation/recorded-dictation-engine.d.ts +66 -0
  115. package/dist/dictation/recorded-dictation-engine.js +153 -0
  116. package/dist/dictation/recorded-dictation-engine.js.map +1 -0
  117. package/dist/dictation/use-athena-dictation-engine.cjs +64 -0
  118. package/dist/dictation/use-athena-dictation-engine.cjs.map +1 -0
  119. package/dist/dictation/use-athena-dictation-engine.d.ts +25 -0
  120. package/dist/dictation/use-athena-dictation-engine.js +64 -0
  121. package/dist/dictation/use-athena-dictation-engine.js.map +1 -0
  122. package/dist/dictation/use-dictation.cjs +17 -6
  123. package/dist/dictation/use-dictation.cjs.map +1 -1
  124. package/dist/dictation/use-dictation.d.ts +20 -4
  125. package/dist/dictation/use-dictation.js +17 -6
  126. package/dist/dictation/use-dictation.js.map +1 -1
  127. package/dist/index.cjs +28 -39
  128. package/dist/index.cjs.map +1 -1
  129. package/dist/index.d.ts +4 -1
  130. package/dist/index.js +10 -21
  131. package/dist/index.js.map +1 -1
  132. package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -1
  133. package/dist/packages/agent-runtime/src/edit-command.js.map +1 -1
  134. package/dist/packages/agent-runtime/src/errors.cjs +18 -0
  135. package/dist/packages/agent-runtime/src/errors.cjs.map +1 -1
  136. package/dist/packages/agent-runtime/src/errors.js +19 -1
  137. package/dist/packages/agent-runtime/src/errors.js.map +1 -1
  138. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +1 -0
  139. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  140. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +1 -0
  141. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  142. package/dist/packages/agent-runtime/src/interrupts.cjs +61 -12
  143. package/dist/packages/agent-runtime/src/interrupts.cjs.map +1 -1
  144. package/dist/packages/agent-runtime/src/interrupts.js +61 -12
  145. package/dist/packages/agent-runtime/src/interrupts.js.map +1 -1
  146. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +49 -0
  147. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  148. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +49 -0
  149. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  150. package/dist/packages/agent-runtime/src/thread-status.js +1 -1
  151. package/dist/packages/agent-runtime/src/tool-metadata.cjs +1 -37
  152. package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +1 -1
  153. package/dist/packages/agent-runtime/src/tool-metadata.js +1 -37
  154. package/dist/packages/agent-runtime/src/tool-metadata.js.map +1 -1
  155. package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs +0 -1
  156. package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs.map +1 -1
  157. package/dist/packages/agent-runtime/src/use-deep-agent-config.js +0 -1
  158. package/dist/packages/agent-runtime/src/use-deep-agent-config.js.map +1 -1
  159. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  160. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  161. package/dist/packages/react/package.json.cjs +1 -1
  162. package/dist/packages/react/package.json.js +1 -1
  163. package/dist/provider/AthenaProvider.cjs +3 -17
  164. package/dist/provider/AthenaProvider.cjs.map +1 -1
  165. package/dist/provider/AthenaProvider.js +3 -17
  166. package/dist/provider/AthenaProvider.js.map +1 -1
  167. package/dist/runtime/statewire-lifecycle.cjs +0 -16
  168. package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
  169. package/dist/runtime/statewire-lifecycle.js +0 -16
  170. package/dist/runtime/statewire-lifecycle.js.map +1 -1
  171. package/dist/runtime/useAthenaStatewireRuntime.cjs +3 -17
  172. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  173. package/dist/runtime/useAthenaStatewireRuntime.js +3 -17
  174. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  175. package/dist/threads/statewire-thread-list.cjs +4 -17
  176. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  177. package/dist/threads/statewire-thread-list.js +4 -17
  178. package/dist/threads/statewire-thread-list.js.map +1 -1
  179. package/dist/threads/use-rest-conversation-history.cjs +2 -16
  180. package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
  181. package/dist/threads/use-rest-conversation-history.js +2 -16
  182. package/dist/threads/use-rest-conversation-history.js.map +1 -1
  183. package/dist/threads/use-statewire-conversation-history.cjs +2 -16
  184. package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
  185. package/dist/threads/use-statewire-conversation-history.js +2 -16
  186. package/dist/threads/use-statewire-conversation-history.js.map +1 -1
  187. package/dist/toolkits/index.cjs +0 -7
  188. package/dist/toolkits/index.cjs.map +1 -1
  189. package/dist/toolkits/index.d.ts +0 -2
  190. package/dist/toolkits/index.js +0 -7
  191. package/dist/toolkits/index.js.map +1 -1
  192. package/dist/tools/index.cjs +4 -20
  193. package/dist/tools/index.cjs.map +1 -1
  194. package/dist/tools/index.js +1 -17
  195. package/dist/tools/index.js.map +1 -1
  196. package/dist/tools/misc-tool-uis.cjs +2 -17
  197. package/dist/tools/misc-tool-uis.cjs.map +1 -1
  198. package/dist/tools/misc-tool-uis.js +2 -17
  199. package/dist/tools/misc-tool-uis.js.map +1 -1
  200. package/dist/tools/primitives.cjs +1 -16
  201. package/dist/tools/primitives.cjs.map +1 -1
  202. package/dist/tools/primitives.js +1 -16
  203. package/dist/tools/primitives.js.map +1 -1
  204. package/dist/tools/tool-fallback.cjs +2 -17
  205. package/dist/tools/tool-fallback.cjs.map +1 -1
  206. package/dist/tools/tool-fallback.js +2 -17
  207. package/dist/tools/tool-fallback.js.map +1 -1
  208. package/dist/tools/voice-update-tool-ui.cjs +1 -17
  209. package/dist/tools/voice-update-tool-ui.cjs.map +1 -1
  210. package/dist/tools/voice-update-tool-ui.js +1 -17
  211. package/dist/tools/voice-update-tool-ui.js.map +1 -1
  212. package/package.json +1 -1
  213. package/dist/node_modules/qrcode-generator/dist/qrcode.cjs +0 -32
  214. package/dist/node_modules/qrcode-generator/dist/qrcode.cjs.map +0 -1
  215. package/dist/node_modules/qrcode-generator/dist/qrcode.js +0 -31
  216. package/dist/node_modules/qrcode-generator/dist/qrcode.js.map +0 -1
  217. package/dist/node_modules/zod/v4/classic/errors.cjs +0 -44
  218. package/dist/node_modules/zod/v4/classic/errors.cjs.map +0 -1
  219. package/dist/node_modules/zod/v4/classic/errors.js +0 -44
  220. package/dist/node_modules/zod/v4/classic/errors.js.map +0 -1
  221. package/dist/node_modules/zod/v4/classic/iso.cjs +0 -43
  222. package/dist/node_modules/zod/v4/classic/iso.cjs.map +0 -1
  223. package/dist/node_modules/zod/v4/classic/iso.js +0 -43
  224. package/dist/node_modules/zod/v4/classic/iso.js.map +0 -1
  225. package/dist/node_modules/zod/v4/classic/parse.cjs +0 -29
  226. package/dist/node_modules/zod/v4/classic/parse.cjs.map +0 -1
  227. package/dist/node_modules/zod/v4/classic/parse.js +0 -29
  228. package/dist/node_modules/zod/v4/classic/parse.js.map +0 -1
  229. package/dist/node_modules/zod/v4/classic/schemas.cjs +0 -871
  230. package/dist/node_modules/zod/v4/classic/schemas.cjs.map +0 -1
  231. package/dist/node_modules/zod/v4/classic/schemas.js +0 -871
  232. package/dist/node_modules/zod/v4/classic/schemas.js.map +0 -1
  233. package/dist/node_modules/zod/v4/core/api.cjs +0 -570
  234. package/dist/node_modules/zod/v4/core/api.cjs.map +0 -1
  235. package/dist/node_modules/zod/v4/core/api.js +0 -570
  236. package/dist/node_modules/zod/v4/core/api.js.map +0 -1
  237. package/dist/node_modules/zod/v4/core/checks.cjs +0 -411
  238. package/dist/node_modules/zod/v4/core/checks.cjs.map +0 -1
  239. package/dist/node_modules/zod/v4/core/checks.js +0 -411
  240. package/dist/node_modules/zod/v4/core/checks.js.map +0 -1
  241. package/dist/node_modules/zod/v4/core/core.cjs +0 -77
  242. package/dist/node_modules/zod/v4/core/core.cjs.map +0 -1
  243. package/dist/node_modules/zod/v4/core/core.js +0 -77
  244. package/dist/node_modules/zod/v4/core/core.js.map +0 -1
  245. package/dist/node_modules/zod/v4/core/doc.cjs +0 -38
  246. package/dist/node_modules/zod/v4/core/doc.cjs.map +0 -1
  247. package/dist/node_modules/zod/v4/core/doc.js +0 -38
  248. package/dist/node_modules/zod/v4/core/doc.js.map +0 -1
  249. package/dist/node_modules/zod/v4/core/errors.cjs +0 -76
  250. package/dist/node_modules/zod/v4/core/errors.cjs.map +0 -1
  251. package/dist/node_modules/zod/v4/core/errors.js +0 -76
  252. package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
  253. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +0 -312
  254. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs.map +0 -1
  255. package/dist/node_modules/zod/v4/core/json-schema-processors.js +0 -312
  256. package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +0 -1
  257. package/dist/node_modules/zod/v4/core/parse.cjs +0 -96
  258. package/dist/node_modules/zod/v4/core/parse.cjs.map +0 -1
  259. package/dist/node_modules/zod/v4/core/parse.js +0 -96
  260. package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
  261. package/dist/node_modules/zod/v4/core/regexes.cjs +0 -86
  262. package/dist/node_modules/zod/v4/core/regexes.cjs.map +0 -1
  263. package/dist/node_modules/zod/v4/core/regexes.js +0 -86
  264. package/dist/node_modules/zod/v4/core/regexes.js.map +0 -1
  265. package/dist/node_modules/zod/v4/core/registries.cjs +0 -52
  266. package/dist/node_modules/zod/v4/core/registries.cjs.map +0 -1
  267. package/dist/node_modules/zod/v4/core/registries.js +0 -52
  268. package/dist/node_modules/zod/v4/core/registries.js.map +0 -1
  269. package/dist/node_modules/zod/v4/core/schemas.cjs +0 -1412
  270. package/dist/node_modules/zod/v4/core/schemas.cjs.map +0 -1
  271. package/dist/node_modules/zod/v4/core/schemas.js +0 -1413
  272. package/dist/node_modules/zod/v4/core/schemas.js.map +0 -1
  273. package/dist/node_modules/zod/v4/core/to-json-schema.cjs +0 -370
  274. package/dist/node_modules/zod/v4/core/to-json-schema.cjs.map +0 -1
  275. package/dist/node_modules/zod/v4/core/to-json-schema.js +0 -370
  276. package/dist/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
  277. package/dist/node_modules/zod/v4/core/util.cjs +0 -444
  278. package/dist/node_modules/zod/v4/core/util.cjs.map +0 -1
  279. package/dist/node_modules/zod/v4/core/util.js +0 -444
  280. package/dist/node_modules/zod/v4/core/util.js.map +0 -1
  281. package/dist/node_modules/zod/v4/core/versions.cjs +0 -9
  282. package/dist/node_modules/zod/v4/core/versions.cjs.map +0 -1
  283. package/dist/node_modules/zod/v4/core/versions.js +0 -9
  284. package/dist/node_modules/zod/v4/core/versions.js.map +0 -1
  285. package/dist/packages/agent-runtime/src/thread-handoff.cjs +0 -85
  286. package/dist/packages/agent-runtime/src/thread-handoff.cjs.map +0 -1
  287. package/dist/packages/agent-runtime/src/thread-handoff.js +0 -85
  288. package/dist/packages/agent-runtime/src/thread-handoff.js.map +0 -1
@@ -1,1413 +0,0 @@
1
- import { $ZodCheckStringFormat, $ZodCheckNumberFormat, $ZodCheck } from "./checks.js";
2
- import { $constructor, globalConfig, $ZodAsyncError, config, $ZodEncodeError } from "./core.js";
3
- import { Doc } from "./doc.js";
4
- import { safeParse, safeParseAsync } from "./parse.js";
5
- import { string, boolean, datetime, date, time, duration, email, guid, uuid, httpProtocol, emoji, nanoid, cuid, cuid2, ulid, xid, ksuid, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, e164, number } from "./regexes.js";
6
- import { allowsEval, cached, esc, isObject, defineLazy, getEnumValues, propertyKeyTypes, escapeRegex, aborted, explicitlyAborted, cleanRegex, prefixIssues, finalizeIssue, optionalKeys, isPlainObject, issue } from "./util.js";
7
- import { clone } from "./util.js";
8
- import { version } from "./versions.js";
9
- const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
10
- var _a2;
11
- var _a;
12
- inst ?? (inst = {});
13
- inst._zod.def = def;
14
- inst._zod.bag = inst._zod.bag || {};
15
- inst._zod.version = version;
16
- const checks = [...inst._zod.def.checks ?? []];
17
- if (inst._zod.traits.has("$ZodCheck")) {
18
- checks.unshift(inst);
19
- }
20
- for (const ch of checks) {
21
- for (const fn of ch._zod.onattach) {
22
- fn(inst);
23
- }
24
- }
25
- if (checks.length === 0) {
26
- (_a = inst._zod).deferred ?? (_a.deferred = []);
27
- (_a2 = inst._zod.deferred) == null ? void 0 : _a2.push(() => {
28
- inst._zod.run = inst._zod.parse;
29
- });
30
- } else {
31
- const runChecks = (payload, checks2, ctx) => {
32
- let isAborted = aborted(payload);
33
- let asyncResult;
34
- for (const ch of checks2) {
35
- if (ch._zod.def.when) {
36
- if (explicitlyAborted(payload))
37
- continue;
38
- const shouldRun = ch._zod.def.when(payload);
39
- if (!shouldRun)
40
- continue;
41
- } else if (isAborted) {
42
- continue;
43
- }
44
- const currLen = payload.issues.length;
45
- const _ = ch._zod.check(payload);
46
- if (_ instanceof Promise && (ctx == null ? void 0 : ctx.async) === false) {
47
- throw new $ZodAsyncError();
48
- }
49
- if (asyncResult || _ instanceof Promise) {
50
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
51
- await _;
52
- const nextLen = payload.issues.length;
53
- if (nextLen === currLen)
54
- return;
55
- if (!isAborted)
56
- isAborted = aborted(payload, currLen);
57
- });
58
- } else {
59
- const nextLen = payload.issues.length;
60
- if (nextLen === currLen)
61
- continue;
62
- if (!isAborted)
63
- isAborted = aborted(payload, currLen);
64
- }
65
- }
66
- if (asyncResult) {
67
- return asyncResult.then(() => {
68
- return payload;
69
- });
70
- }
71
- return payload;
72
- };
73
- const handleCanaryResult = (canary, payload, ctx) => {
74
- if (aborted(canary)) {
75
- canary.aborted = true;
76
- return canary;
77
- }
78
- const checkResult = runChecks(payload, checks, ctx);
79
- if (checkResult instanceof Promise) {
80
- if (ctx.async === false)
81
- throw new $ZodAsyncError();
82
- return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
83
- }
84
- return inst._zod.parse(checkResult, ctx);
85
- };
86
- inst._zod.run = (payload, ctx) => {
87
- if (ctx.skipChecks) {
88
- return inst._zod.parse(payload, ctx);
89
- }
90
- if (ctx.direction === "backward") {
91
- const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
92
- if (canary instanceof Promise) {
93
- return canary.then((canary2) => {
94
- return handleCanaryResult(canary2, payload, ctx);
95
- });
96
- }
97
- return handleCanaryResult(canary, payload, ctx);
98
- }
99
- const result = inst._zod.parse(payload, ctx);
100
- if (result instanceof Promise) {
101
- if (ctx.async === false)
102
- throw new $ZodAsyncError();
103
- return result.then((result2) => runChecks(result2, checks, ctx));
104
- }
105
- return runChecks(result, checks, ctx);
106
- };
107
- }
108
- defineLazy(inst, "~standard", () => ({
109
- validate: (value) => {
110
- var _a3;
111
- try {
112
- const r = safeParse(inst, value);
113
- return r.success ? { value: r.data } : { issues: (_a3 = r.error) == null ? void 0 : _a3.issues };
114
- } catch (_) {
115
- return safeParseAsync(inst, value).then((r) => {
116
- var _a4;
117
- return r.success ? { value: r.data } : { issues: (_a4 = r.error) == null ? void 0 : _a4.issues };
118
- });
119
- }
120
- },
121
- vendor: "zod",
122
- version: 1
123
- }));
124
- });
125
- const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
126
- var _a;
127
- $ZodType.init(inst, def);
128
- inst._zod.pattern = [...((_a = inst == null ? void 0 : inst._zod.bag) == null ? void 0 : _a.patterns) ?? []].pop() ?? string(inst._zod.bag);
129
- inst._zod.parse = (payload, _) => {
130
- if (def.coerce)
131
- try {
132
- payload.value = String(payload.value);
133
- } catch (_2) {
134
- }
135
- if (typeof payload.value === "string")
136
- return payload;
137
- payload.issues.push({
138
- expected: "string",
139
- code: "invalid_type",
140
- input: payload.value,
141
- inst
142
- });
143
- return payload;
144
- };
145
- });
146
- const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
147
- $ZodCheckStringFormat.init(inst, def);
148
- $ZodString.init(inst, def);
149
- });
150
- const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
151
- def.pattern ?? (def.pattern = guid);
152
- $ZodStringFormat.init(inst, def);
153
- });
154
- const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
155
- if (def.version) {
156
- const versionMap = {
157
- v1: 1,
158
- v2: 2,
159
- v3: 3,
160
- v4: 4,
161
- v5: 5,
162
- v6: 6,
163
- v7: 7,
164
- v8: 8
165
- };
166
- const v = versionMap[def.version];
167
- if (v === void 0)
168
- throw new Error(`Invalid UUID version: "${def.version}"`);
169
- def.pattern ?? (def.pattern = uuid(v));
170
- } else
171
- def.pattern ?? (def.pattern = uuid());
172
- $ZodStringFormat.init(inst, def);
173
- });
174
- const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
175
- def.pattern ?? (def.pattern = email);
176
- $ZodStringFormat.init(inst, def);
177
- });
178
- const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
179
- $ZodStringFormat.init(inst, def);
180
- inst._zod.check = (payload) => {
181
- var _a;
182
- try {
183
- const trimmed = payload.value.trim();
184
- if (!def.normalize && ((_a = def.protocol) == null ? void 0 : _a.source) === httpProtocol.source) {
185
- if (!/^https?:\/\//i.test(trimmed)) {
186
- payload.issues.push({
187
- code: "invalid_format",
188
- format: "url",
189
- note: "Invalid URL format",
190
- input: payload.value,
191
- inst,
192
- continue: !def.abort
193
- });
194
- return;
195
- }
196
- }
197
- const url = new URL(trimmed);
198
- if (def.hostname) {
199
- def.hostname.lastIndex = 0;
200
- if (!def.hostname.test(url.hostname)) {
201
- payload.issues.push({
202
- code: "invalid_format",
203
- format: "url",
204
- note: "Invalid hostname",
205
- pattern: def.hostname.source,
206
- input: payload.value,
207
- inst,
208
- continue: !def.abort
209
- });
210
- }
211
- }
212
- if (def.protocol) {
213
- def.protocol.lastIndex = 0;
214
- if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
215
- payload.issues.push({
216
- code: "invalid_format",
217
- format: "url",
218
- note: "Invalid protocol",
219
- pattern: def.protocol.source,
220
- input: payload.value,
221
- inst,
222
- continue: !def.abort
223
- });
224
- }
225
- }
226
- if (def.normalize) {
227
- payload.value = url.href;
228
- } else {
229
- payload.value = trimmed;
230
- }
231
- return;
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
- const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
244
- def.pattern ?? (def.pattern = emoji());
245
- $ZodStringFormat.init(inst, def);
246
- });
247
- const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
248
- def.pattern ?? (def.pattern = nanoid);
249
- $ZodStringFormat.init(inst, def);
250
- });
251
- const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
252
- def.pattern ?? (def.pattern = cuid);
253
- $ZodStringFormat.init(inst, def);
254
- });
255
- const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
256
- def.pattern ?? (def.pattern = cuid2);
257
- $ZodStringFormat.init(inst, def);
258
- });
259
- const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
260
- def.pattern ?? (def.pattern = ulid);
261
- $ZodStringFormat.init(inst, def);
262
- });
263
- const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
264
- def.pattern ?? (def.pattern = xid);
265
- $ZodStringFormat.init(inst, def);
266
- });
267
- const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
268
- def.pattern ?? (def.pattern = ksuid);
269
- $ZodStringFormat.init(inst, def);
270
- });
271
- const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
272
- def.pattern ?? (def.pattern = datetime(def));
273
- $ZodStringFormat.init(inst, def);
274
- });
275
- const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
276
- def.pattern ?? (def.pattern = date);
277
- $ZodStringFormat.init(inst, def);
278
- });
279
- const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
280
- def.pattern ?? (def.pattern = time(def));
281
- $ZodStringFormat.init(inst, def);
282
- });
283
- const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
284
- def.pattern ?? (def.pattern = duration);
285
- $ZodStringFormat.init(inst, def);
286
- });
287
- const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
288
- def.pattern ?? (def.pattern = ipv4);
289
- $ZodStringFormat.init(inst, def);
290
- inst._zod.bag.format = `ipv4`;
291
- });
292
- const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
293
- def.pattern ?? (def.pattern = ipv6);
294
- $ZodStringFormat.init(inst, def);
295
- inst._zod.bag.format = `ipv6`;
296
- inst._zod.check = (payload) => {
297
- try {
298
- new URL(`http://[${payload.value}]`);
299
- } catch {
300
- payload.issues.push({
301
- code: "invalid_format",
302
- format: "ipv6",
303
- input: payload.value,
304
- inst,
305
- continue: !def.abort
306
- });
307
- }
308
- };
309
- });
310
- const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
311
- def.pattern ?? (def.pattern = cidrv4);
312
- $ZodStringFormat.init(inst, def);
313
- });
314
- const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
315
- def.pattern ?? (def.pattern = cidrv6);
316
- $ZodStringFormat.init(inst, def);
317
- inst._zod.check = (payload) => {
318
- const parts = payload.value.split("/");
319
- try {
320
- if (parts.length !== 2)
321
- throw new Error();
322
- const [address, prefix] = parts;
323
- if (!prefix)
324
- throw new Error();
325
- const prefixNum = Number(prefix);
326
- if (`${prefixNum}` !== prefix)
327
- throw new Error();
328
- if (prefixNum < 0 || prefixNum > 128)
329
- throw new Error();
330
- new URL(`http://[${address}]`);
331
- } catch {
332
- payload.issues.push({
333
- code: "invalid_format",
334
- format: "cidrv6",
335
- input: payload.value,
336
- inst,
337
- continue: !def.abort
338
- });
339
- }
340
- };
341
- });
342
- function isValidBase64(data) {
343
- if (data === "")
344
- return true;
345
- if (/\s/.test(data))
346
- return false;
347
- if (data.length % 4 !== 0)
348
- return false;
349
- try {
350
- atob(data);
351
- return true;
352
- } catch {
353
- return false;
354
- }
355
- }
356
- const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
357
- def.pattern ?? (def.pattern = base64);
358
- $ZodStringFormat.init(inst, def);
359
- inst._zod.bag.contentEncoding = "base64";
360
- inst._zod.check = (payload) => {
361
- if (isValidBase64(payload.value))
362
- return;
363
- payload.issues.push({
364
- code: "invalid_format",
365
- format: "base64",
366
- input: payload.value,
367
- inst,
368
- continue: !def.abort
369
- });
370
- };
371
- });
372
- function isValidBase64URL(data) {
373
- if (!base64url.test(data))
374
- return false;
375
- const base642 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
376
- const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
377
- return isValidBase64(padded);
378
- }
379
- const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
380
- def.pattern ?? (def.pattern = base64url);
381
- $ZodStringFormat.init(inst, def);
382
- inst._zod.bag.contentEncoding = "base64url";
383
- inst._zod.check = (payload) => {
384
- if (isValidBase64URL(payload.value))
385
- return;
386
- payload.issues.push({
387
- code: "invalid_format",
388
- format: "base64url",
389
- input: payload.value,
390
- inst,
391
- continue: !def.abort
392
- });
393
- };
394
- });
395
- const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
396
- def.pattern ?? (def.pattern = e164);
397
- $ZodStringFormat.init(inst, def);
398
- });
399
- function isValidJWT(token, algorithm = null) {
400
- try {
401
- const tokensParts = token.split(".");
402
- if (tokensParts.length !== 3)
403
- return false;
404
- const [header] = tokensParts;
405
- if (!header)
406
- return false;
407
- const parsedHeader = JSON.parse(atob(header));
408
- if ("typ" in parsedHeader && (parsedHeader == null ? void 0 : parsedHeader.typ) !== "JWT")
409
- return false;
410
- if (!parsedHeader.alg)
411
- return false;
412
- if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
413
- return false;
414
- return true;
415
- } catch {
416
- return false;
417
- }
418
- }
419
- const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
420
- $ZodStringFormat.init(inst, def);
421
- inst._zod.check = (payload) => {
422
- if (isValidJWT(payload.value, def.alg))
423
- return;
424
- payload.issues.push({
425
- code: "invalid_format",
426
- format: "jwt",
427
- input: payload.value,
428
- inst,
429
- continue: !def.abort
430
- });
431
- };
432
- });
433
- const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
434
- $ZodType.init(inst, def);
435
- inst._zod.pattern = inst._zod.bag.pattern ?? number;
436
- inst._zod.parse = (payload, _ctx) => {
437
- if (def.coerce)
438
- try {
439
- payload.value = Number(payload.value);
440
- } catch (_) {
441
- }
442
- const input = payload.value;
443
- if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
444
- return payload;
445
- }
446
- const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
447
- payload.issues.push({
448
- expected: "number",
449
- code: "invalid_type",
450
- input,
451
- inst,
452
- ...received ? { received } : {}
453
- });
454
- return payload;
455
- };
456
- });
457
- const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
458
- $ZodCheckNumberFormat.init(inst, def);
459
- $ZodNumber.init(inst, def);
460
- });
461
- const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
462
- $ZodType.init(inst, def);
463
- inst._zod.pattern = boolean;
464
- inst._zod.parse = (payload, _ctx) => {
465
- if (def.coerce)
466
- try {
467
- payload.value = Boolean(payload.value);
468
- } catch (_) {
469
- }
470
- const input = payload.value;
471
- if (typeof input === "boolean")
472
- return payload;
473
- payload.issues.push({
474
- expected: "boolean",
475
- code: "invalid_type",
476
- input,
477
- inst
478
- });
479
- return payload;
480
- };
481
- });
482
- const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
483
- $ZodType.init(inst, def);
484
- inst._zod.parse = (payload) => payload;
485
- });
486
- const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
487
- $ZodType.init(inst, def);
488
- inst._zod.parse = (payload, _ctx) => {
489
- payload.issues.push({
490
- expected: "never",
491
- code: "invalid_type",
492
- input: payload.value,
493
- inst
494
- });
495
- return payload;
496
- };
497
- });
498
- function handleArrayResult(result, final, index) {
499
- if (result.issues.length) {
500
- final.issues.push(...prefixIssues(index, result.issues));
501
- }
502
- final.value[index] = result.value;
503
- }
504
- const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
505
- $ZodType.init(inst, def);
506
- inst._zod.parse = (payload, ctx) => {
507
- const input = payload.value;
508
- if (!Array.isArray(input)) {
509
- payload.issues.push({
510
- expected: "array",
511
- code: "invalid_type",
512
- input,
513
- inst
514
- });
515
- return payload;
516
- }
517
- payload.value = Array(input.length);
518
- const proms = [];
519
- for (let i = 0; i < input.length; i++) {
520
- const item = input[i];
521
- const result = def.element._zod.run({
522
- value: item,
523
- issues: []
524
- }, ctx);
525
- if (result instanceof Promise) {
526
- proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
527
- } else {
528
- handleArrayResult(result, payload, i);
529
- }
530
- }
531
- if (proms.length) {
532
- return Promise.all(proms).then(() => payload);
533
- }
534
- return payload;
535
- };
536
- });
537
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
538
- const isPresent = key in input;
539
- if (result.issues.length) {
540
- if (isOptionalIn && isOptionalOut && !isPresent) {
541
- return;
542
- }
543
- final.issues.push(...prefixIssues(key, result.issues));
544
- }
545
- if (!isPresent && !isOptionalIn) {
546
- if (!result.issues.length) {
547
- final.issues.push({
548
- code: "invalid_type",
549
- expected: "nonoptional",
550
- input: void 0,
551
- path: [key]
552
- });
553
- }
554
- return;
555
- }
556
- if (result.value === void 0) {
557
- if (isPresent) {
558
- final.value[key] = void 0;
559
- }
560
- } else {
561
- final.value[key] = result.value;
562
- }
563
- }
564
- function normalizeDef(def) {
565
- var _a, _b, _c, _d;
566
- const keys = Object.keys(def.shape);
567
- for (const k of keys) {
568
- if (!((_d = (_c = (_b = (_a = def.shape) == null ? void 0 : _a[k]) == null ? void 0 : _b._zod) == null ? void 0 : _c.traits) == null ? void 0 : _d.has("$ZodType"))) {
569
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
570
- }
571
- }
572
- const okeys = optionalKeys(def.shape);
573
- return {
574
- ...def,
575
- keys,
576
- keySet: new Set(keys),
577
- numKeys: keys.length,
578
- optionalKeys: new Set(okeys)
579
- };
580
- }
581
- function handleCatchall(proms, input, payload, ctx, def, inst) {
582
- const unrecognized = [];
583
- const keySet = def.keySet;
584
- const _catchall = def.catchall._zod;
585
- const t = _catchall.def.type;
586
- const isOptionalIn = _catchall.optin === "optional";
587
- const isOptionalOut = _catchall.optout === "optional";
588
- for (const key in input) {
589
- if (key === "__proto__")
590
- continue;
591
- if (keySet.has(key))
592
- continue;
593
- if (t === "never") {
594
- unrecognized.push(key);
595
- continue;
596
- }
597
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
598
- if (r instanceof Promise) {
599
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
600
- } else {
601
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
602
- }
603
- }
604
- if (unrecognized.length) {
605
- payload.issues.push({
606
- code: "unrecognized_keys",
607
- keys: unrecognized,
608
- input,
609
- inst
610
- });
611
- }
612
- if (!proms.length)
613
- return payload;
614
- return Promise.all(proms).then(() => {
615
- return payload;
616
- });
617
- }
618
- const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
619
- $ZodType.init(inst, def);
620
- const desc = Object.getOwnPropertyDescriptor(def, "shape");
621
- if (!(desc == null ? void 0 : desc.get)) {
622
- const sh = def.shape;
623
- Object.defineProperty(def, "shape", {
624
- get: () => {
625
- const newSh = { ...sh };
626
- Object.defineProperty(def, "shape", {
627
- value: newSh
628
- });
629
- return newSh;
630
- }
631
- });
632
- }
633
- const _normalized = cached(() => normalizeDef(def));
634
- defineLazy(inst._zod, "propValues", () => {
635
- const shape = def.shape;
636
- const propValues = {};
637
- for (const key in shape) {
638
- const field = shape[key]._zod;
639
- if (field.values) {
640
- propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
641
- for (const v of field.values)
642
- propValues[key].add(v);
643
- }
644
- }
645
- return propValues;
646
- });
647
- const isObject$1 = isObject;
648
- const catchall = def.catchall;
649
- let value;
650
- inst._zod.parse = (payload, ctx) => {
651
- value ?? (value = _normalized.value);
652
- const input = payload.value;
653
- if (!isObject$1(input)) {
654
- payload.issues.push({
655
- expected: "object",
656
- code: "invalid_type",
657
- input,
658
- inst
659
- });
660
- return payload;
661
- }
662
- payload.value = {};
663
- const proms = [];
664
- const shape = value.shape;
665
- for (const key of value.keys) {
666
- const el = shape[key];
667
- const isOptionalIn = el._zod.optin === "optional";
668
- const isOptionalOut = el._zod.optout === "optional";
669
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
670
- if (r instanceof Promise) {
671
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
672
- } else {
673
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
674
- }
675
- }
676
- if (!catchall) {
677
- return proms.length ? Promise.all(proms).then(() => payload) : payload;
678
- }
679
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
680
- };
681
- });
682
- const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
683
- $ZodObject.init(inst, def);
684
- const superParse = inst._zod.parse;
685
- const _normalized = cached(() => normalizeDef(def));
686
- const generateFastpass = (shape) => {
687
- var _a, _b;
688
- const doc = new Doc(["shape", "payload", "ctx"]);
689
- const normalized = _normalized.value;
690
- const parseStr = (key) => {
691
- const k = esc(key);
692
- return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
693
- };
694
- doc.write(`const input = payload.value;`);
695
- const ids = /* @__PURE__ */ Object.create(null);
696
- let counter = 0;
697
- for (const key of normalized.keys) {
698
- ids[key] = `key_${counter++}`;
699
- }
700
- doc.write(`const newResult = {};`);
701
- for (const key of normalized.keys) {
702
- const id = ids[key];
703
- const k = esc(key);
704
- const schema = shape[key];
705
- const isOptionalIn = ((_a = schema == null ? void 0 : schema._zod) == null ? void 0 : _a.optin) === "optional";
706
- const isOptionalOut = ((_b = schema == null ? void 0 : schema._zod) == null ? void 0 : _b.optout) === "optional";
707
- doc.write(`const ${id} = ${parseStr(key)};`);
708
- if (isOptionalIn && isOptionalOut) {
709
- doc.write(`
710
- if (${id}.issues.length) {
711
- if (${k} in input) {
712
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
713
- ...iss,
714
- path: iss.path ? [${k}, ...iss.path] : [${k}]
715
- })));
716
- }
717
- }
718
-
719
- if (${id}.value === undefined) {
720
- if (${k} in input) {
721
- newResult[${k}] = undefined;
722
- }
723
- } else {
724
- newResult[${k}] = ${id}.value;
725
- }
726
-
727
- `);
728
- } else if (!isOptionalIn) {
729
- doc.write(`
730
- const ${id}_present = ${k} in input;
731
- if (${id}.issues.length) {
732
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
733
- ...iss,
734
- path: iss.path ? [${k}, ...iss.path] : [${k}]
735
- })));
736
- }
737
- if (!${id}_present && !${id}.issues.length) {
738
- payload.issues.push({
739
- code: "invalid_type",
740
- expected: "nonoptional",
741
- input: undefined,
742
- path: [${k}]
743
- });
744
- }
745
-
746
- if (${id}_present) {
747
- if (${id}.value === undefined) {
748
- newResult[${k}] = undefined;
749
- } else {
750
- newResult[${k}] = ${id}.value;
751
- }
752
- }
753
-
754
- `);
755
- } else {
756
- doc.write(`
757
- if (${id}.issues.length) {
758
- payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
759
- ...iss,
760
- path: iss.path ? [${k}, ...iss.path] : [${k}]
761
- })));
762
- }
763
-
764
- if (${id}.value === undefined) {
765
- if (${k} in input) {
766
- newResult[${k}] = undefined;
767
- }
768
- } else {
769
- newResult[${k}] = ${id}.value;
770
- }
771
-
772
- `);
773
- }
774
- }
775
- doc.write(`payload.value = newResult;`);
776
- doc.write(`return payload;`);
777
- const fn = doc.compile();
778
- return (payload, ctx) => fn(shape, payload, ctx);
779
- };
780
- let fastpass;
781
- const isObject$1 = isObject;
782
- const jit = !globalConfig.jitless;
783
- const allowsEval$1 = allowsEval;
784
- const fastEnabled = jit && allowsEval$1.value;
785
- const catchall = def.catchall;
786
- let value;
787
- inst._zod.parse = (payload, ctx) => {
788
- value ?? (value = _normalized.value);
789
- const input = payload.value;
790
- if (!isObject$1(input)) {
791
- payload.issues.push({
792
- expected: "object",
793
- code: "invalid_type",
794
- input,
795
- inst
796
- });
797
- return payload;
798
- }
799
- if (jit && fastEnabled && (ctx == null ? void 0 : ctx.async) === false && ctx.jitless !== true) {
800
- if (!fastpass)
801
- fastpass = generateFastpass(def.shape);
802
- payload = fastpass(payload, ctx);
803
- if (!catchall)
804
- return payload;
805
- return handleCatchall([], input, payload, ctx, value, inst);
806
- }
807
- return superParse(payload, ctx);
808
- };
809
- });
810
- function handleUnionResults(results, final, inst, ctx) {
811
- for (const result of results) {
812
- if (result.issues.length === 0) {
813
- final.value = result.value;
814
- return final;
815
- }
816
- }
817
- const nonaborted = results.filter((r) => !aborted(r));
818
- if (nonaborted.length === 1) {
819
- final.value = nonaborted[0].value;
820
- return nonaborted[0];
821
- }
822
- final.issues.push({
823
- code: "invalid_union",
824
- input: final.value,
825
- inst,
826
- errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
827
- });
828
- return final;
829
- }
830
- const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
831
- $ZodType.init(inst, def);
832
- defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
833
- defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
834
- defineLazy(inst._zod, "values", () => {
835
- if (def.options.every((o) => o._zod.values)) {
836
- return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
837
- }
838
- return void 0;
839
- });
840
- defineLazy(inst._zod, "pattern", () => {
841
- if (def.options.every((o) => o._zod.pattern)) {
842
- const patterns = def.options.map((o) => o._zod.pattern);
843
- return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
844
- }
845
- return void 0;
846
- });
847
- const first = def.options.length === 1 ? def.options[0]._zod.run : null;
848
- inst._zod.parse = (payload, ctx) => {
849
- if (first) {
850
- return first(payload, ctx);
851
- }
852
- let async = false;
853
- const results = [];
854
- for (const option of def.options) {
855
- const result = option._zod.run({
856
- value: payload.value,
857
- issues: []
858
- }, ctx);
859
- if (result instanceof Promise) {
860
- results.push(result);
861
- async = true;
862
- } else {
863
- if (result.issues.length === 0)
864
- return result;
865
- results.push(result);
866
- }
867
- }
868
- if (!async)
869
- return handleUnionResults(results, payload, inst, ctx);
870
- return Promise.all(results).then((results2) => {
871
- return handleUnionResults(results2, payload, inst, ctx);
872
- });
873
- };
874
- });
875
- const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
876
- def.inclusive = false;
877
- $ZodUnion.init(inst, def);
878
- const _super = inst._zod.parse;
879
- defineLazy(inst._zod, "propValues", () => {
880
- const propValues = {};
881
- for (const option of def.options) {
882
- const pv = option._zod.propValues;
883
- if (!pv || Object.keys(pv).length === 0)
884
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
885
- for (const [k, v] of Object.entries(pv)) {
886
- if (!propValues[k])
887
- propValues[k] = /* @__PURE__ */ new Set();
888
- for (const val of v) {
889
- propValues[k].add(val);
890
- }
891
- }
892
- }
893
- return propValues;
894
- });
895
- const disc = cached(() => {
896
- var _a;
897
- const opts = def.options;
898
- const map = /* @__PURE__ */ new Map();
899
- for (const o of opts) {
900
- const values = (_a = o._zod.propValues) == null ? void 0 : _a[def.discriminator];
901
- if (!values || values.size === 0)
902
- throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
903
- for (const v of values) {
904
- if (map.has(v)) {
905
- throw new Error(`Duplicate discriminator value "${String(v)}"`);
906
- }
907
- map.set(v, o);
908
- }
909
- }
910
- return map;
911
- });
912
- inst._zod.parse = (payload, ctx) => {
913
- const input = payload.value;
914
- if (!isObject(input)) {
915
- payload.issues.push({
916
- code: "invalid_type",
917
- expected: "object",
918
- input,
919
- inst
920
- });
921
- return payload;
922
- }
923
- const opt = disc.value.get(input == null ? void 0 : input[def.discriminator]);
924
- if (opt) {
925
- return opt._zod.run(payload, ctx);
926
- }
927
- if (def.unionFallback || ctx.direction === "backward") {
928
- return _super(payload, ctx);
929
- }
930
- payload.issues.push({
931
- code: "invalid_union",
932
- errors: [],
933
- note: "No matching discriminator",
934
- discriminator: def.discriminator,
935
- options: Array.from(disc.value.keys()),
936
- input,
937
- path: [def.discriminator],
938
- inst
939
- });
940
- return payload;
941
- };
942
- });
943
- const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
944
- $ZodType.init(inst, def);
945
- inst._zod.parse = (payload, ctx) => {
946
- const input = payload.value;
947
- const left = def.left._zod.run({ value: input, issues: [] }, ctx);
948
- const right = def.right._zod.run({ value: input, issues: [] }, ctx);
949
- const async = left instanceof Promise || right instanceof Promise;
950
- if (async) {
951
- return Promise.all([left, right]).then(([left2, right2]) => {
952
- return handleIntersectionResults(payload, left2, right2);
953
- });
954
- }
955
- return handleIntersectionResults(payload, left, right);
956
- };
957
- });
958
- function mergeValues(a, b) {
959
- if (a === b) {
960
- return { valid: true, data: a };
961
- }
962
- if (a instanceof Date && b instanceof Date && +a === +b) {
963
- return { valid: true, data: a };
964
- }
965
- if (isPlainObject(a) && isPlainObject(b)) {
966
- const bKeys = Object.keys(b);
967
- const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
968
- const newObj = { ...a, ...b };
969
- for (const key of sharedKeys) {
970
- const sharedValue = mergeValues(a[key], b[key]);
971
- if (!sharedValue.valid) {
972
- return {
973
- valid: false,
974
- mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
975
- };
976
- }
977
- newObj[key] = sharedValue.data;
978
- }
979
- return { valid: true, data: newObj };
980
- }
981
- if (Array.isArray(a) && Array.isArray(b)) {
982
- if (a.length !== b.length) {
983
- return { valid: false, mergeErrorPath: [] };
984
- }
985
- const newArray = [];
986
- for (let index = 0; index < a.length; index++) {
987
- const itemA = a[index];
988
- const itemB = b[index];
989
- const sharedValue = mergeValues(itemA, itemB);
990
- if (!sharedValue.valid) {
991
- return {
992
- valid: false,
993
- mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
994
- };
995
- }
996
- newArray.push(sharedValue.data);
997
- }
998
- return { valid: true, data: newArray };
999
- }
1000
- return { valid: false, mergeErrorPath: [] };
1001
- }
1002
- function handleIntersectionResults(result, left, right) {
1003
- const unrecKeys = /* @__PURE__ */ new Map();
1004
- let unrecIssue;
1005
- for (const iss of left.issues) {
1006
- if (iss.code === "unrecognized_keys") {
1007
- unrecIssue ?? (unrecIssue = iss);
1008
- for (const k of iss.keys) {
1009
- if (!unrecKeys.has(k))
1010
- unrecKeys.set(k, {});
1011
- unrecKeys.get(k).l = true;
1012
- }
1013
- } else {
1014
- result.issues.push(iss);
1015
- }
1016
- }
1017
- for (const iss of right.issues) {
1018
- if (iss.code === "unrecognized_keys") {
1019
- for (const k of iss.keys) {
1020
- if (!unrecKeys.has(k))
1021
- unrecKeys.set(k, {});
1022
- unrecKeys.get(k).r = true;
1023
- }
1024
- } else {
1025
- result.issues.push(iss);
1026
- }
1027
- }
1028
- const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
1029
- if (bothKeys.length && unrecIssue) {
1030
- result.issues.push({ ...unrecIssue, keys: bothKeys });
1031
- }
1032
- if (aborted(result))
1033
- return result;
1034
- const merged = mergeValues(left.value, right.value);
1035
- if (!merged.valid) {
1036
- throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
1037
- }
1038
- result.value = merged.data;
1039
- return result;
1040
- }
1041
- const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
1042
- $ZodType.init(inst, def);
1043
- const values = getEnumValues(def.entries);
1044
- const valuesSet = new Set(values);
1045
- inst._zod.values = valuesSet;
1046
- inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
1047
- inst._zod.parse = (payload, _ctx) => {
1048
- const input = payload.value;
1049
- if (valuesSet.has(input)) {
1050
- return payload;
1051
- }
1052
- payload.issues.push({
1053
- code: "invalid_value",
1054
- values,
1055
- input,
1056
- inst
1057
- });
1058
- return payload;
1059
- };
1060
- });
1061
- const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
1062
- $ZodType.init(inst, def);
1063
- if (def.values.length === 0) {
1064
- throw new Error("Cannot create literal schema with no valid values");
1065
- }
1066
- const values = new Set(def.values);
1067
- inst._zod.values = values;
1068
- inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
1069
- inst._zod.parse = (payload, _ctx) => {
1070
- const input = payload.value;
1071
- if (values.has(input)) {
1072
- return payload;
1073
- }
1074
- payload.issues.push({
1075
- code: "invalid_value",
1076
- values: def.values,
1077
- input,
1078
- inst
1079
- });
1080
- return payload;
1081
- };
1082
- });
1083
- const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
1084
- $ZodType.init(inst, def);
1085
- inst._zod.optin = "optional";
1086
- inst._zod.parse = (payload, ctx) => {
1087
- if (ctx.direction === "backward") {
1088
- throw new $ZodEncodeError(inst.constructor.name);
1089
- }
1090
- const _out = def.transform(payload.value, payload);
1091
- if (ctx.async) {
1092
- const output = _out instanceof Promise ? _out : Promise.resolve(_out);
1093
- return output.then((output2) => {
1094
- payload.value = output2;
1095
- payload.fallback = true;
1096
- return payload;
1097
- });
1098
- }
1099
- if (_out instanceof Promise) {
1100
- throw new $ZodAsyncError();
1101
- }
1102
- payload.value = _out;
1103
- payload.fallback = true;
1104
- return payload;
1105
- };
1106
- });
1107
- function handleOptionalResult(result, input) {
1108
- if (input === void 0 && (result.issues.length || result.fallback)) {
1109
- return { issues: [], value: void 0 };
1110
- }
1111
- return result;
1112
- }
1113
- const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
1114
- $ZodType.init(inst, def);
1115
- inst._zod.optin = "optional";
1116
- inst._zod.optout = "optional";
1117
- defineLazy(inst._zod, "values", () => {
1118
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
1119
- });
1120
- defineLazy(inst._zod, "pattern", () => {
1121
- const pattern = def.innerType._zod.pattern;
1122
- return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
1123
- });
1124
- inst._zod.parse = (payload, ctx) => {
1125
- if (def.innerType._zod.optin === "optional") {
1126
- const input = payload.value;
1127
- const result = def.innerType._zod.run(payload, ctx);
1128
- if (result instanceof Promise)
1129
- return result.then((r) => handleOptionalResult(r, input));
1130
- return handleOptionalResult(result, input);
1131
- }
1132
- if (payload.value === void 0) {
1133
- return payload;
1134
- }
1135
- return def.innerType._zod.run(payload, ctx);
1136
- };
1137
- });
1138
- const $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
1139
- $ZodOptional.init(inst, def);
1140
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1141
- defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
1142
- inst._zod.parse = (payload, ctx) => {
1143
- return def.innerType._zod.run(payload, ctx);
1144
- };
1145
- });
1146
- const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
1147
- $ZodType.init(inst, def);
1148
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1149
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1150
- defineLazy(inst._zod, "pattern", () => {
1151
- const pattern = def.innerType._zod.pattern;
1152
- return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
1153
- });
1154
- defineLazy(inst._zod, "values", () => {
1155
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
1156
- });
1157
- inst._zod.parse = (payload, ctx) => {
1158
- if (payload.value === null)
1159
- return payload;
1160
- return def.innerType._zod.run(payload, ctx);
1161
- };
1162
- });
1163
- const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
1164
- $ZodType.init(inst, def);
1165
- inst._zod.optin = "optional";
1166
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1167
- inst._zod.parse = (payload, ctx) => {
1168
- if (ctx.direction === "backward") {
1169
- return def.innerType._zod.run(payload, ctx);
1170
- }
1171
- if (payload.value === void 0) {
1172
- payload.value = def.defaultValue;
1173
- return payload;
1174
- }
1175
- const result = def.innerType._zod.run(payload, ctx);
1176
- if (result instanceof Promise) {
1177
- return result.then((result2) => handleDefaultResult(result2, def));
1178
- }
1179
- return handleDefaultResult(result, def);
1180
- };
1181
- });
1182
- function handleDefaultResult(payload, def) {
1183
- if (payload.value === void 0) {
1184
- payload.value = def.defaultValue;
1185
- }
1186
- return payload;
1187
- }
1188
- const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
1189
- $ZodType.init(inst, def);
1190
- inst._zod.optin = "optional";
1191
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1192
- inst._zod.parse = (payload, ctx) => {
1193
- if (ctx.direction === "backward") {
1194
- return def.innerType._zod.run(payload, ctx);
1195
- }
1196
- if (payload.value === void 0) {
1197
- payload.value = def.defaultValue;
1198
- }
1199
- return def.innerType._zod.run(payload, ctx);
1200
- };
1201
- });
1202
- const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
1203
- $ZodType.init(inst, def);
1204
- defineLazy(inst._zod, "values", () => {
1205
- const v = def.innerType._zod.values;
1206
- return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
1207
- });
1208
- inst._zod.parse = (payload, ctx) => {
1209
- const result = def.innerType._zod.run(payload, ctx);
1210
- if (result instanceof Promise) {
1211
- return result.then((result2) => handleNonOptionalResult(result2, inst));
1212
- }
1213
- return handleNonOptionalResult(result, inst);
1214
- };
1215
- });
1216
- function handleNonOptionalResult(payload, inst) {
1217
- if (!payload.issues.length && payload.value === void 0) {
1218
- payload.issues.push({
1219
- code: "invalid_type",
1220
- expected: "nonoptional",
1221
- input: payload.value,
1222
- inst
1223
- });
1224
- }
1225
- return payload;
1226
- }
1227
- const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
1228
- $ZodType.init(inst, def);
1229
- inst._zod.optin = "optional";
1230
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1231
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1232
- inst._zod.parse = (payload, ctx) => {
1233
- if (ctx.direction === "backward") {
1234
- return def.innerType._zod.run(payload, ctx);
1235
- }
1236
- const result = def.innerType._zod.run(payload, ctx);
1237
- if (result instanceof Promise) {
1238
- return result.then((result2) => {
1239
- payload.value = result2.value;
1240
- if (result2.issues.length) {
1241
- payload.value = def.catchValue({
1242
- ...payload,
1243
- error: {
1244
- issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
1245
- },
1246
- input: payload.value
1247
- });
1248
- payload.issues = [];
1249
- payload.fallback = true;
1250
- }
1251
- return payload;
1252
- });
1253
- }
1254
- payload.value = result.value;
1255
- if (result.issues.length) {
1256
- payload.value = def.catchValue({
1257
- ...payload,
1258
- error: {
1259
- issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
1260
- },
1261
- input: payload.value
1262
- });
1263
- payload.issues = [];
1264
- payload.fallback = true;
1265
- }
1266
- return payload;
1267
- };
1268
- });
1269
- const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
1270
- $ZodType.init(inst, def);
1271
- defineLazy(inst._zod, "values", () => def.in._zod.values);
1272
- defineLazy(inst._zod, "optin", () => def.in._zod.optin);
1273
- defineLazy(inst._zod, "optout", () => def.out._zod.optout);
1274
- defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
1275
- inst._zod.parse = (payload, ctx) => {
1276
- if (ctx.direction === "backward") {
1277
- const right = def.out._zod.run(payload, ctx);
1278
- if (right instanceof Promise) {
1279
- return right.then((right2) => handlePipeResult(right2, def.in, ctx));
1280
- }
1281
- return handlePipeResult(right, def.in, ctx);
1282
- }
1283
- const left = def.in._zod.run(payload, ctx);
1284
- if (left instanceof Promise) {
1285
- return left.then((left2) => handlePipeResult(left2, def.out, ctx));
1286
- }
1287
- return handlePipeResult(left, def.out, ctx);
1288
- };
1289
- });
1290
- function handlePipeResult(left, next, ctx) {
1291
- if (left.issues.length) {
1292
- left.aborted = true;
1293
- return left;
1294
- }
1295
- return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
1296
- }
1297
- const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
1298
- $ZodType.init(inst, def);
1299
- defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
1300
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1301
- defineLazy(inst._zod, "optin", () => {
1302
- var _a, _b;
1303
- return (_b = (_a = def.innerType) == null ? void 0 : _a._zod) == null ? void 0 : _b.optin;
1304
- });
1305
- defineLazy(inst._zod, "optout", () => {
1306
- var _a, _b;
1307
- return (_b = (_a = def.innerType) == null ? void 0 : _a._zod) == null ? void 0 : _b.optout;
1308
- });
1309
- inst._zod.parse = (payload, ctx) => {
1310
- if (ctx.direction === "backward") {
1311
- return def.innerType._zod.run(payload, ctx);
1312
- }
1313
- const result = def.innerType._zod.run(payload, ctx);
1314
- if (result instanceof Promise) {
1315
- return result.then(handleReadonlyResult);
1316
- }
1317
- return handleReadonlyResult(result);
1318
- };
1319
- });
1320
- function handleReadonlyResult(payload) {
1321
- payload.value = Object.freeze(payload.value);
1322
- return payload;
1323
- }
1324
- const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
1325
- $ZodCheck.init(inst, def);
1326
- $ZodType.init(inst, def);
1327
- inst._zod.parse = (payload, _) => {
1328
- return payload;
1329
- };
1330
- inst._zod.check = (payload) => {
1331
- const input = payload.value;
1332
- const r = def.fn(input);
1333
- if (r instanceof Promise) {
1334
- return r.then((r2) => handleRefineResult(r2, payload, input, inst));
1335
- }
1336
- handleRefineResult(r, payload, input, inst);
1337
- return;
1338
- };
1339
- });
1340
- function handleRefineResult(result, payload, input, inst) {
1341
- if (!result) {
1342
- const _iss = {
1343
- code: "custom",
1344
- input,
1345
- inst,
1346
- // incorporates params.error into issue reporting
1347
- path: [...inst._zod.def.path ?? []],
1348
- // incorporates params.error into issue reporting
1349
- continue: !inst._zod.def.abort
1350
- // params: inst._zod.def.params,
1351
- };
1352
- if (inst._zod.def.params)
1353
- _iss.params = inst._zod.def.params;
1354
- payload.issues.push(issue(_iss));
1355
- }
1356
- }
1357
- export {
1358
- $ZodArray,
1359
- $ZodBase64,
1360
- $ZodBase64URL,
1361
- $ZodBoolean,
1362
- $ZodCIDRv4,
1363
- $ZodCIDRv6,
1364
- $ZodCUID,
1365
- $ZodCUID2,
1366
- $ZodCatch,
1367
- $ZodCustom,
1368
- $ZodDefault,
1369
- $ZodDiscriminatedUnion,
1370
- $ZodE164,
1371
- $ZodEmail,
1372
- $ZodEmoji,
1373
- $ZodEnum,
1374
- $ZodExactOptional,
1375
- $ZodGUID,
1376
- $ZodIPv4,
1377
- $ZodIPv6,
1378
- $ZodISODate,
1379
- $ZodISODateTime,
1380
- $ZodISODuration,
1381
- $ZodISOTime,
1382
- $ZodIntersection,
1383
- $ZodJWT,
1384
- $ZodKSUID,
1385
- $ZodLiteral,
1386
- $ZodNanoID,
1387
- $ZodNever,
1388
- $ZodNonOptional,
1389
- $ZodNullable,
1390
- $ZodNumber,
1391
- $ZodNumberFormat,
1392
- $ZodObject,
1393
- $ZodObjectJIT,
1394
- $ZodOptional,
1395
- $ZodPipe,
1396
- $ZodPrefault,
1397
- $ZodReadonly,
1398
- $ZodString,
1399
- $ZodStringFormat,
1400
- $ZodTransform,
1401
- $ZodType,
1402
- $ZodULID,
1403
- $ZodURL,
1404
- $ZodUUID,
1405
- $ZodUnion,
1406
- $ZodUnknown,
1407
- $ZodXID,
1408
- clone,
1409
- isValidBase64,
1410
- isValidBase64URL,
1411
- isValidJWT
1412
- };
1413
- //# sourceMappingURL=schemas.js.map