@usetheo/ui 0.9.0-next.0 → 0.11.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (502) hide show
  1. package/CHANGELOG.md +215 -0
  2. package/README.md +22 -21
  3. package/dist/chunk-2UJROWAG.js +106 -0
  4. package/dist/chunk-2UJROWAG.js.map +1 -0
  5. package/dist/chunk-2XPWOUEH.js +68 -0
  6. package/dist/chunk-2XPWOUEH.js.map +1 -0
  7. package/dist/chunk-3GHLNCM3.js +42 -0
  8. package/dist/chunk-3GHLNCM3.js.map +1 -0
  9. package/dist/chunk-3HOXC25T.js +48 -0
  10. package/dist/chunk-3HOXC25T.js.map +1 -0
  11. package/dist/chunk-3QGO5SB3.js +46 -0
  12. package/dist/chunk-3QGO5SB3.js.map +1 -0
  13. package/dist/chunk-47QJVWW2.js +85 -0
  14. package/dist/chunk-47QJVWW2.js.map +1 -0
  15. package/dist/chunk-4L63UW3I.js +35 -0
  16. package/dist/chunk-4L63UW3I.js.map +1 -0
  17. package/dist/chunk-4UUSJJFZ.js +25 -0
  18. package/dist/chunk-4UUSJJFZ.js.map +1 -0
  19. package/dist/chunk-4ZBZBRG5.js +127 -0
  20. package/dist/chunk-4ZBZBRG5.js.map +1 -0
  21. package/dist/chunk-57NXT3OX.js +92 -0
  22. package/dist/chunk-57NXT3OX.js.map +1 -0
  23. package/dist/chunk-5FF5EUZP.js +44 -0
  24. package/dist/chunk-5FF5EUZP.js.map +1 -0
  25. package/dist/chunk-5UGQXB2P.js +714 -0
  26. package/dist/chunk-5UGQXB2P.js.map +1 -0
  27. package/dist/chunk-62FT22CI.js +85 -0
  28. package/dist/chunk-62FT22CI.js.map +1 -0
  29. package/dist/chunk-673R3GSK.js +19 -0
  30. package/dist/chunk-673R3GSK.js.map +1 -0
  31. package/dist/chunk-6VINZJBV.js +128 -0
  32. package/dist/chunk-6VINZJBV.js.map +1 -0
  33. package/dist/chunk-74NZ5U3E.js +145 -0
  34. package/dist/chunk-74NZ5U3E.js.map +1 -0
  35. package/dist/chunk-755NWSNW.js +36 -0
  36. package/dist/chunk-755NWSNW.js.map +1 -0
  37. package/dist/chunk-7GLBWWMW.js +70 -0
  38. package/dist/chunk-7GLBWWMW.js.map +1 -0
  39. package/dist/chunk-7RXYW5VM.js +88 -0
  40. package/dist/chunk-7RXYW5VM.js.map +1 -0
  41. package/dist/chunk-AC4MGCXI.js +92 -0
  42. package/dist/chunk-AC4MGCXI.js.map +1 -0
  43. package/dist/chunk-AEVSVDT6.js +67 -0
  44. package/dist/chunk-AEVSVDT6.js.map +1 -0
  45. package/dist/chunk-AODIMN2N.js +68 -0
  46. package/dist/chunk-AODIMN2N.js.map +1 -0
  47. package/dist/chunk-ATHOPBCA.js +61 -0
  48. package/dist/chunk-ATHOPBCA.js.map +1 -0
  49. package/dist/chunk-AXKBNRZW.js +173 -0
  50. package/dist/chunk-AXKBNRZW.js.map +1 -0
  51. package/dist/chunk-B75MEYNR.js +106 -0
  52. package/dist/chunk-B75MEYNR.js.map +1 -0
  53. package/dist/chunk-BGKA6DI6.js +34 -0
  54. package/dist/chunk-BGKA6DI6.js.map +1 -0
  55. package/dist/chunk-BNQAJGEN.js +88 -0
  56. package/dist/chunk-BNQAJGEN.js.map +1 -0
  57. package/dist/chunk-BP2SETUC.js +101 -0
  58. package/dist/chunk-BP2SETUC.js.map +1 -0
  59. package/dist/chunk-BPUQWMBD.js +79 -0
  60. package/dist/chunk-BPUQWMBD.js.map +1 -0
  61. package/dist/chunk-BVDASR3Y.js +74 -0
  62. package/dist/chunk-BVDASR3Y.js.map +1 -0
  63. package/dist/chunk-BX7A5GUV.js +78 -0
  64. package/dist/chunk-BX7A5GUV.js.map +1 -0
  65. package/dist/chunk-CDA6RYOX.js +115 -0
  66. package/dist/chunk-CDA6RYOX.js.map +1 -0
  67. package/dist/chunk-CG7O3A42.js +80 -0
  68. package/dist/chunk-CG7O3A42.js.map +1 -0
  69. package/dist/chunk-CIYGNPKT.js +76 -0
  70. package/dist/chunk-CIYGNPKT.js.map +1 -0
  71. package/dist/chunk-CKXY4FTV.js +59 -0
  72. package/dist/chunk-CKXY4FTV.js.map +1 -0
  73. package/dist/chunk-CVOKZITR.js +82 -0
  74. package/dist/chunk-CVOKZITR.js.map +1 -0
  75. package/dist/chunk-CWFMFKDI.js +82 -0
  76. package/dist/chunk-CWFMFKDI.js.map +1 -0
  77. package/dist/chunk-CWVKSV7S.js +124 -0
  78. package/dist/chunk-CWVKSV7S.js.map +1 -0
  79. package/dist/chunk-CYOLRWOX.js +63 -0
  80. package/dist/chunk-CYOLRWOX.js.map +1 -0
  81. package/dist/chunk-D23LRJT6.js +116 -0
  82. package/dist/chunk-D23LRJT6.js.map +1 -0
  83. package/dist/chunk-DFADMEJK.js +127 -0
  84. package/dist/chunk-DFADMEJK.js.map +1 -0
  85. package/dist/chunk-DKQAHZG2.js +83 -0
  86. package/dist/chunk-DKQAHZG2.js.map +1 -0
  87. package/dist/chunk-E5A7HN6H.js +32 -0
  88. package/dist/chunk-E5A7HN6H.js.map +1 -0
  89. package/dist/chunk-EI63GTN7.js +57 -0
  90. package/dist/chunk-EI63GTN7.js.map +1 -0
  91. package/dist/chunk-EP25QJ4N.js +146 -0
  92. package/dist/chunk-EP25QJ4N.js.map +1 -0
  93. package/dist/chunk-ET44426Q.js +80 -0
  94. package/dist/chunk-ET44426Q.js.map +1 -0
  95. package/dist/chunk-ETEIDY34.js +67 -0
  96. package/dist/chunk-ETEIDY34.js.map +1 -0
  97. package/dist/chunk-EU55O4P7.js +76 -0
  98. package/dist/chunk-EU55O4P7.js.map +1 -0
  99. package/dist/chunk-F436537E.js +104 -0
  100. package/dist/chunk-F436537E.js.map +1 -0
  101. package/dist/chunk-FLBTGNQI.js +86 -0
  102. package/dist/chunk-FLBTGNQI.js.map +1 -0
  103. package/dist/chunk-FUT45NFW.js +46 -0
  104. package/dist/chunk-FUT45NFW.js.map +1 -0
  105. package/dist/chunk-G3LWNTVZ.js +51 -0
  106. package/dist/chunk-G3LWNTVZ.js.map +1 -0
  107. package/dist/chunk-GBJB5WLT.js +58 -0
  108. package/dist/chunk-GBJB5WLT.js.map +1 -0
  109. package/dist/chunk-GIEPEFRX.js +110 -0
  110. package/dist/chunk-GIEPEFRX.js.map +1 -0
  111. package/dist/chunk-GSO7MISR.js +58 -0
  112. package/dist/chunk-GSO7MISR.js.map +1 -0
  113. package/dist/chunk-GUQFYUIC.js +61 -0
  114. package/dist/chunk-GUQFYUIC.js.map +1 -0
  115. package/dist/chunk-H3VJMFJQ.js +35 -0
  116. package/dist/chunk-H3VJMFJQ.js.map +1 -0
  117. package/dist/chunk-HG4WEERE.js +26 -0
  118. package/dist/chunk-HG4WEERE.js.map +1 -0
  119. package/dist/chunk-HGPBGLNP.js +51 -0
  120. package/dist/chunk-HGPBGLNP.js.map +1 -0
  121. package/dist/chunk-HQFTW7SF.js +141 -0
  122. package/dist/chunk-HQFTW7SF.js.map +1 -0
  123. package/dist/chunk-I7WYM63C.js +170 -0
  124. package/dist/chunk-I7WYM63C.js.map +1 -0
  125. package/dist/chunk-IPEYGWA7.js +186 -0
  126. package/dist/chunk-IPEYGWA7.js.map +1 -0
  127. package/dist/chunk-IWSLOBYG.js +199 -0
  128. package/dist/chunk-IWSLOBYG.js.map +1 -0
  129. package/dist/chunk-JQXLPVWP.js +74 -0
  130. package/dist/chunk-JQXLPVWP.js.map +1 -0
  131. package/dist/chunk-K5ARID4S.js +26 -0
  132. package/dist/chunk-K5ARID4S.js.map +1 -0
  133. package/dist/chunk-K6RTLPIJ.js +41 -0
  134. package/dist/chunk-K6RTLPIJ.js.map +1 -0
  135. package/dist/chunk-KQNKKV2C.js +56 -0
  136. package/dist/chunk-KQNKKV2C.js.map +1 -0
  137. package/dist/chunk-KRN4NE4U.js +155 -0
  138. package/dist/chunk-KRN4NE4U.js.map +1 -0
  139. package/dist/chunk-L2BI762I.js +82 -0
  140. package/dist/chunk-L2BI762I.js.map +1 -0
  141. package/dist/chunk-LEEH63B2.js +56 -0
  142. package/dist/chunk-LEEH63B2.js.map +1 -0
  143. package/dist/chunk-LHRWVM3G.js +42 -0
  144. package/dist/chunk-LHRWVM3G.js.map +1 -0
  145. package/dist/chunk-LIGWMGXM.js +117 -0
  146. package/dist/chunk-LIGWMGXM.js.map +1 -0
  147. package/dist/chunk-LKYSX3QF.js +104 -0
  148. package/dist/chunk-LKYSX3QF.js.map +1 -0
  149. package/dist/chunk-MCIFB6VS.js +54 -0
  150. package/dist/chunk-MCIFB6VS.js.map +1 -0
  151. package/dist/chunk-MI5CXMZU.js +171 -0
  152. package/dist/chunk-MI5CXMZU.js.map +1 -0
  153. package/dist/chunk-NQZYY4LR.js +84 -0
  154. package/dist/chunk-NQZYY4LR.js.map +1 -0
  155. package/dist/chunk-O23LKHUR.js +66 -0
  156. package/dist/chunk-O23LKHUR.js.map +1 -0
  157. package/dist/chunk-PASI2U2R.js +23 -0
  158. package/dist/chunk-PASI2U2R.js.map +1 -0
  159. package/dist/chunk-PPH5NTHV.js +34 -0
  160. package/dist/chunk-PPH5NTHV.js.map +1 -0
  161. package/dist/chunk-PR6OZF6D.js +28 -0
  162. package/dist/chunk-PR6OZF6D.js.map +1 -0
  163. package/dist/chunk-PWXOXPFT.js +142 -0
  164. package/dist/chunk-PWXOXPFT.js.map +1 -0
  165. package/dist/chunk-QB6BNHO3.js +112 -0
  166. package/dist/chunk-QB6BNHO3.js.map +1 -0
  167. package/dist/chunk-QJGGTIUN.js +110 -0
  168. package/dist/chunk-QJGGTIUN.js.map +1 -0
  169. package/dist/chunk-QSOIJ6J3.js +91 -0
  170. package/dist/chunk-QSOIJ6J3.js.map +1 -0
  171. package/dist/chunk-R2PAGRDP.js +152 -0
  172. package/dist/chunk-R2PAGRDP.js.map +1 -0
  173. package/dist/chunk-R63ZKLQM.js +45 -0
  174. package/dist/chunk-R63ZKLQM.js.map +1 -0
  175. package/dist/chunk-RTYYJPPE.js +77 -0
  176. package/dist/chunk-RTYYJPPE.js.map +1 -0
  177. package/dist/chunk-RVOBP7PO.js +116 -0
  178. package/dist/chunk-RVOBP7PO.js.map +1 -0
  179. package/dist/chunk-SF6R5VMQ.js +97 -0
  180. package/dist/chunk-SF6R5VMQ.js.map +1 -0
  181. package/dist/chunk-SP4CP5HY.js +57 -0
  182. package/dist/chunk-SP4CP5HY.js.map +1 -0
  183. package/dist/chunk-SWJ4EUOI.js +30 -0
  184. package/dist/chunk-SWJ4EUOI.js.map +1 -0
  185. package/dist/chunk-TK24HQJJ.js +128 -0
  186. package/dist/chunk-TK24HQJJ.js.map +1 -0
  187. package/dist/chunk-TNBJ36XJ.js +156 -0
  188. package/dist/chunk-TNBJ36XJ.js.map +1 -0
  189. package/dist/chunk-TO3UAT6O.js +221 -0
  190. package/dist/chunk-TO3UAT6O.js.map +1 -0
  191. package/dist/chunk-UAYOOTRR.js +77 -0
  192. package/dist/chunk-UAYOOTRR.js.map +1 -0
  193. package/dist/chunk-UDTAMHXW.js +55 -0
  194. package/dist/chunk-UDTAMHXW.js.map +1 -0
  195. package/dist/chunk-UGKI466V.js +12 -0
  196. package/dist/chunk-UGKI466V.js.map +1 -0
  197. package/dist/chunk-UOXU7NDY.js +120 -0
  198. package/dist/chunk-UOXU7NDY.js.map +1 -0
  199. package/dist/chunk-V7OOTVK3.js +106 -0
  200. package/dist/chunk-V7OOTVK3.js.map +1 -0
  201. package/dist/chunk-VI5M7KJ2.js +1022 -0
  202. package/dist/chunk-VI5M7KJ2.js.map +1 -0
  203. package/dist/chunk-VM4RMQQN.js +11 -0
  204. package/dist/chunk-VM4RMQQN.js.map +1 -0
  205. package/dist/chunk-VMMATOPE.js +64 -0
  206. package/dist/chunk-VMMATOPE.js.map +1 -0
  207. package/dist/chunk-W2PVSIW3.js +89 -0
  208. package/dist/chunk-W2PVSIW3.js.map +1 -0
  209. package/dist/chunk-W3DUDZDU.js +88 -0
  210. package/dist/chunk-W3DUDZDU.js.map +1 -0
  211. package/dist/chunk-WKEUU2FU.js +114 -0
  212. package/dist/chunk-WKEUU2FU.js.map +1 -0
  213. package/dist/chunk-WKLW7RC6.js +28 -0
  214. package/dist/chunk-WKLW7RC6.js.map +1 -0
  215. package/dist/chunk-WSJGZNUH.js +111 -0
  216. package/dist/chunk-WSJGZNUH.js.map +1 -0
  217. package/dist/chunk-WVPDQMC2.js +144 -0
  218. package/dist/chunk-WVPDQMC2.js.map +1 -0
  219. package/dist/chunk-WWNH5ENT.js +43 -0
  220. package/dist/chunk-WWNH5ENT.js.map +1 -0
  221. package/dist/chunk-X5L62PXY.js +112 -0
  222. package/dist/chunk-X5L62PXY.js.map +1 -0
  223. package/dist/chunk-XGCV5E6W.js +133 -0
  224. package/dist/chunk-XGCV5E6W.js.map +1 -0
  225. package/dist/chunk-XRKIEL5M.js +72 -0
  226. package/dist/chunk-XRKIEL5M.js.map +1 -0
  227. package/dist/chunk-XUJYEADU.js +80 -0
  228. package/dist/chunk-XUJYEADU.js.map +1 -0
  229. package/dist/chunk-XVYNSIQC.js +116 -0
  230. package/dist/chunk-XVYNSIQC.js.map +1 -0
  231. package/dist/chunk-XWTISHXO.js +54 -0
  232. package/dist/chunk-XWTISHXO.js.map +1 -0
  233. package/dist/chunk-YOGHS4UU.js +202 -0
  234. package/dist/chunk-YOGHS4UU.js.map +1 -0
  235. package/dist/chunk-YRSKXEOD.js +135 -0
  236. package/dist/chunk-YRSKXEOD.js.map +1 -0
  237. package/dist/chunk-ZALLCR7X.js +108 -0
  238. package/dist/chunk-ZALLCR7X.js.map +1 -0
  239. package/dist/chunk-ZDAOHMCW.js +46 -0
  240. package/dist/chunk-ZDAOHMCW.js.map +1 -0
  241. package/dist/chunk-ZESICCKK.js +37 -0
  242. package/dist/chunk-ZESICCKK.js.map +1 -0
  243. package/dist/chunk-ZIKFOD6N.js +87 -0
  244. package/dist/chunk-ZIKFOD6N.js.map +1 -0
  245. package/dist/chunk-ZJRWCQEN.js +76 -0
  246. package/dist/chunk-ZJRWCQEN.js.map +1 -0
  247. package/dist/chunk-ZSRJCIWF.js +24 -0
  248. package/dist/chunk-ZSRJCIWF.js.map +1 -0
  249. package/dist/chunk-ZXPDS6DH.js +3 -0
  250. package/dist/chunk-ZXPDS6DH.js.map +1 -0
  251. package/dist/components.css +1 -1
  252. package/dist/composites/account-menu/index.js +6 -0
  253. package/dist/composites/account-menu/index.js.map +1 -0
  254. package/dist/composites/agent-composer/index.js +7 -0
  255. package/dist/composites/agent-composer/index.js.map +1 -0
  256. package/dist/composites/agent-editor/index.js +10 -0
  257. package/dist/composites/agent-editor/index.js.map +1 -0
  258. package/dist/composites/agent-stream/index.js +12 -0
  259. package/dist/composites/agent-stream/index.js.map +1 -0
  260. package/dist/composites/agent-timeline/index.js +5 -0
  261. package/dist/composites/agent-timeline/index.js.map +1 -0
  262. package/dist/composites/approval-card/index.js +5 -0
  263. package/dist/composites/approval-card/index.js.map +1 -0
  264. package/dist/composites/chat-composer/index.js +6 -0
  265. package/dist/composites/chat-composer/index.js.map +1 -0
  266. package/dist/composites/chat-message/index.js +6 -0
  267. package/dist/composites/chat-message/index.js.map +1 -0
  268. package/dist/composites/code-block/index.js +5 -0
  269. package/dist/composites/code-block/index.js.map +1 -0
  270. package/dist/composites/command-palette/index.js +5 -0
  271. package/dist/composites/command-palette/index.js.map +1 -0
  272. package/dist/composites/confirm-dialog/index.js +7 -0
  273. package/dist/composites/confirm-dialog/index.js.map +1 -0
  274. package/dist/composites/cron-jobs-list/index.js +5 -0
  275. package/dist/composites/cron-jobs-list/index.js.map +1 -0
  276. package/dist/composites/data-table/index.js +10 -0
  277. package/dist/composites/data-table/index.js.map +1 -0
  278. package/dist/composites/deployment-row/index.js +5 -0
  279. package/dist/composites/deployment-row/index.js.map +1 -0
  280. package/dist/composites/domain-config/index.js +7 -0
  281. package/dist/composites/domain-config/index.js.map +1 -0
  282. package/dist/composites/env-var-editor/index.js +7 -0
  283. package/dist/composites/env-var-editor/index.js.map +1 -0
  284. package/dist/composites/mcp-server-list/index.js +5 -0
  285. package/dist/composites/mcp-server-list/index.js.map +1 -0
  286. package/dist/composites/page-shell/index.js +7 -0
  287. package/dist/composites/page-shell/index.js.map +1 -0
  288. package/dist/composites/permission-modal/index.js +6 -0
  289. package/dist/composites/permission-modal/index.js.map +1 -0
  290. package/dist/composites/preview-env-card/index.js +6 -0
  291. package/dist/composites/preview-env-card/index.js.map +1 -0
  292. package/dist/composites/preview-panel/index.js +5 -0
  293. package/dist/composites/preview-panel/index.js.map +1 -0
  294. package/dist/composites/project-card/index.js +6 -0
  295. package/dist/composites/project-card/index.js.map +1 -0
  296. package/dist/composites/rollback-ui/index.js +6 -0
  297. package/dist/composites/rollback-ui/index.js.map +1 -0
  298. package/dist/composites/rule-editor/index.js +11 -0
  299. package/dist/composites/rule-editor/index.js.map +1 -0
  300. package/dist/composites/skill-editor/index.js +11 -0
  301. package/dist/composites/skill-editor/index.js.map +1 -0
  302. package/dist/composites/skills-list/index.js +5 -0
  303. package/dist/composites/skills-list/index.js.map +1 -0
  304. package/dist/composites/task-header/index.js +5 -0
  305. package/dist/composites/task-header/index.js.map +1 -0
  306. package/dist/composites/usage-meter/index.js +5 -0
  307. package/dist/composites/usage-meter/index.js.map +1 -0
  308. package/dist/index.d.ts +281 -12
  309. package/dist/index.js +129 -9487
  310. package/dist/index.js.map +1 -1
  311. package/dist/primitives/action-bar/index.js +4 -0
  312. package/dist/primitives/action-bar/index.js.map +1 -0
  313. package/dist/primitives/agent-error-card/index.js +5 -0
  314. package/dist/primitives/agent-error-card/index.js.map +1 -0
  315. package/dist/primitives/agent-event/index.js +4 -0
  316. package/dist/primitives/agent-event/index.js.map +1 -0
  317. package/dist/primitives/agent-handoff/index.js +4 -0
  318. package/dist/primitives/agent-handoff/index.js.map +1 -0
  319. package/dist/primitives/agent-profile/index.js +4 -0
  320. package/dist/primitives/agent-profile/index.js.map +1 -0
  321. package/dist/primitives/agent-starting-state/index.js +5 -0
  322. package/dist/primitives/agent-starting-state/index.js.map +1 -0
  323. package/dist/primitives/agent-streaming/index.js +5 -0
  324. package/dist/primitives/agent-streaming/index.js.map +1 -0
  325. package/dist/primitives/alert/index.js +4 -0
  326. package/dist/primitives/alert/index.js.map +1 -0
  327. package/dist/primitives/artifact-preview/index.js +4 -0
  328. package/dist/primitives/artifact-preview/index.js.map +1 -0
  329. package/dist/primitives/attachment-chip/index.js +4 -0
  330. package/dist/primitives/attachment-chip/index.js.map +1 -0
  331. package/dist/primitives/audit-log-entry/index.js +4 -0
  332. package/dist/primitives/audit-log-entry/index.js.map +1 -0
  333. package/dist/primitives/auto-compact-notice/index.js +5 -0
  334. package/dist/primitives/auto-compact-notice/index.js.map +1 -0
  335. package/dist/primitives/avatar/index.js +4 -0
  336. package/dist/primitives/avatar/index.js.map +1 -0
  337. package/dist/primitives/badge/index.js +4 -0
  338. package/dist/primitives/badge/index.js.map +1 -0
  339. package/dist/primitives/browser-controls/index.js +4 -0
  340. package/dist/primitives/browser-controls/index.js.map +1 -0
  341. package/dist/primitives/build-log-stream/index.js +5 -0
  342. package/dist/primitives/build-log-stream/index.js.map +1 -0
  343. package/dist/primitives/button/index.js +4 -0
  344. package/dist/primitives/button/index.js.map +1 -0
  345. package/dist/primitives/capability-indicator/index.js +4 -0
  346. package/dist/primitives/capability-indicator/index.js.map +1 -0
  347. package/dist/primitives/card/index.js +4 -0
  348. package/dist/primitives/card/index.js.map +1 -0
  349. package/dist/primitives/chat-thread/index.js +5 -0
  350. package/dist/primitives/chat-thread/index.js.map +1 -0
  351. package/dist/primitives/checkbox/index.js +4 -0
  352. package/dist/primitives/checkbox/index.js.map +1 -0
  353. package/dist/primitives/context-card/index.js +4 -0
  354. package/dist/primitives/context-card/index.js.map +1 -0
  355. package/dist/primitives/context-window-bar/index.js +4 -0
  356. package/dist/primitives/context-window-bar/index.js.map +1 -0
  357. package/dist/primitives/copy-button/index.js +4 -0
  358. package/dist/primitives/copy-button/index.js.map +1 -0
  359. package/dist/primitives/cost-meter/index.js +4 -0
  360. package/dist/primitives/cost-meter/index.js.map +1 -0
  361. package/dist/primitives/created-files-card/index.js +4 -0
  362. package/dist/primitives/created-files-card/index.js.map +1 -0
  363. package/dist/primitives/cron-job-card/index.js +4 -0
  364. package/dist/primitives/cron-job-card/index.js.map +1 -0
  365. package/dist/primitives/danger-zone/index.js +4 -0
  366. package/dist/primitives/danger-zone/index.js.map +1 -0
  367. package/dist/primitives/dialog/index.js +4 -0
  368. package/dist/primitives/dialog/index.js.map +1 -0
  369. package/dist/primitives/diff-viewer/index.js +4 -0
  370. package/dist/primitives/diff-viewer/index.js.map +1 -0
  371. package/dist/primitives/dropdown-menu/index.js +4 -0
  372. package/dist/primitives/dropdown-menu/index.js.map +1 -0
  373. package/dist/primitives/empty-state/index.js +4 -0
  374. package/dist/primitives/empty-state/index.js.map +1 -0
  375. package/dist/primitives/folder-context-card/index.js +4 -0
  376. package/dist/primitives/folder-context-card/index.js.map +1 -0
  377. package/dist/primitives/folder-selector/index.js +4 -0
  378. package/dist/primitives/folder-selector/index.js.map +1 -0
  379. package/dist/primitives/form-field/index.js +4 -0
  380. package/dist/primitives/form-field/index.js.map +1 -0
  381. package/dist/primitives/hook-config/index.js +4 -0
  382. package/dist/primitives/hook-config/index.js.map +1 -0
  383. package/dist/primitives/hook-event-log/index.js +4 -0
  384. package/dist/primitives/hook-event-log/index.js.map +1 -0
  385. package/dist/primitives/input/index.js +4 -0
  386. package/dist/primitives/input/index.js.map +1 -0
  387. package/dist/primitives/intent-selector/index.js +4 -0
  388. package/dist/primitives/intent-selector/index.js.map +1 -0
  389. package/dist/primitives/label/index.js +4 -0
  390. package/dist/primitives/label/index.js.map +1 -0
  391. package/dist/primitives/lane-board/index.js +4 -0
  392. package/dist/primitives/lane-board/index.js.map +1 -0
  393. package/dist/primitives/login-split/index.js +4 -0
  394. package/dist/primitives/login-split/index.js.map +1 -0
  395. package/dist/primitives/mcp-server-card/index.js +4 -0
  396. package/dist/primitives/mcp-server-card/index.js.map +1 -0
  397. package/dist/primitives/memory-editor/index.js +4 -0
  398. package/dist/primitives/memory-editor/index.js.map +1 -0
  399. package/dist/primitives/mention-menu/index.js +4 -0
  400. package/dist/primitives/mention-menu/index.js.map +1 -0
  401. package/dist/primitives/metrics-panel/index.js +4 -0
  402. package/dist/primitives/metrics-panel/index.js.map +1 -0
  403. package/dist/primitives/model-card/index.js +4 -0
  404. package/dist/primitives/model-card/index.js.map +1 -0
  405. package/dist/primitives/model-selector/index.js +4 -0
  406. package/dist/primitives/model-selector/index.js.map +1 -0
  407. package/dist/primitives/pagination/index.js +4 -0
  408. package/dist/primitives/pagination/index.js.map +1 -0
  409. package/dist/primitives/permission-matrix/index.js +4 -0
  410. package/dist/primitives/permission-matrix/index.js.map +1 -0
  411. package/dist/primitives/pin-input/index.js +4 -0
  412. package/dist/primitives/pin-input/index.js.map +1 -0
  413. package/dist/primitives/plan-badge/index.js +4 -0
  414. package/dist/primitives/plan-badge/index.js.map +1 -0
  415. package/dist/primitives/progress/index.js +4 -0
  416. package/dist/primitives/progress/index.js.map +1 -0
  417. package/dist/primitives/progress-checklist/index.js +4 -0
  418. package/dist/primitives/progress-checklist/index.js.map +1 -0
  419. package/dist/primitives/project-switcher/index.js +4 -0
  420. package/dist/primitives/project-switcher/index.js.map +1 -0
  421. package/dist/primitives/quick-action-chips/index.js +4 -0
  422. package/dist/primitives/quick-action-chips/index.js.map +1 -0
  423. package/dist/primitives/radio-group/index.js +4 -0
  424. package/dist/primitives/radio-group/index.js.map +1 -0
  425. package/dist/primitives/recent-folders-list/index.js +4 -0
  426. package/dist/primitives/recent-folders-list/index.js.map +1 -0
  427. package/dist/primitives/rule-card/index.js +4 -0
  428. package/dist/primitives/rule-card/index.js.map +1 -0
  429. package/dist/primitives/run-stats/index.js +4 -0
  430. package/dist/primitives/run-stats/index.js.map +1 -0
  431. package/dist/primitives/running-tasks-panel/index.js +4 -0
  432. package/dist/primitives/running-tasks-panel/index.js.map +1 -0
  433. package/dist/primitives/scroll-area/index.js +4 -0
  434. package/dist/primitives/scroll-area/index.js.map +1 -0
  435. package/dist/primitives/select/index.js +4 -0
  436. package/dist/primitives/select/index.js.map +1 -0
  437. package/dist/primitives/session-list-item/index.js +4 -0
  438. package/dist/primitives/session-list-item/index.js.map +1 -0
  439. package/dist/primitives/session-timeline/index.js +4 -0
  440. package/dist/primitives/session-timeline/index.js.map +1 -0
  441. package/dist/primitives/sheet/index.js +4 -0
  442. package/dist/primitives/sheet/index.js.map +1 -0
  443. package/dist/primitives/sidebar/index.js +4 -0
  444. package/dist/primitives/sidebar/index.js.map +1 -0
  445. package/dist/primitives/skeleton/index.js +5 -0
  446. package/dist/primitives/skeleton/index.js.map +1 -0
  447. package/dist/primitives/skill-card/index.js +4 -0
  448. package/dist/primitives/skill-card/index.js.map +1 -0
  449. package/dist/primitives/social-auth-row/index.js +4 -0
  450. package/dist/primitives/social-auth-row/index.js.map +1 -0
  451. package/dist/primitives/stat-tile/index.js +4 -0
  452. package/dist/primitives/stat-tile/index.js.map +1 -0
  453. package/dist/primitives/status-dot/index.js +4 -0
  454. package/dist/primitives/status-dot/index.js.map +1 -0
  455. package/dist/primitives/steps-rail/index.js +4 -0
  456. package/dist/primitives/steps-rail/index.js.map +1 -0
  457. package/dist/primitives/sub-agent-dispatch/index.js +4 -0
  458. package/dist/primitives/sub-agent-dispatch/index.js.map +1 -0
  459. package/dist/primitives/switch/index.js +4 -0
  460. package/dist/primitives/switch/index.js.map +1 -0
  461. package/dist/primitives/system-prompt-editor/index.js +4 -0
  462. package/dist/primitives/system-prompt-editor/index.js.map +1 -0
  463. package/dist/primitives/table/index.js +4 -0
  464. package/dist/primitives/table/index.js.map +1 -0
  465. package/dist/primitives/tabs/index.js +4 -0
  466. package/dist/primitives/tabs/index.js.map +1 -0
  467. package/dist/primitives/task-plan/index.js +4 -0
  468. package/dist/primitives/task-plan/index.js.map +1 -0
  469. package/dist/primitives/terminal-panel/index.js +5 -0
  470. package/dist/primitives/terminal-panel/index.js.map +1 -0
  471. package/dist/primitives/textarea/index.js +4 -0
  472. package/dist/primitives/textarea/index.js.map +1 -0
  473. package/dist/primitives/timestamp/index.js +4 -0
  474. package/dist/primitives/timestamp/index.js.map +1 -0
  475. package/dist/primitives/toast/index.js +4 -0
  476. package/dist/primitives/toast/index.js.map +1 -0
  477. package/dist/primitives/token-usage-chart/index.js +4 -0
  478. package/dist/primitives/token-usage-chart/index.js.map +1 -0
  479. package/dist/primitives/tool-call/index.js +4 -0
  480. package/dist/primitives/tool-call/index.js.map +1 -0
  481. package/dist/primitives/tool-call-card/index.js +4 -0
  482. package/dist/primitives/tool-call-card/index.js.map +1 -0
  483. package/dist/primitives/tool-result/index.js +4 -0
  484. package/dist/primitives/tool-result/index.js.map +1 -0
  485. package/dist/primitives/tools-list/index.js +4 -0
  486. package/dist/primitives/tools-list/index.js.map +1 -0
  487. package/dist/primitives/tooltip/index.js +4 -0
  488. package/dist/primitives/tooltip/index.js.map +1 -0
  489. package/dist/primitives/topnav/index.js +4 -0
  490. package/dist/primitives/topnav/index.js.map +1 -0
  491. package/dist/slide/index.js +1 -712
  492. package/dist/slide/index.js.map +1 -1
  493. package/dist/slide-deck/index.js +2 -688
  494. package/dist/slide-deck/index.js.map +1 -1
  495. package/llms.txt +8 -6
  496. package/package.json +177 -157
  497. package/registry/index.json +30 -0
  498. package/registry/r/action-bar.json +22 -0
  499. package/registry/r/data-table.json +27 -0
  500. package/registry/r/dropdown-menu.json +23 -0
  501. package/registry/r/page-shell.json +25 -0
  502. package/registry/r/pin-input.json +20 -0
