@pstdio/ui 0.15.0 → 0.17.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 (304) hide show
  1. package/dist/{MermaidComponent-DBJsTOmj.js → MermaidComponent-BCMQqPqu.js} +11 -11
  2. package/dist/{MermaidComponent-DBJsTOmj.js.map → MermaidComponent-BCMQqPqu.js.map} +1 -1
  3. package/dist/browser-storage-BinyFNJX.js +40 -0
  4. package/dist/browser-storage-BinyFNJX.js.map +1 -0
  5. package/dist/chat-ui.js +1832 -1275
  6. package/dist/chat-ui.js.map +1 -1
  7. package/dist/checkbox-B2zYVemL.js +70 -0
  8. package/dist/checkbox-B2zYVemL.js.map +1 -0
  9. package/dist/components/chat-ui/components/ai-conversation.d.ts +1 -1
  10. package/dist/components/chat-ui/components/ai-message.d.ts +1 -1
  11. package/dist/components/chat-ui/components/ai-response.d.ts +0 -1
  12. package/dist/components/chat-ui/components/attachment-list.d.ts +1 -1
  13. package/dist/components/chat-ui/components/auto-scroll.d.ts +27 -0
  14. package/dist/components/chat-ui/components/chat-input-actions.d.ts +1 -0
  15. package/dist/components/chat-ui/components/chat-input.d.ts +8 -2
  16. package/dist/components/chat-ui/components/chat-message-animation.d.ts +22 -0
  17. package/dist/components/chat-ui/components/chat-panel.d.ts +11 -5
  18. package/dist/components/chat-ui/components/composer-constants.d.ts +1 -0
  19. package/dist/components/chat-ui/components/conversation-browse.d.ts +22 -0
  20. package/dist/components/chat-ui/components/message-types.d.ts +14 -0
  21. package/dist/components/chat-ui/components/queued-follow-up-list-state.d.ts +4 -0
  22. package/dist/components/chat-ui/components/queued-follow-up-list.d.ts +11 -0
  23. package/dist/components/chat-ui/components/timeline.d.ts +5 -2
  24. package/dist/components/chat-ui/components/working-indicator.d.ts +9 -0
  25. package/dist/components/chat-ui/components/workspace-hub.d.ts +8 -1
  26. package/dist/components/chat-ui/index.d.ts +4 -2
  27. package/dist/components/chat-ui/performance/chat-performance-fixtures.d.ts +0 -1
  28. package/dist/components/chat-ui/tool-rendering/build-timeline.d.ts +4 -14
  29. package/dist/components/chat-ui/tool-rendering/question-prompt.d.ts +9 -0
  30. package/dist/components/chat-ui/tool-rendering/shared.d.ts +1 -1
  31. package/dist/components/chat-ui/tool-rendering/types.d.ts +1 -2
  32. package/dist/components/command-palette/index.d.ts +4 -0
  33. package/dist/components/data-table/build-columns.d.ts +13 -2
  34. package/dist/components/data-table/categorical-color-cell.d.ts +8 -0
  35. package/dist/components/data-table/color-cell-style.d.ts +13 -0
  36. package/dist/components/data-table/color-scale-cell.d.ts +7 -0
  37. package/dist/components/data-table/data-table-column-menu.d.ts +12 -0
  38. package/dist/components/data-table/data-table-header.d.ts +18 -0
  39. package/dist/components/data-table/data-table-stat-chart.d.ts +21 -0
  40. package/dist/components/data-table/data-table-state.d.ts +27 -0
  41. package/dist/components/data-table/data-table-stats-row.d.ts +11 -0
  42. package/dist/components/data-table/data-table-stats.d.ts +19 -0
  43. package/dist/components/data-table/data-table-table-parts.d.ts +21 -0
  44. package/dist/components/data-table/data-table.story-descriptions.d.ts +6 -0
  45. package/dist/components/data-table/data-table.story-fixtures.d.ts +6 -0
  46. package/dist/components/data-table/friendly-json-display.d.ts +31 -0
  47. package/dist/components/data-table/index.d.ts +3 -1
  48. package/dist/components/data-table/json-cell.d.ts +6 -0
  49. package/dist/components/data-table/pagination-footer.d.ts +4 -1
  50. package/dist/components/data-table/selection-toolbar.d.ts +3 -1
  51. package/dist/components/data-table/types.d.ts +72 -0
  52. package/dist/components/diff-viewer/diff-card.d.ts +1 -0
  53. package/dist/components/diff-viewer/diff-drawer-scroll.d.ts +0 -19
  54. package/dist/components/diff-viewer/diff-drawer.d.ts +1 -0
  55. package/dist/components/diff-viewer/index.d.ts +2 -0
  56. package/dist/components/diff-viewer/use-selected-diff-scroll.d.ts +7 -3
  57. package/dist/components/internal/style-guide.d.ts +14 -0
  58. package/dist/components/internal/token-editor-controls.d.ts +8 -0
  59. package/dist/components/internal/token-editor-data.d.ts +40 -0
  60. package/dist/components/internal/token-editor-state.d.ts +22 -0
  61. package/dist/components/{data-renderer → kanban-renderer}/display-menu.d.ts +4 -4
  62. package/dist/components/{data-renderer → kanban-renderer}/filter-menu.d.ts +3 -3
  63. package/dist/components/kanban-renderer/index.d.ts +19 -0
  64. package/dist/components/kanban-renderer/kanban-renderer-attribute-badge.d.ts +7 -0
  65. package/dist/components/{data-renderer/data-renderer-board-column-header.d.ts → kanban-renderer/kanban-renderer-board-column-header.d.ts} +2 -2
  66. package/dist/components/{data-renderer/data-renderer-board-group-section.d.ts → kanban-renderer/kanban-renderer-board-group-section.d.ts} +2 -2
  67. package/dist/components/{data-renderer/data-renderer-board-move.d.ts → kanban-renderer/kanban-renderer-board-move.d.ts} +3 -3
  68. package/dist/components/{data-renderer/data-renderer-board.d.ts → kanban-renderer/kanban-renderer-board.d.ts} +16 -15
  69. package/dist/components/{data-renderer/data-renderer-card.d.ts → kanban-renderer/kanban-renderer-card.d.ts} +5 -4
  70. package/dist/components/{data-renderer/data-renderer-content.d.ts → kanban-renderer/kanban-renderer-content.d.ts} +8 -8
  71. package/dist/components/kanban-renderer/kanban-renderer-create-dialog.d.ts +12 -0
  72. package/dist/components/kanban-renderer/kanban-renderer-create-field.d.ts +10 -0
  73. package/dist/components/kanban-renderer/kanban-renderer-grouping.d.ts +23 -0
  74. package/dist/components/{data-renderer/data-renderer-helpers.d.ts → kanban-renderer/kanban-renderer-helpers.d.ts} +15 -15
  75. package/dist/components/kanban-renderer/kanban-renderer-list-items.d.ts +25 -0
  76. package/dist/components/kanban-renderer/kanban-renderer-list.d.ts +43 -0
  77. package/dist/components/{data-renderer/data-renderer-story-fixtures.d.ts → kanban-renderer/kanban-renderer-story-fixtures.d.ts} +3 -2
  78. package/dist/components/kanban-renderer/kanban-renderer-toolbar.d.ts +15 -0
  79. package/dist/components/kanban-renderer/kanban-renderer-view-bar.d.ts +14 -0
  80. package/dist/components/kanban-renderer/kanban-renderer-views.d.ts +12 -0
  81. package/dist/components/{data-renderer/data-renderer.d.ts → kanban-renderer/kanban-renderer.d.ts} +12 -9
  82. package/dist/components/{data-renderer → kanban-renderer}/types.d.ts +51 -14
  83. package/dist/components/kanban-renderer/use-kanban-renderer-store.d.ts +78 -0
  84. package/dist/components/layout/index.d.ts +7 -0
  85. package/dist/components/layout/panel-header.constants.d.ts +3 -0
  86. package/dist/components/{resizable-split-layout.d.ts → layout/resizable-split-layout.d.ts} +3 -2
  87. package/dist/components/layout/resizable-split-layout.geometry.d.ts +56 -0
  88. package/dist/components/{resizable-split-layout.handle.d.ts → layout/resizable-split-layout.handle.d.ts} +6 -2
  89. package/dist/components/layout/resizable-split-layout.panels.d.ts +25 -0
  90. package/dist/components/list-row/list-row-actions.d.ts +1 -0
  91. package/dist/components/list-row/list-row-content.d.ts +7 -0
  92. package/dist/components/list-row/list-row.types.d.ts +4 -1
  93. package/dist/components/overlays/attached-menu.d.ts +6 -0
  94. package/dist/components/overlays/attachment-chip.d.ts +13 -0
  95. package/dist/components/overlays/index.d.ts +16 -0
  96. package/dist/components/{resource-context-menu.d.ts → overlays/resource-context-menu.d.ts} +13 -1
  97. package/dist/components/{search-modal-content.d.ts → overlays/search-modal-content.d.ts} +1 -1
  98. package/dist/components/{searchable-menu.d.ts → overlays/searchable-menu.d.ts} +1 -1
  99. package/dist/components/param-editor/index.d.ts +24 -0
  100. package/dist/components/param-editor/inputs/action-input.d.ts +13 -0
  101. package/dist/components/param-editor/inputs/anchor-grid-input.d.ts +12 -0
  102. package/dist/components/param-editor/inputs/anchor-grid.d.ts +4 -0
  103. package/dist/components/param-editor/inputs/file-accept.d.ts +22 -0
  104. package/dist/components/param-editor/inputs/file-drop-input.d.ts +14 -0
  105. package/dist/components/param-editor/inputs/numeric-value.d.ts +6 -0
  106. package/dist/components/param-editor/inputs/range-input.d.ts +17 -0
  107. package/dist/components/param-editor/inputs/range-value.d.ts +5 -0
  108. package/dist/components/param-editor/inputs/resource-input-chips.d.ts +15 -0
  109. package/dist/components/param-editor/inputs/resource-input.d.ts +18 -0
  110. package/dist/components/param-editor/inputs/segmented-input.d.ts +14 -0
  111. package/dist/components/param-editor/{selection-input.d.ts → inputs/selection-input.d.ts} +6 -6
  112. package/dist/components/param-editor/inputs/selection-menu.d.ts +29 -0
  113. package/dist/components/param-editor/inputs/slider-marks.d.ts +5 -0
  114. package/dist/components/param-editor/inputs/vector-input.d.ts +17 -0
  115. package/dist/components/param-editor/inputs/vector-value.d.ts +7 -0
  116. package/dist/components/param-editor/param-editor-control-item.d.ts +15 -0
  117. package/dist/components/param-editor/param-editor-control-list.d.ts +5 -0
  118. package/dist/components/param-editor/param-editor-field-label.d.ts +1 -0
  119. package/dist/components/param-editor/param-editor-field.d.ts +11 -0
  120. package/dist/components/param-editor/param-editor-horizontal.d.ts +1 -0
  121. package/dist/components/param-editor/param-editor-inline-group.d.ts +5 -0
  122. package/dist/components/param-editor/param-editor-read-only-field.d.ts +9 -0
  123. package/dist/components/param-editor/param-editor-section.d.ts +17 -0
  124. package/dist/components/param-editor/param-editor.d.ts +3 -1
  125. package/dist/components/param-editor/param-editor.types.d.ts +135 -24
  126. package/dist/components/{breadcrumb.d.ts → primitives/breadcrumb.d.ts} +1 -1
  127. package/dist/components/primitives/index.d.ts +28 -0
  128. package/dist/components/{number-input.d.ts → primitives/number-input.d.ts} +0 -2
  129. package/dist/components/{session-indicator.d.ts → primitives/session-indicator.d.ts} +2 -1
  130. package/dist/components/{tooltip.d.ts → primitives/tooltip.d.ts} +0 -1
  131. package/dist/components/rich-text/prompt-input/commands.d.ts +0 -17
  132. package/dist/components/rich-text/prompt-input/events.d.ts +0 -13
  133. package/dist/components/rich-text/prompt-input/plugins/CommentPlugin/nodes/CommentNode/CommentNode.d.ts +1 -2
  134. package/dist/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/ReferenceMenuPlugin.d.ts +2 -1
  135. package/dist/components/rich-text/prompt-input/plugins/ReferenceMenuPlugin/hooks/useContextLookup.d.ts +2 -1
  136. package/dist/components/rich-text/prompt-input/plugins/ReferencePlugin/ReferencePlugin.d.ts +2 -1
  137. package/dist/components/rich-text/prompt-input/plugins/ReferencePlugin/nodes/ReferenceNode/ReferenceNode.d.ts +1 -2
  138. package/dist/components/rich-text/prompt-input/prompt-input.d.ts +3 -2
  139. package/dist/components/rich-text/prompt-input/utils.d.ts +1 -2
  140. package/dist/components/rich-text/shared/plugins/MermaidPlugin/MermaidNode.d.ts +0 -1
  141. package/dist/components/rich-text/types.d.ts +1 -1
  142. package/dist/components/rich-text/utils/inferResourceType.d.ts +1 -1
  143. package/dist/components/{sidebar/sidebar-footer.d.ts → sidenav/sidenav-footer.d.ts} +2 -2
  144. package/dist/components/{sidebar/sidebar-header.d.ts → sidenav/sidenav-header.d.ts} +2 -2
  145. package/dist/components/sidenav/sidenav.d.ts +2 -0
  146. package/dist/components/sidenav/sidenav.store.d.ts +49 -0
  147. package/dist/components/{sidebar/sidebar.types.d.ts → sidenav/sidenav.types.d.ts} +6 -6
  148. package/dist/components/tab-strip/tab-visibility-filter.d.ts +2 -1
  149. package/dist/components/tag-editor/tag-editor-row.d.ts +1 -1
  150. package/dist/components/tag-editor/tag-editor.types.d.ts +1 -1
  151. package/dist/components/terminal/bind-session.d.ts +33 -0
  152. package/dist/components/terminal/index.d.ts +6 -0
  153. package/dist/components/terminal/scripted-bridge.d.ts +35 -0
  154. package/dist/components/terminal/terminal-contract.d.ts +22 -0
  155. package/dist/components/terminal/terminal-theme.d.ts +12 -0
  156. package/dist/components/terminal/terminal.d.ts +56 -0
  157. package/dist/components/terminal/types.d.ts +35 -0
  158. package/dist/components/terminal/use-terminal-session.d.ts +21 -0
  159. package/dist/components/tree-list/tree-list-order-filter.d.ts +1 -2
  160. package/dist/components/tree-list/tree-list-visibility-filter.d.ts +1 -2
  161. package/dist/components/tree-list/tree-list.d.ts +2 -2
  162. package/dist/components/tree-list/tree-list.types.d.ts +4 -0
  163. package/dist/data-table.js +1271 -0
  164. package/dist/data-table.js.map +1 -0
  165. package/dist/diff-editor-BnfV8cYB.js +182 -0
  166. package/dist/diff-editor-BnfV8cYB.js.map +1 -0
  167. package/dist/diff.js +1313 -0
  168. package/dist/diff.js.map +1 -0
  169. package/dist/empty-state-Bo4HVrgr.js +34 -0
  170. package/dist/empty-state-Bo4HVrgr.js.map +1 -0
  171. package/dist/foundations/gallery/gallery-frame.d.ts +21 -0
  172. package/dist/foundations/gallery/sections/badges-section.d.ts +1 -0
  173. package/dist/foundations/gallery/sections/buttons-section.d.ts +1 -0
  174. package/dist/foundations/gallery/sections/composite-chat-section.d.ts +1 -0
  175. package/dist/foundations/gallery/sections/composites-section.d.ts +1 -0
  176. package/dist/foundations/gallery/sections/feedback-section.d.ts +1 -0
  177. package/dist/foundations/gallery/sections/input-authoring-card.d.ts +1 -0
  178. package/dist/foundations/gallery/sections/inputs-section.d.ts +1 -0
  179. package/dist/foundations/gallery/sections/layout-section.d.ts +1 -0
  180. package/dist/foundations/gallery/sections/navigation-identity-section.d.ts +1 -0
  181. package/dist/foundations/gallery/sections/overlays-section.d.ts +1 -0
  182. package/dist/foundations/gallery/sections/panels-section.d.ts +1 -0
  183. package/dist/foundations/gallery/sections/param-editor-composite-card.d.ts +1 -0
  184. package/dist/foundations/gallery/sections/settings-composite-cards.d.ts +1 -0
  185. package/dist/index.d.ts +14 -87
  186. package/dist/index.js +2027 -7501
  187. package/dist/index.js.map +1 -1
  188. package/dist/kanban-renderer-toolbar-B9ro-9z1.js +1318 -0
  189. package/dist/kanban-renderer-toolbar-B9ro-9z1.js.map +1 -0
  190. package/dist/kanban-renderer.js +1087 -0
  191. package/dist/kanban-renderer.js.map +1 -0
  192. package/dist/list-row-YRUxEcy3.js +808 -0
  193. package/dist/list-row-YRUxEcy3.js.map +1 -0
  194. package/dist/mermaid-renderer-DZo3qj6D.js +425 -0
  195. package/dist/mermaid-renderer-DZo3qj6D.js.map +1 -0
  196. package/dist/mermaid.js +5 -0
  197. package/dist/mermaid.js.map +1 -0
  198. package/dist/param-editor-CYZJbmKu.js +933 -0
  199. package/dist/param-editor-CYZJbmKu.js.map +1 -0
  200. package/dist/param-editor-read-only-field-DgtLqcFa.js +925 -0
  201. package/dist/param-editor-read-only-field-DgtLqcFa.js.map +1 -0
  202. package/dist/prism-BXb57lxL.js +125 -0
  203. package/dist/prism-BXb57lxL.js.map +1 -0
  204. package/dist/radio-cLMEBBZk.js +76 -0
  205. package/dist/radio-cLMEBBZk.js.map +1 -0
  206. package/dist/resource-badge-qCWHP-wQ.js +99 -0
  207. package/dist/resource-badge-qCWHP-wQ.js.map +1 -0
  208. package/dist/{rich-message-DNSEhxXh.js → rich-message-DBf_5YlW.js} +462 -481
  209. package/dist/rich-message-DBf_5YlW.js.map +1 -0
  210. package/dist/rich-text.js +300 -299
  211. package/dist/rich-text.js.map +1 -1
  212. package/dist/scroll-area-BMbg1WcD.js +91 -0
  213. package/dist/scroll-area-BMbg1WcD.js.map +1 -0
  214. package/dist/style.css +1 -1
  215. package/dist/terminal.js +359 -0
  216. package/dist/terminal.js.map +1 -0
  217. package/dist/theme/global.d.ts +3 -0
  218. package/dist/theme/primitives/sizes.d.ts +23 -0
  219. package/dist/theme/recipes/badge.d.ts +50 -0
  220. package/dist/theme/recipes/button.d.ts +30 -19
  221. package/dist/theme/recipes/color-picker.d.ts +1 -0
  222. package/dist/theme/recipes/dialog.d.ts +1 -1
  223. package/dist/theme/recipes/drawer.d.ts +1 -1
  224. package/dist/theme/recipes/input.d.ts +55 -0
  225. package/dist/theme/recipes/number-input.d.ts +98 -0
  226. package/dist/theme/recipes/tabs.d.ts +49 -28
  227. package/dist/theme/recipes/textarea.d.ts +62 -1
  228. package/dist/theme/recipes/timeline.d.ts +74 -0
  229. package/dist/theme/tokens/borders.d.ts +0 -3
  230. package/dist/theme/tokens/colors.d.ts +118 -94
  231. package/dist/{theme-25P7ij4C.js → theme-CNhnbvcE.js} +1300 -375
  232. package/dist/theme-CNhnbvcE.js.map +1 -0
  233. package/dist/theme-preference-DOzHx64J.js +123 -0
  234. package/dist/theme-preference-DOzHx64J.js.map +1 -0
  235. package/dist/theme.js +1 -1
  236. package/dist/tree-list-CZHLAURU.js +1033 -0
  237. package/dist/tree-list-CZHLAURU.js.map +1 -0
  238. package/package.json +29 -3
  239. package/dist/components/data-renderer/card-interaction-guard.d.ts +0 -2
  240. package/dist/components/data-renderer/data-renderer-attribute-badge.d.ts +0 -7
  241. package/dist/components/data-renderer/data-renderer-grouping.d.ts +0 -23
  242. package/dist/components/data-renderer/data-renderer-list.d.ts +0 -39
  243. package/dist/components/data-renderer/data-renderer-toolbar.d.ts +0 -12
  244. package/dist/components/data-renderer/use-data-renderer-store.d.ts +0 -59
  245. package/dist/components/file-tree-helpers.d.ts +0 -8
  246. package/dist/components/open-source-notices-screen.d.ts +0 -20
  247. package/dist/components/panel-header.constants.d.ts +0 -1
  248. package/dist/components/param-editor/input-group.d.ts +0 -10
  249. package/dist/components/rich-text/shared/plugins/MermaidPlugin/index.d.ts +0 -1
  250. package/dist/components/rich-text/shared/plugins/TableActionMenuPlugin/TableActionMenuPlugin.d.ts +0 -5
  251. package/dist/components/rich-text/shared/plugins/TableCellResizerPlugin/TableCellResizerPlugin.d.ts +0 -2
  252. package/dist/components/rich-text/theme/report-theme.d.ts +0 -3
  253. package/dist/components/sidebar/sidebar.d.ts +0 -2
  254. package/dist/components/sidebar/sidebar.store.d.ts +0 -49
  255. package/dist/components/style-guide-data.d.ts +0 -40
  256. package/dist/components/style-guide.d.ts +0 -1
  257. package/dist/mermaid-renderer-CPGj6vsb.js +0 -570
  258. package/dist/mermaid-renderer-CPGj6vsb.js.map +0 -1
  259. package/dist/radio-DJtQY9po.js +0 -286
  260. package/dist/radio-DJtQY9po.js.map +0 -1
  261. package/dist/resource-badge-CeJTOn8F.js +0 -188
  262. package/dist/resource-badge-CeJTOn8F.js.map +0 -1
  263. package/dist/rich-message-DNSEhxXh.js.map +0 -1
  264. package/dist/theme-25P7ij4C.js.map +0 -1
  265. package/dist/utils/formats.d.ts +0 -7
  266. /package/dist/components/{palette-filter.d.ts → command-palette/palette-filter.d.ts} +0 -0
  267. /package/dist/components/{palette-list.d.ts → command-palette/palette-list.d.ts} +0 -0
  268. /package/dist/components/{palette-shortcut.d.ts → command-palette/palette-shortcut.d.ts} +0 -0
  269. /package/dist/components/{palette.d.ts → command-palette/palette.d.ts} +0 -0
  270. /package/dist/components/{code-editor.d.ts → diff-viewer/code-editor.d.ts} +0 -0
  271. /package/dist/components/{column-file-browser.d.ts → file-browser/column-file-browser.d.ts} +0 -0
  272. /package/dist/components/{performance-panel.d.ts → internal/performance-panel.d.ts} +0 -0
  273. /package/dist/components/{data-renderer/data-renderer-badge-helpers.d.ts → kanban-renderer/kanban-renderer-badge-helpers.d.ts} +0 -0
  274. /package/dist/components/{data-renderer/data-renderer-enum-helpers.d.ts → kanban-renderer/kanban-renderer-enum-helpers.d.ts} +0 -0
  275. /package/dist/components/{data-renderer → kanban-renderer}/use-resolved-attributes.d.ts +0 -0
  276. /package/dist/components/{header.d.ts → layout/header.d.ts} +0 -0
  277. /package/dist/components/{horizontal-menu-stack.d.ts → layout/horizontal-menu-stack.d.ts} +0 -0
  278. /package/dist/components/{item-section.d.ts → layout/item-section.d.ts} +0 -0
  279. /package/dist/components/{attached-panel.d.ts → overlays/attached-panel.d.ts} +0 -0
  280. /package/dist/components/{bubble-button.d.ts → overlays/bubble-button.d.ts} +0 -0
  281. /package/dist/components/{bubble-panel.d.ts → overlays/bubble-panel.d.ts} +0 -0
  282. /package/dist/components/{delete-confirmation-modal.d.ts → overlays/delete-confirmation-modal.d.ts} +0 -0
  283. /package/dist/components/{repo-picker-dialog.d.ts → overlays/repo-picker-dialog.d.ts} +0 -0
  284. /package/dist/components/param-editor/{color-input.d.ts → inputs/color-input.d.ts} +0 -0
  285. /package/dist/components/param-editor/{date-input.d.ts → inputs/date-input.d.ts} +0 -0
  286. /package/dist/components/param-editor/{horizontal-text-input.d.ts → inputs/horizontal-text-input.d.ts} +0 -0
  287. /package/dist/components/param-editor/{number-input.d.ts → inputs/number-input.d.ts} +0 -0
  288. /package/dist/components/param-editor/{text-input.d.ts → inputs/text-input.d.ts} +0 -0
  289. /package/dist/components/{alert.d.ts → primitives/alert.d.ts} +0 -0
  290. /package/dist/components/{checkbox.d.ts → primitives/checkbox.d.ts} +0 -0
  291. /package/dist/components/{content-placeholder.d.ts → primitives/content-placeholder.d.ts} +0 -0
  292. /package/dist/components/{empty-state.d.ts → primitives/empty-state.d.ts} +0 -0
  293. /package/dist/components/{error-boundary.d.ts → primitives/error-boundary.d.ts} +0 -0
  294. /package/dist/components/{icon-color-picker.d.ts → primitives/icon-color-picker.d.ts} +0 -0
  295. /package/dist/components/{info-card.d.ts → primitives/info-card.d.ts} +0 -0
  296. /package/dist/components/{integration-card.d.ts → primitives/integration-card.d.ts} +0 -0
  297. /package/dist/components/{radio.d.ts → primitives/radio.d.ts} +0 -0
  298. /package/dist/components/{resource-badge.d.ts → primitives/resource-badge.d.ts} +0 -0
  299. /package/dist/components/{scroll-area.d.ts → primitives/scroll-area.d.ts} +0 -0
  300. /package/dist/components/{simple-card.d.ts → primitives/simple-card.d.ts} +0 -0
  301. /package/dist/components/{slider.d.ts → primitives/slider.d.ts} +0 -0
  302. /package/dist/components/{switch.d.ts → primitives/switch.d.ts} +0 -0
  303. /package/dist/components/{toaster.d.ts → primitives/toaster.d.ts} +0 -0
  304. /package/dist/components/{workspace-badge.d.ts → primitives/workspace-badge.d.ts} +0 -0
package/dist/chat-ui.js CHANGED
@@ -1,47 +1,23 @@
1
- import { jsx as a, jsxs as k, Fragment as Ot } from "react/jsx-runtime";
2
- import { c as T } from "react/compiler-runtime";
3
- import { chakra as Fn, AbsoluteCenter as zn, IconButton as $t, defineSlotRecipe as qn, createSlotRecipeContext as Hn, Text as X, Code as jt, Button as Ze, HStack as Me, Box as I, Flex as Re, Stack as Y, Textarea as Qn, Tooltip as dt, Portal as Wn, Kbd as Nn, Spacer as Vn, Timeline as jn, Span as Je, Avatar as We, Card as ue, Link as sn, Spinner as Ft, Image as Un, Skeleton as Kn } from "@chakra-ui/react";
4
- import { ArrowDownIcon as Gn, ShieldX as Xn, ShieldCheck as Yn, Check as rn, Square as Jn, ArrowUp as Zn, Copy as eo, Move as to, FileDown as no, FileUp as oo, FileDiff as so, Trash2 as ro, FilePen as io, FileText as lo, ListTree as ao, Terminal as ln, ListTodo as co, CircleQuestionMark as uo, File as fo, Globe as po, Search as mo, AlertTriangle as an, DotIcon as ho, ChevronUpIcon as go, MessageCircleIcon as bo } from "lucide-react";
5
- import { StickToBottom as yo, useStickToBottomContext as mt } from "use-stick-to-bottom";
6
- import { S as ht, R as zt, T as cn } from "./resource-badge-CeJTOn8F.js";
7
- import { Fragment as xo, useRef as Ne, useEffect as Ae, useState as G } from "react";
8
- import { i as Mt, P as So, h as To, R as un } from "./rich-message-DNSEhxXh.js";
9
- import "@lexical/react/LexicalCollaborationContext";
10
- import "@lexical/react/LexicalCollaborationPlugin";
11
- import "@lexical/react/LexicalComposer";
12
- import "@lexical/react/LexicalErrorBoundary";
13
- import "@lexical/react/LexicalHorizontalRulePlugin";
14
- import "@lexical/react/LexicalLinkPlugin";
15
- import "@lexical/react/LexicalListPlugin";
16
- import "@lexical/react/LexicalRichTextPlugin";
17
- import "@lexical/react/LexicalTabIndentationPlugin";
18
- import "y-websocket";
19
- import "yjs";
20
- import "@lexical/react/LexicalComposerContext";
21
- import "@lexical/utils";
22
- import "lexical";
23
- import "react-dom";
24
- import "@lexical/code";
25
- import "@lexical/link";
26
- import "@lexical/list";
27
- import "@lexical/rich-text";
28
- import "@lexical/selection";
29
- import "@lexical/markdown";
30
- import "@lexical/react/LexicalAutoFocusPlugin";
31
- import "@lexical/react/LexicalCheckListPlugin";
32
- import "@lexical/react/LexicalHistoryPlugin";
33
- import "@lexical/react/LexicalMarkdownShortcutPlugin";
34
- import "@lexical/react/LexicalOnChangePlugin";
35
- import "@lexical/react/LexicalTreeView";
36
- import "@lexical/react/LexicalClickableLinkPlugin";
37
- import { C as dn, R as wo, a as ko, D as Co, b as fn, A as Ut, E as Ao } from "./radio-DJtQY9po.js";
38
- import { useVirtualizer as _o } from "@tanstack/react-virtual";
39
- const Ro = {
1
+ import { jsx as c, jsxs as A, Fragment as tn } from "react/jsx-runtime";
2
+ import { c as k } from "react/compiler-runtime";
3
+ import { AbsoluteCenter as ms, IconButton as nt, chakra as _n, createSlotRecipeContext as hs, defineSlotRecipe as gs, Text as j, Code as dn, Button as ft, HStack as ae, Box as B, Flex as Qe, Stack as X, Textarea as bs, Tooltip as Ct, Portal as vn, Kbd as ys, Spacer as xs, Timeline as Ss, Span as dt, Avatar as st, Image as Rn, Card as ie, Link as Mn, Spinner as nn, Badge as ws, Icon as Wt, Skeleton as Ts } from "@chakra-ui/react";
4
+ import { ArrowDownIcon as Cs, ShieldX as ks, ShieldCheck as As, Check as Pn, Pause as Is, ArrowUp as _s, Copy as vs, Move as Rs, FileDown as Ms, FileUp as Ps, FileDiff as Es, Trash2 as En, FilePen as Ds, FileText as Bs, ListTree as Fs, Terminal as Dn, ListTodo as Ls, CircleQuestionMark as $s, File as Os, Globe as zs, Search as Qs, AlertTriangle as Bn, DotIcon as qs, ChevronUpIcon as Hs, GripVertical as Ws, Pencil as Vs, MessageCircleIcon as Ns } from "lucide-react";
5
+ import { useStickToBottomContext as It, StickToBottom as js } from "use-stick-to-bottom";
6
+ import { S as _t, T as Fn } from "./scroll-area-BMbg1WcD.js";
7
+ import { Fragment as Us, useRef as Te, useEffect as le, useState as W } from "react";
8
+ import { R as sn } from "./resource-badge-qCWHP-wQ.js";
9
+ import { h as Vt, P as Ks, g as Gs, R as Ln } from "./rich-message-DBf_5YlW.js";
10
+ import { C as $n } from "./checkbox-B2zYVemL.js";
11
+ import { R as Xs, a as Ys, A as fn } from "./radio-cLMEBBZk.js";
12
+ import { E as Js } from "./empty-state-Bo4HVrgr.js";
13
+ import { useVirtualizer as Zs } from "@tanstack/react-virtual";
14
+ import { D as eo, a as to } from "./diff-editor-BnfV8cYB.js";
15
+ const no = {
40
16
  "aria-roledescription": "conversation",
41
17
  initial: "instant",
42
18
  resize: "instant",
43
19
  role: "log"
44
- }, Io = Fn(yo, {
20
+ }, so = _n(js, {
45
21
  base: {
46
22
  position: "relative",
47
23
  flex: 1,
@@ -50,44 +26,44 @@ const Ro = {
50
26
  }
51
27
  }, {
52
28
  forwardProps: ["initial", "resize"],
53
- defaultProps: Ro
54
- }), Po = (t) => {
55
- const e = T(10);
56
- let n, s;
29
+ defaultProps: no
30
+ }), oo = (t) => {
31
+ const e = k(10);
32
+ let n, o;
57
33
  e[0] !== t ? ({
58
34
  children: n,
59
- ...s
60
- } = t, e[0] = t, e[1] = n, e[2] = s) : (n = e[1], s = e[2]);
35
+ ...o
36
+ } = t, e[0] = t, e[1] = n, e[2] = o) : (n = e[1], o = e[2]);
61
37
  const {
62
- contentRef: o,
38
+ contentRef: s,
63
39
  scrollRef: r
64
- } = mt(), i = r, l = o;
65
- let c, u;
66
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = {
40
+ } = It(), i = r, l = s;
41
+ let a, u;
42
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = {
67
43
  zIndex: 2
68
44
  }, u = {
69
45
  py: "sm",
70
46
  "aria-live": "polite",
71
47
  role: "list"
72
- }, e[3] = c, e[4] = u) : (c = e[3], u = e[4]);
48
+ }, e[3] = a, e[4] = u) : (a = e[3], u = e[4]);
73
49
  let d;
