@athenaintel/react 0.20.0 → 0.21.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 (347) hide show
  1. package/README.md +74 -0
  2. package/dist/assets/use-asset-embed.cjs +8 -0
  3. package/dist/assets/use-asset-embed.cjs.map +1 -1
  4. package/dist/assets/use-asset-embed.js +8 -0
  5. package/dist/assets/use-asset-embed.js.map +1 -1
  6. package/dist/chat/StatewireApprovalCard.cjs +22 -4
  7. package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
  8. package/dist/chat/StatewireApprovalCard.d.ts +14 -0
  9. package/dist/chat/StatewireApprovalCard.js +23 -5
  10. package/dist/chat/StatewireApprovalCard.js.map +1 -1
  11. package/dist/chat/StatewireClientToolBridge.cjs +2 -1
  12. package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
  13. package/dist/chat/StatewireClientToolBridge.js +2 -1
  14. package/dist/chat/StatewireClientToolBridge.js.map +1 -1
  15. package/dist/chat/StatewireQueuedMessages.cjs +2 -1
  16. package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
  17. package/dist/chat/StatewireQueuedMessages.js +2 -1
  18. package/dist/chat/StatewireQueuedMessages.js.map +1 -1
  19. package/dist/chat/athena-citation-links.cjs +17 -1
  20. package/dist/chat/athena-citation-links.cjs.map +1 -1
  21. package/dist/chat/athena-citation-links.js +17 -1
  22. package/dist/chat/athena-citation-links.js.map +1 -1
  23. package/dist/chat/statewire-client-tools.cjs +2 -1
  24. package/dist/chat/statewire-client-tools.cjs.map +1 -1
  25. package/dist/chat/statewire-client-tools.js +2 -1
  26. package/dist/chat/statewire-client-tools.js.map +1 -1
  27. package/dist/chat/super-grouping/SuperGroupingCard.cjs +69 -187
  28. package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
  29. package/dist/chat/super-grouping/SuperGroupingCard.d.ts +10 -6
  30. package/dist/chat/super-grouping/SuperGroupingCard.js +73 -191
  31. package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
  32. package/dist/chat/super-grouping/ToolTimeline.cjs +131 -0
  33. package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -0
  34. package/dist/chat/super-grouping/ToolTimeline.d.ts +16 -0
  35. package/dist/chat/super-grouping/ToolTimeline.js +131 -0
  36. package/dist/chat/super-grouping/ToolTimeline.js.map +1 -0
  37. package/dist/chat/super-grouping/activity-timeline.cjs +14 -8
  38. package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
  39. package/dist/chat/super-grouping/activity-timeline.d.ts +3 -0
  40. package/dist/chat/super-grouping/activity-timeline.js +14 -8
  41. package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
  42. package/dist/chat/super-grouping/timeline-step.cjs +65 -0
  43. package/dist/chat/super-grouping/timeline-step.cjs.map +1 -0
  44. package/dist/chat/super-grouping/timeline-step.d.ts +17 -0
  45. package/dist/chat/super-grouping/timeline-step.js +65 -0
  46. package/dist/chat/super-grouping/timeline-step.js.map +1 -0
  47. package/dist/chat/tiptap-text.cjs +8 -8
  48. package/dist/chat/tiptap-text.cjs.map +1 -1
  49. package/dist/chat/use-athena-run-live.cjs +2 -1
  50. package/dist/chat/use-athena-run-live.cjs.map +1 -1
  51. package/dist/chat/use-athena-run-live.js +2 -1
  52. package/dist/chat/use-athena-run-live.js.map +1 -1
  53. package/dist/chat/use-statewire-approval-request.cjs +7 -2
  54. package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
  55. package/dist/chat/use-statewire-approval-request.d.ts +12 -2
  56. package/dist/chat/use-statewire-approval-request.js +8 -3
  57. package/dist/chat/use-statewire-approval-request.js.map +1 -1
  58. package/dist/chat-ui/composer/tiptap-composer.cjs +24 -65
  59. package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
  60. package/dist/chat-ui/composer/tiptap-composer.js +24 -65
  61. package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
  62. package/dist/chat-ui/index.cjs +2 -1
  63. package/dist/chat-ui/index.cjs.map +1 -1
  64. package/dist/chat-ui/index.js +2 -1
  65. package/dist/chat-ui/index.js.map +1 -1
  66. package/dist/chat-ui/mentions/mention-chip.cjs +49 -4
  67. package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
  68. package/dist/chat-ui/mentions/mention-chip.d.ts +11 -0
  69. package/dist/chat-ui/mentions/mention-chip.js +50 -5
  70. package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
  71. package/dist/chat-ui/mentions/mention-extension.cjs +18 -6
  72. package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
  73. package/dist/chat-ui/mentions/mention-extension.d.ts +2 -0
  74. package/dist/chat-ui/mentions/mention-extension.js +18 -6
  75. package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
  76. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +1 -1
  77. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -1
  78. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +1 -1
  79. package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -1
  80. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +9 -6
  81. package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -1
  82. package/dist/chat-ui/mentions/suggestions/components/menu-item.d.ts +2 -2
  83. package/dist/chat-ui/mentions/suggestions/components/menu-item.js +10 -7
  84. package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -1
  85. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +2 -2
  86. package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -1
  87. package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +2 -2
  88. package/dist/chat-ui/mentions/suggestions/components/menu-list.js +2 -2
  89. package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -1
  90. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +2 -1
  91. package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
  92. package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +3 -2
  93. package/dist/chat-ui/mentions/suggestions/data/api-client.js +2 -1
  94. package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
  95. package/dist/chat-ui/messages/message-components.cjs +6 -29
  96. package/dist/chat-ui/messages/message-components.cjs.map +1 -1
  97. package/dist/chat-ui/messages/message-components.d.ts +1 -13
  98. package/dist/chat-ui/messages/message-components.js +8 -31
  99. package/dist/chat-ui/messages/message-components.js.map +1 -1
  100. package/dist/chat-ui/messages/runtime-message.cjs +3 -2
  101. package/dist/chat-ui/messages/runtime-message.cjs.map +1 -1
  102. package/dist/chat-ui/messages/runtime-message.js +3 -2
  103. package/dist/chat-ui/messages/runtime-message.js.map +1 -1
  104. package/dist/chat-ui/messages/statewire-continue-run.cjs +23 -8
  105. package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -1
  106. package/dist/chat-ui/messages/statewire-continue-run.d.ts +14 -4
  107. package/dist/chat-ui/messages/statewire-continue-run.js +23 -8
  108. package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -1
  109. package/dist/chat-ui/messages/user-edit-composer.cjs +2 -1
  110. package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
  111. package/dist/chat-ui/messages/user-edit-composer.js +2 -1
  112. package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
  113. package/dist/chat-ui/rich-text/chat-message-body.cjs +76 -0
  114. package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -0
  115. package/dist/chat-ui/rich-text/chat-message-body.d.ts +5 -0
  116. package/dist/chat-ui/rich-text/chat-message-body.js +76 -0
  117. package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -0
  118. package/dist/chat-ui/rich-text/chat-node-views.cjs +51 -0
  119. package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -0
  120. package/dist/chat-ui/rich-text/chat-node-views.d.ts +13 -0
  121. package/dist/chat-ui/rich-text/chat-node-views.js +51 -0
  122. package/dist/chat-ui/rich-text/chat-node-views.js.map +1 -0
  123. package/dist/chat-ui/rich-text/chat-text-schema.cjs +70 -0
  124. package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -0
  125. package/dist/chat-ui/rich-text/chat-text-schema.d.ts +7 -0
  126. package/dist/chat-ui/rich-text/chat-text-schema.js +70 -0
  127. package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -0
  128. package/dist/chat-ui/rich-text/dom-output-spec.cjs +83 -0
  129. package/dist/chat-ui/rich-text/dom-output-spec.cjs.map +1 -0
  130. package/dist/chat-ui/rich-text/dom-output-spec.d.ts +11 -0
  131. package/dist/chat-ui/rich-text/dom-output-spec.js +83 -0
  132. package/dist/chat-ui/rich-text/dom-output-spec.js.map +1 -0
  133. package/dist/chat-ui/statewire.cjs +2 -1
  134. package/dist/chat-ui/statewire.cjs.map +1 -1
  135. package/dist/chat-ui/statewire.js +2 -1
  136. package/dist/chat-ui/statewire.js.map +1 -1
  137. package/dist/chat-ui/thread/statewire-history-edge.cjs +2 -1
  138. package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
  139. package/dist/chat-ui/thread/statewire-history-edge.js +2 -1
  140. package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
  141. package/dist/index.cjs +2 -1
  142. package/dist/index.cjs.map +1 -1
  143. package/dist/index.js +2 -1
  144. package/dist/index.js.map +1 -1
  145. package/dist/node_modules/qrcode-generator/dist/qrcode.cjs +32 -0
  146. package/dist/node_modules/qrcode-generator/dist/qrcode.cjs.map +1 -0
  147. package/dist/node_modules/qrcode-generator/dist/qrcode.js +31 -0
  148. package/dist/node_modules/qrcode-generator/dist/qrcode.js.map +1 -0
  149. package/dist/node_modules/zod/v4/classic/errors.cjs +44 -0
  150. package/dist/node_modules/zod/v4/classic/errors.cjs.map +1 -0
  151. package/dist/node_modules/zod/v4/classic/errors.js +44 -0
  152. package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
  153. package/dist/node_modules/zod/v4/classic/iso.cjs +43 -0
  154. package/dist/node_modules/zod/v4/classic/iso.cjs.map +1 -0
  155. package/dist/node_modules/zod/v4/classic/iso.js +43 -0
  156. package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
  157. package/dist/node_modules/zod/v4/classic/parse.cjs +29 -0
  158. package/dist/node_modules/zod/v4/classic/parse.cjs.map +1 -0
  159. package/dist/node_modules/zod/v4/classic/parse.js +29 -0
  160. package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
  161. package/dist/node_modules/zod/v4/classic/schemas.cjs +871 -0
  162. package/dist/node_modules/zod/v4/classic/schemas.cjs.map +1 -0
  163. package/dist/node_modules/zod/v4/classic/schemas.js +871 -0
  164. package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
  165. package/dist/node_modules/zod/v4/core/api.cjs +570 -0
  166. package/dist/node_modules/zod/v4/core/api.cjs.map +1 -0
  167. package/dist/node_modules/zod/v4/core/api.js +570 -0
  168. package/dist/node_modules/zod/v4/core/api.js.map +1 -0
  169. package/dist/node_modules/zod/v4/core/checks.cjs +411 -0
  170. package/dist/node_modules/zod/v4/core/checks.cjs.map +1 -0
  171. package/dist/node_modules/zod/v4/core/checks.js +411 -0
  172. package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
  173. package/dist/node_modules/zod/v4/core/core.cjs +77 -0
  174. package/dist/node_modules/zod/v4/core/core.cjs.map +1 -0
  175. package/dist/node_modules/zod/v4/core/core.js +77 -0
  176. package/dist/node_modules/zod/v4/core/core.js.map +1 -0
  177. package/dist/node_modules/zod/v4/core/doc.cjs +38 -0
  178. package/dist/node_modules/zod/v4/core/doc.cjs.map +1 -0
  179. package/dist/node_modules/zod/v4/core/doc.js +38 -0
  180. package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
  181. package/dist/node_modules/zod/v4/core/errors.cjs +76 -0
  182. package/dist/node_modules/zod/v4/core/errors.cjs.map +1 -0
  183. package/dist/node_modules/zod/v4/core/errors.js +76 -0
  184. package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
  185. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +312 -0
  186. package/dist/node_modules/zod/v4/core/json-schema-processors.cjs.map +1 -0
  187. package/dist/node_modules/zod/v4/core/json-schema-processors.js +312 -0
  188. package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +1 -0
  189. package/dist/node_modules/zod/v4/core/parse.cjs +96 -0
  190. package/dist/node_modules/zod/v4/core/parse.cjs.map +1 -0
  191. package/dist/node_modules/zod/v4/core/parse.js +96 -0
  192. package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
  193. package/dist/node_modules/zod/v4/core/regexes.cjs +86 -0
  194. package/dist/node_modules/zod/v4/core/regexes.cjs.map +1 -0
  195. package/dist/node_modules/zod/v4/core/regexes.js +86 -0
  196. package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
  197. package/dist/node_modules/zod/v4/core/registries.cjs +52 -0
  198. package/dist/node_modules/zod/v4/core/registries.cjs.map +1 -0
  199. package/dist/node_modules/zod/v4/core/registries.js +52 -0
  200. package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
  201. package/dist/node_modules/zod/v4/core/schemas.cjs +1412 -0
  202. package/dist/node_modules/zod/v4/core/schemas.cjs.map +1 -0
  203. package/dist/node_modules/zod/v4/core/schemas.js +1413 -0
  204. package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
  205. package/dist/node_modules/zod/v4/core/to-json-schema.cjs +370 -0
  206. package/dist/node_modules/zod/v4/core/to-json-schema.cjs.map +1 -0
  207. package/dist/node_modules/zod/v4/core/to-json-schema.js +370 -0
  208. package/dist/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
  209. package/dist/node_modules/zod/v4/core/util.cjs +444 -0
  210. package/dist/node_modules/zod/v4/core/util.cjs.map +1 -0
  211. package/dist/node_modules/zod/v4/core/util.js +444 -0
  212. package/dist/node_modules/zod/v4/core/util.js.map +1 -0
  213. package/dist/node_modules/zod/v4/core/versions.cjs +9 -0
  214. package/dist/node_modules/zod/v4/core/versions.cjs.map +1 -0
  215. package/dist/node_modules/zod/v4/core/versions.js +9 -0
  216. package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
  217. package/dist/packages/agent-runtime/src/client-tool-bridge.cjs +7 -1
  218. package/dist/packages/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
  219. package/dist/packages/agent-runtime/src/client-tool-bridge.js +7 -1
  220. package/dist/packages/agent-runtime/src/client-tool-bridge.js.map +1 -1
  221. package/dist/packages/agent-runtime/src/conversation-list.cjs +4 -0
  222. package/dist/packages/agent-runtime/src/conversation-list.cjs.map +1 -1
  223. package/dist/packages/agent-runtime/src/conversation-list.js +4 -0
  224. package/dist/packages/agent-runtime/src/conversation-list.js.map +1 -1
  225. package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -1
  226. package/dist/packages/agent-runtime/src/edit-command.js.map +1 -1
  227. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +2 -0
  228. package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
  229. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +2 -0
  230. package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
  231. package/dist/packages/agent-runtime/src/interrupts.cjs +31 -7
  232. package/dist/packages/agent-runtime/src/interrupts.cjs.map +1 -1
  233. package/dist/packages/agent-runtime/src/interrupts.js +31 -7
  234. package/dist/packages/agent-runtime/src/interrupts.js.map +1 -1
  235. package/dist/packages/agent-runtime/src/messages.cjs +35 -5
  236. package/dist/packages/agent-runtime/src/messages.cjs.map +1 -1
  237. package/dist/packages/agent-runtime/src/messages.js +35 -5
  238. package/dist/packages/agent-runtime/src/messages.js.map +1 -1
  239. package/dist/packages/agent-runtime/src/protocol.cjs +4 -6
  240. package/dist/packages/agent-runtime/src/protocol.cjs.map +1 -1
  241. package/dist/packages/agent-runtime/src/protocol.js +4 -6
  242. package/dist/packages/agent-runtime/src/protocol.js.map +1 -1
  243. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +296 -14
  244. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
  245. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +293 -11
  246. package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
  247. package/dist/packages/agent-runtime/src/screen-point.cjs +68 -0
  248. package/dist/packages/agent-runtime/src/screen-point.cjs.map +1 -0
  249. package/dist/packages/agent-runtime/src/screen-point.js +68 -0
  250. package/dist/packages/agent-runtime/src/screen-point.js.map +1 -0
  251. package/dist/packages/agent-runtime/src/statewire-transport.cjs +6 -1
  252. package/dist/packages/agent-runtime/src/statewire-transport.cjs.map +1 -1
  253. package/dist/packages/agent-runtime/src/statewire-transport.js +6 -1
  254. package/dist/packages/agent-runtime/src/statewire-transport.js.map +1 -1
  255. package/dist/packages/agent-runtime/src/thread-handoff.cjs +85 -0
  256. package/dist/packages/agent-runtime/src/thread-handoff.cjs.map +1 -0
  257. package/dist/packages/agent-runtime/src/thread-handoff.js +85 -0
  258. package/dist/packages/agent-runtime/src/thread-handoff.js.map +1 -0
  259. package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs +1 -1
  260. package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs.map +1 -1
  261. package/dist/packages/agent-runtime/src/thread-snapshot-cache.js +1 -1
  262. package/dist/packages/agent-runtime/src/thread-snapshot-cache.js.map +1 -1
  263. package/dist/packages/agent-runtime/src/tool-metadata.cjs +0 -8
  264. package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +1 -1
  265. package/dist/packages/agent-runtime/src/tool-metadata.js +0 -8
  266. package/dist/packages/agent-runtime/src/tool-metadata.js.map +1 -1
  267. package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs +14 -0
  268. package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs.map +1 -0
  269. package/dist/packages/agent-runtime/src/use-deep-agent-config.js +14 -0
  270. package/dist/packages/agent-runtime/src/use-deep-agent-config.js.map +1 -0
  271. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs +21 -5
  272. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
  273. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js +21 -5
  274. package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
  275. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs +13 -3
  276. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
  277. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js +14 -4
  278. package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
  279. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs +35 -15
  280. package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
  281. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js +35 -15
  282. package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
  283. package/dist/packages/agent-runtime/src/voice-presentation.cjs.map +1 -1
  284. package/dist/packages/agent-runtime/src/voice-presentation.js.map +1 -1
  285. package/dist/packages/react/package.json.cjs +1 -1
  286. package/dist/packages/react/package.json.js +1 -1
  287. package/dist/provider/AthenaProvider.cjs +2 -1
  288. package/dist/provider/AthenaProvider.cjs.map +1 -1
  289. package/dist/provider/AthenaProvider.js +2 -1
  290. package/dist/provider/AthenaProvider.js.map +1 -1
  291. package/dist/runtime/statewire-lifecycle.cjs +2 -1
  292. package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
  293. package/dist/runtime/statewire-lifecycle.js +2 -1
  294. package/dist/runtime/statewire-lifecycle.js.map +1 -1
  295. package/dist/runtime/useAthenaStatewireRuntime.cjs +2 -1
  296. package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
  297. package/dist/runtime/useAthenaStatewireRuntime.js +2 -1
  298. package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
  299. package/dist/styles.css +1 -1
  300. package/dist/threads/conversation-list-fetcher.cjs +4 -0
  301. package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
  302. package/dist/threads/conversation-list-fetcher.js +4 -0
  303. package/dist/threads/conversation-list-fetcher.js.map +1 -1
  304. package/dist/threads/statewire-thread-list.cjs +2 -1
  305. package/dist/threads/statewire-thread-list.cjs.map +1 -1
  306. package/dist/threads/statewire-thread-list.js +2 -1
  307. package/dist/threads/statewire-thread-list.js.map +1 -1
  308. package/dist/threads/use-rest-conversation-history.cjs +2 -1
  309. package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
  310. package/dist/threads/use-rest-conversation-history.js +2 -1
  311. package/dist/threads/use-rest-conversation-history.js.map +1 -1
  312. package/dist/threads/use-statewire-conversation-history.cjs +2 -1
  313. package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
  314. package/dist/threads/use-statewire-conversation-history.d.ts +1 -0
  315. package/dist/threads/use-statewire-conversation-history.js +2 -1
  316. package/dist/threads/use-statewire-conversation-history.js.map +1 -1
  317. package/dist/tools/index.cjs +2 -1
  318. package/dist/tools/index.cjs.map +1 -1
  319. package/dist/tools/index.js +2 -1
  320. package/dist/tools/index.js.map +1 -1
  321. package/dist/tools/misc-tool-uis.cjs +2 -1
  322. package/dist/tools/misc-tool-uis.cjs.map +1 -1
  323. package/dist/tools/misc-tool-uis.js +2 -1
  324. package/dist/tools/misc-tool-uis.js.map +1 -1
  325. package/dist/tools/primitives.cjs +2 -1
  326. package/dist/tools/primitives.cjs.map +1 -1
  327. package/dist/tools/primitives.js +2 -1
  328. package/dist/tools/primitives.js.map +1 -1
  329. package/dist/tools/tool-fallback.cjs +2 -1
  330. package/dist/tools/tool-fallback.cjs.map +1 -1
  331. package/dist/tools/tool-fallback.js +2 -1
  332. package/dist/tools/tool-fallback.js.map +1 -1
  333. package/dist/tools/voice-update-tool-ui.cjs +2 -1
  334. package/dist/tools/voice-update-tool-ui.cjs.map +1 -1
  335. package/dist/tools/voice-update-tool-ui.js +2 -1
  336. package/dist/tools/voice-update-tool-ui.js.map +1 -1
  337. package/dist/voice/index.cjs +6 -0
  338. package/dist/voice/index.cjs.map +1 -0
  339. package/dist/voice/index.d.ts +2 -0
  340. package/dist/voice/index.js +6 -0
  341. package/dist/voice/index.js.map +1 -0
  342. package/dist/voice/use-athena-voice-session.cjs +315 -0
  343. package/dist/voice/use-athena-voice-session.cjs.map +1 -0
  344. package/dist/voice/use-athena-voice-session.d.ts +145 -0
  345. package/dist/voice/use-athena-voice-session.js +315 -0
  346. package/dist/voice/use-athena-voice-session.js.map +1 -0
  347. package/package.json +17 -3
@@ -0,0 +1,1413 @@
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