@touchvue/chat 1.0.0-beta.5 → 1.0.0-beta.50

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 (443) hide show
  1. package/README.md +25 -25
  2. package/es/_virtual/_plugin-vue_export-helper.mjs +10 -0
  3. package/es/_virtual/_plugin-vue_export-helper.mjs.map +1 -0
  4. package/es/index.mjs.map +1 -1
  5. package/es/node_modules/.pnpm/@touchvue_a2ui@1.0.0-beta.46/node_modules/@touchvue/a2ui/dist/index.mjs +4816 -0
  6. package/es/node_modules/.pnpm/@touchvue_a2ui@1.0.0-beta.46/node_modules/@touchvue/a2ui/dist/index.mjs.map +1 -0
  7. package/es/node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.mjs +1380 -0
  8. package/es/node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.mjs.map +1 -0
  9. package/es/node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.mjs +7824 -0
  10. package/es/node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.mjs.map +1 -0
  11. package/es/package.json.css +1 -1
  12. package/es/package.json.mjs +2 -2
  13. package/es/packages/components/index.mjs +1 -1
  14. package/es/packages/components/resolver.mjs.map +1 -1
  15. package/es/packages/components/touchchat/component/AiRobot/HelloChat.vue.mjs +3 -2
  16. package/es/packages/components/touchchat/component/AiRobot/HelloChat.vue.mjs.map +1 -1
  17. package/es/packages/components/touchchat/component/AiRobot/HelloChat.vue2.mjs +219 -159
  18. package/es/packages/components/touchchat/component/AiRobot/HelloChat.vue2.mjs.map +1 -1
  19. package/es/packages/components/touchchat/component/AiRobot/face.vue.mjs +3 -2
  20. package/es/packages/components/touchchat/component/AiRobot/face.vue.mjs.map +1 -1
  21. package/es/packages/components/touchchat/component/AiRobot/face.vue2.mjs +27 -13
  22. package/es/packages/components/touchchat/component/AiRobot/face.vue2.mjs.map +1 -1
  23. package/es/packages/components/touchchat/component/AiRobot/letter.vue.mjs +3 -2
  24. package/es/packages/components/touchchat/component/AiRobot/letter.vue.mjs.map +1 -1
  25. package/es/packages/components/touchchat/component/AiRobot/letter.vue2.mjs +182 -41
  26. package/es/packages/components/touchchat/component/AiRobot/letter.vue2.mjs.map +1 -1
  27. package/es/packages/components/touchchat/component/AiRobot/meterialPrepare.vue.mjs +3 -2
  28. package/es/packages/components/touchchat/component/AiRobot/meterialPrepare.vue.mjs.map +1 -1
  29. package/es/packages/components/touchchat/component/AiRobot/meterialPrepare.vue2.mjs +15 -10
  30. package/es/packages/components/touchchat/component/AiRobot/meterialPrepare.vue2.mjs.map +1 -1
  31. package/es/packages/components/touchchat/component/AiRobot/start.vue.mjs +3 -2
  32. package/es/packages/components/touchchat/component/AiRobot/start.vue.mjs.map +1 -1
  33. package/es/packages/components/touchchat/component/AiRobot/start.vue2.mjs +18 -11
  34. package/es/packages/components/touchchat/component/AiRobot/start.vue2.mjs.map +1 -1
  35. package/es/packages/components/touchchat/component/CardView.vue.mjs +3 -2
  36. package/es/packages/components/touchchat/component/CardView.vue.mjs.map +1 -1
  37. package/es/packages/components/touchchat/component/CardView.vue2.mjs +66 -42
  38. package/es/packages/components/touchchat/component/CardView.vue2.mjs.map +1 -1
  39. package/es/packages/components/touchchat/component/FileContent.vue.mjs +7 -0
  40. package/es/packages/components/touchchat/component/FileContent.vue.mjs.map +1 -0
  41. package/es/packages/components/touchchat/component/FileContent.vue2.mjs +206 -0
  42. package/es/packages/components/touchchat/component/FileContent.vue2.mjs.map +1 -0
  43. package/es/packages/components/touchchat/component/FileView.vue.mjs +3 -2
  44. package/es/packages/components/touchchat/component/FileView.vue.mjs.map +1 -1
  45. package/es/packages/components/touchchat/component/FileView.vue2.mjs +17 -4
  46. package/es/packages/components/touchchat/component/FileView.vue2.mjs.map +1 -1
  47. package/es/packages/components/touchchat/component/HelloChat.vue.mjs +3 -2
  48. package/es/packages/components/touchchat/component/HelloChat.vue.mjs.map +1 -1
  49. package/es/packages/components/touchchat/component/HelloChat.vue2.mjs +26 -14
  50. package/es/packages/components/touchchat/component/HelloChat.vue2.mjs.map +1 -1
  51. package/es/packages/components/touchchat/component/ImageFile.vue.mjs +7 -0
  52. package/es/packages/components/touchchat/component/ImageFile.vue.mjs.map +1 -0
  53. package/es/packages/components/touchchat/component/ImageFile.vue2.mjs +162 -0
  54. package/es/packages/components/touchchat/component/ImageFile.vue2.mjs.map +1 -0
  55. package/es/packages/components/touchchat/component/ImageView.vue.mjs +3 -2
  56. package/es/packages/components/touchchat/component/ImageView.vue.mjs.map +1 -1
  57. package/es/packages/components/touchchat/component/ImageView.vue2.mjs +1 -1
  58. package/es/packages/components/touchchat/component/ImageView.vue2.mjs.map +1 -1
  59. package/es/packages/components/touchchat/component/LinkView.vue.mjs +3 -2
  60. package/es/packages/components/touchchat/component/LinkView.vue.mjs.map +1 -1
  61. package/es/packages/components/touchchat/component/LinkView.vue2.mjs +19 -5
  62. package/es/packages/components/touchchat/component/LinkView.vue2.mjs.map +1 -1
  63. package/es/packages/components/touchchat/component/MarkLayer.vue.mjs +7 -0
  64. package/es/packages/components/touchchat/component/MarkLayer.vue.mjs.map +1 -0
  65. package/es/packages/components/touchchat/component/MarkLayer.vue2.mjs +56 -0
  66. package/es/packages/components/touchchat/component/MarkLayer.vue2.mjs.map +1 -0
  67. package/es/packages/components/touchchat/component/ModuleSelect.vue.mjs +7 -0
  68. package/es/packages/components/touchchat/component/ModuleSelect.vue.mjs.map +1 -0
  69. package/es/packages/components/touchchat/component/ModuleSelect.vue2.mjs +121 -0
  70. package/es/packages/components/touchchat/component/ModuleSelect.vue2.mjs.map +1 -0
  71. package/es/packages/components/touchchat/component/PDFFile.vue.mjs +7 -0
  72. package/es/packages/components/touchchat/component/PDFFile.vue.mjs.map +1 -0
  73. package/es/packages/components/touchchat/component/PDFFile.vue2.mjs +211 -0
  74. package/es/packages/components/touchchat/component/PDFFile.vue2.mjs.map +1 -0
  75. package/es/packages/components/touchchat/component/QuoteContent.vue.mjs +7 -0
  76. package/es/packages/components/touchchat/component/QuoteContent.vue.mjs.map +1 -0
  77. package/es/packages/components/touchchat/component/QuoteContent.vue2.mjs +40 -0
  78. package/es/packages/components/touchchat/component/QuoteContent.vue2.mjs.map +1 -0
  79. package/es/packages/components/touchchat/component/RealtimeVoice.vue.mjs +7 -0
  80. package/es/packages/components/touchchat/component/RealtimeVoice.vue.mjs.map +1 -0
  81. package/es/packages/components/touchchat/component/RealtimeVoice.vue2.mjs +160 -0
  82. package/es/packages/components/touchchat/component/RealtimeVoice.vue2.mjs.map +1 -0
  83. package/es/packages/components/touchchat/component/Screenshot.vue.mjs +7 -0
  84. package/es/packages/components/touchchat/component/Screenshot.vue.mjs.map +1 -0
  85. package/es/packages/components/touchchat/component/Screenshot.vue2.mjs +208 -0
  86. package/es/packages/components/touchchat/component/Screenshot.vue2.mjs.map +1 -0
  87. package/es/packages/components/touchchat/component/ThoughtChain.vue.mjs +7 -0
  88. package/es/packages/components/touchchat/component/ThoughtChain.vue.mjs.map +1 -0
  89. package/es/packages/components/touchchat/component/ThoughtChain.vue2.mjs +69 -0
  90. package/es/packages/components/touchchat/component/ThoughtChain.vue2.mjs.map +1 -0
  91. package/es/packages/components/touchchat/component/UploadView.vue.mjs +7 -0
  92. package/es/packages/components/touchchat/component/UploadView.vue.mjs.map +1 -0
  93. package/es/packages/components/touchchat/component/UploadView.vue2.mjs +186 -0
  94. package/es/packages/components/touchchat/component/UploadView.vue2.mjs.map +1 -0
  95. package/es/packages/components/touchchat/component/UploadView_api.vue.mjs +7 -0
  96. package/es/packages/components/touchchat/component/UploadView_api.vue.mjs.map +1 -0
  97. package/es/packages/components/touchchat/component/UploadView_api.vue2.mjs +166 -0
  98. package/es/packages/components/touchchat/component/UploadView_api.vue2.mjs.map +1 -0
  99. package/es/packages/components/touchchat/component/VideoFile.vue.mjs +7 -0
  100. package/es/packages/components/touchchat/component/VideoFile.vue.mjs.map +1 -0
  101. package/es/packages/components/touchchat/component/VideoFile.vue2.mjs +33 -0
  102. package/es/packages/components/touchchat/component/VideoFile.vue2.mjs.map +1 -0
  103. package/es/packages/components/touchchat/component/VoiceView.vue.mjs +7 -0
  104. package/es/packages/components/touchchat/component/VoiceView.vue.mjs.map +1 -0
  105. package/es/packages/components/touchchat/component/VoiceView.vue2.mjs +165 -0
  106. package/es/packages/components/touchchat/component/VoiceView.vue2.mjs.map +1 -0
  107. package/es/packages/components/touchchat/img/file/doc.png.mjs +4 -0
  108. package/es/packages/components/touchchat/img/file/doc.png.mjs.map +1 -0
  109. package/es/packages/components/touchchat/img/file/docx.png.mjs +4 -0
  110. package/es/packages/components/touchchat/img/file/docx.png.mjs.map +1 -0
  111. package/es/packages/components/touchchat/img/file/gif.png.mjs +4 -0
  112. package/es/packages/components/touchchat/img/file/gif.png.mjs.map +1 -0
  113. package/es/packages/components/touchchat/img/file/html.png.mjs +4 -0
  114. package/es/packages/components/touchchat/img/file/html.png.mjs.map +1 -0
  115. package/es/packages/components/touchchat/img/file/jpg.png.mjs +4 -0
  116. package/es/packages/components/touchchat/img/file/jpg.png.mjs.map +1 -0
  117. package/es/packages/components/touchchat/img/file/mp3.png.mjs +4 -0
  118. package/es/packages/components/touchchat/img/file/mp3.png.mjs.map +1 -0
  119. package/es/packages/components/touchchat/img/file/mp4.png.mjs +4 -0
  120. package/es/packages/components/touchchat/img/file/mp4.png.mjs.map +1 -0
  121. package/es/packages/components/touchchat/img/file/music.png.mjs +4 -0
  122. package/es/packages/components/touchchat/img/file/music.png.mjs.map +1 -0
  123. package/es/packages/components/touchchat/img/file/pdf.png.mjs +4 -0
  124. package/es/packages/components/touchchat/img/file/pdf.png.mjs.map +1 -0
  125. package/es/packages/components/touchchat/img/file/png.png.mjs +4 -0
  126. package/es/packages/components/touchchat/img/file/png.png.mjs.map +1 -0
  127. package/es/packages/components/touchchat/img/file/ppt.png.mjs +4 -0
  128. package/es/packages/components/touchchat/img/file/ppt.png.mjs.map +1 -0
  129. package/es/packages/components/touchchat/img/file/pptx.png.mjs +4 -0
  130. package/es/packages/components/touchchat/img/file/pptx.png.mjs.map +1 -0
  131. package/es/packages/components/touchchat/img/file/txt.png.mjs +4 -0
  132. package/es/packages/components/touchchat/img/file/txt.png.mjs.map +1 -0
  133. package/es/packages/components/touchchat/img/file/xls.png.mjs +4 -0
  134. package/es/packages/components/touchchat/img/file/xls.png.mjs.map +1 -0
  135. package/es/packages/components/touchchat/img/file/xlsx.png.mjs +4 -0
  136. package/es/packages/components/touchchat/img/file/xlsx.png.mjs.map +1 -0
  137. package/es/packages/components/touchchat/img/svg/reset.svg.mjs +4 -0
  138. package/es/packages/components/touchchat/img/svg/reset.svg.mjs.map +1 -0
  139. package/es/packages/components/touchchat/index.mjs +5 -5
  140. package/es/packages/components/touchchat/index.mjs.map +1 -1
  141. package/es/packages/components/touchchat/src/AiChat/AgentsView.vue.mjs +7 -0
  142. package/es/packages/components/touchchat/src/AiChat/AgentsView.vue.mjs.map +1 -0
  143. package/es/packages/components/touchchat/src/AiChat/AgentsView.vue2.mjs +59 -0
  144. package/es/packages/components/touchchat/src/AiChat/AgentsView.vue2.mjs.map +1 -0
  145. package/es/packages/components/touchchat/src/AiChat/AiMessage.vue.mjs +3 -2
  146. package/es/packages/components/touchchat/src/AiChat/AiMessage.vue.mjs.map +1 -1
  147. package/es/packages/components/touchchat/src/AiChat/AiMessage.vue2.mjs +322 -139
  148. package/es/packages/components/touchchat/src/AiChat/AiMessage.vue2.mjs.map +1 -1
  149. package/es/packages/components/touchchat/src/AiChat/Chat/TouchChat.mjs +18 -0
  150. package/es/packages/components/touchchat/src/AiChat/Chat/TouchChat.mjs.map +1 -0
  151. package/es/packages/components/touchchat/src/AiChat/Chat/scriptMatcher.mjs +145 -0
  152. package/es/packages/components/touchchat/src/AiChat/Chat/scriptMatcher.mjs.map +1 -0
  153. package/es/packages/components/touchchat/src/AiChat/Chat/types.mjs +19 -0
  154. package/es/packages/components/touchchat/src/AiChat/Chat/types.mjs.map +1 -0
  155. package/es/packages/components/touchchat/src/AiChat/Chat/useChat.mjs +693 -0
  156. package/es/packages/components/touchchat/src/AiChat/Chat/useChat.mjs.map +1 -0
  157. package/es/packages/components/touchchat/src/AiChat/Chat/useCopy.mjs +55 -0
  158. package/es/packages/components/touchchat/src/AiChat/Chat/useCopy.mjs.map +1 -0
  159. package/es/packages/components/touchchat/src/AiChat/Chat/useMessageRender.mjs +155 -0
  160. package/es/packages/components/touchchat/src/AiChat/Chat/useMessageRender.mjs.map +1 -0
  161. package/es/packages/components/touchchat/src/AiChat/Chat/useSSE.mjs +345 -0
  162. package/es/packages/components/touchchat/src/AiChat/Chat/useSSE.mjs.map +1 -0
  163. package/es/packages/components/touchchat/src/AiChat/Chat/useScroll.mjs +74 -0
  164. package/es/packages/components/touchchat/src/AiChat/Chat/useScroll.mjs.map +1 -0
  165. package/es/packages/components/touchchat/src/AiChat/ChatInput.vue.mjs +3 -2
  166. package/es/packages/components/touchchat/src/AiChat/ChatInput.vue.mjs.map +1 -1
  167. package/es/packages/components/touchchat/src/AiChat/ChatInput.vue2.mjs +472 -44
  168. package/es/packages/components/touchchat/src/AiChat/ChatInput.vue2.mjs.map +1 -1
  169. package/es/packages/components/touchchat/src/AiChat/HistoryList.vue.mjs +3 -2
  170. package/es/packages/components/touchchat/src/AiChat/HistoryList.vue.mjs.map +1 -1
  171. package/es/packages/components/touchchat/src/AiChat/HistoryList.vue2.mjs +180 -98
  172. package/es/packages/components/touchchat/src/AiChat/HistoryList.vue2.mjs.map +1 -1
  173. package/es/packages/components/touchchat/src/AiChat/HistorySidebar.vue.mjs +3 -2
  174. package/es/packages/components/touchchat/src/AiChat/HistorySidebar.vue.mjs.map +1 -1
  175. package/es/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.mjs +29 -12
  176. package/es/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.mjs.map +1 -1
  177. package/es/packages/components/touchchat/src/AiChat/MessageActions.vue.mjs +3 -2
  178. package/es/packages/components/touchchat/src/AiChat/MessageActions.vue.mjs.map +1 -1
  179. package/es/packages/components/touchchat/src/AiChat/MessageActions.vue2.mjs +175 -62
  180. package/es/packages/components/touchchat/src/AiChat/MessageActions.vue2.mjs.map +1 -1
  181. package/es/packages/components/touchchat/src/AiChat/SiderBarView.vue.mjs +3 -2
  182. package/es/packages/components/touchchat/src/AiChat/SiderBarView.vue.mjs.map +1 -1
  183. package/es/packages/components/touchchat/src/AiChat/SiderBarView.vue2.mjs +14 -8
  184. package/es/packages/components/touchchat/src/AiChat/SiderBarView.vue2.mjs.map +1 -1
  185. package/es/packages/components/touchchat/src/AiChat/TouchAgent.vue.mjs +7 -0
  186. package/es/packages/components/touchchat/src/AiChat/TouchAgent.vue.mjs.map +1 -0
  187. package/es/packages/components/touchchat/src/AiChat/TouchAgent.vue2.mjs +1034 -0
  188. package/es/packages/components/touchchat/src/AiChat/TouchAgent.vue2.mjs.map +1 -0
  189. package/es/packages/components/touchchat/src/AiChat/TouchChat.vue.mjs +3 -2
  190. package/es/packages/components/touchchat/src/AiChat/TouchChat.vue.mjs.map +1 -1
  191. package/es/packages/components/touchchat/src/AiChat/TouchChat.vue2.mjs +276 -1004
  192. package/es/packages/components/touchchat/src/AiChat/TouchChat.vue2.mjs.map +1 -1
  193. package/es/packages/components/touchchat/src/AiChat/TouchHistory.vue.mjs +3 -2
  194. package/es/packages/components/touchchat/src/AiChat/TouchHistory.vue.mjs.map +1 -1
  195. package/es/packages/components/touchchat/src/AiChat/TouchHistory.vue2.mjs +346 -122
  196. package/es/packages/components/touchchat/src/AiChat/TouchHistory.vue2.mjs.map +1 -1
  197. package/es/packages/components/touchchat/src/AiChat/UserMessage.vue.mjs +3 -2
  198. package/es/packages/components/touchchat/src/AiChat/UserMessage.vue.mjs.map +1 -1
  199. package/es/packages/components/touchchat/src/AiChat/UserMessage.vue2.mjs +143 -64
  200. package/es/packages/components/touchchat/src/AiChat/UserMessage.vue2.mjs.map +1 -1
  201. package/es/packages/components/touchchat/src/index.vue.mjs +3 -2
  202. package/es/packages/components/touchchat/src/index.vue.mjs.map +1 -1
  203. package/es/packages/components/touchchat/src/index.vue2.mjs +252 -143
  204. package/es/packages/components/touchchat/src/index.vue2.mjs.map +1 -1
  205. package/es/packages/components/touchchat/src/types/a2a.mjs +11 -0
  206. package/es/packages/components/touchchat/src/types/a2a.mjs.map +1 -0
  207. package/es/packages/components/touchchat/utils/a2aService.mjs +316 -0
  208. package/es/packages/components/touchchat/utils/a2aService.mjs.map +1 -0
  209. package/es/packages/components/touchchat/utils/fetchStream.mjs +8 -2
  210. package/es/packages/components/touchchat/utils/fetchStream.mjs.map +1 -1
  211. package/es/packages/components/touchchat/utils/markdown.mjs +31 -13
  212. package/es/packages/components/touchchat/utils/markdown.mjs.map +1 -1
  213. package/es/packages/utils/config.mjs.map +1 -1
  214. package/es/packages/utils/types.mjs.map +1 -1
  215. package/global.d.ts +2 -2
  216. package/lib/_virtual/_plugin-vue_export-helper.js +14 -0
  217. package/lib/_virtual/_plugin-vue_export-helper.js.map +1 -0
  218. package/lib/index.js.map +1 -1
  219. package/lib/node_modules/.pnpm/@touchvue_a2ui@1.0.0-beta.46/node_modules/@touchvue/a2ui/dist/index.js +4819 -0
  220. package/lib/node_modules/.pnpm/@touchvue_a2ui@1.0.0-beta.46/node_modules/@touchvue/a2ui/dist/index.js.map +1 -0
  221. package/lib/node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.js +1384 -0
  222. package/lib/node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.js.map +1 -0
  223. package/lib/node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.js +7828 -0
  224. package/lib/node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.js.map +1 -0
  225. package/lib/package.json.css +1 -1
  226. package/lib/package.json.js +2 -2
  227. package/lib/packages/components/index.js +2 -2
  228. package/lib/packages/components/resolver.js.map +1 -1
  229. package/lib/packages/components/touchchat/component/AiRobot/HelloChat.vue.js +3 -2
  230. package/lib/packages/components/touchchat/component/AiRobot/HelloChat.vue.js.map +1 -1
  231. package/lib/packages/components/touchchat/component/AiRobot/HelloChat.vue2.js +219 -159
  232. package/lib/packages/components/touchchat/component/AiRobot/HelloChat.vue2.js.map +1 -1
  233. package/lib/packages/components/touchchat/component/AiRobot/face.vue.js +3 -2
  234. package/lib/packages/components/touchchat/component/AiRobot/face.vue.js.map +1 -1
  235. package/lib/packages/components/touchchat/component/AiRobot/face.vue2.js +26 -12
  236. package/lib/packages/components/touchchat/component/AiRobot/face.vue2.js.map +1 -1
  237. package/lib/packages/components/touchchat/component/AiRobot/letter.vue.js +3 -2
  238. package/lib/packages/components/touchchat/component/AiRobot/letter.vue.js.map +1 -1
  239. package/lib/packages/components/touchchat/component/AiRobot/letter.vue2.js +181 -40
  240. package/lib/packages/components/touchchat/component/AiRobot/letter.vue2.js.map +1 -1
  241. package/lib/packages/components/touchchat/component/AiRobot/meterialPrepare.vue.js +3 -2
  242. package/lib/packages/components/touchchat/component/AiRobot/meterialPrepare.vue.js.map +1 -1
  243. package/lib/packages/components/touchchat/component/AiRobot/meterialPrepare.vue2.js +15 -10
  244. package/lib/packages/components/touchchat/component/AiRobot/meterialPrepare.vue2.js.map +1 -1
  245. package/lib/packages/components/touchchat/component/AiRobot/start.vue.js +3 -2
  246. package/lib/packages/components/touchchat/component/AiRobot/start.vue.js.map +1 -1
  247. package/lib/packages/components/touchchat/component/AiRobot/start.vue2.js +17 -10
  248. package/lib/packages/components/touchchat/component/AiRobot/start.vue2.js.map +1 -1
  249. package/lib/packages/components/touchchat/component/CardView.vue.js +3 -2
  250. package/lib/packages/components/touchchat/component/CardView.vue.js.map +1 -1
  251. package/lib/packages/components/touchchat/component/CardView.vue2.js +66 -42
  252. package/lib/packages/components/touchchat/component/CardView.vue2.js.map +1 -1
  253. package/lib/packages/components/touchchat/component/FileContent.vue.js +11 -0
  254. package/lib/packages/components/touchchat/component/FileContent.vue.js.map +1 -0
  255. package/lib/packages/components/touchchat/component/FileContent.vue2.js +210 -0
  256. package/lib/packages/components/touchchat/component/FileContent.vue2.js.map +1 -0
  257. package/lib/packages/components/touchchat/component/FileView.vue.js +3 -2
  258. package/lib/packages/components/touchchat/component/FileView.vue.js.map +1 -1
  259. package/lib/packages/components/touchchat/component/FileView.vue2.js +16 -3
  260. package/lib/packages/components/touchchat/component/FileView.vue2.js.map +1 -1
  261. package/lib/packages/components/touchchat/component/HelloChat.vue.js +3 -2
  262. package/lib/packages/components/touchchat/component/HelloChat.vue.js.map +1 -1
  263. package/lib/packages/components/touchchat/component/HelloChat.vue2.js +26 -14
  264. package/lib/packages/components/touchchat/component/HelloChat.vue2.js.map +1 -1
  265. package/lib/packages/components/touchchat/component/ImageFile.vue.js +11 -0
  266. package/lib/packages/components/touchchat/component/ImageFile.vue.js.map +1 -0
  267. package/lib/packages/components/touchchat/component/ImageFile.vue2.js +166 -0
  268. package/lib/packages/components/touchchat/component/ImageFile.vue2.js.map +1 -0
  269. package/lib/packages/components/touchchat/component/ImageView.vue.js +3 -2
  270. package/lib/packages/components/touchchat/component/ImageView.vue.js.map +1 -1
  271. package/lib/packages/components/touchchat/component/ImageView.vue2.js +1 -1
  272. package/lib/packages/components/touchchat/component/ImageView.vue2.js.map +1 -1
  273. package/lib/packages/components/touchchat/component/LinkView.vue.js +3 -2
  274. package/lib/packages/components/touchchat/component/LinkView.vue.js.map +1 -1
  275. package/lib/packages/components/touchchat/component/LinkView.vue2.js +18 -4
  276. package/lib/packages/components/touchchat/component/LinkView.vue2.js.map +1 -1
  277. package/lib/packages/components/touchchat/component/MarkLayer.vue.js +11 -0
  278. package/lib/packages/components/touchchat/component/MarkLayer.vue.js.map +1 -0
  279. package/lib/packages/components/touchchat/component/MarkLayer.vue2.js +60 -0
  280. package/lib/packages/components/touchchat/component/MarkLayer.vue2.js.map +1 -0
  281. package/lib/packages/components/touchchat/component/ModuleSelect.vue.js +11 -0
  282. package/lib/packages/components/touchchat/component/ModuleSelect.vue.js.map +1 -0
  283. package/lib/packages/components/touchchat/component/ModuleSelect.vue2.js +125 -0
  284. package/lib/packages/components/touchchat/component/ModuleSelect.vue2.js.map +1 -0
  285. package/lib/packages/components/touchchat/component/PDFFile.vue.js +11 -0
  286. package/lib/packages/components/touchchat/component/PDFFile.vue.js.map +1 -0
  287. package/lib/packages/components/touchchat/component/PDFFile.vue2.js +215 -0
  288. package/lib/packages/components/touchchat/component/PDFFile.vue2.js.map +1 -0
  289. package/lib/packages/components/touchchat/component/QuoteContent.vue.js +11 -0
  290. package/lib/packages/components/touchchat/component/QuoteContent.vue.js.map +1 -0
  291. package/lib/packages/components/touchchat/component/QuoteContent.vue2.js +44 -0
  292. package/lib/packages/components/touchchat/component/QuoteContent.vue2.js.map +1 -0
  293. package/lib/packages/components/touchchat/component/RealtimeVoice.vue.js +11 -0
  294. package/lib/packages/components/touchchat/component/RealtimeVoice.vue.js.map +1 -0
  295. package/lib/packages/components/touchchat/component/RealtimeVoice.vue2.js +164 -0
  296. package/lib/packages/components/touchchat/component/RealtimeVoice.vue2.js.map +1 -0
  297. package/lib/packages/components/touchchat/component/Screenshot.vue.js +11 -0
  298. package/lib/packages/components/touchchat/component/Screenshot.vue.js.map +1 -0
  299. package/lib/packages/components/touchchat/component/Screenshot.vue2.js +212 -0
  300. package/lib/packages/components/touchchat/component/Screenshot.vue2.js.map +1 -0
  301. package/lib/packages/components/touchchat/component/ThoughtChain.vue.js +11 -0
  302. package/lib/packages/components/touchchat/component/ThoughtChain.vue.js.map +1 -0
  303. package/lib/packages/components/touchchat/component/ThoughtChain.vue2.js +73 -0
  304. package/lib/packages/components/touchchat/component/ThoughtChain.vue2.js.map +1 -0
  305. package/lib/packages/components/touchchat/component/UploadView.vue.js +11 -0
  306. package/lib/packages/components/touchchat/component/UploadView.vue.js.map +1 -0
  307. package/lib/packages/components/touchchat/component/UploadView.vue2.js +190 -0
  308. package/lib/packages/components/touchchat/component/UploadView.vue2.js.map +1 -0
  309. package/lib/packages/components/touchchat/component/UploadView_api.vue.js +11 -0
  310. package/lib/packages/components/touchchat/component/UploadView_api.vue.js.map +1 -0
  311. package/lib/packages/components/touchchat/component/UploadView_api.vue2.js +170 -0
  312. package/lib/packages/components/touchchat/component/UploadView_api.vue2.js.map +1 -0
  313. package/lib/packages/components/touchchat/component/VideoFile.vue.js +11 -0
  314. package/lib/packages/components/touchchat/component/VideoFile.vue.js.map +1 -0
  315. package/lib/packages/components/touchchat/component/VideoFile.vue2.js +37 -0
  316. package/lib/packages/components/touchchat/component/VideoFile.vue2.js.map +1 -0
  317. package/lib/packages/components/touchchat/component/VoiceView.vue.js +11 -0
  318. package/lib/packages/components/touchchat/component/VoiceView.vue.js.map +1 -0
  319. package/lib/packages/components/touchchat/component/VoiceView.vue2.js +169 -0
  320. package/lib/packages/components/touchchat/component/VoiceView.vue2.js.map +1 -0
  321. package/lib/packages/components/touchchat/img/file/doc.png.js +8 -0
  322. package/lib/packages/components/touchchat/img/file/doc.png.js.map +1 -0
  323. package/lib/packages/components/touchchat/img/file/docx.png.js +8 -0
  324. package/lib/packages/components/touchchat/img/file/docx.png.js.map +1 -0
  325. package/lib/packages/components/touchchat/img/file/gif.png.js +8 -0
  326. package/lib/packages/components/touchchat/img/file/gif.png.js.map +1 -0
  327. package/lib/packages/components/touchchat/img/file/html.png.js +8 -0
  328. package/lib/packages/components/touchchat/img/file/html.png.js.map +1 -0
  329. package/lib/packages/components/touchchat/img/file/jpg.png.js +8 -0
  330. package/lib/packages/components/touchchat/img/file/jpg.png.js.map +1 -0
  331. package/lib/packages/components/touchchat/img/file/mp3.png.js +8 -0
  332. package/lib/packages/components/touchchat/img/file/mp3.png.js.map +1 -0
  333. package/lib/packages/components/touchchat/img/file/mp4.png.js +8 -0
  334. package/lib/packages/components/touchchat/img/file/mp4.png.js.map +1 -0
  335. package/lib/packages/components/touchchat/img/file/music.png.js +8 -0
  336. package/lib/packages/components/touchchat/img/file/music.png.js.map +1 -0
  337. package/lib/packages/components/touchchat/img/file/pdf.png.js +8 -0
  338. package/lib/packages/components/touchchat/img/file/pdf.png.js.map +1 -0
  339. package/lib/packages/components/touchchat/img/file/png.png.js +8 -0
  340. package/lib/packages/components/touchchat/img/file/png.png.js.map +1 -0
  341. package/lib/packages/components/touchchat/img/file/ppt.png.js +8 -0
  342. package/lib/packages/components/touchchat/img/file/ppt.png.js.map +1 -0
  343. package/lib/packages/components/touchchat/img/file/pptx.png.js +8 -0
  344. package/lib/packages/components/touchchat/img/file/pptx.png.js.map +1 -0
  345. package/lib/packages/components/touchchat/img/file/txt.png.js +8 -0
  346. package/lib/packages/components/touchchat/img/file/txt.png.js.map +1 -0
  347. package/lib/packages/components/touchchat/img/file/xls.png.js +8 -0
  348. package/lib/packages/components/touchchat/img/file/xls.png.js.map +1 -0
  349. package/lib/packages/components/touchchat/img/file/xlsx.png.js +8 -0
  350. package/lib/packages/components/touchchat/img/file/xlsx.png.js.map +1 -0
  351. package/lib/packages/components/touchchat/img/svg/reset.svg.js +8 -0
  352. package/lib/packages/components/touchchat/img/svg/reset.svg.js.map +1 -0
  353. package/lib/packages/components/touchchat/index.js +6 -6
  354. package/lib/packages/components/touchchat/index.js.map +1 -1
  355. package/lib/packages/components/touchchat/src/AiChat/AgentsView.vue.js +11 -0
  356. package/lib/packages/components/touchchat/src/AiChat/AgentsView.vue.js.map +1 -0
  357. package/lib/packages/components/touchchat/src/AiChat/AgentsView.vue2.js +63 -0
  358. package/lib/packages/components/touchchat/src/AiChat/AgentsView.vue2.js.map +1 -0
  359. package/lib/packages/components/touchchat/src/AiChat/AiMessage.vue.js +3 -2
  360. package/lib/packages/components/touchchat/src/AiChat/AiMessage.vue.js.map +1 -1
  361. package/lib/packages/components/touchchat/src/AiChat/AiMessage.vue2.js +321 -138
  362. package/lib/packages/components/touchchat/src/AiChat/AiMessage.vue2.js.map +1 -1
  363. package/lib/packages/components/touchchat/src/AiChat/Chat/TouchChat.js +21 -0
  364. package/lib/packages/components/touchchat/src/AiChat/Chat/TouchChat.js.map +1 -0
  365. package/lib/packages/components/touchchat/src/AiChat/Chat/scriptMatcher.js +147 -0
  366. package/lib/packages/components/touchchat/src/AiChat/Chat/scriptMatcher.js.map +1 -0
  367. package/lib/packages/components/touchchat/src/AiChat/Chat/types.js +22 -0
  368. package/lib/packages/components/touchchat/src/AiChat/Chat/types.js.map +1 -0
  369. package/lib/packages/components/touchchat/src/AiChat/Chat/useChat.js +695 -0
  370. package/lib/packages/components/touchchat/src/AiChat/Chat/useChat.js.map +1 -0
  371. package/lib/packages/components/touchchat/src/AiChat/Chat/useCopy.js +57 -0
  372. package/lib/packages/components/touchchat/src/AiChat/Chat/useCopy.js.map +1 -0
  373. package/lib/packages/components/touchchat/src/AiChat/Chat/useMessageRender.js +157 -0
  374. package/lib/packages/components/touchchat/src/AiChat/Chat/useMessageRender.js.map +1 -0
  375. package/lib/packages/components/touchchat/src/AiChat/Chat/useSSE.js +347 -0
  376. package/lib/packages/components/touchchat/src/AiChat/Chat/useSSE.js.map +1 -0
  377. package/lib/packages/components/touchchat/src/AiChat/Chat/useScroll.js +76 -0
  378. package/lib/packages/components/touchchat/src/AiChat/Chat/useScroll.js.map +1 -0
  379. package/lib/packages/components/touchchat/src/AiChat/ChatInput.vue.js +3 -2
  380. package/lib/packages/components/touchchat/src/AiChat/ChatInput.vue.js.map +1 -1
  381. package/lib/packages/components/touchchat/src/AiChat/ChatInput.vue2.js +471 -43
  382. package/lib/packages/components/touchchat/src/AiChat/ChatInput.vue2.js.map +1 -1
  383. package/lib/packages/components/touchchat/src/AiChat/HistoryList.vue.js +3 -2
  384. package/lib/packages/components/touchchat/src/AiChat/HistoryList.vue.js.map +1 -1
  385. package/lib/packages/components/touchchat/src/AiChat/HistoryList.vue2.js +179 -97
  386. package/lib/packages/components/touchchat/src/AiChat/HistoryList.vue2.js.map +1 -1
  387. package/lib/packages/components/touchchat/src/AiChat/HistorySidebar.vue.js +3 -2
  388. package/lib/packages/components/touchchat/src/AiChat/HistorySidebar.vue.js.map +1 -1
  389. package/lib/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.js +28 -11
  390. package/lib/packages/components/touchchat/src/AiChat/HistorySidebar.vue2.js.map +1 -1
  391. package/lib/packages/components/touchchat/src/AiChat/MessageActions.vue.js +3 -2
  392. package/lib/packages/components/touchchat/src/AiChat/MessageActions.vue.js.map +1 -1
  393. package/lib/packages/components/touchchat/src/AiChat/MessageActions.vue2.js +174 -61
  394. package/lib/packages/components/touchchat/src/AiChat/MessageActions.vue2.js.map +1 -1
  395. package/lib/packages/components/touchchat/src/AiChat/SiderBarView.vue.js +3 -2
  396. package/lib/packages/components/touchchat/src/AiChat/SiderBarView.vue.js.map +1 -1
  397. package/lib/packages/components/touchchat/src/AiChat/SiderBarView.vue2.js +14 -8
  398. package/lib/packages/components/touchchat/src/AiChat/SiderBarView.vue2.js.map +1 -1
  399. package/lib/packages/components/touchchat/src/AiChat/TouchAgent.vue.js +11 -0
  400. package/lib/packages/components/touchchat/src/AiChat/TouchAgent.vue.js.map +1 -0
  401. package/lib/packages/components/touchchat/src/AiChat/TouchAgent.vue2.js +1038 -0
  402. package/lib/packages/components/touchchat/src/AiChat/TouchAgent.vue2.js.map +1 -0
  403. package/lib/packages/components/touchchat/src/AiChat/TouchChat.vue.js +3 -2
  404. package/lib/packages/components/touchchat/src/AiChat/TouchChat.vue.js.map +1 -1
  405. package/lib/packages/components/touchchat/src/AiChat/TouchChat.vue2.js +275 -1003
  406. package/lib/packages/components/touchchat/src/AiChat/TouchChat.vue2.js.map +1 -1
  407. package/lib/packages/components/touchchat/src/AiChat/TouchHistory.vue.js +3 -2
  408. package/lib/packages/components/touchchat/src/AiChat/TouchHistory.vue.js.map +1 -1
  409. package/lib/packages/components/touchchat/src/AiChat/TouchHistory.vue2.js +345 -121
  410. package/lib/packages/components/touchchat/src/AiChat/TouchHistory.vue2.js.map +1 -1
  411. package/lib/packages/components/touchchat/src/AiChat/UserMessage.vue.js +3 -2
  412. package/lib/packages/components/touchchat/src/AiChat/UserMessage.vue.js.map +1 -1
  413. package/lib/packages/components/touchchat/src/AiChat/UserMessage.vue2.js +142 -63
  414. package/lib/packages/components/touchchat/src/AiChat/UserMessage.vue2.js.map +1 -1
  415. package/lib/packages/components/touchchat/src/index.vue.js +3 -2
  416. package/lib/packages/components/touchchat/src/index.vue.js.map +1 -1
  417. package/lib/packages/components/touchchat/src/index.vue2.js +251 -142
  418. package/lib/packages/components/touchchat/src/index.vue2.js.map +1 -1
  419. package/lib/packages/components/touchchat/src/types/a2a.js +13 -0
  420. package/lib/packages/components/touchchat/src/types/a2a.js.map +1 -0
  421. package/lib/packages/components/touchchat/utils/a2aService.js +319 -0
  422. package/lib/packages/components/touchchat/utils/a2aService.js.map +1 -0
  423. package/lib/packages/components/touchchat/utils/fetchStream.js +8 -2
  424. package/lib/packages/components/touchchat/utils/fetchStream.js.map +1 -1
  425. package/lib/packages/components/touchchat/utils/markdown.js +31 -13
  426. package/lib/packages/components/touchchat/utils/markdown.js.map +1 -1
  427. package/lib/packages/utils/config.js.map +1 -1
  428. package/lib/packages/utils/types.js.map +1 -1
  429. package/package.json +83 -83
  430. package/theme/components/index.css +969 -43
  431. package/theme/font/iconfont.woff +0 -0
  432. package/theme/font/iconfont.woff2 +0 -0
  433. package/theme/index.css +969 -43
  434. package/theme/skin/default.css +969 -43
  435. package/types/global.d.ts +2 -2
  436. package/es/packages/components/touchchat/src/AiChat/Scene.vue.mjs +0 -6
  437. package/es/packages/components/touchchat/src/AiChat/Scene.vue.mjs.map +0 -1
  438. package/es/packages/components/touchchat/src/AiChat/Scene.vue2.mjs +0 -42
  439. package/es/packages/components/touchchat/src/AiChat/Scene.vue2.mjs.map +0 -1
  440. package/lib/packages/components/touchchat/src/AiChat/Scene.vue.js +0 -10
  441. package/lib/packages/components/touchchat/src/AiChat/Scene.vue.js.map +0 -1
  442. package/lib/packages/components/touchchat/src/AiChat/Scene.vue2.js +0 -46
  443. package/lib/packages/components/touchchat/src/AiChat/Scene.vue2.js.map +0 -1
