@tylertech/forge-ai 0.15.3-dev.1 → 0.16.0-dev.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 (446) hide show
  1. package/MIGRATION.md +192 -0
  2. package/README.md +76 -2
  3. package/custom-elements.json +5757 -15411
  4. package/dist/_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorate.mjs +9 -0
  5. package/dist/ai-agent-info/ai-agent-info.mjs +4 -78
  6. package/dist/ai-agent-info/ai-agent-info2.mjs +55 -0
  7. package/dist/ai-agent-info/index.d.ts +1 -1
  8. package/dist/ai-agent-info/index.mjs +1 -5
  9. package/dist/ai-agent-selector/ai-agent-selector.d.ts +2 -2
  10. package/dist/ai-agent-selector/ai-agent-selector.mjs +4 -439
  11. package/dist/ai-agent-selector/ai-agent-selector2.mjs +344 -0
  12. package/dist/ai-agent-selector/index.mjs +1 -5
  13. package/dist/ai-artifact/ai-artifact.mjs +4 -39
  14. package/dist/ai-artifact/ai-artifact2.mjs +31 -0
  15. package/dist/ai-artifact/index.d.ts +1 -1
  16. package/dist/ai-artifact/index.mjs +1 -5
  17. package/dist/ai-artifact-card/ai-artifact-card.mjs +4 -142
  18. package/dist/ai-artifact-card/ai-artifact-card2.mjs +103 -0
  19. package/dist/ai-artifact-card/index.d.ts +1 -1
  20. package/dist/ai-artifact-card/index.mjs +1 -5
  21. package/dist/ai-artifact-card-group/ai-artifact-card-group.mjs +4 -137
  22. package/dist/ai-artifact-card-group/ai-artifact-card-group2.mjs +100 -0
  23. package/dist/ai-artifact-card-group/index.d.ts +1 -1
  24. package/dist/ai-artifact-card-group/index.mjs +1 -5
  25. package/dist/ai-assistant-response/ai-assistant-response.d.ts +1 -2
  26. package/dist/ai-assistant-response/ai-assistant-response.mjs +4 -236
  27. package/dist/ai-assistant-response/ai-assistant-response2.mjs +137 -0
  28. package/dist/ai-assistant-response/index.d.ts +1 -1
  29. package/dist/ai-assistant-response/index.mjs +1 -5
  30. package/dist/ai-canvas/ai-canvas.d.ts +3 -3
  31. package/dist/ai-canvas/ai-canvas.mjs +4 -95
  32. package/dist/ai-canvas/ai-canvas2.mjs +74 -0
  33. package/dist/ai-canvas/index.d.ts +1 -1
  34. package/dist/ai-canvas/index.mjs +1 -5
  35. package/dist/ai-chain-of-thought/ai-chain-of-thought.mjs +4 -45
  36. package/dist/ai-chain-of-thought/ai-chain-of-thought2.mjs +35 -0
  37. package/dist/ai-chain-of-thought/index.d.ts +5 -5
  38. package/dist/ai-chain-of-thought/index.mjs +6 -17
  39. package/dist/ai-chain-of-thought/thought-base/index.mjs +1 -5
  40. package/dist/ai-chain-of-thought/thought-base/thought-base.mjs +4 -43
  41. package/dist/ai-chain-of-thought/thought-base/thought-base2.mjs +31 -0
  42. package/dist/ai-chain-of-thought/thought-detail/index.mjs +1 -5
  43. package/dist/ai-chain-of-thought/thought-detail/thought-detail.mjs +4 -34
  44. package/dist/ai-chain-of-thought/thought-detail/thought-detail2.mjs +26 -0
  45. package/dist/ai-chain-of-thought/thought-image/index.mjs +1 -5
  46. package/dist/ai-chain-of-thought/thought-image/thought-image.mjs +4 -43
  47. package/dist/ai-chain-of-thought/thought-image/thought-image2.mjs +30 -0
  48. package/dist/ai-chain-of-thought/thought-search-result/index.mjs +1 -5
  49. package/dist/ai-chain-of-thought/thought-search-result/thought-search-result.mjs +4 -62
  50. package/dist/ai-chain-of-thought/thought-search-result/thought-search-result2.mjs +45 -0
  51. package/dist/ai-chat-header/ai-chat-header.d.ts +7 -5
  52. package/dist/ai-chat-header/ai-chat-header.mjs +4 -439
  53. package/dist/ai-chat-header/ai-chat-header2.mjs +319 -0
  54. package/dist/ai-chat-header/index.d.ts +2 -2
  55. package/dist/ai-chat-header/index.mjs +1 -5
  56. package/dist/ai-chat-interface/ai-chat-interface.d.ts +1 -0
  57. package/dist/ai-chat-interface/ai-chat-interface.mjs +4 -103
  58. package/dist/ai-chat-interface/ai-chat-interface2.mjs +73 -0
  59. package/dist/ai-chat-interface/index.mjs +1 -5
  60. package/dist/ai-client-message/ai-client-message.d.ts +5 -6
  61. package/dist/ai-client-message/ai-client-message.mjs +4 -112
  62. package/dist/ai-client-message/ai-client-message2.mjs +76 -0
  63. package/dist/ai-client-message/index.mjs +1 -5
  64. package/dist/ai-context-chip/ai-context-chip.d.ts +1 -1
  65. package/dist/ai-context-chip/ai-context-chip.mjs +4 -169
  66. package/dist/ai-context-chip/ai-context-chip2.mjs +113 -0
  67. package/dist/ai-context-chip/index.mjs +1 -5
  68. package/dist/ai-context-items/ai-context-items.d.ts +11 -5
  69. package/dist/ai-context-items/ai-context-items.mjs +4 -78
  70. package/dist/ai-context-items/ai-context-items2.mjs +53 -0
  71. package/dist/ai-context-items/index.d.ts +1 -1
  72. package/dist/ai-context-items/index.mjs +1 -5
  73. package/dist/ai-conversations-panel/ai-conversations-panel.d.ts +2 -2
  74. package/dist/ai-conversations-panel/ai-conversations-panel.mjs +4 -632
  75. package/dist/ai-conversations-panel/ai-conversations-panel2.mjs +531 -0
  76. package/dist/ai-conversations-panel/index.mjs +1 -5
  77. package/dist/ai-copy-button/ai-copy-button.mjs +4 -116
  78. package/dist/ai-copy-button/ai-copy-button2.mjs +88 -0
  79. package/dist/ai-copy-button/index.mjs +1 -5
  80. package/dist/ai-dialog/ai-dialog.mjs +4 -304
  81. package/dist/ai-dialog/ai-dialog2.mjs +237 -0
  82. package/dist/ai-dialog/index.d.ts +1 -1
  83. package/dist/ai-dialog/index.mjs +1 -5
  84. package/dist/ai-disclaimer/ai-disclaimer.mjs +4 -70
  85. package/dist/ai-disclaimer/ai-disclaimer2.mjs +46 -0
  86. package/dist/ai-disclaimer/index.d.ts +1 -1
  87. package/dist/ai-disclaimer/index.mjs +1 -5
  88. package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group.mjs +4 -80
  89. package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group2.mjs +51 -0
  90. package/dist/ai-dropdown-menu/ai-dropdown-menu-item.d.ts +5 -1
  91. package/dist/ai-dropdown-menu/ai-dropdown-menu-item.mjs +4 -330
  92. package/dist/ai-dropdown-menu/ai-dropdown-menu-item2.mjs +280 -0
  93. package/dist/ai-dropdown-menu/ai-dropdown-menu-separator.mjs +4 -26
  94. package/dist/ai-dropdown-menu/ai-dropdown-menu-separator2.mjs +19 -0
  95. package/dist/ai-dropdown-menu/ai-dropdown-menu.d.ts +5 -0
  96. package/dist/ai-dropdown-menu/ai-dropdown-menu.mjs +4 -351
  97. package/dist/ai-dropdown-menu/ai-dropdown-menu2.mjs +268 -0
  98. package/dist/ai-dropdown-menu/index.d.ts +1 -0
  99. package/dist/ai-dropdown-menu/index.mjs +5 -10
  100. package/dist/ai-dropdown-menu/navigation-controller.d.ts +9 -1
  101. package/dist/ai-dropdown-menu/navigation-controller.mjs +214 -204
  102. package/dist/ai-dropdown-menu/selection-manager.mjs +202 -182
  103. package/dist/ai-edit-thread/ai-edit-thread.d.ts +1 -1
  104. package/dist/ai-edit-thread/ai-edit-thread.mjs +4 -137
  105. package/dist/ai-edit-thread/ai-edit-thread2.mjs +96 -0
  106. package/dist/ai-edit-thread/index.d.ts +1 -1
  107. package/dist/ai-edit-thread/index.mjs +1 -5
  108. package/dist/ai-empty-state/ai-empty-state.mjs +4 -38
  109. package/dist/ai-empty-state/ai-empty-state2.mjs +28 -0
  110. package/dist/ai-empty-state/index.d.ts +1 -1
  111. package/dist/ai-empty-state/index.mjs +1 -5
  112. package/dist/ai-error-message/ai-error-message.mjs +4 -80
  113. package/dist/ai-error-message/ai-error-message2.mjs +62 -0
  114. package/dist/ai-error-message/index.mjs +1 -5
  115. package/dist/ai-fab/ai-fab.mjs +4 -81
  116. package/dist/ai-fab/ai-fab2.mjs +54 -0
  117. package/dist/ai-fab/index.d.ts +1 -1
  118. package/dist/ai-fab/index.mjs +1 -5
  119. package/dist/ai-file-picker/ai-file-picker.d.ts +1 -0
  120. package/dist/ai-file-picker/ai-file-picker.mjs +4 -224
  121. package/dist/ai-file-picker/ai-file-picker2.mjs +172 -0
  122. package/dist/ai-file-picker/index.mjs +1 -4
  123. package/dist/ai-gradient-container/ai-gradient-container.mjs +4 -61
  124. package/dist/ai-gradient-container/ai-gradient-container2.mjs +38 -0
  125. package/dist/ai-gradient-container/index.d.ts +1 -1
  126. package/dist/ai-gradient-container/index.mjs +1 -5
  127. package/dist/ai-icon/ai-icon.d.ts +3 -0
  128. package/dist/ai-icon/ai-icon.mjs +4 -71
  129. package/dist/ai-icon/ai-icon2.mjs +41 -0
  130. package/dist/ai-icon/index.d.ts +1 -1
  131. package/dist/ai-icon/index.mjs +1 -5
  132. package/dist/ai-message-thread/ai-message-thread.d.ts +4 -3
  133. package/dist/ai-message-thread/ai-message-thread.mjs +4 -360
  134. package/dist/ai-message-thread/ai-message-thread2.mjs +279 -0
  135. package/dist/ai-message-thread/index.mjs +1 -5
  136. package/dist/ai-modal/ai-modal.mjs +4 -178
  137. package/dist/ai-modal/ai-modal2.mjs +141 -0
  138. package/dist/ai-modal/index.mjs +1 -4
  139. package/dist/ai-prompt/ai-prompt.d.ts +10 -6
  140. package/dist/ai-prompt/ai-prompt.mjs +4 -534
  141. package/dist/ai-prompt/ai-prompt2.mjs +438 -0
  142. package/dist/ai-prompt/index.mjs +1 -5
  143. package/dist/ai-reasoning/ai-reasoning.mjs +4 -44
  144. package/dist/ai-reasoning/ai-reasoning2.mjs +35 -0
  145. package/dist/ai-reasoning/index.d.ts +2 -2
  146. package/dist/ai-reasoning/index.mjs +4 -8
  147. package/dist/ai-reasoning/reasoning-content/index.d.ts +1 -1
  148. package/dist/ai-reasoning/reasoning-content/index.mjs +1 -5
  149. package/dist/ai-reasoning/reasoning-content/reasoning-content.mjs +4 -90
  150. package/dist/ai-reasoning/reasoning-content/reasoning-content2.mjs +68 -0
  151. package/dist/ai-reasoning-header/ai-reasoning-header.d.ts +7 -1
  152. package/dist/ai-reasoning-header/ai-reasoning-header.mjs +4 -68
  153. package/dist/ai-reasoning-header/ai-reasoning-header2.mjs +51 -0
  154. package/dist/ai-reasoning-header/index.d.ts +1 -1
  155. package/dist/ai-reasoning-header/index.mjs +1 -5
  156. package/dist/ai-response-message/ai-response-message.mjs +4 -25
  157. package/dist/ai-response-message/ai-response-message2.mjs +17 -0
  158. package/dist/ai-response-message/index.mjs +1 -5
  159. package/dist/ai-response-message-toolbar/ai-response-message-toolbar.d.ts +1 -1
  160. package/dist/ai-response-message-toolbar/ai-response-message-toolbar.mjs +4 -230
  161. package/dist/ai-response-message-toolbar/ai-response-message-toolbar2.mjs +171 -0
  162. package/dist/ai-response-message-toolbar/index.mjs +1 -5
  163. package/dist/ai-sidebar/ai-sidebar.d.ts +4 -4
  164. package/dist/ai-sidebar/ai-sidebar.mjs +4 -256
  165. package/dist/ai-sidebar/ai-sidebar2.mjs +211 -0
  166. package/dist/ai-sidebar/index.d.ts +2 -2
  167. package/dist/ai-sidebar/index.mjs +1 -5
  168. package/dist/ai-slash-command-menu/ai-slash-command-menu.d.ts +1 -1
  169. package/dist/ai-slash-command-menu/ai-slash-command-menu.mjs +4 -200
  170. package/dist/ai-slash-command-menu/ai-slash-command-menu2.mjs +156 -0
  171. package/dist/ai-slash-command-menu/index.mjs +1 -5
  172. package/dist/ai-spinner/ai-spinner.mjs +4 -41
  173. package/dist/ai-spinner/ai-spinner2.mjs +29 -0
  174. package/dist/ai-spinner/index.d.ts +1 -1
  175. package/dist/ai-spinner/index.mjs +1 -5
  176. package/dist/ai-steps/ai-steps.mjs +4 -163
  177. package/dist/ai-steps/ai-steps2.mjs +133 -0
  178. package/dist/ai-steps/index.d.ts +1 -1
  179. package/dist/ai-steps/index.mjs +1 -5
  180. package/dist/ai-suggestions/ai-suggestions.d.ts +2 -5
  181. package/dist/ai-suggestions/ai-suggestions.mjs +4 -164
  182. package/dist/ai-suggestions/ai-suggestions2.mjs +125 -0
  183. package/dist/ai-suggestions/index.d.ts +2 -1
  184. package/dist/ai-suggestions/index.mjs +1 -5
  185. package/dist/ai-thinking-indicator/ai-thinking-indicator.d.ts +2 -1
  186. package/dist/ai-thinking-indicator/ai-thinking-indicator.mjs +4 -160
  187. package/dist/ai-thinking-indicator/ai-thinking-indicator2.mjs +143 -0
  188. package/dist/ai-thinking-indicator/index.d.ts +1 -1
  189. package/dist/ai-thinking-indicator/index.mjs +1 -5
  190. package/dist/ai-thread-actions-menu/ai-thread-actions-menu.d.ts +2 -2
  191. package/dist/ai-thread-actions-menu/ai-thread-actions-menu.mjs +4 -152
  192. package/dist/ai-thread-actions-menu/ai-thread-actions-menu2.mjs +109 -0
  193. package/dist/ai-thread-actions-menu/index.d.ts +1 -1
  194. package/dist/ai-thread-actions-menu/index.mjs +1 -5
  195. package/dist/ai-threads-search/ai-threads-search.d.ts +3 -4
  196. package/dist/ai-threads-search/ai-threads-search.mjs +4 -602
  197. package/dist/ai-threads-search/ai-threads-search2.mjs +495 -0
  198. package/dist/ai-threads-search/index.d.ts +1 -1
  199. package/dist/ai-threads-search/index.mjs +1 -5
  200. package/dist/ai-tool-call/ai-tool-call.d.ts +21 -0
  201. package/dist/ai-tool-call/ai-tool-call.mjs +4 -0
  202. package/dist/ai-tool-call/ai-tool-call2.mjs +132 -0
  203. package/dist/{ai-chatbot → ai-tool-call}/create-tool-renderer.d.ts +1 -1
  204. package/dist/ai-tool-call/create-tool-renderer.mjs +10 -0
  205. package/dist/ai-tool-call/index.d.ts +6 -0
  206. package/dist/ai-tool-call/index.mjs +5 -0
  207. package/dist/{ai-chatbot → ai-tool-call}/tool-canvas.d.ts +1 -1
  208. package/dist/ai-tool-call/tool-canvas.mjs +135 -0
  209. package/dist/ai-tool-call/utils.d.ts +12 -0
  210. package/dist/ai-tool-call/utils.mjs +20 -0
  211. package/dist/ai-tool-call-indicator/ai-tool-call-indicator.d.ts +1 -1
  212. package/dist/ai-tool-call-indicator/ai-tool-call-indicator.mjs +4 -331
  213. package/dist/ai-tool-call-indicator/ai-tool-call-indicator2.mjs +225 -0
  214. package/dist/ai-tool-call-indicator/index.mjs +1 -5
  215. package/dist/ai-user-message/ai-user-message.mjs +4 -151
  216. package/dist/ai-user-message/ai-user-message2.mjs +105 -0
  217. package/dist/ai-user-message/index.mjs +1 -5
  218. package/dist/ai-user-message-toolbar/ai-user-message-toolbar.mjs +4 -160
  219. package/dist/ai-user-message-toolbar/ai-user-message-toolbar2.mjs +102 -0
  220. package/dist/ai-user-message-toolbar/index.mjs +1 -5
  221. package/dist/ai-voice-input/ai-voice-input.d.ts +1 -1
  222. package/dist/ai-voice-input/ai-voice-input.mjs +4 -113
  223. package/dist/ai-voice-input/ai-voice-input2.mjs +92 -0
  224. package/dist/ai-voice-input/index.d.ts +1 -1
  225. package/dist/ai-voice-input/index.mjs +1 -5
  226. package/dist/core/drag-controller.mjs +196 -221
  227. package/dist/core/index.d.ts +3 -2
  228. package/dist/core/index.mjs +7 -8
  229. package/dist/core/overlay/index.mjs +1 -4
  230. package/dist/core/overlay/overlay.d.ts +1 -1
  231. package/dist/core/overlay/overlay.mjs +4 -180
  232. package/dist/core/overlay/overlay2.mjs +146 -0
  233. package/dist/core/popover/index.mjs +1 -4
  234. package/dist/core/popover/popover.mjs +4 -98
  235. package/dist/core/popover/popover2.mjs +71 -0
  236. package/dist/core/resize-controller.mjs +132 -154
  237. package/dist/core/tooltip/index.mjs +1 -4
  238. package/dist/core/tooltip/tooltip.mjs +4 -279
  239. package/dist/core/tooltip/tooltip2.mjs +213 -0
  240. package/dist/index.d.ts +45 -53
  241. package/dist/index.mjs +100 -214
  242. package/dist/jsx.d.ts +895 -0
  243. package/dist/tools/ai-data-table/ai-data-table.d.ts +1 -2
  244. package/dist/tools/ai-data-table/ai-data-table.mjs +4 -257
  245. package/dist/tools/ai-data-table/ai-data-table2.mjs +185 -0
  246. package/dist/tools/ai-data-table/index.d.ts +0 -1
  247. package/dist/tools/ai-data-table/index.mjs +1 -6
  248. package/dist/tools/ai-paginator/ai-paginator.d.ts +14 -0
  249. package/dist/tools/ai-paginator/ai-paginator.mjs +4 -115
  250. package/dist/tools/ai-paginator/ai-paginator2.mjs +90 -0
  251. package/dist/tools/ai-paginator/index.mjs +1 -4
  252. package/dist/tools/ai-steps/ai-steps.d.ts +2 -3
  253. package/dist/tools/ai-steps/ai-steps.mjs +4 -49
  254. package/dist/tools/ai-steps/ai-steps2.mjs +30 -0
  255. package/dist/tools/ai-steps/index.d.ts +0 -1
  256. package/dist/tools/ai-steps/index.mjs +1 -6
  257. package/dist/tools/index.d.ts +3 -3
  258. package/dist/tools/index.mjs +7 -12
  259. package/dist/types/chat.d.ts +102 -0
  260. package/dist/types/feature.d.ts +1 -0
  261. package/dist/types/file.d.ts +36 -0
  262. package/dist/types/index.d.ts +6 -0
  263. package/dist/types/index.mjs +0 -0
  264. package/dist/types/thread.d.ts +14 -0
  265. package/dist/types/tool.d.ts +197 -0
  266. package/dist/utils/csv-utils.mjs +37 -57
  267. package/dist/utils/delete-thread-controller.d.ts +1 -1
  268. package/dist/utils/delete-thread-controller.mjs +48 -71
  269. package/dist/utils/dom.d.ts +14 -0
  270. package/dist/utils/dom.mjs +30 -0
  271. package/dist/utils/format.d.ts +9 -0
  272. package/dist/utils/format.mjs +27 -0
  273. package/dist/utils/index.d.ts +9 -6
  274. package/dist/utils/index.mjs +6 -16
  275. package/dist/utils/infinite-scroll-controller.mjs +88 -94
  276. package/dist/utils/keyboard-navigation-controller.mjs +62 -70
  277. package/dist/utils/markdown-stream-controller.mjs +48 -0
  278. package/dist/utils/markdown.d.ts +10 -1
  279. package/dist/utils/markdown.mjs +261 -40
  280. package/dist/utils/storage-utils.mjs +30 -24
  281. package/package.json +39 -103
  282. package/dist/ai-agent-info/ai-agent-info.scss.mjs +0 -4
  283. package/dist/ai-agent-selector/ai-agent-selector.scss.mjs +0 -4
  284. package/dist/ai-artifact/ai-artifact.scss.mjs +0 -4
  285. package/dist/ai-artifact-card/ai-artifact-card.scss.mjs +0 -283
  286. package/dist/ai-artifact-card-group/ai-artifact-card-group.scss.mjs +0 -173
  287. package/dist/ai-assistant-response/ai-assistant-response.scss.mjs +0 -4
  288. package/dist/ai-attachment/ai-attachment.d.ts +0 -39
  289. package/dist/ai-attachment/ai-attachment.mjs +0 -130
  290. package/dist/ai-attachment/ai-attachment.scss.mjs +0 -4
  291. package/dist/ai-attachment/index.d.ts +0 -1
  292. package/dist/ai-attachment/index.mjs +0 -5
  293. package/dist/ai-button/ai-button.d.ts +0 -21
  294. package/dist/ai-button/ai-button.mjs +0 -68
  295. package/dist/ai-button/ai-button.scss.mjs +0 -4
  296. package/dist/ai-button/index.d.ts +0 -1
  297. package/dist/ai-button/index.mjs +0 -5
  298. package/dist/ai-canvas/ai-canvas.scss.mjs +0 -4
  299. package/dist/ai-chain-of-thought/ai-chain-of-thought.scss.mjs +0 -4
  300. package/dist/ai-chain-of-thought/thought-base/thought-base.scss.mjs +0 -4
  301. package/dist/ai-chain-of-thought/thought-detail/thought-detail.scss.mjs +0 -4
  302. package/dist/ai-chain-of-thought/thought-image/thought-image.scss.mjs +0 -4
  303. package/dist/ai-chain-of-thought/thought-search-result/thought-search-result.scss.mjs +0 -4
  304. package/dist/ai-chat-header/ai-chat-header.scss.mjs +0 -4
  305. package/dist/ai-chat-interface/ai-chat-interface.scss.mjs +0 -4
  306. package/dist/ai-chatbot/ag-ui-adapter.d.ts +0 -24
  307. package/dist/ai-chatbot/ag-ui-adapter.mjs +0 -388
  308. package/dist/ai-chatbot/agent-adapter.d.ts +0 -310
  309. package/dist/ai-chatbot/agent-adapter.mjs +0 -221
  310. package/dist/ai-chatbot/agent-runner.d.ts +0 -41
  311. package/dist/ai-chatbot/agent-runner.mjs +0 -265
  312. package/dist/ai-chatbot/ai-chatbot-base.d.ts +0 -179
  313. package/dist/ai-chatbot/ai-chatbot-base.mjs +0 -684
  314. package/dist/ai-chatbot/ai-chatbot-tool-call.d.ts +0 -19
  315. package/dist/ai-chatbot/ai-chatbot-tool-call.mjs +0 -182
  316. package/dist/ai-chatbot/ai-chatbot-tool-call.scss.mjs +0 -4
  317. package/dist/ai-chatbot/ai-chatbot.d.ts +0 -196
  318. package/dist/ai-chatbot/ai-chatbot.mjs +0 -502
  319. package/dist/ai-chatbot/ai-chatbot.scss.mjs +0 -4
  320. package/dist/ai-chatbot/create-tool-renderer.mjs +0 -16
  321. package/dist/ai-chatbot/event-emitter.d.ts +0 -43
  322. package/dist/ai-chatbot/event-emitter.mjs +0 -81
  323. package/dist/ai-chatbot/file-upload-manager.d.ts +0 -27
  324. package/dist/ai-chatbot/file-upload-manager.mjs +0 -106
  325. package/dist/ai-chatbot/http-agent-with-credentials.d.ts +0 -8
  326. package/dist/ai-chatbot/http-agent-with-credentials.mjs +0 -14
  327. package/dist/ai-chatbot/index.d.ts +0 -18
  328. package/dist/ai-chatbot/index.mjs +0 -40
  329. package/dist/ai-chatbot/markdown-stream-controller.mjs +0 -50
  330. package/dist/ai-chatbot/message-state-controller.d.ts +0 -72
  331. package/dist/ai-chatbot/message-state-controller.mjs +0 -392
  332. package/dist/ai-chatbot/request-serialization.d.ts +0 -33
  333. package/dist/ai-chatbot/request-serialization.mjs +0 -31
  334. package/dist/ai-chatbot/tool-canvas.mjs +0 -128
  335. package/dist/ai-chatbot/types.d.ts +0 -582
  336. package/dist/ai-chatbot/utils.d.ts +0 -49
  337. package/dist/ai-chatbot/utils.mjs +0 -114
  338. package/dist/ai-chatbot-launcher/ai-chatbot-launcher.d.ts +0 -190
  339. package/dist/ai-chatbot-launcher/ai-chatbot-launcher.mjs +0 -986
  340. package/dist/ai-chatbot-launcher/ai-chatbot-launcher.scss.mjs +0 -4
  341. package/dist/ai-chatbot-launcher/index.d.ts +0 -1
  342. package/dist/ai-chatbot-launcher/index.mjs +0 -5
  343. package/dist/ai-client-message/ai-client-message.scss.mjs +0 -4
  344. package/dist/ai-confirmation-prompt/ai-confirmation-prompt.d.ts +0 -34
  345. package/dist/ai-confirmation-prompt/ai-confirmation-prompt.mjs +0 -134
  346. package/dist/ai-confirmation-prompt/ai-confirmation-prompt.scss.mjs +0 -4
  347. package/dist/ai-confirmation-prompt/index.d.ts +0 -1
  348. package/dist/ai-confirmation-prompt/index.mjs +0 -5
  349. package/dist/ai-context-chip/ai-context-chip.scss.mjs +0 -4
  350. package/dist/ai-context-items/ai-context-items.scss.mjs +0 -4
  351. package/dist/ai-conversations-panel/ai-conversations-panel.scss.mjs +0 -4
  352. package/dist/ai-copy-button/ai-copy-button.scss.mjs +0 -4
  353. package/dist/ai-dialog/ai-dialog.scss.mjs +0 -4
  354. package/dist/ai-disclaimer/ai-disclaimer.scss.mjs +0 -4
  355. package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group.scss.mjs +0 -4
  356. package/dist/ai-dropdown-menu/ai-dropdown-menu-item.scss.mjs +0 -4
  357. package/dist/ai-dropdown-menu/ai-dropdown-menu-separator.scss.mjs +0 -4
  358. package/dist/ai-dropdown-menu/ai-dropdown-menu.scss.mjs +0 -4
  359. package/dist/ai-edit-thread/ai-edit-thread.scss.mjs +0 -4
  360. package/dist/ai-embedded-chat/ai-embedded-chat.d.ts +0 -64
  361. package/dist/ai-embedded-chat/ai-embedded-chat.mjs +0 -173
  362. package/dist/ai-embedded-chat/ai-embedded-chat.scss.mjs +0 -4
  363. package/dist/ai-embedded-chat/index.d.ts +0 -1
  364. package/dist/ai-embedded-chat/index.mjs +0 -5
  365. package/dist/ai-empty-state/ai-empty-state.scss.mjs +0 -4
  366. package/dist/ai-error-message/ai-error-message.scss.mjs +0 -4
  367. package/dist/ai-fab/ai-fab.scss.mjs +0 -4
  368. package/dist/ai-file-picker/ai-file-picker.scss.mjs +0 -4
  369. package/dist/ai-floating-chat/ai-floating-chat.d.ts +0 -53
  370. package/dist/ai-floating-chat/ai-floating-chat.mjs +0 -147
  371. package/dist/ai-floating-chat/ai-floating-chat.scss.mjs +0 -4
  372. package/dist/ai-floating-chat/index.d.ts +0 -1
  373. package/dist/ai-floating-chat/index.mjs +0 -5
  374. package/dist/ai-gradient-container/ai-gradient-container.scss.mjs +0 -4
  375. package/dist/ai-icon/ai-icon.scss.mjs +0 -4
  376. package/dist/ai-icon-button/ai-icon-button.d.ts +0 -19
  377. package/dist/ai-icon-button/ai-icon-button.mjs +0 -66
  378. package/dist/ai-icon-button/ai-icon-button.scss.mjs +0 -4
  379. package/dist/ai-icon-button/index.d.ts +0 -1
  380. package/dist/ai-icon-button/index.mjs +0 -5
  381. package/dist/ai-message-thread/ai-message-thread.scss.mjs +0 -4
  382. package/dist/ai-modal/ai-modal.scss.mjs +0 -4
  383. package/dist/ai-prompt/ai-prompt.scss.mjs +0 -4
  384. package/dist/ai-prompt/prompt-button/index.d.ts +0 -1
  385. package/dist/ai-prompt/prompt-button/index.mjs +0 -5
  386. package/dist/ai-prompt/prompt-button/prompt-button.d.ts +0 -16
  387. package/dist/ai-prompt/prompt-button/prompt-button.mjs +0 -40
  388. package/dist/ai-prompt/prompt-button/prompt-button.scss.mjs +0 -4
  389. package/dist/ai-reasoning/ai-reasoning.scss.mjs +0 -4
  390. package/dist/ai-reasoning/reasoning-content/reasoning-content.scss.mjs +0 -4
  391. package/dist/ai-reasoning-header/ai-reasoning-header.scss.mjs +0 -4
  392. package/dist/ai-response-message/ai-response-message.scss.mjs +0 -4
  393. package/dist/ai-response-message-toolbar/ai-response-message-toolbar.scss.mjs +0 -4
  394. package/dist/ai-sidebar/ai-sidebar.scss.mjs +0 -4
  395. package/dist/ai-sidebar-chat/ai-sidebar-chat.d.ts +0 -54
  396. package/dist/ai-sidebar-chat/ai-sidebar-chat.mjs +0 -163
  397. package/dist/ai-sidebar-chat/ai-sidebar-chat.scss.mjs +0 -4
  398. package/dist/ai-sidebar-chat/index.d.ts +0 -1
  399. package/dist/ai-sidebar-chat/index.mjs +0 -5
  400. package/dist/ai-slash-command-menu/ai-slash-command-menu.scss.mjs +0 -4
  401. package/dist/ai-spinner/ai-spinner.scss.mjs +0 -4
  402. package/dist/ai-steps/ai-steps.scss.mjs +0 -4
  403. package/dist/ai-suggestions/ai-suggestions.scss.mjs +0 -500
  404. package/dist/ai-thinking-indicator/ai-thinking-indicator.scss.mjs +0 -143
  405. package/dist/ai-thread-actions-menu/ai-thread-actions-menu.scss.mjs +0 -4
  406. package/dist/ai-threads/ai-threads.d.ts +0 -82
  407. package/dist/ai-threads/ai-threads.mjs +0 -343
  408. package/dist/ai-threads/ai-threads.scss.mjs +0 -4
  409. package/dist/ai-threads/index.d.ts +0 -1
  410. package/dist/ai-threads/index.mjs +0 -5
  411. package/dist/ai-threads-search/ai-threads-search.scss.mjs +0 -4
  412. package/dist/ai-tool-call-indicator/ai-tool-call-indicator.scss.mjs +0 -4
  413. package/dist/ai-user-message/ai-user-message.scss.mjs +0 -4
  414. package/dist/ai-user-message-toolbar/ai-user-message-toolbar.scss.mjs +0 -4
  415. package/dist/ai-voice-input/ai-voice-input.scss.mjs +0 -4
  416. package/dist/core/canvas-controller.d.ts +0 -81
  417. package/dist/core/canvas-controller.mjs +0 -221
  418. package/dist/core/chatbot-core-controller.d.ts +0 -57
  419. package/dist/core/chatbot-core-controller.mjs +0 -545
  420. package/dist/core/overlay/overlay.scss.mjs +0 -4
  421. package/dist/core/popover/popover.scss.mjs +0 -4
  422. package/dist/core/tooltip/tooltip.scss.mjs +0 -4
  423. package/dist/tools/ai-data-table/ai-data-table-definition.d.ts +0 -2
  424. package/dist/tools/ai-data-table/ai-data-table-definition.mjs +0 -43
  425. package/dist/tools/ai-data-table/ai-data-table.scss.mjs +0 -4
  426. package/dist/tools/ai-mcp-app/ai-mcp-app.d.ts +0 -70
  427. package/dist/tools/ai-mcp-app/ai-mcp-app.mjs +0 -589
  428. package/dist/tools/ai-mcp-app/ai-mcp-app.scss.mjs +0 -4
  429. package/dist/tools/ai-mcp-app/index.d.ts +0 -3
  430. package/dist/tools/ai-mcp-app/index.mjs +0 -6
  431. package/dist/tools/ai-mcp-app/mcp-app-bridge-controller.d.ts +0 -60
  432. package/dist/tools/ai-mcp-app/mcp-app-bridge-controller.mjs +0 -147
  433. package/dist/tools/ai-mcp-app/mcp-app-bridge-types.d.ts +0 -124
  434. package/dist/tools/ai-mcp-app/mcp-app-bridge.d.ts +0 -41
  435. package/dist/tools/ai-mcp-app/mcp-app-bridge.mjs +0 -293
  436. package/dist/tools/ai-mcp-app/mcp-app-context.d.ts +0 -46
  437. package/dist/tools/ai-mcp-app/mcp-app-context.mjs +0 -5
  438. package/dist/tools/ai-paginator/ai-paginator.scss.mjs +0 -4
  439. package/dist/tools/ai-steps/ai-steps-definition.d.ts +0 -2
  440. package/dist/tools/ai-steps/ai-steps-definition.mjs +0 -51
  441. package/dist/tools/ai-steps/ai-steps.scss.mjs +0 -4
  442. package/dist/utils/inert-outside.d.ts +0 -7
  443. package/dist/utils/inert-outside.mjs +0 -28
  444. package/dist/utils.d.ts +0 -32
  445. package/dist/utils.mjs +0 -57
  446. /package/dist/{ai-chatbot → utils}/markdown-stream-controller.d.ts +0 -0