@@ -0,0 +1,1022 @@
1
+ import { safeHref } from './chunk-673R3GSK.js';
2
+ import { Button } from './chunk-57NXT3OX.js';
3
+ import { cn } from './chunk-ZSRJCIWF.js';
4
+ import { memo, forwardRef, createContext, useState, useEffect, createElement, useCallback, useMemo, useContext } from 'react';
5
+ import { BrainCircuitIcon, ImageIcon, FileIcon, ExternalLinkIcon, FileTextIcon, WrenchIcon, CodeIcon, ShieldIcon, AlertCircleIcon, CheckCircleIcon, LoaderIcon, ChevronLeftIcon, ChevronRightIcon, CheckIcon, CopyIcon } from 'lucide-react';
6
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
+
8
+ // src/types/chat.ts
9
+ function isTextUIPart(part) {
10
+ return part.type === "text";
11
+ }
12
+ function isReasoningUIPart(part) {
13
+ return part.type === "reasoning";
14
+ }
15
+ function isFileUIPart(part) {
16
+ return part.type === "file";
17
+ }
18
+ function isReasoningFileUIPart(part) {
19
+ return part.type === "reasoning-file";
20
+ }
21
+ function isSourceUrlUIPart(part) {
22
+ return part.type === "source-url";
23
+ }
24
+ function isSourceDocumentUIPart(part) {
25
+ return part.type === "source-document";
26
+ }
27
+ function isStepStartUIPart(part) {
28
+ return part.type === "step-start";
29
+ }
30
+ function isCustomContentUIPart(part) {
31
+ return part.type === "custom";
32
+ }
33
+ function isToolUIPart(part) {
34
+ return part.type === "dynamic-tool" || part.type.startsWith("tool-");
35
+ }
36
+ function isDataUIPart(part) {
37
+ return part.type.startsWith("data-");
38
+ }
39
+ function deriveDataName(part) {
40
+ return part.type.slice("data-".length);
41
+ }
42
+ function DataPart({ part, renderers }) {
43
+ const name = deriveDataName(part);
44
+ const renderer = renderers?.[part.type] ?? renderers?.[name];
45
+ if (renderer) return renderer(part.data, part);
46
+ return /* @__PURE__ */ jsxs(
47
+ "details",
48
+ {
49
+ className: cn("my-2 rounded-md border border-border bg-muted/20 px-3 py-1.5 text-body-sm"),
50
+ "data-theo-data": name,
51
+ children: [
52
+ /* @__PURE__ */ jsxs("summary", { className: "flex cursor-pointer items-center gap-1.5 font-mono text-label-caps text-muted-foreground uppercase tracking-wider", children: [
53
+ /* @__PURE__ */ jsx(CodeIcon, { className: "size-3", "aria-hidden": "true" }),
54
+ /* @__PURE__ */ jsxs("span", { children: [
55
+ "data-",
56
+ name
57
+ ] })
58
+ ] }),
59
+ /* @__PURE__ */ jsx("pre", { className: "mt-2 overflow-x-auto border-border border-t pt-2 text-code-sm", children: /* @__PURE__ */ jsx("code", { children: safeStringify(part.data) }) })
60
+ ]
61
+ }
62
+ );
63
+ }
64
+ function safeStringify(value) {
65
+ try {
66
+ return JSON.stringify(value, null, 2);
67
+ } catch {
68
+ return String(value);
69
+ }
70
+ }
71
+ function isImage(mediaType) {
72
+ return mediaType.startsWith("image/") || mediaType === "image";
73
+ }
74
+ function FilePart({ part }) {
75
+ const safeUrl = safeHref(part.url);
76
+ const label = part.filename ?? part.url.split("/").pop() ?? "file";
77
+ if (isImage(part.mediaType)) {
78
+ if (!safeUrl) {
79
+ return /* @__PURE__ */ jsxs(
80
+ "div",
81
+ {
82
+ className: cn(
83
+ "my-2 inline-flex items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",
84
+ "text-body-sm text-muted-foreground"
85
+ ),
86
+ children: [
87
+ /* @__PURE__ */ jsx(ImageIcon, { className: "size-4", "aria-hidden": "true" }),
88
+ /* @__PURE__ */ jsx("span", { children: label }),
89
+ /* @__PURE__ */ jsx("span", { className: "text-destructive", children: "(blocked)" })
90
+ ]
91
+ }
92
+ );
93
+ }
94
+ return /* @__PURE__ */ jsxs(
95
+ "figure",
96
+ {
97
+ className: "my-3 overflow-hidden rounded-lg border border-border",
98
+ "data-theo-file": "image",
99
+ children: [
100
+ /* @__PURE__ */ jsx("img", { src: safeUrl, alt: label, className: "block max-w-full", loading: "lazy" }),
101
+ part.filename ? /* @__PURE__ */ jsx("figcaption", { className: "border-border border-t bg-muted/30 px-3 py-1.5 font-mono text-label-caps text-muted-foreground uppercase tracking-wider", children: part.filename }) : null
102
+ ]
103
+ }
104
+ );
105
+ }
106
+ return /* @__PURE__ */ jsxs(
107
+ "div",
108
+ {
109
+ className: cn(
110
+ "my-2 inline-flex items-center gap-2 rounded-md border border-border bg-card px-3 py-2",
111
+ "text-body-sm"
112
+ ),
113
+ "data-theo-file": "generic",
114
+ children: [
115
+ /* @__PURE__ */ jsx(FileIcon, { className: "size-4 text-muted-foreground", "aria-hidden": "true" }),
116
+ safeUrl ? /* @__PURE__ */ jsx("a", { href: safeUrl, className: "text-primary hover:text-primary-deep hover:underline", children: label }) : /* @__PURE__ */ jsx("span", { children: label }),
117
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-label-caps text-muted-foreground uppercase tracking-wider", children: part.mediaType })
118
+ ]
119
+ }
120
+ );
121
+ }
122
+ var DEFAULT_THEMES = { light: "github-light", dark: "github-dark" };
123
+ var cachedHighlighter = null;
124
+ var highlighterFailed = false;
125
+ async function getHighlighter(themes) {
126
+ if (cachedHighlighter) return cachedHighlighter;
127
+ if (highlighterFailed) return null;
128
+ try {
129
+ const shiki = await import('shiki');
130
+ cachedHighlighter = await shiki.createHighlighter({
131
+ themes: [themes.light, themes.dark],
132
+ langs: [
133
+ "ts",
134
+ "tsx",
135
+ "js",
136
+ "jsx",
137
+ "python",
138
+ "go",
139
+ "rust",
140
+ "java",
141
+ "json",
142
+ "yaml",
143
+ "bash",
144
+ "shell",
145
+ "html",
146
+ "css",
147
+ "sql",
148
+ "markdown"
149
+ ]
150
+ });
151
+ return cachedHighlighter;
152
+ } catch {
153
+ highlighterFailed = true;
154
+ return null;
155
+ }
156
+ }
157
+ function CodeBlock({ code, language, themes, className }) {
158
+ const [html, setHtml] = useState(null);
159
+ const [copied, setCopied] = useState(false);
160
+ const effectiveThemes = themes ?? DEFAULT_THEMES;
161
+ useEffect(() => {
162
+ let cancelled = false;
163
+ if (!language) return;
164
+ getHighlighter(effectiveThemes).then((hl) => {
165
+ if (cancelled || !hl) return;
166
+ try {
167
+ const out = hl.codeToHtml(code, {
168
+ lang: language,
169
+ themes: { light: effectiveThemes.light, dark: effectiveThemes.dark },
170
+ defaultColor: "light"
171
+ });
172
+ setHtml(out);
173
+ } catch {
174
+ }
175
+ }).catch(() => {
176
+ });
177
+ return () => {
178
+ cancelled = true;
179
+ };
180
+ }, [code, language, effectiveThemes.light, effectiveThemes.dark, effectiveThemes]);
181
+ const handleCopy = async () => {
182
+ try {
183
+ await navigator.clipboard.writeText(code);
184
+ setCopied(true);
185
+ setTimeout(() => setCopied(false), 2e3);
186
+ } catch {
187
+ }
188
+ };
189
+ return /* @__PURE__ */ jsxs(
190
+ "div",
191
+ {
192
+ className: cn(
193
+ "group relative my-4 overflow-hidden rounded-lg border border-border bg-muted/30",
194
+ className
195
+ ),
196
+ "data-theo-code-block": "",
197
+ children: [
198
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-border border-b bg-muted/50 px-3 py-1.5", children: [
199
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-label-caps text-muted-foreground uppercase tracking-wider", children: language || "text" }),
200
+ /* @__PURE__ */ jsx(
201
+ "button",
202
+ {
203
+ type: "button",
204
+ onClick: handleCopy,
205
+ className: cn(
206
+ "inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-label",
207
+ "text-muted-foreground transition-colors hover:bg-secondary hover:text-foreground",
208
+ "focus-visible:outline focus-visible:outline-2 focus-visible:outline-ring"
209
+ ),
210
+ "aria-label": copied ? "Copied" : "Copy code",
211
+ children: copied ? /* @__PURE__ */ jsxs(Fragment, { children: [
212
+ /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5", "aria-hidden": "true" }),
213
+ /* @__PURE__ */ jsx("span", { children: "Copied" })
214
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
215
+ /* @__PURE__ */ jsx(CopyIcon, { className: "size-3.5", "aria-hidden": "true" }),
216
+ /* @__PURE__ */ jsx("span", { children: "Copy" })
217
+ ] })
218
+ }
219
+ )
220
+ ] }),
221
+ html ? /* @__PURE__ */ jsx(
222
+ "div",
223
+ {
224
+ className: "[&_pre]:!bg-transparent [&_pre]:!m-0 [&_pre]:!p-0 overflow-x-auto p-3 text-code-sm",
225
+ dangerouslySetInnerHTML: { __html: html }
226
+ }
227
+ ) : /* @__PURE__ */ jsx("pre", { className: "overflow-x-auto p-3 text-code-sm", children: /* @__PURE__ */ jsx("code", { className: language ? `language-${language}` : void 0, children: code }) })
228
+ ]
229
+ }
230
+ );
231
+ }
232
+ function InlineCode({ className, children, ...props }) {
233
+ return /* @__PURE__ */ jsx(
234
+ "code",
235
+ {
236
+ className: cn(
237
+ "rounded bg-muted px-1.5 py-0.5 font-mono text-code-sm text-foreground",
238
+ className
239
+ ),
240
+ ...props,
241
+ children
242
+ }
243
+ );
244
+ }
245
+
246
+ // src/lib/markdown/streaming-preprocess.ts
247
+ function preprocessStreaming(markdown, isStreaming = true) {
248
+ if (!isStreaming) return markdown;
249
+ let buf = markdown;
250
+ const fenceCount = countTripleBackticks(buf);
251
+ if (fenceCount % 2 === 1) {
252
+ buf = `${buf.endsWith("\n") ? buf : `${buf}
253
+ `}\`\`\``;
254
+ return buf;
255
+ }
256
+ const blockMathCount = countOccurrences(buf, "$$");
257
+ if (blockMathCount % 2 === 1) {
258
+ buf = `${buf}$$`;
259
+ return buf;
260
+ }
261
+ const inlineBackticks = countSingleBackticks(buf);
262
+ if (inlineBackticks % 2 === 1) {
263
+ buf = `${buf}\``;
264
+ }
265
+ const inlineDollars = countSingleDollars(buf);
266
+ if (inlineDollars % 2 === 1) {
267
+ buf = `${buf}$`;
268
+ }
269
+ for (const marker of ["**", "__", "*", "_"]) {
270
+ if (countMarker(buf, marker) % 2 === 1) {
271
+ buf = `${buf}${marker}`;
272
+ }
273
+ }
274
+ buf = closeUnclosedLink(buf);
275
+ return buf;
276
+ }
277
+ function countTripleBackticks(s) {
278
+ let count = 0;
279
+ let i = 0;
280
+ while (i < s.length) {
281
+ if (s[i] === "`" && s[i + 1] === "`" && s[i + 2] === "`") {
282
+ count++;
283
+ i += 3;
284
+ } else {
285
+ i++;
286
+ }
287
+ }
288
+ return count;
289
+ }
290
+ function countSingleBackticks(s) {
291
+ let count = 0;
292
+ let i = 0;
293
+ while (i < s.length) {
294
+ if (s[i] === "`") {
295
+ if (s[i + 1] === "`" && s[i + 2] === "`") {
296
+ i += 3;
297
+ continue;
298
+ }
299
+ count++;
300
+ }
301
+ i++;
302
+ }
303
+ return count;
304
+ }
305
+ function countOccurrences(s, needle) {
306
+ if (needle.length === 0) return 0;
307
+ let count = 0;
308
+ let i = s.indexOf(needle);
309
+ while (i !== -1) {
310
+ count++;
311
+ i = s.indexOf(needle, i + needle.length);
312
+ }
313
+ return count;
314
+ }
315
+ function countSingleDollars(s) {
316
+ let count = 0;
317
+ let i = 0;
318
+ while (i < s.length) {
319
+ if (s[i] === "$") {
320
+ if (s[i + 1] === "$") {
321
+ i += 2;
322
+ continue;
323
+ }
324
+ if (i > 0 && s[i - 1] === "\\") {
325
+ i++;
326
+ continue;
327
+ }
328
+ count++;
329
+ }
330
+ i++;
331
+ }
332
+ return count;
333
+ }
334
+ function countMarker(s, marker) {
335
+ if (marker.length === 0) return 0;
336
+ if (marker.length === 1) {
337
+ let count2 = 0;
338
+ let i2 = 0;
339
+ while (i2 < s.length) {
340
+ if (s[i2] === marker) {
341
+ if (s[i2 + 1] === marker) {
342
+ i2 += 2;
343
+ continue;
344
+ }
345
+ if (i2 > 0 && s[i2 - 1] === "\\") {
346
+ i2++;
347
+ continue;
348
+ }
349
+ count2++;
350
+ }
351
+ i2++;
352
+ }
353
+ return count2;
354
+ }
355
+ let count = 0;
356
+ let i = 0;
357
+ while (i <= s.length - marker.length) {
358
+ if (s.substring(i, i + marker.length) === marker) {
359
+ count++;
360
+ i += marker.length;
361
+ } else {
362
+ i++;
363
+ }
364
+ }
365
+ return count;
366
+ }
367
+ function closeUnclosedLink(s) {
368
+ const lastOpenParen = s.lastIndexOf("(");
369
+ const lastCloseParen = s.lastIndexOf(")");
370
+ if (lastOpenParen === -1 || lastOpenParen <= lastCloseParen) return s;
371
+ if (s[lastOpenParen - 1] !== "]") return s;
372
+ const closingBracket = lastOpenParen - 1;
373
+ const openingBracket = s.lastIndexOf("[", closingBracket - 1);
374
+ if (openingBracket === -1) return s;
375
+ return `${s})`;
376
+ }
377
+
378
+ // src/lib/markdown/parser.ts
379
+ async function parseBody(body) {
380
+ const [{ fromMarkdown }, { gfmFromMarkdown }, { gfm }] = await Promise.all([
381
+ import('mdast-util-from-markdown'),
382
+ import('mdast-util-gfm'),
383
+ import('micromark-extension-gfm')
384
+ ]);
385
+ return fromMarkdown(body, {
386
+ extensions: [gfm()],
387
+ mdastExtensions: [gfmFromMarkdown()]
388
+ });
389
+ }
390
+ async function mdastToHast(tree) {
391
+ const { toHast } = await import('mdast-util-to-hast');
392
+ const hast = toHast(tree, { allowDangerousHtml: false });
393
+ if (!hast || hast.type !== "root") {
394
+ return { type: "root", children: hast ? [hast] : [] };
395
+ }
396
+ return hast;
397
+ }
398
+ async function sanitizeHast(tree) {
399
+ const { sanitize, defaultSchema } = await import('hast-util-sanitize');
400
+ const schema = {
401
+ ...defaultSchema,
402
+ attributes: {
403
+ ...defaultSchema.attributes ?? {},
404
+ code: [...defaultSchema.attributes?.code ?? [], ["className", /^language-./]],
405
+ pre: [...defaultSchema.attributes?.pre ?? [], ["className", /./]],
406
+ span: [...defaultSchema.attributes?.span ?? [], ["className", /./], ["style"]]
407
+ }
408
+ };
409
+ const safe = sanitize(tree, schema);
410
+ return safe.type === "root" ? safe : { type: "root", children: [safe] };
411
+ }
412
+ async function hastToReact(tree, components) {
413
+ const { Fragment: Fragment4, jsx: jsx14, jsxs: jsxs10 } = await import('react/jsx-runtime');
414
+ const { toJsxRuntime } = await import('hast-util-to-jsx-runtime');
415
+ return toJsxRuntime(tree, {
416
+ Fragment: Fragment4,
417
+ jsx: jsx14,
418
+ jsxs: jsxs10,
419
+ components
420
+ });
421
+ }
422
+ async function parseMarkdownToReact(markdown, opts = {}) {
423
+ const preprocessed = preprocessStreaming(markdown, opts.isStreaming ?? false);
424
+ const mdast = await parseBody(preprocessed);
425
+ const hast = await mdastToHast(mdast);
426
+ const safe = await sanitizeHast(hast);
427
+ return hastToReact(safe, opts.components);
428
+ }
429
+ async function parseMarkdownToReactSafe(markdown, opts = {}) {
430
+ try {
431
+ return await parseMarkdownToReact(markdown, opts);
432
+ } catch {
433
+ return createElement("span", { className: "whitespace-pre-wrap" }, markdown);
434
+ }
435
+ }
436
+ function isFenced(props) {
437
+ const cls = props.className;
438
+ if (typeof cls === "string") return cls.startsWith("language-");
439
+ if (Array.isArray(cls))
440
+ return cls.some((c) => typeof c === "string" && c.startsWith("language-"));
441
+ return false;
442
+ }
443
+ function extractLanguage(props) {
444
+ const cls = props.className;
445
+ const list = typeof cls === "string" ? [cls] : Array.isArray(cls) ? cls : [];
446
+ for (const c of list) {
447
+ if (typeof c === "string" && c.startsWith("language-")) {
448
+ return c.slice("language-".length);
449
+ }
450
+ }
451
+ return void 0;
452
+ }
453
+ function extractText(children) {
454
+ if (typeof children === "string") return children;
455
+ if (Array.isArray(children)) return children.map(extractText).join("");
456
+ if (children && typeof children === "object" && "props" in children && children.props) {
457
+ return extractText(children.props.children);
458
+ }
459
+ return "";
460
+ }
461
+ var MARKDOWN_COMPONENTS = {
462
+ code: (props) => {
463
+ if (isFenced(props)) {
464
+ const language = extractLanguage(props);
465
+ const code = extractText(props.children);
466
+ return /* @__PURE__ */ jsx(CodeBlock, { code, language });
467
+ }
468
+ return /* @__PURE__ */ jsx(InlineCode, { ...props, children: props.children });
469
+ },
470
+ // Strip the default `<pre>` since `<CodeBlock>` ships its own wrapper.
471
+ // Inline `<pre>` still works for raw whitespace-preserving text.
472
+ pre: ({ children }) => {
473
+ return /* @__PURE__ */ jsx(Fragment, { children });
474
+ }
475
+ };
476
+ function ChatMessageResponseImpl({
477
+ text,
478
+ isStreaming = false,
479
+ className
480
+ }) {
481
+ const [tree, setTree] = useState(null);
482
+ useEffect(() => {
483
+ let cancelled = false;
484
+ parseMarkdownToReactSafe(text, {
485
+ isStreaming,
486
+ components: MARKDOWN_COMPONENTS
487
+ }).then((next) => {
488
+ if (!cancelled) setTree(next);
489
+ });
490
+ return () => {
491
+ cancelled = true;
492
+ };
493
+ }, [text, isStreaming]);
494
+ return /* @__PURE__ */ jsx(
495
+ "div",
496
+ {
497
+ className: cn(
498
+ "prose-theo max-w-none text-body-md text-foreground leading-relaxed",
499
+ // First/last child margin reset — fork from vercel/ai-elements
500
+ "[&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
501
+ // Heading sizes inside chat use our typescale, not browser defaults
502
+ "[&_h1]:mt-4 [&_h1]:mb-2 [&_h1]:font-semibold [&_h1]:text-title-lg",
503
+ "[&_h2]:mt-3 [&_h2]:mb-2 [&_h2]:font-semibold [&_h2]:text-title-md",
504
+ "[&_h3]:mt-3 [&_h3]:mb-1.5 [&_h3]:font-semibold [&_h3]:text-body-lg",
505
+ "[&_p]:my-2",
506
+ "[&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5",
507
+ "[&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5",
508
+ "[&_li]:my-0.5",
509
+ "[&_blockquote]:my-2 [&_blockquote]:border-primary/40 [&_blockquote]:border-l-2 [&_blockquote]:pl-3 [&_blockquote]:text-muted-foreground",
510
+ "[&_a:hover]:text-primary-deep [&_a]:text-primary [&_a]:underline",
511
+ "[&_table]:my-3 [&_table]:w-full [&_table]:border-collapse",
512
+ "[&_th]:border [&_th]:border-border [&_th]:bg-muted/40 [&_th]:px-3 [&_th]:py-1.5 [&_th]:text-left",
513
+ "[&_td]:border [&_td]:border-border [&_td]:px-3 [&_td]:py-1.5",
514
+ "[&_hr]:my-4 [&_hr]:border-border",
515
+ className
516
+ ),
517
+ "data-theo-chat-response": "",
518
+ children: tree
519
+ }
520
+ );
521
+ }
522
+ var ChatMessageResponse = memo(ChatMessageResponseImpl, (prev, next) => {
523
+ return prev.text === next.text && prev.isStreaming === next.isStreaming;
524
+ });
525
+ ChatMessageResponse.displayName = "ChatMessageResponse";
526
+ function ReasoningPart({ part, defaultOpen }) {
527
+ const isStreaming = part.state === "streaming";
528
+ const open = defaultOpen ?? isStreaming;
529
+ return /* @__PURE__ */ jsxs(
530
+ "details",
531
+ {
532
+ className: cn(
533
+ "my-2 rounded-md border border-border bg-muted/20 px-3 py-2",
534
+ "[&[open]]:bg-muted/40"
535
+ ),
536
+ open,
537
+ "data-theo-reasoning": "",
538
+ children: [
539
+ /* @__PURE__ */ jsxs(
540
+ "summary",
541
+ {
542
+ className: cn(
543
+ "cursor-pointer list-none font-mono text-label-caps text-muted-foreground uppercase tracking-wider",
544
+ "flex items-center gap-1.5 marker:hidden",
545
+ "transition-colors hover:text-foreground"
546
+ ),
547
+ children: [
548
+ /* @__PURE__ */ jsx(BrainCircuitIcon, { className: "size-3.5", "aria-hidden": "true" }),
549
+ /* @__PURE__ */ jsx("span", { children: "Reasoning" }),
550
+ isStreaming ? /* @__PURE__ */ jsx("span", { className: "text-primary/80", children: "\u2026" }) : null
551
+ ]
552
+ }
553
+ ),
554
+ /* @__PURE__ */ jsx("div", { className: "mt-2 border-border border-t pt-2", children: /* @__PURE__ */ jsx(ChatMessageResponse, { text: part.text, isStreaming }) })
555
+ ]
556
+ }
557
+ );
558
+ }
559
+ function SourceUrlPart({ part }) {
560
+ const safe = safeHref(part.url);
561
+ const label = part.title || part.url;
562
+ return /* @__PURE__ */ jsxs(
563
+ "span",
564
+ {
565
+ className: cn(
566
+ "my-1 inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-card px-2 py-1",
567
+ "align-middle font-mono text-label"
568
+ ),
569
+ "data-theo-source": "url",
570
+ children: [
571
+ /* @__PURE__ */ jsx(ExternalLinkIcon, { className: "size-3 text-muted-foreground", "aria-hidden": "true" }),
572
+ safe ? /* @__PURE__ */ jsx(
573
+ "a",
574
+ {
575
+ href: safe,
576
+ className: "truncate text-primary hover:text-primary-deep hover:underline",
577
+ rel: "noopener noreferrer",
578
+ target: "_blank",
579
+ children: label
580
+ }
581
+ ) : /* @__PURE__ */ jsx("span", { className: "truncate text-muted-foreground", children: label })
582
+ ]
583
+ }
584
+ );
585
+ }
586
+ function SourceDocumentPart({ part }) {
587
+ return /* @__PURE__ */ jsxs(
588
+ "span",
589
+ {
590
+ className: cn(
591
+ "my-1 inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-card px-2 py-1",
592
+ "align-middle font-mono text-label"
593
+ ),
594
+ "data-theo-source": "document",
595
+ children: [
596
+ /* @__PURE__ */ jsx(FileTextIcon, { className: "size-3 text-muted-foreground", "aria-hidden": "true" }),
597
+ /* @__PURE__ */ jsx("span", { className: "truncate text-foreground", children: part.title }),
598
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "\xB7" }),
599
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: part.mediaType })
600
+ ]
601
+ }
602
+ );
603
+ }
604
+ function TextPart({ part }) {
605
+ return /* @__PURE__ */ jsx(ChatMessageResponse, { text: part.text, isStreaming: part.state === "streaming" });
606
+ }
607
+ function deriveToolName(part) {
608
+ if (part.toolName) return part.toolName;
609
+ if (part.type === "dynamic-tool") return "dynamic-tool";
610
+ return part.type.slice("tool-".length);
611
+ }
612
+ function stateBadge(state) {
613
+ switch (state) {
614
+ case "input-streaming":
615
+ return {
616
+ icon: /* @__PURE__ */ jsx(LoaderIcon, { className: "size-3.5 animate-spin", "aria-hidden": "true" }),
617
+ label: "Streaming input",
618
+ tone: "text-muted-foreground"
619
+ };
620
+ case "input-available":
621
+ return {
622
+ icon: /* @__PURE__ */ jsx(WrenchIcon, { className: "size-3.5", "aria-hidden": "true" }),
623
+ label: "Ready to call",
624
+ tone: "text-primary"
625
+ };
626
+ case "approval-requested":
627
+ return {
628
+ icon: /* @__PURE__ */ jsx(ShieldIcon, { className: "size-3.5", "aria-hidden": "true" }),
629
+ label: "Awaiting approval",
630
+ tone: "text-warning"
631
+ };
632
+ case "approval-responded":
633
+ return {
634
+ icon: /* @__PURE__ */ jsx(ShieldIcon, { className: "size-3.5", "aria-hidden": "true" }),
635
+ label: "Approval responded",
636
+ tone: "text-primary"
637
+ };
638
+ case "output-available":
639
+ return {
640
+ icon: /* @__PURE__ */ jsx(CheckCircleIcon, { className: "size-3.5", "aria-hidden": "true" }),
641
+ label: "Completed",
642
+ tone: "text-success"
643
+ };
644
+ case "output-error":
645
+ return {
646
+ icon: /* @__PURE__ */ jsx(AlertCircleIcon, { className: "size-3.5", "aria-hidden": "true" }),
647
+ label: "Error",
648
+ tone: "text-destructive"
649
+ };
650
+ case "output-denied":
651
+ return {
652
+ icon: /* @__PURE__ */ jsx(ShieldIcon, { className: "size-3.5", "aria-hidden": "true" }),
653
+ label: "Denied",
654
+ tone: "text-destructive"
655
+ };
656
+ default:
657
+ return {
658
+ icon: /* @__PURE__ */ jsx(WrenchIcon, { className: "size-3.5", "aria-hidden": "true" }),
659
+ label: "Unknown",
660
+ tone: "text-muted-foreground"
661
+ };
662
+ }
663
+ }
664
+ function safeStringify2(value) {
665
+ if (value === void 0) return "";
666
+ if (typeof value === "string") return value;
667
+ try {
668
+ return JSON.stringify(value, null, 2);
669
+ } catch {
670
+ return String(value);
671
+ }
672
+ }
673
+ function ToolCallPart({ part }) {
674
+ const toolName = deriveToolName(part);
675
+ const badge = stateBadge(part.state);
676
+ const inputStr = safeStringify2(part.input);
677
+ const outputStr = part.state === "output-available" ? safeStringify2(part.output) : part.errorText ?? "";
678
+ return /* @__PURE__ */ jsxs(
679
+ "div",
680
+ {
681
+ className: cn("my-3 overflow-hidden rounded-lg border border-border bg-card", "shadow-sm"),
682
+ "data-theo-tool-call": part.state,
683
+ children: [
684
+ /* @__PURE__ */ jsxs("header", { className: "flex items-center justify-between gap-3 border-border border-b bg-muted/30 px-3 py-1.5", children: [
685
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
686
+ /* @__PURE__ */ jsx(WrenchIcon, { className: "size-3.5 shrink-0 text-muted-foreground", "aria-hidden": "true" }),
687
+ /* @__PURE__ */ jsx("span", { className: "truncate font-mono text-foreground text-label", children: toolName })
688
+ ] }),
689
+ /* @__PURE__ */ jsxs(
690
+ "span",
691
+ {
692
+ className: cn(
693
+ "inline-flex items-center gap-1 text-label-caps uppercase tracking-wider",
694
+ badge.tone
695
+ ),
696
+ children: [
697
+ badge.icon,
698
+ /* @__PURE__ */ jsx("span", { children: badge.label })
699
+ ]
700
+ }
701
+ )
702
+ ] }),
703
+ inputStr ? /* @__PURE__ */ jsxs("details", { className: "border-border border-b", open: part.state === "input-streaming", children: [
704
+ /* @__PURE__ */ jsx("summary", { className: "cursor-pointer px-3 py-1.5 font-mono text-label-caps text-muted-foreground uppercase tracking-wider hover:text-foreground", children: "Input" }),
705
+ /* @__PURE__ */ jsx("pre", { className: "overflow-x-auto bg-muted/20 px-3 py-2 text-code-sm", children: /* @__PURE__ */ jsx("code", { children: inputStr }) })
706
+ ] }) : null,
707
+ outputStr ? /* @__PURE__ */ jsxs("details", { open: part.state === "output-error" || part.state === "output-available", children: [
708
+ /* @__PURE__ */ jsx(
709
+ "summary",
710
+ {
711
+ className: cn(
712
+ "cursor-pointer px-3 py-1.5 font-mono text-label-caps uppercase tracking-wider hover:text-foreground",
713
+ part.state === "output-error" ? "text-destructive" : "text-muted-foreground"
714
+ ),
715
+ children: part.state === "output-error" ? "Error" : "Output"
716
+ }
717
+ ),
718
+ /* @__PURE__ */ jsx(
719
+ "pre",
720
+ {
721
+ className: cn(
722
+ "overflow-x-auto px-3 py-2 text-code-sm",
723
+ part.state === "output-error" ? "bg-destructive/5" : "bg-muted/20"
724
+ ),
725
+ children: /* @__PURE__ */ jsx("code", { children: outputStr })
726
+ }
727
+ )
728
+ ] }) : null
729
+ ]
730
+ }
731
+ );
732
+ }
733
+ var ChatMessageRoot = forwardRef(
734
+ ({ className, from, children, ...props }, ref) => /* @__PURE__ */ jsx(
735
+ "div",
736
+ {
737
+ ref,
738
+ className: cn(
739
+ "group flex w-full max-w-[95%] flex-col gap-2",
740
+ from === "user" ? "is-user ml-auto justify-end" : from === "assistant" ? "is-assistant" : "is-system",
741
+ className
742
+ ),
743
+ "data-theo-chat-message": from,
744
+ ...props,
745
+ children
746
+ }
747
+ )
748
+ );
749
+ ChatMessageRoot.displayName = "ChatMessageRoot";
750
+ var ChatMessageContent = forwardRef(
751
+ ({ className, variant, children, ...props }, ref) => /* @__PURE__ */ jsx(
752
+ "div",
753
+ {
754
+ ref,
755
+ className: cn(
756
+ "flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-body-md",
757
+ // User bubble — secondary surface, right-aligned (within the `is-user` group)
758
+ "group-[.is-user]:ml-auto",
759
+ variant !== "flat" && "group-[.is-user]:rounded-2xl group-[.is-user]:rounded-tr-md group-[.is-user]:border group-[.is-user]:border-border/40 group-[.is-user]:bg-secondary group-[.is-user]:px-4 group-[.is-user]:py-3",
760
+ // Assistant card — primary accent border-left
761
+ variant === "contained" && "group-[.is-assistant]:rounded-2xl group-[.is-assistant]:rounded-tl-md group-[.is-assistant]:border group-[.is-assistant]:border-border/40 group-[.is-assistant]:border-l-2 group-[.is-assistant]:border-l-primary group-[.is-assistant]:bg-card group-[.is-assistant]:px-5 group-[.is-assistant]:py-4 group-[.is-assistant]:shadow-sm",
762
+ // System callout — accent-deep border
763
+ "group-[.is-system]:rounded-lg group-[.is-system]:border group-[.is-system]:border-accent-deep/40 group-[.is-system]:border-l-4 group-[.is-system]:bg-accent/10 group-[.is-system]:px-4 group-[.is-system]:py-2 group-[.is-system]:text-body-sm",
764
+ "group-[.is-assistant]:text-foreground group-[.is-user]:text-secondary-foreground",
765
+ className
766
+ ),
767
+ "data-theo-chat-content": "",
768
+ ...props,
769
+ children
770
+ }
771
+ )
772
+ );
773
+ ChatMessageContent.displayName = "ChatMessageContent";
774
+ function renderPart(part, opts = {}) {
775
+ const overrides = opts.partRenderers ?? {};
776
+ if (isTextUIPart(part)) {
777
+ return overrides.text?.(part) ?? /* @__PURE__ */ jsx(TextPart, { part });
778
+ }
779
+ if (isReasoningUIPart(part)) {
780
+ return overrides.reasoning?.(part) ?? /* @__PURE__ */ jsx(ReasoningPart, { part });
781
+ }
782
+ if (isReasoningFileUIPart(part)) {
783
+ return overrides["reasoning-file"]?.(part) ?? null;
784
+ }
785
+ if (isFileUIPart(part)) {
786
+ return overrides.file?.(part) ?? /* @__PURE__ */ jsx(FilePart, { part });
787
+ }
788
+ if (isSourceUrlUIPart(part)) {
789
+ return overrides["source-url"]?.(part) ?? /* @__PURE__ */ jsx(SourceUrlPart, { part });
790
+ }
791
+ if (isSourceDocumentUIPart(part)) {
792
+ return overrides["source-document"]?.(part) ?? /* @__PURE__ */ jsx(SourceDocumentPart, { part });
793
+ }
794
+ if (isToolUIPart(part)) {
795
+ return overrides.tool?.(part) ?? /* @__PURE__ */ jsx(ToolCallPart, { part });
796
+ }
797
+ if (isDataUIPart(part)) {
798
+ return overrides.data?.(part) ?? /* @__PURE__ */ jsx(DataPart, { part, renderers: opts.dataRenderers });
799
+ }
800
+ if (isStepStartUIPart(part)) {
801
+ return overrides["step-start"]?.() ?? /* @__PURE__ */ jsx("hr", { className: "my-3 border-border", "aria-label": "Step boundary" });
802
+ }
803
+ return null;
804
+ }
805
+ var ChatMessage = forwardRef(
806
+ ({ message, avatar, actions, variant, partRenderers, dataRenderers, className, ...props }, ref) => {
807
+ const inner = /* @__PURE__ */ jsxs(
808
+ ChatMessageContent,
809
+ {
810
+ variant: variant ?? (message.role === "assistant" ? "contained" : void 0),
811
+ children: [
812
+ message.parts.map((part, idx) => /* @__PURE__ */ jsx("div", { children: renderPart(part, { dataRenderers, partRenderers }) }, `${part.type}-${idx}`)),
813
+ actions
814
+ ]
815
+ }
816
+ );
817
+ if (message.role === "user") {
818
+ return /* @__PURE__ */ jsxs(ChatMessageRoot, { ref, from: "user", className, ...props, children: [
819
+ inner,
820
+ avatar ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: avatar }) : null
821
+ ] });
822
+ }
823
+ return /* @__PURE__ */ jsxs(ChatMessageRoot, { ref, from: message.role, className, ...props, children: [
824
+ avatar ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: avatar }) : null,
825
+ inner
826
+ ] });
827
+ }
828
+ );
829
+ ChatMessage.displayName = "ChatMessage";
830
+ function ChatMessageActions({
831
+ className,
832
+ children,
833
+ ...props
834
+ }) {
835
+ return /* @__PURE__ */ jsx("div", { className: cn("flex items-center gap-1", className), "data-theo-chat-actions": "", ...props, children });
836
+ }
837
+ function ChatMessageAction({
838
+ tooltip,
839
+ label,
840
+ variant = "ghost",
841
+ size = "icon",
842
+ className,
843
+ children,
844
+ ...props
845
+ }) {
846
+ return /* @__PURE__ */ jsxs(
847
+ Button,
848
+ {
849
+ type: "button",
850
+ variant,
851
+ size,
852
+ title: tooltip,
853
+ className: cn(className),
854
+ ...props,
855
+ children: [
856
+ children,
857
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: label || tooltip })
858
+ ]
859
+ }
860
+ );
861
+ }
862
+ function ChatMessageToolbar({
863
+ className,
864
+ children,
865
+ ...props
866
+ }) {
867
+ return /* @__PURE__ */ jsx(
868
+ "div",
869
+ {
870
+ className: cn("mt-3 flex w-full items-center justify-between gap-3", className),
871
+ "data-theo-chat-toolbar": "",
872
+ ...props,
873
+ children
874
+ }
875
+ );
876
+ }
877
+ var MessageBranchContext = createContext(null);
878
+ function useMessageBranch() {
879
+ const ctx = useContext(MessageBranchContext);
880
+ if (!ctx) {
881
+ throw new Error("ChatMessageBranch* components must be wrapped in <ChatMessageBranch>.");
882
+ }
883
+ return ctx;
884
+ }
885
+ function ChatMessageBranch({
886
+ defaultBranch = 0,
887
+ onBranchChange,
888
+ className,
889
+ ...props
890
+ }) {
891
+ const [currentBranch, setCurrentBranch] = useState(defaultBranch);
892
+ const [branches, setBranches] = useState([]);
893
+ const handleChange = useCallback(
894
+ (next) => {
895
+ setCurrentBranch(next);
896
+ onBranchChange?.(next);
897
+ },
898
+ [onBranchChange]
899
+ );
900
+ const goToPrevious = useCallback(() => {
901
+ handleChange(currentBranch > 0 ? currentBranch - 1 : branches.length - 1);
902
+ }, [currentBranch, branches.length, handleChange]);
903
+ const goToNext = useCallback(() => {
904
+ handleChange(currentBranch < branches.length - 1 ? currentBranch + 1 : 0);
905
+ }, [currentBranch, branches.length, handleChange]);
906
+ const value = useMemo(
907
+ () => ({
908
+ branches,
909
+ currentBranch,
910
+ goToNext,
911
+ goToPrevious,
912
+ setBranches,
913
+ totalBranches: branches.length
914
+ }),
915
+ [branches, currentBranch, goToNext, goToPrevious]
916
+ );
917
+ return /* @__PURE__ */ jsx(MessageBranchContext.Provider, { value, children: /* @__PURE__ */ jsx("div", { className: cn("grid w-full gap-2", className), ...props }) });
918
+ }
919
+ function ChatMessageBranchContent({
920
+ children,
921
+ ...props
922
+ }) {
923
+ const { currentBranch, setBranches, branches } = useMessageBranch();
924
+ const childrenArray = useMemo(
925
+ () => Array.isArray(children) ? children : [children],
926
+ [children]
927
+ );
928
+ useEffect(() => {
929
+ if (branches.length !== childrenArray.length) {
930
+ setBranches(childrenArray);
931
+ }
932
+ }, [childrenArray, branches, setBranches]);
933
+ return /* @__PURE__ */ jsx(Fragment, { children: childrenArray.map((branch, idx) => /* @__PURE__ */ jsx(
934
+ "div",
935
+ {
936
+ className: cn("grid gap-2 overflow-hidden", idx === currentBranch ? "block" : "hidden"),
937
+ ...props,
938
+ children: branch
939
+ },
940
+ // Prefer a stable element key; fall back to index
941
+ branch?.key ?? `branch-${idx}`
942
+ )) });
943
+ }
944
+ function ChatMessageBranchSelector({
945
+ className,
946
+ ...props
947
+ }) {
948
+ const { totalBranches } = useMessageBranch();
949
+ if (totalBranches <= 1) return null;
950
+ return /* @__PURE__ */ jsx(
951
+ "div",
952
+ {
953
+ className: cn("inline-flex items-center gap-0.5 rounded-md border border-border", className),
954
+ role: "group",
955
+ "aria-label": "Branch selector",
956
+ ...props
957
+ }
958
+ );
959
+ }
960
+ function ChatMessageBranchPrevious({
961
+ children,
962
+ ...props
963
+ }) {
964
+ const { goToPrevious, totalBranches } = useMessageBranch();
965
+ return /* @__PURE__ */ jsx(
966
+ Button,
967
+ {
968
+ type: "button",
969
+ variant: "ghost",
970
+ size: "icon",
971
+ "aria-label": "Previous branch",
972
+ disabled: totalBranches <= 1,
973
+ onClick: goToPrevious,
974
+ ...props,
975
+ children: children ?? /* @__PURE__ */ jsx(ChevronLeftIcon, { className: "size-3.5", "aria-hidden": "true" })
976
+ }
977
+ );
978
+ }
979
+ function ChatMessageBranchNext({
980
+ children,
981
+ ...props
982
+ }) {
983
+ const { goToNext, totalBranches } = useMessageBranch();
984
+ return /* @__PURE__ */ jsx(
985
+ Button,
986
+ {
987
+ type: "button",
988
+ variant: "ghost",
989
+ size: "icon",
990
+ "aria-label": "Next branch",
991
+ disabled: totalBranches <= 1,
992
+ onClick: goToNext,
993
+ ...props,
994
+ children: children ?? /* @__PURE__ */ jsx(ChevronRightIcon, { className: "size-3.5", "aria-hidden": "true" })
995
+ }
996
+ );
997
+ }
998
+ function ChatMessageBranchPage({
999
+ className,
1000
+ ...props
1001
+ }) {
1002
+ const { currentBranch, totalBranches } = useMessageBranch();
1003
+ return /* @__PURE__ */ jsxs(
1004
+ "span",
1005
+ {
1006
+ className: cn(
1007
+ "inline-flex items-center px-2 font-mono text-label-caps text-muted-foreground",
1008
+ className
1009
+ ),
1010
+ ...props,
1011
+ children: [
1012
+ currentBranch + 1,
1013
+ " of ",
1014
+ totalBranches
1015
+ ]
1016
+ }
1017
+ );
1018
+ }
1019
+
1020
+ export { ChatMessage, ChatMessageAction, ChatMessageActions, ChatMessageBranch, ChatMessageBranchContent, ChatMessageBranchNext, ChatMessageBranchPage, ChatMessageBranchPrevious, ChatMessageBranchSelector, ChatMessageContent, ChatMessageResponse, ChatMessageRoot, ChatMessageToolbar, DataPart, FilePart, ReasoningPart, SourceDocumentPart, SourceUrlPart, TextPart, ToolCallPart, isCustomContentUIPart, isDataUIPart, isFileUIPart, isReasoningFileUIPart, isReasoningUIPart, isSourceDocumentUIPart, isSourceUrlUIPart, isStepStartUIPart, isTextUIPart, isToolUIPart, renderPart };
1021
+ //# sourceMappingURL=chunk-VI5M7KJ2.js.map
1022
+ //# sourceMappingURL=chunk-VI5M7KJ2.js.map