@@ -0,0 +1,4819 @@
1
+ 'use strict';
2
+
3
+ var vue = require('vue');
4
+
5
+ var k;
6
+ (function(n) {
7
+ n.assertEqual = (s) => {
8
+ };
9
+ function e(s) {
10
+ }
11
+ n.assertIs = e;
12
+ function t(s) {
13
+ throw new Error();
14
+ }
15
+ n.assertNever = t, n.arrayToEnum = (s) => {
16
+ const a = {};
17
+ for (const i of s)
18
+ a[i] = i;
19
+ return a;
20
+ }, n.getValidEnumValues = (s) => {
21
+ const a = n.objectKeys(s).filter((o) => typeof s[s[o]] != "number"), i = {};
22
+ for (const o of a)
23
+ i[o] = s[o];
24
+ return n.objectValues(i);
25
+ }, n.objectValues = (s) => n.objectKeys(s).map(function(a) {
26
+ return s[a];
27
+ }), n.objectKeys = typeof Object.keys == "function" ? (s) => Object.keys(s) : (s) => {
28
+ const a = [];
29
+ for (const i in s)
30
+ Object.prototype.hasOwnProperty.call(s, i) && a.push(i);
31
+ return a;
32
+ }, n.find = (s, a) => {
33
+ for (const i of s)
34
+ if (a(i))
35
+ return i;
36
+ }, n.isInteger = typeof Number.isInteger == "function" ? (s) => Number.isInteger(s) : (s) => typeof s == "number" && Number.isFinite(s) && Math.floor(s) === s;
37
+ function r(s, a = " | ") {
38
+ return s.map((i) => typeof i == "string" ? `'${i}'` : i).join(a);
39
+ }
40
+ n.joinValues = r, n.jsonStringifyReplacer = (s, a) => typeof a == "bigint" ? a.toString() : a;
41
+ })(k || (k = {}));
42
+ var mt;
43
+ (function(n) {
44
+ n.mergeShapes = (e, t) => ({
45
+ ...e,
46
+ ...t
47
+ // second overwrites first
48
+ });
49
+ })(mt || (mt = {}));
50
+ const h = k.arrayToEnum([
51
+ "string",
52
+ "nan",
53
+ "number",
54
+ "integer",
55
+ "float",
56
+ "boolean",
57
+ "date",
58
+ "bigint",
59
+ "symbol",
60
+ "function",
61
+ "undefined",
62
+ "null",
63
+ "array",
64
+ "object",
65
+ "unknown",
66
+ "promise",
67
+ "void",
68
+ "never",
69
+ "map",
70
+ "set"
71
+ ]), q = (n) => {
72
+ switch (typeof n) {
73
+ case "undefined":
74
+ return h.undefined;
75
+ case "string":
76
+ return h.string;
77
+ case "number":
78
+ return Number.isNaN(n) ? h.nan : h.number;
79
+ case "boolean":
80
+ return h.boolean;
81
+ case "function":
82
+ return h.function;
83
+ case "bigint":
84
+ return h.bigint;
85
+ case "symbol":
86
+ return h.symbol;
87
+ case "object":
88
+ return Array.isArray(n) ? h.array : n === null ? h.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? h.promise : typeof Map != "undefined" && n instanceof Map ? h.map : typeof Set != "undefined" && n instanceof Set ? h.set : typeof Date != "undefined" && n instanceof Date ? h.date : h.object;
89
+ default:
90
+ return h.unknown;
91
+ }
92
+ }, d = k.arrayToEnum([
93
+ "invalid_type",
94
+ "invalid_literal",
95
+ "custom",
96
+ "invalid_union",
97
+ "invalid_union_discriminator",
98
+ "invalid_enum_value",
99
+ "unrecognized_keys",
100
+ "invalid_arguments",
101
+ "invalid_return_type",
102
+ "invalid_date",
103
+ "invalid_string",
104
+ "too_small",
105
+ "too_big",
106
+ "invalid_intersection_types",
107
+ "not_multiple_of",
108
+ "not_finite"
109
+ ]);
110
+ class z extends Error {
111
+ get errors() {
112
+ return this.issues;
113
+ }
114
+ constructor(e) {
115
+ super(), this.issues = [], this.addIssue = (r) => {
116
+ this.issues = [...this.issues, r];
117
+ }, this.addIssues = (r = []) => {
118
+ this.issues = [...this.issues, ...r];
119
+ };
120
+ const t = new.target.prototype;
121
+ Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
122
+ }
123
+ format(e) {
124
+ const t = e || function(a) {
125
+ return a.message;
126
+ }, r = { _errors: [] }, s = (a) => {
127
+ for (const i of a.issues)
128
+ if (i.code === "invalid_union")
129
+ i.unionErrors.map(s);
130
+ else if (i.code === "invalid_return_type")
131
+ s(i.returnTypeError);
132
+ else if (i.code === "invalid_arguments")
133
+ s(i.argumentsError);
134
+ else if (i.path.length === 0)
135
+ r._errors.push(t(i));
136
+ else {
137
+ let o = r, c = 0;
138
+ for (; c < i.path.length; ) {
139
+ const u = i.path[c];
140
+ c === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(t(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], c++;
141
+ }
142
+ }
143
+ };
144
+ return s(this), r;
145
+ }
146
+ static assert(e) {
147
+ if (!(e instanceof z))
148
+ throw new Error(`Not a ZodError: ${e}`);
149
+ }
150
+ toString() {
151
+ return this.message;
152
+ }
153
+ get message() {
154
+ return JSON.stringify(this.issues, k.jsonStringifyReplacer, 2);
155
+ }
156
+ get isEmpty() {
157
+ return this.issues.length === 0;
158
+ }
159
+ flatten(e = (t) => t.message) {
160
+ const t = {}, r = [];
161
+ for (const s of this.issues)
162
+ if (s.path.length > 0) {
163
+ const a = s.path[0];
164
+ t[a] = t[a] || [], t[a].push(e(s));
165
+ } else
166
+ r.push(e(s));
167
+ return { formErrors: r, fieldErrors: t };
168
+ }
169
+ get formErrors() {
170
+ return this.flatten();
171
+ }
172
+ }
173
+ z.create = (n) => new z(n);
174
+ const an = (n, e) => {
175
+ let t;
176
+ switch (n.code) {
177
+ case d.invalid_type:
178
+ n.received === h.undefined ? t = "Required" : t = `Expected ${n.expected}, received ${n.received}`;
179
+ break;
180
+ case d.invalid_literal:
181
+ t = `Invalid literal value, expected ${JSON.stringify(n.expected, k.jsonStringifyReplacer)}`;
182
+ break;
183
+ case d.unrecognized_keys:
184
+ t = `Unrecognized key(s) in object: ${k.joinValues(n.keys, ", ")}`;
185
+ break;
186
+ case d.invalid_union:
187
+ t = "Invalid input";
188
+ break;
189
+ case d.invalid_union_discriminator:
190
+ t = `Invalid discriminator value. Expected ${k.joinValues(n.options)}`;
191
+ break;
192
+ case d.invalid_enum_value:
193
+ t = `Invalid enum value. Expected ${k.joinValues(n.options)}, received '${n.received}'`;
194
+ break;
195
+ case d.invalid_arguments:
196
+ t = "Invalid function arguments";
197
+ break;
198
+ case d.invalid_return_type:
199
+ t = "Invalid function return type";
200
+ break;
201
+ case d.invalid_date:
202
+ t = "Invalid date";
203
+ break;
204
+ case d.invalid_string:
205
+ typeof n.validation == "object" ? "includes" in n.validation ? (t = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? t = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? t = `Invalid input: must end with "${n.validation.endsWith}"` : k.assertNever(n.validation) : n.validation !== "regex" ? t = `Invalid ${n.validation}` : t = "Invalid";
206
+ break;
207
+ case d.too_small:
208
+ n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "bigint" ? t = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : t = "Invalid input";
209
+ break;
210
+ case d.too_big:
211
+ n.type === "array" ? t = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? t = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? t = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? t = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? t = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : t = "Invalid input";
212
+ break;
213
+ case d.custom:
214
+ t = "Invalid input";
215
+ break;
216
+ case d.invalid_intersection_types:
217
+ t = "Intersection results could not be merged";
218
+ break;
219
+ case d.not_multiple_of:
220
+ t = `Number must be a multiple of ${n.multipleOf}`;
221
+ break;
222
+ case d.not_finite:
223
+ t = "Number must be finite";
224
+ break;
225
+ default:
226
+ t = e.defaultError, k.assertNever(n);
227
+ }
228
+ return { message: t };
229
+ }, Fe = an;
230
+ let on = Fe;
231
+ function cn() {
232
+ return on;
233
+ }
234
+ const un = (n) => {
235
+ const { data: e, path: t, errorMaps: r, issueData: s } = n, a = [...t, ...s.path || []], i = {
236
+ ...s,
237
+ path: a
238
+ };
239
+ if (s.message !== void 0)
240
+ return {
241
+ ...s,
242
+ path: a,
243
+ message: s.message
244
+ };
245
+ let o = "";
246
+ const c = r.filter((u) => !!u).slice().reverse();
247
+ for (const u of c)
248
+ o = u(i, { data: e, defaultError: o }).message;
249
+ return {
250
+ ...s,
251
+ path: a,
252
+ message: o
253
+ };
254
+ };
255
+ function f(n, e) {
256
+ const t = cn(), r = un({
257
+ issueData: e,
258
+ data: n.data,
259
+ path: n.path,
260
+ errorMaps: [
261
+ n.common.contextualErrorMap,
262
+ // contextual error map is first priority
263
+ n.schemaErrorMap,
264
+ // then schema-bound map if available
265
+ t,
266
+ // then global override map
267
+ t === Fe ? void 0 : Fe
268
+ // then global default map
269
+ ].filter((s) => !!s)
270
+ });
271
+ n.common.issues.push(r);
272
+ }
273
+ class P {
274
+ constructor() {
275
+ this.value = "valid";
276
+ }
277
+ dirty() {
278
+ this.value === "valid" && (this.value = "dirty");
279
+ }
280
+ abort() {
281
+ this.value !== "aborted" && (this.value = "aborted");
282
+ }
283
+ static mergeArray(e, t) {
284
+ const r = [];
285
+ for (const s of t) {
286
+ if (s.status === "aborted")
287
+ return g;
288
+ s.status === "dirty" && e.dirty(), r.push(s.value);
289
+ }
290
+ return { status: e.value, value: r };
291
+ }
292
+ static async mergeObjectAsync(e, t) {
293
+ const r = [];
294
+ for (const s of t) {
295
+ const a = await s.key, i = await s.value;
296
+ r.push({
297
+ key: a,
298
+ value: i
299
+ });
300
+ }
301
+ return P.mergeObjectSync(e, r);
302
+ }
303
+ static mergeObjectSync(e, t) {
304
+ const r = {};
305
+ for (const s of t) {
306
+ const { key: a, value: i } = s;
307
+ if (a.status === "aborted" || i.status === "aborted")
308
+ return g;
309
+ a.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), a.value !== "__proto__" && (typeof i.value != "undefined" || s.alwaysSet) && (r[a.value] = i.value);
310
+ }
311
+ return { status: e.value, value: r };
312
+ }
313
+ }
314
+ const g = Object.freeze({
315
+ status: "aborted"
316
+ }), fe = (n) => ({ status: "dirty", value: n }), E = (n) => ({ status: "valid", value: n }), yt = (n) => n.status === "aborted", gt = (n) => n.status === "dirty", re = (n) => n.status === "valid", ke = (n) => typeof Promise != "undefined" && n instanceof Promise;
317
+ var p;
318
+ (function(n) {
319
+ n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
320
+ })(p || (p = {}));
321
+ class V {
322
+ constructor(e, t, r, s) {
323
+ this._cachedPath = [], this.parent = e, this.data = t, this._path = r, this._key = s;
324
+ }
325
+ get path() {
326
+ return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
327
+ }
328
+ }
329
+ const vt = (n, e) => {
330
+ if (re(e))
331
+ return { success: !0, data: e.value };
332
+ if (!n.common.issues.length)
333
+ throw new Error("Validation failed but no issues detected.");
334
+ return {
335
+ success: !1,
336
+ get error() {
337
+ if (this._error)
338
+ return this._error;
339
+ const t = new z(n.common.issues);
340
+ return this._error = t, this._error;
341
+ }
342
+ };
343
+ };
344
+ function _(n) {
345
+ if (!n)
346
+ return {};
347
+ const { errorMap: e, invalid_type_error: t, required_error: r, description: s } = n;
348
+ if (e && (t || r))
349
+ throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
350
+ return e ? { errorMap: e, description: s } : { errorMap: (i, o) => {
351
+ var u, y;
352
+ const { message: c } = n;
353
+ return i.code === "invalid_enum_value" ? { message: c != null ? c : o.defaultError } : typeof o.data == "undefined" ? { message: (u = c != null ? c : r) != null ? u : o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: (y = c != null ? c : t) != null ? y : o.defaultError };
354
+ }, description: s };
355
+ }
356
+ class b {
357
+ get description() {
358
+ return this._def.description;
359
+ }
360
+ _getType(e) {
361
+ return q(e.data);
362
+ }
363
+ _getOrReturnCtx(e, t) {
364
+ return t || {
365
+ common: e.parent.common,
366
+ data: e.data,
367
+ parsedType: q(e.data),
368
+ schemaErrorMap: this._def.errorMap,
369
+ path: e.path,
370
+ parent: e.parent
371
+ };
372
+ }
373
+ _processInputParams(e) {
374
+ return {
375
+ status: new P(),
376
+ ctx: {
377
+ common: e.parent.common,
378
+ data: e.data,
379
+ parsedType: q(e.data),
380
+ schemaErrorMap: this._def.errorMap,
381
+ path: e.path,
382
+ parent: e.parent
383
+ }
384
+ };
385
+ }
386
+ _parseSync(e) {
387
+ const t = this._parse(e);
388
+ if (ke(t))
389
+ throw new Error("Synchronous parse encountered promise.");
390
+ return t;
391
+ }
392
+ _parseAsync(e) {
393
+ const t = this._parse(e);
394
+ return Promise.resolve(t);
395
+ }
396
+ parse(e, t) {
397
+ const r = this.safeParse(e, t);
398
+ if (r.success)
399
+ return r.data;
400
+ throw r.error;
401
+ }
402
+ safeParse(e, t) {
403
+ var a;
404
+ const r = {
405
+ common: {
406
+ issues: [],
407
+ async: (a = t == null ? void 0 : t.async) != null ? a : !1,
408
+ contextualErrorMap: t == null ? void 0 : t.errorMap
409
+ },
410
+ path: (t == null ? void 0 : t.path) || [],
411
+ schemaErrorMap: this._def.errorMap,
412
+ parent: null,
413
+ data: e,
414
+ parsedType: q(e)
415
+ }, s = this._parseSync({ data: e, path: r.path, parent: r });
416
+ return vt(r, s);
417
+ }
418
+ "~validate"(e) {
419
+ var r, s;
420
+ const t = {
421
+ common: {
422
+ issues: [],
423
+ async: !!this["~standard"].async
424
+ },
425
+ path: [],
426
+ schemaErrorMap: this._def.errorMap,
427
+ parent: null,
428
+ data: e,
429
+ parsedType: q(e)
430
+ };
431
+ if (!this["~standard"].async)
432
+ try {
433
+ const a = this._parseSync({ data: e, path: [], parent: t });
434
+ return re(a) ? {
435
+ value: a.value
436
+ } : {
437
+ issues: t.common.issues
438
+ };
439
+ } catch (a) {
440
+ (s = (r = a == null ? void 0 : a.message) == null ? void 0 : r.toLowerCase()) != null && s.includes("encountered") && (this["~standard"].async = !0), t.common = {
441
+ issues: [],
442
+ async: !0
443
+ };
444
+ }
445
+ return this._parseAsync({ data: e, path: [], parent: t }).then((a) => re(a) ? {
446
+ value: a.value
447
+ } : {
448
+ issues: t.common.issues
449
+ });
450
+ }
451
+ async parseAsync(e, t) {
452
+ const r = await this.safeParseAsync(e, t);
453
+ if (r.success)
454
+ return r.data;
455
+ throw r.error;
456
+ }
457
+ async safeParseAsync(e, t) {
458
+ const r = {
459
+ common: {
460
+ issues: [],
461
+ contextualErrorMap: t == null ? void 0 : t.errorMap,
462
+ async: !0
463
+ },
464
+ path: (t == null ? void 0 : t.path) || [],
465
+ schemaErrorMap: this._def.errorMap,
466
+ parent: null,
467
+ data: e,
468
+ parsedType: q(e)
469
+ }, s = this._parse({ data: e, path: r.path, parent: r }), a = await (ke(s) ? s : Promise.resolve(s));
470
+ return vt(r, a);
471
+ }
472
+ refine(e, t) {
473
+ const r = (s) => typeof t == "string" || typeof t == "undefined" ? { message: t } : typeof t == "function" ? t(s) : t;
474
+ return this._refinement((s, a) => {
475
+ const i = e(s), o = () => a.addIssue({
476
+ code: d.custom,
477
+ ...r(s)
478
+ });
479
+ return typeof Promise != "undefined" && i instanceof Promise ? i.then((c) => c ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
480
+ });
481
+ }
482
+ refinement(e, t) {
483
+ return this._refinement((r, s) => e(r) ? !0 : (s.addIssue(typeof t == "function" ? t(r, s) : t), !1));
484
+ }
485
+ _refinement(e) {
486
+ return new K({
487
+ schema: this,
488
+ typeName: l.ZodEffects,
489
+ effect: { type: "refinement", refinement: e }
490
+ });
491
+ }
492
+ superRefine(e) {
493
+ return this._refinement(e);
494
+ }
495
+ constructor(e) {
496
+ this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this), this["~standard"] = {
497
+ version: 1,
498
+ vendor: "zod",
499
+ validate: (t) => this["~validate"](t)
500
+ };
501
+ }
502
+ optional() {
503
+ return H.create(this, this._def);
504
+ }
505
+ nullable() {
506
+ return ce.create(this, this._def);
507
+ }
508
+ nullish() {
509
+ return this.nullable().optional();
510
+ }
511
+ array() {
512
+ return L.create(this);
513
+ }
514
+ promise() {
515
+ return Ae.create(this, this._def);
516
+ }
517
+ or(e) {
518
+ return xe.create([this, e], this._def);
519
+ }
520
+ and(e) {
521
+ return we.create(this, e, this._def);
522
+ }
523
+ transform(e) {
524
+ return new K({
525
+ ..._(this._def),
526
+ schema: this,
527
+ typeName: l.ZodEffects,
528
+ effect: { type: "transform", transform: e }
529
+ });
530
+ }
531
+ default(e) {
532
+ const t = typeof e == "function" ? e : () => e;
533
+ return new nt({
534
+ ..._(this._def),
535
+ innerType: this,
536
+ defaultValue: t,
537
+ typeName: l.ZodDefault
538
+ });
539
+ }
540
+ brand() {
541
+ return new jn({
542
+ typeName: l.ZodBranded,
543
+ type: this,
544
+ ..._(this._def)
545
+ });
546
+ }
547
+ catch(e) {
548
+ const t = typeof e == "function" ? e : () => e;
549
+ return new rt({
550
+ ..._(this._def),
551
+ innerType: this,
552
+ catchValue: t,
553
+ typeName: l.ZodCatch
554
+ });
555
+ }
556
+ describe(e) {
557
+ const t = this.constructor;
558
+ return new t({
559
+ ...this._def,
560
+ description: e
561
+ });
562
+ }
563
+ pipe(e) {
564
+ return ot.create(this, e);
565
+ }
566
+ readonly() {
567
+ return at.create(this);
568
+ }
569
+ isOptional() {
570
+ return this.safeParse(void 0).success;
571
+ }
572
+ isNullable() {
573
+ return this.safeParse(null).success;
574
+ }
575
+ }
576
+ const dn = /^c[^\s-]{8,}$/i, ln = /^[0-9a-z]+$/, fn = /^[0-9A-HJKMNP-TV-Z]{26}$/i, hn = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i, pn = /^[a-z0-9_-]{21}$/i, mn = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, yn = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, gn = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, vn = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
577
+ let Ee;
578
+ const _n = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, bn = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, kn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, xn = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, wn = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, Sn = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, jt = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", An = new RegExp(`^${jt}$`);
579
+ function It(n) {
580
+ let e = "[0-5]\\d";
581
+ n.precision ? e = `${e}\\.\\d{${n.precision}}` : n.precision == null && (e = `${e}(\\.\\d+)?`);
582
+ const t = n.precision ? "+" : "?";
583
+ return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
584
+ }
585
+ function Tn(n) {
586
+ return new RegExp(`^${It(n)}$`);
587
+ }
588
+ function Cn(n) {
589
+ let e = `${jt}T${It(n)}`;
590
+ const t = [];
591
+ return t.push(n.local ? "Z?" : "Z"), n.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
592
+ }
593
+ function On(n, e) {
594
+ return !!((e === "v4" || !e) && _n.test(n) || (e === "v6" || !e) && kn.test(n));
595
+ }
596
+ function Nn(n, e) {
597
+ if (!mn.test(n))
598
+ return !1;
599
+ try {
600
+ const [t] = n.split(".");
601
+ if (!t)
602
+ return !1;
603
+ const r = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), s = JSON.parse(atob(r));
604
+ return !(typeof s != "object" || s === null || "typ" in s && (s == null ? void 0 : s.typ) !== "JWT" || !s.alg || e && s.alg !== e);
605
+ } catch (t) {
606
+ return !1;
607
+ }
608
+ }
609
+ function Zn(n, e) {
610
+ return !!((e === "v4" || !e) && bn.test(n) || (e === "v6" || !e) && xn.test(n));
611
+ }
612
+ class F extends b {
613
+ _parse(e) {
614
+ if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== h.string) {
615
+ const a = this._getOrReturnCtx(e);
616
+ return f(a, {
617
+ code: d.invalid_type,
618
+ expected: h.string,
619
+ received: a.parsedType
620
+ }), g;
621
+ }
622
+ const r = new P();
623
+ let s;
624
+ for (const a of this._def.checks)
625
+ if (a.kind === "min")
626
+ e.data.length < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
627
+ code: d.too_small,
628
+ minimum: a.value,
629
+ type: "string",
630
+ inclusive: !0,
631
+ exact: !1,
632
+ message: a.message
633
+ }), r.dirty());
634
+ else if (a.kind === "max")
635
+ e.data.length > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
636
+ code: d.too_big,
637
+ maximum: a.value,
638
+ type: "string",
639
+ inclusive: !0,
640
+ exact: !1,
641
+ message: a.message
642
+ }), r.dirty());
643
+ else if (a.kind === "length") {
644
+ const i = e.data.length > a.value, o = e.data.length < a.value;
645
+ (i || o) && (s = this._getOrReturnCtx(e, s), i ? f(s, {
646
+ code: d.too_big,
647
+ maximum: a.value,
648
+ type: "string",
649
+ inclusive: !0,
650
+ exact: !0,
651
+ message: a.message
652
+ }) : o && f(s, {
653
+ code: d.too_small,
654
+ minimum: a.value,
655
+ type: "string",
656
+ inclusive: !0,
657
+ exact: !0,
658
+ message: a.message
659
+ }), r.dirty());
660
+ } else if (a.kind === "email")
661
+ gn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
662
+ validation: "email",
663
+ code: d.invalid_string,
664
+ message: a.message
665
+ }), r.dirty());
666
+ else if (a.kind === "emoji")
667
+ Ee || (Ee = new RegExp(vn, "u")), Ee.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
668
+ validation: "emoji",
669
+ code: d.invalid_string,
670
+ message: a.message
671
+ }), r.dirty());
672
+ else if (a.kind === "uuid")
673
+ hn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
674
+ validation: "uuid",
675
+ code: d.invalid_string,
676
+ message: a.message
677
+ }), r.dirty());
678
+ else if (a.kind === "nanoid")
679
+ pn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
680
+ validation: "nanoid",
681
+ code: d.invalid_string,
682
+ message: a.message
683
+ }), r.dirty());
684
+ else if (a.kind === "cuid")
685
+ dn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
686
+ validation: "cuid",
687
+ code: d.invalid_string,
688
+ message: a.message
689
+ }), r.dirty());
690
+ else if (a.kind === "cuid2")
691
+ ln.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
692
+ validation: "cuid2",
693
+ code: d.invalid_string,
694
+ message: a.message
695
+ }), r.dirty());
696
+ else if (a.kind === "ulid")
697
+ fn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
698
+ validation: "ulid",
699
+ code: d.invalid_string,
700
+ message: a.message
701
+ }), r.dirty());
702
+ else if (a.kind === "url")
703
+ try {
704
+ new URL(e.data);
705
+ } catch (i) {
706
+ s = this._getOrReturnCtx(e, s), f(s, {
707
+ validation: "url",
708
+ code: d.invalid_string,
709
+ message: a.message
710
+ }), r.dirty();
711
+ }
712
+ else
713
+ a.kind === "regex" ? (a.regex.lastIndex = 0, a.regex.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
714
+ validation: "regex",
715
+ code: d.invalid_string,
716
+ message: a.message
717
+ }), r.dirty())) : a.kind === "trim" ? e.data = e.data.trim() : a.kind === "includes" ? e.data.includes(a.value, a.position) || (s = this._getOrReturnCtx(e, s), f(s, {
718
+ code: d.invalid_string,
719
+ validation: { includes: a.value, position: a.position },
720
+ message: a.message
721
+ }), r.dirty()) : a.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : a.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : a.kind === "startsWith" ? e.data.startsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
722
+ code: d.invalid_string,
723
+ validation: { startsWith: a.value },
724
+ message: a.message
725
+ }), r.dirty()) : a.kind === "endsWith" ? e.data.endsWith(a.value) || (s = this._getOrReturnCtx(e, s), f(s, {
726
+ code: d.invalid_string,
727
+ validation: { endsWith: a.value },
728
+ message: a.message
729
+ }), r.dirty()) : a.kind === "datetime" ? Cn(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
730
+ code: d.invalid_string,
731
+ validation: "datetime",
732
+ message: a.message
733
+ }), r.dirty()) : a.kind === "date" ? An.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
734
+ code: d.invalid_string,
735
+ validation: "date",
736
+ message: a.message
737
+ }), r.dirty()) : a.kind === "time" ? Tn(a).test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
738
+ code: d.invalid_string,
739
+ validation: "time",
740
+ message: a.message
741
+ }), r.dirty()) : a.kind === "duration" ? yn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
742
+ validation: "duration",
743
+ code: d.invalid_string,
744
+ message: a.message
745
+ }), r.dirty()) : a.kind === "ip" ? On(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
746
+ validation: "ip",
747
+ code: d.invalid_string,
748
+ message: a.message
749
+ }), r.dirty()) : a.kind === "jwt" ? Nn(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), f(s, {
750
+ validation: "jwt",
751
+ code: d.invalid_string,
752
+ message: a.message
753
+ }), r.dirty()) : a.kind === "cidr" ? Zn(e.data, a.version) || (s = this._getOrReturnCtx(e, s), f(s, {
754
+ validation: "cidr",
755
+ code: d.invalid_string,
756
+ message: a.message
757
+ }), r.dirty()) : a.kind === "base64" ? wn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
758
+ validation: "base64",
759
+ code: d.invalid_string,
760
+ message: a.message
761
+ }), r.dirty()) : a.kind === "base64url" ? Sn.test(e.data) || (s = this._getOrReturnCtx(e, s), f(s, {
762
+ validation: "base64url",
763
+ code: d.invalid_string,
764
+ message: a.message
765
+ }), r.dirty()) : k.assertNever(a);
766
+ return { status: r.value, value: e.data };
767
+ }
768
+ _regex(e, t, r) {
769
+ return this.refinement((s) => e.test(s), {
770
+ validation: t,
771
+ code: d.invalid_string,
772
+ ...p.errToObj(r)
773
+ });
774
+ }
775
+ _addCheck(e) {
776
+ return new F({
777
+ ...this._def,
778
+ checks: [...this._def.checks, e]
779
+ });
780
+ }
781
+ email(e) {
782
+ return this._addCheck({ kind: "email", ...p.errToObj(e) });
783
+ }
784
+ url(e) {
785
+ return this._addCheck({ kind: "url", ...p.errToObj(e) });
786
+ }
787
+ emoji(e) {
788
+ return this._addCheck({ kind: "emoji", ...p.errToObj(e) });
789
+ }
790
+ uuid(e) {
791
+ return this._addCheck({ kind: "uuid", ...p.errToObj(e) });
792
+ }
793
+ nanoid(e) {
794
+ return this._addCheck({ kind: "nanoid", ...p.errToObj(e) });
795
+ }
796
+ cuid(e) {
797
+ return this._addCheck({ kind: "cuid", ...p.errToObj(e) });
798
+ }
799
+ cuid2(e) {
800
+ return this._addCheck({ kind: "cuid2", ...p.errToObj(e) });
801
+ }
802
+ ulid(e) {
803
+ return this._addCheck({ kind: "ulid", ...p.errToObj(e) });
804
+ }
805
+ base64(e) {
806
+ return this._addCheck({ kind: "base64", ...p.errToObj(e) });
807
+ }
808
+ base64url(e) {
809
+ return this._addCheck({
810
+ kind: "base64url",
811
+ ...p.errToObj(e)
812
+ });
813
+ }
814
+ jwt(e) {
815
+ return this._addCheck({ kind: "jwt", ...p.errToObj(e) });
816
+ }
817
+ ip(e) {
818
+ return this._addCheck({ kind: "ip", ...p.errToObj(e) });
819
+ }
820
+ cidr(e) {
821
+ return this._addCheck({ kind: "cidr", ...p.errToObj(e) });
822
+ }
823
+ datetime(e) {
824
+ var t, r;
825
+ return typeof e == "string" ? this._addCheck({
826
+ kind: "datetime",
827
+ precision: null,
828
+ offset: !1,
829
+ local: !1,
830
+ message: e
831
+ }) : this._addCheck({
832
+ kind: "datetime",
833
+ precision: typeof (e == null ? void 0 : e.precision) == "undefined" ? null : e == null ? void 0 : e.precision,
834
+ offset: (t = e == null ? void 0 : e.offset) != null ? t : !1,
835
+ local: (r = e == null ? void 0 : e.local) != null ? r : !1,
836
+ ...p.errToObj(e == null ? void 0 : e.message)
837
+ });
838
+ }
839
+ date(e) {
840
+ return this._addCheck({ kind: "date", message: e });
841
+ }
842
+ time(e) {
843
+ return typeof e == "string" ? this._addCheck({
844
+ kind: "time",
845
+ precision: null,
846
+ message: e
847
+ }) : this._addCheck({
848
+ kind: "time",
849
+ precision: typeof (e == null ? void 0 : e.precision) == "undefined" ? null : e == null ? void 0 : e.precision,
850
+ ...p.errToObj(e == null ? void 0 : e.message)
851
+ });
852
+ }
853
+ duration(e) {
854
+ return this._addCheck({ kind: "duration", ...p.errToObj(e) });
855
+ }
856
+ regex(e, t) {
857
+ return this._addCheck({
858
+ kind: "regex",
859
+ regex: e,
860
+ ...p.errToObj(t)
861
+ });
862
+ }
863
+ includes(e, t) {
864
+ return this._addCheck({
865
+ kind: "includes",
866
+ value: e,
867
+ position: t == null ? void 0 : t.position,
868
+ ...p.errToObj(t == null ? void 0 : t.message)
869
+ });
870
+ }
871
+ startsWith(e, t) {
872
+ return this._addCheck({
873
+ kind: "startsWith",
874
+ value: e,
875
+ ...p.errToObj(t)
876
+ });
877
+ }
878
+ endsWith(e, t) {
879
+ return this._addCheck({
880
+ kind: "endsWith",
881
+ value: e,
882
+ ...p.errToObj(t)
883
+ });
884
+ }
885
+ min(e, t) {
886
+ return this._addCheck({
887
+ kind: "min",
888
+ value: e,
889
+ ...p.errToObj(t)
890
+ });
891
+ }
892
+ max(e, t) {
893
+ return this._addCheck({
894
+ kind: "max",
895
+ value: e,
896
+ ...p.errToObj(t)
897
+ });
898
+ }
899
+ length(e, t) {
900
+ return this._addCheck({
901
+ kind: "length",
902
+ value: e,
903
+ ...p.errToObj(t)
904
+ });
905
+ }
906
+ /**
907
+ * Equivalent to `.min(1)`
908
+ */
909
+ nonempty(e) {
910
+ return this.min(1, p.errToObj(e));
911
+ }
912
+ trim() {
913
+ return new F({
914
+ ...this._def,
915
+ checks: [...this._def.checks, { kind: "trim" }]
916
+ });
917
+ }
918
+ toLowerCase() {
919
+ return new F({
920
+ ...this._def,
921
+ checks: [...this._def.checks, { kind: "toLowerCase" }]
922
+ });
923
+ }
924
+ toUpperCase() {
925
+ return new F({
926
+ ...this._def,
927
+ checks: [...this._def.checks, { kind: "toUpperCase" }]
928
+ });
929
+ }
930
+ get isDatetime() {
931
+ return !!this._def.checks.find((e) => e.kind === "datetime");
932
+ }
933
+ get isDate() {
934
+ return !!this._def.checks.find((e) => e.kind === "date");
935
+ }
936
+ get isTime() {
937
+ return !!this._def.checks.find((e) => e.kind === "time");
938
+ }
939
+ get isDuration() {
940
+ return !!this._def.checks.find((e) => e.kind === "duration");
941
+ }
942
+ get isEmail() {
943
+ return !!this._def.checks.find((e) => e.kind === "email");
944
+ }
945
+ get isURL() {
946
+ return !!this._def.checks.find((e) => e.kind === "url");
947
+ }
948
+ get isEmoji() {
949
+ return !!this._def.checks.find((e) => e.kind === "emoji");
950
+ }
951
+ get isUUID() {
952
+ return !!this._def.checks.find((e) => e.kind === "uuid");
953
+ }
954
+ get isNANOID() {
955
+ return !!this._def.checks.find((e) => e.kind === "nanoid");
956
+ }
957
+ get isCUID() {
958
+ return !!this._def.checks.find((e) => e.kind === "cuid");
959
+ }
960
+ get isCUID2() {
961
+ return !!this._def.checks.find((e) => e.kind === "cuid2");
962
+ }
963
+ get isULID() {
964
+ return !!this._def.checks.find((e) => e.kind === "ulid");
965
+ }
966
+ get isIP() {
967
+ return !!this._def.checks.find((e) => e.kind === "ip");
968
+ }
969
+ get isCIDR() {
970
+ return !!this._def.checks.find((e) => e.kind === "cidr");
971
+ }
972
+ get isBase64() {
973
+ return !!this._def.checks.find((e) => e.kind === "base64");
974
+ }
975
+ get isBase64url() {
976
+ return !!this._def.checks.find((e) => e.kind === "base64url");
977
+ }
978
+ get minLength() {
979
+ let e = null;
980
+ for (const t of this._def.checks)
981
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
982
+ return e;
983
+ }
984
+ get maxLength() {
985
+ let e = null;
986
+ for (const t of this._def.checks)
987
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
988
+ return e;
989
+ }
990
+ }
991
+ F.create = (n) => {
992
+ var e;
993
+ return new F({
994
+ checks: [],
995
+ typeName: l.ZodString,
996
+ coerce: (e = n == null ? void 0 : n.coerce) != null ? e : !1,
997
+ ..._(n)
998
+ });
999
+ };
1000
+ function Pn(n, e) {
1001
+ const t = (n.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, s = t > r ? t : r, a = Number.parseInt(n.toFixed(s).replace(".", "")), i = Number.parseInt(e.toFixed(s).replace(".", ""));
1002
+ return a % i / 10 ** s;
1003
+ }
1004
+ class se extends b {
1005
+ constructor() {
1006
+ super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
1007
+ }
1008
+ _parse(e) {
1009
+ if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== h.number) {
1010
+ const a = this._getOrReturnCtx(e);
1011
+ return f(a, {
1012
+ code: d.invalid_type,
1013
+ expected: h.number,
1014
+ received: a.parsedType
1015
+ }), g;
1016
+ }
1017
+ let r;
1018
+ const s = new P();
1019
+ for (const a of this._def.checks)
1020
+ a.kind === "int" ? k.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
1021
+ code: d.invalid_type,
1022
+ expected: "integer",
1023
+ received: "float",
1024
+ message: a.message
1025
+ }), s.dirty()) : a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1026
+ code: d.too_small,
1027
+ minimum: a.value,
1028
+ type: "number",
1029
+ inclusive: a.inclusive,
1030
+ exact: !1,
1031
+ message: a.message
1032
+ }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1033
+ code: d.too_big,
1034
+ maximum: a.value,
1035
+ type: "number",
1036
+ inclusive: a.inclusive,
1037
+ exact: !1,
1038
+ message: a.message
1039
+ }), s.dirty()) : a.kind === "multipleOf" ? Pn(e.data, a.value) !== 0 && (r = this._getOrReturnCtx(e, r), f(r, {
1040
+ code: d.not_multiple_of,
1041
+ multipleOf: a.value,
1042
+ message: a.message
1043
+ }), s.dirty()) : a.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), f(r, {
1044
+ code: d.not_finite,
1045
+ message: a.message
1046
+ }), s.dirty()) : k.assertNever(a);
1047
+ return { status: s.value, value: e.data };
1048
+ }
1049
+ gte(e, t) {
1050
+ return this.setLimit("min", e, !0, p.toString(t));
1051
+ }
1052
+ gt(e, t) {
1053
+ return this.setLimit("min", e, !1, p.toString(t));
1054
+ }
1055
+ lte(e, t) {
1056
+ return this.setLimit("max", e, !0, p.toString(t));
1057
+ }
1058
+ lt(e, t) {
1059
+ return this.setLimit("max", e, !1, p.toString(t));
1060
+ }
1061
+ setLimit(e, t, r, s) {
1062
+ return new se({
1063
+ ...this._def,
1064
+ checks: [
1065
+ ...this._def.checks,
1066
+ {
1067
+ kind: e,
1068
+ value: t,
1069
+ inclusive: r,
1070
+ message: p.toString(s)
1071
+ }
1072
+ ]
1073
+ });
1074
+ }
1075
+ _addCheck(e) {
1076
+ return new se({
1077
+ ...this._def,
1078
+ checks: [...this._def.checks, e]
1079
+ });
1080
+ }
1081
+ int(e) {
1082
+ return this._addCheck({
1083
+ kind: "int",
1084
+ message: p.toString(e)
1085
+ });
1086
+ }
1087
+ positive(e) {
1088
+ return this._addCheck({
1089
+ kind: "min",
1090
+ value: 0,
1091
+ inclusive: !1,
1092
+ message: p.toString(e)
1093
+ });
1094
+ }
1095
+ negative(e) {
1096
+ return this._addCheck({
1097
+ kind: "max",
1098
+ value: 0,
1099
+ inclusive: !1,
1100
+ message: p.toString(e)
1101
+ });
1102
+ }
1103
+ nonpositive(e) {
1104
+ return this._addCheck({
1105
+ kind: "max",
1106
+ value: 0,
1107
+ inclusive: !0,
1108
+ message: p.toString(e)
1109
+ });
1110
+ }
1111
+ nonnegative(e) {
1112
+ return this._addCheck({
1113
+ kind: "min",
1114
+ value: 0,
1115
+ inclusive: !0,
1116
+ message: p.toString(e)
1117
+ });
1118
+ }
1119
+ multipleOf(e, t) {
1120
+ return this._addCheck({
1121
+ kind: "multipleOf",
1122
+ value: e,
1123
+ message: p.toString(t)
1124
+ });
1125
+ }
1126
+ finite(e) {
1127
+ return this._addCheck({
1128
+ kind: "finite",
1129
+ message: p.toString(e)
1130
+ });
1131
+ }
1132
+ safe(e) {
1133
+ return this._addCheck({
1134
+ kind: "min",
1135
+ inclusive: !0,
1136
+ value: Number.MIN_SAFE_INTEGER,
1137
+ message: p.toString(e)
1138
+ })._addCheck({
1139
+ kind: "max",
1140
+ inclusive: !0,
1141
+ value: Number.MAX_SAFE_INTEGER,
1142
+ message: p.toString(e)
1143
+ });
1144
+ }
1145
+ get minValue() {
1146
+ let e = null;
1147
+ for (const t of this._def.checks)
1148
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1149
+ return e;
1150
+ }
1151
+ get maxValue() {
1152
+ let e = null;
1153
+ for (const t of this._def.checks)
1154
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1155
+ return e;
1156
+ }
1157
+ get isInt() {
1158
+ return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && k.isInteger(e.value));
1159
+ }
1160
+ get isFinite() {
1161
+ let e = null, t = null;
1162
+ for (const r of this._def.checks) {
1163
+ if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
1164
+ return !0;
1165
+ r.kind === "min" ? (t === null || r.value > t) && (t = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
1166
+ }
1167
+ return Number.isFinite(t) && Number.isFinite(e);
1168
+ }
1169
+ }
1170
+ se.create = (n) => new se({
1171
+ checks: [],
1172
+ typeName: l.ZodNumber,
1173
+ coerce: (n == null ? void 0 : n.coerce) || !1,
1174
+ ..._(n)
1175
+ });
1176
+ class ae extends b {
1177
+ constructor() {
1178
+ super(...arguments), this.min = this.gte, this.max = this.lte;
1179
+ }
1180
+ _parse(e) {
1181
+ if (this._def.coerce)
1182
+ try {
1183
+ e.data = BigInt(e.data);
1184
+ } catch (a) {
1185
+ return this._getInvalidInput(e);
1186
+ }
1187
+ if (this._getType(e) !== h.bigint)
1188
+ return this._getInvalidInput(e);
1189
+ let r;
1190
+ const s = new P();
1191
+ for (const a of this._def.checks)
1192
+ a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1193
+ code: d.too_small,
1194
+ type: "bigint",
1195
+ minimum: a.value,
1196
+ inclusive: a.inclusive,
1197
+ message: a.message
1198
+ }), s.dirty()) : a.kind === "max" ? (a.inclusive ? e.data > a.value : e.data >= a.value) && (r = this._getOrReturnCtx(e, r), f(r, {
1199
+ code: d.too_big,
1200
+ type: "bigint",
1201
+ maximum: a.value,
1202
+ inclusive: a.inclusive,
1203
+ message: a.message
1204
+ }), s.dirty()) : a.kind === "multipleOf" ? e.data % a.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), f(r, {
1205
+ code: d.not_multiple_of,
1206
+ multipleOf: a.value,
1207
+ message: a.message
1208
+ }), s.dirty()) : k.assertNever(a);
1209
+ return { status: s.value, value: e.data };
1210
+ }
1211
+ _getInvalidInput(e) {
1212
+ const t = this._getOrReturnCtx(e);
1213
+ return f(t, {
1214
+ code: d.invalid_type,
1215
+ expected: h.bigint,
1216
+ received: t.parsedType
1217
+ }), g;
1218
+ }
1219
+ gte(e, t) {
1220
+ return this.setLimit("min", e, !0, p.toString(t));
1221
+ }
1222
+ gt(e, t) {
1223
+ return this.setLimit("min", e, !1, p.toString(t));
1224
+ }
1225
+ lte(e, t) {
1226
+ return this.setLimit("max", e, !0, p.toString(t));
1227
+ }
1228
+ lt(e, t) {
1229
+ return this.setLimit("max", e, !1, p.toString(t));
1230
+ }
1231
+ setLimit(e, t, r, s) {
1232
+ return new ae({
1233
+ ...this._def,
1234
+ checks: [
1235
+ ...this._def.checks,
1236
+ {
1237
+ kind: e,
1238
+ value: t,
1239
+ inclusive: r,
1240
+ message: p.toString(s)
1241
+ }
1242
+ ]
1243
+ });
1244
+ }
1245
+ _addCheck(e) {
1246
+ return new ae({
1247
+ ...this._def,
1248
+ checks: [...this._def.checks, e]
1249
+ });
1250
+ }
1251
+ positive(e) {
1252
+ return this._addCheck({
1253
+ kind: "min",
1254
+ value: BigInt(0),
1255
+ inclusive: !1,
1256
+ message: p.toString(e)
1257
+ });
1258
+ }
1259
+ negative(e) {
1260
+ return this._addCheck({
1261
+ kind: "max",
1262
+ value: BigInt(0),
1263
+ inclusive: !1,
1264
+ message: p.toString(e)
1265
+ });
1266
+ }
1267
+ nonpositive(e) {
1268
+ return this._addCheck({
1269
+ kind: "max",
1270
+ value: BigInt(0),
1271
+ inclusive: !0,
1272
+ message: p.toString(e)
1273
+ });
1274
+ }
1275
+ nonnegative(e) {
1276
+ return this._addCheck({
1277
+ kind: "min",
1278
+ value: BigInt(0),
1279
+ inclusive: !0,
1280
+ message: p.toString(e)
1281
+ });
1282
+ }
1283
+ multipleOf(e, t) {
1284
+ return this._addCheck({
1285
+ kind: "multipleOf",
1286
+ value: e,
1287
+ message: p.toString(t)
1288
+ });
1289
+ }
1290
+ get minValue() {
1291
+ let e = null;
1292
+ for (const t of this._def.checks)
1293
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1294
+ return e;
1295
+ }
1296
+ get maxValue() {
1297
+ let e = null;
1298
+ for (const t of this._def.checks)
1299
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1300
+ return e;
1301
+ }
1302
+ }
1303
+ ae.create = (n) => {
1304
+ var e;
1305
+ return new ae({
1306
+ checks: [],
1307
+ typeName: l.ZodBigInt,
1308
+ coerce: (e = n == null ? void 0 : n.coerce) != null ? e : !1,
1309
+ ..._(n)
1310
+ });
1311
+ };
1312
+ class Be extends b {
1313
+ _parse(e) {
1314
+ if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== h.boolean) {
1315
+ const r = this._getOrReturnCtx(e);
1316
+ return f(r, {
1317
+ code: d.invalid_type,
1318
+ expected: h.boolean,
1319
+ received: r.parsedType
1320
+ }), g;
1321
+ }
1322
+ return E(e.data);
1323
+ }
1324
+ }
1325
+ Be.create = (n) => new Be({
1326
+ typeName: l.ZodBoolean,
1327
+ coerce: (n == null ? void 0 : n.coerce) || !1,
1328
+ ..._(n)
1329
+ });
1330
+ class ge extends b {
1331
+ _parse(e) {
1332
+ if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== h.date) {
1333
+ const a = this._getOrReturnCtx(e);
1334
+ return f(a, {
1335
+ code: d.invalid_type,
1336
+ expected: h.date,
1337
+ received: a.parsedType
1338
+ }), g;
1339
+ }
1340
+ if (Number.isNaN(e.data.getTime())) {
1341
+ const a = this._getOrReturnCtx(e);
1342
+ return f(a, {
1343
+ code: d.invalid_date
1344
+ }), g;
1345
+ }
1346
+ const r = new P();
1347
+ let s;
1348
+ for (const a of this._def.checks)
1349
+ a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), f(s, {
1350
+ code: d.too_small,
1351
+ message: a.message,
1352
+ inclusive: !0,
1353
+ exact: !1,
1354
+ minimum: a.value,
1355
+ type: "date"
1356
+ }), r.dirty()) : a.kind === "max" ? e.data.getTime() > a.value && (s = this._getOrReturnCtx(e, s), f(s, {
1357
+ code: d.too_big,
1358
+ message: a.message,
1359
+ inclusive: !0,
1360
+ exact: !1,
1361
+ maximum: a.value,
1362
+ type: "date"
1363
+ }), r.dirty()) : k.assertNever(a);
1364
+ return {
1365
+ status: r.value,
1366
+ value: new Date(e.data.getTime())
1367
+ };
1368
+ }
1369
+ _addCheck(e) {
1370
+ return new ge({
1371
+ ...this._def,
1372
+ checks: [...this._def.checks, e]
1373
+ });
1374
+ }
1375
+ min(e, t) {
1376
+ return this._addCheck({
1377
+ kind: "min",
1378
+ value: e.getTime(),
1379
+ message: p.toString(t)
1380
+ });
1381
+ }
1382
+ max(e, t) {
1383
+ return this._addCheck({
1384
+ kind: "max",
1385
+ value: e.getTime(),
1386
+ message: p.toString(t)
1387
+ });
1388
+ }
1389
+ get minDate() {
1390
+ let e = null;
1391
+ for (const t of this._def.checks)
1392
+ t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1393
+ return e != null ? new Date(e) : null;
1394
+ }
1395
+ get maxDate() {
1396
+ let e = null;
1397
+ for (const t of this._def.checks)
1398
+ t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1399
+ return e != null ? new Date(e) : null;
1400
+ }
1401
+ }
1402
+ ge.create = (n) => new ge({
1403
+ checks: [],
1404
+ coerce: (n == null ? void 0 : n.coerce) || !1,
1405
+ typeName: l.ZodDate,
1406
+ ..._(n)
1407
+ });
1408
+ class We extends b {
1409
+ _parse(e) {
1410
+ if (this._getType(e) !== h.symbol) {
1411
+ const r = this._getOrReturnCtx(e);
1412
+ return f(r, {
1413
+ code: d.invalid_type,
1414
+ expected: h.symbol,
1415
+ received: r.parsedType
1416
+ }), g;
1417
+ }
1418
+ return E(e.data);
1419
+ }
1420
+ }
1421
+ We.create = (n) => new We({
1422
+ typeName: l.ZodSymbol,
1423
+ ..._(n)
1424
+ });
1425
+ class qe extends b {
1426
+ _parse(e) {
1427
+ if (this._getType(e) !== h.undefined) {
1428
+ const r = this._getOrReturnCtx(e);
1429
+ return f(r, {
1430
+ code: d.invalid_type,
1431
+ expected: h.undefined,
1432
+ received: r.parsedType
1433
+ }), g;
1434
+ }
1435
+ return E(e.data);
1436
+ }
1437
+ }
1438
+ qe.create = (n) => new qe({
1439
+ typeName: l.ZodUndefined,
1440
+ ..._(n)
1441
+ });
1442
+ class Je extends b {
1443
+ _parse(e) {
1444
+ if (this._getType(e) !== h.null) {
1445
+ const r = this._getOrReturnCtx(e);
1446
+ return f(r, {
1447
+ code: d.invalid_type,
1448
+ expected: h.null,
1449
+ received: r.parsedType
1450
+ }), g;
1451
+ }
1452
+ return E(e.data);
1453
+ }
1454
+ }
1455
+ Je.create = (n) => new Je({
1456
+ typeName: l.ZodNull,
1457
+ ..._(n)
1458
+ });
1459
+ class He extends b {
1460
+ constructor() {
1461
+ super(...arguments), this._any = !0;
1462
+ }
1463
+ _parse(e) {
1464
+ return E(e.data);
1465
+ }
1466
+ }
1467
+ He.create = (n) => new He({
1468
+ typeName: l.ZodAny,
1469
+ ..._(n)
1470
+ });
1471
+ class Ge extends b {
1472
+ constructor() {
1473
+ super(...arguments), this._unknown = !0;
1474
+ }
1475
+ _parse(e) {
1476
+ return E(e.data);
1477
+ }
1478
+ }
1479
+ Ge.create = (n) => new Ge({
1480
+ typeName: l.ZodUnknown,
1481
+ ..._(n)
1482
+ });
1483
+ class Y extends b {
1484
+ _parse(e) {
1485
+ const t = this._getOrReturnCtx(e);
1486
+ return f(t, {
1487
+ code: d.invalid_type,
1488
+ expected: h.never,
1489
+ received: t.parsedType
1490
+ }), g;
1491
+ }
1492
+ }
1493
+ Y.create = (n) => new Y({
1494
+ typeName: l.ZodNever,
1495
+ ..._(n)
1496
+ });
1497
+ class Ye extends b {
1498
+ _parse(e) {
1499
+ if (this._getType(e) !== h.undefined) {
1500
+ const r = this._getOrReturnCtx(e);
1501
+ return f(r, {
1502
+ code: d.invalid_type,
1503
+ expected: h.void,
1504
+ received: r.parsedType
1505
+ }), g;
1506
+ }
1507
+ return E(e.data);
1508
+ }
1509
+ }
1510
+ Ye.create = (n) => new Ye({
1511
+ typeName: l.ZodVoid,
1512
+ ..._(n)
1513
+ });
1514
+ class L extends b {
1515
+ _parse(e) {
1516
+ const { ctx: t, status: r } = this._processInputParams(e), s = this._def;
1517
+ if (t.parsedType !== h.array)
1518
+ return f(t, {
1519
+ code: d.invalid_type,
1520
+ expected: h.array,
1521
+ received: t.parsedType
1522
+ }), g;
1523
+ if (s.exactLength !== null) {
1524
+ const i = t.data.length > s.exactLength.value, o = t.data.length < s.exactLength.value;
1525
+ (i || o) && (f(t, {
1526
+ code: i ? d.too_big : d.too_small,
1527
+ minimum: o ? s.exactLength.value : void 0,
1528
+ maximum: i ? s.exactLength.value : void 0,
1529
+ type: "array",
1530
+ inclusive: !0,
1531
+ exact: !0,
1532
+ message: s.exactLength.message
1533
+ }), r.dirty());
1534
+ }
1535
+ if (s.minLength !== null && t.data.length < s.minLength.value && (f(t, {
1536
+ code: d.too_small,
1537
+ minimum: s.minLength.value,
1538
+ type: "array",
1539
+ inclusive: !0,
1540
+ exact: !1,
1541
+ message: s.minLength.message
1542
+ }), r.dirty()), s.maxLength !== null && t.data.length > s.maxLength.value && (f(t, {
1543
+ code: d.too_big,
1544
+ maximum: s.maxLength.value,
1545
+ type: "array",
1546
+ inclusive: !0,
1547
+ exact: !1,
1548
+ message: s.maxLength.message
1549
+ }), r.dirty()), t.common.async)
1550
+ return Promise.all([...t.data].map((i, o) => s.type._parseAsync(new V(t, i, t.path, o)))).then((i) => P.mergeArray(r, i));
1551
+ const a = [...t.data].map((i, o) => s.type._parseSync(new V(t, i, t.path, o)));
1552
+ return P.mergeArray(r, a);
1553
+ }
1554
+ get element() {
1555
+ return this._def.type;
1556
+ }
1557
+ min(e, t) {
1558
+ return new L({
1559
+ ...this._def,
1560
+ minLength: { value: e, message: p.toString(t) }
1561
+ });
1562
+ }
1563
+ max(e, t) {
1564
+ return new L({
1565
+ ...this._def,
1566
+ maxLength: { value: e, message: p.toString(t) }
1567
+ });
1568
+ }
1569
+ length(e, t) {
1570
+ return new L({
1571
+ ...this._def,
1572
+ exactLength: { value: e, message: p.toString(t) }
1573
+ });
1574
+ }
1575
+ nonempty(e) {
1576
+ return this.min(1, e);
1577
+ }
1578
+ }
1579
+ L.create = (n, e) => new L({
1580
+ type: n,
1581
+ minLength: null,
1582
+ maxLength: null,
1583
+ exactLength: null,
1584
+ typeName: l.ZodArray,
1585
+ ..._(e)
1586
+ });
1587
+ function te(n) {
1588
+ if (n instanceof C) {
1589
+ const e = {};
1590
+ for (const t in n.shape) {
1591
+ const r = n.shape[t];
1592
+ e[t] = H.create(te(r));
1593
+ }
1594
+ return new C({
1595
+ ...n._def,
1596
+ shape: () => e
1597
+ });
1598
+ } else
1599
+ return n instanceof L ? new L({
1600
+ ...n._def,
1601
+ type: te(n.element)
1602
+ }) : n instanceof H ? H.create(te(n.unwrap())) : n instanceof ce ? ce.create(te(n.unwrap())) : n instanceof Q ? Q.create(n.items.map((e) => te(e))) : n;
1603
+ }
1604
+ class C extends b {
1605
+ constructor() {
1606
+ super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1607
+ }
1608
+ _getCached() {
1609
+ if (this._cached !== null)
1610
+ return this._cached;
1611
+ const e = this._def.shape(), t = k.objectKeys(e);
1612
+ return this._cached = { shape: e, keys: t }, this._cached;
1613
+ }
1614
+ _parse(e) {
1615
+ if (this._getType(e) !== h.object) {
1616
+ const u = this._getOrReturnCtx(e);
1617
+ return f(u, {
1618
+ code: d.invalid_type,
1619
+ expected: h.object,
1620
+ received: u.parsedType
1621
+ }), g;
1622
+ }
1623
+ const { status: r, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), o = [];
1624
+ if (!(this._def.catchall instanceof Y && this._def.unknownKeys === "strip"))
1625
+ for (const u in s.data)
1626
+ i.includes(u) || o.push(u);
1627
+ const c = [];
1628
+ for (const u of i) {
1629
+ const y = a[u], T = s.data[u];
1630
+ c.push({
1631
+ key: { status: "valid", value: u },
1632
+ value: y._parse(new V(s, T, s.path, u)),
1633
+ alwaysSet: u in s.data
1634
+ });
1635
+ }
1636
+ if (this._def.catchall instanceof Y) {
1637
+ const u = this._def.unknownKeys;
1638
+ if (u === "passthrough")
1639
+ for (const y of o)
1640
+ c.push({
1641
+ key: { status: "valid", value: y },
1642
+ value: { status: "valid", value: s.data[y] }
1643
+ });
1644
+ else if (u === "strict")
1645
+ o.length > 0 && (f(s, {
1646
+ code: d.unrecognized_keys,
1647
+ keys: o
1648
+ }), r.dirty());
1649
+ else if (u !== "strip")
1650
+ throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1651
+ } else {
1652
+ const u = this._def.catchall;
1653
+ for (const y of o) {
1654
+ const T = s.data[y];
1655
+ c.push({
1656
+ key: { status: "valid", value: y },
1657
+ value: u._parse(
1658
+ new V(s, T, s.path, y)
1659
+ //, ctx.child(key), value, getParsedType(value)
1660
+ ),
1661
+ alwaysSet: y in s.data
1662
+ });
1663
+ }
1664
+ }
1665
+ return s.common.async ? Promise.resolve().then(async () => {
1666
+ const u = [];
1667
+ for (const y of c) {
1668
+ const T = await y.key, v = await y.value;
1669
+ u.push({
1670
+ key: T,
1671
+ value: v,
1672
+ alwaysSet: y.alwaysSet
1673
+ });
1674
+ }
1675
+ return u;
1676
+ }).then((u) => P.mergeObjectSync(r, u)) : P.mergeObjectSync(r, c);
1677
+ }
1678
+ get shape() {
1679
+ return this._def.shape();
1680
+ }
1681
+ strict(e) {
1682
+ return p.errToObj, new C({
1683
+ ...this._def,
1684
+ unknownKeys: "strict",
1685
+ ...e !== void 0 ? {
1686
+ errorMap: (t, r) => {
1687
+ var a, i, o, c;
1688
+ const s = (o = (i = (a = this._def).errorMap) == null ? void 0 : i.call(a, t, r).message) != null ? o : r.defaultError;
1689
+ return t.code === "unrecognized_keys" ? {
1690
+ message: (c = p.errToObj(e).message) != null ? c : s
1691
+ } : {
1692
+ message: s
1693
+ };
1694
+ }
1695
+ } : {}
1696
+ });
1697
+ }
1698
+ strip() {
1699
+ return new C({
1700
+ ...this._def,
1701
+ unknownKeys: "strip"
1702
+ });
1703
+ }
1704
+ passthrough() {
1705
+ return new C({
1706
+ ...this._def,
1707
+ unknownKeys: "passthrough"
1708
+ });
1709
+ }
1710
+ // const AugmentFactory =
1711
+ // <Def extends ZodObjectDef>(def: Def) =>
1712
+ // <Augmentation extends ZodRawShape>(
1713
+ // augmentation: Augmentation
1714
+ // ): ZodObject<
1715
+ // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1716
+ // Def["unknownKeys"],
1717
+ // Def["catchall"]
1718
+ // > => {
1719
+ // return new ZodObject({
1720
+ // ...def,
1721
+ // shape: () => ({
1722
+ // ...def.shape(),
1723
+ // ...augmentation,
1724
+ // }),
1725
+ // }) as any;
1726
+ // };
1727
+ extend(e) {
1728
+ return new C({
1729
+ ...this._def,
1730
+ shape: () => ({
1731
+ ...this._def.shape(),
1732
+ ...e
1733
+ })
1734
+ });
1735
+ }
1736
+ /**
1737
+ * Prior to zod@1.0.12 there was a bug in the
1738
+ * inferred type of merged objects. Please
1739
+ * upgrade if you are experiencing issues.
1740
+ */
1741
+ merge(e) {
1742
+ return new C({
1743
+ unknownKeys: e._def.unknownKeys,
1744
+ catchall: e._def.catchall,
1745
+ shape: () => ({
1746
+ ...this._def.shape(),
1747
+ ...e._def.shape()
1748
+ }),
1749
+ typeName: l.ZodObject
1750
+ });
1751
+ }
1752
+ // merge<
1753
+ // Incoming extends AnyZodObject,
1754
+ // Augmentation extends Incoming["shape"],
1755
+ // NewOutput extends {
1756
+ // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1757
+ // ? Augmentation[k]["_output"]
1758
+ // : k extends keyof Output
1759
+ // ? Output[k]
1760
+ // : never;
1761
+ // },
1762
+ // NewInput extends {
1763
+ // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1764
+ // ? Augmentation[k]["_input"]
1765
+ // : k extends keyof Input
1766
+ // ? Input[k]
1767
+ // : never;
1768
+ // }
1769
+ // >(
1770
+ // merging: Incoming
1771
+ // ): ZodObject<
1772
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1773
+ // Incoming["_def"]["unknownKeys"],
1774
+ // Incoming["_def"]["catchall"],
1775
+ // NewOutput,
1776
+ // NewInput
1777
+ // > {
1778
+ // const merged: any = new ZodObject({
1779
+ // unknownKeys: merging._def.unknownKeys,
1780
+ // catchall: merging._def.catchall,
1781
+ // shape: () =>
1782
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1783
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1784
+ // }) as any;
1785
+ // return merged;
1786
+ // }
1787
+ setKey(e, t) {
1788
+ return this.augment({ [e]: t });
1789
+ }
1790
+ // merge<Incoming extends AnyZodObject>(
1791
+ // merging: Incoming
1792
+ // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1793
+ // ZodObject<
1794
+ // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1795
+ // Incoming["_def"]["unknownKeys"],
1796
+ // Incoming["_def"]["catchall"]
1797
+ // > {
1798
+ // // const mergedShape = objectUtil.mergeShapes(
1799
+ // // this._def.shape(),
1800
+ // // merging._def.shape()
1801
+ // // );
1802
+ // const merged: any = new ZodObject({
1803
+ // unknownKeys: merging._def.unknownKeys,
1804
+ // catchall: merging._def.catchall,
1805
+ // shape: () =>
1806
+ // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1807
+ // typeName: ZodFirstPartyTypeKind.ZodObject,
1808
+ // }) as any;
1809
+ // return merged;
1810
+ // }
1811
+ catchall(e) {
1812
+ return new C({
1813
+ ...this._def,
1814
+ catchall: e
1815
+ });
1816
+ }
1817
+ pick(e) {
1818
+ const t = {};
1819
+ for (const r of k.objectKeys(e))
1820
+ e[r] && this.shape[r] && (t[r] = this.shape[r]);
1821
+ return new C({
1822
+ ...this._def,
1823
+ shape: () => t
1824
+ });
1825
+ }
1826
+ omit(e) {
1827
+ const t = {};
1828
+ for (const r of k.objectKeys(this.shape))
1829
+ e[r] || (t[r] = this.shape[r]);
1830
+ return new C({
1831
+ ...this._def,
1832
+ shape: () => t
1833
+ });
1834
+ }
1835
+ /**
1836
+ * @deprecated
1837
+ */
1838
+ deepPartial() {
1839
+ return te(this);
1840
+ }
1841
+ partial(e) {
1842
+ const t = {};
1843
+ for (const r of k.objectKeys(this.shape)) {
1844
+ const s = this.shape[r];
1845
+ e && !e[r] ? t[r] = s : t[r] = s.optional();
1846
+ }
1847
+ return new C({
1848
+ ...this._def,
1849
+ shape: () => t
1850
+ });
1851
+ }
1852
+ required(e) {
1853
+ const t = {};
1854
+ for (const r of k.objectKeys(this.shape))
1855
+ if (e && !e[r])
1856
+ t[r] = this.shape[r];
1857
+ else {
1858
+ let a = this.shape[r];
1859
+ for (; a instanceof H; )
1860
+ a = a._def.innerType;
1861
+ t[r] = a;
1862
+ }
1863
+ return new C({
1864
+ ...this._def,
1865
+ shape: () => t
1866
+ });
1867
+ }
1868
+ keyof() {
1869
+ return Mt(k.objectKeys(this.shape));
1870
+ }
1871
+ }
1872
+ C.create = (n, e) => new C({
1873
+ shape: () => n,
1874
+ unknownKeys: "strip",
1875
+ catchall: Y.create(),
1876
+ typeName: l.ZodObject,
1877
+ ..._(e)
1878
+ });
1879
+ C.strictCreate = (n, e) => new C({
1880
+ shape: () => n,
1881
+ unknownKeys: "strict",
1882
+ catchall: Y.create(),
1883
+ typeName: l.ZodObject,
1884
+ ..._(e)
1885
+ });
1886
+ C.lazycreate = (n, e) => new C({
1887
+ shape: n,
1888
+ unknownKeys: "strip",
1889
+ catchall: Y.create(),
1890
+ typeName: l.ZodObject,
1891
+ ..._(e)
1892
+ });
1893
+ class xe extends b {
1894
+ _parse(e) {
1895
+ const { ctx: t } = this._processInputParams(e), r = this._def.options;
1896
+ function s(a) {
1897
+ for (const o of a)
1898
+ if (o.result.status === "valid")
1899
+ return o.result;
1900
+ for (const o of a)
1901
+ if (o.result.status === "dirty")
1902
+ return t.common.issues.push(...o.ctx.common.issues), o.result;
1903
+ const i = a.map((o) => new z(o.ctx.common.issues));
1904
+ return f(t, {
1905
+ code: d.invalid_union,
1906
+ unionErrors: i
1907
+ }), g;
1908
+ }
1909
+ if (t.common.async)
1910
+ return Promise.all(r.map(async (a) => {
1911
+ const i = {
1912
+ ...t,
1913
+ common: {
1914
+ ...t.common,
1915
+ issues: []
1916
+ },
1917
+ parent: null
1918
+ };
1919
+ return {
1920
+ result: await a._parseAsync({
1921
+ data: t.data,
1922
+ path: t.path,
1923
+ parent: i
1924
+ }),
1925
+ ctx: i
1926
+ };
1927
+ })).then(s);
1928
+ {
1929
+ let a;
1930
+ const i = [];
1931
+ for (const c of r) {
1932
+ const u = {
1933
+ ...t,
1934
+ common: {
1935
+ ...t.common,
1936
+ issues: []
1937
+ },
1938
+ parent: null
1939
+ }, y = c._parseSync({
1940
+ data: t.data,
1941
+ path: t.path,
1942
+ parent: u
1943
+ });
1944
+ if (y.status === "valid")
1945
+ return y;
1946
+ y.status === "dirty" && !a && (a = { result: y, ctx: u }), u.common.issues.length && i.push(u.common.issues);
1947
+ }
1948
+ if (a)
1949
+ return t.common.issues.push(...a.ctx.common.issues), a.result;
1950
+ const o = i.map((c) => new z(c));
1951
+ return f(t, {
1952
+ code: d.invalid_union,
1953
+ unionErrors: o
1954
+ }), g;
1955
+ }
1956
+ }
1957
+ get options() {
1958
+ return this._def.options;
1959
+ }
1960
+ }
1961
+ xe.create = (n, e) => new xe({
1962
+ options: n,
1963
+ typeName: l.ZodUnion,
1964
+ ..._(e)
1965
+ });
1966
+ function Ke(n, e) {
1967
+ const t = q(n), r = q(e);
1968
+ if (n === e)
1969
+ return { valid: !0, data: n };
1970
+ if (t === h.object && r === h.object) {
1971
+ const s = k.objectKeys(e), a = k.objectKeys(n).filter((o) => s.indexOf(o) !== -1), i = { ...n, ...e };
1972
+ for (const o of a) {
1973
+ const c = Ke(n[o], e[o]);
1974
+ if (!c.valid)
1975
+ return { valid: !1 };
1976
+ i[o] = c.data;
1977
+ }
1978
+ return { valid: !0, data: i };
1979
+ } else if (t === h.array && r === h.array) {
1980
+ if (n.length !== e.length)
1981
+ return { valid: !1 };
1982
+ const s = [];
1983
+ for (let a = 0; a < n.length; a++) {
1984
+ const i = n[a], o = e[a], c = Ke(i, o);
1985
+ if (!c.valid)
1986
+ return { valid: !1 };
1987
+ s.push(c.data);
1988
+ }
1989
+ return { valid: !0, data: s };
1990
+ } else
1991
+ return t === h.date && r === h.date && +n == +e ? { valid: !0, data: n } : { valid: !1 };
1992
+ }
1993
+ class we extends b {
1994
+ _parse(e) {
1995
+ const { status: t, ctx: r } = this._processInputParams(e), s = (a, i) => {
1996
+ if (yt(a) || yt(i))
1997
+ return g;
1998
+ const o = Ke(a.value, i.value);
1999
+ return o.valid ? ((gt(a) || gt(i)) && t.dirty(), { status: t.value, value: o.data }) : (f(r, {
2000
+ code: d.invalid_intersection_types
2001
+ }), g);
2002
+ };
2003
+ return r.common.async ? Promise.all([
2004
+ this._def.left._parseAsync({
2005
+ data: r.data,
2006
+ path: r.path,
2007
+ parent: r
2008
+ }),
2009
+ this._def.right._parseAsync({
2010
+ data: r.data,
2011
+ path: r.path,
2012
+ parent: r
2013
+ })
2014
+ ]).then(([a, i]) => s(a, i)) : s(this._def.left._parseSync({
2015
+ data: r.data,
2016
+ path: r.path,
2017
+ parent: r
2018
+ }), this._def.right._parseSync({
2019
+ data: r.data,
2020
+ path: r.path,
2021
+ parent: r
2022
+ }));
2023
+ }
2024
+ }
2025
+ we.create = (n, e, t) => new we({
2026
+ left: n,
2027
+ right: e,
2028
+ typeName: l.ZodIntersection,
2029
+ ..._(t)
2030
+ });
2031
+ class Q extends b {
2032
+ _parse(e) {
2033
+ const { status: t, ctx: r } = this._processInputParams(e);
2034
+ if (r.parsedType !== h.array)
2035
+ return f(r, {
2036
+ code: d.invalid_type,
2037
+ expected: h.array,
2038
+ received: r.parsedType
2039
+ }), g;
2040
+ if (r.data.length < this._def.items.length)
2041
+ return f(r, {
2042
+ code: d.too_small,
2043
+ minimum: this._def.items.length,
2044
+ inclusive: !0,
2045
+ exact: !1,
2046
+ type: "array"
2047
+ }), g;
2048
+ !this._def.rest && r.data.length > this._def.items.length && (f(r, {
2049
+ code: d.too_big,
2050
+ maximum: this._def.items.length,
2051
+ inclusive: !0,
2052
+ exact: !1,
2053
+ type: "array"
2054
+ }), t.dirty());
2055
+ const a = [...r.data].map((i, o) => {
2056
+ const c = this._def.items[o] || this._def.rest;
2057
+ return c ? c._parse(new V(r, i, r.path, o)) : null;
2058
+ }).filter((i) => !!i);
2059
+ return r.common.async ? Promise.all(a).then((i) => P.mergeArray(t, i)) : P.mergeArray(t, a);
2060
+ }
2061
+ get items() {
2062
+ return this._def.items;
2063
+ }
2064
+ rest(e) {
2065
+ return new Q({
2066
+ ...this._def,
2067
+ rest: e
2068
+ });
2069
+ }
2070
+ }
2071
+ Q.create = (n, e) => {
2072
+ if (!Array.isArray(n))
2073
+ throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2074
+ return new Q({
2075
+ items: n,
2076
+ typeName: l.ZodTuple,
2077
+ rest: null,
2078
+ ..._(e)
2079
+ });
2080
+ };
2081
+ class Se extends b {
2082
+ get keySchema() {
2083
+ return this._def.keyType;
2084
+ }
2085
+ get valueSchema() {
2086
+ return this._def.valueType;
2087
+ }
2088
+ _parse(e) {
2089
+ const { status: t, ctx: r } = this._processInputParams(e);
2090
+ if (r.parsedType !== h.object)
2091
+ return f(r, {
2092
+ code: d.invalid_type,
2093
+ expected: h.object,
2094
+ received: r.parsedType
2095
+ }), g;
2096
+ const s = [], a = this._def.keyType, i = this._def.valueType;
2097
+ for (const o in r.data)
2098
+ s.push({
2099
+ key: a._parse(new V(r, o, r.path, o)),
2100
+ value: i._parse(new V(r, r.data[o], r.path, o)),
2101
+ alwaysSet: o in r.data
2102
+ });
2103
+ return r.common.async ? P.mergeObjectAsync(t, s) : P.mergeObjectSync(t, s);
2104
+ }
2105
+ get element() {
2106
+ return this._def.valueType;
2107
+ }
2108
+ static create(e, t, r) {
2109
+ return t instanceof b ? new Se({
2110
+ keyType: e,
2111
+ valueType: t,
2112
+ typeName: l.ZodRecord,
2113
+ ..._(r)
2114
+ }) : new Se({
2115
+ keyType: F.create(),
2116
+ valueType: e,
2117
+ typeName: l.ZodRecord,
2118
+ ..._(t)
2119
+ });
2120
+ }
2121
+ }
2122
+ class Xe extends b {
2123
+ get keySchema() {
2124
+ return this._def.keyType;
2125
+ }
2126
+ get valueSchema() {
2127
+ return this._def.valueType;
2128
+ }
2129
+ _parse(e) {
2130
+ const { status: t, ctx: r } = this._processInputParams(e);
2131
+ if (r.parsedType !== h.map)
2132
+ return f(r, {
2133
+ code: d.invalid_type,
2134
+ expected: h.map,
2135
+ received: r.parsedType
2136
+ }), g;
2137
+ const s = this._def.keyType, a = this._def.valueType, i = [...r.data.entries()].map(([o, c], u) => ({
2138
+ key: s._parse(new V(r, o, r.path, [u, "key"])),
2139
+ value: a._parse(new V(r, c, r.path, [u, "value"]))
2140
+ }));
2141
+ if (r.common.async) {
2142
+ const o = /* @__PURE__ */ new Map();
2143
+ return Promise.resolve().then(async () => {
2144
+ for (const c of i) {
2145
+ const u = await c.key, y = await c.value;
2146
+ if (u.status === "aborted" || y.status === "aborted")
2147
+ return g;
2148
+ (u.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(u.value, y.value);
2149
+ }
2150
+ return { status: t.value, value: o };
2151
+ });
2152
+ } else {
2153
+ const o = /* @__PURE__ */ new Map();
2154
+ for (const c of i) {
2155
+ const u = c.key, y = c.value;
2156
+ if (u.status === "aborted" || y.status === "aborted")
2157
+ return g;
2158
+ (u.status === "dirty" || y.status === "dirty") && t.dirty(), o.set(u.value, y.value);
2159
+ }
2160
+ return { status: t.value, value: o };
2161
+ }
2162
+ }
2163
+ }
2164
+ Xe.create = (n, e, t) => new Xe({
2165
+ valueType: e,
2166
+ keyType: n,
2167
+ typeName: l.ZodMap,
2168
+ ..._(t)
2169
+ });
2170
+ class ie extends b {
2171
+ _parse(e) {
2172
+ const { status: t, ctx: r } = this._processInputParams(e);
2173
+ if (r.parsedType !== h.set)
2174
+ return f(r, {
2175
+ code: d.invalid_type,
2176
+ expected: h.set,
2177
+ received: r.parsedType
2178
+ }), g;
2179
+ const s = this._def;
2180
+ s.minSize !== null && r.data.size < s.minSize.value && (f(r, {
2181
+ code: d.too_small,
2182
+ minimum: s.minSize.value,
2183
+ type: "set",
2184
+ inclusive: !0,
2185
+ exact: !1,
2186
+ message: s.minSize.message
2187
+ }), t.dirty()), s.maxSize !== null && r.data.size > s.maxSize.value && (f(r, {
2188
+ code: d.too_big,
2189
+ maximum: s.maxSize.value,
2190
+ type: "set",
2191
+ inclusive: !0,
2192
+ exact: !1,
2193
+ message: s.maxSize.message
2194
+ }), t.dirty());
2195
+ const a = this._def.valueType;
2196
+ function i(c) {
2197
+ const u = /* @__PURE__ */ new Set();
2198
+ for (const y of c) {
2199
+ if (y.status === "aborted")
2200
+ return g;
2201
+ y.status === "dirty" && t.dirty(), u.add(y.value);
2202
+ }
2203
+ return { status: t.value, value: u };
2204
+ }
2205
+ const o = [...r.data.values()].map((c, u) => a._parse(new V(r, c, r.path, u)));
2206
+ return r.common.async ? Promise.all(o).then((c) => i(c)) : i(o);
2207
+ }
2208
+ min(e, t) {
2209
+ return new ie({
2210
+ ...this._def,
2211
+ minSize: { value: e, message: p.toString(t) }
2212
+ });
2213
+ }
2214
+ max(e, t) {
2215
+ return new ie({
2216
+ ...this._def,
2217
+ maxSize: { value: e, message: p.toString(t) }
2218
+ });
2219
+ }
2220
+ size(e, t) {
2221
+ return this.min(e, t).max(e, t);
2222
+ }
2223
+ nonempty(e) {
2224
+ return this.min(1, e);
2225
+ }
2226
+ }
2227
+ ie.create = (n, e) => new ie({
2228
+ valueType: n,
2229
+ minSize: null,
2230
+ maxSize: null,
2231
+ typeName: l.ZodSet,
2232
+ ..._(e)
2233
+ });
2234
+ class Qe extends b {
2235
+ get schema() {
2236
+ return this._def.getter();
2237
+ }
2238
+ _parse(e) {
2239
+ const { ctx: t } = this._processInputParams(e);
2240
+ return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2241
+ }
2242
+ }
2243
+ Qe.create = (n, e) => new Qe({
2244
+ getter: n,
2245
+ typeName: l.ZodLazy,
2246
+ ..._(e)
2247
+ });
2248
+ class et extends b {
2249
+ _parse(e) {
2250
+ if (e.data !== this._def.value) {
2251
+ const t = this._getOrReturnCtx(e);
2252
+ return f(t, {
2253
+ received: t.data,
2254
+ code: d.invalid_literal,
2255
+ expected: this._def.value
2256
+ }), g;
2257
+ }
2258
+ return { status: "valid", value: e.data };
2259
+ }
2260
+ get value() {
2261
+ return this._def.value;
2262
+ }
2263
+ }
2264
+ et.create = (n, e) => new et({
2265
+ value: n,
2266
+ typeName: l.ZodLiteral,
2267
+ ..._(e)
2268
+ });
2269
+ function Mt(n, e) {
2270
+ return new oe({
2271
+ values: n,
2272
+ typeName: l.ZodEnum,
2273
+ ..._(e)
2274
+ });
2275
+ }
2276
+ class oe extends b {
2277
+ _parse(e) {
2278
+ if (typeof e.data != "string") {
2279
+ const t = this._getOrReturnCtx(e), r = this._def.values;
2280
+ return f(t, {
2281
+ expected: k.joinValues(r),
2282
+ received: t.parsedType,
2283
+ code: d.invalid_type
2284
+ }), g;
2285
+ }
2286
+ if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
2287
+ const t = this._getOrReturnCtx(e), r = this._def.values;
2288
+ return f(t, {
2289
+ received: t.data,
2290
+ code: d.invalid_enum_value,
2291
+ options: r
2292
+ }), g;
2293
+ }
2294
+ return E(e.data);
2295
+ }
2296
+ get options() {
2297
+ return this._def.values;
2298
+ }
2299
+ get enum() {
2300
+ const e = {};
2301
+ for (const t of this._def.values)
2302
+ e[t] = t;
2303
+ return e;
2304
+ }
2305
+ get Values() {
2306
+ const e = {};
2307
+ for (const t of this._def.values)
2308
+ e[t] = t;
2309
+ return e;
2310
+ }
2311
+ get Enum() {
2312
+ const e = {};
2313
+ for (const t of this._def.values)
2314
+ e[t] = t;
2315
+ return e;
2316
+ }
2317
+ extract(e, t = this._def) {
2318
+ return oe.create(e, {
2319
+ ...this._def,
2320
+ ...t
2321
+ });
2322
+ }
2323
+ exclude(e, t = this._def) {
2324
+ return oe.create(this.options.filter((r) => !e.includes(r)), {
2325
+ ...this._def,
2326
+ ...t
2327
+ });
2328
+ }
2329
+ }
2330
+ oe.create = Mt;
2331
+ class tt extends b {
2332
+ _parse(e) {
2333
+ const t = k.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
2334
+ if (r.parsedType !== h.string && r.parsedType !== h.number) {
2335
+ const s = k.objectValues(t);
2336
+ return f(r, {
2337
+ expected: k.joinValues(s),
2338
+ received: r.parsedType,
2339
+ code: d.invalid_type
2340
+ }), g;
2341
+ }
2342
+ if (this._cache || (this._cache = new Set(k.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2343
+ const s = k.objectValues(t);
2344
+ return f(r, {
2345
+ received: r.data,
2346
+ code: d.invalid_enum_value,
2347
+ options: s
2348
+ }), g;
2349
+ }
2350
+ return E(e.data);
2351
+ }
2352
+ get enum() {
2353
+ return this._def.values;
2354
+ }
2355
+ }
2356
+ tt.create = (n, e) => new tt({
2357
+ values: n,
2358
+ typeName: l.ZodNativeEnum,
2359
+ ..._(e)
2360
+ });
2361
+ class Ae extends b {
2362
+ unwrap() {
2363
+ return this._def.type;
2364
+ }
2365
+ _parse(e) {
2366
+ const { ctx: t } = this._processInputParams(e);
2367
+ if (t.parsedType !== h.promise && t.common.async === !1)
2368
+ return f(t, {
2369
+ code: d.invalid_type,
2370
+ expected: h.promise,
2371
+ received: t.parsedType
2372
+ }), g;
2373
+ const r = t.parsedType === h.promise ? t.data : Promise.resolve(t.data);
2374
+ return E(r.then((s) => this._def.type.parseAsync(s, {
2375
+ path: t.path,
2376
+ errorMap: t.common.contextualErrorMap
2377
+ })));
2378
+ }
2379
+ }
2380
+ Ae.create = (n, e) => new Ae({
2381
+ type: n,
2382
+ typeName: l.ZodPromise,
2383
+ ..._(e)
2384
+ });
2385
+ class K extends b {
2386
+ innerType() {
2387
+ return this._def.schema;
2388
+ }
2389
+ sourceType() {
2390
+ return this._def.schema._def.typeName === l.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2391
+ }
2392
+ _parse(e) {
2393
+ const { status: t, ctx: r } = this._processInputParams(e), s = this._def.effect || null, a = {
2394
+ addIssue: (i) => {
2395
+ f(r, i), i.fatal ? t.abort() : t.dirty();
2396
+ },
2397
+ get path() {
2398
+ return r.path;
2399
+ }
2400
+ };
2401
+ if (a.addIssue = a.addIssue.bind(a), s.type === "preprocess") {
2402
+ const i = s.transform(r.data, a);
2403
+ if (r.common.async)
2404
+ return Promise.resolve(i).then(async (o) => {
2405
+ if (t.value === "aborted")
2406
+ return g;
2407
+ const c = await this._def.schema._parseAsync({
2408
+ data: o,
2409
+ path: r.path,
2410
+ parent: r
2411
+ });
2412
+ return c.status === "aborted" ? g : c.status === "dirty" || t.value === "dirty" ? fe(c.value) : c;
2413
+ });
2414
+ {
2415
+ if (t.value === "aborted")
2416
+ return g;
2417
+ const o = this._def.schema._parseSync({
2418
+ data: i,
2419
+ path: r.path,
2420
+ parent: r
2421
+ });
2422
+ return o.status === "aborted" ? g : o.status === "dirty" || t.value === "dirty" ? fe(o.value) : o;
2423
+ }
2424
+ }
2425
+ if (s.type === "refinement") {
2426
+ const i = (o) => {
2427
+ const c = s.refinement(o, a);
2428
+ if (r.common.async)
2429
+ return Promise.resolve(c);
2430
+ if (c instanceof Promise)
2431
+ throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2432
+ return o;
2433
+ };
2434
+ if (r.common.async === !1) {
2435
+ const o = this._def.schema._parseSync({
2436
+ data: r.data,
2437
+ path: r.path,
2438
+ parent: r
2439
+ });
2440
+ return o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2441
+ } else
2442
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((o) => o.status === "aborted" ? g : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2443
+ }
2444
+ if (s.type === "transform")
2445
+ if (r.common.async === !1) {
2446
+ const i = this._def.schema._parseSync({
2447
+ data: r.data,
2448
+ path: r.path,
2449
+ parent: r
2450
+ });
2451
+ if (!re(i))
2452
+ return g;
2453
+ const o = s.transform(i.value, a);
2454
+ if (o instanceof Promise)
2455
+ throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2456
+ return { status: t.value, value: o };
2457
+ } else
2458
+ return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((i) => re(i) ? Promise.resolve(s.transform(i.value, a)).then((o) => ({
2459
+ status: t.value,
2460
+ value: o
2461
+ })) : g);
2462
+ k.assertNever(s);
2463
+ }
2464
+ }
2465
+ K.create = (n, e, t) => new K({
2466
+ schema: n,
2467
+ typeName: l.ZodEffects,
2468
+ effect: e,
2469
+ ..._(t)
2470
+ });
2471
+ K.createWithPreprocess = (n, e, t) => new K({
2472
+ schema: e,
2473
+ effect: { type: "preprocess", transform: n },
2474
+ typeName: l.ZodEffects,
2475
+ ..._(t)
2476
+ });
2477
+ class H extends b {
2478
+ _parse(e) {
2479
+ return this._getType(e) === h.undefined ? E(void 0) : this._def.innerType._parse(e);
2480
+ }
2481
+ unwrap() {
2482
+ return this._def.innerType;
2483
+ }
2484
+ }
2485
+ H.create = (n, e) => new H({
2486
+ innerType: n,
2487
+ typeName: l.ZodOptional,
2488
+ ..._(e)
2489
+ });
2490
+ class ce extends b {
2491
+ _parse(e) {
2492
+ return this._getType(e) === h.null ? E(null) : this._def.innerType._parse(e);
2493
+ }
2494
+ unwrap() {
2495
+ return this._def.innerType;
2496
+ }
2497
+ }
2498
+ ce.create = (n, e) => new ce({
2499
+ innerType: n,
2500
+ typeName: l.ZodNullable,
2501
+ ..._(e)
2502
+ });
2503
+ class nt extends b {
2504
+ _parse(e) {
2505
+ const { ctx: t } = this._processInputParams(e);
2506
+ let r = t.data;
2507
+ return t.parsedType === h.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({
2508
+ data: r,
2509
+ path: t.path,
2510
+ parent: t
2511
+ });
2512
+ }
2513
+ removeDefault() {
2514
+ return this._def.innerType;
2515
+ }
2516
+ }
2517
+ nt.create = (n, e) => new nt({
2518
+ innerType: n,
2519
+ typeName: l.ZodDefault,
2520
+ defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2521
+ ..._(e)
2522
+ });
2523
+ class rt extends b {
2524
+ _parse(e) {
2525
+ const { ctx: t } = this._processInputParams(e), r = {
2526
+ ...t,
2527
+ common: {
2528
+ ...t.common,
2529
+ issues: []
2530
+ }
2531
+ }, s = this._def.innerType._parse({
2532
+ data: r.data,
2533
+ path: r.path,
2534
+ parent: {
2535
+ ...r
2536
+ }
2537
+ });
2538
+ return ke(s) ? s.then((a) => ({
2539
+ status: "valid",
2540
+ value: a.status === "valid" ? a.value : this._def.catchValue({
2541
+ get error() {
2542
+ return new z(r.common.issues);
2543
+ },
2544
+ input: r.data
2545
+ })
2546
+ })) : {
2547
+ status: "valid",
2548
+ value: s.status === "valid" ? s.value : this._def.catchValue({
2549
+ get error() {
2550
+ return new z(r.common.issues);
2551
+ },
2552
+ input: r.data
2553
+ })
2554
+ };
2555
+ }
2556
+ removeCatch() {
2557
+ return this._def.innerType;
2558
+ }
2559
+ }
2560
+ rt.create = (n, e) => new rt({
2561
+ innerType: n,
2562
+ typeName: l.ZodCatch,
2563
+ catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2564
+ ..._(e)
2565
+ });
2566
+ class st extends b {
2567
+ _parse(e) {
2568
+ if (this._getType(e) !== h.nan) {
2569
+ const r = this._getOrReturnCtx(e);
2570
+ return f(r, {
2571
+ code: d.invalid_type,
2572
+ expected: h.nan,
2573
+ received: r.parsedType
2574
+ }), g;
2575
+ }
2576
+ return { status: "valid", value: e.data };
2577
+ }
2578
+ }
2579
+ st.create = (n) => new st({
2580
+ typeName: l.ZodNaN,
2581
+ ..._(n)
2582
+ });
2583
+ class jn extends b {
2584
+ _parse(e) {
2585
+ const { ctx: t } = this._processInputParams(e), r = t.data;
2586
+ return this._def.type._parse({
2587
+ data: r,
2588
+ path: t.path,
2589
+ parent: t
2590
+ });
2591
+ }
2592
+ unwrap() {
2593
+ return this._def.type;
2594
+ }
2595
+ }
2596
+ class ot extends b {
2597
+ _parse(e) {
2598
+ const { status: t, ctx: r } = this._processInputParams(e);
2599
+ if (r.common.async)
2600
+ return (async () => {
2601
+ const a = await this._def.in._parseAsync({
2602
+ data: r.data,
2603
+ path: r.path,
2604
+ parent: r
2605
+ });
2606
+ return a.status === "aborted" ? g : a.status === "dirty" ? (t.dirty(), fe(a.value)) : this._def.out._parseAsync({
2607
+ data: a.value,
2608
+ path: r.path,
2609
+ parent: r
2610
+ });
2611
+ })();
2612
+ {
2613
+ const s = this._def.in._parseSync({
2614
+ data: r.data,
2615
+ path: r.path,
2616
+ parent: r
2617
+ });
2618
+ return s.status === "aborted" ? g : s.status === "dirty" ? (t.dirty(), {
2619
+ status: "dirty",
2620
+ value: s.value
2621
+ }) : this._def.out._parseSync({
2622
+ data: s.value,
2623
+ path: r.path,
2624
+ parent: r
2625
+ });
2626
+ }
2627
+ }
2628
+ static create(e, t) {
2629
+ return new ot({
2630
+ in: e,
2631
+ out: t,
2632
+ typeName: l.ZodPipeline
2633
+ });
2634
+ }
2635
+ }
2636
+ class at extends b {
2637
+ _parse(e) {
2638
+ const t = this._def.innerType._parse(e), r = (s) => (re(s) && (s.value = Object.freeze(s.value)), s);
2639
+ return ke(t) ? t.then((s) => r(s)) : r(t);
2640
+ }
2641
+ unwrap() {
2642
+ return this._def.innerType;
2643
+ }
2644
+ }
2645
+ at.create = (n, e) => new at({
2646
+ innerType: n,
2647
+ typeName: l.ZodReadonly,
2648
+ ..._(e)
2649
+ });
2650
+ C.lazycreate;
2651
+ var l;
2652
+ (function(n) {
2653
+ n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
2654
+ })(l || (l = {}));
2655
+ const D = F.create, _t = se.create;
2656
+ st.create;
2657
+ ae.create;
2658
+ const In = Be.create;
2659
+ ge.create;
2660
+ We.create;
2661
+ qe.create;
2662
+ const Mn = Je.create, ne = He.create;
2663
+ Ge.create;
2664
+ Y.create;
2665
+ Ye.create;
2666
+ const Et = L.create, B = C.create;
2667
+ C.strictCreate;
2668
+ const Ze = xe.create;
2669
+ we.create;
2670
+ Q.create;
2671
+ const ct = Se.create;
2672
+ Xe.create;
2673
+ ie.create;
2674
+ Qe.create;
2675
+ const Pe = et.create;
2676
+ oe.create;
2677
+ tt.create;
2678
+ Ae.create;
2679
+ K.create;
2680
+ H.create;
2681
+ ce.create;
2682
+ K.createWithPreprocess;
2683
+ class je extends Error {
2684
+ constructor(e, t = "UNKNOWN_ERROR") {
2685
+ super(e), this.name = this.constructor.name, this.code = t, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
2686
+ }
2687
+ }
2688
+ class Re extends je {
2689
+ constructor(e, t) {
2690
+ super(e, "VALIDATION_ERROR"), this.details = t;
2691
+ }
2692
+ }
2693
+ class le extends je {
2694
+ constructor(e, t) {
2695
+ super(e, "DATA_ERROR"), this.path = t;
2696
+ }
2697
+ }
2698
+ class bt extends je {
2699
+ constructor(e, t, r) {
2700
+ super(e, "EXPRESSION_ERROR"), this.expression = t, this.details = r;
2701
+ }
2702
+ }
2703
+ class he extends je {
2704
+ constructor(e) {
2705
+ super(e, "STATE_ERROR");
2706
+ }
2707
+ }
2708
+ class En {
2709
+ constructor(e, t, r = [], s) {
2710
+ this.id = e;
2711
+ const a = /* @__PURE__ */ new Map();
2712
+ for (const o of t)
2713
+ a.set(o.name, o);
2714
+ this.components = a;
2715
+ const i = /* @__PURE__ */ new Map();
2716
+ for (const o of r)
2717
+ i.set(o.name, o);
2718
+ this.functions = i, this.themeSchema = s, this.invoker = (o, c, u, y) => {
2719
+ var v;
2720
+ const T = this.functions.get(o);
2721
+ if (!T)
2722
+ throw new bt(`Function not found in catalog '${this.id}': ${o}`, o);
2723
+ try {
2724
+ const w = T.schema.parse(c);
2725
+ return T.execute(w, u, y);
2726
+ } catch (w) {
2727
+ throw (w == null ? void 0 : w.name) === "ZodError" || w instanceof z ? new bt(`Validation failed for function '${o}': ${w.message}`, o, (v = w.errors) != null ? v : w.issues) : w;
2728
+ }
2729
+ };
2730
+ }
2731
+ }
2732
+ class G {
2733
+ constructor() {
2734
+ this.listeners = /* @__PURE__ */ new Set();
2735
+ }
2736
+ /**
2737
+ * Subscribes to the event.
2738
+ *
2739
+ * @param listener The listener function to call when the event is emitted.
2740
+ * @returns A subscription object that can be used to unsubscribe.
2741
+ */
2742
+ subscribe(e) {
2743
+ return this.listeners.add(e), {
2744
+ unsubscribe: () => this.listeners.delete(e)
2745
+ };
2746
+ }
2747
+ /**
2748
+ * Emits an event to all subscribers.
2749
+ *
2750
+ * @param data The data to pass to subscribers.
2751
+ */
2752
+ async emit(e) {
2753
+ for (const t of this.listeners)
2754
+ try {
2755
+ await t(e);
2756
+ } catch (r) {
2757
+ console.error("EventEmitter error:", r);
2758
+ }
2759
+ }
2760
+ /**
2761
+ * Removes all listeners.
2762
+ */
2763
+ dispose() {
2764
+ this.listeners.clear();
2765
+ }
2766
+ }
2767
+ var Rn = Symbol.for("preact-signals");
2768
+ function Ie() {
2769
+ if (W > 1)
2770
+ W--;
2771
+ else {
2772
+ var n, e = !1;
2773
+ for (function() {
2774
+ var s = Ce;
2775
+ for (Ce = void 0; s !== void 0; )
2776
+ s.S.v === s.v && (s.S.i = s.i), s = s.o;
2777
+ }(); ye !== void 0; ) {
2778
+ var t = ye;
2779
+ for (ye = void 0, Te++; t !== void 0; ) {
2780
+ var r = t.u;
2781
+ if (t.u = void 0, t.f &= -3, !(8 & t.f) && Dt(t))
2782
+ try {
2783
+ t.c();
2784
+ } catch (s) {
2785
+ e || (n = s, e = !0);
2786
+ }
2787
+ t = r;
2788
+ }
2789
+ }
2790
+ if (Te = 0, W--, e)
2791
+ throw n;
2792
+ }
2793
+ }
2794
+ function kt(n) {
2795
+ if (W > 0)
2796
+ return n();
2797
+ it = ++$n, W++;
2798
+ try {
2799
+ return n();
2800
+ } finally {
2801
+ Ie();
2802
+ }
2803
+ }
2804
+ var S = void 0;
2805
+ function Rt(n) {
2806
+ var e = S;
2807
+ S = void 0;
2808
+ try {
2809
+ return n();
2810
+ } finally {
2811
+ S = e;
2812
+ }
2813
+ }
2814
+ var ye = void 0, W = 0, Te = 0, $n = 0, it = 0, Ce = void 0, Oe = 0;
2815
+ function $t(n) {
2816
+ if (S !== void 0) {
2817
+ var e = n.n;
2818
+ if (e === void 0 || e.t !== S)
2819
+ return e = { i: 0, S: n, p: S.s, n: void 0, t: S, e: void 0, x: void 0, r: e }, S.s !== void 0 && (S.s.n = e), S.s = e, n.n = e, 32 & S.f && n.S(e), e;
2820
+ if (e.i === -1)
2821
+ return e.i = 0, e.n !== void 0 && (e.n.p = e.p, e.p !== void 0 && (e.p.n = e.n), e.p = S.s, e.n = void 0, S.s.n = e, S.s = e), e;
2822
+ }
2823
+ }
2824
+ function j(n, e) {
2825
+ this.v = n, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = e == null ? void 0 : e.watched, this.Z = e == null ? void 0 : e.unwatched, this.name = e == null ? void 0 : e.name;
2826
+ }
2827
+ j.prototype.brand = Rn;
2828
+ j.prototype.h = function() {
2829
+ return !0;
2830
+ };
2831
+ j.prototype.S = function(n) {
2832
+ var e = this, t = this.t;
2833
+ t !== n && n.e === void 0 && (n.x = t, this.t = n, t !== void 0 ? t.e = n : Rt(function() {
2834
+ var r;
2835
+ (r = e.W) == null || r.call(e);
2836
+ }));
2837
+ };
2838
+ j.prototype.U = function(n) {
2839
+ var e = this;
2840
+ if (this.t !== void 0) {
2841
+ var t = n.e, r = n.x;
2842
+ t !== void 0 && (t.x = r, n.e = void 0), r !== void 0 && (r.e = t, n.x = void 0), n === this.t && (this.t = r, r === void 0 && Rt(function() {
2843
+ var s;
2844
+ (s = e.Z) == null || s.call(e);
2845
+ }));
2846
+ }
2847
+ };
2848
+ j.prototype.subscribe = function(n) {
2849
+ var e = this;
2850
+ return Ut(function() {
2851
+ var t = e.value, r = S;
2852
+ S = void 0;
2853
+ try {
2854
+ n(t);
2855
+ } finally {
2856
+ S = r;
2857
+ }
2858
+ }, { name: "sub" });
2859
+ };
2860
+ j.prototype.valueOf = function() {
2861
+ return this.value;
2862
+ };
2863
+ j.prototype.toString = function() {
2864
+ return this.value + "";
2865
+ };
2866
+ j.prototype.toJSON = function() {
2867
+ return this.value;
2868
+ };
2869
+ j.prototype.peek = function() {
2870
+ var n = S;
2871
+ S = void 0;
2872
+ try {
2873
+ return this.value;
2874
+ } finally {
2875
+ S = n;
2876
+ }
2877
+ };
2878
+ Object.defineProperty(j.prototype, "value", { get: function() {
2879
+ var n = $t(this);
2880
+ return n !== void 0 && (n.i = this.i), this.v;
2881
+ }, set: function(n) {
2882
+ if (n !== this.v) {
2883
+ if (Te > 100)
2884
+ throw new Error("Cycle detected");
2885
+ ((function(t) {
2886
+ W !== 0 && Te === 0 && t.l !== it && (t.l = it, Ce = { S: t, v: t.v, i: t.i, o: Ce });
2887
+ }))(this), this.v = n, this.i++, Oe++, W++;
2888
+ try {
2889
+ for (var e = this.t; e !== void 0; e = e.x)
2890
+ e.t.N();
2891
+ } finally {
2892
+ Ie();
2893
+ }
2894
+ }
2895
+ } });
2896
+ function Dn(n, e) {
2897
+ return new j(n, e);
2898
+ }
2899
+ function Dt(n) {
2900
+ for (var e = n.s; e !== void 0; e = e.n)
2901
+ if (e.S.i !== e.i || !e.S.h() || e.S.i !== e.i)
2902
+ return !0;
2903
+ return !1;
2904
+ }
2905
+ function Lt(n) {
2906
+ for (var e = n.s; e !== void 0; e = e.n) {
2907
+ var t = e.S.n;
2908
+ if (t !== void 0 && (e.r = t), e.S.n = e, e.i = -1, e.n === void 0) {
2909
+ n.s = e;
2910
+ break;
2911
+ }
2912
+ }
2913
+ }
2914
+ function zt(n) {
2915
+ for (var e = n.s, t = void 0; e !== void 0; ) {
2916
+ var r = e.p;
2917
+ e.i === -1 ? (e.S.U(e), r !== void 0 && (r.n = e.n), e.n !== void 0 && (e.n.p = r)) : t = e, e.S.n = e.r, e.r !== void 0 && (e.r = void 0), e = r;
2918
+ }
2919
+ n.s = t;
2920
+ }
2921
+ function ue(n, e) {
2922
+ j.call(this, void 0), this.x = n, this.s = void 0, this.g = Oe - 1, this.f = 4, this.W = e == null ? void 0 : e.watched, this.Z = e == null ? void 0 : e.unwatched, this.name = e == null ? void 0 : e.name;
2923
+ }
2924
+ ue.prototype = new j();
2925
+ ue.prototype.h = function() {
2926
+ if (this.f &= -3, 1 & this.f)
2927
+ return !1;
2928
+ if ((36 & this.f) == 32 || (this.f &= -5, this.g === Oe))
2929
+ return !0;
2930
+ if (this.g = Oe, this.f |= 1, this.i > 0 && !Dt(this))
2931
+ return this.f &= -2, !0;
2932
+ var n = S;
2933
+ try {
2934
+ Lt(this), S = this;
2935
+ var e = this.x();
2936
+ (16 & this.f || this.v !== e || this.i === 0) && (this.v = e, this.f &= -17, this.i++);
2937
+ } catch (t) {
2938
+ this.v = t, this.f |= 16, this.i++;
2939
+ }
2940
+ return S = n, zt(this), this.f &= -2, !0;
2941
+ };
2942
+ ue.prototype.S = function(n) {
2943
+ if (this.t === void 0) {
2944
+ this.f |= 36;
2945
+ for (var e = this.s; e !== void 0; e = e.n)
2946
+ e.S.S(e);
2947
+ }
2948
+ j.prototype.S.call(this, n);
2949
+ };
2950
+ ue.prototype.U = function(n) {
2951
+ if (this.t !== void 0 && (j.prototype.U.call(this, n), this.t === void 0)) {
2952
+ this.f &= -33;
2953
+ for (var e = this.s; e !== void 0; e = e.n)
2954
+ e.S.U(e);
2955
+ }
2956
+ };
2957
+ ue.prototype.N = function() {
2958
+ if (!(2 & this.f)) {
2959
+ this.f |= 6;
2960
+ for (var n = this.t; n !== void 0; n = n.x)
2961
+ n.t.N();
2962
+ }
2963
+ };
2964
+ Object.defineProperty(ue.prototype, "value", { get: function() {
2965
+ if (1 & this.f)
2966
+ throw new Error("Cycle detected");
2967
+ var n = $t(this);
2968
+ if (this.h(), n !== void 0 && (n.i = this.i), 16 & this.f)
2969
+ throw this.v;
2970
+ return this.v;
2971
+ } });
2972
+ function Vt(n) {
2973
+ var e = n.m;
2974
+ if (n.m = void 0, typeof e == "function") {
2975
+ W++;
2976
+ var t = S;
2977
+ S = void 0;
2978
+ try {
2979
+ e();
2980
+ } catch (r) {
2981
+ throw n.f &= -2, n.f |= 8, ut(n), r;
2982
+ } finally {
2983
+ S = t, Ie();
2984
+ }
2985
+ }
2986
+ }
2987
+ function ut(n) {
2988
+ for (var e = n.s; e !== void 0; e = e.n)
2989
+ e.S.U(e);
2990
+ n.x = void 0, n.s = void 0, Vt(n);
2991
+ }
2992
+ function Ln(n) {
2993
+ if (S !== this)
2994
+ throw new Error("Out-of-order effect");
2995
+ zt(this), S = n, this.f &= -2, 8 & this.f && ut(this), Ie();
2996
+ }
2997
+ function de(n, e) {
2998
+ this.x = n, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = e == null ? void 0 : e.name;
2999
+ }
3000
+ de.prototype.c = function() {
3001
+ var n = this.S();
3002
+ try {
3003
+ if (8 & this.f || this.x === void 0)
3004
+ return;
3005
+ var e = this.x();
3006
+ typeof e == "function" && (this.m = e);
3007
+ } finally {
3008
+ n();
3009
+ }
3010
+ };
3011
+ de.prototype.S = function() {
3012
+ if (1 & this.f)
3013
+ throw new Error("Cycle detected");
3014
+ this.f |= 1, this.f &= -9, Vt(this), Lt(this), W++;
3015
+ var n = S;
3016
+ return S = this, Ln.bind(this, n);
3017
+ };
3018
+ de.prototype.N = function() {
3019
+ 2 & this.f || (this.f |= 2, this.u = ye, ye = this);
3020
+ };
3021
+ de.prototype.d = function() {
3022
+ this.f |= 8, 1 & this.f || ut(this);
3023
+ };
3024
+ de.prototype.dispose = function() {
3025
+ this.d();
3026
+ };
3027
+ function Ut(n, e) {
3028
+ var t = new de(n, e);
3029
+ try {
3030
+ t.c();
3031
+ } catch (s) {
3032
+ throw t.d(), s;
3033
+ }
3034
+ var r = t.d.bind(t);
3035
+ return r[Symbol.dispose] = r, r;
3036
+ }
3037
+ function $e(n) {
3038
+ return /^\d+$/.test(n);
3039
+ }
3040
+ class zn {
3041
+ /**
3042
+ * Creates a new data model.
3043
+ *
3044
+ * @param initialData The initial data for the model. Defaults to an empty object.
3045
+ */
3046
+ constructor(e = {}) {
3047
+ this.data = {}, this.signals = /* @__PURE__ */ new Map(), this.subscriptions = /* @__PURE__ */ new Set(), this.data = e;
3048
+ }
3049
+ /**
3050
+ * Retrieves a Preact Signal for a specific data path.
3051
+ *
3052
+ * This provides a reactive way to access a value. If the value at the path changes via `set()`,
3053
+ * the signal will automatically be updated.
3054
+ *
3055
+ * @param path The JSON pointer path to create or retrieve a signal for.
3056
+ * @returns A Preact Signal representing the value at the specified path.
3057
+ */
3058
+ getSignal(e) {
3059
+ const t = this.normalizePath(e);
3060
+ return this.signals.has(t) || this.signals.set(t, Dn(this.get(t))), this.signals.get(t);
3061
+ }
3062
+ /**
3063
+ * Updates the model at the specific path and notifies all relevant signals.
3064
+ * If path is '/' or empty, replaces the entire root.
3065
+ *
3066
+ * Note on `undefined` values:
3067
+ * - For objects: Setting a property to `undefined` removes the key from the object.
3068
+ * - For arrays: Setting an index to `undefined` sets that index to `undefined` but preserves the array length (sparse array).
3069
+ */
3070
+ set(e, t) {
3071
+ if (e == null)
3072
+ throw new le("Path cannot be null or undefined.");
3073
+ if (e === "/" || e === "")
3074
+ return this.data = t, this.notifyAllSignals(), this;
3075
+ const r = this.parsePath(e), s = r.pop();
3076
+ this.data || (this.data = {});
3077
+ let a = this.data;
3078
+ for (let i = 0; i < r.length; i++) {
3079
+ const o = r[i];
3080
+ if (Array.isArray(a) && !$e(o))
3081
+ throw new le(`Cannot use non-numeric segment '${o}' on an array in path '${e}'.`, e);
3082
+ if (a[o] !== void 0 && a[o] !== null && typeof a[o] != "object")
3083
+ throw new le(`Cannot set path '${e}': segment '${o}' is a primitive value.`, e);
3084
+ if (a[o] === void 0 || a[o] === null) {
3085
+ const c = i < r.length - 1 ? r[i + 1] : s;
3086
+ a[o] = $e(c) ? [] : {};
3087
+ }
3088
+ a = a[o];
3089
+ }
3090
+ if (Array.isArray(a) && !$e(s))
3091
+ throw new le(`Cannot use non-numeric segment '${s}' on an array in path '${e}'.`, e);
3092
+ return t === void 0 ? Array.isArray(a) ? a[parseInt(s, 10)] = void 0 : delete a[s] : a[s] = t, this.notifySignals(e), this;
3093
+ }
3094
+ /**
3095
+ * Retrieves data at a specific JSON pointer path.
3096
+ *
3097
+ * @param path The JSON pointer path to read from.
3098
+ * @returns The value at the specified path, or undefined if not found.
3099
+ */
3100
+ get(e) {
3101
+ if (e == null)
3102
+ throw new le("Path cannot be null or undefined.");
3103
+ if (e === "/" || e === "")
3104
+ return this.data;
3105
+ const t = this.parsePath(e);
3106
+ let r = this.data;
3107
+ for (const s of t) {
3108
+ if (r == null)
3109
+ return;
3110
+ r = r[s];
3111
+ }
3112
+ return r;
3113
+ }
3114
+ /**
3115
+ * Subscribes to changes at the specified data path.
3116
+ *
3117
+ * This is a backwards-compatible layer using Preact Signals internally. It allows
3118
+ * listeners to be notified whenever the value at the specified path (or any of its
3119
+ * ancestors/descendants) changes.
3120
+ *
3121
+ * @param path The JSON pointer path to observe.
3122
+ * @param onChange A callback fired whenever the value changes.
3123
+ * @returns A `DataSubscription` containing the initial value and an `unsubscribe` method.
3124
+ */
3125
+ subscribe(e, t) {
3126
+ const r = this.getSignal(e);
3127
+ let s = !0, a = r.peek();
3128
+ const i = Ut(() => {
3129
+ const o = r.value;
3130
+ a = o, s || t(o);
3131
+ });
3132
+ return s = !1, this.subscriptions.add(i), {
3133
+ get value() {
3134
+ return a;
3135
+ },
3136
+ unsubscribe: () => {
3137
+ i(), this.subscriptions.delete(i);
3138
+ }
3139
+ };
3140
+ }
3141
+ /**
3142
+ * Clears all internal subscriptions.
3143
+ */
3144
+ dispose() {
3145
+ for (const e of this.subscriptions)
3146
+ e();
3147
+ this.subscriptions.clear(), this.signals.clear();
3148
+ }
3149
+ normalizePath(e) {
3150
+ return e.length > 1 && e.endsWith("/") ? e.slice(0, -1) : e || "/";
3151
+ }
3152
+ parsePath(e) {
3153
+ return e.split("/").filter((t) => t.length > 0);
3154
+ }
3155
+ notifySignals(e) {
3156
+ const t = this.normalizePath(e);
3157
+ kt(() => {
3158
+ this.updateSignal(t);
3159
+ let r = t;
3160
+ for (; r !== "/" && r !== ""; )
3161
+ r = r.substring(0, r.lastIndexOf("/")) || "/", this.updateSignal(r);
3162
+ for (const s of this.signals.keys())
3163
+ this.isDescendant(s, t) && this.updateSignal(s);
3164
+ });
3165
+ }
3166
+ updateSignal(e) {
3167
+ const t = this.signals.get(e);
3168
+ if (t) {
3169
+ const r = this.get(e);
3170
+ Array.isArray(r) ? t.value = [...r] : typeof r == "object" && r !== null ? t.value = { ...r } : t.value = r;
3171
+ }
3172
+ }
3173
+ notifyAllSignals() {
3174
+ kt(() => {
3175
+ for (const e of this.signals.keys())
3176
+ this.updateSignal(e);
3177
+ });
3178
+ }
3179
+ isDescendant(e, t) {
3180
+ return t === "/" || t === "" ? e !== "/" : e.startsWith(t + "/");
3181
+ }
3182
+ }
3183
+ class Vn {
3184
+ constructor() {
3185
+ this.components = /* @__PURE__ */ new Map(), this._onCreated = new G(), this._onDeleted = new G(), this.onCreated = this._onCreated, this.onDeleted = this._onDeleted;
3186
+ }
3187
+ /**
3188
+ * Retrieves a component by its ID.
3189
+ *
3190
+ *
3191
+ * @param id The ID of the component to retrieve.
3192
+ * @returns The component model, or undefined if not found.
3193
+ */
3194
+ get(e) {
3195
+ return this.components.get(e);
3196
+ }
3197
+ /**
3198
+ * Returns an iterator over the components in the model.
3199
+ */
3200
+ get entries() {
3201
+ return this.components.entries();
3202
+ }
3203
+ /**
3204
+ * Adds a component to the model.
3205
+ * Throws an error if a component with the same ID already exists.
3206
+ *
3207
+ * @param component The component to add.
3208
+ */
3209
+ addComponent(e) {
3210
+ if (this.components.has(e.id))
3211
+ throw new he(`Component with id '${e.id}' already exists.`);
3212
+ this.components.set(e.id, e), this._onCreated.emit(e);
3213
+ }
3214
+ /**
3215
+ * Removes a component from the model by its ID.
3216
+ * Disposes of the component upon removal.
3217
+ *
3218
+ * @param id The ID of the component to remove.
3219
+ */
3220
+ removeComponent(e) {
3221
+ const t = this.components.get(e);
3222
+ t && (this.components.delete(e), t.dispose(), this._onDeleted.emit(e));
3223
+ }
3224
+ /**
3225
+ * Disposes of the model and all its components.
3226
+ */
3227
+ dispose() {
3228
+ for (const e of this.components.values())
3229
+ e.dispose();
3230
+ this.components.clear(), this._onCreated.dispose(), this._onDeleted.dispose();
3231
+ }
3232
+ }
3233
+ const Ft = B({
3234
+ name: D().describe("The name of the action, taken from the component's action.event.name property."),
3235
+ surfaceId: D().describe("The id of the surface where the event originated."),
3236
+ sourceComponentId: D().describe("The id of the component that triggered the event."),
3237
+ timestamp: D().datetime().describe("An ISO 8601 timestamp of when the event occurred."),
3238
+ context: ct(ne()).describe("A JSON object containing the key-value pairs from the component's action.event.context, after resolving all data bindings.")
3239
+ }).strict(), Un = B({
3240
+ code: Pe("VALIDATION_FAILED"),
3241
+ surfaceId: D().describe("The id of the surface where the error occurred."),
3242
+ path: D().describe("The JSON pointer to the field that failed validation (e.g. '/components/0/text')."),
3243
+ message: D().describe("A short one or two sentence description of why validation failed.")
3244
+ }).strict(), Fn = B({
3245
+ code: D().refine((n) => n !== "VALIDATION_FAILED"),
3246
+ message: D().describe("A short one or two sentence description of why the error occurred."),
3247
+ surfaceId: D().describe("The id of the surface where the error occurred.")
3248
+ }).passthrough(), Bn = Ze([
3249
+ Un,
3250
+ Fn
3251
+ ]);
3252
+ B({
3253
+ version: Pe("v0.9")
3254
+ }).and(Ze([
3255
+ B({ action: Ft }),
3256
+ B({ error: Bn })
3257
+ ]));
3258
+ B({
3259
+ version: Pe("v0.9"),
3260
+ surfaces: ct(B({}).passthrough()).describe("A map of surface IDs to their current data models.")
3261
+ }).strict();
3262
+ class Wn {
3263
+ /**
3264
+ * Creates a new surface model.
3265
+ *
3266
+ * @param id The unique identifier for this surface.
3267
+ * @param catalog The component catalog used by this surface.
3268
+ * @param theme The theme to apply to this surface.
3269
+ * @param sendDataModel If true, the client will send the full data model.
3270
+ */
3271
+ constructor(e, t, r = {}, s = !1) {
3272
+ this.id = e, this.catalog = t, this.theme = r, this.sendDataModel = s, this._onAction = new G(), this._onError = new G(), this.onAction = this._onAction, this.onError = this._onError, this.dataModel = new zn({}), this.componentsModel = new Vn();
3273
+ }
3274
+ /**
3275
+ * Dispatches an action from this surface to listeners.
3276
+ *
3277
+ * @param payload The action payload (name and context) to dispatch.
3278
+ * @param sourceComponentId The ID of the component that triggered the action.
3279
+ */
3280
+ async dispatchAction(e, t) {
3281
+ if (e && typeof e == "object" && "event" in e && e.event) {
3282
+ const r = {
3283
+ name: e.event.name,
3284
+ surfaceId: this.id,
3285
+ sourceComponentId: t,
3286
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
3287
+ context: e.event.context || {}
3288
+ }, s = Ft.safeParse(r);
3289
+ s.success ? await this._onAction.emit(s.data) : console.error("A2UI: Invalid action payload dispatched.", s.error.format());
3290
+ }
3291
+ }
3292
+ /**
3293
+ * Dispatches an error from this surface to listeners.
3294
+ *
3295
+ * @param error The error object to dispatch, conforming to client_to_server schema.
3296
+ */
3297
+ async dispatchError(e) {
3298
+ await this._onError.emit({
3299
+ ...e,
3300
+ surfaceId: this.id
3301
+ });
3302
+ }
3303
+ /**
3304
+ * Disposes of the surface and its resources.
3305
+ */
3306
+ dispose() {
3307
+ this.dataModel.dispose(), this.componentsModel.dispose(), this._onAction.dispose(), this._onError.dispose();
3308
+ }
3309
+ }
3310
+ class qn {
3311
+ constructor() {
3312
+ this.surfaces = /* @__PURE__ */ new Map(), this.surfaceUnsubscribers = /* @__PURE__ */ new Map(), this._onSurfaceCreated = new G(), this._onSurfaceDeleted = new G(), this._onAction = new G(), this.onSurfaceCreated = this._onSurfaceCreated, this.onSurfaceDeleted = this._onSurfaceDeleted, this.onAction = this._onAction;
3313
+ }
3314
+ /**
3315
+ * Adds a surface to the group.
3316
+ * Ignores if a surface with the same ID already exists.
3317
+ *
3318
+ * @param surface The surface model to add.
3319
+ */
3320
+ addSurface(e) {
3321
+ if (this.surfaces.has(e.id)) {
3322
+ console.warn(`Surface ${e.id} already exists. Ignoring.`);
3323
+ return;
3324
+ }
3325
+ this.surfaces.set(e.id, e);
3326
+ const t = e.onAction.subscribe((r) => this._onAction.emit(r));
3327
+ this.surfaceUnsubscribers.set(e.id, t), this._onSurfaceCreated.emit(e);
3328
+ }
3329
+ /**
3330
+ * Removes a surface from the group by its ID.
3331
+ * Disposes of the surface upon removal.
3332
+ *
3333
+ * @param id The ID of the surface to remove.
3334
+ */
3335
+ deleteSurface(e) {
3336
+ const t = this.surfaces.get(e);
3337
+ if (t) {
3338
+ const r = this.surfaceUnsubscribers.get(e);
3339
+ r && (r.unsubscribe(), this.surfaceUnsubscribers.delete(e)), this.surfaces.delete(e), t.dispose(), this._onSurfaceDeleted.emit(e);
3340
+ }
3341
+ }
3342
+ /**
3343
+ * Retrieves a surface by its ID.
3344
+ *
3345
+ *
3346
+ * @param id The ID of the surface to retrieve.
3347
+ * @returns The surface model, or undefined if not found.
3348
+ */
3349
+ getSurface(e) {
3350
+ return this.surfaces.get(e);
3351
+ }
3352
+ /**
3353
+ * Returns a readonly map of all active surfaces.
3354
+ */
3355
+ get surfacesMap() {
3356
+ return this.surfaces;
3357
+ }
3358
+ /**
3359
+ * Disposes of the group and all its surfaces.
3360
+ */
3361
+ dispose() {
3362
+ for (const e of Array.from(this.surfaces.keys()))
3363
+ this.deleteSurface(e);
3364
+ this._onSurfaceCreated.dispose(), this._onSurfaceDeleted.dispose(), this._onAction.dispose();
3365
+ }
3366
+ }
3367
+ class xt {
3368
+ /**
3369
+ * Creates a new component model.
3370
+ *
3371
+ * @param id The unique identifier for this component.
3372
+ * @param type The component type name.
3373
+ * @param initialProperties The initial properties for the component.
3374
+ */
3375
+ constructor(e, t, r) {
3376
+ this.id = e, this.type = t, this._onUpdated = new G(), this.onUpdated = this._onUpdated, this._properties = r;
3377
+ }
3378
+ /**
3379
+ * The current properties of the component.
3380
+ */
3381
+ get properties() {
3382
+ return this._properties;
3383
+ }
3384
+ set properties(e) {
3385
+ this._properties = e, this._onUpdated.emit(this);
3386
+ }
3387
+ /**
3388
+ * Disposes of the component and its resources.
3389
+ */
3390
+ dispose() {
3391
+ this._onUpdated.dispose();
3392
+ }
3393
+ /**
3394
+ * Returns a JSON representation of the component tree.
3395
+ */
3396
+ get componentTree() {
3397
+ return {
3398
+ id: this.id,
3399
+ type: this.type,
3400
+ ...this._properties
3401
+ };
3402
+ }
3403
+ }
3404
+ const Jn = Symbol("Let zodToJsonSchema decide on which parser to use"), wt = {
3405
+ name: void 0,
3406
+ $refStrategy: "root",
3407
+ basePath: ["#"],
3408
+ effectStrategy: "input",
3409
+ pipeStrategy: "all",
3410
+ dateStrategy: "format:date-time",
3411
+ mapStrategy: "entries",
3412
+ removeAdditionalStrategy: "passthrough",
3413
+ allowedAdditionalProperties: !0,
3414
+ rejectedAdditionalProperties: !1,
3415
+ definitionPath: "definitions",
3416
+ target: "jsonSchema7",
3417
+ strictUnions: !1,
3418
+ definitions: {},
3419
+ errorMessages: !1,
3420
+ markdownDescription: !1,
3421
+ patternStrategy: "escape",
3422
+ applyRegexFlags: !1,
3423
+ emailStrategy: "format:email",
3424
+ base64Strategy: "contentEncoding:base64",
3425
+ nameStrategy: "ref",
3426
+ openAiAnyTypeName: "OpenAiAnyType"
3427
+ }, Hn = (n) => typeof n == "string" ? {
3428
+ ...wt,
3429
+ name: n
3430
+ } : {
3431
+ ...wt,
3432
+ ...n
3433
+ }, Gn = (n) => {
3434
+ const e = Hn(n), t = e.name !== void 0 ? [...e.basePath, e.definitionPath, e.name] : e.basePath;
3435
+ return {
3436
+ ...e,
3437
+ flags: { hasReferencedOpenAiAnyType: !1 },
3438
+ currentPath: t,
3439
+ propertyPath: void 0,
3440
+ seen: new Map(Object.entries(e.definitions).map(([r, s]) => [
3441
+ s._def,
3442
+ {
3443
+ def: s._def,
3444
+ path: [...e.basePath, e.definitionPath, r],
3445
+ // Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
3446
+ jsonSchema: void 0
3447
+ }
3448
+ ]))
3449
+ };
3450
+ };
3451
+ function Bt(n, e, t, r) {
3452
+ r != null && r.errorMessages && t && (n.errorMessage = {
3453
+ ...n.errorMessage,
3454
+ [e]: t
3455
+ });
3456
+ }
3457
+ function A(n, e, t, r, s) {
3458
+ n[e] = t, Bt(n, e, r, s);
3459
+ }
3460
+ const Wt = (n, e) => {
3461
+ let t = 0;
3462
+ for (; t < n.length && t < e.length && n[t] === e[t]; t++)
3463
+ ;
3464
+ return [(n.length - t).toString(), ...e.slice(t)].join("/");
3465
+ };
3466
+ function M(n) {
3467
+ if (n.target !== "openAi")
3468
+ return {};
3469
+ const e = [
3470
+ ...n.basePath,
3471
+ n.definitionPath,
3472
+ n.openAiAnyTypeName
3473
+ ];
3474
+ return n.flags.hasReferencedOpenAiAnyType = !0, {
3475
+ $ref: n.$refStrategy === "relative" ? Wt(e, n.currentPath) : e.join("/")
3476
+ };
3477
+ }
3478
+ function Yn(n, e) {
3479
+ var r, s, a;
3480
+ const t = {
3481
+ type: "array"
3482
+ };
3483
+ return (r = n.type) != null && r._def && ((a = (s = n.type) == null ? void 0 : s._def) == null ? void 0 : a.typeName) !== l.ZodAny && (t.items = x(n.type._def, {
3484
+ ...e,
3485
+ currentPath: [...e.currentPath, "items"]
3486
+ })), n.minLength && A(t, "minItems", n.minLength.value, n.minLength.message, e), n.maxLength && A(t, "maxItems", n.maxLength.value, n.maxLength.message, e), n.exactLength && (A(t, "minItems", n.exactLength.value, n.exactLength.message, e), A(t, "maxItems", n.exactLength.value, n.exactLength.message, e)), t;
3487
+ }
3488
+ function Kn(n, e) {
3489
+ const t = {
3490
+ type: "integer",
3491
+ format: "int64"
3492
+ };
3493
+ if (!n.checks)
3494
+ return t;
3495
+ for (const r of n.checks)
3496
+ switch (r.kind) {
3497
+ case "min":
3498
+ e.target === "jsonSchema7" ? r.inclusive ? A(t, "minimum", r.value, r.message, e) : A(t, "exclusiveMinimum", r.value, r.message, e) : (r.inclusive || (t.exclusiveMinimum = !0), A(t, "minimum", r.value, r.message, e));
3499
+ break;
3500
+ case "max":
3501
+ e.target === "jsonSchema7" ? r.inclusive ? A(t, "maximum", r.value, r.message, e) : A(t, "exclusiveMaximum", r.value, r.message, e) : (r.inclusive || (t.exclusiveMaximum = !0), A(t, "maximum", r.value, r.message, e));
3502
+ break;
3503
+ case "multipleOf":
3504
+ A(t, "multipleOf", r.value, r.message, e);
3505
+ break;
3506
+ }
3507
+ return t;
3508
+ }
3509
+ function Xn() {
3510
+ return {
3511
+ type: "boolean"
3512
+ };
3513
+ }
3514
+ function qt(n, e) {
3515
+ return x(n.type._def, e);
3516
+ }
3517
+ const Qn = (n, e) => x(n.innerType._def, e);
3518
+ function Jt(n, e, t) {
3519
+ const r = t != null ? t : e.dateStrategy;
3520
+ if (Array.isArray(r))
3521
+ return {
3522
+ anyOf: r.map((s, a) => Jt(n, e, s))
3523
+ };
3524
+ switch (r) {
3525
+ case "string":
3526
+ case "format:date-time":
3527
+ return {
3528
+ type: "string",
3529
+ format: "date-time"
3530
+ };
3531
+ case "format:date":
3532
+ return {
3533
+ type: "string",
3534
+ format: "date"
3535
+ };
3536
+ case "integer":
3537
+ return er(n, e);
3538
+ }
3539
+ }
3540
+ const er = (n, e) => {
3541
+ const t = {
3542
+ type: "integer",
3543
+ format: "unix-time"
3544
+ };
3545
+ if (e.target === "openApi3")
3546
+ return t;
3547
+ for (const r of n.checks)
3548
+ switch (r.kind) {
3549
+ case "min":
3550
+ A(
3551
+ t,
3552
+ "minimum",
3553
+ r.value,
3554
+ // This is in milliseconds
3555
+ r.message,
3556
+ e
3557
+ );
3558
+ break;
3559
+ case "max":
3560
+ A(
3561
+ t,
3562
+ "maximum",
3563
+ r.value,
3564
+ // This is in milliseconds
3565
+ r.message,
3566
+ e
3567
+ );
3568
+ break;
3569
+ }
3570
+ return t;
3571
+ };
3572
+ function tr(n, e) {
3573
+ return {
3574
+ ...x(n.innerType._def, e),
3575
+ default: n.defaultValue()
3576
+ };
3577
+ }
3578
+ function nr(n, e) {
3579
+ return e.effectStrategy === "input" ? x(n.schema._def, e) : M(e);
3580
+ }
3581
+ function rr(n) {
3582
+ return {
3583
+ type: "string",
3584
+ enum: Array.from(n.values)
3585
+ };
3586
+ }
3587
+ const sr = (n) => "type" in n && n.type === "string" ? !1 : "allOf" in n;
3588
+ function ar(n, e) {
3589
+ const t = [
3590
+ x(n.left._def, {
3591
+ ...e,
3592
+ currentPath: [...e.currentPath, "allOf", "0"]
3593
+ }),
3594
+ x(n.right._def, {
3595
+ ...e,
3596
+ currentPath: [...e.currentPath, "allOf", "1"]
3597
+ })
3598
+ ].filter((a) => !!a);
3599
+ let r = e.target === "jsonSchema2019-09" ? { unevaluatedProperties: !1 } : void 0;
3600
+ const s = [];
3601
+ return t.forEach((a) => {
3602
+ if (sr(a))
3603
+ s.push(...a.allOf), a.unevaluatedProperties === void 0 && (r = void 0);
3604
+ else {
3605
+ let i = a;
3606
+ if ("additionalProperties" in a && a.additionalProperties === !1) {
3607
+ const { additionalProperties: o, ...c } = a;
3608
+ i = c;
3609
+ } else
3610
+ r = void 0;
3611
+ s.push(i);
3612
+ }
3613
+ }), s.length ? {
3614
+ allOf: s,
3615
+ ...r
3616
+ } : void 0;
3617
+ }
3618
+ function ir(n, e) {
3619
+ const t = typeof n.value;
3620
+ return t !== "bigint" && t !== "number" && t !== "boolean" && t !== "string" ? {
3621
+ type: Array.isArray(n.value) ? "array" : "object"
3622
+ } : e.target === "openApi3" ? {
3623
+ type: t === "bigint" ? "integer" : t,
3624
+ enum: [n.value]
3625
+ } : {
3626
+ type: t === "bigint" ? "integer" : t,
3627
+ const: n.value
3628
+ };
3629
+ }
3630
+ let De;
3631
+ const R = {
3632
+ /**
3633
+ * `c` was changed to `[cC]` to replicate /i flag
3634
+ */
3635
+ cuid: /^[cC][^\s-]{8,}$/,
3636
+ cuid2: /^[0-9a-z]+$/,
3637
+ ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
3638
+ /**
3639
+ * `a-z` was added to replicate /i flag
3640
+ */
3641
+ email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
3642
+ /**
3643
+ * Constructed a valid Unicode RegExp
3644
+ *
3645
+ * Lazily instantiate since this type of regex isn't supported
3646
+ * in all envs (e.g. React Native).
3647
+ *
3648
+ * See:
3649
+ * https://github.com/colinhacks/zod/issues/2433
3650
+ * Fix in Zod:
3651
+ * https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
3652
+ */
3653
+ emoji: () => (De === void 0 && (De = RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$", "u")), De),
3654
+ /**
3655
+ * Unused
3656
+ */
3657
+ uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
3658
+ /**
3659
+ * Unused
3660
+ */
3661
+ ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
3662
+ ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
3663
+ /**
3664
+ * Unused
3665
+ */
3666
+ ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
3667
+ ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
3668
+ base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
3669
+ base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
3670
+ nanoid: /^[a-zA-Z0-9_-]{21}$/,
3671
+ jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
3672
+ };
3673
+ function Ht(n, e) {
3674
+ const t = {
3675
+ type: "string"
3676
+ };
3677
+ if (n.checks)
3678
+ for (const r of n.checks)
3679
+ switch (r.kind) {
3680
+ case "min":
3681
+ A(t, "minLength", typeof t.minLength == "number" ? Math.max(t.minLength, r.value) : r.value, r.message, e);
3682
+ break;
3683
+ case "max":
3684
+ A(t, "maxLength", typeof t.maxLength == "number" ? Math.min(t.maxLength, r.value) : r.value, r.message, e);
3685
+ break;
3686
+ case "email":
3687
+ switch (e.emailStrategy) {
3688
+ case "format:email":
3689
+ $(t, "email", r.message, e);
3690
+ break;
3691
+ case "format:idn-email":
3692
+ $(t, "idn-email", r.message, e);
3693
+ break;
3694
+ case "pattern:zod":
3695
+ Z(t, R.email, r.message, e);
3696
+ break;
3697
+ }
3698
+ break;
3699
+ case "url":
3700
+ $(t, "uri", r.message, e);
3701
+ break;
3702
+ case "uuid":
3703
+ $(t, "uuid", r.message, e);
3704
+ break;
3705
+ case "regex":
3706
+ Z(t, r.regex, r.message, e);
3707
+ break;
3708
+ case "cuid":
3709
+ Z(t, R.cuid, r.message, e);
3710
+ break;
3711
+ case "cuid2":
3712
+ Z(t, R.cuid2, r.message, e);
3713
+ break;
3714
+ case "startsWith":
3715
+ Z(t, RegExp(`^${Le(r.value, e)}`), r.message, e);
3716
+ break;
3717
+ case "endsWith":
3718
+ Z(t, RegExp(`${Le(r.value, e)}$`), r.message, e);
3719
+ break;
3720
+ case "datetime":
3721
+ $(t, "date-time", r.message, e);
3722
+ break;
3723
+ case "date":
3724
+ $(t, "date", r.message, e);
3725
+ break;
3726
+ case "time":
3727
+ $(t, "time", r.message, e);
3728
+ break;
3729
+ case "duration":
3730
+ $(t, "duration", r.message, e);
3731
+ break;
3732
+ case "length":
3733
+ A(t, "minLength", typeof t.minLength == "number" ? Math.max(t.minLength, r.value) : r.value, r.message, e), A(t, "maxLength", typeof t.maxLength == "number" ? Math.min(t.maxLength, r.value) : r.value, r.message, e);
3734
+ break;
3735
+ case "includes": {
3736
+ Z(t, RegExp(Le(r.value, e)), r.message, e);
3737
+ break;
3738
+ }
3739
+ case "ip": {
3740
+ r.version !== "v6" && $(t, "ipv4", r.message, e), r.version !== "v4" && $(t, "ipv6", r.message, e);
3741
+ break;
3742
+ }
3743
+ case "base64url":
3744
+ Z(t, R.base64url, r.message, e);
3745
+ break;
3746
+ case "jwt":
3747
+ Z(t, R.jwt, r.message, e);
3748
+ break;
3749
+ case "cidr": {
3750
+ r.version !== "v6" && Z(t, R.ipv4Cidr, r.message, e), r.version !== "v4" && Z(t, R.ipv6Cidr, r.message, e);
3751
+ break;
3752
+ }
3753
+ case "emoji":
3754
+ Z(t, R.emoji(), r.message, e);
3755
+ break;
3756
+ case "ulid": {
3757
+ Z(t, R.ulid, r.message, e);
3758
+ break;
3759
+ }
3760
+ case "base64": {
3761
+ switch (e.base64Strategy) {
3762
+ case "format:binary": {
3763
+ $(t, "binary", r.message, e);
3764
+ break;
3765
+ }
3766
+ case "contentEncoding:base64": {
3767
+ A(t, "contentEncoding", "base64", r.message, e);
3768
+ break;
3769
+ }
3770
+ case "pattern:zod": {
3771
+ Z(t, R.base64, r.message, e);
3772
+ break;
3773
+ }
3774
+ }
3775
+ break;
3776
+ }
3777
+ case "nanoid":
3778
+ Z(t, R.nanoid, r.message, e);
3779
+ }
3780
+ return t;
3781
+ }
3782
+ function Le(n, e) {
3783
+ return e.patternStrategy === "escape" ? cr(n) : n;
3784
+ }
3785
+ const or = new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");
3786
+ function cr(n) {
3787
+ let e = "";
3788
+ for (let t = 0; t < n.length; t++)
3789
+ or.has(n[t]) || (e += "\\"), e += n[t];
3790
+ return e;
3791
+ }
3792
+ function $(n, e, t, r) {
3793
+ var s;
3794
+ n.format || (s = n.anyOf) != null && s.some((a) => a.format) ? (n.anyOf || (n.anyOf = []), n.format && (n.anyOf.push({
3795
+ format: n.format,
3796
+ ...n.errorMessage && r.errorMessages && {
3797
+ errorMessage: { format: n.errorMessage.format }
3798
+ }
3799
+ }), delete n.format, n.errorMessage && (delete n.errorMessage.format, Object.keys(n.errorMessage).length === 0 && delete n.errorMessage)), n.anyOf.push({
3800
+ format: e,
3801
+ ...t && r.errorMessages && { errorMessage: { format: t } }
3802
+ })) : A(n, "format", e, t, r);
3803
+ }
3804
+ function Z(n, e, t, r) {
3805
+ var s;
3806
+ n.pattern || (s = n.allOf) != null && s.some((a) => a.pattern) ? (n.allOf || (n.allOf = []), n.pattern && (n.allOf.push({
3807
+ pattern: n.pattern,
3808
+ ...n.errorMessage && r.errorMessages && {
3809
+ errorMessage: { pattern: n.errorMessage.pattern }
3810
+ }
3811
+ }), delete n.pattern, n.errorMessage && (delete n.errorMessage.pattern, Object.keys(n.errorMessage).length === 0 && delete n.errorMessage)), n.allOf.push({
3812
+ pattern: St(e, r),
3813
+ ...t && r.errorMessages && { errorMessage: { pattern: t } }
3814
+ })) : A(n, "pattern", St(e, r), t, r);
3815
+ }
3816
+ function St(n, e) {
3817
+ var c;
3818
+ if (!e.applyRegexFlags || !n.flags)
3819
+ return n.source;
3820
+ const t = {
3821
+ i: n.flags.includes("i"),
3822
+ m: n.flags.includes("m"),
3823
+ s: n.flags.includes("s")
3824
+ // `.` matches newlines
3825
+ }, r = t.i ? n.source.toLowerCase() : n.source;
3826
+ let s = "", a = !1, i = !1, o = !1;
3827
+ for (let u = 0; u < r.length; u++) {
3828
+ if (a) {
3829
+ s += r[u], a = !1;
3830
+ continue;
3831
+ }
3832
+ if (t.i) {
3833
+ if (i) {
3834
+ if (r[u].match(/[a-z]/)) {
3835
+ o ? (s += r[u], s += `${r[u - 2]}-${r[u]}`.toUpperCase(), o = !1) : r[u + 1] === "-" && ((c = r[u + 2]) != null && c.match(/[a-z]/)) ? (s += r[u], o = !0) : s += `${r[u]}${r[u].toUpperCase()}`;
3836
+ continue;
3837
+ }
3838
+ } else if (r[u].match(/[a-z]/)) {
3839
+ s += `[${r[u]}${r[u].toUpperCase()}]`;
3840
+ continue;
3841
+ }
3842
+ }
3843
+ if (t.m) {
3844
+ if (r[u] === "^") {
3845
+ s += `(^|(?<=[\r
3846
+ ]))`;
3847
+ continue;
3848
+ } else if (r[u] === "$") {
3849
+ s += `($|(?=[\r
3850
+ ]))`;
3851
+ continue;
3852
+ }
3853
+ }
3854
+ if (t.s && r[u] === ".") {
3855
+ s += i ? `${r[u]}\r
3856
+ ` : `[${r[u]}\r
3857
+ ]`;
3858
+ continue;
3859
+ }
3860
+ s += r[u], r[u] === "\\" ? a = !0 : i && r[u] === "]" ? i = !1 : !i && r[u] === "[" && (i = !0);
3861
+ }
3862
+ try {
3863
+ new RegExp(s);
3864
+ } catch (u) {
3865
+ return console.warn(`Could not convert regex pattern at ${e.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`), n.source;
3866
+ }
3867
+ return s;
3868
+ }
3869
+ function Gt(n, e) {
3870
+ var r, s, a, i, o, c, u;
3871
+ if (e.target === "openAi" && console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead."), e.target === "openApi3" && ((r = n.keyType) == null ? void 0 : r._def.typeName) === l.ZodEnum)
3872
+ return {
3873
+ type: "object",
3874
+ required: n.keyType._def.values,
3875
+ properties: n.keyType._def.values.reduce((y, T) => {
3876
+ var v;
3877
+ return {
3878
+ ...y,
3879
+ [T]: (v = x(n.valueType._def, {
3880
+ ...e,
3881
+ currentPath: [...e.currentPath, "properties", T]
3882
+ })) != null ? v : M(e)
3883
+ };
3884
+ }, {}),
3885
+ additionalProperties: e.rejectedAdditionalProperties
3886
+ };
3887
+ const t = {
3888
+ type: "object",
3889
+ additionalProperties: (s = x(n.valueType._def, {
3890
+ ...e,
3891
+ currentPath: [...e.currentPath, "additionalProperties"]
3892
+ })) != null ? s : e.allowedAdditionalProperties
3893
+ };
3894
+ if (e.target === "openApi3")
3895
+ return t;
3896
+ if (((a = n.keyType) == null ? void 0 : a._def.typeName) === l.ZodString && ((i = n.keyType._def.checks) != null && i.length)) {
3897
+ const { type: y, ...T } = Ht(n.keyType._def, e);
3898
+ return {
3899
+ ...t,
3900
+ propertyNames: T
3901
+ };
3902
+ } else {
3903
+ if (((o = n.keyType) == null ? void 0 : o._def.typeName) === l.ZodEnum)
3904
+ return {
3905
+ ...t,
3906
+ propertyNames: {
3907
+ enum: n.keyType._def.values
3908
+ }
3909
+ };
3910
+ if (((c = n.keyType) == null ? void 0 : c._def.typeName) === l.ZodBranded && n.keyType._def.type._def.typeName === l.ZodString && ((u = n.keyType._def.type._def.checks) != null && u.length)) {
3911
+ const { type: y, ...T } = qt(n.keyType._def, e);
3912
+ return {
3913
+ ...t,
3914
+ propertyNames: T
3915
+ };
3916
+ }
3917
+ }
3918
+ return t;
3919
+ }
3920
+ function ur(n, e) {
3921
+ if (e.mapStrategy === "record")
3922
+ return Gt(n, e);
3923
+ const t = x(n.keyType._def, {
3924
+ ...e,
3925
+ currentPath: [...e.currentPath, "items", "items", "0"]
3926
+ }) || M(e), r = x(n.valueType._def, {
3927
+ ...e,
3928
+ currentPath: [...e.currentPath, "items", "items", "1"]
3929
+ }) || M(e);
3930
+ return {
3931
+ type: "array",
3932
+ maxItems: 125,
3933
+ items: {
3934
+ type: "array",
3935
+ items: [t, r],
3936
+ minItems: 2,
3937
+ maxItems: 2
3938
+ }
3939
+ };
3940
+ }
3941
+ function dr(n) {
3942
+ const e = n.values, r = Object.keys(n.values).filter((a) => typeof e[e[a]] != "number").map((a) => e[a]), s = Array.from(new Set(r.map((a) => typeof a)));
3943
+ return {
3944
+ type: s.length === 1 ? s[0] === "string" ? "string" : "number" : ["string", "number"],
3945
+ enum: r
3946
+ };
3947
+ }
3948
+ function lr(n) {
3949
+ return n.target === "openAi" ? void 0 : {
3950
+ not: M({
3951
+ ...n,
3952
+ currentPath: [...n.currentPath, "not"]
3953
+ })
3954
+ };
3955
+ }
3956
+ function fr(n) {
3957
+ return n.target === "openApi3" ? {
3958
+ enum: ["null"],
3959
+ nullable: !0
3960
+ } : {
3961
+ type: "null"
3962
+ };
3963
+ }
3964
+ const Ne = {
3965
+ ZodString: "string",
3966
+ ZodNumber: "number",
3967
+ ZodBigInt: "integer",
3968
+ ZodBoolean: "boolean",
3969
+ ZodNull: "null"
3970
+ };
3971
+ function hr(n, e) {
3972
+ if (e.target === "openApi3")
3973
+ return At(n, e);
3974
+ const t = n.options instanceof Map ? Array.from(n.options.values()) : n.options;
3975
+ if (t.every((r) => r._def.typeName in Ne && (!r._def.checks || !r._def.checks.length))) {
3976
+ const r = t.reduce((s, a) => {
3977
+ const i = Ne[a._def.typeName];
3978
+ return i && !s.includes(i) ? [...s, i] : s;
3979
+ }, []);
3980
+ return {
3981
+ type: r.length > 1 ? r : r[0]
3982
+ };
3983
+ } else if (t.every((r) => r._def.typeName === "ZodLiteral" && !r.description)) {
3984
+ const r = t.reduce((s, a) => {
3985
+ const i = typeof a._def.value;
3986
+ switch (i) {
3987
+ case "string":
3988
+ case "number":
3989
+ case "boolean":
3990
+ return [...s, i];
3991
+ case "bigint":
3992
+ return [...s, "integer"];
3993
+ case "object":
3994
+ if (a._def.value === null)
3995
+ return [...s, "null"];
3996
+ case "symbol":
3997
+ case "undefined":
3998
+ case "function":
3999
+ default:
4000
+ return s;
4001
+ }
4002
+ }, []);
4003
+ if (r.length === t.length) {
4004
+ const s = r.filter((a, i, o) => o.indexOf(a) === i);
4005
+ return {
4006
+ type: s.length > 1 ? s : s[0],
4007
+ enum: t.reduce((a, i) => a.includes(i._def.value) ? a : [...a, i._def.value], [])
4008
+ };
4009
+ }
4010
+ } else if (t.every((r) => r._def.typeName === "ZodEnum"))
4011
+ return {
4012
+ type: "string",
4013
+ enum: t.reduce((r, s) => [
4014
+ ...r,
4015
+ ...s._def.values.filter((a) => !r.includes(a))
4016
+ ], [])
4017
+ };
4018
+ return At(n, e);
4019
+ }
4020
+ const At = (n, e) => {
4021
+ const t = (n.options instanceof Map ? Array.from(n.options.values()) : n.options).map((r, s) => x(r._def, {
4022
+ ...e,
4023
+ currentPath: [...e.currentPath, "anyOf", `${s}`]
4024
+ })).filter((r) => !!r && (!e.strictUnions || typeof r == "object" && Object.keys(r).length > 0));
4025
+ return t.length ? { anyOf: t } : void 0;
4026
+ };
4027
+ function pr(n, e) {
4028
+ if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(n.innerType._def.typeName) && (!n.innerType._def.checks || !n.innerType._def.checks.length))
4029
+ return e.target === "openApi3" ? {
4030
+ type: Ne[n.innerType._def.typeName],
4031
+ nullable: !0
4032
+ } : {
4033
+ type: [
4034
+ Ne[n.innerType._def.typeName],
4035
+ "null"
4036
+ ]
4037
+ };
4038
+ if (e.target === "openApi3") {
4039
+ const r = x(n.innerType._def, {
4040
+ ...e,
4041
+ currentPath: [...e.currentPath]
4042
+ });
4043
+ return r && "$ref" in r ? { allOf: [r], nullable: !0 } : r && { ...r, nullable: !0 };
4044
+ }
4045
+ const t = x(n.innerType._def, {
4046
+ ...e,
4047
+ currentPath: [...e.currentPath, "anyOf", "0"]
4048
+ });
4049
+ return t && { anyOf: [t, { type: "null" }] };
4050
+ }
4051
+ function mr(n, e) {
4052
+ const t = {
4053
+ type: "number"
4054
+ };
4055
+ if (!n.checks)
4056
+ return t;
4057
+ for (const r of n.checks)
4058
+ switch (r.kind) {
4059
+ case "int":
4060
+ t.type = "integer", Bt(t, "type", r.message, e);
4061
+ break;
4062
+ case "min":
4063
+ e.target === "jsonSchema7" ? r.inclusive ? A(t, "minimum", r.value, r.message, e) : A(t, "exclusiveMinimum", r.value, r.message, e) : (r.inclusive || (t.exclusiveMinimum = !0), A(t, "minimum", r.value, r.message, e));
4064
+ break;
4065
+ case "max":
4066
+ e.target === "jsonSchema7" ? r.inclusive ? A(t, "maximum", r.value, r.message, e) : A(t, "exclusiveMaximum", r.value, r.message, e) : (r.inclusive || (t.exclusiveMaximum = !0), A(t, "maximum", r.value, r.message, e));
4067
+ break;
4068
+ case "multipleOf":
4069
+ A(t, "multipleOf", r.value, r.message, e);
4070
+ break;
4071
+ }
4072
+ return t;
4073
+ }
4074
+ function yr(n, e) {
4075
+ const t = e.target === "openAi", r = {
4076
+ type: "object",
4077
+ properties: {}
4078
+ }, s = [], a = n.shape();
4079
+ for (const o in a) {
4080
+ let c = a[o];
4081
+ if (c === void 0 || c._def === void 0)
4082
+ continue;
4083
+ let u = vr(c);
4084
+ u && t && (c._def.typeName === "ZodOptional" && (c = c._def.innerType), c.isNullable() || (c = c.nullable()), u = !1);
4085
+ const y = x(c._def, {
4086
+ ...e,
4087
+ currentPath: [...e.currentPath, "properties", o],
4088
+ propertyPath: [...e.currentPath, "properties", o]
4089
+ });
4090
+ y !== void 0 && (r.properties[o] = y, u || s.push(o));
4091
+ }
4092
+ s.length && (r.required = s);
4093
+ const i = gr(n, e);
4094
+ return i !== void 0 && (r.additionalProperties = i), r;
4095
+ }
4096
+ function gr(n, e) {
4097
+ if (n.catchall._def.typeName !== "ZodNever")
4098
+ return x(n.catchall._def, {
4099
+ ...e,
4100
+ currentPath: [...e.currentPath, "additionalProperties"]
4101
+ });
4102
+ switch (n.unknownKeys) {
4103
+ case "passthrough":
4104
+ return e.allowedAdditionalProperties;
4105
+ case "strict":
4106
+ return e.rejectedAdditionalProperties;
4107
+ case "strip":
4108
+ return e.removeAdditionalStrategy === "strict" ? e.allowedAdditionalProperties : e.rejectedAdditionalProperties;
4109
+ }
4110
+ }
4111
+ function vr(n) {
4112
+ try {
4113
+ return n.isOptional();
4114
+ } catch (e) {
4115
+ return !0;
4116
+ }
4117
+ }
4118
+ const _r = (n, e) => {
4119
+ var r;
4120
+ if (e.currentPath.toString() === ((r = e.propertyPath) == null ? void 0 : r.toString()))
4121
+ return x(n.innerType._def, e);
4122
+ const t = x(n.innerType._def, {
4123
+ ...e,
4124
+ currentPath: [...e.currentPath, "anyOf", "1"]
4125
+ });
4126
+ return t ? {
4127
+ anyOf: [
4128
+ {
4129
+ not: M(e)
4130
+ },
4131
+ t
4132
+ ]
4133
+ } : M(e);
4134
+ }, br = (n, e) => {
4135
+ if (e.pipeStrategy === "input")
4136
+ return x(n.in._def, e);
4137
+ if (e.pipeStrategy === "output")
4138
+ return x(n.out._def, e);
4139
+ const t = x(n.in._def, {
4140
+ ...e,
4141
+ currentPath: [...e.currentPath, "allOf", "0"]
4142
+ }), r = x(n.out._def, {
4143
+ ...e,
4144
+ currentPath: [...e.currentPath, "allOf", t ? "1" : "0"]
4145
+ });
4146
+ return {
4147
+ allOf: [t, r].filter((s) => s !== void 0)
4148
+ };
4149
+ };
4150
+ function kr(n, e) {
4151
+ return x(n.type._def, e);
4152
+ }
4153
+ function xr(n, e) {
4154
+ const r = {
4155
+ type: "array",
4156
+ uniqueItems: !0,
4157
+ items: x(n.valueType._def, {
4158
+ ...e,
4159
+ currentPath: [...e.currentPath, "items"]
4160
+ })
4161
+ };
4162
+ return n.minSize && A(r, "minItems", n.minSize.value, n.minSize.message, e), n.maxSize && A(r, "maxItems", n.maxSize.value, n.maxSize.message, e), r;
4163
+ }
4164
+ function wr(n, e) {
4165
+ return n.rest ? {
4166
+ type: "array",
4167
+ minItems: n.items.length,
4168
+ items: n.items.map((t, r) => x(t._def, {
4169
+ ...e,
4170
+ currentPath: [...e.currentPath, "items", `${r}`]
4171
+ })).reduce((t, r) => r === void 0 ? t : [...t, r], []),
4172
+ additionalItems: x(n.rest._def, {
4173
+ ...e,
4174
+ currentPath: [...e.currentPath, "additionalItems"]
4175
+ })
4176
+ } : {
4177
+ type: "array",
4178
+ minItems: n.items.length,
4179
+ maxItems: n.items.length,
4180
+ items: n.items.map((t, r) => x(t._def, {
4181
+ ...e,
4182
+ currentPath: [...e.currentPath, "items", `${r}`]
4183
+ })).reduce((t, r) => r === void 0 ? t : [...t, r], [])
4184
+ };
4185
+ }
4186
+ function Sr(n) {
4187
+ return {
4188
+ not: M(n)
4189
+ };
4190
+ }
4191
+ function Ar(n) {
4192
+ return M(n);
4193
+ }
4194
+ const Tr = (n, e) => x(n.innerType._def, e), Cr = (n, e, t) => {
4195
+ switch (e) {
4196
+ case l.ZodString:
4197
+ return Ht(n, t);
4198
+ case l.ZodNumber:
4199
+ return mr(n, t);
4200
+ case l.ZodObject:
4201
+ return yr(n, t);
4202
+ case l.ZodBigInt:
4203
+ return Kn(n, t);
4204
+ case l.ZodBoolean:
4205
+ return Xn();
4206
+ case l.ZodDate:
4207
+ return Jt(n, t);
4208
+ case l.ZodUndefined:
4209
+ return Sr(t);
4210
+ case l.ZodNull:
4211
+ return fr(t);
4212
+ case l.ZodArray:
4213
+ return Yn(n, t);
4214
+ case l.ZodUnion:
4215
+ case l.ZodDiscriminatedUnion:
4216
+ return hr(n, t);
4217
+ case l.ZodIntersection:
4218
+ return ar(n, t);
4219
+ case l.ZodTuple:
4220
+ return wr(n, t);
4221
+ case l.ZodRecord:
4222
+ return Gt(n, t);
4223
+ case l.ZodLiteral:
4224
+ return ir(n, t);
4225
+ case l.ZodEnum:
4226
+ return rr(n);
4227
+ case l.ZodNativeEnum:
4228
+ return dr(n);
4229
+ case l.ZodNullable:
4230
+ return pr(n, t);
4231
+ case l.ZodOptional:
4232
+ return _r(n, t);
4233
+ case l.ZodMap:
4234
+ return ur(n, t);
4235
+ case l.ZodSet:
4236
+ return xr(n, t);
4237
+ case l.ZodLazy:
4238
+ return () => n.getter()._def;
4239
+ case l.ZodPromise:
4240
+ return kr(n, t);
4241
+ case l.ZodNaN:
4242
+ case l.ZodNever:
4243
+ return lr(t);
4244
+ case l.ZodEffects:
4245
+ return nr(n, t);
4246
+ case l.ZodAny:
4247
+ return M(t);
4248
+ case l.ZodUnknown:
4249
+ return Ar(t);
4250
+ case l.ZodDefault:
4251
+ return tr(n, t);
4252
+ case l.ZodBranded:
4253
+ return qt(n, t);
4254
+ case l.ZodReadonly:
4255
+ return Tr(n, t);
4256
+ case l.ZodCatch:
4257
+ return Qn(n, t);
4258
+ case l.ZodPipeline:
4259
+ return br(n, t);
4260
+ case l.ZodFunction:
4261
+ case l.ZodVoid:
4262
+ case l.ZodSymbol:
4263
+ return;
4264
+ default:
4265
+ return /* @__PURE__ */ ((r) => {
4266
+ })();
4267
+ }
4268
+ };
4269
+ function x(n, e, t = !1) {
4270
+ var o;
4271
+ const r = e.seen.get(n);
4272
+ if (e.override) {
4273
+ const c = (o = e.override) == null ? void 0 : o.call(e, n, e, r, t);
4274
+ if (c !== Jn)
4275
+ return c;
4276
+ }
4277
+ if (r && !t) {
4278
+ const c = Or(r, e);
4279
+ if (c !== void 0)
4280
+ return c;
4281
+ }
4282
+ const s = { def: n, path: e.currentPath, jsonSchema: void 0 };
4283
+ e.seen.set(n, s);
4284
+ const a = Cr(n, n.typeName, e), i = typeof a == "function" ? x(a(), e) : a;
4285
+ if (i && Nr(n, e, i), e.postProcess) {
4286
+ const c = e.postProcess(i, n, e);
4287
+ return s.jsonSchema = i, c;
4288
+ }
4289
+ return s.jsonSchema = i, i;
4290
+ }
4291
+ const Or = (n, e) => {
4292
+ switch (e.$refStrategy) {
4293
+ case "root":
4294
+ return { $ref: n.path.join("/") };
4295
+ case "relative":
4296
+ return { $ref: Wt(e.currentPath, n.path) };
4297
+ case "none":
4298
+ case "seen":
4299
+ return n.path.length < e.currentPath.length && n.path.every((t, r) => e.currentPath[r] === t) ? (console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`), M(e)) : e.$refStrategy === "seen" ? M(e) : void 0;
4300
+ }
4301
+ }, Nr = (n, e, t) => (n.description && (t.description = n.description, e.markdownDescription && (t.markdownDescription = n.description)), t), ze = (n, e) => {
4302
+ var c;
4303
+ const t = Gn(e);
4304
+ let r = typeof e == "object" && e.definitions ? Object.entries(e.definitions).reduce((u, [y, T]) => {
4305
+ var v;
4306
+ return {
4307
+ ...u,
4308
+ [y]: (v = x(T._def, {
4309
+ ...t,
4310
+ currentPath: [...t.basePath, t.definitionPath, y]
4311
+ }, !0)) != null ? v : M(t)
4312
+ };
4313
+ }, {}) : void 0;
4314
+ const s = typeof e == "string" ? e : (e == null ? void 0 : e.nameStrategy) === "title" || e == null ? void 0 : e.name, a = (c = x(n._def, s === void 0 ? t : {
4315
+ ...t,
4316
+ currentPath: [...t.basePath, t.definitionPath, s]
4317
+ }, !1)) != null ? c : M(t), i = typeof e == "object" && e.name !== void 0 && e.nameStrategy === "title" ? e.name : void 0;
4318
+ i !== void 0 && (a.title = i), t.flags.hasReferencedOpenAiAnyType && (r || (r = {}), r[t.openAiAnyTypeName] || (r[t.openAiAnyTypeName] = {
4319
+ // Skipping "object" as no properties can be defined and additionalProperties must be "false"
4320
+ type: ["string", "number", "integer", "boolean", "array", "null"],
4321
+ items: {
4322
+ $ref: t.$refStrategy === "relative" ? "1" : [
4323
+ ...t.basePath,
4324
+ t.definitionPath,
4325
+ t.openAiAnyTypeName
4326
+ ].join("/")
4327
+ }
4328
+ }));
4329
+ const o = s === void 0 ? r ? {
4330
+ ...a,
4331
+ [t.definitionPath]: r
4332
+ } : a : {
4333
+ $ref: [
4334
+ ...t.$refStrategy === "relative" ? [] : t.basePath,
4335
+ t.definitionPath,
4336
+ s
4337
+ ].join("/"),
4338
+ [t.definitionPath]: {
4339
+ ...r,
4340
+ [s]: a
4341
+ }
4342
+ };
4343
+ return t.target === "jsonSchema7" ? o.$schema = "http://json-schema.org/draft-07/schema#" : (t.target === "jsonSchema2019-09" || t.target === "openAi") && (o.$schema = "https://json-schema.org/draft/2019-09/schema#"), t.target === "openAi" && ("anyOf" in o || "oneOf" in o || "allOf" in o || "type" in o && Array.isArray(o.type)) && console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property."), o;
4344
+ };
4345
+ class Zr {
4346
+ /**
4347
+ * Creates a new message processor.
4348
+ *
4349
+ * @param catalogs A list of available catalogs.
4350
+ * @param actionHandler A global handler for actions from all surfaces.
4351
+ */
4352
+ constructor(e, t) {
4353
+ this.catalogs = e, this.actionHandler = t, this.model = new qn(), this.actionHandler && this.model.onAction.subscribe(this.actionHandler);
4354
+ }
4355
+ /**
4356
+ * Generates the a2uiClientCapabilities object for the current processor.
4357
+ *
4358
+ * @param options Configuration for capability generation.
4359
+ * @returns The capabilities object.
4360
+ */
4361
+ getClientCapabilities(e) {
4362
+ const t = {
4363
+ "v0.9": {
4364
+ supportedCatalogIds: this.catalogs.map((r) => r.id)
4365
+ }
4366
+ };
4367
+ return e != null && e.includeInlineCatalogs && (t["v0.9"].inlineCatalogs = this.catalogs.map((r) => this.generateInlineCatalog(r))), t;
4368
+ }
4369
+ generateInlineCatalog(e) {
4370
+ const t = {};
4371
+ for (const [a, i] of e.components.entries()) {
4372
+ const o = ze(i.schema, {
4373
+ target: "jsonSchema2019-09"
4374
+ });
4375
+ this.processRefs(o), t[a] = {
4376
+ allOf: [
4377
+ { $ref: "common_types.json#/$defs/ComponentCommon" },
4378
+ {
4379
+ properties: {
4380
+ component: { const: a },
4381
+ ...o.properties
4382
+ },
4383
+ required: ["component", ...o.required || []]
4384
+ }
4385
+ ]
4386
+ };
4387
+ }
4388
+ const r = [];
4389
+ for (const a of e.functions.values()) {
4390
+ const i = ze(a.schema, {
4391
+ target: "jsonSchema2019-09"
4392
+ });
4393
+ this.processRefs(i), r.push({
4394
+ name: a.name,
4395
+ description: a.schema.description,
4396
+ returnType: a.returnType,
4397
+ parameters: i
4398
+ });
4399
+ }
4400
+ let s;
4401
+ if (e.themeSchema) {
4402
+ const a = ze(e.themeSchema, {
4403
+ target: "jsonSchema2019-09"
4404
+ });
4405
+ this.processRefs(a), s = a.properties;
4406
+ }
4407
+ return {
4408
+ catalogId: e.id,
4409
+ components: t,
4410
+ functions: r.length > 0 ? r : void 0,
4411
+ theme: s
4412
+ };
4413
+ }
4414
+ processRefs(e) {
4415
+ if (!(typeof e != "object" || e === null)) {
4416
+ if (typeof e.description == "string" && e.description.startsWith("REF:")) {
4417
+ const t = e.description.substring(4).split("|"), r = t[0], s = t[1] || "";
4418
+ for (const a of Object.keys(e))
4419
+ delete e[a];
4420
+ e.$ref = r, s && (e.description = s);
4421
+ return;
4422
+ }
4423
+ if (Array.isArray(e))
4424
+ for (const t of e)
4425
+ this.processRefs(t);
4426
+ else
4427
+ for (const t of Object.keys(e))
4428
+ this.processRefs(e[t]);
4429
+ }
4430
+ }
4431
+ /**
4432
+ * Returns the aggregated data model for all surfaces that have 'sendDataModel' enabled.
4433
+ */
4434
+ getClientDataModel() {
4435
+ const e = {};
4436
+ for (const t of this.model.surfacesMap.values())
4437
+ t.sendDataModel && (e[t.id] = t.dataModel.get("/"));
4438
+ if (Object.keys(e).length !== 0)
4439
+ return {
4440
+ version: "v0.9",
4441
+ surfaces: e
4442
+ };
4443
+ }
4444
+ /**
4445
+ * Subscribes to surface creation events.
4446
+ */
4447
+ onSurfaceCreated(e) {
4448
+ return this.model.onSurfaceCreated.subscribe(e);
4449
+ }
4450
+ /**
4451
+ * Subscribes to surface deletion events.
4452
+ */
4453
+ onSurfaceDeleted(e) {
4454
+ return this.model.onSurfaceDeleted.subscribe(e);
4455
+ }
4456
+ /**
4457
+ * Processes a list of messages.
4458
+ *
4459
+ * @param messages The messages to process.
4460
+ */
4461
+ processMessages(e) {
4462
+ for (const t of e)
4463
+ this.processMessage(t);
4464
+ }
4465
+ processMessage(e) {
4466
+ const t = [
4467
+ "createSurface",
4468
+ "updateComponents",
4469
+ "updateDataModel",
4470
+ "deleteSurface"
4471
+ ].filter((r) => r in e);
4472
+ if (t.length > 1)
4473
+ throw new Re(`Message contains multiple update types: ${t.join(", ")}.`);
4474
+ if ("createSurface" in e) {
4475
+ this.processCreateSurfaceMessage(e);
4476
+ return;
4477
+ }
4478
+ if ("deleteSurface" in e) {
4479
+ this.processDeleteSurfaceMessage(e);
4480
+ return;
4481
+ }
4482
+ if ("updateComponents" in e) {
4483
+ this.processUpdateComponentsMessage(e);
4484
+ return;
4485
+ }
4486
+ if ("updateDataModel" in e) {
4487
+ this.processUpdateDataModelMessage(e);
4488
+ return;
4489
+ }
4490
+ }
4491
+ processCreateSurfaceMessage(e) {
4492
+ const t = e.createSurface, { surfaceId: r, catalogId: s, theme: a, sendDataModel: i } = t, o = this.catalogs.find((u) => u.id === s);
4493
+ if (!o)
4494
+ throw new he(`Catalog not found: ${s}`);
4495
+ if (this.model.getSurface(r))
4496
+ throw new he(`Surface ${r} already exists.`);
4497
+ const c = new Wn(r, o, a, i != null ? i : !1);
4498
+ this.model.addSurface(c);
4499
+ }
4500
+ processDeleteSurfaceMessage(e) {
4501
+ const t = e.deleteSurface;
4502
+ t.surfaceId && this.model.deleteSurface(t.surfaceId);
4503
+ }
4504
+ processUpdateComponentsMessage(e) {
4505
+ const t = e.updateComponents;
4506
+ if (!t.surfaceId)
4507
+ return;
4508
+ const r = this.model.getSurface(t.surfaceId);
4509
+ if (!r)
4510
+ throw new he(`Surface not found for message: ${t.surfaceId}`);
4511
+ for (const s of t.components) {
4512
+ const { id: a, component: i, ...o } = s;
4513
+ if (!a)
4514
+ throw new Re(`Component '${i}' is missing an 'id'.`);
4515
+ const c = r.componentsModel.get(a);
4516
+ if (c)
4517
+ if (i && i !== c.type) {
4518
+ r.componentsModel.removeComponent(a);
4519
+ const u = new xt(a, i, o);
4520
+ r.componentsModel.addComponent(u);
4521
+ } else
4522
+ c.properties = o;
4523
+ else {
4524
+ if (!i)
4525
+ throw new Re(`Cannot create component ${a} without a type.`);
4526
+ const u = new xt(a, i, o);
4527
+ r.componentsModel.addComponent(u);
4528
+ }
4529
+ }
4530
+ }
4531
+ processUpdateDataModelMessage(e) {
4532
+ const t = e.updateDataModel;
4533
+ if (!t.surfaceId)
4534
+ return;
4535
+ const r = this.model.getSurface(t.surfaceId);
4536
+ if (!r)
4537
+ throw new he(`Surface not found for message: ${t.surfaceId}`);
4538
+ const s = t.path || "/", a = t.value;
4539
+ r.dataModel.set(s, a);
4540
+ }
4541
+ /**
4542
+ * Resolves a relative path against a context path.
4543
+ *
4544
+ * @param path The path to resolve.
4545
+ * @param contextPath The base path (optional).
4546
+ */
4547
+ resolvePath(e, t) {
4548
+ return e.startsWith("/") ? e : t ? `${t.endsWith("/") ? t : `${t}/`}${e}` : `/${e}`;
4549
+ }
4550
+ }
4551
+ function Pr(n) {
4552
+ const e = new Zr(n.catalogs, n.onAction), t = vue.shallowRef(/* @__PURE__ */ new Map());
4553
+ let r = 0;
4554
+ function s(o) {
4555
+ if (o.length <= r)
4556
+ return;
4557
+ const c = o.slice(r);
4558
+ try {
4559
+ e.processMessages(c);
4560
+ } catch (u) {
4561
+ return;
4562
+ }
4563
+ r = o.length, t.value = new Map(e.model.surfacesMap);
4564
+ }
4565
+ function a() {
4566
+ e.model.dispose(), r = 0, t.value = /* @__PURE__ */ new Map();
4567
+ }
4568
+ function i() {
4569
+ e.model.dispose();
4570
+ }
4571
+ return vue.onUnmounted(i), { processor: e, surfaces: t, processMessages: s, reset: a, dispose: i };
4572
+ }
4573
+ function jr(n) {
4574
+ switch (n) {
4575
+ case "string":
4576
+ return D();
4577
+ case "number":
4578
+ return _t();
4579
+ case "integer":
4580
+ return _t().int();
4581
+ case "boolean":
4582
+ return In();
4583
+ case "null":
4584
+ return Mn();
4585
+ case "array":
4586
+ return Et(ne());
4587
+ case "object":
4588
+ return ct(ne());
4589
+ default:
4590
+ return ne();
4591
+ }
4592
+ }
4593
+ function Ve(n, e) {
4594
+ let t = n;
4595
+ if (e.enum && e.enum.length > 0) {
4596
+ const r = e.enum.map((s) => Pe(s));
4597
+ return r.length === 1 ? r[0] : Ze([r[0], r[1], ...r.slice(2)]);
4598
+ }
4599
+ return e.type === "string" && (typeof e.minLength == "number" && (t = t.min(e.minLength)), typeof e.maxLength == "number" && (t = t.max(e.maxLength))), (e.type === "number" || e.type === "integer") && (typeof e.minimum == "number" && (t = t.min(e.minimum)), typeof e.maximum == "number" && (t = t.max(e.maximum))), Object.prototype.hasOwnProperty.call(e, "default") && (t = t.default(e.default)), t;
4600
+ }
4601
+ function pe(n) {
4602
+ var r, s;
4603
+ if (!n)
4604
+ return ne();
4605
+ const e = n.type;
4606
+ if (Array.isArray(e) && e.length > 0) {
4607
+ const i = Array.from(new Set(e)).map((o) => pe({ ...n, type: o }));
4608
+ return i.length === 1 ? i[0] : Ze(i);
4609
+ }
4610
+ if (e === "array") {
4611
+ const a = pe(n.items);
4612
+ return Ve(Et(a), n);
4613
+ }
4614
+ if (e === "object" || n.properties) {
4615
+ const a = new Set((r = n.required) != null ? r : []), i = Object.entries((s = n.properties) != null ? s : {}).reduce((c, [u, y]) => {
4616
+ const T = pe(y);
4617
+ return c[u] = a.has(u) ? T : T.optional(), c;
4618
+ }, {});
4619
+ let o = B(i);
4620
+ return n.additionalProperties === !0 ? o = o.catchall(ne()) : n.additionalProperties && typeof n.additionalProperties == "object" && (o = o.catchall(pe(n.additionalProperties))), Ve(o, n);
4621
+ }
4622
+ return Ve(jr(typeof e == "string" ? e : "object"), n);
4623
+ }
4624
+ function Ir(n, e) {
4625
+ var r;
4626
+ const t = pe({
4627
+ type: (r = e.type) != null ? r : "object",
4628
+ properties: e.properties,
4629
+ required: e.required,
4630
+ additionalProperties: e.additionalProperties
4631
+ });
4632
+ return {
4633
+ name: n,
4634
+ schema: t
4635
+ };
4636
+ }
4637
+ function Mr(n) {
4638
+ const e = Object.entries(n.components).map(([t, r]) => Ir(t, r));
4639
+ return new En(n.catalogId, e);
4640
+ }
4641
+ const Er = /* @__PURE__ */ vue.defineComponent({
4642
+ __name: "ComponentNode",
4643
+ props: {
4644
+ componentModel: {},
4645
+ surface: {},
4646
+ components: {},
4647
+ componentEvents: {},
4648
+ componentPropAllowlist: {}
4649
+ },
4650
+ setup(n) {
4651
+ const e = n, t = vue.computed(() => {
4652
+ const v = e.components[e.componentModel.type];
4653
+ return v != null ? v : e.componentModel.type;
4654
+ }), r = vue.shallowRef({});
4655
+ let s = [];
4656
+ function a() {
4657
+ s.forEach((v) => v.unsubscribe()), s = [];
4658
+ }
4659
+ function i(v, w) {
4660
+ if (w && typeof w == "object" && !Array.isArray(w) && "path" in w) {
4661
+ const I = w.path, m = w.default;
4662
+ if (typeof I == "string") {
4663
+ const O = I.startsWith("/") ? I : `/${I}`, N = e.surface.dataModel.subscribe(O, (U) => {
4664
+ r.value = {
4665
+ ...r.value,
4666
+ [v]: U === void 0 ? m : U
4667
+ };
4668
+ });
4669
+ return s.push(N), N.value === void 0 ? m : N.value;
4670
+ }
4671
+ }
4672
+ return w;
4673
+ }
4674
+ function o() {
4675
+ a();
4676
+ const v = { ...e.componentModel.properties };
4677
+ delete v.children;
4678
+ const w = e.componentPropAllowlist[e.componentModel.type], I = w && w.length > 0 ? new Set(w) : void 0, m = I ? Object.fromEntries(Object.entries(v).filter(([N]) => I.has(N))) : v, O = Object.fromEntries(Object.entries(m).map(([N, U]) => [N, i(N, U)]));
4679
+ r.value = O;
4680
+ }
4681
+ let c;
4682
+ vue.onMounted(() => {
4683
+ o(), c = e.componentModel.onUpdated.subscribe(() => {
4684
+ o();
4685
+ }).unsubscribe;
4686
+ }), vue.onUnmounted(() => {
4687
+ c == null || c(), a();
4688
+ });
4689
+ const u = vue.computed(() => {
4690
+ var w;
4691
+ const v = (w = e.componentModel.properties) == null ? void 0 : w.children;
4692
+ return v ? Array.isArray(v) ? v : typeof v == "string" ? [v] : [] : [];
4693
+ });
4694
+ function y(v) {
4695
+ return e.surface.componentsModel.get(v);
4696
+ }
4697
+ const T = vue.computed(() => {
4698
+ var I;
4699
+ const v = {}, w = (I = e.componentEvents[e.componentModel.type]) != null ? I : [];
4700
+ for (const m of w)
4701
+ v[m] = (...O) => {
4702
+ e.surface.dispatchAction(
4703
+ {
4704
+ event: {
4705
+ name: m,
4706
+ context: {
4707
+ ...r.value,
4708
+ value: O[0],
4709
+ args: O
4710
+ }
4711
+ }
4712
+ },
4713
+ e.componentModel.id
4714
+ );
4715
+ };
4716
+ return v;
4717
+ });
4718
+ return (v, w) => {
4719
+ const I = vue.resolveComponent("ComponentNode", !0);
4720
+ return t.value ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(t.value), vue.mergeProps({ key: 0 }, r.value, vue.toHandlers(T.value)), {
4721
+ default: vue.withCtx(() => [
4722
+ (vue.openBlock(!0), vue.createElementBlock(vue.Fragment, null, vue.renderList(u.value, (m) => (vue.openBlock(), vue.createBlock(I, {
4723
+ key: m,
4724
+ "component-model": y(m),
4725
+ surface: v.surface,
4726
+ components: v.components,
4727
+ "component-events": v.componentEvents,
4728
+ "component-prop-allowlist": v.componentPropAllowlist
4729
+ }, null, 8, ["component-model", "surface", "components", "component-events", "component-prop-allowlist"]))), 128))
4730
+ ]),
4731
+ _: 1
4732
+ }, 16)) : vue.createCommentVNode("", !0);
4733
+ };
4734
+ }
4735
+ }), Rr = /* @__PURE__ */ vue.defineComponent({
4736
+ __name: "A2UISurface",
4737
+ props: {
4738
+ messages: {},
4739
+ surfaceId: {},
4740
+ components: { default: () => ({}) },
4741
+ catalog: { default: () => ({
4742
+ catalogId: "touchvue-a2ui-default",
4743
+ components: {}
4744
+ }) }
4745
+ },
4746
+ emits: ["action"],
4747
+ setup(n, { emit: e }) {
4748
+ const t = n;
4749
+ function r(m, O) {
4750
+ var ee, _e, X, Me, be, dt, lt, ft, ht, pt;
4751
+ const N = (Me = (X = (ee = m == null ? void 0 : m.name) != null ? ee : m == null ? void 0 : m.action) != null ? X : (_e = m == null ? void 0 : m.event) == null ? void 0 : _e.name) != null ? Me : "unknown", U = (lt = (dt = (be = m == null ? void 0 : m.sourceComponentId) != null ? be : m == null ? void 0 : m.componentId) != null ? dt : m == null ? void 0 : m.targetComponentId) != null ? lt : "", ve = (pt = (ht = m == null ? void 0 : m.context) != null ? ht : (ft = m == null ? void 0 : m.event) == null ? void 0 : ft.context) != null ? pt : {};
4752
+ return {
4753
+ name: N,
4754
+ surfaceId: O,
4755
+ sourceComponentId: U,
4756
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
4757
+ context: ve
4758
+ };
4759
+ }
4760
+ const s = e, a = vue.computed(() => Mr(t.catalog)), i = vue.computed(() => {
4761
+ const m = {};
4762
+ for (const [O, N] of Object.entries(t.catalog.components))
4763
+ m[O] = c(N.events);
4764
+ return console.log(m), m;
4765
+ }), o = vue.computed(() => {
4766
+ var O;
4767
+ const m = {};
4768
+ for (const [N, U] of Object.entries(t.catalog.components))
4769
+ m[N] = Object.keys((O = U.properties) != null ? O : {});
4770
+ return m;
4771
+ });
4772
+ function c(m) {
4773
+ return m ? Array.isArray(m) ? m : Object.keys(m) : [];
4774
+ }
4775
+ const { surfaces: u, processMessages: y } = Pr({
4776
+ catalogs: [a.value],
4777
+ onAction: (m) => {
4778
+ s("action", r(m, t.surfaceId));
4779
+ }
4780
+ }), T = vue.ref(0);
4781
+ vue.watch(
4782
+ () => t.messages.length,
4783
+ () => {
4784
+ y(t.messages), T.value++;
4785
+ },
4786
+ { immediate: !0 }
4787
+ );
4788
+ const v = vue.computed(() => u.value.get(t.surfaceId)), w = vue.computed(() => {
4789
+ var ve;
4790
+ T.value;
4791
+ const m = v.value;
4792
+ if (!m)
4793
+ return [];
4794
+ const O = /* @__PURE__ */ new Set(), N = /* @__PURE__ */ new Set();
4795
+ for (const [ee, _e] of m.componentsModel.entries) {
4796
+ O.add(ee);
4797
+ const X = (ve = _e.properties) == null ? void 0 : ve.children;
4798
+ X && (Array.isArray(X) ? X : [X]).forEach((be) => N.add(be));
4799
+ }
4800
+ return Array.from(O).filter((ee) => !N.has(ee));
4801
+ });
4802
+ function I(m) {
4803
+ var O;
4804
+ return (O = v.value) == null ? void 0 : O.componentsModel.get(m);
4805
+ }
4806
+ return (m, O) => (vue.openBlock(!0), vue.createElementBlock(vue.Fragment, null, vue.renderList(w.value, (N) => (vue.openBlock(), vue.createBlock(Er, {
4807
+ key: N,
4808
+ "component-model": I(N),
4809
+ surface: v.value,
4810
+ components: t.components,
4811
+ "component-events": i.value,
4812
+ "component-prop-allowlist": o.value
4813
+ }, null, 8, ["component-model", "surface", "components", "component-events", "component-prop-allowlist"]))), 128));
4814
+ }
4815
+ });
4816
+
4817
+ exports.TouchA2ui = Rr;
4818
+ exports.useA2UI = Pr;
4819
+ //# sourceMappingURL=index.js.map