@@ -1,986 +0,0 @@
1
- import { unsafeCSS, nothing, html, LitElement } from "lit";
2
- import { property, state, customElement } from "lit/decorators.js";
3
- import { classMap } from "lit/directives/class-map.js";
4
- import { createRef, ref } from "lit/directives/ref.js";
5
- import { when } from "lit/directives/when.js";
6
- import { styleMap } from "lit/directives/style-map.js";
7
- import { AiChatbotBase } from "../ai-chatbot/ai-chatbot-base.mjs";
8
- import { CanvasController } from "../core/canvas-controller.mjs";
9
- import { ResizeController } from "../core/resize-controller.mjs";
10
- import { DeleteThreadController } from "../utils/delete-thread-controller.mjs";
11
- import { writeStoredNumber, readStoredNumber } from "../utils/storage-utils.mjs";
12
- import { toggleState, forwardCancelableEvent } from "../utils.mjs";
13
- import "../ai-attachment/ai-attachment.mjs";
14
- import "../ai-canvas/ai-canvas.mjs";
15
- import "../ai-chat-header/ai-chat-header.mjs";
16
- import "../ai-edit-thread/ai-edit-thread.mjs";
17
- import "../ai-file-picker/ai-file-picker.mjs";
18
- import "../ai-icon/ai-icon.mjs";
19
- import "../ai-message-thread/ai-message-thread.mjs";
20
- import "../ai-prompt/ai-prompt.mjs";
21
- import "../ai-spinner/ai-spinner.mjs";
22
- import "../ai-suggestions/ai-suggestions.mjs";
23
- import "../ai-voice-input/ai-voice-input.mjs";
24
- import "../ai-gradient-container/ai-gradient-container.mjs";
25
- import "../ai-thread-actions-menu/ai-thread-actions-menu.mjs";
26
- import "../ai-threads-search/ai-threads-search.mjs";
27
- import "../core/popover/popover.mjs";
28
- import "../core/tooltip/tooltip.mjs";
29
- import styles from "./ai-chatbot-launcher.scss.mjs";
30
- var __defProp = Object.defineProperty;
31
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
32
- var __typeError = (msg) => {
33
- throw TypeError(msg);
34
- };
35
- var __decorateClass = (decorators, target, key, kind) => {
36
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
37
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
38
- if (decorator = decorators[i])
39
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
40
- if (kind && result) __defProp(target, key, result);
41
- return result;
42
- };
43
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
44
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
45
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
46
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
47
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
48
- var _headerRef, _gradientContainerRef, _historyButtonRef, _historyPopoverSearchRef, _historyViewSearchRef, _canvasRef, _launcherRef, _canvasTrackRef, _resizeHandleRef, _resizeController, _internals, _pendingThreadDeleteSource, _deleteThreadController, _canvas, _AiChatbotLauncherComponent_instances, setViewState_fn, focusAfterUpdate_fn, transitionToConversation_fn, commitConversationTransition_fn, transitionToWelcome_fn, transitionToHistory_fn, handleHistoryBack_fn, handleHeaderClear_fn, handleHeaderInfo_fn, handleThreadRename_fn, handleEditSave_fn, handleEditCancel_fn, handleThreadNameClick_fn, handleThreadDelete_fn, handleHistoryButtonClick_fn, handleHistoryPopoverToggle_fn, handleHistoryPopoverKeydown_fn, handleViewAllClick_fn, handleThreadsSearchQuery_fn, handleThreadsSearchLoadMore_fn, handleThreadsSearchSelect_fn, handleThreadsSearchRetry_fn, handleThreadsSearchNewChat_fn, handleThreadsSearchRename_fn, handleThreadsSearchDelete_fn, handleThreadsSearchDeleteConfirm_fn, hasFocusInCanvas_fn, availableChatWidth_get, handleResizeCommit_fn, readPersistedChatWidth_fn, shouldRestoreChatWidth_get, handleCanvasClose_fn, handleCanvasKeydown_fn, headingElement_get, promptTemplate_get, welcomeHeaderTemplate_get, welcomeSuggestionsTemplate_get, threadName_get, threadActionsMenu_get, conversationContentTemplate_get, historyContentTemplate_get, mainContentTemplate_get, showThreadsLoading_get, historyButtonTemplate_get, historyPopoverTemplate_get, promptSectionTemplate_get, resizeHandle_get, canvasTemplate_get;
49
- const HISTORY_POPOVER_INSET = 48;
50
- const AiChatbotLauncherComponentTagName = "forge-ai-chatbot-launcher";
51
- const DEFAULT_CHAT_WIDTH = 420;
52
- const MIN_CHAT_WIDTH = 360;
53
- const MIN_CANVAS_WIDTH = 320;
54
- const CHAT_WIDTH_STORAGE_KEY = "forge-ai-chatbot-launcher-chat-width";
55
- const CHAT_WIDTH_STORAGE_KINDS = ["session", "local"];
56
- let AiChatbotLauncherComponent = class extends AiChatbotBase {
57
- constructor() {
58
- super();
59
- __privateAdd(this, _AiChatbotLauncherComponent_instances);
60
- this.placeholder = "How can I help you today?";
61
- this.showHistoryButton = false;
62
- this.showThreadRename = false;
63
- this.showThreadDelete = false;
64
- this.threads = [];
65
- this.totalThreads = 0;
66
- this.threadsLoading = false;
67
- this.selectedThreadId = null;
68
- this.canvasResizable = "on";
69
- this.chatWidth = DEFAULT_CHAT_WIDTH;
70
- this._viewState = "welcome";
71
- this._isResizing = false;
72
- this._skipAnimation = false;
73
- this._editingThreadId = null;
74
- this._historyPopoverOpen = false;
75
- this._messageThreadRef = createRef();
76
- this._promptRef = createRef();
77
- __privateAdd(this, _headerRef, createRef());
78
- __privateAdd(this, _gradientContainerRef, createRef());
79
- __privateAdd(this, _historyButtonRef, createRef());
80
- __privateAdd(this, _historyPopoverSearchRef, createRef());
81
- __privateAdd(this, _historyViewSearchRef, createRef());
82
- __privateAdd(this, _canvasRef, createRef());
83
- __privateAdd(this, _launcherRef, createRef());
84
- __privateAdd(this, _canvasTrackRef, createRef());
85
- __privateAdd(this, _resizeHandleRef, createRef());
86
- __privateAdd(this, _resizeController);
87
- __privateAdd(this, _internals);
88
- __privateAdd(this, _pendingThreadDeleteSource, null);
89
- __privateAdd(this, _deleteThreadController, new DeleteThreadController(this, {
90
- onConfirm: (thread) => {
91
- const source = __privateGet(this, _pendingThreadDeleteSource);
92
- __privateSet(this, _pendingThreadDeleteSource, null);
93
- if (source) {
94
- source.confirmThreadDelete(thread);
95
- return;
96
- }
97
- const onSuccess = () => {
98
- };
99
- const onError = (error) => {
100
- if (error) {
101
- console.error("Delete failed:", error);
102
- }
103
- };
104
- const event = this._dispatchHostEvent({
105
- type: "forge-ai-chatbot-launcher-thread-delete",
106
- detail: {
107
- id: thread.id,
108
- thread,
109
- onSuccess,
110
- onError
111
- },
112
- cancelable: true
113
- });
114
- if (!event.defaultPrevented) {
115
- this.clearMessages();
116
- }
117
- }
118
- }));
119
- __privateAdd(this, _canvas, new CanvasController(this, {
120
- openEvent: "forge-ai-chatbot-launcher-canvas-open",
121
- closeEvent: "forge-ai-chatbot-launcher-canvas-close",
122
- dispatchHostEvent: (config) => this._dispatchHostEvent(config),
123
- getToolCalls: () => this._toolCalls,
124
- getTools: () => this._tools,
125
- canOpen: () => this._viewState === "conversation",
126
- onOpen: ({ reason }) => {
127
- __privateGet(this, _resizeController).setWidth(this.chatWidth);
128
- toggleState(__privateGet(this, _internals), "canvas-open", true);
129
- if (reason === "request") {
130
- void __privateMethod(this, _AiChatbotLauncherComponent_instances, focusAfterUpdate_fn).call(this, () => __privateGet(this, _canvasRef).value);
131
- }
132
- },
133
- onClose: () => {
134
- if (__privateMethod(this, _AiChatbotLauncherComponent_instances, hasFocusInCanvas_fn).call(this)) {
135
- void __privateMethod(this, _AiChatbotLauncherComponent_instances, focusAfterUpdate_fn).call(this, () => this._promptRef.value);
136
- }
137
- toggleState(__privateGet(this, _internals), "canvas-open", false);
138
- },
139
- onRefocus: () => __privateGet(this, _canvasRef).value?.focus(),
140
- collapsed: async () => {
141
- const transitions = [__privateGet(this, _launcherRef).value, __privateGet(this, _canvasTrackRef).value].flatMap((element) => element?.getAnimations() ?? []).filter((animation) => animation instanceof CSSTransition);
142
- await Promise.allSettled(transitions.map((transition) => transition.finished));
143
- }
144
- }));
145
- __privateSet(this, _internals, this.attachInternals());
146
- __privateSet(this, _resizeController, new ResizeController(this, {
147
- targetElementRef: __privateGet(this, _launcherRef),
148
- resizeHandleRef: __privateGet(this, _resizeHandleRef),
149
- minWidth: MIN_CHAT_WIDTH,
150
- maxWidth: Infinity,
151
- defaultWidth: DEFAULT_CHAT_WIDTH,
152
- // The handle sits on the chat column's inline-end edge, so dragging toward inline-end widens it.
153
- growDirection: () => getComputedStyle(this).direction === "rtl" ? "left" : "right",
154
- getAvailableWidth: () => __privateGet(this, _AiChatbotLauncherComponent_instances, availableChatWidth_get) ?? Number.MAX_SAFE_INTEGER,
155
- onResize: (width) => {
156
- this.chatWidth = width;
157
- },
158
- onResizeStart: () => {
159
- this._isResizing = true;
160
- },
161
- onResizeEnd: () => {
162
- this._isResizing = false;
163
- },
164
- onCommit: (width) => {
165
- __privateMethod(this, _AiChatbotLauncherComponent_instances, handleResizeCommit_fn).call(this, width);
166
- }
167
- }));
168
- }
169
- _onConnected() {
170
- __privateGet(this, _internals).states.add("welcome");
171
- }
172
- willUpdate(changedProperties) {
173
- super.willUpdate(changedProperties);
174
- if (!this.hasUpdated && __privateGet(this, _AiChatbotLauncherComponent_instances, shouldRestoreChatWidth_get)) {
175
- this.chatWidth = __privateMethod(this, _AiChatbotLauncherComponent_instances, readPersistedChatWidth_fn).call(this) ?? this.chatWidth;
176
- }
177
- if (changedProperties.has("chatWidth") && this.chatWidth !== __privateGet(this, _resizeController).currentWidth) {
178
- __privateGet(this, _resizeController).setWidth(this.chatWidth);
179
- }
180
- __privateGet(this, _canvas).syncToolCall();
181
- }
182
- // Auto-open dispatches a cancelable event, so it runs after render where listeners can safely call launcher APIs.
183
- updated(changedProperties) {
184
- super.updated(changedProperties);
185
- __privateGet(this, _canvas).autoOpenPending();
186
- }
187
- startConversation() {
188
- __privateMethod(this, _AiChatbotLauncherComponent_instances, commitConversationTransition_fn).call(this);
189
- }
190
- /**
191
- * Returns to the welcome view without touching conversation state. Unlike `startNewChat()`, this
192
- * leaves messages, `selectedThreadId`, and the adapter's thread untouched, so an abandoned thread
193
- * selection can be undone without discarding the conversation the user was already in.
194
- */
195
- showWelcome() {
196
- this._historyPopoverOpen = false;
197
- __privateMethod(this, _AiChatbotLauncherComponent_instances, transitionToWelcome_fn).call(this);
198
- }
199
- /**
200
- * Navigates directly to the full history view (not the history popover).
201
- */
202
- showHistory() {
203
- this._historyPopoverOpen = false;
204
- __privateMethod(this, _AiChatbotLauncherComponent_instances, transitionToHistory_fn).call(this);
205
- }
206
- _handleInfo() {
207
- const header = __privateGet(this, _headerRef).value;
208
- header?.showAgentInfo();
209
- super._handleInfo();
210
- }
211
- async _handleSend(evt) {
212
- __privateMethod(this, _AiChatbotLauncherComponent_instances, transitionToConversation_fn).call(this);
213
- await super._handleSend(evt);
214
- }
215
- async _handleSuggestionSelect(evt) {
216
- __privateMethod(this, _AiChatbotLauncherComponent_instances, transitionToConversation_fn).call(this);
217
- await super._handleSuggestionSelect(evt);
218
- }
219
- clearMessages() {
220
- if (super.clearMessages()) {
221
- __privateGet(this, _canvas).reset();
222
- __privateMethod(this, _AiChatbotLauncherComponent_instances, transitionToWelcome_fn).call(this);
223
- return true;
224
- }
225
- return false;
226
- }
227
- startNewChat() {
228
- super.startNewChat();
229
- this.selectedThreadId = null;
230
- __privateGet(this, _canvas).reset();
231
- __privateMethod(this, _AiChatbotLauncherComponent_instances, transitionToWelcome_fn).call(this);
232
- }
233
- setMessages(messages) {
234
- __privateGet(this, _canvas).reset();
235
- __privateGet(this, _canvas).markSeen(messages);
236
- super.setMessages(messages);
237
- if (messages.length > 0) {
238
- __privateMethod(this, _AiChatbotLauncherComponent_instances, transitionToConversation_fn).call(this);
239
- }
240
- }
241
- async sendMessage(content, files) {
242
- __privateMethod(this, _AiChatbotLauncherComponent_instances, transitionToConversation_fn).call(this);
243
- await super.sendMessage(content, files);
244
- }
245
- async setThreadState(threadState, options) {
246
- if (options?.skipAnimation) {
247
- this._skipAnimation = true;
248
- }
249
- await super.setThreadState(threadState);
250
- if (threadState.messages.length > 0) {
251
- __privateMethod(this, _AiChatbotLauncherComponent_instances, transitionToConversation_fn).call(this);
252
- }
253
- }
254
- get viewState() {
255
- return this._viewState;
256
- }
257
- get canvasOpen() {
258
- return __privateGet(this, _canvas).isOpen;
259
- }
260
- /**
261
- * Opens the canvas beside the conversation, or swaps its content if already open. Only available in the
262
- * conversation view; returns false elsewhere or when the open event is prevented.
263
- */
264
- openCanvas(options = {}) {
265
- return __privateGet(this, _canvas).open(options);
266
- }
267
- /**
268
- * Closes the canvas. Returns false if it was not open or the close event was prevented.
269
- */
270
- closeCanvas() {
271
- return __privateGet(this, _canvas).close();
272
- }
273
- focus() {
274
- this._promptRef.value?.focus();
275
- }
276
- render() {
277
- const classes = {
278
- launcher: true,
279
- "skip-animation": this._skipAnimation,
280
- resizing: this._isResizing
281
- };
282
- return html`
283
- <div
284
- ${ref(__privateGet(this, _launcherRef))}
285
- class=${classMap(classes)}
286
- style=${styleMap({ "--_chat-width": `${this.chatWidth}px` })}
287
- role="region"
288
- aria-label="AI chatbot launcher"
289
- aria-busy=${this._isStreaming}
290
- @forge-ai-canvas-open-request=${__privateGet(this, _canvas).handleOpenRequest}
291
- @forge-ai-canvas-close-request=${__privateGet(this, _canvas).handleCloseRequest}>
292
- <div class="chat">
293
- ${__privateGet(this, _AiChatbotLauncherComponent_instances, mainContentTemplate_get)} ${__privateGet(this, _AiChatbotLauncherComponent_instances, promptSectionTemplate_get)}
294
- ${this._viewState === "welcome" ? __privateGet(this, _AiChatbotLauncherComponent_instances, welcomeSuggestionsTemplate_get) : nothing}
295
- </div>
296
- <div ${ref(__privateGet(this, _canvasTrackRef))} class="canvas-track">${__privateGet(this, _AiChatbotLauncherComponent_instances, resizeHandle_get)} ${__privateGet(this, _AiChatbotLauncherComponent_instances, canvasTemplate_get)}</div>
297
- </div>
298
- ${when(this.showHistoryButton, () => __privateGet(this, _AiChatbotLauncherComponent_instances, historyPopoverTemplate_get))} ${__privateGet(this, _deleteThreadController).template}
299
- `;
300
- }
301
- };
302
- _headerRef = /* @__PURE__ */ new WeakMap();
303
- _gradientContainerRef = /* @__PURE__ */ new WeakMap();
304
- _historyButtonRef = /* @__PURE__ */ new WeakMap();
305
- _historyPopoverSearchRef = /* @__PURE__ */ new WeakMap();
306
- _historyViewSearchRef = /* @__PURE__ */ new WeakMap();
307
- _canvasRef = /* @__PURE__ */ new WeakMap();
308
- _launcherRef = /* @__PURE__ */ new WeakMap();
309
- _canvasTrackRef = /* @__PURE__ */ new WeakMap();
310
- _resizeHandleRef = /* @__PURE__ */ new WeakMap();
311
- _resizeController = /* @__PURE__ */ new WeakMap();
312
- _internals = /* @__PURE__ */ new WeakMap();
313
- _pendingThreadDeleteSource = /* @__PURE__ */ new WeakMap();
314
- _deleteThreadController = /* @__PURE__ */ new WeakMap();
315
- _canvas = /* @__PURE__ */ new WeakMap();
316
- _AiChatbotLauncherComponent_instances = /* @__PURE__ */ new WeakSet();
317
- setViewState_fn = function(next) {
318
- if (this._viewState === next) {
319
- return;
320
- }
321
- if (next !== "conversation") {
322
- __privateGet(this, _canvas).forceClose();
323
- }
324
- const previous = this._viewState;
325
- toggleState(__privateGet(this, _internals), previous, false);
326
- toggleState(__privateGet(this, _internals), next, true);
327
- this._viewState = next;
328
- if (next === "history") {
329
- this._dispatchHostEvent({ type: "forge-ai-chatbot-launcher-history-open" });
330
- void __privateMethod(this, _AiChatbotLauncherComponent_instances, focusAfterUpdate_fn).call(this, () => __privateGet(this, _historyViewSearchRef).value);
331
- } else if (previous === "history") {
332
- this._dispatchHostEvent({ type: "forge-ai-chatbot-launcher-history-close" });
333
- void __privateMethod(this, _AiChatbotLauncherComponent_instances, focusAfterUpdate_fn).call(this, () => this);
334
- }
335
- };
336
- focusAfterUpdate_fn = async function(resolve) {
337
- const viewState = this._viewState;
338
- const popoverOpen = this._historyPopoverOpen;
339
- await this.updateComplete;
340
- const target = resolve();
341
- if (target instanceof LitElement) {
342
- await target.updateComplete;
343
- }
344
- if (!this.isConnected || this._viewState !== viewState || this._historyPopoverOpen !== popoverOpen) {
345
- return;
346
- }
347
- target?.focus();
348
- };
349
- transitionToConversation_fn = function() {
350
- if (this._viewState === "conversation") {
351
- return;
352
- }
353
- const event = this._dispatchHostEvent({
354
- type: "forge-ai-chatbot-launcher-conversation-start",
355
- cancelable: true
356
- });
357
- if (event.defaultPrevented) {
358
- return;
359
- }
360
- __privateMethod(this, _AiChatbotLauncherComponent_instances, commitConversationTransition_fn).call(this);
361
- };
362
- commitConversationTransition_fn = function() {
363
- __privateMethod(this, _AiChatbotLauncherComponent_instances, setViewState_fn).call(this, "conversation");
364
- };
365
- transitionToWelcome_fn = function() {
366
- if (this._viewState === "welcome") {
367
- return;
368
- }
369
- this._skipAnimation = false;
370
- __privateMethod(this, _AiChatbotLauncherComponent_instances, setViewState_fn).call(this, "welcome");
371
- };
372
- transitionToHistory_fn = function() {
373
- __privateMethod(this, _AiChatbotLauncherComponent_instances, setViewState_fn).call(this, "history");
374
- };
375
- handleHistoryBack_fn = function() {
376
- __privateMethod(this, _AiChatbotLauncherComponent_instances, setViewState_fn).call(this, this._hasMessages ? "conversation" : "welcome");
377
- };
378
- handleHeaderClear_fn = function() {
379
- this.clearMessages();
380
- };
381
- handleHeaderInfo_fn = function() {
382
- this._handleInfo();
383
- };
384
- handleThreadRename_fn = function(evt) {
385
- this._editingThreadId = evt.detail.id;
386
- };
387
- handleEditSave_fn = function(evt) {
388
- const { id, oldTitle, newTitle } = evt.detail;
389
- const onSuccess = () => {
390
- this._editingThreadId = null;
391
- };
392
- const onError = () => {
393
- this._editingThreadId = null;
394
- };
395
- const event = this._dispatchHostEvent({
396
- type: "forge-ai-chatbot-launcher-thread-rename",
397
- detail: {
398
- id,
399
- oldTitle,
400
- newTitle,
401
- onSuccess,
402
- onError
403
- },
404
- cancelable: true
405
- });
406
- if (!event.defaultPrevented) {
407
- this._editingThreadId = null;
408
- }
409
- };
410
- handleEditCancel_fn = function() {
411
- this._editingThreadId = null;
412
- };
413
- handleThreadNameClick_fn = function() {
414
- const threadId = this.agentInfo?.threadId || "";
415
- this._editingThreadId = threadId;
416
- };
417
- handleThreadDelete_fn = function() {
418
- const thread = {
419
- id: this.agentInfo?.threadId || "",
420
- title: this.threadName || "",
421
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
422
- };
423
- __privateGet(this, _deleteThreadController).show(thread);
424
- };
425
- handleHistoryButtonClick_fn = function() {
426
- if (!this._historyPopoverOpen) {
427
- __privateGet(this, _historyPopoverSearchRef).value?.resetSearch();
428
- }
429
- this._historyPopoverOpen = !this._historyPopoverOpen;
430
- };
431
- handleHistoryPopoverToggle_fn = function(evt) {
432
- if (evt.target !== evt.currentTarget) {
433
- return;
434
- }
435
- this._historyPopoverOpen = evt.detail.open;
436
- if (evt.detail.open) {
437
- void __privateMethod(this, _AiChatbotLauncherComponent_instances, focusAfterUpdate_fn).call(this, () => __privateGet(this, _historyPopoverSearchRef).value);
438
- return;
439
- }
440
- const activeElement = this.shadowRoot?.activeElement ?? null;
441
- const focusInsidePopover = evt.currentTarget.contains(activeElement);
442
- const focusLost = this.ownerDocument.activeElement === this.ownerDocument.body;
443
- if ((focusInsidePopover || focusLost) && this._viewState !== "history") {
444
- __privateGet(this, _historyButtonRef).value?.focus();
445
- }
446
- };
447
- handleHistoryPopoverKeydown_fn = function(evt) {
448
- if (evt.key !== "Escape" || evt.defaultPrevented) {
449
- return;
450
- }
451
- evt.preventDefault();
452
- evt.stopPropagation();
453
- this._historyPopoverOpen = false;
454
- void __privateMethod(this, _AiChatbotLauncherComponent_instances, focusAfterUpdate_fn).call(this, () => __privateGet(this, _historyButtonRef).value);
455
- };
456
- handleViewAllClick_fn = function() {
457
- this._historyPopoverOpen = false;
458
- __privateMethod(this, _AiChatbotLauncherComponent_instances, transitionToHistory_fn).call(this);
459
- };
460
- handleThreadsSearchQuery_fn = function(evt) {
461
- forwardCancelableEvent(this, evt, "forge-ai-chatbot-launcher-thread-search");
462
- };
463
- handleThreadsSearchLoadMore_fn = function(evt) {
464
- this._dispatchHostEvent({ type: "forge-ai-chatbot-launcher-thread-load-more", detail: evt.detail });
465
- };
466
- handleThreadsSearchSelect_fn = function(evt) {
467
- this._historyPopoverOpen = false;
468
- const event = this._dispatchHostEvent({
469
- type: "forge-ai-chatbot-launcher-thread-select",
470
- detail: evt.detail,
471
- cancelable: true
472
- });
473
- if (event.defaultPrevented) {
474
- return;
475
- }
476
- this.selectedThreadId = evt.detail.id;
477
- __privateMethod(this, _AiChatbotLauncherComponent_instances, setViewState_fn).call(this, "conversation");
478
- };
479
- handleThreadsSearchRetry_fn = function() {
480
- this._dispatchHostEvent({ type: "forge-ai-chatbot-launcher-thread-retry" });
481
- };
482
- handleThreadsSearchNewChat_fn = function() {
483
- this._historyPopoverOpen = false;
484
- const event = this._dispatchHostEvent({ type: "forge-ai-chatbot-launcher-new-chat", cancelable: true });
485
- if (!event.defaultPrevented) {
486
- this.startNewChat();
487
- }
488
- };
489
- handleThreadsSearchRename_fn = function(evt) {
490
- forwardCancelableEvent(this, evt, "forge-ai-chatbot-launcher-thread-rename");
491
- };
492
- handleThreadsSearchDelete_fn = function(evt) {
493
- forwardCancelableEvent(this, evt, "forge-ai-chatbot-launcher-thread-delete");
494
- };
495
- handleThreadsSearchDeleteConfirm_fn = function(evt) {
496
- evt.preventDefault();
497
- __privateSet(this, _pendingThreadDeleteSource, evt.target);
498
- __privateGet(this, _deleteThreadController).show(evt.detail.thread);
499
- };
500
- hasFocusInCanvas_fn = function() {
501
- const active = this.shadowRoot?.activeElement;
502
- if (active) {
503
- return !!__privateGet(this, _canvasRef).value?.contains(active);
504
- }
505
- const root = this.getRootNode();
506
- const slotted = root.activeElement?.closest('[slot="canvas"], [slot="canvas-actions"]');
507
- return slotted?.parentElement === this;
508
- };
509
- availableChatWidth_get = function() {
510
- const width = __privateGet(this, _launcherRef).value?.clientWidth ?? 0;
511
- return width > 0 ? width - MIN_CANVAS_WIDTH : void 0;
512
- };
513
- handleResizeCommit_fn = function(width) {
514
- this._dispatchHostEvent({ type: "forge-ai-chatbot-launcher-canvas-resize", detail: { chatWidth: width } });
515
- for (const kind of CHAT_WIDTH_STORAGE_KINDS) {
516
- writeStoredNumber({ kind, key: CHAT_WIDTH_STORAGE_KEY, value: width });
517
- }
518
- };
519
- readPersistedChatWidth_fn = function() {
520
- for (const kind of CHAT_WIDTH_STORAGE_KINDS) {
521
- const width = readStoredNumber({ kind, key: CHAT_WIDTH_STORAGE_KEY });
522
- if (width !== void 0) {
523
- return width;
524
- }
525
- }
526
- return void 0;
527
- };
528
- shouldRestoreChatWidth_get = function() {
529
- return this.canvasResizable === "on" && this.chatWidth === DEFAULT_CHAT_WIDTH && !this.hasAttribute("chat-width");
530
- };
531
- handleCanvasClose_fn = function() {
532
- this.closeCanvas();
533
- };
534
- handleCanvasKeydown_fn = function(evt) {
535
- if (evt.key !== "Escape" || evt.defaultPrevented) {
536
- return;
537
- }
538
- evt.preventDefault();
539
- this.closeCanvas();
540
- };
541
- headingElement_get = function() {
542
- switch (this.headingLevel) {
543
- case 1:
544
- return html`<h1 class="title"><slot name="heading">${this.titleText}</slot></h1>`;
545
- case 2:
546
- return html`<h2 class="title"><slot name="heading">${this.titleText}</slot></h2>`;
547
- case 3:
548
- return html`<h3 class="title"><slot name="heading">${this.titleText}</slot></h3>`;
549
- case 4:
550
- return html`<h4 class="title"><slot name="heading">${this.titleText}</slot></h4>`;
551
- case 5:
552
- return html`<h5 class="title"><slot name="heading">${this.titleText}</slot></h5>`;
553
- case 6:
554
- return html`<h6 class="title"><slot name="heading">${this.titleText}</slot></h6>`;
555
- default:
556
- return html`<h2 class="title"><slot name="heading">${this.titleText}</slot></h2>`;
557
- }
558
- };
559
- promptTemplate_get = function() {
560
- const isUploading = this._isUploading;
561
- return html`
562
- <forge-ai-prompt
563
- ${ref(this._promptRef)}
564
- .placeholder=${this.placeholder}
565
- .running=${this._isStreaming || isUploading}
566
- .slashCommands=${this._slashCommands}
567
- .contextItems=${this._allContextItems}
568
- ?disabled=${isUploading}
569
- ?debug-mode=${this.debugMode}
570
- @forge-ai-prompt-send=${this._handleSend}
571
- @forge-ai-prompt-stop=${this._handleStop}
572
- @forge-ai-prompt-cancel=${this._handleCancel}
573
- @forge-ai-prompt-debug-toggle=${this._handleDebugToggle}
574
- @forge-ai-prompt-command=${this._handleSlashCommand}
575
- @forge-ai-prompt-context-remove=${this._handlePromptContextRemove}>
576
- ${when(
577
- this.fileUpload === "on",
578
- () => html`
579
- <forge-ai-file-picker
580
- slot="actions-start"
581
- variant="icon-button"
582
- multiple
583
- ?disabled=${isUploading}
584
- .maxSize=${this.maxFileSize}
585
- .accept=${this.acceptedFileTypes}
586
- .selectedFiles=${this._coreController?.pendingAttachments.map((a) => a.filename) ?? []}
587
- @forge-ai-file-picker-change=${this._handleFileSelect}
588
- @forge-ai-file-picker-error=${this._handleFileError}>
589
- </forge-ai-file-picker>
590
- `
591
- )}
592
- ${__privateGet(this, _AiChatbotLauncherComponent_instances, historyButtonTemplate_get)}
593
- ${when(
594
- this.voiceInput === "on",
595
- () => html`
596
- <forge-ai-voice-input slot="actions-end" @forge-ai-voice-input-result=${this._handleVoiceInputResult}>
597
- </forge-ai-voice-input>
598
- `
599
- )}
600
- </forge-ai-prompt>
601
- `;
602
- };
603
- welcomeHeaderTemplate_get = function() {
604
- return html`
605
- <div class="welcome">
606
- <div class="welcome-header">
607
- <slot name="icon">
608
- <forge-ai-icon class="icon"></forge-ai-icon>
609
- </slot>
610
- ${__privateGet(this, _AiChatbotLauncherComponent_instances, headingElement_get)}
611
- </div>
612
- <div class="description"><slot name="description">${this.descriptionText}</slot></div>
613
- </div>
614
- `;
615
- };
616
- welcomeSuggestionsTemplate_get = function() {
617
- if (!this.suggestions?.length) {
618
- return nothing;
619
- }
620
- return html`
621
- <div class="welcome-suggestions">
622
- <forge-ai-suggestions
623
- variant="block"
624
- .suggestions=${this.suggestions ?? []}
625
- @forge-ai-suggestions-select=${this._handleSuggestionSelect}>
626
- </forge-ai-suggestions>
627
- </div>
628
- `;
629
- };
630
- threadName_get = function() {
631
- const showActions = this.showThreadRename || this.showThreadDelete;
632
- const threadId = this.agentInfo?.threadId || "";
633
- const isEditing = this._editingThreadId === threadId;
634
- return html`
635
- <div class="thread-name" slot="thread-name">
636
- <div class="thread-name__separator">
637
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="forge-icon" aria-hidden="true">
638
- <path d="m7 21 7.9-18H17L9.1 21z" />
639
- </svg>
640
- </div>
641
- ${when(
642
- isEditing,
643
- () => html`
644
- <forge-ai-edit-thread
645
- .thread=${{
646
- id: threadId,
647
- title: this.threadName || "",
648
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
649
- }}
650
- .value=${this.threadName || ""}
651
- @forge-ai-edit-thread-save=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleEditSave_fn)}
652
- @forge-ai-edit-thread-cancel=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleEditCancel_fn)}>
653
- </forge-ai-edit-thread>
654
- `,
655
- () => html`
656
- ${when(
657
- this.showThreadRename,
658
- () => html`
659
- <button
660
- class="forge-button forge-button--dense thread-name__button"
661
- id="thread-name-button"
662
- aria-label="Edit thread name: ${this.threadName}"
663
- @click=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadNameClick_fn)}>
664
- <span class="thread-name__text">${this.threadName}</span>
665
- </button>
666
- <forge-ai-tooltip for="thread-name-button" placement="bottom">${this.threadName}</forge-ai-tooltip>
667
- `,
668
- () => html`
669
- <span class="thread-name__text" id="thread-name-text">${this.threadName}</span>
670
- <forge-ai-tooltip for="thread-name-text" placement="bottom">${this.threadName}</forge-ai-tooltip>
671
- `
672
- )}
673
- ${when(showActions, () => __privateGet(this, _AiChatbotLauncherComponent_instances, threadActionsMenu_get))}
674
- `
675
- )}
676
- </div>
677
- `;
678
- };
679
- threadActionsMenu_get = function() {
680
- const thread = {
681
- id: this.agentInfo?.threadId || "",
682
- title: this.threadName || "",
683
- createdAt: (/* @__PURE__ */ new Date()).toISOString()
684
- };
685
- return html`
686
- <forge-ai-thread-actions-menu
687
- .thread=${thread}
688
- ?show-rename=${this.showThreadRename}
689
- ?show-delete=${this.showThreadDelete}
690
- @forge-ai-thread-actions-menu-rename=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadRename_fn)}
691
- @forge-ai-thread-actions-menu-delete-click=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadDelete_fn)}>
692
- <svg
693
- slot="trigger-icon"
694
- xmlns="http://www.w3.org/2000/svg"
695
- viewBox="0 0 24 24"
696
- class="forge-icon"
697
- aria-hidden="true">
698
- <path fill="none" d="M0 0h24v24H0z" />
699
- <path d="m7 10 5 5 5-5z" />
700
- </svg>
701
- </forge-ai-thread-actions-menu>
702
- `;
703
- };
704
- conversationContentTemplate_get = function() {
705
- return html`
706
- <div class="conversation">
707
- <forge-ai-chat-header
708
- ${ref(__privateGet(this, _headerRef))}
709
- ?disable-agent-selector=${this._isStreaming}
710
- export-option=${this.exportOption === "off" ? "off" : this._hasMessages ? "enabled" : "off"}
711
- clear-option=${this.clearOption === "off" ? "off" : this._hasMessages ? "enabled" : "off"}
712
- .agentInfo=${this.agentInfo}
713
- .headingLevel=${this.headingLevel}
714
- .titleText=${this.titleText}
715
- .agents=${this.agents}
716
- .selectedAgentId=${this.selectedAgentId}
717
- @forge-ai-chat-header-clear=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleHeaderClear_fn)}
718
- @forge-ai-chat-header-export=${this._handleExport}
719
- @forge-ai-chat-header-info=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleHeaderInfo_fn)}
720
- @forge-ai-chat-header-agent-change=${this._handleAgentChange}>
721
- <slot name="icon" slot="icon">
722
- <forge-ai-icon></forge-ai-icon>
723
- </slot>
724
- <slot name="header-actions" slot="header-actions"></slot>
725
- ${when(this.threadName, () => __privateGet(this, _AiChatbotLauncherComponent_instances, threadName_get))}
726
- </forge-ai-chat-header>
727
- <forge-ai-message-thread
728
- ${ref(this._messageThreadRef)}
729
- .messageItems=${this._messageItems}
730
- .tools=${this._tools}
731
- ?enable-reactions=${this.enableReactions}
732
- ?show-thinking=${this._isStreaming}
733
- ?debug-mode=${this.debugMode}
734
- @forge-ai-message-thread-copy=${this._handleCopy}
735
- @forge-ai-message-thread-resend=${this._handleResend}
736
- @forge-ai-message-thread-thumbs-up=${this._handleThumbsUp}
737
- @forge-ai-message-thread-thumbs-down=${this._handleThumbsDown}
738
- @forge-ai-message-thread-user-copy=${this._handleUserCopy}
739
- @forge-ai-message-thread-user-resend=${this._handleUserResend}
740
- @forge-ai-message-thread-user-edit=${this._handleUserEdit}>
741
- </forge-ai-message-thread>
742
- </div>
743
- `;
744
- };
745
- historyContentTemplate_get = function() {
746
- return html`
747
- <div class="history">
748
- <forge-ai-threads-search
749
- ${ref(__privateGet(this, _historyViewSearchRef))}
750
- header-title="Chat history"
751
- ?show-back-button=${true}
752
- .threads=${this.threads}
753
- .totalChats=${this.totalThreads}
754
- .selectedThreadId=${this.selectedThreadId}
755
- .errorMessage=${this.threadsError}
756
- ?show-thread-rename=${this.showThreadRename}
757
- ?show-thread-delete=${this.showThreadDelete}
758
- @forge-ai-threads-search-back=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleHistoryBack_fn)}
759
- @forge-ai-threads-search-query=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchQuery_fn)}
760
- @forge-ai-threads-search-load-more=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchLoadMore_fn)}
761
- @forge-ai-threads-search-select=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchSelect_fn)}
762
- @forge-ai-threads-search-new-chat=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchNewChat_fn)}
763
- @forge-ai-threads-search-rename=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchRename_fn)}
764
- @forge-ai-threads-search-delete=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchDelete_fn)}
765
- @forge-ai-threads-search-retry=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchRetry_fn)}
766
- @forge-ai-threads-search-delete-confirm=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchDeleteConfirm_fn)}>
767
- </forge-ai-threads-search>
768
- </div>
769
- `;
770
- };
771
- mainContentTemplate_get = function() {
772
- switch (this._viewState) {
773
- case "welcome":
774
- return __privateGet(this, _AiChatbotLauncherComponent_instances, welcomeHeaderTemplate_get);
775
- case "history":
776
- return __privateGet(this, _AiChatbotLauncherComponent_instances, historyContentTemplate_get);
777
- default:
778
- return __privateGet(this, _AiChatbotLauncherComponent_instances, conversationContentTemplate_get);
779
- }
780
- };
781
- showThreadsLoading_get = function() {
782
- return this.threadsLoading && !this.threadsError;
783
- };
784
- historyButtonTemplate_get = function() {
785
- if (!this.showHistoryButton) {
786
- return nothing;
787
- }
788
- return html`
789
- <button
790
- ${ref(__privateGet(this, _historyButtonRef))}
791
- id="history-button"
792
- slot="actions-start"
793
- type="button"
794
- class="forge-icon-button forge-icon-button--medium ai-icon-button history-button"
795
- aria-label=${this.threadsError ? "Chat history - failed to load" : "Chat history"}
796
- aria-expanded=${this._historyPopoverOpen}
797
- ?disabled=${__privateGet(this, _AiChatbotLauncherComponent_instances, showThreadsLoading_get)}
798
- @click=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleHistoryButtonClick_fn)}>
799
- ${when(
800
- __privateGet(this, _AiChatbotLauncherComponent_instances, showThreadsLoading_get),
801
- () => html`<forge-ai-spinner size="extra-small"></forge-ai-spinner>`,
802
- () => html`
803
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" aria-hidden="true">
804
- <path
805
- d="M13.5 8H12v5l4.28 2.54.72-1.21-3.5-2.08zM13 3a9 9 0 0 0-9 9H1l3.96 4.03L9 12H6a7 7 0 0 1 7-7 7 7 0 0 1 7 7 7 7 0 0 1-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.9 8.9 0 0 0 13 21a9 9 0 0 0 9-9 9 9 0 0 0-9-9" />
806
- </svg>
807
- `
808
- )}
809
- ${when(
810
- this.threadsError,
811
- () => html`<span class="forge-badge forge-badge--dot history-button__error-badge"></span>`
812
- )}
813
- </button>
814
- ${when(
815
- !__privateGet(this, _AiChatbotLauncherComponent_instances, showThreadsLoading_get),
816
- () => html`<forge-ai-tooltip slot="actions-start" for="history-button" placement="top"
817
- >Chat history</forge-ai-tooltip
818
- >`
819
- )}
820
- `;
821
- };
822
- historyPopoverTemplate_get = function() {
823
- const chatCount = this.totalThreads > 0 ? this.totalThreads : this.threads.length;
824
- const anchorWidth = __privateGet(this, _gradientContainerRef).value?.getBoundingClientRect().width;
825
- const popoverWidth = anchorWidth ? anchorWidth - HISTORY_POPOVER_INSET * 2 : void 0;
826
- return html`
827
- <forge-ai-popover
828
- .anchor=${__privateGet(this, _gradientContainerRef).value ?? null}
829
- placement="bottom"
830
- .offset=${8}
831
- .flip=${true}
832
- .autoSize=${true}
833
- ?open=${this._historyPopoverOpen}
834
- @keydown=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleHistoryPopoverKeydown_fn)}
835
- @forge-ai-popover-toggle=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleHistoryPopoverToggle_fn)}>
836
- <div class="history-popover" style=${popoverWidth ? `width: ${popoverWidth}px` : ""}>
837
- <forge-ai-threads-search
838
- ${ref(__privateGet(this, _historyPopoverSearchRef))}
839
- header-title="Chat history"
840
- .showNewChatButton=${false}
841
- .showSearch=${chatCount > 5}
842
- .threads=${this.threads}
843
- .totalChats=${this.totalThreads}
844
- .selectedThreadId=${this.selectedThreadId}
845
- .errorMessage=${this.threadsError}
846
- ?show-thread-rename=${this.showThreadRename}
847
- ?show-thread-delete=${this.showThreadDelete}
848
- @forge-ai-threads-search-query=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchQuery_fn)}
849
- @forge-ai-threads-search-load-more=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchLoadMore_fn)}
850
- @forge-ai-threads-search-select=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchSelect_fn)}
851
- @forge-ai-threads-search-rename=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchRename_fn)}
852
- @forge-ai-threads-search-delete=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchDelete_fn)}
853
- @forge-ai-threads-search-retry=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchRetry_fn)}
854
- @forge-ai-threads-search-delete-confirm=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleThreadsSearchDeleteConfirm_fn)}>
855
- <button
856
- slot="header-actions"
857
- type="button"
858
- class="forge-button forge-button--dense history-popover__view-all"
859
- @click=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleViewAllClick_fn)}>
860
- <span>View all</span>
861
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" class="forge-icon" aria-hidden="true">
862
- <path fill="none" d="M0 0h24v24H0z" />
863
- <path d="M9 5v2h6.59L4 18.59 5.41 20 17 8.41V15h2V5z" />
864
- </svg>
865
- </button>
866
- </forge-ai-threads-search>
867
- </div>
868
- </forge-ai-popover>
869
- `;
870
- };
871
- promptSectionTemplate_get = function() {
872
- return html`
873
- <div class="prompt-section">
874
- <forge-ai-gradient-container class="prompt-container" variant="medium" ${ref(__privateGet(this, _gradientContainerRef))}>
875
- ${__privateGet(this, _AiChatbotLauncherComponent_instances, promptTemplate_get)}
876
- </forge-ai-gradient-container>
877
- ${when(this.disclaimerText, () => html`<div class="disclaimer">${this.disclaimerText}</div>`)}
878
- </div>
879
- `;
880
- };
881
- resizeHandle_get = function() {
882
- if (this.canvasResizable !== "on") {
883
- return nothing;
884
- }
885
- const max = Math.max(this.chatWidth, __privateGet(this, _AiChatbotLauncherComponent_instances, availableChatWidth_get) ?? this.chatWidth);
886
- return html`
887
- <div
888
- ${ref(__privateGet(this, _resizeHandleRef))}
889
- class=${classMap({ "resize-handle": true, "resize-handle--active": this._isResizing })}
890
- role="separator"
891
- aria-orientation="vertical"
892
- aria-label="Resize canvas, use left and right arrow keys"
893
- aria-valuemin=${MIN_CHAT_WIDTH}
894
- aria-valuemax=${max}
895
- aria-valuenow=${this.chatWidth}
896
- aria-valuetext="Conversation ${this.chatWidth} pixels wide"
897
- tabindex="0"
898
- @pointerdown=${(evt) => __privateGet(this, _resizeController).handlePointerDown(evt)}
899
- @keydown=${(evt) => __privateGet(this, _resizeController).handleKeyDown(evt)}>
900
- <span class="resize-handle__grip" aria-hidden="true">
901
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
902
- <path
903
- d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2" />
904
- </svg>
905
- </span>
906
- </div>
907
- `;
908
- };
909
- canvasTemplate_get = function() {
910
- const title = __privateGet(this, _canvas).content?.title ?? this.canvasTitle ?? "";
911
- return html`
912
- <forge-ai-canvas
913
- ${ref(__privateGet(this, _canvasRef))}
914
- class="canvas"
915
- .titleText=${title}
916
- .headingLevel=${this.headingLevel}
917
- ?inert=${!__privateGet(this, _canvas).isOpen}
918
- @forge-ai-canvas-close=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleCanvasClose_fn)}
919
- @keydown=${__privateMethod(this, _AiChatbotLauncherComponent_instances, handleCanvasKeydown_fn)}>
920
- <slot name="canvas-actions" slot="actions"></slot>
921
- ${__privateGet(this, _canvas).content?.node ?? html`<slot name="canvas"></slot>`}
922
- </forge-ai-canvas>
923
- `;
924
- };
925
- AiChatbotLauncherComponent.styles = unsafeCSS(styles);
926
- __decorateClass([
927
- property({ attribute: "description-text" })
928
- ], AiChatbotLauncherComponent.prototype, "descriptionText", 2);
929
- __decorateClass([
930
- property({ attribute: "thread-name" })
931
- ], AiChatbotLauncherComponent.prototype, "threadName", 2);
932
- __decorateClass([
933
- property({ type: Boolean, attribute: "show-history-button" })
934
- ], AiChatbotLauncherComponent.prototype, "showHistoryButton", 2);
935
- __decorateClass([
936
- property({ type: Boolean, attribute: "show-thread-rename" })
937
- ], AiChatbotLauncherComponent.prototype, "showThreadRename", 2);
938
- __decorateClass([
939
- property({ type: Boolean, attribute: "show-thread-delete" })
940
- ], AiChatbotLauncherComponent.prototype, "showThreadDelete", 2);
941
- __decorateClass([
942
- property({ type: Array, attribute: false })
943
- ], AiChatbotLauncherComponent.prototype, "threads", 2);
944
- __decorateClass([
945
- property({ type: Number, attribute: "total-threads" })
946
- ], AiChatbotLauncherComponent.prototype, "totalThreads", 2);
947
- __decorateClass([
948
- property({ type: Boolean, attribute: "threads-loading" })
949
- ], AiChatbotLauncherComponent.prototype, "threadsLoading", 2);
950
- __decorateClass([
951
- property({ type: String, attribute: "threads-error" })
952
- ], AiChatbotLauncherComponent.prototype, "threadsError", 2);
953
- __decorateClass([
954
- property({ type: String, attribute: "selected-thread-id" })
955
- ], AiChatbotLauncherComponent.prototype, "selectedThreadId", 2);
956
- __decorateClass([
957
- property({ attribute: "canvas-title" })
958
- ], AiChatbotLauncherComponent.prototype, "canvasTitle", 2);
959
- __decorateClass([
960
- property({ attribute: "canvas-resizable" })
961
- ], AiChatbotLauncherComponent.prototype, "canvasResizable", 2);
962
- __decorateClass([
963
- property({ type: Number, attribute: "chat-width" })
964
- ], AiChatbotLauncherComponent.prototype, "chatWidth", 2);
965
- __decorateClass([
966
- state()
967
- ], AiChatbotLauncherComponent.prototype, "_viewState", 2);
968
- __decorateClass([
969
- state()
970
- ], AiChatbotLauncherComponent.prototype, "_isResizing", 2);
971
- __decorateClass([
972
- state()
973
- ], AiChatbotLauncherComponent.prototype, "_skipAnimation", 2);
974
- __decorateClass([
975
- state()
976
- ], AiChatbotLauncherComponent.prototype, "_editingThreadId", 2);
977
- __decorateClass([
978
- state()
979
- ], AiChatbotLauncherComponent.prototype, "_historyPopoverOpen", 2);
980
- AiChatbotLauncherComponent = __decorateClass([
981
- customElement(AiChatbotLauncherComponentTagName)
982
- ], AiChatbotLauncherComponent);
983
- export {
984
- AiChatbotLauncherComponent,
985
- AiChatbotLauncherComponentTagName
986
- };