74
- return e[5] !== n || e[6] !== s || e[7] !== i || e[8] !== l ? (d = /* @__PURE__ */ a(ht, { ...s, height: "full", width: "full", showHorizontalScrollbar: !1, viewportRef: i, contentRef: l, verticalScrollbarProps: c, contentProps: u, children: n }), e[5] = n, e[6] = s, e[7] = i, e[8] = l, e[9] = d) : d = e[9], d;
75
- }, Mo = {
50
+ return e[5] !== n || e[6] !== o || e[7] !== i || e[8] !== l ? (d = /* @__PURE__ */ c(_t, { ...o, height: "full", width: "full", showHorizontalScrollbar: !1, viewportRef: i, contentRef: l, verticalScrollbarProps: a, contentProps: u, children: n }), e[5] = n, e[6] = o, e[7] = i, e[8] = l, e[9] = d) : d = e[9], d;
51
+ }, ro = {
76
52
  axis: "horizontal",
77
53
  bottom: "md",
78
54
  zIndex: 2
79
- }, Eo = (t) => {
80
- const e = T(4), {
55
+ }, io = (t) => {
56
+ const e = k(4), {
81
57
  isAtBottom: n,
82
- scrollToBottom: s
83
- } = mt();
84
- let o;
85
- return e[0] !== n || e[1] !== t || e[2] !== s ? (o = !n && /* @__PURE__ */ a(zn, { ...Mo, children: /* @__PURE__ */ a($t, { rounded: "full", onClick: () => s(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ a(Gn, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = s, e[3] = o) : o = e[3], o;
86
- }, Et = {
87
- Root: Io,
88
- Viewport: Po,
89
- ScrollToBottom: Eo
90
- }, vo = qn({
58
+ scrollToBottom: o
59
+ } = It();
60
+ let s;
61
+ return e[0] !== n || e[1] !== t || e[2] !== o ? (s = !n && /* @__PURE__ */ c(ms, { ...ro, children: /* @__PURE__ */ c(nt, { rounded: "full", onClick: () => o(), variant: "outline", size: "xs", ...t, children: /* @__PURE__ */ c(Cs, { size: 16 }) }) }), e[0] = n, e[1] = t, e[2] = o, e[3] = s) : s = e[3], s;
62
+ }, Nt = {
63
+ Root: so,
64
+ Viewport: oo,
65
+ ScrollToBottom: io
66
+ }, lo = gs({
91
67
  className: "ai-message",
92
68
  slots: ["root", "content"],
93
69
  base: {
@@ -97,9 +73,6 @@ const Ro = {
97
73
  alignItems: "end",
98
74
  justifyContent: "end",
99
75
  gap: "sm",
100
- animationName: "message-fade-in",
101
- animationDuration: "200ms",
102
- animationTimingFunction: "ease-out",
103
76
  "&:has(+ [data-scope='ai-message'][data-part='root'])": {
104
77
  mb: 0
105
78
  }
@@ -125,7 +98,7 @@ const Ro = {
125
98
  borderRightWidth: "1px",
126
99
  borderBottomWidth: "1px",
127
100
  borderLeftWidth: "1px",
128
- borderColor: "border.muted",
101
+ borderColor: "border.subtle",
129
102
  bg: "bg.subtle",
130
103
  px: "xs",
131
104
  py: "xs",
@@ -197,681 +170,818 @@ const Ro = {
197
170
  shape: "rounded"
198
171
  }
199
172
  }), {
200
- withProvider: Lo,
201
- withContext: Do
202
- } = Hn({
203
- recipe: vo
204
- }), Bo = Lo("div", "root"), Oo = Do("div", "content"), _e = {
205
- Root: Bo,
206
- Content: Oo
207
- }, $o = (t) => {
173
+ withProvider: ao,
174
+ withContext: co
175
+ } = hs({
176
+ recipe: lo
177
+ }), uo = ao("div", "root"), fo = co("div", "content"), ze = {
178
+ Root: uo,
179
+ Content: fo
180
+ }, po = (t) => {
208
181
  if (t == null) return null;
209
182
  const e = typeof t == "string" ? t : JSON.stringify(t, null, 2);
210
183
  return e.length === 0 ? null : e.length > 200 ? `${e.slice(0, 200)}...` : e;
211
- }, cl = (t) => {
212
- const e = T(19), {
184
+ }, Gl = (t) => {
185
+ const e = k(19), {
213
186
  toolName: n,
214
- toolInput: s,
215
- onApprove: o,
187
+ toolInput: o,
188
+ onApprove: s,
216
189
  onDeny: r
217
190
  } = t;
218
191
  let i;
219
- e[0] !== s ? (i = $o(s), e[0] = s, e[1] = i) : i = e[1];
192
+ e[0] !== o ? (i = po(o), e[0] = o, e[1] = i) : i = e[1];
220
193
  const l = i;
221
- let c;
222
- e[2] !== n ? (c = /* @__PURE__ */ k(X, { textStyle: "label/S/medium", color: "fg", children: [
194
+ let a;
195
+ e[2] !== n ? (a = /* @__PURE__ */ A(j, { textStyle: "label/S/medium", color: "fg", children: [
223
196
  "Allow ",
224
- /* @__PURE__ */ a(jt, { size: "sm", children: n }),
197
+ /* @__PURE__ */ c(dn, { size: "sm", children: n }),
225
198
  "?"
226
- ] }), e[2] = n, e[3] = c) : c = e[3];
199
+ ] }), e[2] = n, e[3] = a) : a = e[3];
227
200
  let u;
228
- e[4] !== l ? (u = l ? /* @__PURE__ */ a(ht, { maxH: "6rem", children: /* @__PURE__ */ a(jt, { size: "sm", whiteSpace: "pre-wrap", display: "block", width: "100%", children: l }) }) : null, e[4] = l, e[5] = u) : u = e[5];
201
+ e[4] !== l ? (u = l ? /* @__PURE__ */ c(_t, { maxH: "6rem", children: /* @__PURE__ */ c(dn, { size: "sm", whiteSpace: "pre-wrap", display: "block", width: "100%", children: l }) }) : null, e[4] = l, e[5] = u) : u = e[5];
229
202
  let d;
230
- e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ a(Xn, { size: 14 }), e[6] = d) : d = e[6];
203
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ c(ks, { size: 14 }), e[6] = d) : d = e[6];
231
204
  let f;
232
- e[7] !== r ? (f = /* @__PURE__ */ k(Ze, { size: "xs", variant: "outline", onClick: r, children: [
205
+ e[7] !== r ? (f = /* @__PURE__ */ A(ft, { size: "xs", variant: "outline", onClick: r, children: [
233
206
  d,
234
207
  "Deny"
235
208
  ] }), e[7] = r, e[8] = f) : f = e[8];
236
- let m;
237
- e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ a(Yn, { size: 14 }), e[9] = m) : m = e[9];
238
209
  let p;
239
- e[10] !== o ? (p = /* @__PURE__ */ k(Ze, { size: "xs", colorPalette: "green", onClick: o, children: [
240
- m,
210
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ c(As, { size: 14 }), e[9] = p) : p = e[9];
211
+ let m;
212
+ e[10] !== s ? (m = /* @__PURE__ */ A(ft, { size: "xs", colorPalette: "green", onClick: s, children: [
213
+ p,
241
214
  "Allow"
242
- ] }), e[10] = o, e[11] = p) : p = e[11];
215
+ ] }), e[10] = s, e[11] = m) : m = e[11];
243
216
  let h;
244
- e[12] !== f || e[13] !== p ? (h = /* @__PURE__ */ k(Me, { gap: "xs", justifyContent: "flex-end", children: [
217
+ e[12] !== f || e[13] !== m ? (h = /* @__PURE__ */ A(ae, { gap: "xs", justifyContent: "flex-end", children: [
245
218
  f,
246
- p
247
- ] }), e[12] = f, e[13] = p, e[14] = h) : h = e[14];
219
+ m
220
+ ] }), e[12] = f, e[13] = m, e[14] = h) : h = e[14];
248
221
  let g;
249
- return e[15] !== c || e[16] !== u || e[17] !== h ? (g = /* @__PURE__ */ a(I, { px: "sm", py: "xs", mx: "sm", borderWidth: "1px", borderColor: "border.warning", borderRadius: "lg", bg: "bg.warning", children: /* @__PURE__ */ k(Re, { direction: "column", gap: "xs", children: [
250
- c,
222
+ return e[15] !== a || e[16] !== u || e[17] !== h ? (g = /* @__PURE__ */ c(B, { px: "sm", py: "xs", mx: "sm", borderWidth: "1px", borderColor: "border.warning", borderRadius: "lg", bg: "bg.warning", children: /* @__PURE__ */ A(Qe, { direction: "column", gap: "xs", children: [
223
+ a,
251
224
  u,
252
225
  h
253
- ] }) }), e[15] = c, e[16] = u, e[17] = h, e[18] = g) : g = e[18], g;
254
- }, Fo = "md", zo = "neutral", ul = (t) => {
255
- const e = T(17), {
226
+ ] }) }), e[15] = a, e[16] = u, e[17] = h, e[18] = g) : g = e[18], g;
227
+ }, mo = "md", ho = "neutral", Xl = (t) => {
228
+ const e = k(17), {
256
229
  attachments: n,
257
- onSelect: s,
258
- onRemove: o,
230
+ onSelect: o,
231
+ onRemove: s,
259
232
  renderBadge: r,
260
233
  size: i,
261
234
  tone: l
262
235
  } = t;
263
- let c;
264
- e[0] !== n ? (c = n === void 0 ? [] : n, e[0] = n, e[1] = c) : c = e[1];
265
- const u = c, d = i === void 0 ? Fo : i, f = l === void 0 ? zo : l;
236
+ let a;
237
+ e[0] !== n ? (a = n === void 0 ? [] : n, e[0] = n, e[1] = a) : a = e[1];
238
+ const u = a, d = i === void 0 ? mo : i, f = l === void 0 ? ho : l;
266
239
  if (u.length === 0)
267
240
  return null;
268
- let m;
269
- if (e[2] !== u || e[3] !== o || e[4] !== s || e[5] !== r || e[6] !== d || e[7] !== f) {
241
+ let p;
242
+ if (e[2] !== u || e[3] !== s || e[4] !== o || e[5] !== r || e[6] !== d || e[7] !== f) {
270
243
  let h;
271
- e[9] !== o || e[10] !== s || e[11] !== r || e[12] !== d || e[13] !== f ? (h = (g) => {
272
- const y = s ? () => s(g) : void 0, b = o ? () => o(g) : void 0;
244
+ e[9] !== s || e[10] !== o || e[11] !== r || e[12] !== d || e[13] !== f ? (h = (g) => {
245
+ const y = o ? () => o(g) : void 0, x = s ? () => s(g) : void 0;
273
246
  if (r) {
274
- const x = r({
247
+ const b = r({
275
248
  attachmentId: g,
276
249
  onSelect: y,
277
- onRemove: b,
250
+ onRemove: x,
278
251
  size: d,
279
252
  tone: f
280
253
  });
281
- return /* @__PURE__ */ a(xo, { children: x }, g);
254
+ return /* @__PURE__ */ c(Us, { children: b }, g);
282
255
  }
283
- return /* @__PURE__ */ a(zt, { fileName: g, onSelect: y, onRemove: b, size: d, tone: f }, g);
284
- }, e[9] = o, e[10] = s, e[11] = r, e[12] = d, e[13] = f, e[14] = h) : h = e[14], m = u.map(h), e[2] = u, e[3] = o, e[4] = s, e[5] = r, e[6] = d, e[7] = f, e[8] = m;
256
+ return /* @__PURE__ */ c(sn, { fileName: g, onSelect: y, onRemove: x, size: d, tone: f }, g);
257
+ }, e[9] = s, e[10] = o, e[11] = r, e[12] = d, e[13] = f, e[14] = h) : h = e[14], p = u.map(h), e[2] = u, e[3] = s, e[4] = o, e[5] = r, e[6] = d, e[7] = f, e[8] = p;
285
258
  } else
286
- m = e[8];
287
- let p;
288
- return e[15] !== m ? (p = /* @__PURE__ */ a(Y, { marginBottom: "sm", gap: "1", flexDir: "row", flexWrap: "wrap", children: m }), e[15] = m, e[16] = p) : p = e[16], p;
289
- }, qo = (t) => {
259
+ p = e[8];
260
+ let m;
261
+ return e[15] !== p ? (m = /* @__PURE__ */ c(X, { marginBottom: "sm", gap: "1", flexDir: "row", flexWrap: "wrap", children: p }), e[15] = p, e[16] = m) : m = e[16], m;
262
+ }, go = (t) => {
290
263
  const {
291
264
  previousUserMessageCount: e,
292
265
  userMessageCount: n
293
266
  } = t;
294
267
  return e === 0 ? !1 : n > e;
268
+ }, bo = (t) => {
269
+ const e = t.conversationKey ?? null;
270
+ return t.state.conversationKey !== e ? {
271
+ shouldScroll: !1,
272
+ state: {
273
+ conversationKey: e,
274
+ userMessageCount: t.userMessageCount
275
+ }
276
+ } : {
277
+ shouldScroll: go({
278
+ previousUserMessageCount: t.state.userMessageCount,
279
+ userMessageCount: t.userMessageCount
280
+ }),
281
+ state: {
282
+ conversationKey: e,
283
+ userMessageCount: Math.max(t.state.userMessageCount, t.userMessageCount)
284
+ }
285
+ };
286
+ }, yo = (t) => {
287
+ const e = bo(t);
288
+ return e.shouldScroll && t.scrollToBottom("instant"), e;
295
289
  };
296
- function Ho(t) {
297
- const e = T(4), {
298
- userMessageCount: n
290
+ function xo(t) {
291
+ const e = k(8), {
292
+ conversationKey: n,
293
+ userMessageCount: o
299
294
  } = t, {
300
295
  scrollToBottom: s
301
- } = mt(), o = Ne(n);
302
- let r, i;
303
- return e[0] !== s || e[1] !== n ? (r = () => {
304
- qo({
305
- previousUserMessageCount: o.current,
306
- userMessageCount: n
307
- }) && s(), o.current = n;
308
- }, i = [n, s], e[0] = s, e[1] = n, e[2] = r, e[3] = i) : (r = e[2], i = e[3]), Ae(r, i), null;
296
+ } = It(), r = n ?? null;
297
+ let i;
298
+ e[0] !== r || e[1] !== o ? (i = {
299
+ conversationKey: r,
300
+ userMessageCount: o
301
+ }, e[0] = r, e[1] = o, e[2] = i) : i = e[2];
302
+ const l = Te(i);
303
+ let a, u;
304
+ return e[3] !== n || e[4] !== s || e[5] !== o ? (a = () => {
305
+ const d = yo({
306
+ state: l.current,
307
+ conversationKey: n,
308
+ userMessageCount: o,
309
+ scrollToBottom: s
310
+ });
311
+ l.current = d.state;
312
+ }, u = [n, o, s], e[3] = n, e[4] = s, e[5] = o, e[6] = a, e[7] = u) : (a = e[6], u = e[7]), le(a, u), null;
309
313
  }
310
- const pn = (t) => t.trim().length > 0, Qo = (t) => {
314
+ const On = (t) => t.trim().length > 0, So = (t) => {
311
315
  const {
312
- isDisabled: e,
313
- streaming: n,
316
+ hasQuestionPrompt: e,
317
+ isDisabled: n,
318
+ streaming: o,
314
319
  text: s
315
320
  } = t;
316
- return e || n || !pn(s) ? "none" : "submit";
317
- }, Wo = (t) => {
321
+ return n || o && !e || !On(s) ? "none" : "submit";
322
+ }, wo = (t) => {
318
323
  const {
319
324
  canInterrupt: e,
320
- isDisabled: n,
325
+ hasQuestionPrompt: n,
326
+ isDisabled: o,
321
327
  streaming: s,
322
- text: o
328
+ text: r
323
329
  } = t;
324
- return n ? "none" : s ? e ? "interrupt" : "none" : pn(o) ? "submit" : "none";
325
- }, mn = 200, No = (t, e = mn) => t.length > 0 && t.split(/\r\n|\r|\n/).length > e, Vo = (t) => {
330
+ return o ? "none" : s && !n ? e ? "interrupt" : "none" : On(r) ? "submit" : "none";
331
+ }, zn = 200, To = (t, e = zn) => t.length > 0 && t.split(/\r\n|\r|\n/).length > e, Co = (t) => {
326
332
  const {
327
333
  onAttachFiles: e,
328
334
  onAttachText: n,
329
- textAttachmentPasteLineThreshold: s
335
+ textAttachmentPasteLineThreshold: o
330
336
  } = t;
331
337
  return {
332
338
  onDragOver: (l) => {
333
339
  !e || !Array.from(l.dataTransfer.types).includes("Files") || l.preventDefault();
334
340
  },
335
341
  onDropCapture: (l) => {
336
- const c = Array.from(l.dataTransfer.files ?? []);
337
- c.length === 0 || !e || (l.preventDefault(), e(c));
342
+ const a = Array.from(l.dataTransfer.files ?? []);
343
+ a.length === 0 || !e || (l.preventDefault(), e(a));
338
344
  },
339
345
  onPasteCapture: (l) => {
340
- const c = Array.from(l.clipboardData.files ?? []);
341
- if (c.length > 0 && e) {
342
- l.preventDefault(), e(c);
346
+ const a = Array.from(l.clipboardData.files ?? []);
347
+ if (a.length > 0 && e) {
348
+ l.preventDefault(), e(a);
343
349
  return;
344
350
  }
345
351
  const u = l.clipboardData.getData("text/plain");
346
- n && No(u, s) && (l.preventDefault(), n(u));
352
+ n && To(u, o) && (l.preventDefault(), n(u));
347
353
  }
348
354
  };
349
- }, jo = (t) => {
355
+ }, ko = (t) => {
350
356
  t.preventDefault();
351
- }, hn = (t) => {
352
- const e = T(7), {
357
+ }, Qn = (t) => {
358
+ const e = k(7), {
353
359
  option: n
354
360
  } = t;
355
- let s;
356
- e[0] !== n.label ? (s = /* @__PURE__ */ a(X, { textStyle: "label/S/regular", color: "fg", children: n.label }), e[0] = n.label, e[1] = s) : s = e[1];
357
361
  let o;
358
- e[2] !== n.description ? (o = n.description ? /* @__PURE__ */ a(X, { textStyle: "label/XS/regular", color: "fg.muted", children: n.description }) : null, e[2] = n.description, e[3] = o) : o = e[3];
362
+ e[0] !== n.label ? (o = /* @__PURE__ */ c(j, { textStyle: "label/S/regular", color: "fg", children: n.label }), e[0] = n.label, e[1] = o) : o = e[1];
363
+ let s;
364
+ e[2] !== n.description ? (s = n.description ? /* @__PURE__ */ c(j, { textStyle: "label/XS/regular", color: "fg.muted", children: n.description }) : null, e[2] = n.description, e[3] = s) : s = e[3];
359
365
  let r;
360
- return e[4] !== s || e[5] !== o ? (r = /* @__PURE__ */ k(Y, { gap: "0", minWidth: "0", children: [
361
- s,
362
- o
363
- ] }), e[4] = s, e[5] = o, e[6] = r) : r = e[6], r;
364
- }, Uo = (t) => {
365
- const e = T(12), {
366
+ return e[4] !== o || e[5] !== s ? (r = /* @__PURE__ */ A(X, { gap: "0", minWidth: "0", children: [
367
+ o,
368
+ s
369
+ ] }), e[4] = o, e[5] = s, e[6] = r) : r = e[6], r;
370
+ }, Ao = (t) => {
371
+ const e = k(12), {
366
372
  option: n,
367
- name: s,
368
- checked: o,
373
+ name: o,
374
+ checked: s,
369
375
  editable: r,
370
376
  onToggle: i
371
- } = t, l = !r, c = r ? void 0 : "true";
377
+ } = t, l = !r, a = r ? void 0 : "true";
372
378
  let u;
373
379
  e[0] !== r ? (u = r ? void 0 : {
374
380
  tabIndex: -1
375
381
  }, e[0] = r, e[1] = u) : u = e[1];
376
382
  const d = r ? i : void 0;
377
383
  let f;
378
- e[2] !== n ? (f = /* @__PURE__ */ a(hn, { option: n }), e[2] = n, e[3] = f) : f = e[3];
379
- let m;
380
- return e[4] !== o || e[5] !== s || e[6] !== l || e[7] !== c || e[8] !== u || e[9] !== d || e[10] !== f ? (m = /* @__PURE__ */ a(dn, { name: s, checked: o, readOnly: l, "aria-readonly": c, inputProps: u, alignItems: "flex-start", onCheckedChange: d, children: f }), e[4] = o, e[5] = s, e[6] = l, e[7] = c, e[8] = u, e[9] = d, e[10] = f, e[11] = m) : m = e[11], m;
381
- }, Ko = (t) => {
382
- const e = T(17), {
384
+ e[2] !== n ? (f = /* @__PURE__ */ c(Qn, { option: n }), e[2] = n, e[3] = f) : f = e[3];
385
+ let p;
386
+ return e[4] !== s || e[5] !== o || e[6] !== l || e[7] !== a || e[8] !== u || e[9] !== d || e[10] !== f ? (p = /* @__PURE__ */ c($n, { name: o, checked: s, readOnly: l, "aria-readonly": a, inputProps: u, alignItems: "flex-start", onCheckedChange: d, children: f }), e[4] = s, e[5] = o, e[6] = l, e[7] = a, e[8] = u, e[9] = d, e[10] = f, e[11] = p) : p = e[11], p;
387
+ }, Io = (t) => {
388
+ const e = k(17), {
383
389
  question: n,
384
- questionIndex: s,
385
- name: o,
390
+ questionIndex: o,
391
+ name: s,
386
392
  selectedOption: r,
387
393
  editable: i,
388
394
  onToggleOption: l
389
- } = t, c = r ?? null, u = !i, d = i ? void 0 : "true";
395
+ } = t, a = r ?? null, u = !i, d = i ? void 0 : "true";
390
396
  let f;
391
- e[0] !== i || e[1] !== l || e[2] !== n || e[3] !== s ? (f = i ? (h) => {
392
- h.value && l?.(n, s, h.value);
393
- } : void 0, e[0] = i, e[1] = l, e[2] = n, e[3] = s, e[4] = f) : f = e[4];
394
- let m;
397
+ e[0] !== i || e[1] !== l || e[2] !== n || e[3] !== o ? (f = i ? (h) => {
398
+ h.value && l?.(n, o, h.value);
399
+ } : void 0, e[0] = i, e[1] = l, e[2] = n, e[3] = o, e[4] = f) : f = e[4];
400
+ let p;
395
401
  if (e[5] !== i || e[6] !== n.options) {
396
402
  let h;
397
- e[8] !== i ? (h = (g) => /* @__PURE__ */ a(wo, { value: g.label, inputProps: i ? void 0 : {
403
+ e[8] !== i ? (h = (g) => /* @__PURE__ */ c(Xs, { value: g.label, inputProps: i ? void 0 : {
398
404
  tabIndex: -1
399
- }, alignItems: "flex-start", children: /* @__PURE__ */ a(hn, { option: g }) }, g.label), e[8] = i, e[9] = h) : h = e[9], m = n.options.map(h), e[5] = i, e[6] = n.options, e[7] = m;
405
+ }, alignItems: "flex-start", children: /* @__PURE__ */ c(Qn, { option: g }) }, g.label), e[8] = i, e[9] = h) : h = e[9], p = n.options.map(h), e[5] = i, e[6] = n.options, e[7] = p;
400
406
  } else
401
- m = e[7];
402
- let p;
403
- return e[10] !== o || e[11] !== c || e[12] !== u || e[13] !== d || e[14] !== f || e[15] !== m ? (p = /* @__PURE__ */ a(ko, { name: o, value: c, readOnly: u, "aria-readonly": d, display: "flex", flexDirection: "column", gap: "xs", onValueChange: f, children: m }), e[10] = o, e[11] = c, e[12] = u, e[13] = d, e[14] = f, e[15] = m, e[16] = p) : p = e[16], p;
404
- }, Go = (t) => {
405
- const e = T(4), {
407
+ p = e[7];
408
+ let m;
409
+ return e[10] !== s || e[11] !== a || e[12] !== u || e[13] !== d || e[14] !== f || e[15] !== p ? (m = /* @__PURE__ */ c(Ys, { name: s, value: a, readOnly: u, "aria-readonly": d, display: "flex", flexDirection: "column", gap: "xs", onValueChange: f, children: p }), e[10] = s, e[11] = a, e[12] = u, e[13] = d, e[14] = f, e[15] = p, e[16] = m) : m = e[16], m;
410
+ }, _o = (t) => {
411
+ const e = k(4), {
406
412
  items: n
407
413
  } = t;
408
- let s;
409
- e[0] !== n ? (s = n.map(Xo), e[0] = n, e[1] = s) : s = e[1];
410
414
  let o;
411
- return e[2] !== s ? (o = /* @__PURE__ */ a(Y, { as: "ul", gap: "0", listStyleType: "none", margin: "0", padding: "0", children: s }), e[2] = s, e[3] = o) : o = e[3], o;
412
- }, gn = (t) => {
413
- const e = T(19), {
415
+ e[0] !== n ? (o = n.map(vo), e[0] = n, e[1] = o) : o = e[1];
416
+ let s;
417
+ return e[2] !== o ? (s = /* @__PURE__ */ c(X, { as: "ul", gap: "0", listStyleType: "none", margin: "0", padding: "0", children: o }), e[2] = o, e[3] = s) : s = e[3], s;
418
+ }, qn = (t) => {
419
+ const e = k(19), {
414
420
  questions: n,
415
- editable: s,
416
- selectedOptionsByQuestion: o,
421
+ editable: o,
422
+ selectedOptionsByQuestion: s,
417
423
  customAnswersByQuestion: r,
418
424
  onToggleOption: i,
419
425
  onCustomAnswerChange: l
420
- } = t, c = s === void 0 ? !1 : s;
426
+ } = t, a = o === void 0 ? !1 : o;
421
427
  let u;
422
- e[0] !== o ? (u = o === void 0 ? {} : o, e[0] = o, e[1] = u) : u = e[1];
428
+ e[0] !== s ? (u = s === void 0 ? {} : s, e[0] = s, e[1] = u) : u = e[1];
423
429
  const d = u;
424
430
  let f;
425
431
  e[2] !== r ? (f = r === void 0 ? {} : r, e[2] = r, e[3] = f) : f = e[3];
426
- const m = f;
427
- let p;
428
- if (e[4] !== m || e[5] !== c || e[6] !== l || e[7] !== i || e[8] !== n || e[9] !== d) {
432
+ const p = f;
433
+ let m;
434
+ if (e[4] !== p || e[5] !== a || e[6] !== l || e[7] !== i || e[8] !== n || e[9] !== d) {
429
435
  let g;
430
- e[11] !== m || e[12] !== c || e[13] !== l || e[14] !== i || e[15] !== d ? (g = (y, b) => {
431
- const x = y.id ?? `question-${b}`, C = y.multiple ? "checkbox" : "radio", A = d[x] ?? [];
432
- return /* @__PURE__ */ k(Y, { as: "fieldset", gap: "xs", borderWidth: "1px", borderColor: "border.muted", borderRadius: "sm", padding: "sm", minWidth: "0", children: [
433
- /* @__PURE__ */ a(X, { as: "legend", textStyle: "label/S/medium", color: "fg", paddingX: "2xs", children: y.question }),
434
- C === "radio" ? /* @__PURE__ */ a(Ko, { question: y, questionIndex: b, name: x, selectedOption: A[0], editable: c, onToggleOption: i }) : y.options.map((w) => /* @__PURE__ */ a(Uo, { option: w, name: x, checked: A.includes(w.label), editable: c, onToggle: () => i?.(y, b, w.label) }, w.label)),
435
- y.allowCustomAnswer ? /* @__PURE__ */ a(Qn, { readOnly: !c, "aria-readonly": c ? void 0 : "true", value: m[x] ?? "", placeholder: c ? "Answer..." : "Custom answer", "aria-label": y.question, rows: 2, borderWidth: "1px", borderColor: "border.muted", borderRadius: "sm", padding: "xs", resize: c ? "vertical" : "none", color: "fg", onChange: (w) => l?.(y, b, w.currentTarget.value) }) : null
436
- ] }, x);
437
- }, e[11] = m, e[12] = c, e[13] = l, e[14] = i, e[15] = d, e[16] = g) : g = e[16], p = n.map(g), e[4] = m, e[5] = c, e[6] = l, e[7] = i, e[8] = n, e[9] = d, e[10] = p;
436
+ e[11] !== p || e[12] !== a || e[13] !== l || e[14] !== i || e[15] !== d ? (g = (y, x) => {
437
+ const b = y.id ?? `question-${x}`, S = y.multiple ? "checkbox" : "radio", T = d[b] ?? [];
438
+ return /* @__PURE__ */ A(X, { as: "fieldset", gap: "xs", borderWidth: "1px", borderColor: "border.subtle", borderRadius: "sm", padding: "sm", minWidth: "0", children: [
439
+ /* @__PURE__ */ c(j, { as: "legend", textStyle: "label/S/medium", color: "fg", paddingX: "2xs", children: y.question }),
440
+ S === "radio" ? /* @__PURE__ */ c(Io, { question: y, questionIndex: x, name: b, selectedOption: T[0], editable: a, onToggleOption: i }) : y.options.map((w) => /* @__PURE__ */ c(Ao, { option: w, name: b, checked: T.includes(w.label), editable: a, onToggle: () => i?.(y, x, w.label) }, w.label)),
441
+ y.allowCustomAnswer ? /* @__PURE__ */ c(bs, { readOnly: !a, "aria-readonly": a ? void 0 : "true", value: p[b] ?? "", placeholder: a ? "Answer..." : "Custom answer", "aria-label": y.question, rows: 2, borderWidth: "1px", borderColor: "border.subtle", borderRadius: "sm", padding: "xs", resize: a ? "vertical" : "none", color: "fg", onChange: (w) => l?.(y, x, w.currentTarget.value) }) : null
442
+ ] }, b);
443
+ }, e[11] = p, e[12] = a, e[13] = l, e[14] = i, e[15] = d, e[16] = g) : g = e[16], m = n.map(g), e[4] = p, e[5] = a, e[6] = l, e[7] = i, e[8] = n, e[9] = d, e[10] = m;
438
444
  } else
439
- p = e[10];
445
+ m = e[10];
440
446
  let h;
441
- return e[17] !== p ? (h = /* @__PURE__ */ a(Y, { as: "form", gap: "sm", onSubmit: jo, "aria-label": "Question form", children: p }), e[17] = p, e[18] = h) : h = e[18], h;
447
+ return e[17] !== m ? (h = /* @__PURE__ */ c(X, { as: "form", gap: "sm", onSubmit: ko, "aria-label": "Question form", children: m }), e[17] = m, e[18] = h) : h = e[18], h;
442
448
  };
443
- function Xo(t, e) {
444
- return /* @__PURE__ */ a(I, { as: "li", children: /* @__PURE__ */ a(dn, { checked: t.checked, readOnly: !0, "aria-readonly": "true", inputProps: {
449
+ function vo(t, e) {
450
+ return /* @__PURE__ */ c(B, { as: "li", children: /* @__PURE__ */ c($n, { checked: t.checked, readOnly: !0, "aria-readonly": "true", inputProps: {
445
451
  tabIndex: -1
446
- }, size: "xs", children: /* @__PURE__ */ a(X, { textStyle: "label/XS/regular", color: "fg", children: t.label }) }) }, `${t.label}-${e}`);
452
+ }, size: "xs", children: /* @__PURE__ */ c(j, { textStyle: "label/XS/regular", color: "fg", children: t.label }) }) }, `${t.label}-${e}`);
447
453
  }
448
- const de = (t, e) => t.id ?? `question-${e}`, Dt = (t) => t ? JSON.stringify(t.questions.map((e, n) => ({
449
- id: de(e, n),
454
+ const Ce = (t, e) => t.id ?? `question-${e}`, Gt = (t) => t ? JSON.stringify(t.questions.map((e, n) => ({
455
+ id: Ce(e, n),
450
456
  question: e.question,
451
457
  multiple: !!e.multiple,
452
458
  required: !!e.required,
453
459
  allowCustomAnswer: !!e.allowCustomAnswer,
454
- options: e.options.map((s) => ({
455
- label: s.label,
456
- description: s.description ?? ""
460
+ options: e.options.map((o) => ({
461
+ label: o.label,
462
+ description: o.description ?? ""
457
463
  }))
458
- }))) : "", Yo = (t, e, n) => {
459
- const s = [];
460
- for (let o = 0; o < t.questions.length; o += 1) {
461
- const r = t.questions[o], i = de(r, o), l = e[i] ?? [], c = n[i]?.trim(), u = c ? [...l, c] : l;
462
- u.length !== 0 && s.push(`${r.question}: ${u.join(", ")}`);
464
+ }))) : "", Ro = (t, e, n) => {
465
+ const o = [];
466
+ for (let s = 0; s < t.questions.length; s += 1) {
467
+ const r = t.questions[s], i = Ce(r, s), l = e[i] ?? [], a = n[i]?.trim(), u = a ? [...l, a] : l;
468
+ u.length !== 0 && o.push(`${r.question}: ${u.join(", ")}`);
463
469
  }
464
- return s;
465
- }, Jo = (t) => typeof t != "string", qt = (t, e) => {
466
- if (Jo(e)) return e;
470
+ return o;
471
+ }, Mo = (t) => typeof t != "string", on = (t, e) => {
472
+ if (Mo(e)) return e;
467
473
  const n = e.trim();
468
474
  if (n.length === 0) return {};
469
- const s = {};
470
- for (let o = 0; o < t.questions.length; o += 1) {
471
- const r = t.questions[o];
472
- r.allowCustomAnswer && (s[de(r, o)] = n);
475
+ const o = {};
476
+ for (let s = 0; s < t.questions.length; s += 1) {
477
+ const r = t.questions[s];
478
+ r.allowCustomAnswer && (o[Ce(r, s)] = n);
473
479
  }
474
- return s;
475
- }, Zo = (t, e, n) => {
480
+ return o;
481
+ }, Po = (t, e, n) => {
476
482
  if (!t) return typeof n == "string" ? n.trim() : "";
477
- const s = qt(t, n), o = Yo(t, e, s), r = typeof n == "string" ? n.trim() : "", i = t.questions.some((l) => l.allowCustomAnswer);
478
- return r.length > 0 && !i && o.push(`Additional response: ${r}`), o.join(`
483
+ const o = on(t, n), s = Ro(t, e, o), r = typeof n == "string" ? n.trim() : "", i = t.questions.some((l) => l.allowCustomAnswer);
484
+ return r.length > 0 && !i && s.push(`Additional response: ${r}`), s.join(`
479
485
  `);
480
- }, es = (t, e, n) => {
481
- const s = qt(t, n);
482
- return t.questions.map((o, r) => {
483
- const i = de(o, r), l = e[i] ?? [], c = s[i]?.trim();
484
- return c ? [...l, c] : l;
486
+ }, Eo = (t, e, n) => {
487
+ const o = on(t, n);
488
+ return t.questions.map((s, r) => {
489
+ const i = Ce(s, r), l = e[i] ?? [], a = o[i]?.trim();
490
+ return a ? [...l, a] : l;
485
491
  });
486
- }, ts = (t, e, n) => {
492
+ }, Do = (t, e, n) => {
487
493
  if (!t) return !1;
488
- const s = qt(t, n);
489
- for (let o = 0; o < t.questions.length; o += 1) {
490
- const r = t.questions[o];
494
+ const o = on(t, n);
495
+ for (let s = 0; s < t.questions.length; s += 1) {
496
+ const r = t.questions[s];
491
497
  if (!r.required) continue;
492
- const i = de(r, o);
493
- if (!((e[i] ?? []).length > 0) && !(r.allowCustomAnswer && s[i]?.trim()))
498
+ const i = Ce(r, s);
499
+ if (!((e[i] ?? []).length > 0) && !(r.allowCustomAnswer && o[i]?.trim()))
494
500
  return !0;
495
501
  }
496
502
  return !1;
497
- }, ns = (t) => t.questions.map((e, n) => ({
498
- id: de(e, n),
503
+ }, Bo = (t) => t.questions.map((e, n) => ({
504
+ id: Ce(e, n),
499
505
  question: e.question,
500
506
  options: e.options,
501
507
  multiple: !!e.multiple,
502
508
  required: !!e.required,
503
509
  allowCustomAnswer: !!e.allowCustomAnswer
504
- })), os = (t, e, n, s) => {
505
- const o = de(t, e);
506
- return (n[o] ?? []).length > 0 || !!s[o]?.trim();
507
- }, ss = (t) => {
508
- const e = T(22), {
510
+ })), Fo = (t, e, n, o) => {
511
+ const s = Ce(t, e);
512
+ return (n[s] ?? []).length > 0 || !!o[s]?.trim();
513
+ }, Lo = (t) => {
514
+ const e = k(22), {
509
515
  question: n,
510
- sourceQuestion: s,
511
- questionIndex: o,
516
+ sourceQuestion: o,
517
+ questionIndex: s,
512
518
  isActive: r,
513
519
  selectedOptionsByQuestion: i,
514
520
  customAnswersByQuestion: l,
515
- onSelectStep: c
521
+ onSelectStep: a
516
522
  } = t;
517
523
  let u;
518
- e[0] !== l || e[1] !== o || e[2] !== i || e[3] !== s ? (u = os(s, o, i, l), e[0] = l, e[1] = o, e[2] = i, e[3] = s, e[4] = u) : u = e[4];
519
- const d = u, f = d ? "answered" : "not answered", m = r ? "outline" : "ghost", p = `question-step-tab-${n.id}`, h = `${n.question} (${f})`, g = `question-step-panel-${n.id}`;
524
+ e[0] !== l || e[1] !== s || e[2] !== i || e[3] !== o ? (u = Fo(o, s, i, l), e[0] = l, e[1] = s, e[2] = i, e[3] = o, e[4] = u) : u = e[4];
525
+ const d = u, f = d ? "answered" : "not answered", p = r ? "outline" : "ghost", m = `question-step-tab-${n.id}`, h = `${n.question} (${f})`, g = `question-step-panel-${n.id}`;
520
526
  let y;
521
- e[5] !== c || e[6] !== o ? (y = () => c(o), e[5] = c, e[6] = o, e[7] = y) : y = e[7];
522
- let b;
523
- e[8] !== d || e[9] !== o ? (b = d ? /* @__PURE__ */ a(rn, { "aria-hidden": "true" }) : o + 1, e[8] = d, e[9] = o, e[10] = b) : b = e[10];
527
+ e[5] !== a || e[6] !== s ? (y = () => a(s), e[5] = a, e[6] = s, e[7] = y) : y = e[7];
524
528
  let x;
525
- e[11] !== r || e[12] !== p || e[13] !== h || e[14] !== g || e[15] !== y || e[16] !== b || e[17] !== m ? (x = /* @__PURE__ */ a(Ze, { id: p, role: "tab", "aria-label": h, "aria-selected": r, "aria-controls": g, size: "xs", variant: m, minW: "8", onClick: y, children: b }), e[11] = r, e[12] = p, e[13] = h, e[14] = g, e[15] = y, e[16] = b, e[17] = m, e[18] = x) : x = e[18];
526
- let C;
527
- return e[19] !== n.question || e[20] !== x ? (C = /* @__PURE__ */ a(cn, { content: n.question, showArrow: !0, children: x }), e[19] = n.question, e[20] = x, e[21] = C) : C = e[21], C;
528
- }, rs = (t) => {
529
- const e = T(31), {
529
+ e[8] !== d || e[9] !== s ? (x = d ? /* @__PURE__ */ c(Pn, { "aria-hidden": "true" }) : s + 1, e[8] = d, e[9] = s, e[10] = x) : x = e[10];
530
+ let b;
531
+ e[11] !== r || e[12] !== m || e[13] !== h || e[14] !== g || e[15] !== y || e[16] !== x || e[17] !== p ? (b = /* @__PURE__ */ c(ft, { id: m, role: "tab", "aria-label": h, "aria-selected": r, "aria-controls": g, size: "xs", variant: p, minW: "8", onClick: y, children: x }), e[11] = r, e[12] = m, e[13] = h, e[14] = g, e[15] = y, e[16] = x, e[17] = p, e[18] = b) : b = e[18];
532
+ let S;
533
+ return e[19] !== n.question || e[20] !== b ? (S = /* @__PURE__ */ c(Fn, { content: n.question, children: b }), e[19] = n.question, e[20] = b, e[21] = S) : S = e[21], S;
534
+ }, $o = (t) => {
535
+ const e = k(31), {
530
536
  questionPrompt: n,
531
- selectedOptionsByQuestion: s,
532
- customAnswersByQuestion: o,
537
+ selectedOptionsByQuestion: o,
538
+ customAnswersByQuestion: s,
533
539
  onToggleOption: r,
534
540
  onCustomAnswerChange: i
535
541
  } = t, {
536
542
  questions: l
537
- } = t, [c, u] = G(0), d = Math.min(c, l.length - 1), f = l[d], m = l.length > 1;
538
- let p;
539
- e[0] !== o || e[1] !== m || e[2] !== n.questions || e[3] !== l || e[4] !== d || e[5] !== s ? (p = m ? /* @__PURE__ */ a(Me, { role: "tablist", "aria-label": "Question steps", gap: "1", minWidth: "0", children: l.map((M, P) => /* @__PURE__ */ a(ss, { question: M, sourceQuestion: n.questions[P], questionIndex: P, isActive: P === d, selectedOptionsByQuestion: s, customAnswersByQuestion: o, onSelectStep: u }, M.id)) }) : null, e[0] = o, e[1] = m, e[2] = n.questions, e[3] = l, e[4] = d, e[5] = s, e[6] = p) : p = e[6];
540
- const h = `question-step-panel-${f.id}`, g = m ? "tabpanel" : void 0, y = m ? `question-step-tab-${f.id}` : void 0;
541
- let b;
542
- e[7] !== f ? (b = [f], e[7] = f, e[8] = b) : b = e[8];
543
+ } = t, [a, u] = W(0), d = Math.min(a, l.length - 1), f = l[d], p = l.length > 1;
544
+ let m;
545
+ e[0] !== s || e[1] !== p || e[2] !== n.questions || e[3] !== l || e[4] !== d || e[5] !== o ? (m = p ? /* @__PURE__ */ c(ae, { role: "tablist", "aria-label": "Question steps", gap: "1", minWidth: "0", children: l.map((_, I) => /* @__PURE__ */ c(Lo, { question: _, sourceQuestion: n.questions[I], questionIndex: I, isActive: I === d, selectedOptionsByQuestion: o, customAnswersByQuestion: s, onSelectStep: u }, _.id)) }) : null, e[0] = s, e[1] = p, e[2] = n.questions, e[3] = l, e[4] = d, e[5] = o, e[6] = m) : m = e[6];
546
+ const h = `question-step-panel-${f.id}`, g = p ? "tabpanel" : void 0, y = p ? `question-step-tab-${f.id}` : void 0;
543
547
  let x;
544
- e[9] !== r || e[10] !== n.questions || e[11] !== d ? (x = (M, P, v) => {
545
- r(n.questions[d], d, v);
546
- }, e[9] = r, e[10] = n.questions, e[11] = d, e[12] = x) : x = e[12];
547
- let C;
548
- e[13] !== i || e[14] !== n.questions || e[15] !== d ? (C = (M, P, v) => {
549
- i(n.questions[d], d, v);
550
- }, e[13] = i, e[14] = n.questions, e[15] = d, e[16] = C) : C = e[16];
551
- let A;
552
- e[17] !== o || e[18] !== s || e[19] !== b || e[20] !== x || e[21] !== C ? (A = /* @__PURE__ */ a(gn, { questions: b, editable: !0, selectedOptionsByQuestion: s, customAnswersByQuestion: o, onToggleOption: x, onCustomAnswerChange: C }), e[17] = o, e[18] = s, e[19] = b, e[20] = x, e[21] = C, e[22] = A) : A = e[22];
548
+ e[7] !== f ? (x = [f], e[7] = f, e[8] = x) : x = e[8];
549
+ let b;
550
+ e[9] !== r || e[10] !== n.questions || e[11] !== d ? (b = (_, I, M) => {
551
+ r(n.questions[d], d, M);
552
+ }, e[9] = r, e[10] = n.questions, e[11] = d, e[12] = b) : b = e[12];
553
+ let S;
554
+ e[13] !== i || e[14] !== n.questions || e[15] !== d ? (S = (_, I, M) => {
555
+ i(n.questions[d], d, M);
556
+ }, e[13] = i, e[14] = n.questions, e[15] = d, e[16] = S) : S = e[16];
557
+ let T;
558
+ e[17] !== s || e[18] !== o || e[19] !== x || e[20] !== b || e[21] !== S ? (T = /* @__PURE__ */ c(qn, { questions: x, editable: !0, selectedOptionsByQuestion: o, customAnswersByQuestion: s, onToggleOption: b, onCustomAnswerChange: S }), e[17] = s, e[18] = o, e[19] = x, e[20] = b, e[21] = S, e[22] = T) : T = e[22];
553
559
  let w;
554
- e[23] !== h || e[24] !== g || e[25] !== y || e[26] !== A ? (w = /* @__PURE__ */ a(Y, { id: h, role: g, "aria-labelledby": y, gap: "0", children: A }), e[23] = h, e[24] = g, e[25] = y, e[26] = A, e[27] = w) : w = e[27];
555
- let _;
556
- return e[28] !== p || e[29] !== w ? (_ = /* @__PURE__ */ k(Y, { gap: "xs", pb: "sm", children: [
557
- p,
560
+ e[23] !== h || e[24] !== g || e[25] !== y || e[26] !== T ? (w = /* @__PURE__ */ c(X, { id: h, role: g, "aria-labelledby": y, gap: "0", children: T }), e[23] = h, e[24] = g, e[25] = y, e[26] = T, e[27] = w) : w = e[27];
561
+ let C;
562
+ return e[28] !== m || e[29] !== w ? (C = /* @__PURE__ */ A(X, { gap: "xs", pb: "sm", children: [
563
+ m,
558
564
  w
559
- ] }), e[28] = p, e[29] = w, e[30] = _) : _ = e[30], _;
560
- }, is = (t) => {
561
- const e = T(8), {
565
+ ] }), e[28] = m, e[29] = w, e[30] = C) : C = e[30], C;
566
+ }, Oo = (t) => {
567
+ const e = k(8), {
562
568
  questionPrompt: n
563
569
  } = t;
564
- let s;
565
- e[0] !== n ? (s = ns(n), e[0] = n, e[1] = s) : s = e[1];
566
- const o = s;
570
+ let o;
571
+ e[0] !== n ? (o = Bo(n), e[0] = n, e[1] = o) : o = e[1];
572
+ const s = o;
567
573
  let r;
568
- e[2] !== n ? (r = Dt(n), e[2] = n, e[3] = r) : r = e[3];
574
+ e[2] !== n ? (r = Gt(n), e[2] = n, e[3] = r) : r = e[3];
569
575
  const i = r;
570
576
  let l;
571
- return e[4] !== t || e[5] !== i || e[6] !== o ? (l = /* @__PURE__ */ a(rs, { ...t, questions: o }, i), e[4] = t, e[5] = i, e[6] = o, e[7] = l) : l = e[7], l;
572
- }, ls = (t) => {
573
- const e = T(22);
574
- let n, s, o, r;
577
+ return e[4] !== t || e[5] !== i || e[6] !== s ? (l = /* @__PURE__ */ c($o, { ...t, questions: s }, i), e[4] = t, e[5] = i, e[6] = s, e[7] = l) : l = e[7], l;
578
+ }, pn = "7", zo = (t) => {
579
+ const e = k(22);
580
+ let n, o, s, r;
575
581
  e[0] !== t ? ({
576
582
  title: r,
577
- shortcut: o,
583
+ shortcut: s,
578
584
  canInterrupt: n,
579
- ...s
580
- } = t, e[0] = t, e[1] = n, e[2] = s, e[3] = o, e[4] = r) : (n = e[1], s = e[2], o = e[3], r = e[4]);
581
- const i = s["aria-label"] ?? r;
585
+ ...o
586
+ } = t, e[0] = t, e[1] = n, e[2] = o, e[3] = s, e[4] = r) : (n = e[1], o = e[2], s = e[3], r = e[4]);
587
+ const i = o["aria-label"] ?? r;
582
588
  let l;
583
- e[5] !== n ? (l = n ? /* @__PURE__ */ a(Jn, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ a(Zn, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = l) : l = e[6];
584
- const c = l;
589
+ e[5] !== n ? (l = n ? /* @__PURE__ */ c(Is, { size: 16, strokeWidth: 2, fill: "currentColor" }) : /* @__PURE__ */ c(_s, { size: 16, strokeWidth: 2 }), e[5] = n, e[6] = l) : l = e[6];
590
+ const a = l;
585
591
  let u;
586
- e[7] !== i || e[8] !== c || e[9] !== s || e[10] !== r ? (u = /* @__PURE__ */ a($t, { "data-testid": "send-message-button", size: "sm", variant: "primary", borderRadius: "full", "aria-label": i, title: r, ...s, children: c }), e[7] = i, e[8] = c, e[9] = s, e[10] = r, e[11] = u) : u = e[11];
592
+ e[7] !== i || e[8] !== a || e[9] !== o || e[10] !== r ? (u = /* @__PURE__ */ c(nt, { "data-testid": "send-message-button", size: "xs", variant: "primary", "aria-label": i, title: r, ...o, children: a }), e[7] = i, e[8] = a, e[9] = o, e[10] = r, e[11] = u) : u = e[11];
587
593
  const d = u;
588
594
  if (r) {
589
595
  let f;
590
- e[12] !== o || e[13] !== r ? (f = o ? /* @__PURE__ */ k(Ot, { children: [
596
+ e[12] !== s || e[13] !== r ? (f = s ? /* @__PURE__ */ A(tn, { children: [
591
597
  r,
592
598
  " ",
593
- /* @__PURE__ */ a(Nn, { fontSize: "xs", children: o })
594
- ] }) : r, e[12] = o, e[13] = r, e[14] = f) : f = e[14];
595
- const m = f;
596
- let p;
597
- e[15] !== d ? (p = /* @__PURE__ */ a(dt.Trigger, { asChild: !0, children: d }), e[15] = d, e[16] = p) : p = e[16];
599
+ /* @__PURE__ */ c(ys, { fontSize: "xs", children: s })
600
+ ] }) : r, e[12] = s, e[13] = r, e[14] = f) : f = e[14];
601
+ const p = f;
602
+ let m;
603
+ e[15] !== d ? (m = /* @__PURE__ */ c(Ct.Trigger, { asChild: !0, children: d }), e[15] = d, e[16] = m) : m = e[16];
598
604
  let h;
599
- e[17] !== m ? (h = /* @__PURE__ */ a(Wn, { children: /* @__PURE__ */ a(dt.Positioner, { children: /* @__PURE__ */ a(dt.Content, { children: m }) }) }), e[17] = m, e[18] = h) : h = e[18];
605
+ e[17] !== p ? (h = /* @__PURE__ */ c(vn, { children: /* @__PURE__ */ c(Ct.Positioner, { children: /* @__PURE__ */ c(Ct.Content, { children: p }) }) }), e[17] = p, e[18] = h) : h = e[18];
600
606
  let g;
601
- return e[19] !== p || e[20] !== h ? (g = /* @__PURE__ */ k(dt.Root, { closeDelay: 50, openDelay: 100, children: [
602
- p,
607
+ return e[19] !== m || e[20] !== h ? (g = /* @__PURE__ */ A(Ct.Root, { closeDelay: 50, openDelay: 100, children: [
608
+ m,
603
609
  h
604
- ] }), e[19] = p, e[20] = h, e[21] = g) : g = e[21], g;
610
+ ] }), e[19] = m, e[20] = h, e[21] = g) : g = e[21], g;
605
611
  }
606
612
  return d;
607
- }, as = (t) => {
608
- const e = T(2), {
613
+ }, Qo = (t) => {
614
+ const e = k(2), {
609
615
  placeholder: n
610
616
  } = t;
611
617
  if (!n)
612
618
  return null;
613
- let s;
614
- return e[0] !== n ? (s = /* @__PURE__ */ a(X, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: n }), e[0] = n, e[1] = s) : s = e[1], s;
615
- }, cs = (t) => {
616
- const e = T(100), {
619
+ let o;
620
+ return e[0] !== n ? (o = /* @__PURE__ */ c(j, { textStyle: "label/M/regular", color: "fg.subtle", pointerEvents: "none", position: "absolute", top: "0", children: n }), e[0] = n, e[1] = o) : o = e[1], o;
621
+ }, jt = "border.accent-light", Xt = (t) => {
622
+ const e = t?.querySelector('[contenteditable="true"]');
623
+ e instanceof HTMLElement && e.focus();
624
+ }, mn = (t, e) => requestAnimationFrame(() => {
625
+ Xt(t), e?.();
626
+ }), qo = (t) => {
627
+ const e = k(106), {
617
628
  defaultState: n,
618
- onSubmit: s,
619
- onInterrupt: o,
629
+ onSubmit: o,
630
+ onInterrupt: s,
620
631
  onAttachFiles: r,
621
632
  onAttachText: i,
622
633
  textAttachmentPasteLineThreshold: l,
623
- streaming: c,
634
+ streaming: a,
624
635
  attachedResources: u,
625
636
  onClearAttachments: d,
626
637
  isDisabled: f,
627
- onChange: m,
628
- placeholder: p,
638
+ onChange: p,
639
+ placeholder: m,
629
640
  attachmentList: h,
630
641
  actions: g,
631
642
  attachedToTop: y,
643
+ recessed: x,
632
644
  questionPrompt: b,
633
- autoFocus: x
634
- } = t, C = s === void 0 ? us : s, A = l === void 0 ? mn : l, w = c === void 0 ? !1 : c;
635
- let _;
636
- e[0] !== u ? (_ = u === void 0 ? [] : u, e[0] = u, e[1] = _) : _ = e[1];
637
- const M = _, P = f === void 0 ? !1 : f, v = y === void 0 ? !1 : y, L = x === void 0 ? !1 : x, [H, J] = G(!1), [B, ve] = G(n), [je, Le] = G(0);
638
- let he;
639
- e[2] !== n ? (he = () => Mt(n), e[2] = n, e[3] = he) : he = e[3];
640
- const [F, z] = G(he);
641
- let ee;
642
- e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ee = {}, e[4] = ee) : ee = e[4];
643
- const [E, ge] = G(ee);
644
- let be;
645
- e[5] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (be = {}, e[5] = be) : be = e[5];
646
- const [O, De] = G(be), Ue = Ne(null), Ke = Ne(m);
647
- let Be;
648
- e[6] !== b ? (Be = Dt(b), e[6] = b, e[7] = Be) : Be = e[7];
649
- const Ie = Ne(Be);
650
- let te, Ge;
651
- e[8] !== m ? (te = () => {
652
- Ke.current = m;
653
- }, Ge = [m], e[8] = m, e[9] = te, e[10] = Ge) : (te = e[9], Ge = e[10]), Ae(te, Ge);
654
- let ye, ne;
655
- e[11] !== n ? (ye = () => {
656
- const R = Mt(n);
657
- ve(n), Le(ds), z(R), ge({}), De({}), Ke.current?.(R);
658
- }, ne = [n], e[11] = n, e[12] = ye, e[13] = ne) : (ye = e[12], ne = e[13]), Ae(ye, ne);
659
- let xe;
660
- e[14] !== b ? (xe = Dt(b), e[14] = b, e[15] = xe) : xe = e[15];
661
- const oe = xe;
662
- let se, re;
663
- e[16] !== oe ? (se = () => {
664
- Ie.current !== oe && (Ie.current = oe, ge({}), De({}));
665
- }, re = [oe], e[16] = oe, e[17] = se, e[18] = re) : (se = e[17], re = e[18]), Ae(se, re);
666
- let Oe;
667
- e[19] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Oe = () => {
668
- const R = Ue.current?.querySelector('[contenteditable="true"]');
669
- R instanceof HTMLElement && R.focus();
670
- }, e[19] = Oe) : Oe = e[19];
671
- const ie = Oe;
672
- let Se, Q;
673
- e[20] !== L ? (Se = () => {
645
+ autoFocus: S,
646
+ focusSignal: T,
647
+ submitTitle: w,
648
+ references: C,
649
+ onAddReference: _
650
+ } = t, I = o === void 0 ? Ho : o, M = l === void 0 ? zn : l, P = a === void 0 ? !1 : a;
651
+ let F;
652
+ e[0] !== u ? (F = u === void 0 ? [] : u, e[0] = u, e[1] = F) : F = e[1];
653
+ const E = F, D = f === void 0 ? !1 : f, O = y === void 0 ? !1 : y, z = x === void 0 ? !1 : x, L = S === void 0 ? !1 : S, q = T === void 0 ? 0 : T;
654
+ let R;
655
+ e[2] !== C ? (R = C === void 0 ? [] : C, e[2] = C, e[3] = R) : R = e[3];
656
+ const Q = R, U = z ? "border.subtle" : "border", [H, _e] = W(!1), [ve, ue] = W(n), [Re, Ne] = W(0);
657
+ let Y;
658
+ e[4] !== n ? (Y = () => Vt(n), e[4] = n, e[5] = Y) : Y = e[5];
659
+ const [ee, de] = W(Y);
660
+ let fe;
661
+ e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (fe = {}, e[6] = fe) : fe = e[6];
662
+ const [N, Me] = W(fe);
663
+ let Pe;
664
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Pe = {}, e[7] = Pe) : Pe = e[7];
665
+ const [J, je] = W(Pe), qe = Te(null), rt = Te(p);
666
+ let Ue;
667
+ e[8] !== b ? (Ue = Gt(b), e[8] = b, e[9] = Ue) : Ue = e[9];
668
+ const He = Te(Ue);
669
+ let pe, it;
670
+ e[10] !== p ? (pe = () => {
671
+ rt.current = p;
672
+ }, it = [p], e[10] = p, e[11] = pe, e[12] = it) : (pe = e[11], it = e[12]), le(pe, it);
673
+ let Ee, De;
674
+ e[13] !== n ? (Ee = () => {
675
+ const $ = Vt(n);
676
+ ue(n), Ne(Wo), de($), Me({}), je({}), rt.current?.($);
677
+ }, De = [n], e[13] = n, e[14] = Ee, e[15] = De) : (Ee = e[14], De = e[15]), le(Ee, De);
678
+ let me;
679
+ e[16] !== b ? (me = Gt(b), e[16] = b, e[17] = me) : me = e[17];
680
+ const ne = me;
681
+ let Be, Fe;
682
+ e[18] !== ne ? (Be = () => {
683
+ He.current !== ne && (He.current = ne, Me({}), je({}));
684
+ }, Fe = [ne], e[18] = ne, e[19] = Be, e[20] = Fe) : (Be = e[19], Fe = e[20]), le(Be, Fe);
685
+ let he, ge;
686
+ e[21] !== L ? (he = () => {
674
687
  if (!L)
675
688
  return;
676
- const R = requestAnimationFrame(() => {
677
- const ke = Ue.current?.querySelector('[contenteditable="true"]');
678
- ke instanceof HTMLElement && ke.focus(), J(!0);
679
- });
680
- return () => cancelAnimationFrame(R);
681
- }, Q = [L], e[20] = L, e[21] = Se, e[22] = Q) : (Se = e[21], Q = e[22]), Ae(Se, Q);
682
- let W;
683
- e[23] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (W = () => {
684
- J(!0), ie();
685
- }, e[23] = W) : W = e[23];
686
- const Te = W;
687
- let N;
688
- e[24] !== n ? (N = (R) => {
689
- const ke = R === void 0 ? !1 : R;
690
- ve(n), Le(fs);
691
- const ce = Mt(n);
692
- z(ce), ge({}), De({}), Ke.current?.(ce), ke && requestAnimationFrame(() => {
693
- ie();
689
+ const $ = mn(qe.current, () => _e(!0));
690
+ return () => cancelAnimationFrame($);
691
+ }, ge = [L], e[21] = L, e[22] = he, e[23] = ge) : (he = e[22], ge = e[23]), le(he, ge);
692
+ let Le, be;
693
+ e[24] !== q ? (Le = () => {
694
+ if (q === 0)
695
+ return;
696
+ const $ = mn(qe.current, () => _e(!0));
697
+ return () => cancelAnimationFrame($);
698
+ }, be = [q], e[24] = q, e[25] = Le, e[26] = be) : (Le = e[25], be = e[26]), le(Le, be);
699
+ let Ke;
700
+ e[27] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ke = () => {
701
+ _e(!0), Xt(qe.current);
702
+ }, e[27] = Ke) : Ke = e[27];
703
+ const lt = Ke;
704
+ let se;
705
+ e[28] !== n ? (se = ($) => {
706
+ const at = $ === void 0 ? !1 : $;
707
+ ue(n), Ne(Vo);
708
+ const Se = Vt(n);
709
+ de(Se), Me({}), je({}), rt.current?.(Se), at && requestAnimationFrame(() => {
710
+ Xt(qe.current);
694
711
  });
695
- }, e[24] = n, e[25] = N) : N = e[25];
696
- const Z = N, V = w && !!o;
697
- let $, D, j;
698
- if (e[26] !== V || e[27] !== O || e[28] !== P || e[29] !== b || e[30] !== E || e[31] !== w || e[32] !== F) {
699
- D = b ? Zo(b, E, O) : F.trim();
700
- const R = ts(b, E, O);
701
- $ = {
702
- canInterrupt: V,
703
- isDisabled: P || R,
704
- streaming: w,
705
- text: D
706
- }, j = Wo($), e[26] = V, e[27] = O, e[28] = P, e[29] = b, e[30] = E, e[31] = w, e[32] = F, e[33] = $, e[34] = D, e[35] = j;
712
+ }, e[28] = n, e[29] = se) : se = e[29];
713
+ const We = se;
714
+ let Z, K, oe;
715
+ if (e[30] !== J || e[31] !== D || e[32] !== s || e[33] !== b || e[34] !== N || e[35] !== P || e[36] !== ee) {
716
+ K = b ? Po(b, N, J) : ee.trim();
717
+ const $ = Do(b, N, J);
718
+ Z = {
719
+ canInterrupt: P && !b && !!s,
720
+ hasQuestionPrompt: !!b,
721
+ isDisabled: D || $,
722
+ streaming: P,
723
+ text: K
724
+ }, oe = wo(Z), e[30] = J, e[31] = D, e[32] = s, e[33] = b, e[34] = N, e[35] = P, e[36] = ee, e[37] = Z, e[38] = K, e[39] = oe;
707
725
  } else
708
- $ = e[33], D = e[34], j = e[35];
709
- const U = j;
710
- let le;
711
- e[36] !== M || e[37] !== O || e[38] !== d || e[39] !== C || e[40] !== b || e[41] !== Z || e[42] !== D || e[43] !== E ? (le = () => {
712
- if (!D)
726
+ Z = e[37], K = e[38], oe = e[39];
727
+ const te = oe;
728
+ let re;
729
+ e[40] !== E || e[41] !== J || e[42] !== d || e[43] !== I || e[44] !== b || e[45] !== We || e[46] !== K || e[47] !== N ? (re = () => {
730
+ if (!K)
713
731
  return;
714
- const R = b ? {
715
- answers: es(b, E, O)
732
+ const $ = b ? {
733
+ answers: Eo(b, N, J)
716
734
  } : void 0;
717
- C(D, M, R), Z(!0), d?.();
718
- }, e[36] = M, e[37] = O, e[38] = d, e[39] = C, e[40] = b, e[41] = Z, e[42] = D, e[43] = E, e[44] = le) : le = e[44];
719
- const q = le;
720
- let we;
721
- e[45] !== o || e[46] !== q ? (we = (R) => {
722
- if (R === "interrupt") {
723
- o?.();
735
+ I(K, E, $), We(!0), d?.();
736
+ }, e[40] = E, e[41] = J, e[42] = d, e[43] = I, e[44] = b, e[45] = We, e[46] = K, e[47] = N, e[48] = re) : re = e[48];
737
+ const ce = re;
738
+ let ye;
739
+ e[49] !== s || e[50] !== ce ? (ye = ($) => {
740
+ if ($ === "interrupt") {
741
+ s?.();
724
742
  return;
725
743
  }
726
- R === "submit" && q();
727
- }, e[45] = o, e[46] = q, e[47] = we) : we = e[47];
728
- const K = we;
729
- let nt;
730
- e[48] !== $ || e[49] !== K ? (nt = () => K(Qo($)), e[48] = $, e[49] = K, e[50] = nt) : nt = e[50];
731
- const xt = nt;
732
- let ot;
733
- e[51] !== U || e[52] !== K ? (ot = () => K(U), e[51] = U, e[52] = K, e[53] = ot) : ot = e[53];
734
- const St = ot;
735
- let st;
736
- e[54] !== r || e[55] !== i || e[56] !== A ? (st = Vo({
744
+ $ === "submit" && ce();
745
+ }, e[49] = s, e[50] = ce, e[51] = ye) : ye = e[51];
746
+ const G = ye;
747
+ let Ge;
748
+ e[52] !== Z || e[53] !== G ? (Ge = () => G(So(Z)), e[52] = Z, e[53] = G, e[54] = Ge) : Ge = e[54];
749
+ const $e = Ge;
750
+ let ht;
751
+ e[55] !== te || e[56] !== G ? (ht = () => G(te), e[55] = te, e[56] = G, e[57] = ht) : ht = e[57];
752
+ const Et = ht;
753
+ let gt;
754
+ e[58] !== r || e[59] !== i || e[60] !== M ? (gt = Co({
737
755
  onAttachFiles: r,
738
756
  onAttachText: i,
739
- textAttachmentPasteLineThreshold: A
740
- }), e[54] = r, e[55] = i, e[56] = A, e[57] = st) : st = e[57];
741
- const ae = st;
742
- let rt;
743
- e[58] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (rt = (R, ke, ce) => {
744
- const Xe = de(R, ke);
745
- ge((Ye) => {
746
- const Pt = Ye[Xe] ?? [], Vt = Pt.includes(ce);
747
- return R.multiple ? {
748
- ...Ye,
749
- [Xe]: Vt ? Pt.filter(($n) => $n !== ce) : [...Pt, ce]
757
+ textAttachmentPasteLineThreshold: M
758
+ }), e[58] = r, e[59] = i, e[60] = M, e[61] = gt) : gt = e[61];
759
+ const xe = gt;
760
+ let bt;
761
+ e[62] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (bt = ($, at, Se) => {
762
+ const ct = Ce($, at);
763
+ Me((ut) => {
764
+ const Ht = ut[ct] ?? [], un = Ht.includes(Se);
765
+ return $.multiple ? {
766
+ ...ut,
767
+ [ct]: un ? Ht.filter((ps) => ps !== Se) : [...Ht, Se]
750
768
  } : {
751
- ...Ye,
752
- [Xe]: Vt ? [] : [ce]
769
+ ...ut,
770
+ [ct]: un ? [] : [Se]
753
771
  };
754
772
  });
755
- }, e[58] = rt) : rt = e[58];
756
- const Bn = rt;
757
- let it;
758
- e[59] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (it = (R, ke, ce) => {
759
- const Xe = de(R, ke);
760
- De((Ye) => ({
761
- ...Ye,
762
- [Xe]: ce
773
+ }, e[62] = bt) : bt = e[62];
774
+ const ds = bt;
775
+ let yt;
776
+ e[63] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (yt = ($, at, Se) => {
777
+ const ct = Ce($, at);
778
+ je((ut) => ({
779
+ ...ut,
780
+ [ct]: Se
763
781
  }));
764
- }, e[59] = it) : it = e[59];
765
- const On = it, Tt = v ? "-1px" : void 0, wt = v ? "0" : void 0, kt = H ? "blue.border" : "border.muted", Ct = H ? 1 : 0, At = H ? "blue.border" : "border";
766
- let $e;
767
- e[60] !== At ? ($e = {
768
- borderColor: At,
782
+ }, e[63] = yt) : yt = e[63];
783
+ const fs = yt, Dt = O ? "-1px" : void 0, Bt = O ? "0" : void 0, Ft = H ? jt : U, Lt = H ? 1 : 0, $t = H ? jt : U;
784
+ let Xe;
785
+ e[64] !== $t ? (Xe = {
786
+ borderColor: $t,
769
787
  zIndex: 1
770
- }, e[60] = At, e[61] = $e) : $e = e[61];
771
- let lt;
772
- e[62] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (lt = {
773
- borderColor: "blue.border",
788
+ }, e[64] = $t, e[65] = Xe) : Xe = e[65];
789
+ let xt;
790
+ e[66] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (xt = {
791
+ borderColor: jt,
774
792
  zIndex: 1
775
- }, e[62] = lt) : lt = e[62];
776
- let at;
777
- e[63] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (at = () => J(!1), e[63] = at) : at = e[63];
778
- let Fe;
779
- e[64] !== h ? (Fe = h ? /* @__PURE__ */ a(I, { mb: "xs", children: h }) : null, e[64] = h, e[65] = Fe) : Fe = e[65];
780
- let ze;
781
- e[66] !== O || e[67] !== je || e[68] !== B || e[69] !== xt || e[70] !== P || e[71] !== m || e[72] !== p || e[73] !== b || e[74] !== E ? (ze = b ? /* @__PURE__ */ a(is, { questionPrompt: b, selectedOptionsByQuestion: E, customAnswersByQuestion: O, onToggleOption: Bn, onCustomAnswerChange: On }) : /* @__PURE__ */ a(ht, { maxH: "10rem", showHorizontalScrollbar: !1, contentProps: {
793
+ }, e[66] = xt) : xt = e[66];
794
+ let St;
795
+ e[67] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (St = () => _e(!1), e[67] = St) : St = e[67];
796
+ let Ye;
797
+ e[68] !== h ? (Ye = h ? /* @__PURE__ */ c(B, { children: h }) : null, e[68] = h, e[69] = Ye) : Ye = e[69];
798
+ let Je;
799
+ e[70] !== J || e[71] !== Re || e[72] !== ve || e[73] !== $e || e[74] !== D || e[75] !== _ || e[76] !== p || e[77] !== m || e[78] !== b || e[79] !== Q || e[80] !== N ? (Je = b ? /* @__PURE__ */ c(Oo, { questionPrompt: b, selectedOptionsByQuestion: N, customAnswersByQuestion: J, onToggleOption: ds, onCustomAnswerChange: fs }) : /* @__PURE__ */ c(_t, { maxH: "10rem", showHorizontalScrollbar: !1, contentProps: {
782
800
  pr: "2xs"
783
- }, children: /* @__PURE__ */ a(So, { defaultState: B, isEditable: !P, placeholder: /* @__PURE__ */ a(as, { placeholder: p }), onChange: (R) => {
784
- z(R), m?.(R);
785
- }, onSubmit: xt }, je) }), e[66] = O, e[67] = je, e[68] = B, e[69] = xt, e[70] = P, e[71] = m, e[72] = p, e[73] = b, e[74] = E, e[75] = ze) : ze = e[75];
786
- let ct;
787
- e[76] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (ct = /* @__PURE__ */ a(Vn, {}), e[76] = ct) : ct = e[76];
788
- const _t = V ? "Stop Response" : "Message Sending", Rt = w ? void 0 : "Enter", It = U === "none";
789
- let qe;
790
- e[77] !== V || e[78] !== St || e[79] !== _t || e[80] !== Rt || e[81] !== It ? (qe = /* @__PURE__ */ a(ls, { canInterrupt: V, title: _t, shortcut: Rt, onClick: St, disabled: It }), e[77] = V, e[78] = St, e[79] = _t, e[80] = Rt, e[81] = It, e[82] = qe) : qe = e[82];
791
- let He;
792
- e[83] !== g || e[84] !== qe ? (He = /* @__PURE__ */ k(Me, { gap: "1", mt: "md", children: [
801
+ }, children: /* @__PURE__ */ c(Qe, { minH: pn, align: "center", children: /* @__PURE__ */ c(Ks, { defaultState: ve, isEditable: !D, placeholder: /* @__PURE__ */ c(Qo, { placeholder: m }), onChange: ($) => {
802
+ de($), p?.($);
803
+ }, onSubmit: $e, references: Q, onAddReference: _ }, Re) }) }), e[70] = J, e[71] = Re, e[72] = ve, e[73] = $e, e[74] = D, e[75] = _, e[76] = p, e[77] = m, e[78] = b, e[79] = Q, e[80] = N, e[81] = Je) : Je = e[81];
804
+ let wt;
805
+ e[82] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (wt = /* @__PURE__ */ c(xs, {}), e[82] = wt) : wt = e[82];
806
+ const Ot = te === "interrupt", zt = te === "interrupt" ? "Stop Response" : w ?? "Send message", Qt = P && !b ? void 0 : "Enter", qt = te === "none";
807
+ let Ze;
808
+ e[83] !== Et || e[84] !== Ot || e[85] !== zt || e[86] !== Qt || e[87] !== qt ? (Ze = /* @__PURE__ */ c(zo, { canInterrupt: Ot, title: zt, shortcut: Qt, onClick: Et, disabled: qt }), e[83] = Et, e[84] = Ot, e[85] = zt, e[86] = Qt, e[87] = qt, e[88] = Ze) : Ze = e[88];
809
+ let et;
810
+ e[89] !== g || e[90] !== Ze ? (et = /* @__PURE__ */ A(ae, { gap: "1", minH: pn, align: "center", children: [
793
811
  g,
794
- ct,
795
- qe
796
- ] }), e[83] = g, e[84] = qe, e[85] = He) : He = e[85];
797
- let Qe;
798
- e[86] !== Fe || e[87] !== ze || e[88] !== He ? (Qe = /* @__PURE__ */ k(Re, { direction: "column", color: "fg", children: [
799
- Fe,
800
- ze,
801
- He
802
- ] }), e[86] = Fe, e[87] = ze, e[88] = He, e[89] = Qe) : Qe = e[89];
803
- let ut;
804
- return e[90] !== ae.onDragOver || e[91] !== ae.onDropCapture || e[92] !== ae.onPasteCapture || e[93] !== Tt || e[94] !== wt || e[95] !== kt || e[96] !== Ct || e[97] !== $e || e[98] !== Qe ? (ut = /* @__PURE__ */ a(I, { ref: Ue, position: "relative", width: "100%", paddingX: "xs", paddingY: "xs", mt: Tt, bg: "bg", borderRadius: "xs", borderTopRadius: wt, borderWidth: "1px", borderStyle: "solid", borderColor: kt, zIndex: Ct, transition: "border-color 0.2s ease-in-out", _hover: $e, _focusWithin: lt, onPasteCapture: ae.onPasteCapture, onDropCapture: ae.onDropCapture, onDragOver: ae.onDragOver, onClick: Te, onBlur: at, children: Qe }), e[90] = ae.onDragOver, e[91] = ae.onDropCapture, e[92] = ae.onPasteCapture, e[93] = Tt, e[94] = wt, e[95] = kt, e[96] = Ct, e[97] = $e, e[98] = Qe, e[99] = ut) : ut = e[99], ut;
812
+ wt,
813
+ Ze
814
+ ] }), e[89] = g, e[90] = Ze, e[91] = et) : et = e[91];
815
+ let tt;
816
+ e[92] !== Ye || e[93] !== Je || e[94] !== et ? (tt = /* @__PURE__ */ A(Qe, { direction: "column", color: "fg", gap: "xs", children: [
817
+ Ye,
818
+ Je,
819
+ et
820
+ ] }), e[92] = Ye, e[93] = Je, e[94] = et, e[95] = tt) : tt = e[95];
821
+ let Tt;
822
+ return e[96] !== xe.onDragOver || e[97] !== xe.onDropCapture || e[98] !== xe.onPasteCapture || e[99] !== Dt || e[100] !== Bt || e[101] !== Ft || e[102] !== Lt || e[103] !== Xe || e[104] !== tt ? (Tt = /* @__PURE__ */ c(B, { ref: qe, position: "relative", width: "100%", paddingX: "xs", paddingY: "xs", mt: Dt, bg: "bg", borderRadius: "xs", borderTopRadius: Bt, borderWidth: "1px", borderStyle: "solid", borderColor: Ft, zIndex: Lt, transition: "border-color 0.2s ease-in-out", _hover: Xe, _focusWithin: xt, onPasteCapture: xe.onPasteCapture, onDropCapture: xe.onDropCapture, onDragOver: xe.onDragOver, onClick: lt, onBlur: St, children: tt }), e[96] = xe.onDragOver, e[97] = xe.onDropCapture, e[98] = xe.onPasteCapture, e[99] = Dt, e[100] = Bt, e[101] = Ft, e[102] = Lt, e[103] = Xe, e[104] = tt, e[105] = Tt) : Tt = e[105], Tt;
805
823
  };
806
- function us() {
824
+ function Ho() {
807
825
  }
808
- function ds(t) {
826
+ function Wo(t) {
809
827
  return t + 1;
810
828
  }
811
- function fs(t) {
829
+ function Vo(t) {
812
830
  return t + 1;
813
831
  }
814
- const ps = (t = "") => JSON.stringify(To(t)), ms = 360, hs = 4, gs = "min(10vh, 4rem)", bn = "min(70dvh, calc(100dvh - 12rem), 22rem)", vt = 1, bs = (t) => t.parts.reduce((e, n) => n.type !== "text" ? e : {
832
+ const pt = (t) => typeof t == "object" && t !== null && !Array.isArray(t), No = (t) => {
833
+ try {
834
+ const e = JSON.parse(t);
835
+ return pt(e) ? e : null;
836
+ } catch {
837
+ return null;
838
+ }
839
+ }, jo = (t) => pt(t) ? t : typeof t == "string" && t.trim().length > 0 ? No(t) : null, ot = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, we = (t) => {
840
+ const e = ot(t);
841
+ if (e) return e;
842
+ if (Array.isArray(t)) {
843
+ const n = t.map(we).filter((o) => o !== null);
844
+ return n.length > 0 ? n.join(`
845
+ `) : null;
846
+ }
847
+ return pt(t) ? we(t.response) ?? we(t.answer) ?? we(t.text) ?? we(t.answers) : null;
848
+ }, Uo = (t) => {
849
+ if (typeof t == "string" && t.trim().length > 0)
850
+ return {
851
+ label: t,
852
+ description: void 0
853
+ };
854
+ if (!pt(t)) return null;
855
+ const e = ot(t.label);
856
+ return e ? {
857
+ label: e,
858
+ description: ot(t.description) ?? void 0
859
+ } : null;
860
+ }, Ko = (t, e) => {
861
+ if (!pt(t)) return null;
862
+ const n = ot(t.question);
863
+ if (!n) return null;
864
+ const o = Array.isArray(t.options) ? t.options.map(Uo).filter((i) => i !== null) : [], s = ot(t.type), r = typeof t.custom == "boolean" ? t.custom : typeof t.allowCustomAnswer == "boolean" ? t.allowCustomAnswer : o.length === 0 || s === "freeform" || s === "text";
865
+ return {
866
+ id: ot(t.id) ?? `question-${e}`,
867
+ question: n,
868
+ options: o,
869
+ multiple: typeof t.multiple == "boolean" ? t.multiple : s === "multi_choice" || s === "multiple_choice",
870
+ required: typeof t.required == "boolean" ? t.required : !0,
871
+ allowCustomAnswer: r
872
+ };
873
+ }, Hn = (t) => {
874
+ const e = jo(t);
875
+ if (!e || !Array.isArray(e.questions)) return null;
876
+ const n = e.questions.map(Ko).filter((o) => o !== null);
877
+ return n.length === 0 ? null : {
878
+ questions: n
879
+ };
880
+ }, Go = (t) => t.tool.toLowerCase() === "question", Xo = (t) => {
881
+ for (let e = t.length - 1; e >= 0; e -= 1) {
882
+ const n = t[e];
883
+ if (n.role === "assistant")
884
+ for (let o = n.parts.length - 1; o >= 0; o -= 1) {
885
+ const s = n.parts[o];
886
+ if (s.type !== "tool" || !Go(s)) continue;
887
+ return we(s.state?.output) ?? we(s.state?.metadata) ? void 0 : Hn(s.state?.input) ?? void 0;
888
+ }
889
+ }
890
+ }, Yo = (t = "") => JSON.stringify(Gs(t)), Wn = {
891
+ animationName: "message-fade-in",
892
+ animationDuration: "200ms",
893
+ animationTimingFunction: "ease-out"
894
+ }, Jo = (t) => {
895
+ const e = /* @__PURE__ */ new Set(), n = new Set(t.state.seenKeys);
896
+ for (const o of t.itemKeys)
897
+ t.state.initialized && !n.has(o) && e.add(o), n.add(o);
898
+ return {
899
+ animatedKeys: e,
900
+ state: {
901
+ initialized: !0,
902
+ seenKeys: n
903
+ }
904
+ };
905
+ }, Zo = (t, e) => {
906
+ if (t.length !== e.length) return !1;
907
+ for (let n = 0; n < t.length; n += 1) if (t[n] !== e[n]) return !1;
908
+ return !0;
909
+ }, er = (t) => {
910
+ const e = Te({
911
+ initialized: !1,
912
+ seenKeys: /* @__PURE__ */ new Set()
913
+ }), n = Te(null);
914
+ if (n.current && Zo(n.current.itemKeys, t))
915
+ return n.current.animatedKeys;
916
+ const o = Jo({
917
+ itemKeys: t,
918
+ state: e.current
919
+ });
920
+ return e.current = o.state, n.current = {
921
+ itemKeys: [...t],
922
+ animatedKeys: o.animatedKeys
923
+ }, o.animatedKeys;
924
+ }, tr = 360, nr = 4, sr = "min(10vh, 4rem)", Vn = "min(70dvh, calc(100dvh - 12rem), 22rem)", Ut = 1, or = (t) => t.parts.reduce((e, n) => n.type !== "text" ? e : {
815
925
  lineCount: e.lineCount + n.text.split(/\r\n|\r|\n/).length,
816
926
  textLength: e.textLength + n.text.length
817
927
  }, {
818
928
  lineCount: 0,
819
929
  textLength: 0
820
- }), ys = (t) => {
930
+ }), rr = (t) => {
821
931
  if (t.role !== "user") return !1;
822
932
  const {
823
933
  lineCount: e,
824
934
  textLength: n
825
- } = bs(t);
826
- return n > ms || e > hs;
827
- }, xs = (t, e) => {
935
+ } = or(t);
936
+ return n > tr || e > nr;
937
+ }, ir = (t, e) => {
828
938
  const n = Math.max(0, t.scrollHeight - t.clientHeight);
829
- return e === 0 || n <= vt ? !1 : e < 0 ? t.scrollTop > vt : t.scrollTop < n - vt;
830
- }, Ss = (t) => t.type === "text", Ts = (t) => (t.parts ?? []).filter(Ss).map((e) => e.text.trim()).filter(Boolean).join(`
939
+ return e === 0 || n <= Ut ? !1 : e < 0 ? t.scrollTop > Ut : t.scrollTop < n - Ut;
940
+ }, lr = (t) => t.type === "text", ar = (t) => (t.parts ?? []).filter(lr).map((e) => e.text.trim()).filter(Boolean).join(`
831
941
 
832
- `), ws = (t, e, n) => t.createdAt ? new Intl.DateTimeFormat(e, {
942
+ `), cr = (t, e, n) => t.createdAt ? new Intl.DateTimeFormat(e, {
833
943
  hour: "numeric",
834
944
  minute: "2-digit",
835
945
  timeZone: n
836
- }).format(new Date(t.createdAt)) : "", Bt = (t) => {
837
- const e = T(20), {
946
+ }).format(new Date(t.createdAt)) : "", Yt = (t) => {
947
+ const e = k(20), {
838
948
  message: n,
839
- alwaysVisible: s,
840
- copyAlwaysVisible: o
841
- } = t, r = s === void 0 ? !1 : s, i = o === void 0 ? r : o, [l, c] = G(!1), u = Ne(null);
949
+ alwaysVisible: o,
950
+ copyAlwaysVisible: s
951
+ } = t, r = o === void 0 ? !1 : o, i = s === void 0 ? r : s, [l, a] = W(!1), u = Te(null);
842
952
  let d;
843
- e[0] !== n ? (d = Ts(n), e[0] = n, e[1] = d) : d = e[1];
953
+ e[0] !== n ? (d = ar(n), e[0] = n, e[1] = d) : d = e[1];
844
954
  const f = d;
845
- let m;
846
- e[2] !== n ? (m = ws(n), e[2] = n, e[3] = m) : m = e[3];
847
- const p = m;
955
+ let p;
956
+ e[2] !== n ? (p = cr(n), e[2] = n, e[3] = p) : p = e[3];
957
+ const m = p;
848
958
  let h, g;
849
959
  e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = () => () => {
850
960
  u.current !== null && window.clearTimeout(u.current);
851
- }, g = [], e[4] = h, e[5] = g) : (h = e[4], g = e[5]), Ae(h, g);
961
+ }, g = [], e[4] = h, e[5] = g) : (h = e[4], g = e[5]), le(h, g);
852
962
  let y;
853
963
  e[6] !== f ? (y = async () => {
854
964
  if (f)
855
965
  try {
856
- await navigator.clipboard.writeText(f), c(!0), u.current !== null && window.clearTimeout(u.current), u.current = window.setTimeout(() => c(!1), 1200);
966
+ await navigator.clipboard.writeText(f), a(!0), u.current !== null && window.clearTimeout(u.current), u.current = window.setTimeout(() => a(!1), 1200);
857
967
  } catch {
858
- c(!1);
968
+ a(!1);
859
969
  }
860
970
  }, e[6] = f, e[7] = y) : y = e[7];
861
- const b = y;
862
- if (!f && !p)
971
+ const x = y;
972
+ if (!f && !m)
863
973
  return null;
864
- const x = r ? "1" : "0", C = r ? "auto" : "none";
865
- let A;
866
- e[8] !== p ? (A = p ? /* @__PURE__ */ a(X, { textStyle: "label/XS/regular", color: "fg.muted", children: p }) : null, e[8] = p, e[9] = A) : A = e[9];
974
+ const b = r ? "1" : "0", S = r ? "auto" : "none";
975
+ let T;
976
+ e[8] !== m ? (T = m ? /* @__PURE__ */ c(j, { textStyle: "label/XS/regular", color: "fg.muted", children: m }) : null, e[8] = m, e[9] = T) : T = e[9];
867
977
  let w;
868
- e[10] !== i || e[11] !== b || e[12] !== f || e[13] !== l ? (w = f ? /* @__PURE__ */ a(I, { opacity: i ? "1" : "0", pointerEvents: i ? "auto" : "none", transition: "opacity 120ms ease", css: Kt, children: /* @__PURE__ */ a(cn, { content: l ? "Copied" : "Copy message", children: /* @__PURE__ */ a($t, { "aria-label": l ? "Copied" : "Copy message", variant: "ghost", size: "2xs", onClick: b, children: l ? /* @__PURE__ */ a(rn, { size: 12 }) : /* @__PURE__ */ a(eo, { size: 12 }) }) }) }) : null, e[10] = i, e[11] = b, e[12] = f, e[13] = l, e[14] = w) : w = e[14];
869
- let _;
870
- return e[15] !== w || e[16] !== x || e[17] !== C || e[18] !== A ? (_ = /* @__PURE__ */ k(Me, { "data-chat-message-action-panel": "true", gap: "2xs", minH: "6", opacity: x, pointerEvents: C, transition: "opacity 120ms ease", css: Kt, children: [
871
- A,
978
+ e[10] !== i || e[11] !== x || e[12] !== f || e[13] !== l ? (w = f ? /* @__PURE__ */ c(B, { opacity: i ? "1" : "0", pointerEvents: i ? "auto" : "none", transition: "opacity 120ms ease", css: hn, children: /* @__PURE__ */ c(Fn, { content: l ? "Copied" : "Copy message", children: /* @__PURE__ */ c(nt, { "aria-label": l ? "Copied" : "Copy message", variant: "ghost", size: "2xs", onClick: x, children: l ? /* @__PURE__ */ c(Pn, { size: 12 }) : /* @__PURE__ */ c(vs, { size: 12 }) }) }) }) : null, e[10] = i, e[11] = x, e[12] = f, e[13] = l, e[14] = w) : w = e[14];
979
+ let C;
980
+ return e[15] !== w || e[16] !== b || e[17] !== S || e[18] !== T ? (C = /* @__PURE__ */ A(ae, { "data-chat-message-action-panel": "true", gap: "2xs", minH: "6", opacity: b, pointerEvents: S, transition: "opacity 120ms ease", css: hn, children: [
981
+ T,
872
982
  w
873
- ] }), e[15] = w, e[16] = x, e[17] = C, e[18] = A, e[19] = _) : _ = e[19], _;
874
- }, Kt = {
983
+ ] }), e[15] = w, e[16] = b, e[17] = S, e[18] = T, e[19] = C) : C = e[19], C;
984
+ }, hn = {
875
985
  "[data-chat-message-with-actions]:hover &, [data-chat-message-with-actions]:focus-within &": {
876
986
  opacity: 1,
877
987
  pointerEvents: "auto"
@@ -884,44 +994,44 @@ const ps = (t = "") => JSON.stringify(To(t)), ms = 360, hs = 4, gs = "min(10vh,
884
994
  opacity: 1,
885
995
  pointerEvents: "auto"
886
996
  }
887
- }, ks = (t) => {
888
- const e = T(8);
889
- let n, s;
997
+ }, ur = (t) => {
998
+ const e = k(8);
999
+ let n, o;
890
1000
  e[0] !== t ? ({
891
1001
  children: n,
892
- ...s
893
- } = t, e[0] = t, e[1] = n, e[2] = s) : (n = e[1], s = e[2]);
894
- let o;
895
- e[3] !== n ? (o = /* @__PURE__ */ a(un, { defaultState: n, fullWidth: !0 }), e[3] = n, e[4] = o) : o = e[4];
1002
+ ...o
1003
+ } = t, e[0] = t, e[1] = n, e[2] = o) : (n = e[1], o = e[2]);
1004
+ let s;
1005
+ e[3] !== n ? (s = /* @__PURE__ */ c(Ln, { defaultState: n, fullWidth: !0 }), e[3] = n, e[4] = s) : s = e[4];
896
1006
  let r;
897
- return e[5] !== s || e[6] !== o ? (r = /* @__PURE__ */ a(I, { ...s, children: o }), e[5] = s, e[6] = o, e[7] = r) : r = e[7], r;
898
- }, Cs = ks, gt = (t) => t.replace(/^tool-/i, "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase(), As = (t) => {
899
- const e = gt(t), n = e.replace(/_/g, "");
1007
+ return e[5] !== o || e[6] !== s ? (r = /* @__PURE__ */ c(B, { ...o, children: s }), e[5] = o, e[6] = s, e[7] = r) : r = e[7], r;
1008
+ }, dr = ur, vt = (t) => t.replace(/^tool-/i, "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[\s-]+/g, "_").toLowerCase(), fr = (t) => {
1009
+ const e = vt(t), n = e.replace(/_/g, "");
900
1010
  return [.../* @__PURE__ */ new Set([t, e, n])];
901
- }, yn = {
902
- shell: ln,
903
- ls: ao,
904
- read_file: lo,
905
- write_file: io,
906
- delete_file: ro,
907
- patch: so,
908
- upload_files: oo,
909
- download_file: no,
910
- move_file: to
911
- }, _s = {
912
- dot: ho,
913
- danger: an,
914
- search: mo,
915
- browser: po,
916
- file: fo,
917
- question: uo,
918
- todo: co,
919
- terminal: ln,
920
- ...yn
921
- }, Gt = "dot", Rs = (t) => Object.hasOwn(yn, t), Is = (t) => _s[t], xn = (t) => {
922
- if (!t) return Gt;
923
- const e = gt(t);
924
- if (Rs(e)) return e;
1011
+ }, Nn = {
1012
+ shell: Dn,
1013
+ ls: Fs,
1014
+ read_file: Bs,
1015
+ write_file: Ds,
1016
+ delete_file: En,
1017
+ patch: Es,
1018
+ upload_files: Ps,
1019
+ download_file: Ms,
1020
+ move_file: Rs
1021
+ }, pr = {
1022
+ dot: qs,
1023
+ danger: Bn,
1024
+ search: Qs,
1025
+ browser: zs,
1026
+ file: Os,
1027
+ question: $s,
1028
+ todo: Ls,
1029
+ terminal: Dn,
1030
+ ...Nn
1031
+ }, gn = "dot", mr = (t) => Object.hasOwn(Nn, t), hr = (t) => pr[t], jn = (t) => {
1032
+ if (!t) return gn;
1033
+ const e = vt(t);
1034
+ if (mr(e)) return e;
925
1035
  const n = e.replace(/_/g, "");
926
1036
  switch (e) {
927
1037
  case "read":
@@ -948,52 +1058,52 @@ const ps = (t = "") => JSON.stringify(To(t)), ms = 360, hs = 4, gs = "min(10vh,
948
1058
  case "file":
949
1059
  return "file";
950
1060
  default:
951
- return n === "todowrite" || n === "todo" ? "todo" : Gt;
1061
+ return n === "todowrite" || n === "todo" ? "todo" : gn;
952
1062
  }
953
1063
  };
954
- function Ht(t) {
1064
+ function rn(t) {
955
1065
  const e = t.lastIndexOf("/");
956
1066
  return e >= 0 ? t.slice(e + 1) : t;
957
1067
  }
958
- function ft(t) {
1068
+ function kt(t) {
959
1069
  if (!t) return null;
960
1070
  const e = t.split(" ")[0].trim();
961
1071
  if (e === "/dev/null") return null;
962
1072
  let n = e;
963
1073
  return (n.startsWith("a/") || n.startsWith("b/")) && (n = n.slice(2)), n.replace(/^\/+/, "").replace(/\\/g, "/");
964
1074
  }
965
- const bt = (t) => t.startsWith("--- "), Qt = (t) => t.startsWith("+++ "), Wt = (t) => t.startsWith("@@"), Ps = (t) => t.startsWith("+") && !(Qt(t) || t === "+++"), Ms = (t) => t.startsWith("-") && !(bt(t) || t === "---"), Es = (t, e) => {
1075
+ const Rt = (t) => t.startsWith("--- "), ln = (t) => t.startsWith("+++ "), an = (t) => t.startsWith("@@"), gr = (t) => t.startsWith("+") && !(ln(t) || t === "+++"), br = (t) => t.startsWith("-") && !(Rt(t) || t === "---"), yr = (t, e) => {
966
1076
  t.has(e) || t.set(e, {
967
1077
  additions: 0,
968
1078
  deletions: 0
969
1079
  });
970
- }, vs = (t, e) => {
1080
+ }, xr = (t, e) => {
971
1081
  const n = t.get(e);
972
1082
  n && (n.additions += 1);
973
- }, Ls = (t, e) => {
1083
+ }, Sr = (t, e) => {
974
1084
  const n = t.get(e);
975
1085
  n && (n.deletions += 1);
976
- }, Ds = (t, e, n) => {
977
- if (bt(t))
1086
+ }, wr = (t, e, n) => {
1087
+ if (Rt(t))
978
1088
  return {
979
1089
  ...e,
980
- lastMinusHeader: ft(t.slice(4)),
1090
+ lastMinusHeader: kt(t.slice(4)),
981
1091
  inHunk: !1
982
1092
  };
983
- if (Qt(t)) {
984
- const o = ft(t.slice(4)) ?? e.lastMinusHeader;
985
- return o && Es(n, o), {
1093
+ if (ln(t)) {
1094
+ const s = kt(t.slice(4)) ?? e.lastMinusHeader;
1095
+ return s && yr(n, s), {
986
1096
  ...e,
987
- currentPath: o,
1097
+ currentPath: s,
988
1098
  inHunk: !1
989
1099
  };
990
1100
  }
991
- return e.currentPath ? Wt(t) ? {
1101
+ return e.currentPath ? an(t) ? {
992
1102
  ...e,
993
1103
  inHunk: !0
994
- } : e.inHunk ? Ps(t) ? (vs(n, e.currentPath), e) : (Ms(t) && Ls(n, e.currentPath), e) : e : e;
1104
+ } : e.inHunk ? gr(t) ? (xr(n, e.currentPath), e) : (br(t) && Sr(n, e.currentPath), e) : e : e;
995
1105
  };
996
- function Sn(t) {
1106
+ function Un(t) {
997
1107
  if (!t || typeof t != "string") return [];
998
1108
  const e = /* @__PURE__ */ new Map();
999
1109
  let n = {
@@ -1001,34 +1111,34 @@ function Sn(t) {
1001
1111
  lastMinusHeader: null,
1002
1112
  inHunk: !1
1003
1113
  };
1004
- const s = t.split(/\r?\n/);
1005
- for (const o of s)
1006
- n = Ds(o, n, e);
1007
- return Array.from(e.entries()).map(([o, {
1114
+ const o = t.split(/\r?\n/);
1115
+ for (const s of o)
1116
+ n = wr(s, n, e);
1117
+ return Array.from(e.entries()).map(([s, {
1008
1118
  additions: r,
1009
1119
  deletions: i
1010
1120
  }]) => ({
1011
- filePath: o,
1121
+ filePath: s,
1012
1122
  additions: r,
1013
1123
  deletions: i
1014
1124
  }));
1015
1125
  }
1016
- function Bs(t) {
1017
- return Sn(t).map((e) => ({
1126
+ function Tr(t) {
1127
+ return Un(t).map((e) => ({
1018
1128
  kind: "diff",
1019
- fileName: Ht(e.filePath),
1129
+ fileName: rn(e.filePath),
1020
1130
  filePath: e.filePath,
1021
1131
  additions: e.additions,
1022
1132
  deletions: e.deletions
1023
1133
  }));
1024
1134
  }
1025
- function Os(t) {
1026
- return Sn(t).map((e) => e.filePath);
1135
+ function Cr(t) {
1136
+ return Un(t).map((e) => e.filePath);
1027
1137
  }
1028
- const Tn = (t) => bt(t) || t.startsWith("diff --git "), $s = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", Fs = (t, e, n) => {
1138
+ const Kn = (t) => Rt(t) || t.startsWith("diff --git "), kr = (t) => t.startsWith(" ") || t.startsWith("+") || t.startsWith("-") ? !1 : t.trim() !== "", Ar = (t, e, n) => {
1029
1139
  if (t.startsWith(" ")) {
1030
- const s = t.slice(1);
1031
- e.push(s), n.push(s);
1140
+ const o = t.slice(1);
1141
+ e.push(o), n.push(o);
1032
1142
  return;
1033
1143
  }
1034
1144
  if (t.startsWith("-")) {
@@ -1036,33 +1146,33 @@ const Tn = (t) => bt(t) || t.startsWith("diff --git "), $s = (t) => t.startsWith
1036
1146
  return;
1037
1147
  }
1038
1148
  t.startsWith("+") && n.push(t.slice(1));
1039
- }, zs = (t, e, n, s) => {
1040
- let o = e;
1041
- for (; o < t.length; ) {
1042
- const r = t[o] || "";
1043
- if (Tn(r) || Wt(r) || $s(r))
1149
+ }, Ir = (t, e, n, o) => {
1150
+ let s = e;
1151
+ for (; s < t.length; ) {
1152
+ const r = t[s] || "";
1153
+ if (Kn(r) || an(r) || kr(r))
1044
1154
  break;
1045
- Fs(r, n, s), o += 1;
1155
+ Ar(r, n, o), s += 1;
1046
1156
  }
1047
- return (n.length > 0 || s.length > 0) && (n.push(""), s.push("")), o;
1048
- }, qs = (t, e) => {
1049
- const n = ft((t[e] || "").slice(4)), s = t[e + 1] || "";
1050
- if (!Qt(s)) return {
1157
+ return (n.length > 0 || o.length > 0) && (n.push(""), o.push("")), s;
1158
+ }, _r = (t, e) => {
1159
+ const n = kt((t[e] || "").slice(4)), o = t[e + 1] || "";
1160
+ if (!ln(o)) return {
1051
1161
  nextIndex: e + 1
1052
1162
  };
1053
- const r = ft(s.slice(4)) ?? n ?? "", i = [], l = [];
1054
- let c = e + 2;
1055
- for (; c < t.length; ) {
1056
- const u = t[c] || "";
1057
- if (Tn(u)) break;
1058
- if (!Wt(u)) {
1059
- c += 1;
1163
+ const r = kt(o.slice(4)) ?? n ?? "", i = [], l = [];
1164
+ let a = e + 2;
1165
+ for (; a < t.length; ) {
1166
+ const u = t[a] || "";
1167
+ if (Kn(u)) break;
1168
+ if (!an(u)) {
1169
+ a += 1;
1060
1170
  continue;
1061
1171
  }
1062
- c = zs(t, c + 1, i, l);
1172
+ a = Ir(t, a + 1, i, l);
1063
1173
  }
1064
1174
  return {
1065
- nextIndex: c,
1175
+ nextIndex: a,
1066
1176
  preview: {
1067
1177
  filePath: r,
1068
1178
  original: i.join(`
@@ -1072,25 +1182,25 @@ const Tn = (t) => bt(t) || t.startsWith("diff --git "), $s = (t) => t.startsWith
1072
1182
  }
1073
1183
  };
1074
1184
  };
1075
- function Hs(t) {
1185
+ function vr(t) {
1076
1186
  if (!t || typeof t != "string") return [];
1077
1187
  const e = t.split(/\r?\n/), n = [];
1078
- let s = 0;
1079
- for (; s < e.length; ) {
1080
- const o = e[s] || "";
1081
- if (!bt(o)) {
1082
- s += 1;
1188
+ let o = 0;
1189
+ for (; o < e.length; ) {
1190
+ const s = e[o] || "";
1191
+ if (!Rt(s)) {
1192
+ o += 1;
1083
1193
  continue;
1084
1194
  }
1085
1195
  const {
1086
1196
  nextIndex: r,
1087
1197
  preview: i
1088
- } = qs(e, s);
1089
- i && n.push(i), s = Math.max(r, s + 1);
1198
+ } = _r(e, o);
1199
+ i && n.push(i), o = Math.max(r, o + 1);
1090
1200
  }
1091
1201
  return n;
1092
1202
  }
1093
- const Qs = {
1203
+ const Rr = {
1094
1204
  apply_patch: "Apply patch",
1095
1205
  bash: "Run command",
1096
1206
  edit: "Edit file",
@@ -1099,7 +1209,7 @@ const Qs = {
1099
1209
  read: "Read file",
1100
1210
  skill: "Load skill",
1101
1211
  todowrite: "Update todos"
1102
- }, Xt = {
1212
+ }, bn = {
1103
1213
  pending: "queued",
1104
1214
  error: "failed",
1105
1215
  "output-error": "failed",
@@ -1108,126 +1218,126 @@ const Qs = {
1108
1218
  running: "running",
1109
1219
  completed: "completed",
1110
1220
  failed: "failed"
1111
- }, wn = (t) => t.replace(/^tool-/, "").toLowerCase(), Ws = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Ns = (t) => wn(t.tool ?? "tool"), Vs = (t) => {
1112
- const e = wn(t);
1113
- return Qs[e] ?? Ws(e.replace(/_/g, " "));
1114
- }, js = (t) => {
1221
+ }, Gn = (t) => t.replace(/^tool-/, "").toLowerCase(), Mr = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), Pr = (t) => Gn(t.tool ?? "tool"), Er = (t) => {
1222
+ const e = Gn(t);
1223
+ return Rr[e] ?? Mr(e.replace(/_/g, " "));
1224
+ }, Dr = (t) => {
1115
1225
  const e = t.state?.status ?? t.status;
1116
1226
  if (!e || typeof e != "string") return null;
1117
1227
  const n = e.replace(/-/g, "_");
1118
- return Xt[n] ? Xt[n] : n.includes("stream") ? "running" : null;
1119
- }, kn = (t) => {
1228
+ return bn[n] ? bn[n] : n.includes("stream") ? "running" : null;
1229
+ }, Xn = (t) => {
1120
1230
  const e = t.state?.status ?? t.status;
1121
1231
  return e === "error" || e === "output-error" || e === "failed";
1122
- }, fe = (t) => kn(t) ? {
1232
+ }, ke = (t) => Xn(t) ? {
1123
1233
  type: "icon",
1124
1234
  icon: "danger"
1125
1235
  } : {
1126
1236
  type: "icon",
1127
- icon: xn(Ns(t))
1128
- }, pe = (t, e, n) => {
1129
- const o = [{
1237
+ icon: jn(Pr(t))
1238
+ }, Ae = (t, e, n) => {
1239
+ const s = [{
1130
1240
  kind: "text",
1131
- text: n ?? Vs(t.tool ?? "tool"),
1241
+ text: n ?? Er(t.tool ?? "tool"),
1132
1242
  bold: !0
1133
1243
  }];
1134
- e && o.push({
1244
+ e && s.push({
1135
1245
  kind: "text",
1136
1246
  text: e,
1137
1247
  muted: !0
1138
1248
  });
1139
- const r = js(t);
1140
- return r && r !== "completed" && o.push({
1249
+ const r = Dr(t);
1250
+ return r && r !== "completed" && s.push({
1141
1251
  kind: "text",
1142
1252
  text: r,
1143
1253
  muted: !0
1144
- }), o;
1145
- }, Ee = (t) => {
1254
+ }), s;
1255
+ }, Ve = (t) => {
1146
1256
  const e = t.state?.input;
1147
1257
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
1148
- }, et = (t) => {
1258
+ }, mt = (t) => {
1149
1259
  const e = t.state?.output;
1150
1260
  return !e || typeof e != "object" || Array.isArray(e) ? null : e;
1151
- }, S = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, pt = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, Us = (t, e) => {
1152
- const n = pt(t.state);
1153
- return n ? pt(n[e]) : null;
1154
- }, Ks = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), Gs = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), Cn = (t) => {
1155
- const e = et(t);
1156
- return [Us(t, "metadata"), pt(e?.metadata)].filter(Boolean);
1157
- }, Xs = (t) => {
1158
- const e = pt(t);
1261
+ }, v = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, At = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, Br = (t, e) => {
1262
+ const n = At(t.state);
1263
+ return n ? At(n[e]) : null;
1264
+ }, Fr = (t) => t.replace(/\\/g, "/").replace(/^\/+/, ""), Lr = (t) => t.includes("--- ") && t.includes("+++ ") && t.includes("@@"), Yn = (t) => {
1265
+ const e = mt(t);
1266
+ return [Br(t, "metadata"), At(e?.metadata)].filter(Boolean);
1267
+ }, $r = (t) => {
1268
+ const e = At(t);
1159
1269
  if (!e) return null;
1160
- const n = S(e.filePath) ?? S(e.relativePath) ?? S(e.path);
1270
+ const n = v(e.filePath) ?? v(e.relativePath) ?? v(e.path);
1161
1271
  return n ? {
1162
- filePath: Ks(n),
1272
+ filePath: Fr(n),
1163
1273
  additions: typeof e.additions == "number" ? e.additions : 0,
1164
1274
  deletions: typeof e.deletions == "number" ? e.deletions : 0,
1165
- diff: S(e.diff) ?? void 0,
1166
- before: S(e.before) ?? void 0,
1167
- after: S(e.after) ?? void 0
1275
+ diff: v(e.diff) ?? void 0,
1276
+ before: v(e.before) ?? void 0,
1277
+ after: v(e.after) ?? void 0
1168
1278
  } : null;
1169
- }, An = (t) => {
1279
+ }, Jn = (t) => {
1170
1280
  const e = [];
1171
- for (const n of Cn(t)) {
1172
- const s = Array.isArray(n.files) ? n.files : [];
1173
- for (const o of s) {
1174
- const r = Xs(o);
1281
+ for (const n of Yn(t)) {
1282
+ const o = Array.isArray(n.files) ? n.files : [];
1283
+ for (const s of o) {
1284
+ const r = $r(s);
1175
1285
  r && e.push(r);
1176
1286
  }
1177
1287
  }
1178
1288
  return e;
1179
- }, Ys = (t) => {
1180
- const e = Ee(t), n = S(e?.diff);
1289
+ }, Or = (t) => {
1290
+ const e = Ve(t), n = v(e?.diff);
1181
1291
  if (n) return n;
1182
- for (const r of Cn(t)) {
1183
- const i = S(r.diff);
1292
+ for (const r of Yn(t)) {
1293
+ const i = v(r.diff);
1184
1294
  if (i) return i;
1185
1295
  }
1186
- const s = An(t).map((r) => r.diff).filter((r) => !!r);
1187
- if (s.length > 0) return s.join(`
1296
+ const o = Jn(t).map((r) => r.diff).filter((r) => !!r);
1297
+ if (o.length > 0) return o.join(`
1188
1298
  `);
1189
- const o = S(e?.patchText);
1190
- return o && Gs(o) ? o : null;
1191
- }, Js = (t) => {
1299
+ const s = v(e?.patchText);
1300
+ return s && Lr(s) ? s : null;
1301
+ }, zr = (t) => {
1192
1302
  const e = /* @__PURE__ */ new Set(), n = [];
1193
- for (const s of t)
1194
- e.has(s.filePath) || (e.add(s.filePath), n.push({
1303
+ for (const o of t)
1304
+ e.has(o.filePath) || (e.add(o.filePath), n.push({
1195
1305
  kind: "diff",
1196
- fileName: Ht(s.filePath),
1197
- filePath: s.filePath,
1198
- additions: s.additions,
1199
- deletions: s.deletions
1306
+ fileName: rn(o.filePath),
1307
+ filePath: o.filePath,
1308
+ additions: o.additions,
1309
+ deletions: o.deletions
1200
1310
  }));
1201
1311
  return n;
1202
- }, Zs = (t) => Array.from(new Set(t.map((e) => e.filePath))), yt = (t) => {
1203
- const e = et(t);
1204
- return S(t.state?.output) ?? S(e?.returnDisplay) ?? S(e?.preview) ?? S(e?.stdout) ?? S(e?.content);
1205
- }, er = (t) => {
1312
+ }, Qr = (t) => Array.from(new Set(t.map((e) => e.filePath))), Mt = (t) => {
1313
+ const e = mt(t);
1314
+ return v(t.state?.output) ?? v(e?.returnDisplay) ?? v(e?.preview) ?? v(e?.stdout) ?? v(e?.content);
1315
+ }, qr = (t) => {
1206
1316
  const e = t.match(/<skill_content(?:\s+name="([^"]+)")?>([\s\S]*?)<\/skill_content>/);
1207
1317
  return e ? {
1208
- skillName: S(e[1]) ?? void 0,
1209
- content: S(e[2]) ?? ""
1318
+ skillName: v(e[1]) ?? void 0,
1319
+ content: v(e[2]) ?? ""
1210
1320
  } : null;
1211
- }, tr = (t) => {
1212
- const e = Ee(t);
1213
- return S(e?.name) ?? S(e?.skillName) ?? S(e?.skill) ?? S(e?.skill_name) ?? void 0;
1214
- }, _n = (t) => ({
1321
+ }, Hr = (t) => {
1322
+ const e = Ve(t);
1323
+ return v(e?.name) ?? v(e?.skillName) ?? v(e?.skill) ?? v(e?.skill_name) ?? void 0;
1324
+ }, Zn = (t) => ({
1215
1325
  kind: "link",
1216
- text: Ht(t),
1326
+ text: rn(t),
1217
1327
  filePath: t
1218
- }), me = (t, e) => !kn(t) || !t.state?.errorText ? e : [{
1328
+ }), Ie = (t, e) => !Xn(t) || !t.state?.errorText ? e : [{
1219
1329
  type: "comment",
1220
1330
  text: t.state.errorText
1221
- }, ...e], Rn = (t) => Hs(t ?? void 0).map((e) => ({
1331
+ }, ...e], es = (t) => vr(t ?? void 0).map((e) => ({
1222
1332
  type: "diff",
1223
1333
  language: "diff",
1224
1334
  original: e.original,
1225
1335
  modified: e.modified,
1226
1336
  sideBySide: !1
1227
- })), nr = (t) => Bs(t ?? void 0), or = (t) => Os(t ?? void 0), sr = (t) => {
1228
- const e = Ys(t), n = An(t), s = pe(t, void 0, "Apply patch"), o = nr(e);
1229
- o.length > 0 ? s.push(...o) : s.push(...Js(n));
1230
- const r = [...Rn(e)];
1337
+ })), Wr = (t) => Tr(t ?? void 0), Vr = (t) => Cr(t ?? void 0), Nr = (t) => {
1338
+ const e = Or(t), n = Jn(t), o = Ae(t, void 0, "Apply patch"), s = Wr(e);
1339
+ s.length > 0 ? o.push(...s) : o.push(...zr(n));
1340
+ const r = [...es(e)];
1231
1341
  if (r.length === 0)
1232
1342
  for (const i of n)
1233
1343
  !i.before && !i.after || r.push({
@@ -1238,113 +1348,67 @@ const Qs = {
1238
1348
  sideBySide: !1
1239
1349
  });
1240
1350
  if (r.length === 0) {
1241
- const i = or(e);
1242
- i.length === 0 && i.push(...Zs(n)), i.length > 0 && r.push({
1351
+ const i = Vr(e);
1352
+ i.length === 0 && i.push(...Qr(n)), i.length > 0 && r.push({
1243
1353
  type: "references",
1244
1354
  references: i
1245
1355
  });
1246
1356
  }
1247
1357
  return {
1248
- indicator: fe(t),
1249
- title: s,
1250
- blocks: me(t, r)
1358
+ indicator: ke(t),
1359
+ title: o,
1360
+ blocks: Ie(t, r)
1251
1361
  };
1252
- }, rr = (t, e) => [{
1362
+ }, jr = (t, e) => [{
1253
1363
  type: "diff",
1254
1364
  language: "text",
1255
1365
  original: t,
1256
1366
  modified: e,
1257
1367
  sideBySide: !1
1258
- }], ir = (t) => {
1259
- const e = Ee(t), n = et(t), s = S(e?.filePath) ?? S(e?.file_path) ?? S(n?.filePath) ?? void 0, o = S(n?.oldString) ?? S(e?.old_string) ?? void 0, r = S(n?.newString) ?? S(e?.new_string) ?? void 0, i = pe(t, void 0, "Edit file");
1260
- s && i.push(_n(s));
1261
- const l = o !== void 0 && r !== void 0 ? rr(o, r) : Rn(S(n?.diff));
1368
+ }], Ur = (t) => {
1369
+ const e = Ve(t), n = mt(t), o = v(e?.filePath) ?? v(e?.file_path) ?? v(n?.filePath) ?? void 0, s = v(n?.oldString) ?? v(e?.old_string) ?? void 0, r = v(n?.newString) ?? v(e?.new_string) ?? void 0, i = Ae(t, void 0, "Edit file");
1370
+ o && i.push(Zn(o));
1371
+ const l = s !== void 0 && r !== void 0 ? jr(s, r) : es(v(n?.diff));
1262
1372
  return {
1263
- indicator: fe(t),
1373
+ indicator: ke(t),
1264
1374
  title: i,
1265
- blocks: me(t, l)
1375
+ blocks: Ie(t, l)
1266
1376
  };
1267
- }, tt = (t) => typeof t == "object" && t !== null && !Array.isArray(t), lr = (t) => {
1268
- try {
1269
- const e = JSON.parse(t);
1270
- return tt(e) ? e : null;
1271
- } catch {
1272
- return null;
1273
- }
1274
- }, ar = (t) => tt(t) ? t : typeof t == "string" && t.trim().length > 0 ? lr(t) : null, Ve = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, Pe = (t) => {
1275
- const e = Ve(t);
1276
- if (e) return e;
1277
- if (Array.isArray(t)) {
1278
- const n = t.map(Pe).filter((s) => s !== null);
1279
- return n.length > 0 ? n.join(`
1280
- `) : null;
1281
- }
1282
- return tt(t) ? Pe(t.response) ?? Pe(t.answer) ?? Pe(t.text) ?? Pe(t.answers) : null;
1283
- }, cr = (t) => {
1284
- if (typeof t == "string" && t.trim().length > 0)
1285
- return {
1286
- label: t,
1287
- description: void 0
1288
- };
1289
- if (!tt(t)) return null;
1290
- const e = Ve(t.label);
1291
- return e ? {
1292
- label: e,
1293
- description: Ve(t.description) ?? void 0
1294
- } : null;
1295
- }, ur = (t, e) => {
1296
- if (!tt(t)) return null;
1297
- const n = Ve(t.question);
1298
- if (!n) return null;
1299
- const s = Array.isArray(t.options) ? t.options.map(cr).filter((i) => i !== null) : [], o = Ve(t.type), r = typeof t.custom == "boolean" ? t.custom : typeof t.allowCustomAnswer == "boolean" ? t.allowCustomAnswer : o === "freeform" || o === "text";
1300
- return s.length === 0 && !r ? null : {
1301
- id: Ve(t.id) ?? `question-${e}`,
1302
- question: n,
1303
- options: s,
1304
- multiple: typeof t.multiple == "boolean" ? t.multiple : o === "multi_choice" || o === "multiple_choice",
1305
- required: typeof t.required == "boolean" ? t.required : !1,
1306
- allowCustomAnswer: r
1307
- };
1308
- }, dr = (t) => {
1309
- const e = ar(t);
1310
- if (!e || !Array.isArray(e.questions)) return null;
1311
- const n = e.questions.map(ur).filter((s) => s !== null);
1312
- return n.length === 0 ? null : {
1313
- type: "question-form",
1314
- questions: n
1315
- };
1316
- }, fr = (t) => {
1377
+ }, Kr = (t) => {
1317
1378
  const {
1318
1379
  buildBaseTitle: e,
1319
1380
  buildIndicator: n,
1320
- prependErrorBlock: s
1381
+ prependErrorBlock: o
1321
1382
  } = t;
1322
- return (o) => {
1323
- const r = Pe(o.state?.output) ?? Pe(o.state?.metadata), i = dr(o.state?.input);
1324
- if (!r && !i) return null;
1325
- const l = i ? `${i.questions.length} field${i.questions.length === 1 ? "" : "s"}` : void 0, c = r ? [] : [i];
1383
+ return (s) => {
1384
+ const r = we(s.state?.output) ?? we(s.state?.metadata), i = Hn(s.state?.input), l = i ? {
1385
+ type: "question-form",
1386
+ questions: i.questions
1387
+ } : null;
1388
+ if (!r && !l) return null;
1389
+ const a = l ? `${l.questions.length} field${l.questions.length === 1 ? "" : "s"}` : void 0, u = r ? [] : [l];
1326
1390
  return {
1327
- indicator: n(o),
1328
- title: e(o, l, "Question"),
1329
- blocks: s(o, c),
1391
+ indicator: n(s),
1392
+ title: e(s, a, "Question"),
1393
+ blocks: o(s, u),
1330
1394
  expandable: !1
1331
1395
  };
1332
1396
  };
1333
- }, pr = (t) => {
1334
- const e = Ee(t), n = et(t), s = S(e?.filePath) ?? S(e?.file_path) ?? S(e?.file) ?? S(n?.filePath) ?? S(n?.file) ?? S(n?.path) ?? void 0, o = pe(t, void 0, "Read file");
1335
- return s && o.push(_n(s)), {
1336
- indicator: fe(t),
1337
- title: o,
1338
- blocks: me(t, [])
1397
+ }, Gr = (t) => {
1398
+ const e = Ve(t), n = mt(t), o = v(e?.filePath) ?? v(e?.file_path) ?? v(e?.file) ?? v(n?.filePath) ?? v(n?.file) ?? v(n?.path) ?? void 0, s = Ae(t, void 0, "Read file");
1399
+ return o && s.push(Zn(o)), {
1400
+ indicator: ke(t),
1401
+ title: s,
1402
+ blocks: Ie(t, [])
1339
1403
  };
1340
- }, mr = (t) => {
1341
- const e = Ee(t), n = et(t), s = S(e?.command) ?? void 0, o = pe(t, s, "Run command"), r = [], i = yt(t);
1404
+ }, Xr = (t) => {
1405
+ const e = Ve(t), n = mt(t), o = v(e?.command) ?? void 0, s = Ae(t, o, "Run command"), r = [], i = Mt(t);
1342
1406
  i && r.push({
1343
1407
  type: "code",
1344
1408
  language: "text",
1345
1409
  code: i
1346
1410
  });
1347
- const l = S(n?.stderr);
1411
+ const l = v(n?.stderr);
1348
1412
  return l && l !== i && r.push({
1349
1413
  type: "code",
1350
1414
  language: "text",
@@ -1353,23 +1417,23 @@ const Qs = {
1353
1417
  type: "text",
1354
1418
  text: `Exit code: ${n.exitCode}`
1355
1419
  }), {
1356
- indicator: fe(t),
1357
- title: o,
1358
- blocks: me(t, r)
1420
+ indicator: ke(t),
1421
+ title: s,
1422
+ blocks: Ie(t, r)
1359
1423
  };
1360
- }, hr = (t) => {
1361
- const e = Ee(t), n = yt(t), s = S(e?.pattern) ?? void 0, o = pe(t, s, "Search files"), r = n ? [{
1424
+ }, Yr = (t) => {
1425
+ const e = Ve(t), n = Mt(t), o = v(e?.pattern) ?? void 0, s = Ae(t, o, "Search files"), r = n ? [{
1362
1426
  type: "code",
1363
1427
  language: "text",
1364
1428
  code: n
1365
1429
  }] : [];
1366
1430
  return {
1367
- indicator: fe(t),
1368
- title: o,
1369
- blocks: me(t, r)
1431
+ indicator: ke(t),
1432
+ title: s,
1433
+ blocks: Ie(t, r)
1370
1434
  };
1371
- }, gr = (t) => {
1372
- const e = Ee(t), n = yt(t), s = S(e?.pattern) ?? void 0, o = pe(t, s, "Find files"), r = [];
1435
+ }, Jr = (t) => {
1436
+ const e = Ve(t), n = Mt(t), o = v(e?.pattern) ?? void 0, s = Ae(t, o, "Find files"), r = [];
1373
1437
  if (n) {
1374
1438
  const i = n.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
1375
1439
  i.length > 0 && r.push({
@@ -1378,112 +1442,112 @@ const Qs = {
1378
1442
  });
1379
1443
  }
1380
1444
  return {
1381
- indicator: fe(t),
1382
- title: o,
1383
- blocks: me(t, r)
1445
+ indicator: ke(t),
1446
+ title: s,
1447
+ blocks: Ie(t, r)
1384
1448
  };
1385
- }, br = (t) => {
1386
- const e = yt(t), n = e ? er(e) : null, s = tr(t) ?? n?.skillName, o = pe(t, s, "Load skill"), r = n?.content ?? e, i = r ? [{
1449
+ }, Zr = (t) => {
1450
+ const e = Mt(t), n = e ? qr(e) : null, o = Hr(t) ?? n?.skillName, s = Ae(t, o, "Load skill"), r = n?.content ?? e, i = r ? [{
1387
1451
  type: "code",
1388
1452
  language: "markdown",
1389
1453
  code: r
1390
1454
  }] : [];
1391
1455
  return {
1392
- indicator: fe(t),
1393
- title: o,
1394
- blocks: me(t, i)
1456
+ indicator: ke(t),
1457
+ title: s,
1458
+ blocks: Ie(t, i)
1395
1459
  };
1396
- }, Lt = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, In = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, yr = (t) => {
1397
- const e = In(t);
1460
+ }, Kt = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, ts = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, ei = (t) => {
1461
+ const e = ts(t);
1398
1462
  if (!e) return null;
1399
- const n = Lt(e.content) ?? Lt(e.title);
1463
+ const n = Kt(e.content) ?? Kt(e.title);
1400
1464
  if (!n) return null;
1401
- const s = Lt(e.status);
1465
+ const o = Kt(e.status);
1402
1466
  return {
1403
1467
  label: n,
1404
- checked: s === "completed"
1468
+ checked: o === "completed"
1405
1469
  };
1406
- }, Yt = (t) => {
1470
+ }, yn = (t) => {
1407
1471
  if (!t) return {
1408
1472
  items: [],
1409
1473
  explicit: !1
1410
1474
  };
1411
1475
  const e = (() => {
1412
1476
  if (Array.isArray(t)) return t;
1413
- const n = In(t);
1477
+ const n = ts(t);
1414
1478
  return !n || !Array.isArray(n.todos) ? null : n.todos;
1415
1479
  })();
1416
1480
  return e ? {
1417
- items: e.map(yr).filter((n) => n !== null),
1481
+ items: e.map(ei).filter((n) => n !== null),
1418
1482
  explicit: !0
1419
1483
  } : {
1420
1484
  items: [],
1421
1485
  explicit: !1
1422
1486
  };
1423
- }, xr = (t) => {
1487
+ }, ti = (t) => {
1424
1488
  const {
1425
1489
  buildBaseTitle: e,
1426
1490
  buildIndicator: n,
1427
- prependErrorBlock: s
1491
+ prependErrorBlock: o
1428
1492
  } = t;
1429
- return (o) => {
1430
- const r = Yt(o.state?.input), i = Yt(o.state?.output), l = i.explicit ? i : r;
1493
+ return (s) => {
1494
+ const r = yn(s.state?.input), i = yn(s.state?.output), l = i.explicit ? i : r;
1431
1495
  if (!l.explicit) return null;
1432
- const c = l.items, u = `${c.length} item${c.length === 1 ? "" : "s"}`, d = e(o, u, "Update todos");
1433
- if (c.length === 0)
1496
+ const a = l.items, u = `${a.length} item${a.length === 1 ? "" : "s"}`, d = e(s, u, "Update todos");
1497
+ if (a.length === 0)
1434
1498
  return {
1435
- indicator: n(o),
1499
+ indicator: n(s),
1436
1500
  title: d,
1437
- blocks: s(o, [{
1501
+ blocks: o(s, [{
1438
1502
  type: "comment",
1439
1503
  text: "No todos"
1440
1504
  }])
1441
1505
  };
1442
1506
  const f = [{
1443
1507
  type: "todo-list",
1444
- items: c
1508
+ items: a
1445
1509
  }];
1446
1510
  return {
1447
- indicator: n(o),
1511
+ indicator: n(s),
1448
1512
  title: d,
1449
- blocks: s(o, f)
1513
+ blocks: o(s, f)
1450
1514
  };
1451
1515
  };
1452
- }, Sr = fr({
1453
- buildBaseTitle: pe,
1454
- buildIndicator: fe,
1455
- prependErrorBlock: me
1456
- }), Jt = xr({
1457
- buildBaseTitle: pe,
1458
- buildIndicator: fe,
1459
- prependErrorBlock: me
1460
- }), Zt = () => ({
1461
- apply_patch: sr,
1462
- bash: mr,
1463
- edit: ir,
1464
- glob: gr,
1465
- grep: hr,
1466
- question: Sr,
1467
- read: pr,
1468
- skill: br,
1469
- todo_write: Jt,
1470
- todowrite: Jt
1471
- }), en = {
1516
+ }, ni = Kr({
1517
+ buildBaseTitle: Ae,
1518
+ buildIndicator: ke,
1519
+ prependErrorBlock: Ie
1520
+ }), xn = ti({
1521
+ buildBaseTitle: Ae,
1522
+ buildIndicator: ke,
1523
+ prependErrorBlock: Ie
1524
+ }), Sn = () => ({
1525
+ apply_patch: Nr,
1526
+ bash: Xr,
1527
+ edit: Ur,
1528
+ glob: Jr,
1529
+ grep: Yr,
1530
+ question: ni,
1531
+ read: Gr,
1532
+ skill: Zr,
1533
+ todo_write: xn,
1534
+ todowrite: xn
1535
+ }), wn = {
1472
1536
  pending: "queued",
1473
1537
  error: "failed",
1474
1538
  "output-error": "failed",
1475
1539
  "input-streaming": "running",
1476
1540
  "input-available": "queued"
1477
- }, Tr = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), wr = (t) => {
1478
- const e = gt(t ?? "tool").replace(/_/g, " ");
1479
- return Tr(e);
1480
- }, Pn = (t) => t === "error" || t === "output-error", kr = (t) => Pn(t.state?.status) ? {
1541
+ }, si = (t) => t.split(" ").filter((e) => e.length > 0).map((e) => e[0].toUpperCase() + e.slice(1)).join(" "), ns = (t) => {
1542
+ const e = vt(t ?? "tool").replace(/_/g, " ");
1543
+ return si(e);
1544
+ }, ss = (t) => t === "error" || t === "output-error", oi = (t) => ss(t.state?.status) ? {
1481
1545
  type: "icon",
1482
1546
  icon: "danger"
1483
1547
  } : {
1484
1548
  type: "icon",
1485
- icon: xn(t.tool ?? "tool")
1486
- }, Cr = (t) => !t || typeof t != "string" ? null : en[t] ? en[t] : t.includes("stream") ? "running" : null, tn = (t) => {
1549
+ icon: jn(t.tool ?? "tool")
1550
+ }, ri = (t) => !t || typeof t != "string" ? null : wn[t] ? wn[t] : t.includes("stream") ? "running" : null, ii = (t) => {
1487
1551
  if (typeof t == "string") return t;
1488
1552
  if (t == null) return null;
1489
1553
  try {
@@ -1491,366 +1555,486 @@ const Qs = {
1491
1555
  } catch {
1492
1556
  return null;
1493
1557
  }
1494
- }, Ar = (t) => {
1495
- const e = [];
1496
- Pn(t.state?.status) && t.state?.errorText && e.push({
1497
- type: "comment",
1498
- text: t.state.errorText
1499
- });
1500
- const n = tn(t.state?.input);
1501
- n && e.push({
1558
+ }, Jt = (t) => t == null ? !0 : typeof t == "string" ? t.trim().length === 0 : Array.isArray(t) ? t.length === 0 || t.every(Jt) : typeof t == "object" ? Object.values(t).every(Jt) : !1, Pt = (t) => !t || typeof t != "object" || Array.isArray(t) ? null : t, V = (t) => typeof t == "string" && t.trim().length > 0 ? t : null, li = (t) => V(t.mime_type) ?? V(t.mediaType) ?? V(t.mimeType), Tn = (t) => !!t?.startsWith("image/"), ai = /\.(avif|bmp|gif|jpe?g|png|svg|webp)(\?.*)?$/i, os = (t, e) => {
1559
+ const n = Pt(t);
1560
+ if (!n) return null;
1561
+ const o = li(n), s = V(n.data);
1562
+ if (s && Tn(o))
1563
+ return {
1564
+ type: "image",
1565
+ src: `data:${o};base64,${s}`,
1566
+ alt: e
1567
+ };
1568
+ const r = V(n.url) ?? V(n.src);
1569
+ return r && (Tn(o) || ai.test(r)) ? {
1570
+ type: "image",
1571
+ src: r,
1572
+ alt: e
1573
+ } : null;
1574
+ }, rs = (t) => {
1575
+ const e = Pt(t);
1576
+ if (!e) return null;
1577
+ const n = V(e.path) ?? V(e.filePath) ?? V(e.filename), o = V(e.content) ?? V(e.body) ?? V(e.text);
1578
+ return !n || o === null ? null : {
1579
+ filePath: n,
1580
+ content: o
1581
+ };
1582
+ }, ci = {
1583
+ css: "css",
1584
+ html: "html",
1585
+ js: "js",
1586
+ json: "json",
1587
+ jsx: "jsx",
1588
+ md: "markdown",
1589
+ py: "python",
1590
+ ts: "ts",
1591
+ tsx: "tsx",
1592
+ yaml: "yaml",
1593
+ yml: "yaml"
1594
+ }, ui = (t) => {
1595
+ const e = t.split(".").pop()?.toLowerCase();
1596
+ return e ? ci[e] ?? e : "text";
1597
+ }, Cn = (t, e) => e.length === 0 ? [] : [{
1598
+ type: "text",
1599
+ text: t
1600
+ }, ...e], di = (t, e) => {
1601
+ const n = [];
1602
+ for (const o of t) {
1603
+ const s = Pt(o), r = V(s?.type);
1604
+ if (r === "image") {
1605
+ const i = os(o, e);
1606
+ i && n.push(i);
1607
+ continue;
1608
+ }
1609
+ if (r === "text") {
1610
+ const i = V(s?.text);
1611
+ i && n.push({
1612
+ type: "text",
1613
+ text: i
1614
+ });
1615
+ continue;
1616
+ }
1617
+ n.push(...Zt(o, e));
1618
+ }
1619
+ return n;
1620
+ }, fi = (t) => {
1621
+ const e = rs(t);
1622
+ return e ? [{
1502
1623
  type: "code",
1503
- language: "json",
1504
- code: n
1505
- });
1506
- const s = tn(t.state?.output);
1507
- return s && e.push({
1624
+ language: ui(e.filePath),
1625
+ code: e.content
1626
+ }] : null;
1627
+ }, pi = (t) => {
1628
+ const e = Pt(t), n = V(e?.attachment_name) ?? V(e?.attachmentName), o = V(e?.attachment_file_id) ?? V(e?.attachmentFileId);
1629
+ return !n && !o ? null : [{
1630
+ type: "text",
1631
+ text: n ?? `Attachment ${o}`
1632
+ }];
1633
+ }, Zt = (t, e) => {
1634
+ if (Jt(t)) return [];
1635
+ const n = os(t, e);
1636
+ if (n) return [n];
1637
+ if (Array.isArray(t)) return di(t, e);
1638
+ const o = fi(t);
1639
+ if (o) return o;
1640
+ const s = pi(t);
1641
+ if (s) return s;
1642
+ const r = ii(t);
1643
+ return r?.trim() ? [{
1508
1644
  type: "code",
1509
- language: "json",
1510
- code: s
1511
- }), e;
1512
- }, _r = (t) => {
1645
+ language: typeof t == "string" ? "text" : "json",
1646
+ code: r
1647
+ }] : [];
1648
+ }, mi = (t) => {
1649
+ const e = [], n = ns(t.tool);
1650
+ return ss(t.state?.status) && t.state?.errorText && e.push({
1651
+ type: "comment",
1652
+ text: t.state.errorText
1653
+ }), e.push(...Cn("Input", Zt(t.state?.input, `${n} input`))), e.push(...Cn("Output", Zt(t.state?.output, `${n} output`))), e;
1654
+ }, hi = (t) => {
1513
1655
  const e = [{
1514
1656
  kind: "text",
1515
- text: wr(t.tool),
1657
+ text: ns(t.tool),
1516
1658
  bold: !0
1517
- }], n = Cr(t.state?.status);
1518
- return n && e.push({
1659
+ }], n = rs(t.state?.output);
1660
+ n && e.push({
1661
+ kind: "link",
1662
+ text: n.filePath,
1663
+ filePath: n.filePath
1664
+ });
1665
+ const o = ri(t.state?.status);
1666
+ return o && e.push({
1519
1667
  kind: "text",
1520
- text: n,
1668
+ text: o,
1521
1669
  muted: !0
1522
1670
  }), {
1523
- indicator: kr(t),
1671
+ indicator: oi(t),
1524
1672
  title: e,
1525
- blocks: Ar(t)
1673
+ blocks: mi(t)
1526
1674
  };
1527
- }, Rr = (t) => t ? {
1528
- ...Zt(),
1675
+ }, gi = (t) => t.kind === "text" || t.kind === "link" ? t.text.trim().length > 0 : t.kind === "diff" ? t.fileName.trim().length > 0 : !0, bi = (t) => {
1676
+ switch (t.type) {
1677
+ case "comment":
1678
+ case "code":
1679
+ case "text":
1680
+ return t.type === "code" ? t.code.trim().length > 0 : t.text.trim().length > 0;
1681
+ case "diff":
1682
+ return t.original.trim().length > 0 || t.modified.trim().length > 0;
1683
+ case "image":
1684
+ return t.src.trim().length > 0;
1685
+ case "todo-list":
1686
+ return t.items.length > 0;
1687
+ case "question-form":
1688
+ return t.questions.length > 0;
1689
+ case "references":
1690
+ return t.references.length > 0;
1691
+ case "input":
1692
+ case "component":
1693
+ return !0;
1694
+ }
1695
+ }, yi = (t) => {
1696
+ const e = t.title.some(gi), n = (t.blocks ?? []).some(bi);
1697
+ return e || n;
1698
+ }, xi = (t) => t ? {
1699
+ ...Sn(),
1529
1700
  ...t
1530
- } : Zt(), Ir = (t, e) => {
1701
+ } : Sn(), Si = (t, e) => {
1531
1702
  const n = t.tool ?? "tool";
1532
- for (const s of As(n)) {
1533
- const o = e[s];
1534
- if (o) return o;
1703
+ for (const o of fr(n)) {
1704
+ const s = e[o];
1705
+ if (s) return s;
1535
1706
  }
1536
- }, Pr = (t, e, n) => {
1537
- const s = Ir(t, e);
1538
- if (s) {
1539
- const o = s(t, n);
1540
- if (o) return o;
1707
+ }, wi = (t, e, n) => {
1708
+ const o = Si(t, e);
1709
+ if (o) {
1710
+ const s = o(t, n);
1711
+ if (s) return s;
1541
1712
  }
1542
- return _r(t);
1543
- }, Mr = (t, e) => {
1544
- const n = Rr(e?.toolRenderers);
1713
+ return hi(t);
1714
+ }, Ti = (t, e) => {
1715
+ const n = xi(e?.toolRenderers);
1545
1716
  return {
1546
- items: t.map((o) => Pr(o, n, e))
1717
+ items: t.map((s) => wi(s, n, e)).filter(yi)
1547
1718
  };
1548
- }, Ce = jn, Mn = (t, e, n, s = !1) => {
1549
- s && t.stopPropagation(), e.href || t.preventDefault(), e.filePath && n?.(e.filePath);
1719
+ }, Oe = Ss, is = (t, e, n, o = !1) => {
1720
+ o && t.stopPropagation(), e.href || t.preventDefault(), e.filePath && n?.(e.filePath);
1550
1721
  };
1551
- function Er(t) {
1552
- const e = T(6), {
1722
+ function Ci(t) {
1723
+ const e = k(6), {
1553
1724
  seg: n
1554
1725
  } = t;
1555
- let s;
1556
- e[0] !== n.alt || e[1] !== n.src ? (s = /* @__PURE__ */ a(We.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = s) : s = e[2];
1557
1726
  let o;
1558
- e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ a(We.Fallback, { background: "bg.muted", color: "fg.muted" }), e[3] = o) : o = e[3];
1727
+ e[0] !== n.alt || e[1] !== n.src ? (o = /* @__PURE__ */ c(st.Image, { src: n.src, alt: n.alt }), e[0] = n.alt, e[1] = n.src, e[2] = o) : o = e[2];
1728
+ let s;
1729
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ c(st.Fallback, { background: "bg.muted", color: "fg.muted" }), e[3] = s) : s = e[3];
1559
1730
  let r;
1560
- return e[4] !== s ? (r = /* @__PURE__ */ k(We.Root, { width: "1.5rem", height: "1.5rem", children: [
1561
- s,
1562
- o
1563
- ] }), e[4] = s, e[5] = r) : r = e[5], r;
1731
+ return e[4] !== o ? (r = /* @__PURE__ */ A(st.Root, { width: "1.5rem", height: "1.5rem", children: [
1732
+ o,
1733
+ s
1734
+ ] }), e[4] = o, e[5] = r) : r = e[5], r;
1564
1735
  }
1565
- function vr(t) {
1566
- const e = T(9), {
1736
+ function ki(t) {
1737
+ const e = k(9), {
1567
1738
  seg: n,
1568
- onOpenFile: s
1569
- } = t, o = n.additions ?? 0, r = n.deletions ?? 0;
1739
+ onOpenFile: o
1740
+ } = t, s = n.additions ?? 0, r = n.deletions ?? 0;
1570
1741
  let i;
1571
- e[0] !== s || e[1] !== n.fileName || e[2] !== n.filePath ? (i = () => {
1572
- const c = n.filePath ?? n.fileName;
1573
- s?.(c);
1574
- }, e[0] = s, e[1] = n.fileName, e[2] = n.filePath, e[3] = i) : i = e[3];
1742
+ e[0] !== o || e[1] !== n.fileName || e[2] !== n.filePath ? (i = () => {
1743
+ const a = n.filePath ?? n.fileName;
1744
+ o?.(a);
1745
+ }, e[0] = o, e[1] = n.fileName, e[2] = n.filePath, e[3] = i) : i = e[3];
1575
1746
  let l;
1576
- return e[4] !== n.fileName || e[5] !== o || e[6] !== r || e[7] !== i ? (l = /* @__PURE__ */ a(fn, { fileName: n.fileName, additions: o, deletions: r, onClickFileLink: i }), e[4] = n.fileName, e[5] = o, e[6] = r, e[7] = i, e[8] = l) : l = e[8], l;
1747
+ return e[4] !== n.fileName || e[5] !== s || e[6] !== r || e[7] !== i ? (l = /* @__PURE__ */ c(to, { fileName: n.fileName, additions: s, deletions: r, onClickFileLink: i }), e[4] = n.fileName, e[5] = s, e[6] = r, e[7] = i, e[8] = l) : l = e[8], l;
1577
1748
  }
1578
- function Lr(t) {
1579
- const e = T(13), {
1749
+ function Ai(t) {
1750
+ const e = k(13), {
1580
1751
  seg: n,
1581
- onOpenFile: s
1582
- } = t, o = n.bold ? "medium" : void 0, r = !!(n.href || n.filePath), i = n.href ?? "#", l = (n.muted, "fg.muted"), c = r ? "pointer" : "default";
1752
+ onOpenFile: o
1753
+ } = t, s = n.bold ? "medium" : void 0, r = !!(n.href || n.filePath), i = n.href ?? "#", l = (n.muted, "fg.muted"), a = r ? "pointer" : "default";
1583
1754
  let u;
1584
- e[0] !== s || e[1] !== n ? (u = (p) => Mn(p, n, s, !0), e[0] = s, e[1] = n, e[2] = u) : u = e[2];
1755
+ e[0] !== o || e[1] !== n ? (u = (m) => is(m, n, o, !0), e[0] = o, e[1] = n, e[2] = u) : u = e[2];
1585
1756
  const d = n.muted ? "fg.muted" : "fg.blue-dark";
1586
1757
  let f;
1587
1758
  e[3] !== d ? (f = {
1588
1759
  textDecoration: "underline",
1589
1760
  color: d
1590
1761
  }, e[3] = d, e[4] = f) : f = e[4];
1591
- let m;
1592
- return e[5] !== o || e[6] !== n.text || e[7] !== i || e[8] !== l || e[9] !== c || e[10] !== u || e[11] !== f ? (m = /* @__PURE__ */ a(sn, { href: i, fontWeight: o, color: l, textDecoration: "none", cursor: c, onClick: u, _hover: f, children: n.text }), e[5] = o, e[6] = n.text, e[7] = i, e[8] = l, e[9] = c, e[10] = u, e[11] = f, e[12] = m) : m = e[12], m;
1762
+ let p;
1763
+ return e[5] !== s || e[6] !== n.text || e[7] !== i || e[8] !== l || e[9] !== a || e[10] !== u || e[11] !== f ? (p = /* @__PURE__ */ c(Mn, { href: i, fontWeight: s, color: l, textDecoration: "none", cursor: a, onClick: u, _hover: f, children: n.text }), e[5] = s, e[6] = n.text, e[7] = i, e[8] = l, e[9] = a, e[10] = u, e[11] = f, e[12] = p) : p = e[12], p;
1593
1764
  }
1594
- function Dr(t) {
1595
- const e = T(12), {
1765
+ function Ii(t) {
1766
+ const e = k(12), {
1596
1767
  seg: n,
1597
- onOpenFile: s
1598
- } = t, o = n.bold ? "medium" : void 0, r = n.href ?? "#", i = n.muted ? "fg.muted" : "accent.primary";
1768
+ onOpenFile: o
1769
+ } = t, s = n.bold ? "medium" : void 0, r = n.href ?? "#", i = n.muted ? "fg.muted" : "accent.primary";
1599
1770
  let l;
1600
- e[0] !== s || e[1] !== n ? (l = (f) => Mn(f, n, s), e[0] = s, e[1] = n, e[2] = l) : l = e[2];
1601
- const c = n.muted ? "fg.muted" : "accent.primary";
1771
+ e[0] !== o || e[1] !== n ? (l = (f) => is(f, n, o), e[0] = o, e[1] = n, e[2] = l) : l = e[2];
1772
+ const a = n.muted ? "fg.muted" : "accent.primary";
1602
1773
  let u;
1603
- e[3] !== c ? (u = {
1604
- color: c,
1774
+ e[3] !== a ? (u = {
1775
+ color: a,
1605
1776
  textDecoration: "underline"
1606
- }, e[3] = c, e[4] = u) : u = e[4];
1777
+ }, e[3] = a, e[4] = u) : u = e[4];
1607
1778
  let d;
1608
- return e[5] !== o || e[6] !== n.text || e[7] !== r || e[8] !== i || e[9] !== l || e[10] !== u ? (d = /* @__PURE__ */ a(sn, { href: r, fontWeight: o, color: i, textDecoration: "underline", onClick: l, _hover: u, children: n.text }), e[5] = o, e[6] = n.text, e[7] = r, e[8] = i, e[9] = l, e[10] = u, e[11] = d) : d = e[11], d;
1779
+ return e[5] !== s || e[6] !== n.text || e[7] !== r || e[8] !== i || e[9] !== l || e[10] !== u ? (d = /* @__PURE__ */ c(Mn, { href: r, fontWeight: s, color: i, textDecoration: "underline", onClick: l, _hover: u, children: n.text }), e[5] = s, e[6] = n.text, e[7] = r, e[8] = i, e[9] = l, e[10] = u, e[11] = d) : d = e[11], d;
1609
1780
  }
1610
- function Br(t) {
1611
- const e = T(6), {
1781
+ function _i(t) {
1782
+ const e = k(6), {
1612
1783
  seg: n,
1613
- isClickable: s
1614
- } = t, o = n.bold ? "medium" : void 0, r = s && !n.muted ? "fg" : "fg.muted";
1784
+ isClickable: o
1785
+ } = t, s = n.bold ? "medium" : void 0, r = o && !n.muted ? "fg" : "fg.muted";
1615
1786
  let i;
1616
1787
  e[0] !== r ? (i = {
1617
1788
  color: r
1618
1789
  }, e[0] = r, e[1] = i) : i = e[1];
1619
1790
  let l;
1620
- return e[2] !== n.text || e[3] !== o || e[4] !== i ? (l = /* @__PURE__ */ a(Je, { fontWeight: o, color: "fg.muted", _groupHover: i, children: n.text }), e[2] = n.text, e[3] = o, e[4] = i, e[5] = l) : l = e[5], l;
1791
+ return e[2] !== n.text || e[3] !== s || e[4] !== i ? (l = /* @__PURE__ */ c(dt, { fontWeight: s, color: "fg.muted", _groupHover: i, children: n.text }), e[2] = n.text, e[3] = s, e[4] = i, e[5] = l) : l = e[5], l;
1621
1792
  }
1622
- function Or(t) {
1623
- const e = T(11), {
1793
+ function vi(t) {
1794
+ const e = k(11), {
1624
1795
  seg: n,
1625
- isClickable: s,
1626
- onOpenFile: o
1796
+ isClickable: o,
1797
+ onOpenFile: s
1627
1798
  } = t;
1628
1799
  switch (n.kind) {
1629
1800
  case "avatar": {
1630
1801
  let r;
1631
- return e[0] !== n ? (r = /* @__PURE__ */ a(Er, { seg: n }), e[0] = n, e[1] = r) : r = e[1], r;
1802
+ return e[0] !== n ? (r = /* @__PURE__ */ c(Ci, { seg: n }), e[0] = n, e[1] = r) : r = e[1], r;
1632
1803
  }
1633
1804
  case "diff": {
1634
1805
  let r;
1635
- return e[2] !== o || e[3] !== n ? (r = /* @__PURE__ */ a(vr, { seg: n, onOpenFile: o }), e[2] = o, e[3] = n, e[4] = r) : r = e[4], r;
1806
+ return e[2] !== s || e[3] !== n ? (r = /* @__PURE__ */ c(ki, { seg: n, onOpenFile: s }), e[2] = s, e[3] = n, e[4] = r) : r = e[4], r;
1636
1807
  }
1637
1808
  case "link": {
1638
1809
  let r;
1639
- return e[5] !== o || e[6] !== n ? (r = n.variant === "bubble" ? /* @__PURE__ */ a(Lr, { seg: n, onOpenFile: o }) : /* @__PURE__ */ a(Dr, { seg: n, onOpenFile: o }), e[5] = o, e[6] = n, e[7] = r) : r = e[7], r;
1810
+ return e[5] !== s || e[6] !== n ? (r = n.variant === "bubble" ? /* @__PURE__ */ c(Ai, { seg: n, onOpenFile: s }) : /* @__PURE__ */ c(Ii, { seg: n, onOpenFile: s }), e[5] = s, e[6] = n, e[7] = r) : r = e[7], r;
1640
1811
  }
1641
1812
  case "text": {
1642
1813
  let r;
1643
- return e[8] !== s || e[9] !== n ? (r = /* @__PURE__ */ a(Br, { seg: n, isClickable: s }), e[8] = s, e[9] = n, e[10] = r) : r = e[10], r;
1814
+ return e[8] !== o || e[9] !== n ? (r = /* @__PURE__ */ c(_i, { seg: n, isClickable: o }), e[8] = o, e[9] = n, e[10] = r) : r = e[10], r;
1644
1815
  }
1645
1816
  default:
1646
1817
  return null;
1647
1818
  }
1648
1819
  }
1649
- function $r(t) {
1650
- const e = T(10), {
1820
+ function Ri(t) {
1821
+ const e = k(10), {
1651
1822
  ind: n
1652
1823
  } = t;
1653
1824
  if (!n || n.type === "none")
1654
1825
  return null;
1655
1826
  if (n.type === "icon") {
1656
1827
  let i;
1657
- e[0] !== n.icon ? (i = Is(n.icon), e[0] = n.icon, e[1] = i) : i = e[1];
1828
+ e[0] !== n.icon ? (i = hr(n.icon), e[0] = n.icon, e[1] = i) : i = e[1];
1658
1829
  const l = i;
1659
- let c;
1660
- return e[2] !== l ? (c = /* @__PURE__ */ a(Ce.Indicator, { outline: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ a(Je, { display: "inline-flex", alignItems: "center", children: /* @__PURE__ */ a(l, { size: 14, strokeWidth: 1 }) }) }), e[2] = l, e[3] = c) : c = e[3], c;
1830
+ let a;
1831
+ return e[2] !== l ? (a = /* @__PURE__ */ c(Oe.Indicator, { outline: "none", border: "none", background: "bg", color: "fg", children: /* @__PURE__ */ c(dt, { display: "inline-flex", alignItems: "center", children: /* @__PURE__ */ c(l, { size: 14, strokeWidth: 1 }) }) }), e[2] = l, e[3] = a) : a = e[3], a;
1661
1832
  }
1662
- let s;
1663
- e[4] !== n.alt || e[5] !== n.src ? (s = /* @__PURE__ */ a(We.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = s) : s = e[6];
1664
1833
  let o;
1665
- e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ a(We.Fallback, { background: "bg.muted", color: "fg.muted" }), e[7] = o) : o = e[7];
1834
+ e[4] !== n.alt || e[5] !== n.src ? (o = /* @__PURE__ */ c(st.Image, { src: n.src, alt: n.alt }), e[4] = n.alt, e[5] = n.src, e[6] = o) : o = e[6];
1835
+ let s;
1836
+ e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ c(st.Fallback, { background: "bg.muted", color: "fg.muted" }), e[7] = s) : s = e[7];
1666
1837
  let r;
1667
- return e[8] !== s ? (r = /* @__PURE__ */ a(Ce.Indicator, { children: /* @__PURE__ */ k(We.Root, { boxSize: "full", children: [
1668
- s,
1669
- o
1670
- ] }) }), e[8] = s, e[9] = r) : r = e[9], r;
1838
+ return e[8] !== o ? (r = /* @__PURE__ */ c(Oe.Indicator, { children: /* @__PURE__ */ A(st.Root, { boxSize: "full", children: [
1839
+ o,
1840
+ s
1841
+ ] }) }), e[8] = o, e[9] = r) : r = e[9], r;
1671
1842
  }
1672
- function Fr(t) {
1673
- const e = T(5), {
1843
+ function Mi(t) {
1844
+ const e = k(5), {
1674
1845
  code: n,
1675
- language: s
1676
- } = t, o = s ? `${s} code block` : "code block";
1846
+ language: o
1847
+ } = t, s = o ? `${o} code block` : "code block";
1677
1848
  let r;
1678
- e[0] !== n ? (r = /* @__PURE__ */ a(I, { as: "code", children: n }), e[0] = n, e[1] = r) : r = e[1];
1849
+ e[0] !== n ? (r = /* @__PURE__ */ c(B, { as: "code", children: n }), e[0] = n, e[1] = r) : r = e[1];
1679
1850
  let i;
1680
- return e[2] !== o || e[3] !== r ? (i = /* @__PURE__ */ a(ht, { background: "bg.code", color: "fg", borderRadius: "md", showHorizontalScrollbar: !0, showVerticalScrollbar: !1, children: /* @__PURE__ */ a(I, { as: "pre", padding: "sm", fontFamily: "mono", fontSize: "xs", lineHeight: "shorter", whiteSpace: "pre", "aria-label": o, children: r }) }), e[2] = o, e[3] = r, e[4] = i) : i = e[4], i;
1851
+ return e[2] !== s || e[3] !== r ? (i = /* @__PURE__ */ c(_t, { background: "bg.code", color: "fg", borderRadius: "md", showHorizontalScrollbar: !0, showVerticalScrollbar: !1, children: /* @__PURE__ */ c(B, { as: "pre", padding: "sm", fontFamily: "mono", fontSize: "xs", lineHeight: "shorter", whiteSpace: "pre", "aria-label": s, children: r }) }), e[2] = s, e[3] = r, e[4] = i) : i = e[4], i;
1681
1852
  }
1682
- function zr(t) {
1683
- const e = T(30), {
1853
+ function Pi(t) {
1854
+ const e = k(38), {
1684
1855
  b: n,
1685
- onOpenFile: s
1856
+ onOpenFile: o
1686
1857
  } = t;
1687
1858
  switch (n.type) {
1688
1859
  case "comment": {
1689
- let o;
1690
- e[0] !== n.text ? (o = /* @__PURE__ */ a(ue.Body, { children: n.text }), e[0] = n.text, e[1] = o) : o = e[1];
1860
+ let s;
1861
+ e[0] !== n.text ? (s = /* @__PURE__ */ c(ie.Body, { children: n.text }), e[0] = n.text, e[1] = s) : s = e[1];
1691
1862
  let r;
1692
- e[2] !== n.reactions ? (r = n.reactions?.clap ? /* @__PURE__ */ a(ue.Footer, { children: /* @__PURE__ */ k(Ze, { children: [
1863
+ e[2] !== n.reactions ? (r = n.reactions?.clap ? /* @__PURE__ */ c(ie.Footer, { children: /* @__PURE__ */ A(ft, { children: [
1693
1864
  "👏 ",
1694
1865
  n.reactions.clap
1695
1866
  ] }) }) : null, e[2] = n.reactions, e[3] = r) : r = e[3];
1696
1867
  let i;
1697
- return e[4] !== o || e[5] !== r ? (i = /* @__PURE__ */ k(ue.Root, { children: [
1698
- o,
1868
+ return e[4] !== s || e[5] !== r ? (i = /* @__PURE__ */ A(ie.Root, { children: [
1869
+ s,
1699
1870
  r
1700
- ] }), e[4] = o, e[5] = r, e[6] = i) : i = e[6], i;
1871
+ ] }), e[4] = s, e[5] = r, e[6] = i) : i = e[6], i;
1701
1872
  }
1702
1873
  case "code": {
1703
- let o;
1704
- return e[7] !== n.code || e[8] !== n.language ? (o = /* @__PURE__ */ a(ue.Root, { border: "0", padding: "0", children: /* @__PURE__ */ a(ue.Body, { padding: "0", children: /* @__PURE__ */ a(Fr, { language: n.language, code: n.code }) }) }), e[7] = n.code, e[8] = n.language, e[9] = o) : o = e[9], o;
1874
+ let s;
1875
+ return e[7] !== n.code || e[8] !== n.language ? (s = /* @__PURE__ */ c(ie.Root, { border: "0", padding: "0", children: /* @__PURE__ */ c(ie.Body, { padding: "0", children: /* @__PURE__ */ c(Mi, { language: n.language, code: n.code }) }) }), e[7] = n.code, e[8] = n.language, e[9] = s) : s = e[9], s;
1705
1876
  }
1706
1877
  case "diff": {
1707
- const o = n.sideBySide ?? !1;
1878
+ const s = n.sideBySide ?? !1;
1708
1879
  let r;
1709
- return e[10] !== n.language || e[11] !== n.modified || e[12] !== n.original || e[13] !== o ? (r = /* @__PURE__ */ a(ue.Root, { border: "0", padding: "0", children: /* @__PURE__ */ a(ue.Body, { padding: "0", children: /* @__PURE__ */ a(I, { height: "240px", minW: "320px", overflow: "hidden", children: /* @__PURE__ */ a(Co, { original: n.original, modified: n.modified, language: n.language, sideBySide: o, disableScroll: !0 }) }) }) }), e[10] = n.language, e[11] = n.modified, e[12] = n.original, e[13] = o, e[14] = r) : r = e[14], r;
1880
+ return e[10] !== n.language || e[11] !== n.modified || e[12] !== n.original || e[13] !== s ? (r = /* @__PURE__ */ c(ie.Root, { border: "0", padding: "0", children: /* @__PURE__ */ c(ie.Body, { padding: "0", children: /* @__PURE__ */ c(B, { height: "240px", minW: "320px", overflow: "hidden", children: /* @__PURE__ */ c(eo, { original: n.original, modified: n.modified, language: n.language, sideBySide: s, disableScroll: !0 }) }) }) }), e[10] = n.language, e[11] = n.modified, e[12] = n.original, e[13] = s, e[14] = r) : r = e[14], r;
1710
1881
  }
1711
1882
  case "text": {
1712
- let o;
1713
- return e[15] !== n.text ? (o = /* @__PURE__ */ a(ue.Root, { background: "transparent", children: /* @__PURE__ */ a(ue.Body, { padding: "sm", children: /* @__PURE__ */ a(X, { textStyle: "label/S/regular", children: n.text }) }) }), e[15] = n.text, e[16] = o) : o = e[16], o;
1883
+ let s;
1884
+ return e[15] !== n.text ? (s = /* @__PURE__ */ c(ie.Root, { background: "transparent", children: /* @__PURE__ */ c(ie.Body, { padding: "sm", children: /* @__PURE__ */ c(j, { textStyle: "label/S/regular", children: n.text }) }) }), e[15] = n.text, e[16] = s) : s = e[16], s;
1714
1885
  }
1715
1886
  case "todo-list": {
1716
- let o;
1717
- return e[17] !== n.items ? (o = /* @__PURE__ */ a(Go, { items: n.items }), e[17] = n.items, e[18] = o) : o = e[18], o;
1887
+ let s;
1888
+ return e[17] !== n.items ? (s = /* @__PURE__ */ c(_o, { items: n.items }), e[17] = n.items, e[18] = s) : s = e[18], s;
1718
1889
  }
1719
1890
  case "question-form": {
1720
- let o;
1721
- return e[19] !== n.questions ? (o = /* @__PURE__ */ a(gn, { questions: n.questions }), e[19] = n.questions, e[20] = o) : o = e[20], o;
1891
+ let s;
1892
+ return e[19] !== n.questions ? (s = /* @__PURE__ */ c(qn, { questions: n.questions }), e[19] = n.questions, e[20] = s) : s = e[20], s;
1722
1893
  }
1723
1894
  case "references": {
1724
- let o;
1725
- e[21] !== n.references ? (o = n.references.map(qr), e[21] = n.references, e[22] = o) : o = e[22];
1895
+ let s;
1896
+ e[21] !== n.references ? (s = n.references.map(Ei), e[21] = n.references, e[22] = s) : s = e[22];
1726
1897
  let r;
1727
- return e[23] !== o ? (r = /* @__PURE__ */ a(Y, { mt: "xs", gap: "xs", flexDir: "row", flexWrap: "wrap", children: o }), e[23] = o, e[24] = r) : r = e[24], r;
1898
+ return e[23] !== s ? (r = /* @__PURE__ */ c(X, { mt: "xs", gap: "xs", flexDir: "row", flexWrap: "wrap", children: s }), e[23] = s, e[24] = r) : r = e[24], r;
1899
+ }
1900
+ case "image": {
1901
+ if (!n.src.trim())
1902
+ return null;
1903
+ let s;
1904
+ e[25] !== n.alt || e[26] !== n.src ? (s = /* @__PURE__ */ c(Rn, { src: n.src, alt: n.alt, maxH: "18rem", maxW: "full", objectFit: "contain", borderRadius: "sm", borderWidth: "1px", borderColor: "border.subtle" }), e[25] = n.alt, e[26] = n.src, e[27] = s) : s = e[27];
1905
+ let r;
1906
+ e[28] !== n.caption ? (r = n.caption ? /* @__PURE__ */ c(j, { mt: "2xs", textStyle: "label/XS/regular", color: "fg.muted", children: n.caption }) : null, e[28] = n.caption, e[29] = r) : r = e[29];
1907
+ let i;
1908
+ return e[30] !== s || e[31] !== r ? (i = /* @__PURE__ */ c(ie.Root, { border: "0", padding: "0", background: "transparent", children: /* @__PURE__ */ A(ie.Body, { padding: "0", children: [
1909
+ s,
1910
+ r
1911
+ ] }) }), e[30] = s, e[31] = r, e[32] = i) : i = e[32], i;
1728
1912
  }
1729
1913
  case "component": {
1730
- let o;
1731
- e[25] !== n || e[26] !== s ? (o = n.render({
1732
- onOpenFile: s
1733
- }), e[25] = n, e[26] = s, e[27] = o) : o = e[27];
1914
+ let s;
1915
+ e[33] !== n || e[34] !== o ? (s = n.render({
1916
+ onOpenFile: o
1917
+ }), e[33] = n, e[34] = o, e[35] = s) : s = e[35];
1734
1918
  let r;
1735
- return e[28] !== o ? (r = /* @__PURE__ */ a(Ot, { children: o }), e[28] = o, e[29] = r) : r = e[29], r;
1919
+ return e[36] !== s ? (r = /* @__PURE__ */ c(tn, { children: s }), e[36] = s, e[37] = r) : r = e[37], r;
1736
1920
  }
1737
1921
  }
1738
1922
  }
1739
- function qr(t) {
1740
- return /* @__PURE__ */ a(zt, { fileName: t }, t);
1923
+ function Ei(t) {
1924
+ return /* @__PURE__ */ c(sn, { fileName: t }, t);
1741
1925
  }
1742
- function Hr(t) {
1743
- const e = T(23), {
1926
+ function Di(t) {
1927
+ const e = k(23), {
1744
1928
  item: n,
1745
- itemKey: s,
1746
- isOpen: o,
1929
+ itemKey: o,
1930
+ isOpen: s,
1747
1931
  canExpand: r,
1748
1932
  hasBlocks: i,
1749
1933
  onToggle: l,
1750
- onOpenFile: c
1934
+ onOpenFile: a
1751
1935
  } = t;
1752
1936
  let u;
1753
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ a(Ce.Separator, {}), e[0] = u) : u = e[0];
1937
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ c(Oe.Separator, {}), e[0] = u) : u = e[0];
1754
1938
  let d;
1755
- e[1] !== n.indicator ? (d = /* @__PURE__ */ k(Ce.Connector, { children: [
1939
+ e[1] !== n.indicator ? (d = /* @__PURE__ */ A(Oe.Connector, { children: [
1756
1940
  u,
1757
- /* @__PURE__ */ a($r, { ind: n.indicator })
1941
+ /* @__PURE__ */ c(Ri, { ind: n.indicator })
1758
1942
  ] }), e[1] = n.indicator, e[2] = d) : d = e[2];
1759
- const f = o ? "auto" : "20px";
1760
- let m;
1761
- e[3] !== r || e[4] !== o || e[5] !== n.title || e[6] !== s || e[7] !== c || e[8] !== l ? (m = n.title.length > 0 && /* @__PURE__ */ a(Ce.Title, { className: "group", fontWeight: "normal", display: "flex", alignItems: "center", justifyContent: "space-between", cursor: r ? "pointer" : "default", onClick: r ? () => l(s) : void 0, children: /* @__PURE__ */ k(Je, { display: "inline-flex", alignItems: "center", gap: "sm", flexWrap: "wrap", children: [
1762
- /* @__PURE__ */ a(Je, { display: "inline-flex", alignItems: "center", gap: "xs", flexWrap: "wrap", children: n.title.map((y, b) => /* @__PURE__ */ a(Or, { seg: y, isClickable: r, onOpenFile: c }, b)) }),
1763
- r ? /* @__PURE__ */ a(Je, { display: "inline-flex", alignItems: "center", transition: "transform 200ms ease, color 200ms ease", transform: o ? "rotate(0deg)" : "rotate(-180deg)", color: "transparent", _groupHover: {
1764
- color: "fg"
1765
- }, children: /* @__PURE__ */ a(go, { size: 12 }) }) : null
1766
- ] }) }), e[3] = r, e[4] = o, e[5] = n.title, e[6] = s, e[7] = c, e[8] = l, e[9] = m) : m = e[9];
1943
+ const f = s ? "auto" : "20px";
1767
1944
  let p;
1768
- e[10] !== i || e[11] !== o || e[12] !== n.blocks || e[13] !== c ? (p = i ? /* @__PURE__ */ a(I, { display: "grid", gridTemplateRows: o ? "1fr" : "0fr", transition: "grid-template-rows 220ms ease", children: o ? /* @__PURE__ */ a(I, { overflow: "hidden", opacity: 1, transform: "translateY(0)", transition: "opacity 200ms ease, transform 200ms ease", children: n.blocks.map((y, b) => /* @__PURE__ */ a(I, { children: /* @__PURE__ */ a(zr, { b: y, onOpenFile: c }) }, b)) }) : null }) : null, e[10] = i, e[11] = o, e[12] = n.blocks, e[13] = c, e[14] = p) : p = e[14];
1945
+ e[3] !== r || e[4] !== s || e[5] !== n.title || e[6] !== o || e[7] !== a || e[8] !== l ? (p = n.title.length > 0 && /* @__PURE__ */ c(Oe.Title, { className: "group", fontWeight: "normal", display: "flex", alignItems: "center", justifyContent: "space-between", cursor: r ? "pointer" : "default", onClick: r ? () => l(o) : void 0, children: /* @__PURE__ */ A(dt, { display: "inline-flex", alignItems: "center", gap: "sm", flexWrap: "wrap", children: [
1946
+ /* @__PURE__ */ c(dt, { display: "inline-flex", alignItems: "center", gap: "xs", flexWrap: "wrap", children: n.title.map((y, x) => /* @__PURE__ */ c(vi, { seg: y, isClickable: r, onOpenFile: a }, x)) }),
1947
+ r ? /* @__PURE__ */ c(dt, { display: "inline-flex", alignItems: "center", transition: "transform 200ms ease, color 200ms ease", transform: s ? "rotate(0deg)" : "rotate(-180deg)", color: "transparent", _groupHover: {
1948
+ color: "fg"
1949
+ }, children: /* @__PURE__ */ c(Hs, { size: 12 }) }) : null
1950
+ ] }) }), e[3] = r, e[4] = s, e[5] = n.title, e[6] = o, e[7] = a, e[8] = l, e[9] = p) : p = e[9];
1951
+ let m;
1952
+ e[10] !== i || e[11] !== s || e[12] !== n.blocks || e[13] !== a ? (m = i ? /* @__PURE__ */ c(B, { display: "grid", gridTemplateRows: s ? "1fr" : "0fr", transition: "grid-template-rows 220ms ease", children: s ? /* @__PURE__ */ c(B, { overflow: "hidden", opacity: 1, transform: "translateY(0)", transition: "opacity 200ms ease, transform 200ms ease", children: n.blocks.map((y, x) => /* @__PURE__ */ c(B, { children: /* @__PURE__ */ c(Pi, { b: y, onOpenFile: a }) }, x)) }) : null }) : null, e[10] = i, e[11] = s, e[12] = n.blocks, e[13] = a, e[14] = m) : m = e[14];
1769
1953
  let h;
1770
- e[15] !== f || e[16] !== m || e[17] !== p ? (h = /* @__PURE__ */ k(Ce.Content, { pb: "xs", h: f, overflow: "hidden", children: [
1771
- m,
1772
- p
1773
- ] }), e[15] = f, e[16] = m, e[17] = p, e[18] = h) : h = e[18];
1954
+ e[15] !== f || e[16] !== p || e[17] !== m ? (h = /* @__PURE__ */ A(Oe.Content, { pb: "xs", h: f, overflow: "hidden", children: [
1955
+ p,
1956
+ m
1957
+ ] }), e[15] = f, e[16] = p, e[17] = m, e[18] = h) : h = e[18];
1774
1958
  let g;
1775
- return e[19] !== s || e[20] !== d || e[21] !== h ? (g = /* @__PURE__ */ k(Ce.Item, { gap: "xs", children: [
1959
+ return e[19] !== o || e[20] !== d || e[21] !== h ? (g = /* @__PURE__ */ A(Oe.Item, { gap: "xs", children: [
1776
1960
  d,
1777
1961
  h
1778
- ] }, s), e[19] = s, e[20] = d, e[21] = h, e[22] = g) : g = e[22], g;
1962
+ ] }, o), e[19] = o, e[20] = d, e[21] = h, e[22] = g) : g = e[22], g;
1779
1963
  }
1780
- function Qr(t) {
1781
- const e = T(11), {
1964
+ function Bi(t) {
1965
+ const e = k(11), {
1782
1966
  data: n,
1783
- onOpenFile: s
1967
+ onOpenFile: o
1784
1968
  } = t;
1785
- let o;
1786
- e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (o = {}, e[0] = o) : o = e[0];
1787
- const [r, i] = G(o), l = Wr;
1788
- let c;
1789
- e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (c = (m) => {
1790
- i((p) => ({
1791
- ...p,
1792
- [m]: !p[m]
1969
+ let s;
1970
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = {}, e[0] = s) : s = e[0];
1971
+ const [r, i] = W(s), l = Fi;
1972
+ let a;
1973
+ e[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (a = (p) => {
1974
+ i((m) => ({
1975
+ ...m,
1976
+ [p]: !m[p]
1793
1977
  }));
1794
- }, e[1] = c) : c = e[1];
1795
- const u = c;
1978
+ }, e[1] = a) : a = e[1];
1979
+ const u = a;
1796
1980
  let d;
1797
- if (e[2] !== n.items || e[3] !== r || e[4] !== s) {
1798
- let m;
1799
- e[6] !== r || e[7] !== s ? (m = (p, h) => {
1800
- const g = l(p, h), y = (p.blocks?.length ?? 0) > 0, b = (p.expandable ?? !0) && y, x = b ? r[g] ?? !1 : y;
1801
- return /* @__PURE__ */ a(Hr, { item: p, itemKey: g, isOpen: x, canExpand: b, hasBlocks: y, onToggle: u, onOpenFile: s }, g);
1802
- }, e[6] = r, e[7] = s, e[8] = m) : m = e[8], d = n.items.map(m), e[2] = n.items, e[3] = r, e[4] = s, e[5] = d;
1981
+ if (e[2] !== n.items || e[3] !== r || e[4] !== o) {
1982
+ let p;
1983
+ e[6] !== r || e[7] !== o ? (p = (m, h) => {
1984
+ const g = l(m, h), y = (m.blocks?.length ?? 0) > 0, x = (m.expandable ?? !0) && y, b = x ? r[g] ?? !1 : y;
1985
+ return /* @__PURE__ */ c(Di, { item: m, itemKey: g, isOpen: b, canExpand: x, hasBlocks: y, onToggle: u, onOpenFile: o }, g);
1986
+ }, e[6] = r, e[7] = o, e[8] = p) : p = e[8], d = n.items.map(p), e[2] = n.items, e[3] = r, e[4] = o, e[5] = d;
1803
1987
  } else
1804
1988
  d = e[5];
1805
1989
  let f;
1806
- return e[9] !== d ? (f = /* @__PURE__ */ a(Ce.Root, { children: d }), e[9] = d, e[10] = f) : f = e[10], f;
1990
+ return e[9] !== d ? (f = /* @__PURE__ */ c(Oe.Root, { children: d }), e[9] = d, e[10] = f) : f = e[10], f;
1807
1991
  }
1808
- function Wr(t, e) {
1992
+ function Fi(t, e) {
1809
1993
  return t.id ? `id:${t.id}` : `idx:${e}`;
1810
1994
  }
1811
- const Nr = (t) => gt(t.tool ?? "").replace(/_/g, "") === "question", Vr = (t) => {
1995
+ const Li = (t) => vt(t.tool ?? "").replace(/_/g, "") === "question", $i = (t) => {
1812
1996
  const e = t.state?.output;
1813
1997
  return typeof e == "string" ? e.trim().length > 0 : Array.isArray(e) ? e.length > 0 : e && typeof e == "object" ? Object.keys(e).length > 0 : e != null;
1814
1998
  };
1815
- function jr(t) {
1816
- const e = T(8), {
1999
+ function Oi(t) {
2000
+ const e = k(8), {
1817
2001
  invocations: n,
1818
- labeledBlocks: s,
1819
- hideQuestionForms: o,
2002
+ labeledBlocks: o,
2003
+ hideQuestionForms: s,
1820
2004
  onOpenFile: r
1821
- } = t, i = o === void 0 ? !1 : o;
1822
- let l, c;
1823
- if (e[0] !== i || e[1] !== n || e[2] !== s) {
1824
- c = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
2005
+ } = t, i = s === void 0 ? !1 : s;
2006
+ let l, a;
2007
+ if (e[0] !== i || e[1] !== n || e[2] !== o) {
2008
+ a = /* @__PURE__ */ Symbol.for("react.early_return_sentinel");
1825
2009
  e: {
1826
- const f = i ? n.filter(Ur) : n;
2010
+ const f = i ? n.filter(zi) : n;
1827
2011
  if (f.length === 0) {
1828
- c = null;
2012
+ a = null;
1829
2013
  break e;
1830
2014
  }
1831
- l = Mr(f, {
1832
- labeledBlocks: s
2015
+ l = Ti(f, {
2016
+ labeledBlocks: o
1833
2017
  });
1834
2018
  }
1835
- e[0] = i, e[1] = n, e[2] = s, e[3] = l, e[4] = c;
2019
+ e[0] = i, e[1] = n, e[2] = o, e[3] = l, e[4] = a;
1836
2020
  } else
1837
- l = e[3], c = e[4];
1838
- if (c !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel"))
1839
- return c;
2021
+ l = e[3], a = e[4];
2022
+ if (a !== /* @__PURE__ */ Symbol.for("react.early_return_sentinel"))
2023
+ return a;
1840
2024
  const u = l;
1841
2025
  let d;
1842
- return e[5] !== u || e[6] !== r ? (d = /* @__PURE__ */ a(Qr, { data: u, onOpenFile: r }), e[5] = u, e[6] = r, e[7] = d) : d = e[7], d;
2026
+ return e[5] !== u || e[6] !== r ? (d = /* @__PURE__ */ c(Bi, { data: u, onOpenFile: r }), e[5] = u, e[6] = r, e[7] = d) : d = e[7], d;
1843
2027
  }
1844
- function Ur(t) {
1845
- return !Nr(t) || Vr(t);
2028
+ function zi(t) {
2029
+ return !Li(t) || $i(t);
1846
2030
  }
1847
- const Kr = (t) => t.type === "tool", Nt = (t) => t.filename ?? t.url.split("/").pop() ?? "attachment", Gr = /\.(avif|bmp|gif|jpe?g|png|svg|webp)$/i, Xr = (t) => t.mediaType?.startsWith("image/") || Gr.test(Nt(t)), Yr = (t) => Xr(t) ? /* @__PURE__ */ a(Un, { src: t.url, alt: `${Nt(t)} preview thumbnail`, boxSize: "18px", borderRadius: "xs", objectFit: "cover" }) : void 0, Jr = (t, e) => {
2031
+ const Qi = (t) => t.type === "tool", cn = (t) => t.filename ?? t.url.split("/").pop() ?? "attachment", qi = /\.(avif|bmp|gif|jpe?g|png|svg|webp)$/i, Hi = (t) => t.mediaType?.startsWith("image/") || qi.test(cn(t)), Wi = (t) => Hi(t) ? /* @__PURE__ */ c(Rn, { src: t.url, alt: `${cn(t)} preview thumbnail`, boxSize: "18px", borderRadius: "xs", objectFit: "cover" }) : void 0, Vi = (t, e) => {
1848
2032
  if (e) {
1849
2033
  e(t.url);
1850
2034
  return;
1851
2035
  }
1852
2036
  typeof window < "u" && window.open(t.url, "_blank", "noopener,noreferrer");
1853
- }, Zr = (t) => {
2037
+ }, Ni = (t) => {
1854
2038
  if (t.message && t.message.trim().length > 0)
1855
2039
  return t.message;
1856
2040
  const {
@@ -1866,425 +2050,798 @@ const Kr = (t) => t.type === "tool", Nt = (t) => t.filename ?? t.url.split("/").
1866
2050
  default:
1867
2051
  return "An error occurred.";
1868
2052
  }
1869
- }, ei = {
2053
+ }, ji = {
1870
2054
  info: "blue",
1871
2055
  warning: "orange",
1872
2056
  error: "red",
1873
2057
  success: "green",
1874
2058
  loading: "blue"
1875
- }, ti = (t, e) => {
2059
+ }, Ui = (t, e) => {
1876
2060
  const n = [];
1877
- let s = e;
1878
- for (; s < t.length; ) {
1879
- const o = t[s];
1880
- if (!Kr(o)) break;
1881
- n.push(o), s += 1;
2061
+ let o = e;
2062
+ for (; o < t.length; ) {
2063
+ const s = t[o];
2064
+ if (!Qi(s)) break;
2065
+ n.push(s), o += 1;
1882
2066
  }
1883
2067
  return {
1884
2068
  invocations: n,
1885
- nextIndex: s - 1
2069
+ nextIndex: o - 1
1886
2070
  };
1887
2071
  };
1888
- function En(t) {
1889
- const e = T(8), {
2072
+ function ls(t) {
2073
+ const e = k(8), {
1890
2074
  message: n,
1891
- hideQuestionForms: s,
1892
- onOpenFile: o,
2075
+ hideQuestionForms: o,
2076
+ onOpenFile: s,
1893
2077
  toolInvocationTimeline: r
1894
- } = t, i = s === void 0 ? !1 : s, l = r ?? jr;
1895
- let c;
1896
- e[0] !== n.parts ? (c = n.parts ?? [], e[0] = n.parts, e[1] = c) : c = e[1];
1897
- const u = c;
2078
+ } = t, i = o === void 0 ? !1 : o, l = r ?? Oi;
2079
+ let a;
2080
+ e[0] !== n.parts ? (a = n.parts ?? [], e[0] = n.parts, e[1] = a) : a = e[1];
2081
+ const u = a;
1898
2082
  let d;
1899
- if (e[2] !== l || e[3] !== i || e[4] !== n.id || e[5] !== o || e[6] !== u) {
2083
+ if (e[2] !== l || e[3] !== i || e[4] !== n.id || e[5] !== s || e[6] !== u) {
1900
2084
  const f = [];
1901
- for (let m = 0; m < u.length; m = m + 1, m) {
1902
- const p = u[m], h = `${n.id}-${m}`;
1903
- e: switch (p.type) {
2085
+ for (let p = 0; p < u.length; p = p + 1, p) {
2086
+ const m = u[p], h = `${n.id}-${p}`;
2087
+ e: switch (m.type) {
1904
2088
  case "text": {
1905
- f.push(/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(Cs, { children: p.text }) }, h));
2089
+ f.push(/* @__PURE__ */ c("div", { children: /* @__PURE__ */ c(dr, { children: m.text }) }, h));
1906
2090
  break e;
1907
2091
  }
1908
2092
  case "reasoning": {
1909
- f.push(/* @__PURE__ */ a(I, { padding: "0", css: {
2093
+ f.push(/* @__PURE__ */ c(B, { padding: "0", css: {
1910
2094
  "& .rich-text, & .rich-text *": {
1911
2095
  color: "fg.subtle !important",
1912
2096
  fontSize: ".75rem !important",
1913
2097
  fontWeight: "normal !important"
1914
2098
  }
1915
- }, children: /* @__PURE__ */ a(un, { defaultState: p.text, fullWidth: !0 }) }, h));
2099
+ }, children: /* @__PURE__ */ c(Ln, { defaultState: m.text, fullWidth: !0 }) }, h));
1916
2100
  break e;
1917
2101
  }
1918
2102
  case "tool": {
1919
2103
  const {
1920
2104
  invocations: g,
1921
2105
  nextIndex: y
1922
- } = ti(u, m);
1923
- m = y, f.push(/* @__PURE__ */ a(I, { width: "full", children: /* @__PURE__ */ a(l, { invocations: g, labeledBlocks: !0, hideQuestionForms: i, onOpenFile: o }) }, h));
2106
+ } = Ui(u, p);
2107
+ p = y, f.push(/* @__PURE__ */ c(B, { width: "full", children: /* @__PURE__ */ c(l, { invocations: g, labeledBlocks: !0, hideQuestionForms: i, onOpenFile: s }) }, h));
1924
2108
  break e;
1925
2109
  }
1926
2110
  case "file": {
1927
- f.push(/* @__PURE__ */ a(I, { width: "fit-content", children: /* @__PURE__ */ a(zt, { fileName: Nt(p), size: "sm", tone: "neutral", icon: Yr(p), onSelect: () => Jr(p, o) }) }, h));
2111
+ f.push(/* @__PURE__ */ c(B, { width: "fit-content", children: /* @__PURE__ */ c(sn, { fileName: cn(m), size: "sm", tone: "neutral", icon: Wi(m), onSelect: () => Vi(m, s) }) }, h));
1928
2112
  break e;
1929
2113
  }
1930
2114
  case "error": {
1931
- f.push(/* @__PURE__ */ a(I, { py: "2", width: "full", children: /* @__PURE__ */ a(Ut, { borderRadius: "xs", status: "error", colorPalette: "red", title: Zr(p), size: "sm" }) }, h));
2115
+ f.push(/* @__PURE__ */ c(B, { py: "2", width: "full", children: /* @__PURE__ */ c(fn, { borderRadius: "xs", status: "error", colorPalette: "red", title: Ni(m), size: "sm" }) }, h));
1932
2116
  break e;
1933
2117
  }
1934
2118
  case "token_usage":
1935
2119
  break e;
1936
2120
  case "alert": {
1937
- f.push(/* @__PURE__ */ a(I, { width: "full", children: /* @__PURE__ */ a(Ut, { borderRadius: "xs", status: p.status === "loading" ? "info" : p.status, colorPalette: ei[p.status], title: p.title, icon: p.status === "loading" ? /* @__PURE__ */ a(Ft, { size: "sm" }) : void 0, size: "sm", children: p.message }) }, h));
2121
+ f.push(/* @__PURE__ */ c(B, { width: "full", children: /* @__PURE__ */ c(fn, { borderRadius: "xs", status: m.status === "loading" ? "info" : m.status, colorPalette: ji[m.status], title: m.title, icon: m.status === "loading" ? /* @__PURE__ */ c(nn, { size: "sm" }) : void 0, size: "sm", children: m.message }) }, h));
1938
2122
  break e;
1939
2123
  }
1940
2124
  default:
1941
2125
  f.push(null);
1942
2126
  }
1943
2127
  }
1944
- d = /* @__PURE__ */ a(Ot, { children: f }), e[2] = l, e[3] = i, e[4] = n.id, e[5] = o, e[6] = u, e[7] = d;
2128
+ d = /* @__PURE__ */ c(tn, { children: f }), e[2] = l, e[3] = i, e[4] = n.id, e[5] = s, e[6] = u, e[7] = d;
1945
2129
  } else
1946
2130
  d = e[7];
1947
2131
  return d;
1948
2132
  }
1949
- const ni = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", oi = (t) => {
1950
- const e = t.parts ?? [];
1951
- return e.length === 0 || e.some((s) => s.type === "text" && "text" in s) ? !1 : e.some((s) => s.type === "reasoning" || s.type === "tool");
1952
- }, si = (t) => {
1953
- const e = [];
1954
- for (const n of t) {
1955
- const s = e[e.length - 1];
1956
- if (s && s.role === n.role && oi(n)) {
1957
- s.parts = [...s.parts ?? [], ...n.parts ?? []];
2133
+ const Ki = (t) => t === "user" || t === "assistant" || t === "developer" ? t : "assistant", Gi = (t) => t.text.trim().length > 0, Xi = (t) => t.title.trim().length > 0 || !!t.message?.trim(), Yi = (t) => {
2134
+ switch (t.type) {
2135
+ case "text":
2136
+ case "reasoning":
2137
+ return Gi(t);
2138
+ case "tool":
2139
+ case "file":
2140
+ case "error":
2141
+ return !0;
2142
+ case "alert":
2143
+ return Xi(t);
2144
+ default:
2145
+ return !1;
2146
+ }
2147
+ }, Ji = (t) => t.type === "reasoning" || t.type === "tool", Zi = (t) => t.role === "user" || t.parts.length === 0 ? !1 : t.parts.every(Ji), el = (t) => {
2148
+ if (t.length === 0) return null;
2149
+ const [e, ...n] = t;
2150
+ return e ? {
2151
+ ...e,
2152
+ role: "assistant",
2153
+ parts: t.flatMap((o) => o.parts),
2154
+ modelId: n.at(-1)?.modelId ?? e.modelId,
2155
+ providerId: n.at(-1)?.providerId ?? e.providerId
2156
+ } : null;
2157
+ }, tl = (t, e = {}) => {
2158
+ const n = [];
2159
+ let o = [];
2160
+ const s = () => {
2161
+ o = [];
2162
+ };
2163
+ for (const r of t) {
2164
+ const i = (r.parts ?? []).filter(Yi);
2165
+ if (i.length === 0) continue;
2166
+ const l = {
2167
+ ...r,
2168
+ parts: i
2169
+ };
2170
+ if (l.role === "user") {
2171
+ s(), n.push(l);
1958
2172
  continue;
1959
2173
  }
1960
- e.push({
1961
- ...n,
1962
- parts: [...n.parts ?? []]
1963
- });
2174
+ if (Zi(l)) {
2175
+ o.push(l);
2176
+ continue;
2177
+ }
2178
+ if (o.length > 0) {
2179
+ n.push({
2180
+ ...l,
2181
+ parts: [...o.flatMap((a) => a.parts), ...l.parts]
2182
+ }), s();
2183
+ continue;
2184
+ }
2185
+ n.push(l);
1964
2186
  }
1965
- return e;
1966
- }, ri = (t) => {
2187
+ if (e.streaming && o.length > 0) {
2188
+ const r = el(o);
2189
+ r && n.push(r);
2190
+ }
2191
+ return n;
2192
+ }, nl = (t) => {
1967
2193
  const e = [], n = [];
1968
- for (const s of t)
1969
- s.role === "user" ? e.push({
1970
- userMessage: s,
2194
+ for (const o of t)
2195
+ o.role === "user" ? e.push({
2196
+ userMessage: o,
1971
2197
  responses: []
1972
- }) : e.length > 0 ? e[e.length - 1].responses.push(s) : n.push(s);
2198
+ }) : e.length > 0 ? e[e.length - 1].responses.push(o) : n.push(o);
1973
2199
  return {
1974
2200
  groups: e,
1975
2201
  leadingResponses: n
1976
2202
  };
1977
- }, vn = 720, ii = 1, li = 3, ai = 20, nn = 1, ci = 4, Ln = 8, ui = (t, e) => [...t.map((n) => ({
2203
+ }, as = 720, sl = 1, ol = 3, rl = 20, kn = 1, il = 4, cs = 8, ll = (t, e) => [...t.map((n) => ({
1978
2204
  type: "leading-response",
1979
2205
  key: n.id,
1980
2206
  message: n
1981
- })), ...e.map((n, s) => ({
2207
+ })), ...e.map((n, o) => ({
1982
2208
  type: "group",
1983
2209
  key: n.userMessage.id,
1984
2210
  group: n,
1985
- groupIndex: s
1986
- }))], di = (t, e) => {
2211
+ groupIndex: o
2212
+ }))], al = (t, e) => {
1987
2213
  if (t === 0) return 0;
1988
- const n = t * vn + (t - 1) * Ln;
2214
+ const n = t * as + (t - 1) * cs;
1989
2215
  return Math.max(n - e, 0);
1990
- }, fi = (t) => t?.clientHeight || ii, pi = (t, e) => Math.abs(t.scrollTop - e.scrollTop) <= nn && Math.abs(t.totalSize - e.totalSize) <= nn, mi = (t, e) => ({
2216
+ }, cl = (t) => t?.clientHeight || sl, ul = (t, e) => Math.abs(t.scrollTop - e.scrollTop) <= kn && Math.abs(t.totalSize - e.totalSize) <= kn, dl = (t, e) => ({
1991
2217
  scrollTop: t?.scrollTop ?? 0,
1992
2218
  totalSize: e
1993
- }), hi = (t) => {
1994
- const e = T(8), {
2219
+ }), fl = (t) => {
2220
+ const e = k(8), {
1995
2221
  itemCount: n,
1996
- onReady: s,
1997
- scrollRef: o,
2222
+ onReady: o,
2223
+ scrollRef: s,
1998
2224
  totalSize: r
1999
- } = t, i = Ne(s);
2000
- let l, c;
2001
- e[0] !== s ? (l = () => {
2002
- i.current = s;
2003
- }, c = [s], e[0] = s, e[1] = l, e[2] = c) : (l = e[1], c = e[2]), Ae(l, c);
2225
+ } = t, i = Te(o);
2226
+ let l, a;
2227
+ e[0] !== o ? (l = () => {
2228
+ i.current = o;
2229
+ }, a = [o], e[0] = o, e[1] = l, e[2] = a) : (l = e[1], a = e[2]), le(l, a);
2004
2230
  let u, d;
2005
- e[3] !== n || e[4] !== o || e[5] !== r ? (u = () => {
2231
+ e[3] !== n || e[4] !== s || e[5] !== r ? (u = () => {
2006
2232
  if (n === 0 || typeof requestAnimationFrame > "u") {
2007
2233
  i.current?.();
2008
2234
  return;
2009
2235
  }
2010
- let f = 0, m = 0, p = 0, h = null;
2236
+ let f = 0, p = 0, m = 0, h = null;
2011
2237
  const g = () => {
2012
- m = m + 1;
2013
- const y = mi(o.current, r);
2014
- if (p = h && pi(y, h) ? p + 1 : 0, h = y, p >= li || m >= ai) {
2238
+ p = p + 1;
2239
+ const y = dl(s.current, r);
2240
+ if (m = h && ul(y, h) ? m + 1 : 0, h = y, m >= ol || p >= rl) {
2015
2241
  i.current?.();
2016
2242
  return;
2017
2243
  }
2018
2244
  f = requestAnimationFrame(g);
2019
2245
  };
2020
2246
  return f = requestAnimationFrame(g), () => cancelAnimationFrame(f);
2021
- }, d = [n, o, r], e[3] = n, e[4] = o, e[5] = r, e[6] = u, e[7] = d) : (u = e[6], d = e[7]), Ae(u, d);
2022
- }, gi = (t) => {
2023
- const e = T(7), {
2247
+ }, d = [n, s, r], e[3] = n, e[4] = s, e[5] = r, e[6] = u, e[7] = d) : (u = e[6], d = e[7]), le(u, d);
2248
+ }, pl = (t) => {
2249
+ const e = k(7), {
2024
2250
  label: n,
2025
- onClick: s,
2026
- actionPanel: o
2027
- } = t, r = o ? "space-between" : "flex-end";
2251
+ onClick: o,
2252
+ actionPanel: s
2253
+ } = t, r = s ? "space-between" : "flex-end";
2028
2254
  let i;
2029
- e[0] !== n || e[1] !== s ? (i = /* @__PURE__ */ a(Ze, { size: "2xs", variant: "outline", pointerEvents: "auto", onClick: s, children: n }), e[0] = n, e[1] = s, e[2] = i) : i = e[2];
2255
+ e[0] !== n || e[1] !== o ? (i = /* @__PURE__ */ c(ft, { size: "2xs", variant: "outline", pointerEvents: "auto", onClick: o, children: n }), e[0] = n, e[1] = o, e[2] = i) : i = e[2];
2030
2256
  let l;
2031
- return e[3] !== o || e[4] !== r || e[5] !== i ? (l = /* @__PURE__ */ k(Re, { position: "absolute", bottom: "0", left: "0", right: "0", justifyContent: r, alignItems: "flex-end", px: "xs", pb: "xs", pt: "lg", bgGradient: "to-t", gradientFrom: "bg.subtle", gradientTo: "transparent", borderBottomRadius: "xs", pointerEvents: "none", children: [
2032
- o,
2257
+ return e[3] !== s || e[4] !== r || e[5] !== i ? (l = /* @__PURE__ */ A(Qe, { position: "absolute", bottom: "0", left: "0", right: "0", justifyContent: r, alignItems: "flex-end", px: "xs", pb: "xs", pt: "lg", bgGradient: "to-t", gradientFrom: "bg.subtle", gradientTo: "transparent", borderBottomRadius: "xs", pointerEvents: "none", children: [
2258
+ s,
2033
2259
  i
2034
- ] }), e[3] = o, e[4] = r, e[5] = i, e[6] = l) : l = e[6], l;
2035
- }, Dn = (t, e, n = !1) => {
2036
- const s = ni(t.role);
2037
- return /* @__PURE__ */ a(_e.Root, { from: s, children: /* @__PURE__ */ k(_e.Content, { from: s, children: [
2038
- /* @__PURE__ */ a(En, { message: t, streaming: e, hideQuestionForms: n }),
2039
- s === "assistant" || s === "user" ? /* @__PURE__ */ a(Bt, { message: t, alwaysVisible: s === "user", copyAlwaysVisible: s !== "user" }) : null
2260
+ ] }), e[3] = s, e[4] = r, e[5] = i, e[6] = l) : l = e[6], l;
2261
+ }, us = (t, e, n = !1, o = !1) => {
2262
+ const s = Ki(t.role);
2263
+ return /* @__PURE__ */ c(ze.Root, { from: s, ...o ? Wn : void 0, children: /* @__PURE__ */ A(ze.Content, { from: s, children: [
2264
+ /* @__PURE__ */ c(ls, { message: t, streaming: e, hideQuestionForms: n }),
2265
+ s === "assistant" || s === "user" ? /* @__PURE__ */ c(Yt, { message: t, alwaysVisible: s === "user", copyAlwaysVisible: s !== "user" }) : null
2040
2266
  ] }) });
2041
- }, bi = (t) => {
2042
- xs(t.currentTarget, t.deltaY) && t.stopPropagation();
2043
- }, yi = (t, e) => {
2267
+ }, ml = (t) => {
2268
+ ir(t.currentTarget, t.deltaY) && t.stopPropagation();
2269
+ }, hl = (t, e) => {
2044
2270
  if (t)
2045
- return e ? bn : gs;
2046
- }, xi = (t) => {
2271
+ return e ? Vn : sr;
2272
+ }, gl = (t) => {
2047
2273
  if (t)
2048
- return bn;
2049
- }, Si = (t) => {
2050
- const e = T(43), {
2274
+ return Vn;
2275
+ }, bl = (t) => {
2276
+ const e = k(46), {
2051
2277
  group: n,
2052
- streaming: s,
2053
- hideQuestionForms: o,
2278
+ streaming: o,
2279
+ hideQuestionForms: s,
2054
2280
  isExpanded: r,
2055
- onToggleStickyMessage: i
2281
+ animate: i,
2282
+ onToggleStickyMessage: l
2056
2283
  } = t;
2057
- let l, c, u;
2058
- e[0] !== n.userMessage || e[1] !== r ? (l = ys(n.userMessage), c = l && r, u = yi(l, r), e[0] = n.userMessage, e[1] = r, e[2] = l, e[3] = c, e[4] = u) : (l = e[2], c = e[3], u = e[4]);
2059
- const d = u;
2060
- let f;
2061
- e[5] !== n.userMessage.id || e[6] !== i ? (f = () => i(n.userMessage.id), e[5] = n.userMessage.id, e[6] = i, e[7] = f) : f = e[7];
2062
- const m = f, p = l ? "0" : void 0, h = l ? "relative" : void 0, g = l ? r ? "expanded" : "collapsed" : void 0;
2063
- let y;
2064
- e[8] !== c ? (y = xi(c), e[8] = c, e[9] = y) : y = e[9];
2065
- const b = c ? "auto" : "visible", x = l ? "xs" : void 0, C = l ? "xs" : void 0, A = c ? "3rem" : void 0, w = c ? bi : void 0;
2066
- let _;
2067
- e[10] !== n.userMessage || e[11] !== s ? (_ = /* @__PURE__ */ a(En, { message: n.userMessage, streaming: s }), e[10] = n.userMessage, e[11] = s, e[12] = _) : _ = e[12];
2284
+ let a, u, d;
2285
+ e[0] !== n.userMessage || e[1] !== r ? (a = rr(n.userMessage), u = a && r, d = hl(a, r), e[0] = n.userMessage, e[1] = r, e[2] = a, e[3] = u, e[4] = d) : (a = e[2], u = e[3], d = e[4]);
2286
+ const f = d;
2287
+ let p;
2288
+ e[5] !== n.userMessage.id || e[6] !== l ? (p = () => l(n.userMessage.id), e[5] = n.userMessage.id, e[6] = l, e[7] = p) : p = e[7];
2289
+ const m = p, h = i ? Wn : void 0, g = a ? "0" : void 0, y = a ? "relative" : void 0, x = a ? r ? "expanded" : "collapsed" : void 0;
2290
+ let b;
2291
+ e[8] !== u ? (b = gl(u), e[8] = u, e[9] = b) : b = e[9];
2292
+ const S = u ? "auto" : "visible", T = a ? "xs" : void 0, w = a ? "xs" : void 0, C = u ? "3rem" : void 0, _ = u ? ml : void 0;
2293
+ let I;
2294
+ e[10] !== n.userMessage || e[11] !== o ? (I = /* @__PURE__ */ c(ls, { message: n.userMessage, streaming: o }), e[10] = n.userMessage, e[11] = o, e[12] = I) : I = e[12];
2068
2295
  let M;
2069
- e[13] !== w || e[14] !== _ || e[15] !== g || e[16] !== y || e[17] !== b || e[18] !== x || e[19] !== C || e[20] !== A ? (M = /* @__PURE__ */ a(I, { "data-sticky-user-message-content": g, display: "flex", flexDirection: "column", gap: "sm", maxH: y, minH: "0", overflowY: b, px: x, py: C, pb: A, onWheel: w, children: _ }), e[13] = w, e[14] = _, e[15] = g, e[16] = y, e[17] = b, e[18] = x, e[19] = C, e[20] = A, e[21] = M) : M = e[21];
2296
+ e[13] !== C || e[14] !== _ || e[15] !== I || e[16] !== x || e[17] !== b || e[18] !== S || e[19] !== T || e[20] !== w ? (M = /* @__PURE__ */ c(B, { "data-sticky-user-message-content": x, display: "flex", flexDirection: "column", gap: "sm", maxH: b, minH: "0", overflowY: S, px: T, py: w, pb: C, onWheel: _, children: I }), e[13] = C, e[14] = _, e[15] = I, e[16] = x, e[17] = b, e[18] = S, e[19] = T, e[20] = w, e[21] = M) : M = e[21];
2070
2297
  let P;
2071
- e[22] !== n.userMessage || e[23] !== l || e[24] !== r || e[25] !== m ? (P = l ? /* @__PURE__ */ a(gi, { label: r ? "Show less" : "Show more", onClick: m, actionPanel: /* @__PURE__ */ a(Bt, { message: n.userMessage, alwaysVisible: !0, copyAlwaysVisible: !1 }) }) : /* @__PURE__ */ a(Bt, { message: n.userMessage, alwaysVisible: !0, copyAlwaysVisible: !1 }), e[22] = n.userMessage, e[23] = l, e[24] = r, e[25] = m, e[26] = P) : P = e[26];
2072
- let v;
2073
- e[27] !== d || e[28] !== M || e[29] !== P || e[30] !== p || e[31] !== h ? (v = /* @__PURE__ */ a(I, { position: "sticky", top: "0", zIndex: 1, children: /* @__PURE__ */ a(_e.Root, { from: "user", children: /* @__PURE__ */ k(_e.Content, { from: "user", maxH: d, overflow: "hidden", p, position: h, children: [
2298
+ e[22] !== n.userMessage || e[23] !== a || e[24] !== r || e[25] !== m ? (P = a ? /* @__PURE__ */ c(pl, { label: r ? "Show less" : "Show more", onClick: m, actionPanel: /* @__PURE__ */ c(Yt, { message: n.userMessage, alwaysVisible: !0, copyAlwaysVisible: !1 }) }) : /* @__PURE__ */ c(Yt, { message: n.userMessage, alwaysVisible: !0, copyAlwaysVisible: !1 }), e[22] = n.userMessage, e[23] = a, e[24] = r, e[25] = m, e[26] = P) : P = e[26];
2299
+ let F;
2300
+ e[27] !== f || e[28] !== M || e[29] !== P || e[30] !== g || e[31] !== y ? (F = /* @__PURE__ */ A(ze.Content, { from: "user", maxH: f, overflow: "hidden", p: g, position: y, children: [
2074
2301
  M,
2075
2302
  P
2076
- ] }) }) }), e[27] = d, e[28] = M, e[29] = P, e[30] = p, e[31] = h, e[32] = v) : v = e[32];
2077
- let L;
2078
- if (e[33] !== n.responses || e[34] !== o || e[35] !== s) {
2079
- let J;
2080
- e[37] !== o || e[38] !== s ? (J = (B) => /* @__PURE__ */ a(I, { children: Dn(B, s, o) }, B.id), e[37] = o, e[38] = s, e[39] = J) : J = e[39], L = n.responses.map(J), e[33] = n.responses, e[34] = o, e[35] = s, e[36] = L;
2303
+ ] }), e[27] = f, e[28] = M, e[29] = P, e[30] = g, e[31] = y, e[32] = F) : F = e[32];
2304
+ let E;
2305
+ e[33] !== F || e[34] !== h ? (E = /* @__PURE__ */ c(B, { position: "sticky", top: "0", zIndex: 1, children: /* @__PURE__ */ c(ze.Root, { from: "user", ...h, children: F }) }), e[33] = F, e[34] = h, e[35] = E) : E = e[35];
2306
+ let D;
2307
+ if (e[36] !== n.responses || e[37] !== s || e[38] !== o) {
2308
+ let z;
2309
+ e[40] !== s || e[41] !== o ? (z = (L) => /* @__PURE__ */ c(B, { children: us(L, o, s) }, L.id), e[40] = s, e[41] = o, e[42] = z) : z = e[42], D = n.responses.map(z), e[36] = n.responses, e[37] = s, e[38] = o, e[39] = D;
2081
2310
  } else
2082
- L = e[36];
2083
- let H;
2084
- return e[40] !== v || e[41] !== L ? (H = /* @__PURE__ */ k(I, { children: [
2085
- v,
2086
- L
2087
- ] }), e[40] = v, e[41] = L, e[42] = H) : H = e[42], H;
2088
- }, Ti = (t, e) => {
2311
+ D = e[39];
2312
+ let O;
2313
+ return e[43] !== E || e[44] !== D ? (O = /* @__PURE__ */ A(B, { children: [
2314
+ E,
2315
+ D
2316
+ ] }), e[43] = E, e[44] = D, e[45] = O) : O = e[45], O;
2317
+ }, yl = (t, e) => {
2089
2318
  const {
2090
2319
  groups: n,
2091
- streaming: s,
2092
- hideActiveQuestionForms: o,
2320
+ streaming: o,
2321
+ hideActiveQuestionForms: s,
2093
2322
  expandedStickyMessageIds: r,
2094
- onToggleStickyMessage: i
2323
+ animatedItemKeys: i,
2324
+ onToggleStickyMessage: l
2095
2325
  } = e;
2096
- return t.type === "leading-response" ? Dn(t.message, s, n.length > 0 || o) : /* @__PURE__ */ a(Si, { group: t.group, streaming: s, hideQuestionForms: t.groupIndex < n.length - 1 || o, isExpanded: r.has(t.group.userMessage.id), onToggleStickyMessage: i });
2097
- }, wi = (t) => {
2326
+ return t.type === "leading-response" ? us(t.message, o, n.length > 0 || s, i.has(t.key)) : /* @__PURE__ */ c(bl, { group: t.group, streaming: o, hideQuestionForms: t.groupIndex < n.length - 1 || s, isExpanded: r.has(t.group.userMessage.id), animate: i.has(t.key), onToggleStickyMessage: l });
2327
+ }, xl = (t) => {
2098
2328
  const {
2099
2329
  leadingResponses: e,
2100
2330
  groups: n,
2101
- streaming: s,
2102
- hideActiveQuestionForms: o,
2331
+ streaming: o,
2332
+ hideActiveQuestionForms: s,
2103
2333
  expandedStickyMessageIds: r,
2104
2334
  onToggleStickyMessage: i,
2105
2335
  onReady: l
2106
2336
  } = t, {
2107
- scrollRef: c
2108
- } = mt(), u = ui(e, n), d = fi(c.current), f = _o({
2337
+ scrollRef: a
2338
+ } = It(), u = ll(e, n), d = er(u.map((h) => h.key)), f = cl(a.current), p = Zs({
2109
2339
  count: u.length,
2110
- getScrollElement: () => c.current,
2111
- estimateSize: () => vn,
2112
- getItemKey: (p) => u[p]?.key ?? p,
2113
- overscan: ci,
2114
- gap: Ln,
2340
+ getScrollElement: () => a.current,
2341
+ estimateSize: () => as,
2342
+ getItemKey: (h) => u[h]?.key ?? h,
2343
+ overscan: il,
2344
+ gap: cs,
2115
2345
  initialRect: {
2116
2346
  width: 0,
2117
- height: d
2347
+ height: f
2118
2348
  },
2119
- initialOffset: () => di(u.length, d)
2120
- }), m = f.getTotalSize();
2121
- return hi({
2349
+ initialOffset: () => al(u.length, f)
2350
+ }), m = p.getTotalSize();
2351
+ return fl({
2122
2352
  itemCount: u.length,
2123
2353
  onReady: l,
2124
- scrollRef: c,
2354
+ scrollRef: a,
2125
2355
  totalSize: m
2126
- }), /* @__PURE__ */ a(I, { px: "xs", children: /* @__PURE__ */ a(I, { position: "relative", width: "100%", style: {
2356
+ }), /* @__PURE__ */ c(B, { px: "xs", children: /* @__PURE__ */ c(B, { position: "relative", width: "100%", style: {
2127
2357
  height: m
2128
- }, children: f.getVirtualItems().map((p) => {
2129
- const h = u[p.index];
2130
- return h ? /* @__PURE__ */ a(I, { ref: f.measureElement, "data-index": p.index, "data-chat-message-list-item": h.type, position: "absolute", top: "0", left: "0", width: "100%", style: {
2131
- top: p.start
2132
- }, children: Ti(h, {
2358
+ }, children: p.getVirtualItems().map((h) => {
2359
+ const g = u[h.index];
2360
+ return g ? /* @__PURE__ */ c(B, { ref: p.measureElement, "data-index": h.index, "data-chat-message-list-item": g.type, position: "absolute", top: "0", left: "0", width: "100%", style: {
2361
+ top: h.start
2362
+ }, children: yl(g, {
2133
2363
  groups: n,
2134
- streaming: s,
2135
- hideActiveQuestionForms: o,
2364
+ streaming: o,
2365
+ hideActiveQuestionForms: s,
2136
2366
  expandedStickyMessageIds: r,
2367
+ animatedItemKeys: d,
2137
2368
  onToggleStickyMessage: i
2138
- }) }, p.key) : null;
2369
+ }) }, h.key) : null;
2139
2370
  }) }) });
2140
- }, dl = (t) => {
2141
- const e = T(64), {
2371
+ }, Sl = (t) => {
2372
+ const e = k(48), {
2373
+ item: n,
2374
+ index: o,
2375
+ isFirst: s,
2376
+ isLast: r,
2377
+ isEditing: i,
2378
+ isDragTarget: l,
2379
+ onEdit: a,
2380
+ onRemove: u,
2381
+ onDragStart: d,
2382
+ onDragEnd: f,
2383
+ onDragOver: p,
2384
+ onDrop: m
2385
+ } = t, h = !!a, g = !!u, y = !s || !r, x = `Drag queued follow-up ${o + 1}`, b = s ? "0" : "1px", S = l ? "border.accent-light" : "border.subtle", T = s ? "0" : "2xs", w = i ? "bg.muted" : void 0;
2386
+ let C;
2387
+ e[0] !== n.id || e[1] !== p ? (C = (H) => p(H, n.id), e[0] = n.id, e[1] = p, e[2] = C) : C = e[2];
2388
+ let _;
2389
+ e[3] !== n.id || e[4] !== m ? (_ = (H) => m(H, n.id), e[3] = n.id, e[4] = m, e[5] = _) : _ = e[5];
2390
+ const I = y ? "grab" : "default", M = !y;
2391
+ let P;
2392
+ e[6] !== n.id || e[7] !== d ? (P = (H) => {
2393
+ H.dataTransfer.effectAllowed = "move", H.dataTransfer.setData("text/plain", n.id), d(n.id);
2394
+ }, e[6] = n.id, e[7] = d, e[8] = P) : P = e[8];
2395
+ let F;
2396
+ e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (F = /* @__PURE__ */ c(Wt, { as: Ws, boxSize: "14px" }), e[9] = F) : F = e[9];
2397
+ let E;
2398
+ e[10] !== y || e[11] !== x || e[12] !== f || e[13] !== I || e[14] !== M || e[15] !== P ? (E = /* @__PURE__ */ c(nt, { size: "2xs", variant: "ghost", draggable: y, "aria-label": x, title: x, color: "fg.muted", cursor: I, disabled: M, onDragStart: P, onDragEnd: f, children: F }), e[10] = y, e[11] = x, e[12] = f, e[13] = I, e[14] = M, e[15] = P, e[16] = E) : E = e[16];
2399
+ let D;
2400
+ e[17] !== n.prompt ? (D = /* @__PURE__ */ c(j, { textStyle: "label/S/regular", color: "fg", lineClamp: 2, minWidth: "0", children: n.prompt }), e[17] = n.prompt, e[18] = D) : D = e[18];
2401
+ let O;
2402
+ e[19] !== n.attachments ? (O = n.attachments?.length ? /* @__PURE__ */ A(ws, { width: "fit-content", size: "sm", variant: "outline", colorPalette: "gray", children: [
2403
+ n.attachments.length,
2404
+ " attachments"
2405
+ ] }) : null, e[19] = n.attachments, e[20] = O) : O = e[20];
2406
+ let z;
2407
+ e[21] !== D || e[22] !== O ? (z = /* @__PURE__ */ A(X, { gap: "2xs", flex: "1", minWidth: "0", children: [
2408
+ D,
2409
+ O
2410
+ ] }), e[21] = D, e[22] = O, e[23] = z) : z = e[23];
2411
+ let L;
2412
+ e[24] !== h || e[25] !== n || e[26] !== a ? (L = h ? /* @__PURE__ */ c(nt, { size: "2xs", variant: "ghost", "aria-label": "Edit queued follow-up", onClick: () => a?.(n), children: /* @__PURE__ */ c(Wt, { as: Vs, boxSize: "14px" }) }) : null, e[24] = h, e[25] = n, e[26] = a, e[27] = L) : L = e[27];
2413
+ let q;
2414
+ e[28] !== g || e[29] !== n.id || e[30] !== u ? (q = g ? /* @__PURE__ */ c(nt, { size: "2xs", variant: "ghost", "aria-label": "Remove queued follow-up", colorPalette: "red", onClick: () => u?.(n.id), children: /* @__PURE__ */ c(Wt, { as: En, boxSize: "14px" }) }) : null, e[28] = g, e[29] = n.id, e[30] = u, e[31] = q) : q = e[31];
2415
+ let R;
2416
+ e[32] !== L || e[33] !== q ? (R = /* @__PURE__ */ A(ae, { gap: "2xs", flexShrink: 0, children: [
2417
+ L,
2418
+ q
2419
+ ] }), e[32] = L, e[33] = q, e[34] = R) : R = e[34];
2420
+ let Q;
2421
+ e[35] !== E || e[36] !== z || e[37] !== R ? (Q = /* @__PURE__ */ A(ae, { gap: "xs", alignItems: "flex-start", children: [
2422
+ E,
2423
+ z,
2424
+ R
2425
+ ] }), e[35] = E, e[36] = z, e[37] = R, e[38] = Q) : Q = e[38];
2426
+ let U;
2427
+ return e[39] !== n.id || e[40] !== b || e[41] !== S || e[42] !== Q || e[43] !== T || e[44] !== w || e[45] !== C || e[46] !== _ ? (U = /* @__PURE__ */ c(B, { minWidth: "0", borderTopWidth: b, borderColor: S, paddingTop: T, paddingBottom: "2xs", bg: w, onDragOver: C, onDrop: _, "data-queued-follow-up-id": n.id, children: Q }), e[39] = n.id, e[40] = b, e[41] = S, e[42] = Q, e[43] = T, e[44] = w, e[45] = C, e[46] = _, e[47] = U) : U = e[47], U;
2428
+ }, wl = (t) => {
2429
+ const e = k(24), {
2430
+ items: n,
2431
+ editingItemId: o,
2432
+ onEdit: s,
2433
+ onRemove: r,
2434
+ onMove: i
2435
+ } = t, [l, a] = W(null), [u, d] = W(null);
2436
+ if (n.length === 0)
2437
+ return null;
2438
+ let f;
2439
+ e[0] !== l ? (f = (x, b) => {
2440
+ !l || l === b || (x.preventDefault(), x.dataTransfer.dropEffect = "move", d(b));
2441
+ }, e[0] = l, e[1] = f) : f = e[1];
2442
+ const p = f;
2443
+ let m;
2444
+ e[2] !== l || e[3] !== n || e[4] !== i ? (m = (x, b) => {
2445
+ x.preventDefault();
2446
+ const S = l ?? x.dataTransfer.getData("text/plain");
2447
+ if (a(null), d(null), !S || S === b)
2448
+ return;
2449
+ const T = n.findIndex((_) => _.id === S), w = n.findIndex((_) => _.id === b);
2450
+ if (T === -1 || w === -1 || T === w)
2451
+ return;
2452
+ const C = w < T ? "up" : "down";
2453
+ i?.(S, C, Math.abs(w - T));
2454
+ }, e[2] = l, e[3] = n, e[4] = i, e[5] = m) : m = e[5];
2455
+ const h = m;
2456
+ let g;
2457
+ if (e[6] !== u || e[7] !== o || e[8] !== p || e[9] !== h || e[10] !== n || e[11] !== s || e[12] !== r) {
2458
+ let x;
2459
+ e[14] !== u || e[15] !== o || e[16] !== p || e[17] !== h || e[18] !== n.length || e[19] !== s || e[20] !== r ? (x = (b, S) => /* @__PURE__ */ c(Sl, { item: b, index: S, isFirst: S === 0, isLast: S === n.length - 1, isEditing: o === b.id, isDragTarget: u === b.id, onEdit: s, onRemove: r, onDragStart: a, onDragEnd: () => {
2460
+ a(null), d(null);
2461
+ }, onDragOver: p, onDrop: h }, b.id), e[14] = u, e[15] = o, e[16] = p, e[17] = h, e[18] = n.length, e[19] = s, e[20] = r, e[21] = x) : x = e[21], g = n.map(x), e[6] = u, e[7] = o, e[8] = p, e[9] = h, e[10] = n, e[11] = s, e[12] = r, e[13] = g;
2462
+ } else
2463
+ g = e[13];
2464
+ let y;
2465
+ return e[22] !== g ? (y = /* @__PURE__ */ c(X, { gap: "2xs", paddingX: "0", paddingY: "xs", borderWidth: "1px", borderBottomWidth: "0", borderColor: "border", borderTopRadius: "xs", background: "bg", children: g }), e[22] = g, e[23] = y) : y = e[23], y;
2466
+ }, Tl = (t) => {
2467
+ const e = Math.max(0, Math.floor(t));
2468
+ if (e < 60) return `${e}s`;
2469
+ const n = Math.floor(e / 60);
2470
+ return n < 60 ? `${n}m ${String(e % 60).padStart(2, "0")}s` : `${Math.floor(n / 60)}h ${String(n % 60).padStart(2, "0")}m`;
2471
+ }, Cl = (t) => {
2472
+ const e = k(9), {
2473
+ hidden: n
2474
+ } = t, o = n === void 0 ? !1 : n, [s, r] = W(0);
2475
+ let i;
2476
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (i = Date.now(), e[0] = i) : i = e[0];
2477
+ const l = Te(i);
2478
+ let a, u;
2479
+ if (e[1] !== o ? (a = () => {
2480
+ if (o)
2481
+ return;
2482
+ const m = () => r((Date.now() - l.current) / 1e3);
2483
+ m();
2484
+ const h = setInterval(m, 1e3);
2485
+ return () => clearInterval(h);
2486
+ }, u = [o], e[1] = o, e[2] = a, e[3] = u) : (a = e[2], u = e[3]), le(a, u), o)
2487
+ return null;
2488
+ let d;
2489
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ c(nn, { size: "xs", color: "fg.muted" }), e[4] = d) : d = e[4];
2490
+ let f;
2491
+ e[5] !== s ? (f = Tl(s), e[5] = s, e[6] = f) : f = e[6];
2492
+ let p;
2493
+ return e[7] !== f ? (p = /* @__PURE__ */ A(ae, { gap: "2xs", px: "sm", py: "xs", children: [
2494
+ d,
2495
+ /* @__PURE__ */ c(j, { fontFamily: "mono", fontSize: "xs", color: "fg.muted", letterSpacing: "-0.2px", children: f })
2496
+ ] }), e[7] = f, e[8] = p) : p = e[8], p;
2497
+ }, kl = (t) => {
2498
+ const e = k(19), {
2499
+ queuedFollowUps: n,
2500
+ defaultValue: o,
2501
+ onChange: s,
2502
+ onSubmit: r,
2503
+ onUpdate: i
2504
+ } = t, [l, a] = W(null), [u, d] = W(""), [f, p] = W(0), m = l ? u : o;
2505
+ let h, g;
2506
+ e[0] !== l || e[1] !== n ? (h = () => {
2507
+ l && (n.some((I) => I.id === l) || (a(null), d("")));
2508
+ }, g = [l, n], e[0] = l, e[1] = n, e[2] = h, e[3] = g) : (h = e[2], g = e[3]), le(h, g);
2509
+ let y;
2510
+ e[4] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (y = (I) => {
2511
+ a(I.id), d(I.prompt), p(Il);
2512
+ }, e[4] = y) : y = e[4];
2513
+ const x = y;
2514
+ let b;
2515
+ e[5] !== l || e[6] !== s ? (b = (I) => {
2516
+ l || s?.(I);
2517
+ }, e[5] = l, e[6] = s, e[7] = b) : b = e[7];
2518
+ const S = b;
2519
+ let T;
2520
+ e[8] !== l || e[9] !== r || e[10] !== i ? (T = (I, M, P) => {
2521
+ if (l) {
2522
+ i?.(l, I), a(null), d("");
2523
+ return;
2524
+ }
2525
+ r?.(I, M, P);
2526
+ }, e[8] = l, e[9] = r, e[10] = i, e[11] = T) : T = e[11];
2527
+ const w = T, C = !!l;
2528
+ let _;
2529
+ return e[12] !== S || e[13] !== l || e[14] !== f || e[15] !== m || e[16] !== w || e[17] !== C ? (_ = {
2530
+ change: S,
2531
+ edit: x,
2532
+ editingItemId: l,
2533
+ focusSignal: f,
2534
+ inputValue: m,
2535
+ isEditing: C,
2536
+ submit: w
2537
+ }, e[12] = S, e[13] = l, e[14] = f, e[15] = m, e[16] = w, e[17] = C, e[18] = _) : _ = e[18], _;
2538
+ }, Al = (t) => {
2539
+ const e = k(43), {
2540
+ actions: n,
2541
+ attachedResources: o,
2542
+ attachmentList: s,
2543
+ chatInputAutoFocus: r,
2544
+ chatInputPlaceholder: i,
2545
+ chatInputQuestionPrompt: l,
2546
+ chatInputReferences: a,
2547
+ hasWorkspaceHub: u,
2548
+ inputDisabled: d,
2549
+ onAttachFiles: f,
2550
+ onAttachText: p,
2551
+ onChatInputAddReference: m,
2552
+ onClearAttachments: h,
2553
+ onInterrupt: g,
2554
+ onQueuedFollowUpMove: y,
2555
+ onQueuedFollowUpRemove: x,
2556
+ onQueuedFollowUpUpdate: b,
2557
+ queuedComposer: S,
2558
+ queuedFollowUps: T,
2559
+ streaming: w,
2560
+ workspaceHub: C
2561
+ } = t, _ = T.length > 0, I = u ? "2xs" : "xs", M = u ? "2xs" : "0", P = u ? "2xs" : void 0, F = u ? "1px" : void 0, E = u ? "border" : void 0, D = u ? "sm" : void 0, O = u ? "bg.subtle" : void 0, z = b ? S.edit : void 0;
2562
+ let L;
2563
+ e[0] !== y || e[1] !== x || e[2] !== S.editingItemId || e[3] !== T || e[4] !== z ? (L = /* @__PURE__ */ c(wl, { items: T, editingItemId: S.editingItemId, onEdit: z, onRemove: x, onMove: y }), e[0] = y, e[1] = x, e[2] = S.editingItemId, e[3] = T, e[4] = z, e[5] = L) : L = e[5];
2564
+ let q;
2565
+ e[6] !== S.inputValue ? (q = Yo(S.inputValue), e[6] = S.inputValue, e[7] = q) : q = e[7];
2566
+ const R = S.isEditing ? "Save queued follow-up" : void 0;
2567
+ let Q;
2568
+ e[8] !== n || e[9] !== o || e[10] !== s || e[11] !== r || e[12] !== i || e[13] !== l || e[14] !== a || e[15] !== _ || e[16] !== u || e[17] !== d || e[18] !== f || e[19] !== p || e[20] !== m || e[21] !== h || e[22] !== g || e[23] !== S.change || e[24] !== S.focusSignal || e[25] !== S.submit || e[26] !== w || e[27] !== R || e[28] !== q ? (Q = /* @__PURE__ */ c(qo, { placeholder: i, defaultState: q, streaming: w, onSubmit: S.submit, onInterrupt: g, onAttachFiles: f, onAttachText: p, onChange: S.change, actions: n, attachedResources: o, onClearAttachments: h, attachmentList: s, isDisabled: d, attachedToTop: _, recessed: u, questionPrompt: l, autoFocus: r, focusSignal: S.focusSignal, submitTitle: R, references: a, onAddReference: m }), e[8] = n, e[9] = o, e[10] = s, e[11] = r, e[12] = i, e[13] = l, e[14] = a, e[15] = _, e[16] = u, e[17] = d, e[18] = f, e[19] = p, e[20] = m, e[21] = h, e[22] = g, e[23] = S.change, e[24] = S.focusSignal, e[25] = S.submit, e[26] = w, e[27] = R, e[28] = q, e[29] = Q) : Q = e[29];
2569
+ let U;
2570
+ e[30] !== M || e[31] !== Q || e[32] !== P || e[33] !== F || e[34] !== E || e[35] !== D || e[36] !== O || e[37] !== L || e[38] !== C ? (U = /* @__PURE__ */ A(X, { gap: M, p: P, borderWidth: F, borderColor: E, borderRadius: D, bg: O, children: [
2571
+ C,
2572
+ L,
2573
+ Q
2574
+ ] }), e[30] = M, e[31] = Q, e[32] = P, e[33] = F, e[34] = E, e[35] = D, e[36] = O, e[37] = L, e[38] = C, e[39] = U) : U = e[39];
2575
+ let H;
2576
+ return e[40] !== I || e[41] !== U ? (H = /* @__PURE__ */ c(X, { px: I, gap: "0", children: U }), e[40] = I, e[41] = U, e[42] = H) : H = e[42], H;
2577
+ }, Yl = (t) => {
2578
+ const e = k(77), {
2142
2579
  conversationKey: n,
2143
- messages: s,
2144
- loading: o,
2580
+ messages: o,
2581
+ loading: s,
2145
2582
  streaming: r,
2146
2583
  emptyStateTitle: i,
2147
2584
  emptyStateDescription: l,
2148
- emptyStateContent: c,
2585
+ emptyStateContent: a,
2149
2586
  loaderComponent: u,
2150
2587
  chatInputPlaceholder: d,
2151
2588
  chatInputDefaultValue: f,
2152
- onSubmitMessage: m,
2153
- onInterrupt: p,
2589
+ onSubmitMessage: p,
2590
+ onInterrupt: m,
2154
2591
  onAttachFiles: h,
2155
2592
  onAttachText: g,
2156
2593
  onChatInputChange: y,
2157
- actions: b,
2158
- repoMenu: x,
2159
- attachedResources: C,
2160
- onClearAttachments: A,
2161
- attachmentList: w,
2162
- approvalPrompt: _,
2163
- workspaceHub: M,
2164
- workspaceInitializing: P,
2165
- inputDisabled: v,
2166
- chatInputQuestionPrompt: L,
2167
- chatInputAutoFocus: H
2168
- } = t, J = o === void 0 ? !1 : o, B = r === void 0 ? !1 : r, ve = f === void 0 ? "" : f, je = P === void 0 ? !1 : P, Le = v === void 0 ? !1 : v, he = H === void 0 ? !1 : H;
2169
- let F, z, ee, E;
2170
- if (e[0] !== n || e[1] !== s) {
2171
- const q = si(s);
2172
- F = q.length > 0;
2173
- const we = n ?? q[0]?.id;
2174
- z = F ? we ?? "active-conversation" : null, E = q.reduce(ki, 0), ee = ri(q), e[0] = n, e[1] = s, e[2] = F, e[3] = z, e[4] = ee, e[5] = E;
2594
+ actions: x,
2595
+ attachedResources: b,
2596
+ onClearAttachments: S,
2597
+ attachmentList: T,
2598
+ approvalPrompt: w,
2599
+ workspaceHub: C,
2600
+ workspaceInitializing: _,
2601
+ inputDisabled: I,
2602
+ chatInputQuestionPrompt: M,
2603
+ chatInputAutoFocus: P,
2604
+ queuedFollowUps: F,
2605
+ onQueuedFollowUpUpdate: E,
2606
+ onQueuedFollowUpRemove: D,
2607
+ onQueuedFollowUpMove: O,
2608
+ chatInputReferences: z,
2609
+ onChatInputAddReference: L
2610
+ } = t, q = s === void 0 ? !1 : s, R = r === void 0 ? !1 : r, Q = f === void 0 ? "" : f, U = _ === void 0 ? !1 : _, H = I === void 0 ? !1 : I, _e = P === void 0 ? !1 : P;
2611
+ let ve;
2612
+ e[0] !== F ? (ve = F === void 0 ? [] : F, e[0] = F, e[1] = ve) : ve = e[1];
2613
+ const ue = ve;
2614
+ let Re;
2615
+ e[2] !== z ? (Re = z === void 0 ? [] : z, e[2] = z, e[3] = Re) : Re = e[3];
2616
+ const Ne = Re;
2617
+ let Y, ee, de, fe, N;
2618
+ if (e[4] !== n || e[5] !== o || e[6] !== R) {
2619
+ const G = tl(o, {
2620
+ streaming: R
2621
+ });
2622
+ Y = G.length > 0, de = n ?? G[0]?.id, ee = Y ? de ?? "active-conversation" : null, N = G.reduce(_l, 0), fe = nl(G), e[4] = n, e[5] = o, e[6] = R, e[7] = Y, e[8] = ee, e[9] = de, e[10] = fe, e[11] = N;
2175
2623
  } else
2176
- F = e[2], z = e[3], ee = e[4], E = e[5];
2624
+ Y = e[7], ee = e[8], de = e[9], fe = e[10], N = e[11];
2177
2625
  const {
2178
- groups: ge,
2179
- leadingResponses: be
2180
- } = ee, [O, De] = G(Ci), [Ue, Ke] = G(null), Be = !F && J;
2181
- let Ie;
2182
- e[6] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Ie = /* @__PURE__ */ a(bo, { size: 48, strokeWidth: 1.5 }), e[6] = Ie) : Ie = e[6];
2183
- let te;
2184
- e[7] !== l || e[8] !== i ? (te = /* @__PURE__ */ a(Ao, { icon: Ie, title: i, description: l }), e[7] = l, e[8] = i, e[9] = te) : te = e[9];
2185
- const ye = Be ? u : c ?? te, ne = !!M, xe = !!L, oe = B && F && !je, se = !z || Ue === z;
2186
- let re;
2187
- e[10] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (re = (q) => {
2188
- De((we) => {
2189
- const K = new Set(we);
2190
- return K.has(q) ? K.delete(q) : K.add(q), K;
2626
+ groups: Me,
2627
+ leadingResponses: Pe
2628
+ } = fe, [J, je] = W(vl), [qe, rt] = W(null), Ue = !Y && q;
2629
+ let He;
2630
+ e[12] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (He = /* @__PURE__ */ c(Ns, { size: 48, strokeWidth: 1.5 }), e[12] = He) : He = e[12];
2631
+ let pe;
2632
+ e[13] !== l || e[14] !== i ? (pe = /* @__PURE__ */ c(Js, { icon: He, title: i, description: l }), e[13] = l, e[14] = i, e[15] = pe) : pe = e[15];
2633
+ const Ee = Ue ? u : a ?? pe, De = !!C;
2634
+ let me;
2635
+ e[16] !== M || e[17] !== o ? (me = M ?? Xo(o), e[16] = M, e[17] = o, e[18] = me) : me = e[18];
2636
+ const ne = me, Be = !!ne, Fe = R && Y && !U && !ne, he = !ee || qe === ee;
2637
+ let ge;
2638
+ e[19] !== Q || e[20] !== y || e[21] !== E || e[22] !== p || e[23] !== ue ? (ge = {
2639
+ queuedFollowUps: ue,
2640
+ defaultValue: Q,
2641
+ onChange: y,
2642
+ onSubmit: p,
2643
+ onUpdate: E
2644
+ }, e[19] = Q, e[20] = y, e[21] = E, e[22] = p, e[23] = ue, e[24] = ge) : ge = e[24];
2645
+ const Le = kl(ge);
2646
+ let be;
2647
+ e[25] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (be = (G) => {
2648
+ je((Ge) => {
2649
+ const $e = new Set(Ge);
2650
+ return $e.has(G) ? $e.delete(G) : $e.add(G), $e;
2191
2651
  });
2192
- }, e[10] = re) : re = e[10];
2193
- const Oe = re;
2194
- let ie;
2195
- e[11] !== E ? (ie = /* @__PURE__ */ a(Ho, { userMessageCount: E }), e[11] = E, e[12] = ie) : ie = e[12];
2196
- const Se = se ? "visible" : "hidden";
2197
- let Q;
2198
- e[13] !== ye || e[14] !== O || e[15] !== ge || e[16] !== F || e[17] !== xe || e[18] !== be || e[19] !== z || e[20] !== B ? (Q = F ? /* @__PURE__ */ a(wi, { leadingResponses: be, groups: ge, streaming: B, hideActiveQuestionForms: xe, expandedStickyMessageIds: O, onToggleStickyMessage: Oe, onReady: () => Ke(z) }, z) : ye, e[13] = ye, e[14] = O, e[15] = ge, e[16] = F, e[17] = xe, e[18] = be, e[19] = z, e[20] = B, e[21] = Q) : Q = e[21];
2199
- let W;
2200
- e[22] !== Se || e[23] !== Q ? (W = /* @__PURE__ */ a(Et.Viewport, { visibility: Se, children: Q }), e[22] = Se, e[23] = Q, e[24] = W) : W = e[24];
2201
- let Te;
2202
- e[25] !== se ? (Te = se ? /* @__PURE__ */ a(Et.ScrollToBottom, { "aria-label": "Scroll to latest message" }) : null, e[25] = se, e[26] = Te) : Te = e[26];
2203
- let N;
2204
- e[27] !== ie || e[28] !== W || e[29] !== Te ? (N = /* @__PURE__ */ k(Et.Root, { children: [
2205
- ie,
2206
- W,
2207
- Te
2208
- ] }), e[27] = ie, e[28] = W, e[29] = Te, e[30] = N) : N = e[30];
2652
+ }, e[25] = be) : be = e[25];
2653
+ const Ke = be, lt = de ?? null;
2654
+ let se;
2655
+ e[26] !== lt || e[27] !== N ? (se = /* @__PURE__ */ c(xo, { conversationKey: lt, userMessageCount: N }), e[26] = lt, e[27] = N, e[28] = se) : se = e[28];
2656
+ const We = he ? "visible" : "hidden";
2209
2657
  let Z;
2210
- e[31] !== oe ? (Z = oe ? /* @__PURE__ */ k(Me, { gap: "xs", px: "sm", py: "2xs", children: [
2211
- /* @__PURE__ */ a(Ft, { size: "xs", color: "fg.muted" }),
2212
- /* @__PURE__ */ a(X, { textStyle: "label/XS/regular", color: "fg.muted", children: "Working..." })
2213
- ] }) : null, e[31] = oe, e[32] = Z) : Z = e[32];
2214
- const V = ne ? "0" : "xs";
2215
- let $;
2216
- e[33] !== ve ? ($ = ps(ve), e[33] = ve, e[34] = $) : $ = e[34];
2217
- let D;
2218
- e[35] !== b || e[36] !== C || e[37] !== w || e[38] !== he || e[39] !== d || e[40] !== L || e[41] !== ne || e[42] !== Le || e[43] !== h || e[44] !== g || e[45] !== y || e[46] !== A || e[47] !== p || e[48] !== m || e[49] !== B || e[50] !== $ ? (D = /* @__PURE__ */ a(cs, { placeholder: d, defaultState: $, streaming: B, onSubmit: m, onInterrupt: p, onAttachFiles: h, onAttachText: g, onChange: y, actions: b, attachedResources: C, onClearAttachments: A, attachmentList: w, isDisabled: Le, attachedToTop: ne, questionPrompt: L, autoFocus: he }), e[35] = b, e[36] = C, e[37] = w, e[38] = he, e[39] = d, e[40] = L, e[41] = ne, e[42] = Le, e[43] = h, e[44] = g, e[45] = y, e[46] = A, e[47] = p, e[48] = m, e[49] = B, e[50] = $, e[51] = D) : D = e[51];
2219
- let j;
2220
- e[52] !== V || e[53] !== D || e[54] !== M ? (j = /* @__PURE__ */ k(Y, { px: "xs", gap: V, children: [
2221
- M,
2222
- D
2223
- ] }), e[52] = V, e[53] = D, e[54] = M, e[55] = j) : j = e[55];
2224
- let U;
2225
- e[56] !== x ? (U = /* @__PURE__ */ a(Re, { p: "2xs", justifyContent: "flex-end", children: x }), e[56] = x, e[57] = U) : U = e[57];
2226
- let le;
2227
- return e[58] !== _ || e[59] !== N || e[60] !== Z || e[61] !== j || e[62] !== U ? (le = /* @__PURE__ */ k(Re, { position: "relative", direction: "column", w: "full", h: "full", overflow: "hidden", children: [
2228
- N,
2229
- _,
2230
- Z,
2231
- j,
2232
- U
2233
- ] }), e[58] = _, e[59] = N, e[60] = Z, e[61] = j, e[62] = U, e[63] = le) : le = e[63], le;
2658
+ e[29] !== Ee || e[30] !== J || e[31] !== Me || e[32] !== Y || e[33] !== Be || e[34] !== Pe || e[35] !== ee || e[36] !== R ? (Z = Y ? /* @__PURE__ */ c(xl, { leadingResponses: Pe, groups: Me, streaming: R, hideActiveQuestionForms: Be, expandedStickyMessageIds: J, onToggleStickyMessage: Ke, onReady: () => rt(ee) }, ee) : Ee, e[29] = Ee, e[30] = J, e[31] = Me, e[32] = Y, e[33] = Be, e[34] = Pe, e[35] = ee, e[36] = R, e[37] = Z) : Z = e[37];
2659
+ let K;
2660
+ e[38] !== We || e[39] !== Z ? (K = /* @__PURE__ */ c(Nt.Viewport, { visibility: We, children: Z }), e[38] = We, e[39] = Z, e[40] = K) : K = e[40];
2661
+ let oe;
2662
+ e[41] !== he ? (oe = he ? /* @__PURE__ */ c(Nt.ScrollToBottom, { "aria-label": "Scroll to latest message" }) : null, e[41] = he, e[42] = oe) : oe = e[42];
2663
+ let te;
2664
+ e[43] !== se || e[44] !== K || e[45] !== oe ? (te = /* @__PURE__ */ A(Nt.Root, { children: [
2665
+ se,
2666
+ K,
2667
+ oe
2668
+ ] }), e[43] = se, e[44] = K, e[45] = oe, e[46] = te) : te = e[46];
2669
+ let re;
2670
+ e[47] !== Fe || e[48] !== R ? (re = R ? /* @__PURE__ */ c(Cl, { hidden: !Fe }) : null, e[47] = Fe, e[48] = R, e[49] = re) : re = e[49];
2671
+ let ce;
2672
+ e[50] !== x || e[51] !== ne || e[52] !== b || e[53] !== T || e[54] !== _e || e[55] !== d || e[56] !== Ne || e[57] !== De || e[58] !== H || e[59] !== h || e[60] !== g || e[61] !== L || e[62] !== S || e[63] !== m || e[64] !== O || e[65] !== D || e[66] !== E || e[67] !== Le || e[68] !== ue || e[69] !== R || e[70] !== C ? (ce = /* @__PURE__ */ c(Al, { actions: x, attachedResources: b, attachmentList: T, chatInputAutoFocus: _e, chatInputPlaceholder: d, chatInputQuestionPrompt: ne, chatInputReferences: Ne, hasWorkspaceHub: De, inputDisabled: H, onAttachFiles: h, onAttachText: g, onChatInputAddReference: L, onClearAttachments: S, onInterrupt: m, onQueuedFollowUpMove: O, onQueuedFollowUpRemove: D, onQueuedFollowUpUpdate: E, queuedComposer: Le, queuedFollowUps: ue, streaming: R, workspaceHub: C }), e[50] = x, e[51] = ne, e[52] = b, e[53] = T, e[54] = _e, e[55] = d, e[56] = Ne, e[57] = De, e[58] = H, e[59] = h, e[60] = g, e[61] = L, e[62] = S, e[63] = m, e[64] = O, e[65] = D, e[66] = E, e[67] = Le, e[68] = ue, e[69] = R, e[70] = C, e[71] = ce) : ce = e[71];
2673
+ let ye;
2674
+ return e[72] !== w || e[73] !== te || e[74] !== re || e[75] !== ce ? (ye = /* @__PURE__ */ A(Qe, { position: "relative", direction: "column", w: "full", h: "full", overflow: "hidden", children: [
2675
+ te,
2676
+ w,
2677
+ re,
2678
+ ce
2679
+ ] }), e[72] = w, e[73] = te, e[74] = re, e[75] = ce, e[76] = ye) : ye = e[76], ye;
2234
2680
  };
2235
- function ki(t, e) {
2681
+ function Il(t) {
2682
+ return t + 1;
2683
+ }
2684
+ function _l(t, e) {
2236
2685
  return t + (e.role === "user" ? 1 : 0);
2237
2686
  }
2238
- function Ci() {
2687
+ function vl() {
2239
2688
  return /* @__PURE__ */ new Set();
2240
2689
  }
2241
- const on = (t) => /* @__PURE__ */ a(Y, { gap: "xs", w: "full", children: t.map((e, n) => /* @__PURE__ */ a(Kn, { height: "3", width: e, borderRadius: "xs" }, `${e}-${n}`)) }), fl = () => {
2242
- const t = T(2);
2690
+ const An = (t) => /* @__PURE__ */ c(X, { gap: "xs", w: "full", children: t.map((e, n) => /* @__PURE__ */ c(Ts, { height: "3", width: e, borderRadius: "xs" }, `${e}-${n}`)) }), Jl = () => {
2691
+ const t = k(2);
2243
2692
  let e;
2244
- t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ a(_e.Root, { from: "user", children: /* @__PURE__ */ a(_e.Content, { from: "user", children: on(["72%", "46%"]) }) }), t[0] = e) : e = t[0];
2693
+ t[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ c(ze.Root, { from: "user", children: /* @__PURE__ */ c(ze.Content, { from: "user", children: An(["72%", "46%"]) }) }), t[0] = e) : e = t[0];
2245
2694
  let n;
2246
- return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ k(Y, { minH: "full", py: "xs", gap: "0", children: [
2695
+ return t[1] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (n = /* @__PURE__ */ A(X, { minH: "full", py: "xs", gap: "0", children: [
2247
2696
  e,
2248
- /* @__PURE__ */ a(_e.Root, { from: "assistant", children: /* @__PURE__ */ a(_e.Content, { from: "assistant", children: on(["76%", "62%", "40%"]) }) })
2697
+ /* @__PURE__ */ c(ze.Root, { from: "assistant", children: /* @__PURE__ */ c(ze.Content, { from: "assistant", children: An(["76%", "62%", "40%"]) }) })
2249
2698
  ] }), t[1] = n) : n = t[1], n;
2250
- }, pl = (t) => {
2251
- const e = T(14), {
2252
- changesLabel: n,
2699
+ }, Rl = 3, In = 10, Ml = 26, en = 4, Pl = (t, e) => {
2700
+ if (e === null) return 0;
2701
+ const n = Math.abs(t - e);
2702
+ return n >= en ? 0 : (1 + Math.cos(Math.PI * n / en)) / 2;
2703
+ }, El = (t, e) => {
2704
+ if (e === null) return "fg.subtle";
2705
+ const n = Math.abs(t - e);
2706
+ return n < 0.5 ? "fg" : n < en ? "fg.muted" : "fg.subtle";
2707
+ }, Dl = (t) => {
2708
+ const e = k(11), {
2709
+ item: n,
2710
+ position: o
2711
+ } = t, s = `${o.left}px`, r = `${o.top}px`;
2712
+ let i;
2713
+ e[0] !== n.message ? (i = /* @__PURE__ */ c(j, { textStyle: "label/S/medium", color: "fg", lineClamp: 2, children: n.message }), e[0] = n.message, e[1] = i) : i = e[1];
2714
+ let l;
2715
+ e[2] !== n.reply ? (l = n.reply ? /* @__PURE__ */ c(j, { textStyle: "label/XS/regular", color: "fg.muted", lineClamp: 2, children: n.reply }) : null, e[2] = n.reply, e[3] = l) : l = e[3];
2716
+ let a;
2717
+ e[4] !== i || e[5] !== l ? (a = /* @__PURE__ */ A(X, { gap: "1.5", p: "3", bg: "bg.elevated", borderWidth: "1px", borderColor: "border", borderRadius: "lg", children: [
2718
+ i,
2719
+ l
2720
+ ] }), e[4] = i, e[5] = l, e[6] = a) : a = e[6];
2721
+ let u;
2722
+ return e[7] !== s || e[8] !== r || e[9] !== a ? (u = /* @__PURE__ */ c(vn, { children: /* @__PURE__ */ c(B, { position: "fixed", left: s, ml: "2xs", top: r, transform: "translateY(-50%)", w: "80", maxW: "80", zIndex: "popover", pointerEvents: "none", children: a }) }), e[7] = s, e[8] = r, e[9] = a, e[10] = u) : u = e[10], u;
2723
+ }, Zl = (t) => {
2724
+ const e = k(22), {
2725
+ items: n,
2726
+ onSelect: o,
2727
+ floating: s
2728
+ } = t, r = s === void 0 ? !1 : s, [i, l] = W(null), [a, u] = W(null);
2729
+ if (n.length < Rl)
2730
+ return null;
2731
+ let d;
2732
+ e[0] !== n.length ? (d = (T) => {
2733
+ const w = T.currentTarget.getBoundingClientRect(), C = (T.clientY - w.top) / w.height, _ = Math.min(n.length - 1, Math.max(0, C * n.length - 0.5)), I = Math.round(_);
2734
+ l(_), u({
2735
+ left: w.right,
2736
+ top: w.top + (I + 0.5) / n.length * w.height
2737
+ });
2738
+ }, e[0] = n.length, e[1] = d) : d = e[1];
2739
+ const f = d, p = i === null ? null : Math.round(i), m = p === null ? null : n[p];
2740
+ let h;
2741
+ e[2] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = () => l(null), e[2] = h) : h = e[2];
2742
+ let g;
2743
+ e[3] !== r ? (g = r ? {
2744
+ position: "absolute",
2745
+ insetInlineStart: 0,
2746
+ top: 0,
2747
+ bottom: 0,
2748
+ bg: "bg"
2749
+ } : {}, e[3] = r, e[4] = g) : g = e[4];
2750
+ let y;
2751
+ if (e[5] !== n || e[6] !== o || e[7] !== i) {
2752
+ let T;
2753
+ e[9] !== o || e[10] !== i ? (T = (w, C) => /* @__PURE__ */ c(_n.button, { type: "button", h: "2px", w: `${In + (Ml - In) * Pl(C, i)}px`, bg: El(C, i), borderRadius: "1px", transition: "width 80ms linear, background-color 80ms linear", "aria-label": `Jump to message ${C + 1}`, onClick: () => o?.(w.id) }, w.id), e[9] = o, e[10] = i, e[11] = T) : T = e[11], y = n.map(T), e[5] = n, e[6] = o, e[7] = i, e[8] = y;
2754
+ } else
2755
+ y = e[8];
2756
+ let x;
2757
+ e[12] !== f || e[13] !== g || e[14] !== y ? (x = /* @__PURE__ */ c(Qe, { direction: "column", align: "flex-start", gap: "1.5", px: "1.5", py: "2", w: "10", onPointerMove: f, onPointerLeave: h, ...g, children: y }), e[12] = f, e[13] = g, e[14] = y, e[15] = x) : x = e[15];
2758
+ let b;
2759
+ e[16] !== m || e[17] !== a ? (b = m && a ? /* @__PURE__ */ c(Dl, { item: m, position: a }) : null, e[16] = m, e[17] = a, e[18] = b) : b = e[18];
2760
+ let S;
2761
+ return e[19] !== x || e[20] !== b ? (S = /* @__PURE__ */ A(B, { position: "relative", w: "10", flexShrink: 0, children: [
2762
+ x,
2763
+ b
2764
+ ] }), e[19] = x, e[20] = b, e[21] = S) : S = e[21], S;
2765
+ }, Bl = (t) => {
2766
+ const e = k(13), {
2767
+ status: n,
2768
+ statusLabel: o,
2253
2769
  additions: s,
2254
- deletions: o,
2770
+ deletions: r
2771
+ } = t;
2772
+ if (n === "loading") {
2773
+ let u;
2774
+ e[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ c(nn, { size: "xs", color: "fg.muted" }), e[0] = u) : u = e[0];
2775
+ const d = o ?? "Setting up workspace...";
2776
+ let f;
2777
+ return e[1] !== d ? (f = /* @__PURE__ */ A(ae, { gap: "2xs", minW: "0", children: [
2778
+ u,
2779
+ /* @__PURE__ */ c(j, { textStyle: "label/XS/regular", color: "fg.muted", truncate: !0, children: d })
2780
+ ] }), e[1] = d, e[2] = f) : f = e[2], f;
2781
+ }
2782
+ if (n === "error") {
2783
+ let u;
2784
+ e[3] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ c(Bn, { size: 14, color: "var(--chakra-colors-fg-error)" }), e[3] = u) : u = e[3];
2785
+ const d = o ?? "Workspace setup failed";
2786
+ let f;
2787
+ return e[4] !== d ? (f = /* @__PURE__ */ A(ae, { gap: "2xs", minW: "0", children: [
2788
+ u,
2789
+ /* @__PURE__ */ c(j, { textStyle: "label/XS/regular", color: "fg.error", truncate: !0, children: d })
2790
+ ] }), e[4] = d, e[5] = f) : f = e[5], f;
2791
+ }
2792
+ if (s <= 0 && r <= 0)
2793
+ return null;
2794
+ let i;
2795
+ e[6] !== s ? (i = /* @__PURE__ */ A(j, { textStyle: "label/XS/medium", color: "fg.success", children: [
2796
+ "+",
2797
+ s
2798
+ ] }), e[6] = s, e[7] = i) : i = e[7];
2799
+ let l;
2800
+ e[8] !== r ? (l = /* @__PURE__ */ A(j, { textStyle: "label/XS/medium", color: "fg.error", children: [
2801
+ "−",
2802
+ r
2803
+ ] }), e[8] = r, e[9] = l) : l = e[9];
2804
+ let a;
2805
+ return e[10] !== i || e[11] !== l ? (a = /* @__PURE__ */ A(ae, { gap: "2xs", children: [
2806
+ i,
2807
+ l
2808
+ ] }), e[10] = i, e[11] = l, e[12] = a) : a = e[12], a;
2809
+ }, ea = (t) => {
2810
+ const e = k(13), {
2811
+ workspaceControl: n,
2812
+ additions: o,
2813
+ deletions: s,
2255
2814
  action: r,
2256
2815
  status: i,
2257
2816
  statusLabel: l
2258
- } = t, c = i === void 0 ? "ready" : i, u = s > 0 || o > 0, d = c === "error" ? "border.error" : "border.muted", f = c === "error" ? "bg.error" : "bg.subtle";
2259
- let m;
2260
- e[0] !== s || e[1] !== n || e[2] !== o || e[3] !== u || e[4] !== c || e[5] !== l ? (m = c === "loading" ? /* @__PURE__ */ k(Me, { gap: "xs", minW: "0", children: [
2261
- /* @__PURE__ */ a(Ft, { size: "xs", color: "fg.muted" }),
2262
- /* @__PURE__ */ a(X, { textStyle: "label/S/regular", color: "fg.muted", truncate: !0, children: l ?? "Setting up workspace..." })
2263
- ] }) : c === "error" ? /* @__PURE__ */ k(Me, { gap: "xs", minW: "0", children: [
2264
- /* @__PURE__ */ a(an, { size: 14, color: "var(--chakra-colors-fg-error)" }),
2265
- /* @__PURE__ */ a(X, { textStyle: "label/S/regular", color: "fg.error", truncate: !0, children: l ?? "Workspace setup failed" })
2266
- ] }) : u ? /* @__PURE__ */ a(fn, { label: n, additions: s, deletions: o, variant: "ghost", size: "small", _hover: {
2267
- background: "transparent"
2268
- } }) : /* @__PURE__ */ a(Re, { flex: "1" }), e[0] = s, e[1] = n, e[2] = o, e[3] = u, e[4] = c, e[5] = l, e[6] = m) : m = e[6];
2817
+ } = t, a = i === void 0 ? "ready" : i;
2818
+ let u;
2819
+ e[0] !== o || e[1] !== s || e[2] !== a || e[3] !== l ? (u = /* @__PURE__ */ c(Bl, { status: a, statusLabel: l, additions: o, deletions: s }), e[0] = o, e[1] = s, e[2] = a, e[3] = l, e[4] = u) : u = e[4];
2820
+ let d;
2821
+ e[5] !== u || e[6] !== n ? (d = /* @__PURE__ */ A(ae, { gap: "sm", minW: "0", children: [
2822
+ n,
2823
+ u
2824
+ ] }), e[5] = u, e[6] = n, e[7] = d) : d = e[7];
2825
+ let f;
2826
+ e[8] !== r ? (f = r ? /* @__PURE__ */ c(Qe, { flexShrink: 0, children: r }) : null, e[8] = r, e[9] = f) : f = e[9];
2269
2827
  let p;
2270
- e[7] !== r ? (p = r ? /* @__PURE__ */ a(Re, { flexShrink: 0, ml: "auto", children: r }) : null, e[7] = r, e[8] = p) : p = e[8];
2271
- let h;
2272
- return e[9] !== d || e[10] !== f || e[11] !== m || e[12] !== p ? (h = /* @__PURE__ */ k(Re, { align: "center", justify: "space-between", gap: "sm", minW: "0", px: "sm", py: "xs", borderWidth: "1px", borderColor: d, borderRadius: "xs", borderBottomRadius: "0", bg: f, children: [
2273
- m,
2274
- p
2275
- ] }), e[9] = d, e[10] = f, e[11] = m, e[12] = p, e[13] = h) : h = e[13], h;
2828
+ return e[10] !== d || e[11] !== f ? (p = /* @__PURE__ */ A(Qe, { align: "center", justify: "space-between", gap: "sm", minW: "0", pl: "xs", pr: "2xs", py: "2xs", children: [
2829
+ d,
2830
+ f
2831
+ ] }), e[10] = d, e[11] = f, e[12] = p) : p = e[12], p;
2276
2832
  };
2277
2833
  export {
2278
- cl as ApprovalPrompt,
2279
- ul as AttachmentList,
2280
- Ho as AutoScroll,
2281
- cs as ChatInput,
2282
- _e as ChatMessage,
2283
- dl as ChatPanel,
2284
- Et as ChatPrimitives,
2285
- fl as ChatSkeleton,
2286
- pl as ChatWorkspaceHub,
2287
- ls as SendButton,
2288
- ps as createSerializedPromptState
2834
+ Gl as ApprovalPrompt,
2835
+ Xl as AttachmentList,
2836
+ xo as AutoScroll,
2837
+ qo as ChatInput,
2838
+ ze as ChatMessage,
2839
+ Yl as ChatPanel,
2840
+ Nt as ChatPrimitives,
2841
+ Jl as ChatSkeleton,
2842
+ ea as ChatWorkspaceHub,
2843
+ Zl as ConversationBrowse,
2844
+ zo as SendButton,
2845
+ Yo as createSerializedPromptState
2289
2846
  };
2290
2847
  //# sourceMappingURL=chat-ui.js.map