@krak-stack/registry 0.10.19 → 0.11.1

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 (472) hide show
  1. package/CHANGELOG.md +105 -0
  2. package/README.md +28 -7
  3. package/dist/components/agent/index.d.ts +454 -0
  4. package/dist/components/agent/react.d.ts +55 -0
  5. package/dist/components/agent/react.js +2594 -0
  6. package/dist/components/agent/schema.d.ts +55 -0
  7. package/dist/components/animated-list/classes.d.ts +9 -0
  8. package/dist/components/animated-list/html.d.ts +11 -0
  9. package/dist/components/animated-list/html.js +533 -0
  10. package/dist/components/animated-list/index.d.ts +205 -0
  11. package/dist/components/animated-list/react.d.ts +11 -0
  12. package/dist/components/animated-list/react.js +711 -0
  13. package/dist/components/animated-list/schema.d.ts +44 -0
  14. package/dist/components/animated-number/html.d.ts +19 -0
  15. package/dist/components/animated-number/html.js +101 -0
  16. package/dist/components/animated-number/index.d.ts +80 -0
  17. package/dist/components/{ui/animated-number.d.ts → animated-number/react.d.ts} +2 -7
  18. package/dist/components/animated-number/react.js +278 -0
  19. package/dist/components/animated-number/schema.d.ts +9 -0
  20. package/dist/components/app-brand/classes.d.ts +11 -0
  21. package/dist/components/app-brand/html.d.ts +26 -0
  22. package/dist/components/app-brand/html.js +78 -0
  23. package/dist/components/app-brand/react.d.ts +12 -0
  24. package/dist/components/app-brand/react.js +86 -0
  25. package/dist/components/app-brand/schema.d.ts +36 -0
  26. package/dist/components/app-switcher/classes.d.ts +15 -0
  27. package/dist/components/app-switcher/html.d.ts +72 -0
  28. package/dist/components/app-switcher/html.js +327 -0
  29. package/dist/components/app-switcher/index.d.ts +47 -0
  30. package/dist/components/app-switcher/react.d.ts +12 -0
  31. package/dist/components/{ui/app-switcher.js → app-switcher/react.js} +84 -15
  32. package/dist/components/app-switcher/schema.d.ts +39 -0
  33. package/dist/components/async-action-button/classes.d.ts +11 -0
  34. package/dist/components/async-action-button/html.d.ts +46 -0
  35. package/dist/components/async-action-button/html.js +266 -0
  36. package/dist/components/async-action-button/index.d.ts +73 -0
  37. package/dist/components/async-action-button/react.d.ts +10 -0
  38. package/dist/components/async-action-button/react.js +378 -0
  39. package/dist/components/async-action-button/schema.d.ts +28 -0
  40. package/dist/{services/events/client/audit-log-table.d.ts → components/audit-log-table/react.d.ts} +2 -2
  41. package/dist/{services/events/client/audit-log-table.js → components/audit-log-table/react.js} +2195 -918
  42. package/dist/components/auto-height/html.d.ts +8 -0
  43. package/dist/components/auto-height/html.js +81 -0
  44. package/dist/components/auto-height/index.d.ts +2 -0
  45. package/dist/components/{ui/auto-height.d.ts → auto-height/react.d.ts} +2 -4
  46. package/dist/components/auto-height/react.js +75 -0
  47. package/dist/components/auto-height/schema.d.ts +7 -0
  48. package/dist/components/bulk-list-input/classes.d.ts +7 -0
  49. package/dist/components/bulk-list-input/html.d.ts +41 -0
  50. package/dist/components/bulk-list-input/html.js +265 -0
  51. package/dist/components/bulk-list-input/index.d.ts +76 -0
  52. package/dist/components/bulk-list-input/react.d.ts +12 -0
  53. package/dist/components/{ui/bulk-list-input.js → bulk-list-input/react.js} +71 -4
  54. package/dist/components/bulk-list-input/schema.d.ts +33 -0
  55. package/dist/components/choice-cards/classes.d.ts +19 -0
  56. package/dist/components/choice-cards/html.d.ts +76 -0
  57. package/dist/components/choice-cards/html.js +237 -0
  58. package/dist/components/choice-cards/index.d.ts +1 -0
  59. package/dist/components/choice-cards/react.d.ts +21 -0
  60. package/dist/components/{ui/choice-cards.js → choice-cards/react.js} +29 -10
  61. package/dist/components/choice-cards/schema.d.ts +100 -0
  62. package/dist/components/code-block/classes.d.ts +13 -0
  63. package/dist/components/code-block/html.d.ts +21 -0
  64. package/dist/components/code-block/html.js +381 -0
  65. package/dist/components/code-block/index.d.ts +4 -0
  66. package/dist/components/code-block/react.d.ts +4 -0
  67. package/dist/components/code-block/react.js +493 -0
  68. package/dist/components/code-block/schema.d.ts +29 -0
  69. package/dist/components/color-input/classes.d.ts +9 -0
  70. package/dist/components/color-input/html.d.ts +48 -0
  71. package/dist/components/color-input/html.js +187 -0
  72. package/dist/components/color-input/index.d.ts +88 -0
  73. package/dist/components/color-input/react.d.ts +7 -0
  74. package/dist/components/{ui/color-picker.js → color-input/react.js} +165 -233
  75. package/dist/components/color-input/schema.d.ts +40 -0
  76. package/dist/components/copy-button/html.d.ts +48 -0
  77. package/dist/components/copy-button/html.js +266 -0
  78. package/dist/components/copy-button/index.d.ts +73 -0
  79. package/dist/components/copy-button/react.d.ts +12 -0
  80. package/dist/components/copy-button/react.js +388 -0
  81. package/dist/components/copy-button/schema.d.ts +37 -0
  82. package/dist/components/copy-value/html.d.ts +37 -0
  83. package/dist/components/copy-value/html.js +426 -0
  84. package/dist/components/copy-value/index.d.ts +57 -0
  85. package/dist/components/copy-value/react.d.ts +9 -0
  86. package/dist/components/copy-value/react.js +682 -0
  87. package/dist/components/copy-value/schema.d.ts +45 -0
  88. package/dist/components/cron-input/classes.d.ts +25 -0
  89. package/dist/components/cron-input/html.d.ts +36 -0
  90. package/dist/components/cron-input/html.js +204 -0
  91. package/dist/components/cron-input/index.d.ts +59 -0
  92. package/dist/components/cron-input/react.d.ts +7 -0
  93. package/dist/components/{ui/cron-expression-editor.js → cron-input/react.js} +126 -54
  94. package/dist/components/cron-input/schema.d.ts +24 -0
  95. package/dist/components/danger-confirmation/classes.d.ts +7 -0
  96. package/dist/components/danger-confirmation/html.d.ts +39 -0
  97. package/dist/components/danger-confirmation/html.js +227 -0
  98. package/dist/components/danger-confirmation/index.d.ts +113 -0
  99. package/dist/components/{ui/danger-confirmation.d.ts → danger-confirmation/react.d.ts} +3 -12
  100. package/dist/components/danger-confirmation/react.js +550 -0
  101. package/dist/components/danger-confirmation/schema.d.ts +34 -0
  102. package/dist/components/data-table/classes.d.ts +63 -0
  103. package/dist/components/data-table/html.d.ts +1938 -0
  104. package/dist/components/data-table/html.js +2682 -0
  105. package/dist/components/data-table/index.d.ts +2686 -0
  106. package/dist/components/data-table/react.d.ts +578 -0
  107. package/dist/components/{ui/data-table.js → data-table/react.js} +2189 -906
  108. package/dist/components/data-table/schema.d.ts +3012 -0
  109. package/dist/components/date-input/classes.d.ts +17 -0
  110. package/dist/components/date-input/html.d.ts +60 -0
  111. package/dist/components/date-input/html.js +418 -0
  112. package/dist/components/date-input/index.d.ts +91 -0
  113. package/dist/components/date-input/react.d.ts +10 -0
  114. package/dist/components/{ui/date-picker.js → date-input/react.js} +233 -79
  115. package/dist/components/date-input/schema.d.ts +41 -0
  116. package/dist/components/editable-text/classes.d.ts +17 -0
  117. package/dist/components/editable-text/html.d.ts +51 -0
  118. package/dist/components/editable-text/html.js +370 -0
  119. package/dist/components/editable-text/index.d.ts +143 -0
  120. package/dist/components/editable-text/react.d.ts +6 -0
  121. package/dist/components/editable-text/react.js +499 -0
  122. package/dist/components/editable-text/schema.d.ts +31 -0
  123. package/dist/components/editing-locale-switcher/classes.d.ts +7 -0
  124. package/dist/components/editing-locale-switcher/html.d.ts +27 -0
  125. package/dist/components/editing-locale-switcher/html.js +250 -0
  126. package/dist/components/editing-locale-switcher/index.d.ts +52 -0
  127. package/dist/components/editing-locale-switcher/react.d.ts +7 -0
  128. package/dist/components/{ui/editing-locale-switcher.js → editing-locale-switcher/react.js} +70 -17
  129. package/dist/components/editing-locale-switcher/schema.d.ts +16 -0
  130. package/dist/components/{ui/effect-form.d.ts → effect-form/react.d.ts} +2 -2
  131. package/dist/components/{ui/effect-form.js → effect-form/react.js} +309 -83
  132. package/dist/components/effectcn/alert-dialog.d.ts +13 -0
  133. package/dist/components/effectcn/button.d.ts +31 -0
  134. package/dist/components/effectcn/calendar.d.ts +12 -0
  135. package/dist/components/effectcn/checkbox.d.ts +10 -0
  136. package/dist/components/effectcn/combobox.d.ts +25 -0
  137. package/dist/components/effectcn/dialog.d.ts +19 -0
  138. package/dist/components/effectcn/field.d.ts +11 -0
  139. package/dist/components/effectcn/file-drop.d.ts +8 -0
  140. package/dist/components/effectcn/input.d.ts +26 -0
  141. package/dist/components/effectcn/menu.d.ts +85 -0
  142. package/dist/components/effectcn/menubar.d.ts +8 -0
  143. package/dist/components/effectcn/popover.d.ts +18 -0
  144. package/dist/components/effectcn/scroll-area.d.ts +12 -0
  145. package/dist/components/effectcn/select.d.ts +68 -0
  146. package/dist/components/effectcn/toast.d.ts +29 -0
  147. package/dist/components/email-composer/index.d.ts +229 -0
  148. package/dist/components/email-composer/labels.d.ts +12 -0
  149. package/dist/components/email-composer/react.d.ts +5 -0
  150. package/dist/components/email-composer/react.js +1354 -0
  151. package/dist/components/email-composer/schema.d.ts +42 -0
  152. package/dist/components/email-editor/classes.d.ts +21 -0
  153. package/dist/components/email-editor/html.d.ts +360 -0
  154. package/dist/components/email-editor/html.js +1706 -0
  155. package/dist/components/email-editor/index.d.ts +693 -0
  156. package/dist/components/{ui/email-editor.d.ts → email-editor/labels.d.ts} +1 -19
  157. package/dist/components/email-editor/legacy-editor.html.d.ts +160 -0
  158. package/dist/components/email-editor/react.d.ts +11 -0
  159. package/dist/components/{ui/email-editor.js → email-editor/react.js} +1057 -712
  160. package/dist/components/email-editor/schema.d.ts +162 -0
  161. package/dist/components/error-component/classes.d.ts +7 -0
  162. package/dist/components/error-component/html.d.ts +120 -0
  163. package/dist/components/error-component/html.js +346 -0
  164. package/dist/components/error-component/index.d.ts +69 -0
  165. package/dist/components/error-component/react.d.ts +8 -0
  166. package/dist/components/error-component/react.js +744 -0
  167. package/dist/components/error-component/schema.d.ts +56 -0
  168. package/dist/components/file-input/classes.d.ts +7 -0
  169. package/dist/components/file-input/html.d.ts +95 -0
  170. package/dist/components/file-input/html.js +368 -0
  171. package/dist/components/file-input/index.d.ts +99 -0
  172. package/dist/components/file-input/react.d.ts +11 -0
  173. package/dist/components/{ui/file-picker.js → file-input/react.js} +122 -19
  174. package/dist/components/file-input/schema.d.ts +37 -0
  175. package/dist/components/{ui/form.d.ts → form/react.d.ts} +4 -4
  176. package/dist/components/{ui/form.js → form/react.js} +314 -84
  177. package/dist/components/icon-input/html.d.ts +55 -0
  178. package/dist/components/icon-input/html.js +538 -0
  179. package/dist/components/icon-input/index.d.ts +143 -0
  180. package/dist/components/icon-input/react.d.ts +6 -0
  181. package/dist/components/{ui/icon-input.js → icon-input/react.js} +459 -89
  182. package/dist/components/icon-input/schema.d.ts +23 -0
  183. package/dist/components/image-crop-editor/classes.d.ts +19 -0
  184. package/dist/components/image-crop-editor/html.d.ts +66 -0
  185. package/dist/components/image-crop-editor/html.js +561 -0
  186. package/dist/components/image-crop-editor/index.d.ts +183 -0
  187. package/dist/components/image-crop-editor/react.d.ts +8 -0
  188. package/dist/components/image-crop-editor/react.js +802 -0
  189. package/dist/components/image-crop-editor/schema.d.ts +54 -0
  190. package/dist/components/krakstack-provider/html.d.ts +17 -0
  191. package/dist/components/krakstack-provider/html.js +37 -0
  192. package/dist/components/krakstack-provider/index.d.ts +7 -0
  193. package/dist/components/krakstack-provider/react.d.ts +8 -0
  194. package/dist/components/{ui/krakstack-provider.js → krakstack-provider/react.js} +14 -5
  195. package/dist/components/krakstack-provider/schema.d.ts +6 -0
  196. package/dist/components/loading/classes.d.ts +5 -0
  197. package/dist/components/loading/html.d.ts +18 -0
  198. package/dist/components/loading/html.js +166 -0
  199. package/dist/components/loading/index.d.ts +6 -0
  200. package/dist/components/loading/react.d.ts +4 -0
  201. package/dist/components/loading/react.js +51 -0
  202. package/dist/components/loading/schema.d.ts +23 -0
  203. package/dist/components/locale-switcher/html.d.ts +22 -0
  204. package/dist/components/locale-switcher/html.js +264 -0
  205. package/dist/components/locale-switcher/index.d.ts +50 -0
  206. package/dist/components/locale-switcher/react.d.ts +7 -0
  207. package/dist/components/{ui/locale-switcher.js → locale-switcher/react.js} +55 -22
  208. package/dist/components/locale-switcher/schema.d.ts +12 -0
  209. package/dist/components/map-menu/classes.d.ts +13 -0
  210. package/dist/components/map-menu/google-maps.d.ts +80 -0
  211. package/dist/components/map-menu/google-viewport.d.ts +7 -0
  212. package/dist/components/map-menu/html.d.ts +274 -0
  213. package/dist/components/map-menu/html.js +934 -0
  214. package/dist/components/map-menu/index.d.ts +246 -0
  215. package/dist/components/map-menu/map.d.ts +47 -0
  216. package/dist/components/map-menu/react.d.ts +40 -0
  217. package/dist/components/{ui/map-menu.js → map-menu/react.js} +502 -141
  218. package/dist/components/map-menu/schema.d.ts +132 -0
  219. package/dist/components/markdown/classes.d.ts +1 -0
  220. package/dist/components/markdown/html.d.ts +23 -0
  221. package/dist/components/markdown/html.js +510 -0
  222. package/dist/components/markdown/index.d.ts +6 -0
  223. package/dist/components/markdown/react.d.ts +3 -0
  224. package/dist/components/markdown/react.js +546 -0
  225. package/dist/components/markdown/schema.d.ts +20 -0
  226. package/dist/components/notification-menu/classes.d.ts +11 -0
  227. package/dist/components/notification-menu/html.d.ts +67 -0
  228. package/dist/components/notification-menu/html.js +425 -0
  229. package/dist/components/notification-menu/index.d.ts +132 -0
  230. package/dist/components/notification-menu/react.d.ts +57 -0
  231. package/dist/components/notification-menu/react.js +829 -0
  232. package/dist/components/notification-menu/schema.d.ts +59 -0
  233. package/dist/components/pagination/classes.d.ts +19 -0
  234. package/dist/components/pagination/html.d.ts +49 -0
  235. package/dist/components/pagination/html.js +387 -0
  236. package/dist/components/pagination/index.d.ts +109 -0
  237. package/dist/components/pagination/react.d.ts +9 -0
  238. package/dist/components/{ui/pagination.js → pagination/react.js} +130 -30
  239. package/dist/components/pagination/schema.d.ts +36 -0
  240. package/dist/components/phone-number-input/classes.d.ts +17 -0
  241. package/dist/components/phone-number-input/html.d.ts +52 -0
  242. package/dist/components/phone-number-input/html.js +655 -0
  243. package/dist/components/phone-number-input/index.d.ts +59 -0
  244. package/dist/components/phone-number-input/react.d.ts +11 -0
  245. package/dist/components/{ui/phone-number-input.js → phone-number-input/react.js} +368 -138
  246. package/dist/components/phone-number-input/schema.d.ts +31 -0
  247. package/dist/components/presence-transition/html.d.ts +13 -0
  248. package/dist/components/presence-transition/html.js +128 -0
  249. package/dist/components/presence-transition/index.d.ts +57 -0
  250. package/dist/components/{ui/presence-transition.d.ts → presence-transition/react.d.ts} +3 -5
  251. package/dist/components/presence-transition/react.js +293 -0
  252. package/dist/components/presence-transition/schema.d.ts +7 -0
  253. package/dist/components/registry-previews/component-example.d.ts +31 -0
  254. package/dist/components/registry-previews/component-example.js +679 -0
  255. package/dist/components/registry-previews/html-preview.d.ts +17 -0
  256. package/dist/components/registry-previews/html-preview.js +83 -0
  257. package/dist/components/rich-text-editor/classes.d.ts +15 -0
  258. package/dist/components/rich-text-editor/engine.d.ts +9 -0
  259. package/dist/components/rich-text-editor/html.d.ts +246 -0
  260. package/dist/components/rich-text-editor/html.js +830 -0
  261. package/dist/components/rich-text-editor/index.d.ts +453 -0
  262. package/dist/components/rich-text-editor/labels.d.ts +42 -0
  263. package/dist/components/rich-text-editor/react.d.ts +19 -0
  264. package/dist/components/rich-text-editor/react.js +1175 -0
  265. package/dist/components/rich-text-editor/schema.d.ts +116 -0
  266. package/dist/components/search-menu/classes.d.ts +9 -0
  267. package/dist/components/search-menu/html.d.ts +127 -0
  268. package/dist/components/search-menu/html.js +432 -0
  269. package/dist/components/search-menu/index.d.ts +85 -0
  270. package/dist/components/search-menu/react.d.ts +18 -0
  271. package/dist/components/{ui/search-menu.js → search-menu/react.js} +290 -31
  272. package/dist/components/search-menu/schema.d.ts +78 -0
  273. package/dist/components/select-with-custom-input/classes.d.ts +17 -0
  274. package/dist/components/select-with-custom-input/html.d.ts +60 -0
  275. package/dist/components/select-with-custom-input/html.js +238 -0
  276. package/dist/components/select-with-custom-input/index.d.ts +114 -0
  277. package/dist/components/select-with-custom-input/react.d.ts +7 -0
  278. package/dist/components/{ui/select-with-custom-input.js → select-with-custom-input/react.js} +134 -29
  279. package/dist/components/select-with-custom-input/schema.d.ts +54 -0
  280. package/dist/components/sidebar-layout/classes.d.ts +21 -0
  281. package/dist/components/sidebar-layout/html.d.ts +97 -0
  282. package/dist/components/sidebar-layout/html.js +361 -0
  283. package/dist/components/sidebar-layout/index.d.ts +57 -0
  284. package/dist/components/sidebar-layout/react.d.ts +30 -0
  285. package/dist/components/{ui/sidebar-layout.js → sidebar-layout/react.js} +353 -39
  286. package/dist/components/sidebar-layout/schema.d.ts +54 -0
  287. package/dist/components/stats-card/classes.d.ts +11 -0
  288. package/dist/components/stats-card/html.d.ts +15 -0
  289. package/dist/components/stats-card/html.js +55 -0
  290. package/dist/components/stats-card/react.d.ts +7 -0
  291. package/dist/components/{ui/stats-card.js → stats-card/react.js} +19 -15
  292. package/dist/components/stats-card/schema.d.ts +14 -0
  293. package/dist/components/stepper/classes.d.ts +39 -0
  294. package/dist/components/stepper/html.d.ts +107 -0
  295. package/dist/components/stepper/html.js +397 -0
  296. package/dist/components/stepper/index.d.ts +83 -0
  297. package/dist/components/stepper/react.d.ts +17 -0
  298. package/dist/components/{ui/stepper.js → stepper/react.js} +120 -21
  299. package/dist/components/stepper/schema.d.ts +52 -0
  300. package/dist/components/support/classes.d.ts +55 -0
  301. package/dist/components/support/form.d.ts +19 -0
  302. package/dist/components/support/html.d.ts +266 -0
  303. package/dist/components/support/html.js +604 -0
  304. package/dist/components/support/index.d.ts +226 -0
  305. package/dist/components/support/multipart.d.ts +21 -0
  306. package/dist/components/support/react.d.ts +54 -0
  307. package/dist/components/support/react.js +1252 -0
  308. package/dist/components/support/schema.d.ts +69 -0
  309. package/dist/components/support.d.ts +1 -66
  310. package/dist/components/theme-switcher/html.d.ts +28 -0
  311. package/dist/components/theme-switcher/html.js +288 -0
  312. package/dist/components/theme-switcher/index.d.ts +59 -0
  313. package/dist/components/{ui/theme-switcher.d.ts → theme-switcher/react.d.ts} +4 -12
  314. package/dist/components/{ui/theme-switcher.js → theme-switcher/react.js} +69 -35
  315. package/dist/components/theme-switcher/schema.d.ts +33 -0
  316. package/dist/components/time-input/classes.d.ts +23 -0
  317. package/dist/components/time-input/html.d.ts +75 -0
  318. package/dist/components/time-input/html.js +571 -0
  319. package/dist/components/time-input/index.d.ts +164 -0
  320. package/dist/components/time-input/react.d.ts +7 -0
  321. package/dist/components/{ui/time-picker.js → time-input/react.js} +286 -114
  322. package/dist/components/time-input/schema.d.ts +96 -0
  323. package/dist/components/timezone-input/classes.d.ts +13 -0
  324. package/dist/components/timezone-input/html.d.ts +58 -0
  325. package/dist/components/timezone-input/html.js +804 -0
  326. package/dist/components/timezone-input/index.d.ts +170 -0
  327. package/dist/components/timezone-input/react.d.ts +9 -0
  328. package/dist/components/{ui/timezone-select.js → timezone-input/react.js} +493 -106
  329. package/dist/components/timezone-input/schema.d.ts +43 -0
  330. package/dist/components/toast/classes.d.ts +7 -0
  331. package/dist/components/toast/html.d.ts +34 -0
  332. package/dist/components/toast/html.js +280 -0
  333. package/dist/components/toast/index.d.ts +10 -0
  334. package/dist/components/toast/react.d.ts +9 -0
  335. package/dist/components/{ui/toast.js → toast/react.js} +35 -15
  336. package/dist/components/toast/schema.d.ts +24 -0
  337. package/dist/{services/events/client/tracking-notice.d.ts → components/tracking-notice/react.d.ts} +7 -1
  338. package/dist/{services/events/client/tracking-notice.js → components/tracking-notice/react.js} +13 -7
  339. package/dist/components/ui/animated-list.d.ts +1 -21
  340. package/dist/components/ui/app-brand.d.ts +1 -33
  341. package/dist/components/ui/async-action-button.d.ts +1 -17
  342. package/dist/components/ui/code-block.d.ts +1 -14
  343. package/dist/components/ui/copy-button.d.ts +1 -21
  344. package/dist/components/ui/data-table.d.ts +1 -584
  345. package/dist/components/ui/krakstack-provider.d.ts +1 -9
  346. package/dist/components/ui/loading.d.ts +1 -13
  347. package/dist/components/ui/pagination.d.ts +1 -47
  348. package/dist/components/ui/rich-text-editor.d.ts +1 -70
  349. package/dist/components/ui/search-menu.d.ts +1 -36
  350. package/dist/components/ui/select.js +159 -0
  351. package/dist/components/ui/sidebar-layout.d.ts +1 -40
  352. package/dist/components/ui/virtualized-combobox.d.ts +1 -59
  353. package/dist/components/unsaved-changes-guard/html.d.ts +34 -0
  354. package/dist/components/unsaved-changes-guard/html.js +172 -0
  355. package/dist/components/unsaved-changes-guard/index.d.ts +56 -0
  356. package/dist/components/unsaved-changes-guard/react.d.ts +4 -0
  357. package/dist/components/{ui/unsaved-changes-guard.js → unsaved-changes-guard/react.js} +74 -11
  358. package/dist/components/unsaved-changes-guard/schema.d.ts +37 -0
  359. package/dist/components/upload-attachment/classes.d.ts +11 -0
  360. package/dist/components/upload-attachment/html.d.ts +84 -0
  361. package/dist/components/upload-attachment/html.js +312 -0
  362. package/dist/components/upload-attachment/index.d.ts +72 -0
  363. package/dist/components/upload-attachment/react.d.ts +9 -0
  364. package/dist/components/{ui/upload-attachment.js → upload-attachment/react.js} +114 -17
  365. package/dist/components/upload-attachment/schema.d.ts +53 -0
  366. package/dist/components/virtualized-combobox/classes.d.ts +7 -0
  367. package/dist/components/virtualized-combobox/html.d.ts +97 -0
  368. package/dist/components/virtualized-combobox/html.js +310 -0
  369. package/dist/components/virtualized-combobox/index.d.ts +182 -0
  370. package/dist/components/virtualized-combobox/react.d.ts +31 -0
  371. package/dist/components/{ui/virtualized-combobox.js → virtualized-combobox/react.js} +160 -40
  372. package/dist/components/virtualized-combobox/schema.d.ts +92 -0
  373. package/dist/components/webhook-delivery-table/html.d.ts +216 -0
  374. package/dist/components/webhook-delivery-table/html.js +3008 -0
  375. package/dist/components/webhook-delivery-table/index.d.ts +405 -0
  376. package/dist/components/webhook-delivery-table/react.d.ts +13 -0
  377. package/dist/{services/webhooks/client/delivery-table.js → components/webhook-delivery-table/react.js} +2475 -956
  378. package/dist/components/webhook-delivery-table/schema.d.ts +134 -0
  379. package/dist/lib/docs.d.ts +17 -1
  380. package/dist/lib/docs.integrations.server.js +358 -73
  381. package/dist/lib/docs.js +861 -293
  382. package/dist/lib/docs.server.js +342 -57
  383. package/dist/lib/documentation-toolkit.d.ts +4 -4
  384. package/dist/lib/documentation-toolkit.js +354 -69
  385. package/dist/lib/effect-ui-adapter/model-runtime.d.ts +17 -0
  386. package/dist/lib/effect-ui-adapter/use-model.d.ts +9 -0
  387. package/dist/lib/effectcn-form.d.ts +3 -0
  388. package/dist/lib/effectcn-form.js +54 -0
  389. package/dist/lib/email-composer/index.d.ts +12 -0
  390. package/dist/lib/email-composer/index.js +110 -0
  391. package/dist/lib/email-composer/schema.d.ts +14 -0
  392. package/dist/lib/email-composer/schema.js +13 -0
  393. package/dist/lib/email-document/legacy-rich-text/editor.d.ts +70 -0
  394. package/dist/lib/email-document/legacy-rich-text/model.d.ts +19 -0
  395. package/dist/lib/email-document/legacy-rich-text/schema.d.ts +65 -0
  396. package/dist/lib/email-document/legacy-rich-text/tiptap.d.ts +39 -0
  397. package/dist/lib/email-document/model.d.ts +1 -1
  398. package/dist/lib/email-document/model.js +2 -2
  399. package/dist/lib/email-document/render.js +2 -2
  400. package/dist/lib/email-document/schema.js +1 -1
  401. package/dist/lib/httpapi-toolkit.d.ts +1 -1
  402. package/dist/lib/lucide-effect.d.ts +39 -0
  403. package/dist/lib/markdown/content.d.ts +1 -12
  404. package/dist/lib/rich-text/model.d.ts +5 -19
  405. package/dist/lib/rich-text/model.js +79 -111
  406. package/dist/lib/rich-text/schema.d.ts +5 -55
  407. package/dist/lib/rich-text/schema.js +17 -36
  408. package/dist/lib/rich-text/tiptap.d.ts +12 -0
  409. package/dist/lib/webfetch-toolkit.d.ts +1 -1
  410. package/dist/services/agent/client/index.js +695 -179
  411. package/dist/services/agent/client/widget.d.ts +1 -55
  412. package/dist/services/notification/client/index.js +138 -27
  413. package/dist/services/notification/client/notification-menu.d.ts +1 -85
  414. package/dist/services/notification/public.js +138 -27
  415. package/dist/services/opentelemetry/browser.js +15 -9
  416. package/dist/services/webhooks/index.d.ts +4 -3
  417. package/package.json +199 -137
  418. package/dist/components/support-dialog.js +0 -881
  419. package/dist/components/support.js +0 -881
  420. package/dist/components/ui/animated-list.js +0 -414
  421. package/dist/components/ui/animated-number.js +0 -75
  422. package/dist/components/ui/app-brand.js +0 -126
  423. package/dist/components/ui/app-switcher.d.ts +0 -26
  424. package/dist/components/ui/async-action-button.js +0 -149
  425. package/dist/components/ui/auto-height.js +0 -86
  426. package/dist/components/ui/bulk-list-input.d.ts +0 -25
  427. package/dist/components/ui/choice-cards.d.ts +0 -33
  428. package/dist/components/ui/code-block.js +0 -221
  429. package/dist/components/ui/color-picker.d.ts +0 -31
  430. package/dist/components/ui/copy-button.js +0 -138
  431. package/dist/components/ui/copy-value.d.ts +0 -24
  432. package/dist/components/ui/copy-value.js +0 -352
  433. package/dist/components/ui/cron-expression-editor.d.ts +0 -16
  434. package/dist/components/ui/cron-expression-editor.schema.d.ts +0 -7
  435. package/dist/components/ui/danger-confirmation.js +0 -398
  436. package/dist/components/ui/date-picker.d.ts +0 -33
  437. package/dist/components/ui/date-picker.schema.d.ts +0 -9
  438. package/dist/components/ui/editable-text.d.ts +0 -19
  439. package/dist/components/ui/editable-text.js +0 -341
  440. package/dist/components/ui/editing-locale-switcher.d.ts +0 -11
  441. package/dist/components/ui/error-component.d.ts +0 -34
  442. package/dist/components/ui/error-component.js +0 -387
  443. package/dist/components/ui/file-picker.d.ts +0 -37
  444. package/dist/components/ui/icon-input.d.ts +0 -58
  445. package/dist/components/ui/image-crop-editor.d.ts +0 -41
  446. package/dist/components/ui/image-crop-editor.js +0 -417
  447. package/dist/components/ui/loading.js +0 -39
  448. package/dist/components/ui/locale-switcher.d.ts +0 -11
  449. package/dist/components/ui/map-menu-map.d.ts +0 -115
  450. package/dist/components/ui/map-menu.d.ts +0 -87
  451. package/dist/components/ui/phone-number-input.d.ts +0 -22
  452. package/dist/components/ui/phone-number-input.schema.d.ts +0 -7
  453. package/dist/components/ui/presence-transition.js +0 -94
  454. package/dist/components/ui/rich-text-editor.js +0 -1135
  455. package/dist/components/ui/select-with-custom-input.d.ts +0 -36
  456. package/dist/components/ui/stats-card.d.ts +0 -12
  457. package/dist/components/ui/stepper.d.ts +0 -37
  458. package/dist/components/ui/time-picker.d.ts +0 -50
  459. package/dist/components/ui/time-picker.schema.d.ts +0 -28
  460. package/dist/components/ui/timezone-select.d.ts +0 -57
  461. package/dist/components/ui/timezone-select.schema.d.ts +0 -9
  462. package/dist/components/ui/toast.d.ts +0 -18
  463. package/dist/components/ui/unsaved-changes-guard.d.ts +0 -16
  464. package/dist/components/ui/upload-attachment.d.ts +0 -39
  465. package/dist/lib/rich-text/dom.d.ts +0 -40
  466. package/dist/services/notification/persistence/drizzle.d.ts +0 -868
  467. package/dist/services/notification/persistence/drizzle.js +0 -214
  468. package/dist/services/notification/persistence/index.d.ts +0 -2
  469. package/dist/services/notification/persistence/index.js +0 -227
  470. package/dist/services/notification/persistence/schema.d.ts +0 -143
  471. package/dist/services/notification/persistence/schema.js +0 -118
  472. package/dist/services/webhooks/client/delivery-table.d.ts +0 -62
@@ -0,0 +1,2594 @@
1
+ // ../../src/components/agent/react.tsx
2
+ import { useEffect as useEffect2, useId, useRef as useRef3, useState as useState3 } from "react";
3
+ import { Dialog as DialogPrimitive2 } from "@base-ui/react/dialog";
4
+ import {
5
+ ArrowDownIcon as ArrowDownIcon2,
6
+ BotIcon,
7
+ Maximize2Icon,
8
+ MessageCircleDashedIcon,
9
+ Minimize2Icon,
10
+ MinusIcon,
11
+ SendIcon,
12
+ SquareIcon,
13
+ WrenchIcon,
14
+ XIcon as XIcon2
15
+ } from "lucide-react";
16
+
17
+ // ../../src/components/ui/button.tsx
18
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
19
+ import { cva } from "class-variance-authority";
20
+
21
+ // ../../src/lib/utils.ts
22
+ import { cn } from "cn";
23
+
24
+ // ../../src/components/ui/button.tsx
25
+ import { jsx } from "react/jsx-runtime";
26
+ var buttonVariants = cva("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
27
+ variants: {
28
+ variant: {
29
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
30
+ outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
31
+ secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
32
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
33
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
34
+ link: "text-primary underline-offset-4 hover:underline"
35
+ },
36
+ size: {
37
+ default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
38
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
39
+ sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
40
+ lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
41
+ icon: "size-9",
42
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
43
+ "icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
44
+ "icon-lg": "size-10"
45
+ }
46
+ },
47
+ defaultVariants: {
48
+ variant: "default",
49
+ size: "default"
50
+ }
51
+ });
52
+ function Button({
53
+ className,
54
+ variant = "default",
55
+ size = "default",
56
+ ...props
57
+ }) {
58
+ return /* @__PURE__ */ jsx(ButtonPrimitive, {
59
+ "data-slot": "button",
60
+ className: cn(buttonVariants({ variant, size, className })),
61
+ ...props
62
+ });
63
+ }
64
+
65
+ // ../../src/components/copy-button/react.tsx
66
+ import { Check, Copy, TriangleAlert } from "lucide-react";
67
+ import { Redacted as Redacted2 } from "effect";
68
+ import { Component as Component2 } from "effect/ui";
69
+ import { useLayoutEffect as useLayoutEffect2, useRef as useRef2, useState as useState2 } from "react";
70
+ import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
71
+
72
+ // ../../src/lib/effect-ui-adapter/use-model.ts
73
+ import { MessageLog as MessageLog2 } from "effect/ui";
74
+ import {
75
+ createContext,
76
+ useCallback,
77
+ useContext,
78
+ useEffect,
79
+ useLayoutEffect,
80
+ useRef,
81
+ useState,
82
+ useSyncExternalStore
83
+ } from "react";
84
+
85
+ // ../../src/lib/effect-ui-adapter/model-runtime.ts
86
+ import { MessageLog, Renderer, View } from "effect/ui";
87
+ import { BrowserHost, Html } from "effect/ui/html";
88
+ import { Cause, Effect, Fiber } from "effect";
89
+ var node = () => ({ children: [] });
90
+ var modelHost = (commit) => {
91
+ const remove = (child) => {
92
+ if (!child.parent)
93
+ return;
94
+ child.parent.children.splice(child.parent.children.indexOf(child), 1);
95
+ delete child.parent;
96
+ };
97
+ return {
98
+ createElement: node,
99
+ createText: node,
100
+ setText: () => {},
101
+ setAttr: () => {},
102
+ setProp: () => {},
103
+ setEvents: () => {},
104
+ insertBefore: (parent, child, before) => {
105
+ if (child === before)
106
+ return;
107
+ remove(child);
108
+ const index = before ? parent.children.indexOf(before) : parent.children.length;
109
+ parent.children.splice(index, 0, child);
110
+ child.parent = parent;
111
+ },
112
+ remove,
113
+ parentOf: (child) => child.parent,
114
+ nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
115
+ elements: ["html"],
116
+ controlled: new Set,
117
+ runsMounts: false,
118
+ commit
119
+ };
120
+ };
121
+ var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
122
+ let currentProps = props;
123
+ let root;
124
+ let active = true;
125
+ let failure;
126
+ const publish = () => {
127
+ if (!active)
128
+ return;
129
+ if (failure) {
130
+ publishSnapshot({ error: failure });
131
+ return;
132
+ }
133
+ const current = root?.model();
134
+ if (current !== undefined)
135
+ publishSnapshot({ model: current });
136
+ };
137
+ const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
138
+ const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
139
+ head: false,
140
+ onEmit,
141
+ fallback: ({ cause }) => {
142
+ failure = new Error("Effect UI root failed", {
143
+ cause: Cause.squash(cause)
144
+ });
145
+ return View.text("");
146
+ }
147
+ });
148
+ if (!active)
149
+ return;
150
+ root = mounted;
151
+ if (props !== currentProps)
152
+ mounted.setProps(currentProps);
153
+ publish();
154
+ return yield* Effect.never;
155
+ }).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
156
+ return {
157
+ send: (message) => {
158
+ root?.send(message);
159
+ publish();
160
+ },
161
+ setProps: (next) => {
162
+ currentProps = next;
163
+ root?.setProps(next);
164
+ },
165
+ dispose: () => {
166
+ active = false;
167
+ root = undefined;
168
+ Effect.runFork(Fiber.interrupt(fiber));
169
+ }
170
+ };
171
+ };
172
+
173
+ // ../../src/lib/effect-ui-adapter/use-model.ts
174
+ "use client";
175
+ var ModelMessageLogContext = createContext(undefined);
176
+ var useModel = (component, props, options = {}) => {
177
+ const contextLog = useContext(ModelMessageLogContext);
178
+ const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
179
+ const [store] = useState(() => {
180
+ const initial = { model: component.init(props).model };
181
+ let snapshot = initial;
182
+ const listeners = new Set;
183
+ return {
184
+ subscribe: (listener) => {
185
+ listeners.add(listener);
186
+ return () => {
187
+ listeners.delete(listener);
188
+ };
189
+ },
190
+ getSnapshot: () => snapshot,
191
+ getServerSnapshot: () => initial,
192
+ publish: (next) => {
193
+ if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
194
+ return;
195
+ if ("error" in snapshot && "error" in next && snapshot.error === next.error)
196
+ return;
197
+ snapshot = next;
198
+ listeners.forEach((listener) => listener());
199
+ }
200
+ };
201
+ });
202
+ const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
203
+ const committed = useRef(props);
204
+ const onEmit = useRef(options.onEmit);
205
+ const runtime = useRef(undefined);
206
+ const send = useCallback((message) => runtime.current?.send(message), []);
207
+ useLayoutEffect(() => {
208
+ onEmit.current = options.onEmit;
209
+ committed.current = props;
210
+ runtime.current?.setProps(props);
211
+ }, [props, options.onEmit]);
212
+ useEffect(() => {
213
+ if (messageLog === null)
214
+ return;
215
+ const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
216
+ runtime.current = mounted;
217
+ return () => {
218
+ runtime.current = undefined;
219
+ mounted.dispose();
220
+ };
221
+ }, [component, messageLog, store]);
222
+ if ("error" in snapshot)
223
+ throw snapshot.error;
224
+ return { model: snapshot.model, send };
225
+ };
226
+
227
+ // ../../src/components/copy-button/index.ts
228
+ import { Effect as Effect2, Redacted, Schema as Schema2 } from "effect";
229
+ import { Command, Component, UiSchema, View as View2 } from "effect/ui";
230
+
231
+ // ../../src/components/copy-button/schema.ts
232
+ import { Schema } from "effect";
233
+ var MessageOverrides = Schema.Struct({
234
+ copy: Schema.optional(Schema.String),
235
+ copied: Schema.optional(Schema.String),
236
+ copyFailed: Schema.optional(Schema.String)
237
+ }).annotate({ identifier: "CopyButtonMessageOverrides" });
238
+ var CopyButtonTranslations = Schema.Record(Schema.String, Schema.UndefinedOr(MessageOverrides));
239
+ var copyButtonVariants = [
240
+ "default",
241
+ "secondary",
242
+ "outline",
243
+ "ghost",
244
+ "destructive",
245
+ "link"
246
+ ];
247
+ var CopyButtonModelProps = Schema.Struct({
248
+ value: Schema.Redacted(Schema.String, { disallowJsonEncode: true }),
249
+ disabled: Schema.optional(Schema.Boolean),
250
+ resetDelay: Schema.optional(Schema.Finite)
251
+ }).annotate({ identifier: "CopyButtonModelProps" });
252
+ var copyButtonSharedProps = Schema.Struct({
253
+ ...CopyButtonModelProps.fields,
254
+ valueDescription: Schema.optional(Schema.String),
255
+ copyVariant: Schema.optional(Schema.Literals(["default", "sm", "large"])),
256
+ variant: Schema.optional(Schema.Literals(copyButtonVariants)),
257
+ locale: Schema.optional(Schema.String),
258
+ messages: Schema.optional(CopyButtonTranslations)
259
+ }).annotate({ identifier: "CopyButtonSharedProps" });
260
+
261
+ // ../../src/components/copy-button/index.ts
262
+ var labels = {
263
+ en: { copy: "Copy", copied: "Copied", copyFailed: "Copy failed" },
264
+ fr: { copy: "Copier", copied: "Copié", copyFailed: "Échec de la copie" }
265
+ };
266
+ var copyButtonMessages = (locale = "en", translations) => ({
267
+ ...locale.startsWith("fr") ? labels.fr : labels.en,
268
+ ...translations?.[locale.split("-")[0] ?? locale],
269
+ ...translations?.[locale]
270
+ });
271
+ var copyButtonLabel = (copy, description) => description ? `${copy} ${description}` : copy;
272
+ var CopyButtonMessage = UiSchema.TaggedEnum({
273
+ Pressed: {},
274
+ Finished: { success: Schema2.Boolean },
275
+ Reset: {}
276
+ }).annotate({ identifier: "CopyButtonMessage" });
277
+
278
+ class WriteClipboard extends Command.Service()("copy-button/WriteClipboard", {
279
+ args: {
280
+ value: Schema2.Redacted(Schema2.String, { disallowJsonEncode: true })
281
+ },
282
+ success: CopyButtonMessage
283
+ }) {
284
+ static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) => Effect2.tryPromise(() => write(Redacted.value(value))).pipe(Effect2.match({
285
+ onSuccess: () => CopyButtonMessage.Finished({ success: true }),
286
+ onFailure: () => CopyButtonMessage.Finished({ success: false })
287
+ })));
288
+ static browser = WriteClipboard.layerFromWrite((value) => navigator.clipboard.writeText(value));
289
+ }
290
+ var ResetClipboardFeedback = Command.make("copy-button/ResetFeedback", { args: { delay: Schema2.Number }, mode: "switch" }, ({ delay }) => Effect2.sleep(Math.max(0, delay)).pipe(Effect2.as(CopyButtonMessage.Reset())));
291
+ var copyButtonOptions = {
292
+ name: "CopyButton",
293
+ props: CopyButtonModelProps,
294
+ model: Schema2.Struct({
295
+ status: Schema2.Literals(["idle", "copied", "failed"])
296
+ }).annotate({ identifier: "CopyButtonModel" }),
297
+ message: CopyButtonMessage,
298
+ restore: false
299
+ };
300
+ var Definition = Component.define(copyButtonOptions);
301
+ var update = Definition.update({
302
+ Pressed: ($) => $.props.disabled ? $.model : $.run(WriteClipboard.make({ value: $.props.value })),
303
+ Finished: ($, { success }) => $.evolve({ status: success ? "copied" : "failed" }).run(ResetClipboardFeedback.make({ delay: $.props.resetDelay ?? 1500 })),
304
+ Reset: ($) => $.evolve({ status: "idle" })
305
+ });
306
+ var copyButtonBehaviours = {
307
+ init: () => ({ status: "idle" }),
308
+ update
309
+ };
310
+ var CopyButtonModel = Definition.make({
311
+ ...copyButtonBehaviours,
312
+ view: () => View2.text("")
313
+ });
314
+ var copyButtonStatus = (status, copy, description) => {
315
+ if (status === "idle")
316
+ return "";
317
+ const text = status === "copied" ? copy.copied : copy.copyFailed;
318
+ return description ? `${text}: ${description}` : text;
319
+ };
320
+
321
+ // ../../src/components/copy-button/react.tsx
322
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
323
+ "use client";
324
+ function CopyButton({
325
+ value,
326
+ valueDescription,
327
+ copyVariant = "default",
328
+ locale: localeOverride,
329
+ messages,
330
+ onCopied,
331
+ onCopyError,
332
+ resetDelay = 1500,
333
+ disabled,
334
+ size,
335
+ "aria-label": ariaLabel,
336
+ ...props
337
+ }) {
338
+ const locale = useKrakstackLocale(localeOverride);
339
+ const labels = copyButtonMessages(locale, messages);
340
+ const callbacks = useRef2({
341
+ onCopied,
342
+ onCopyError,
343
+ failureLabel: labels.copyFailed
344
+ });
345
+ useLayoutEffect2(() => {
346
+ callbacks.current = {
347
+ onCopied,
348
+ onCopyError,
349
+ failureLabel: labels.copyFailed
350
+ };
351
+ }, [onCopied, onCopyError, labels.copyFailed]);
352
+ const [component] = useState2(() => CopyButtonModel.pipe(Component2.provide(WriteClipboard.layerFromWrite(async (text) => {
353
+ const { onCopied, onCopyError, failureLabel } = callbacks.current;
354
+ try {
355
+ await navigator.clipboard.writeText(text);
356
+ onCopied?.();
357
+ } catch (cause) {
358
+ onCopyError?.(cause instanceof Error ? cause : new Error(failureLabel, { cause }));
359
+ throw cause;
360
+ }
361
+ }))));
362
+ const {
363
+ model: { status },
364
+ send
365
+ } = useModel(component, {
366
+ value: Redacted2.make(value),
367
+ disabled: disabled ?? false,
368
+ resetDelay
369
+ });
370
+ const accessibleLabel = ariaLabel ?? copyButtonLabel(labels.copy, valueDescription);
371
+ const isLarge = copyVariant === "large";
372
+ const defaultSize = copyVariant === "sm" ? "icon-xs" : isLarge ? "sm" : "icon-sm";
373
+ return /* @__PURE__ */ jsxs(Button, {
374
+ "aria-label": accessibleLabel,
375
+ disabled,
376
+ onClick: () => send(CopyButtonMessage.Pressed()),
377
+ size: size ?? defaultSize,
378
+ ...props,
379
+ children: [
380
+ /* @__PURE__ */ jsx2("span", {
381
+ "aria-live": "polite",
382
+ className: "sr-only",
383
+ role: "status",
384
+ children: copyButtonStatus(status, labels, valueDescription)
385
+ }),
386
+ status === "copied" ? /* @__PURE__ */ jsx2(Check, {
387
+ "aria-hidden": "true"
388
+ }) : null,
389
+ status === "failed" ? /* @__PURE__ */ jsx2(TriangleAlert, {
390
+ "aria-hidden": "true"
391
+ }) : null,
392
+ status === "idle" ? /* @__PURE__ */ jsx2(Copy, {
393
+ "aria-hidden": "true"
394
+ }) : null,
395
+ isLarge ? /* @__PURE__ */ jsx2("span", {
396
+ children: labels.copy
397
+ }) : null
398
+ ]
399
+ });
400
+ }
401
+
402
+ // ../../src/components/ui/copy-button.tsx
403
+ "use client";
404
+
405
+ // ../../src/components/code-block/react.tsx
406
+ import { highlight } from "@tanstack/highlight";
407
+ import { useKrakstackLocale as useKrakstackLocale2 } from "@krak-stack/registry/krakstack-provider/react";
408
+
409
+ // ../../src/components/code-block/classes.ts
410
+ var codeBlockClasses = {
411
+ root: "not-prose bg-muted overflow-hidden rounded-md border text-[var(--th-token)]",
412
+ header: "bg-background border-border/60 flex items-center justify-between border-b px-3 py-2",
413
+ language: "text-muted-foreground font-mono text-xs",
414
+ viewport: "max-h-full overflow-auto font-mono text-[0.875rem] leading-[1.625]"
415
+ };
416
+ var resolveCodeBlockClasses = (overrides) => ({
417
+ ...codeBlockClasses,
418
+ ...overrides
419
+ });
420
+
421
+ // ../../src/components/code-block/index.ts
422
+ import { createThemeCss } from "@tanstack/highlight/theme";
423
+ import { githubDarkTheme } from "@tanstack/highlight/themes/github-dark";
424
+ import { githubLightTheme } from "@tanstack/highlight/themes/github-light";
425
+ var codeThemeCss = `${createThemeCss({
426
+ light: githubLightTheme,
427
+ dark: githubDarkTheme,
428
+ lightSelector: "[data-code-theme]",
429
+ darkSelector: ".dark [data-code-theme]",
430
+ codeBlockSelector: "[data-code-theme] pre.th-code",
431
+ lineNumbersSelector: "[data-code-theme] .th-code--line-numbers"
432
+ })}
433
+ [data-code-theme] pre.th-code {
434
+ margin: 0;
435
+ overflow: visible;
436
+ background: transparent;
437
+ font: inherit;
438
+ color: inherit;
439
+ }
440
+ [data-code-theme] pre.th-code code { font: inherit; }`;
441
+ var messages = {
442
+ en: {
443
+ codeDescription: (language) => `${language} code`,
444
+ copy: "Copy",
445
+ copied: "Copied",
446
+ copyFailed: "Copy failed"
447
+ },
448
+ fr: {
449
+ codeDescription: (language) => `code ${language}`,
450
+ copy: "Copier",
451
+ copied: "Copié",
452
+ copyFailed: "Échec de la copie"
453
+ }
454
+ };
455
+ var codeBlockMessages = (locale = "en", translations) => ({
456
+ ...locale.startsWith("fr") ? messages.fr : messages.en,
457
+ ...translations?.[locale.split("-")[0] ?? locale],
458
+ ...translations?.[locale]
459
+ });
460
+ var codeLanguage = (language = "text") => language.toLowerCase() || "text";
461
+
462
+ // ../../src/components/code-block/react.tsx
463
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
464
+ function CodeBlock({
465
+ classes: classOverrides,
466
+ code,
467
+ language = "text",
468
+ locale: localeOverride,
469
+ messages
470
+ }) {
471
+ const codeBlockClasses = resolveCodeBlockClasses(classOverrides);
472
+ const locale = useKrakstackLocale2(localeOverride);
473
+ const normalizedLanguage = codeLanguage(language);
474
+ const highlighted = highlight(code, { lang: normalizedLanguage });
475
+ const labels = codeBlockMessages(locale, messages);
476
+ return /* @__PURE__ */ jsxs2("div", {
477
+ className: codeBlockClasses.root,
478
+ "data-code-theme": true,
479
+ children: [
480
+ /* @__PURE__ */ jsx3("style", {
481
+ children: codeThemeCss
482
+ }),
483
+ /* @__PURE__ */ jsxs2("div", {
484
+ className: codeBlockClasses.header,
485
+ children: [
486
+ /* @__PURE__ */ jsx3("span", {
487
+ className: codeBlockClasses.language,
488
+ children: highlighted.lang
489
+ }),
490
+ /* @__PURE__ */ jsx3(CopyButton, {
491
+ value: code,
492
+ valueDescription: labels.codeDescription(highlighted.lang),
493
+ variant: "ghost",
494
+ locale,
495
+ messages: { [locale]: labels }
496
+ })
497
+ ]
498
+ }),
499
+ /* @__PURE__ */ jsx3("div", {
500
+ className: codeBlockClasses.viewport,
501
+ dangerouslySetInnerHTML: { __html: highlighted.html }
502
+ })
503
+ ]
504
+ });
505
+ }
506
+ // ../../src/components/markdown/classes.ts
507
+ var markdownClass = "[&_a:hover]:text-primary [&_a]:decoration-border [&_blockquote]:border-primary/40 [&_blockquote]:bg-muted/40 [&_h2_a]:text-muted-foreground [&_h3_a]:text-muted-foreground [&_[data-inline-code]]:bg-muted text-[0.98rem] leading-7 [&_[data-inline-code]]:rounded [&_[data-inline-code]]:px-1.5 [&_[data-inline-code]]:py-0.5 [&_[data-inline-code]]:font-mono [&_[data-inline-code]]:text-[0.875em] [&_[data-markdown-table]]:overflow-x-auto [&_a]:font-medium [&_a]:underline [&_a]:decoration-1 [&_a]:underline-offset-4 [&_a]:transition-colors [&_blockquote]:my-5 [&_blockquote]:rounded-r-lg [&_blockquote]:border-l-4 [&_blockquote]:px-5 [&_blockquote]:py-1 [&_h2]:mt-12 [&_h2]:scroll-mt-20 [&_h2]:border-t [&_h2]:pt-8 [&_h2]:text-2xl [&_h2]:font-bold [&_h2]:tracking-tight [&_h2_a]:ml-2 [&_h2_a]:no-underline [&_h2:first-of-type]:mt-0 [&_h2:first-of-type]:border-t-0 [&_h2:first-of-type]:pt-0 [&_h3]:mt-8 [&_h3]:scroll-mt-20 [&_h3]:text-xl [&_h3]:font-semibold [&_h3]:tracking-tight [&_h3_a]:ml-2 [&_h3_a]:no-underline [&_ol]:my-5 [&_p]:my-5 [&_table]:w-full [&_table]:text-sm [&_td]:border-b [&_td]:p-2 [&_th]:border-b [&_th]:p-2 [&_th]:text-left [&_ul]:my-5 [&_li]:my-1 [&_li>ol]:my-2 [&_li>p]:my-2 [&_li>ul]:my-2 [&_ol]:list-decimal [&_ol]:ps-6 [&_ul]:list-disc [&_ul]:ps-6";
508
+
509
+ // ../../src/components/markdown/index.ts
510
+ var markdownSegments = ({
511
+ html,
512
+ codeBlocks
513
+ }) => {
514
+ let remainingHtml = html;
515
+ const segments = [];
516
+ codeBlocks.forEach((block, index) => {
517
+ const marker = `<markdown-code-block data-index="${index}"></markdown-code-block>`;
518
+ const at = remainingHtml.indexOf(marker);
519
+ if (at === -1)
520
+ return;
521
+ segments.push({ html: remainingHtml.slice(0, at), index, block });
522
+ remainingHtml = remainingHtml.slice(at + marker.length);
523
+ });
524
+ segments.push({ html: remainingHtml, index: codeBlocks.length });
525
+ return segments;
526
+ };
527
+
528
+ // ../../src/components/markdown/react.tsx
529
+ import { jsx as jsx4 } from "react/jsx-runtime";
530
+ var MarkdownContent = ({
531
+ classes,
532
+ className,
533
+ codeBlocks,
534
+ html,
535
+ locale,
536
+ messages
537
+ }) => {
538
+ const content = [];
539
+ for (const segment of markdownSegments({ html, codeBlocks })) {
540
+ const { block, index } = segment;
541
+ content.push(/* @__PURE__ */ jsx4("div", {
542
+ dangerouslySetInnerHTML: { __html: segment.html }
543
+ }, `html-${index}`));
544
+ if (block)
545
+ content.push(/* @__PURE__ */ jsx4("div", {
546
+ className: "my-5",
547
+ children: /* @__PURE__ */ jsx4(CodeBlock, {
548
+ code: block.code,
549
+ language: block.language,
550
+ locale,
551
+ messages
552
+ })
553
+ }, `code-${index}`));
554
+ }
555
+ return /* @__PURE__ */ jsx4("div", {
556
+ className: cn(classes?.root ?? markdownClass, className),
557
+ children: content
558
+ });
559
+ };
560
+ // ../../src/components/ui/alert.tsx
561
+ import { cva as cva2 } from "class-variance-authority";
562
+ import { jsx as jsx5 } from "react/jsx-runtime";
563
+ var alertVariants = cva2("group/alert relative grid w-full gap-0.5 rounded-lg border px-4 py-3 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", {
564
+ variants: {
565
+ variant: {
566
+ default: "bg-card text-card-foreground",
567
+ destructive: "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current"
568
+ }
569
+ },
570
+ defaultVariants: {
571
+ variant: "default"
572
+ }
573
+ });
574
+ function Alert({
575
+ className,
576
+ variant,
577
+ ...props
578
+ }) {
579
+ return /* @__PURE__ */ jsx5("div", {
580
+ "data-slot": "alert",
581
+ role: "alert",
582
+ className: cn(alertVariants({ variant }), className),
583
+ ...props
584
+ });
585
+ }
586
+ function AlertTitle({ className, ...props }) {
587
+ return /* @__PURE__ */ jsx5("div", {
588
+ "data-slot": "alert-title",
589
+ className: cn("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground", className),
590
+ ...props
591
+ });
592
+ }
593
+ function AlertDescription({
594
+ className,
595
+ ...props
596
+ }) {
597
+ return /* @__PURE__ */ jsx5("div", {
598
+ "data-slot": "alert-description",
599
+ className: cn("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4", className),
600
+ ...props
601
+ });
602
+ }
603
+
604
+ // ../../src/components/ui/attachment.tsx
605
+ import { mergeProps } from "@base-ui/react/merge-props";
606
+ import { useRender } from "@base-ui/react/use-render";
607
+ import { cva as cva3 } from "class-variance-authority";
608
+ import { jsx as jsx6 } from "react/jsx-runtime";
609
+ var attachmentVariants = cva3("group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed", {
610
+ variants: {
611
+ size: {
612
+ default: "gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2",
613
+ sm: "gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5",
614
+ xs: "gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1"
615
+ },
616
+ orientation: {
617
+ horizontal: "min-w-40 items-center",
618
+ vertical: "w-24 flex-col has-data-[slot=attachment-content]:w-30"
619
+ }
620
+ }
621
+ });
622
+ function Attachment({
623
+ className,
624
+ state = "done",
625
+ size = "default",
626
+ orientation = "horizontal",
627
+ ...props
628
+ }) {
629
+ return /* @__PURE__ */ jsx6("div", {
630
+ "data-slot": "attachment",
631
+ "data-state": state,
632
+ "data-size": size,
633
+ "data-orientation": orientation,
634
+ className: cn(attachmentVariants({ size, orientation }), className),
635
+ ...props
636
+ });
637
+ }
638
+ var attachmentMediaVariants = cva3("relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5", {
639
+ variants: {
640
+ variant: {
641
+ icon: "",
642
+ image: "opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover"
643
+ }
644
+ },
645
+ defaultVariants: {
646
+ variant: "icon"
647
+ }
648
+ });
649
+ function AttachmentMedia({
650
+ className,
651
+ variant = "icon",
652
+ ...props
653
+ }) {
654
+ return /* @__PURE__ */ jsx6("div", {
655
+ "data-slot": "attachment-media",
656
+ "data-variant": variant,
657
+ className: cn(attachmentMediaVariants({ variant }), className),
658
+ ...props
659
+ });
660
+ }
661
+ function AttachmentContent({
662
+ className,
663
+ ...props
664
+ }) {
665
+ return /* @__PURE__ */ jsx6("div", {
666
+ "data-slot": "attachment-content",
667
+ className: cn("max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1", className),
668
+ ...props
669
+ });
670
+ }
671
+ function AttachmentTitle({
672
+ className,
673
+ ...props
674
+ }) {
675
+ return /* @__PURE__ */ jsx6("span", {
676
+ "data-slot": "attachment-title",
677
+ className: cn("block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer", className),
678
+ ...props
679
+ });
680
+ }
681
+ function AttachmentActions({
682
+ className,
683
+ ...props
684
+ }) {
685
+ return /* @__PURE__ */ jsx6("div", {
686
+ "data-slot": "attachment-actions",
687
+ className: cn("relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1", className),
688
+ ...props
689
+ });
690
+ }
691
+ function AttachmentAction({
692
+ className,
693
+ variant,
694
+ size = "icon-xs",
695
+ ...props
696
+ }) {
697
+ return /* @__PURE__ */ jsx6(Button, {
698
+ "data-slot": "attachment-action",
699
+ variant: variant ?? "ghost",
700
+ size,
701
+ className: cn(className),
702
+ ...props
703
+ });
704
+ }
705
+
706
+ // ../../src/components/ui/badge.tsx
707
+ import { mergeProps as mergeProps2 } from "@base-ui/react/merge-props";
708
+ import { useRender as useRender2 } from "@base-ui/react/use-render";
709
+ import { cva as cva4 } from "class-variance-authority";
710
+ var badgeVariants = cva4("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
711
+ variants: {
712
+ variant: {
713
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
714
+ secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
715
+ destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
716
+ outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
717
+ ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
718
+ link: "text-primary underline-offset-4 hover:underline"
719
+ }
720
+ },
721
+ defaultVariants: {
722
+ variant: "default"
723
+ }
724
+ });
725
+ function Badge({
726
+ className,
727
+ variant = "default",
728
+ render,
729
+ ...props
730
+ }) {
731
+ return useRender2({
732
+ defaultTagName: "span",
733
+ props: mergeProps2({
734
+ className: cn(badgeVariants({ variant }), className)
735
+ }, props),
736
+ render,
737
+ state: {
738
+ slot: "badge",
739
+ variant
740
+ }
741
+ });
742
+ }
743
+
744
+ // ../../src/components/ui/bubble.tsx
745
+ import { mergeProps as mergeProps3 } from "@base-ui/react/merge-props";
746
+ import { useRender as useRender3 } from "@base-ui/react/use-render";
747
+ import { cva as cva5 } from "class-variance-authority";
748
+ import { jsx as jsx7 } from "react/jsx-runtime";
749
+ var bubbleVariants = cva5("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full", {
750
+ variants: {
751
+ variant: {
752
+ default: "*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",
753
+ secondary: "*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",
754
+ muted: "*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",
755
+ tinted: "*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",
756
+ outline: "*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",
757
+ ghost: "border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",
758
+ destructive: "*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"
759
+ }
760
+ },
761
+ defaultVariants: {
762
+ variant: "default"
763
+ }
764
+ });
765
+ function Bubble({
766
+ variant = "default",
767
+ align = "start",
768
+ className,
769
+ ...props
770
+ }) {
771
+ return /* @__PURE__ */ jsx7("div", {
772
+ "data-slot": "bubble",
773
+ "data-variant": variant,
774
+ "data-align": align,
775
+ className: cn(bubbleVariants({ variant }), className),
776
+ ...props
777
+ });
778
+ }
779
+ function BubbleContent({
780
+ className,
781
+ render,
782
+ ...props
783
+ }) {
784
+ return useRender3({
785
+ defaultTagName: "div",
786
+ props: mergeProps3({
787
+ className: cn("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50", className)
788
+ }, props),
789
+ render,
790
+ state: {
791
+ slot: "bubble-content"
792
+ }
793
+ });
794
+ }
795
+ var bubbleReactionsVariants = cva5("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0", {
796
+ variants: {
797
+ side: {
798
+ top: "top-0 -translate-y-3/4",
799
+ bottom: "bottom-0 translate-y-3/4"
800
+ },
801
+ align: {
802
+ start: "left-3",
803
+ end: "right-3"
804
+ }
805
+ },
806
+ defaultVariants: {
807
+ side: "bottom",
808
+ align: "end"
809
+ }
810
+ });
811
+
812
+ // ../../src/components/ui/command.tsx
813
+ import { Command as CommandPrimitive } from "cmdk";
814
+ import { SearchIcon } from "lucide-react";
815
+
816
+ // ../../src/components/ui/dialog.tsx
817
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
818
+ import { cn as cn2 } from "cn";
819
+ import { XIcon } from "lucide-react";
820
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
821
+ function Dialog({ ...props }) {
822
+ return /* @__PURE__ */ jsx8(DialogPrimitive.Root, {
823
+ "data-slot": "dialog",
824
+ ...props
825
+ });
826
+ }
827
+ function DialogTrigger({ ...props }) {
828
+ return /* @__PURE__ */ jsx8(DialogPrimitive.Trigger, {
829
+ "data-slot": "dialog-trigger",
830
+ ...props
831
+ });
832
+ }
833
+ function DialogPortal({ ...props }) {
834
+ return /* @__PURE__ */ jsx8(DialogPrimitive.Portal, {
835
+ "data-slot": "dialog-portal",
836
+ ...props
837
+ });
838
+ }
839
+ function DialogClose({ ...props }) {
840
+ return /* @__PURE__ */ jsx8(DialogPrimitive.Close, {
841
+ "data-slot": "dialog-close",
842
+ ...props
843
+ });
844
+ }
845
+ function DialogHeader({ className, ...props }) {
846
+ return /* @__PURE__ */ jsx8("div", {
847
+ "data-slot": "dialog-header",
848
+ className: cn2("flex flex-col gap-2", className),
849
+ ...props
850
+ });
851
+ }
852
+ function DialogTitle({ className, ...props }) {
853
+ return /* @__PURE__ */ jsx8(DialogPrimitive.Title, {
854
+ "data-slot": "dialog-title",
855
+ className: cn2("leading-none font-medium", className),
856
+ ...props
857
+ });
858
+ }
859
+
860
+ // ../../src/components/ui/command.tsx
861
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
862
+ function Command2({
863
+ className,
864
+ ...props
865
+ }) {
866
+ return /* @__PURE__ */ jsx9(CommandPrimitive, {
867
+ "data-slot": "command",
868
+ className: cn("flex size-full flex-col overflow-hidden rounded-xl bg-popover p-1 text-popover-foreground", className),
869
+ ...props
870
+ });
871
+ }
872
+ function CommandList({
873
+ className,
874
+ ...props
875
+ }) {
876
+ return /* @__PURE__ */ jsx9(CommandPrimitive.List, {
877
+ "data-slot": "command-list",
878
+ className: cn("max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none", className),
879
+ ...props
880
+ });
881
+ }
882
+ function CommandEmpty({
883
+ className,
884
+ ...props
885
+ }) {
886
+ return /* @__PURE__ */ jsx9(CommandPrimitive.Empty, {
887
+ "data-slot": "command-empty",
888
+ className: cn("py-6 text-center text-sm", className),
889
+ ...props
890
+ });
891
+ }
892
+ function CommandGroup({
893
+ className,
894
+ ...props
895
+ }) {
896
+ return /* @__PURE__ */ jsx9(CommandPrimitive.Group, {
897
+ "data-slot": "command-group",
898
+ className: cn("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground", className),
899
+ ...props
900
+ });
901
+ }
902
+ function CommandItem({
903
+ className,
904
+ ...props
905
+ }) {
906
+ return /* @__PURE__ */ jsx9(CommandPrimitive.Item, {
907
+ "data-slot": "command-item",
908
+ className: cn("group/command-item relative flex cursor-default items-center gap-2 rounded-lg px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
909
+ ...props
910
+ });
911
+ }
912
+
913
+ // ../../src/components/ui/empty.tsx
914
+ import { cva as cva6 } from "class-variance-authority";
915
+ import { jsx as jsx10 } from "react/jsx-runtime";
916
+ function Empty({ className, ...props }) {
917
+ return /* @__PURE__ */ jsx10("div", {
918
+ "data-slot": "empty",
919
+ className: cn("flex w-full min-w-0 flex-1 flex-col items-center justify-center gap-4 rounded-lg border-dashed p-12 text-center text-balance", className),
920
+ ...props
921
+ });
922
+ }
923
+ function EmptyHeader({ className, ...props }) {
924
+ return /* @__PURE__ */ jsx10("div", {
925
+ "data-slot": "empty-header",
926
+ className: cn("flex max-w-sm flex-col items-center gap-2", className),
927
+ ...props
928
+ });
929
+ }
930
+ var emptyMediaVariants = cva6("mb-2 flex shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg]:shrink-0", {
931
+ variants: {
932
+ variant: {
933
+ default: "bg-transparent",
934
+ icon: "flex size-10 shrink-0 items-center justify-center rounded-lg bg-muted text-foreground [&_svg:not([class*='size-'])]:size-6"
935
+ }
936
+ },
937
+ defaultVariants: {
938
+ variant: "default"
939
+ }
940
+ });
941
+ function EmptyMedia({
942
+ className,
943
+ variant = "default",
944
+ ...props
945
+ }) {
946
+ return /* @__PURE__ */ jsx10("div", {
947
+ "data-slot": "empty-icon",
948
+ "data-variant": variant,
949
+ className: cn(emptyMediaVariants({ variant, className })),
950
+ ...props
951
+ });
952
+ }
953
+ function EmptyTitle({ className, ...props }) {
954
+ return /* @__PURE__ */ jsx10("div", {
955
+ "data-slot": "empty-title",
956
+ className: cn("text-lg font-medium tracking-tight", className),
957
+ ...props
958
+ });
959
+ }
960
+ function EmptyDescription({ className, ...props }) {
961
+ return /* @__PURE__ */ jsx10("div", {
962
+ "data-slot": "empty-description",
963
+ className: cn("text-sm/relaxed text-muted-foreground [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
964
+ ...props
965
+ });
966
+ }
967
+
968
+ // ../../src/components/ui/input-group.tsx
969
+ import { cva as cva7 } from "class-variance-authority";
970
+
971
+ // ../../src/components/ui/input.tsx
972
+ import { Input as InputPrimitive } from "@base-ui/react/input";
973
+
974
+ // ../../src/components/ui/textarea.tsx
975
+ import { jsx as jsx11 } from "react/jsx-runtime";
976
+ function Textarea({ className, ...props }) {
977
+ return /* @__PURE__ */ jsx11("textarea", {
978
+ "data-slot": "textarea",
979
+ className: cn("flex field-sizing-content min-h-16 w-full rounded-md border border-input bg-transparent px-2.5 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40", className),
980
+ ...props
981
+ });
982
+ }
983
+
984
+ // ../../src/components/ui/input-group.tsx
985
+ import { jsx as jsx12 } from "react/jsx-runtime";
986
+ function InputGroup({ className, ...props }) {
987
+ return /* @__PURE__ */ jsx12("div", {
988
+ "data-slot": "input-group",
989
+ role: "group",
990
+ className: cn("group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5", className),
991
+ ...props
992
+ });
993
+ }
994
+ var inputGroupAddonVariants = cva7("flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4", {
995
+ variants: {
996
+ align: {
997
+ "inline-start": "order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]",
998
+ "inline-end": "order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]",
999
+ "block-start": "order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2",
1000
+ "block-end": "order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2"
1001
+ }
1002
+ },
1003
+ defaultVariants: { align: "inline-start" }
1004
+ });
1005
+ function InputGroupAddon({
1006
+ className,
1007
+ align = "inline-start",
1008
+ ...props
1009
+ }) {
1010
+ return /* @__PURE__ */ jsx12("div", {
1011
+ role: "group",
1012
+ "data-slot": "input-group-addon",
1013
+ "data-align": align,
1014
+ className: cn(inputGroupAddonVariants({ align }), className),
1015
+ onClick: (event) => {
1016
+ if (event.target instanceof HTMLElement && event.target.closest("button")) {
1017
+ return;
1018
+ }
1019
+ event.currentTarget.parentElement?.querySelector("input")?.focus();
1020
+ },
1021
+ ...props
1022
+ });
1023
+ }
1024
+ var inputGroupButtonVariants = cva7("flex items-center gap-2 text-sm shadow-none", {
1025
+ variants: {
1026
+ size: {
1027
+ xs: "h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5",
1028
+ sm: "",
1029
+ "icon-xs": "size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0",
1030
+ "icon-sm": "size-8 p-0 has-[>svg]:p-0"
1031
+ }
1032
+ },
1033
+ defaultVariants: { size: "xs" }
1034
+ });
1035
+ function InputGroupButton({
1036
+ className,
1037
+ type = "button",
1038
+ variant = "ghost",
1039
+ size = "xs",
1040
+ ...props
1041
+ }) {
1042
+ return /* @__PURE__ */ jsx12(Button, {
1043
+ type,
1044
+ "data-size": size,
1045
+ variant,
1046
+ className: cn(inputGroupButtonVariants({ size }), className),
1047
+ ...props
1048
+ });
1049
+ }
1050
+ function InputGroupTextarea({
1051
+ className,
1052
+ ...props
1053
+ }) {
1054
+ return /* @__PURE__ */ jsx12(Textarea, {
1055
+ "data-slot": "input-group-control",
1056
+ className: cn("flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent", className),
1057
+ ...props
1058
+ });
1059
+ }
1060
+
1061
+ // ../../src/components/ui/item.tsx
1062
+ import { mergeProps as mergeProps4 } from "@base-ui/react/merge-props";
1063
+ import { useRender as useRender4 } from "@base-ui/react/use-render";
1064
+ import { cva as cva8 } from "class-variance-authority";
1065
+ import { cn as cn3 } from "cn";
1066
+
1067
+ // ../../src/components/ui/separator.tsx
1068
+ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
1069
+
1070
+ // ../../src/components/ui/item.tsx
1071
+ import { jsx as jsx13 } from "react/jsx-runtime";
1072
+ var itemVariants = cva8("group/item flex w-full flex-wrap items-center rounded-md border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted", {
1073
+ variants: {
1074
+ variant: {
1075
+ default: "border-transparent",
1076
+ outline: "border-border",
1077
+ muted: "border-transparent bg-muted/50"
1078
+ },
1079
+ size: {
1080
+ default: "gap-3.5 px-4 py-3.5",
1081
+ sm: "gap-2.5 px-3 py-2.5",
1082
+ xs: "gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0"
1083
+ }
1084
+ },
1085
+ defaultVariants: {
1086
+ variant: "default",
1087
+ size: "default"
1088
+ }
1089
+ });
1090
+ function Item({
1091
+ className,
1092
+ variant = "default",
1093
+ size = "default",
1094
+ render,
1095
+ ...props
1096
+ }) {
1097
+ return useRender4({
1098
+ defaultTagName: "div",
1099
+ props: mergeProps4({
1100
+ className: cn3(itemVariants({ variant, size, className }))
1101
+ }, props),
1102
+ render,
1103
+ state: {
1104
+ slot: "item",
1105
+ variant,
1106
+ size
1107
+ }
1108
+ });
1109
+ }
1110
+ var itemMediaVariants = cva8("flex shrink-0 items-center justify-center gap-2 group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start [&_svg]:pointer-events-none", {
1111
+ variants: {
1112
+ variant: {
1113
+ default: "bg-transparent",
1114
+ icon: "[&_svg:not([class*='size-'])]:size-4",
1115
+ image: "size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover"
1116
+ }
1117
+ },
1118
+ defaultVariants: {
1119
+ variant: "default"
1120
+ }
1121
+ });
1122
+ function ItemMedia({
1123
+ className,
1124
+ variant = "default",
1125
+ ...props
1126
+ }) {
1127
+ return /* @__PURE__ */ jsx13("div", {
1128
+ "data-slot": "item-media",
1129
+ "data-variant": variant,
1130
+ className: cn3(itemMediaVariants({ variant, className })),
1131
+ ...props
1132
+ });
1133
+ }
1134
+ function ItemContent({ className, ...props }) {
1135
+ return /* @__PURE__ */ jsx13("div", {
1136
+ "data-slot": "item-content",
1137
+ className: cn3("flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none", className),
1138
+ ...props
1139
+ });
1140
+ }
1141
+ function ItemTitle({ className, ...props }) {
1142
+ return /* @__PURE__ */ jsx13("div", {
1143
+ "data-slot": "item-title",
1144
+ className: cn3("line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4", className),
1145
+ ...props
1146
+ });
1147
+ }
1148
+ function ItemDescription({ className, ...props }) {
1149
+ return /* @__PURE__ */ jsx13("p", {
1150
+ "data-slot": "item-description",
1151
+ className: cn3("line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
1152
+ ...props
1153
+ });
1154
+ }
1155
+ function ItemActions({ className, ...props }) {
1156
+ return /* @__PURE__ */ jsx13("div", {
1157
+ "data-slot": "item-actions",
1158
+ className: cn3("flex items-center gap-2", className),
1159
+ ...props
1160
+ });
1161
+ }
1162
+ function ItemFooter({ className, ...props }) {
1163
+ return /* @__PURE__ */ jsx13("div", {
1164
+ "data-slot": "item-footer",
1165
+ className: cn3("flex basis-full items-center justify-between gap-2", className),
1166
+ ...props
1167
+ });
1168
+ }
1169
+
1170
+ // ../../src/components/ui/message.tsx
1171
+ import { jsx as jsx14 } from "react/jsx-runtime";
1172
+ function Message({
1173
+ className,
1174
+ align = "start",
1175
+ ...props
1176
+ }) {
1177
+ return /* @__PURE__ */ jsx14("div", {
1178
+ "data-slot": "message",
1179
+ "data-align": align,
1180
+ className: cn("group/message relative flex w-full min-w-0 gap-2 text-sm data-[align=end]:flex-row-reverse", className),
1181
+ ...props
1182
+ });
1183
+ }
1184
+ function MessageContent({ className, ...props }) {
1185
+ return /* @__PURE__ */ jsx14("div", {
1186
+ "data-slot": "message-content",
1187
+ className: cn("flex w-full min-w-0 flex-col gap-2.5 wrap-break-word group-data-[align=end]/message:*:data-slot:self-end", className),
1188
+ ...props
1189
+ });
1190
+ }
1191
+
1192
+ // ../../src/components/ui/message-scroller.tsx
1193
+ import {
1194
+ MessageScroller as MessageScrollerPrimitive,
1195
+ useMessageScroller,
1196
+ useMessageScrollerScrollable,
1197
+ useMessageScrollerVisibility
1198
+ } from "@shadcn/react/message-scroller";
1199
+ import { ArrowDownIcon } from "lucide-react";
1200
+ import { jsx as jsx15, jsxs as jsxs5, Fragment } from "react/jsx-runtime";
1201
+ function MessageScrollerProvider(props) {
1202
+ return /* @__PURE__ */ jsx15(MessageScrollerPrimitive.Provider, {
1203
+ ...props
1204
+ });
1205
+ }
1206
+ function MessageScroller({
1207
+ className,
1208
+ ...props
1209
+ }) {
1210
+ return /* @__PURE__ */ jsx15(MessageScrollerPrimitive.Root, {
1211
+ "data-slot": "message-scroller",
1212
+ className: cn("group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden", className),
1213
+ ...props
1214
+ });
1215
+ }
1216
+ function MessageScrollerViewport({
1217
+ className,
1218
+ ...props
1219
+ }) {
1220
+ return /* @__PURE__ */ jsx15(MessageScrollerPrimitive.Viewport, {
1221
+ "data-slot": "message-scroller-viewport",
1222
+ className: cn("size-full min-h-0 min-w-0 scroll-fade-b scrollbar-thin scrollbar-gutter-stable overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent", className),
1223
+ ...props
1224
+ });
1225
+ }
1226
+ function MessageScrollerContent({
1227
+ className,
1228
+ ...props
1229
+ }) {
1230
+ return /* @__PURE__ */ jsx15(MessageScrollerPrimitive.Content, {
1231
+ "data-slot": "message-scroller-content",
1232
+ className: cn("flex h-max min-h-full flex-col gap-8", className),
1233
+ ...props
1234
+ });
1235
+ }
1236
+ function MessageScrollerItem({
1237
+ className,
1238
+ scrollAnchor = false,
1239
+ ...props
1240
+ }) {
1241
+ return /* @__PURE__ */ jsx15(MessageScrollerPrimitive.Item, {
1242
+ "data-slot": "message-scroller-item",
1243
+ scrollAnchor,
1244
+ className: cn("min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]", className),
1245
+ ...props
1246
+ });
1247
+ }
1248
+ function MessageScrollerButton({
1249
+ direction = "end",
1250
+ className,
1251
+ children,
1252
+ render,
1253
+ variant = "secondary",
1254
+ size = "icon-sm",
1255
+ ...props
1256
+ }) {
1257
+ return /* @__PURE__ */ jsx15(MessageScrollerPrimitive.Button, {
1258
+ "data-slot": "message-scroller-button",
1259
+ "data-direction": direction,
1260
+ "data-variant": variant,
1261
+ "data-size": size,
1262
+ direction,
1263
+ className: cn("absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180", className),
1264
+ render: render ?? /* @__PURE__ */ jsx15(Button, {
1265
+ variant,
1266
+ size
1267
+ }),
1268
+ ...props,
1269
+ children: children ?? /* @__PURE__ */ jsxs5(Fragment, {
1270
+ children: [
1271
+ /* @__PURE__ */ jsx15(ArrowDownIcon, {}),
1272
+ /* @__PURE__ */ jsx15("span", {
1273
+ className: "sr-only",
1274
+ children: direction === "end" ? "Scroll to end" : "Scroll to start"
1275
+ })
1276
+ ]
1277
+ })
1278
+ });
1279
+ }
1280
+
1281
+ // ../../src/components/ui/popover.tsx
1282
+ import { Popover as PopoverPrimitive } from "@base-ui/react/popover";
1283
+ import { jsx as jsx16 } from "react/jsx-runtime";
1284
+ function Popover({ ...props }) {
1285
+ return /* @__PURE__ */ jsx16(PopoverPrimitive.Root, {
1286
+ "data-slot": "popover",
1287
+ ...props
1288
+ });
1289
+ }
1290
+ function PopoverTrigger({ ...props }) {
1291
+ return /* @__PURE__ */ jsx16(PopoverPrimitive.Trigger, {
1292
+ "data-slot": "popover-trigger",
1293
+ ...props
1294
+ });
1295
+ }
1296
+ function PopoverContent({
1297
+ className,
1298
+ align = "center",
1299
+ alignOffset = 0,
1300
+ side = "bottom",
1301
+ sideOffset = 4,
1302
+ ...props
1303
+ }) {
1304
+ return /* @__PURE__ */ jsx16(PopoverPrimitive.Portal, {
1305
+ children: /* @__PURE__ */ jsx16(PopoverPrimitive.Positioner, {
1306
+ align,
1307
+ alignOffset,
1308
+ side,
1309
+ sideOffset,
1310
+ className: "isolate z-50",
1311
+ children: /* @__PURE__ */ jsx16(PopoverPrimitive.Popup, {
1312
+ "data-slot": "popover-content",
1313
+ className: cn("z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
1314
+ ...props
1315
+ })
1316
+ })
1317
+ });
1318
+ }
1319
+
1320
+ // ../../src/components/ui/trace.tsx
1321
+ import { cn as cn4 } from "cn";
1322
+
1323
+ // ../../src/components/ui/collapsible.tsx
1324
+ import { Collapsible as CollapsiblePrimitive } from "@base-ui/react/collapsible";
1325
+ import { jsx as jsx17 } from "react/jsx-runtime";
1326
+ function Collapsible({ ...props }) {
1327
+ return /* @__PURE__ */ jsx17(CollapsiblePrimitive.Root, {
1328
+ "data-slot": "collapsible",
1329
+ ...props
1330
+ });
1331
+ }
1332
+ function CollapsibleTrigger({ ...props }) {
1333
+ return /* @__PURE__ */ jsx17(CollapsiblePrimitive.Trigger, {
1334
+ "data-slot": "collapsible-trigger",
1335
+ ...props
1336
+ });
1337
+ }
1338
+ function CollapsibleContent({ ...props }) {
1339
+ return /* @__PURE__ */ jsx17(CollapsiblePrimitive.Panel, {
1340
+ "data-slot": "collapsible-content",
1341
+ ...props
1342
+ });
1343
+ }
1344
+
1345
+ // ../../src/components/ui/trace.tsx
1346
+ import { ChevronRightIcon } from "lucide-react";
1347
+ import { jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
1348
+ function Trace({ className, ...props }) {
1349
+ return /* @__PURE__ */ jsx18("div", {
1350
+ "data-slot": "trace",
1351
+ className: cn4("flex w-full min-w-0 flex-col gap-2 *:has-[>[data-slot=trace-line]]:flex *:has-[>[data-slot=trace-line]]:w-fit *:has-[>[data-slot=trace-line]]:max-w-full *:has-[>[data-slot=trace-line]]:min-w-0 *:has-[>[data-slot=trace-line]]:rounded-md *:has-[>[data-slot=trace-line]]:text-left *:has-[>[data-slot=trace-line]]:outline-none *:has-[>[data-slot=trace-line]]:focus-visible:ring-3 *:has-[>[data-slot=trace-line]]:focus-visible:ring-ring/50", className),
1352
+ ...props
1353
+ });
1354
+ }
1355
+ function TraceLine({
1356
+ className,
1357
+ status,
1358
+ ...props
1359
+ }) {
1360
+ return /* @__PURE__ */ jsx18("span", {
1361
+ "data-slot": "trace-line",
1362
+ "data-status": status,
1363
+ className: cn4("flex w-fit max-w-full min-w-0 items-center gap-2 text-sm text-muted-foreground transition-colors in-[a,button]:cursor-pointer in-[a:hover,button:hover]:text-foreground data-[status=error]:text-destructive data-[status=error]:in-[a:hover,button:hover]:text-destructive data-[status=pending]:opacity-60 data-[status=running]:*:data-[slot=trace-title]:shimmer", className),
1364
+ ...props
1365
+ });
1366
+ }
1367
+ function TraceIcon({ className, ...props }) {
1368
+ return /* @__PURE__ */ jsx18("span", {
1369
+ "data-slot": "trace-icon",
1370
+ "aria-hidden": "true",
1371
+ className: cn4("flex size-4 shrink-0 items-center justify-center [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [[data-slot=trace-title]~&]:-ml-1", className),
1372
+ ...props
1373
+ });
1374
+ }
1375
+ function TraceTitle({ className, ...props }) {
1376
+ return /* @__PURE__ */ jsx18("span", {
1377
+ "data-slot": "trace-title",
1378
+ className: cn4("min-w-0 truncate motion-reduce:shimmer-none", className),
1379
+ ...props
1380
+ });
1381
+ }
1382
+ function TraceDescription({
1383
+ className,
1384
+ ...props
1385
+ }) {
1386
+ return /* @__PURE__ */ jsx18("span", {
1387
+ "data-slot": "trace-description",
1388
+ className: cn4("shrink-0 text-muted-foreground/70 tabular-nums", className),
1389
+ ...props
1390
+ });
1391
+ }
1392
+ function TraceCollapsible({
1393
+ className,
1394
+ ...props
1395
+ }) {
1396
+ return /* @__PURE__ */ jsx18(Collapsible, {
1397
+ "data-slot": "trace-collapsible",
1398
+ className: cn4("flex w-full min-w-0 flex-col", className),
1399
+ ...props
1400
+ });
1401
+ }
1402
+ function TraceCollapsibleTrigger({
1403
+ className,
1404
+ children,
1405
+ ...props
1406
+ }) {
1407
+ return /* @__PURE__ */ jsxs6(CollapsibleTrigger, {
1408
+ "data-slot": "trace-collapsible-trigger",
1409
+ className: cn4("group/trace-collapsible-trigger flex w-fit max-w-full min-w-0 cursor-pointer items-center gap-1 rounded-md text-left text-muted-foreground transition-colors outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 has-[[data-status=error]]:text-destructive", className),
1410
+ ...props,
1411
+ children: [
1412
+ children,
1413
+ /* @__PURE__ */ jsx18(TraceIcon, {
1414
+ className: "transition-transform group-aria-expanded/trace-collapsible-trigger:rotate-90",
1415
+ children: /* @__PURE__ */ jsx18(ChevronRightIcon, {})
1416
+ })
1417
+ ]
1418
+ });
1419
+ }
1420
+ function TraceCollapsibleContent({
1421
+ className,
1422
+ children,
1423
+ ...props
1424
+ }) {
1425
+ return /* @__PURE__ */ jsx18(CollapsibleContent, {
1426
+ "data-slot": "trace-collapsible-content",
1427
+ className: "h-(--collapsible-panel-height) min-w-0 overflow-hidden transition-[height] duration-200 data-ending-style:h-0 data-starting-style:h-0",
1428
+ ...props,
1429
+ children: /* @__PURE__ */ jsx18("div", {
1430
+ "data-slot": "trace-collapsible-content-inner",
1431
+ className: cn4("mt-2 mb-1 ml-[calc(--spacing(2)-1px)] min-w-0 border-l pr-1 pl-4 leading-relaxed wrap-break-word text-muted-foreground", className),
1432
+ children
1433
+ })
1434
+ });
1435
+ }
1436
+
1437
+ // ../../src/services/agent/schema.ts
1438
+ import { Schema as Schema3 } from "effect";
1439
+ import {
1440
+ HttpApiEndpoint,
1441
+ HttpApiError,
1442
+ HttpApiGroup,
1443
+ HttpApiSchema,
1444
+ OpenApi
1445
+ } from "effect/http-api";
1446
+ var AgentMessageText = Schema3.String.check(Schema3.isBetweenLength(1, 4000)).annotate({
1447
+ identifier: "AgentMessageText",
1448
+ title: "Agent message",
1449
+ description: "A user message sent to the agent."
1450
+ });
1451
+ var AgentReferenceLabel = Schema3.String.check(Schema3.isBetweenLength(1, 500));
1452
+ var AGENT_REFERENCE_LIMIT = 20;
1453
+ var AgentToolMetadata = Schema3.Struct({
1454
+ title: Schema3.optional(Schema3.String),
1455
+ description: Schema3.optional(Schema3.String),
1456
+ destructive: Schema3.Boolean
1457
+ }).annotate({ identifier: "AgentToolMetadata" });
1458
+ var AgentMarkdownCodeBlock = Schema3.Struct({
1459
+ code: Schema3.String,
1460
+ language: Schema3.String
1461
+ }).annotate({ identifier: "AgentMarkdownCodeBlock" });
1462
+ var AgentEvent = Schema3.Union([
1463
+ Schema3.Struct({ type: Schema3.Literal("heartbeat") }),
1464
+ Schema3.Struct({
1465
+ type: Schema3.Literal("message-start"),
1466
+ messageId: Schema3.String
1467
+ }),
1468
+ Schema3.Struct({
1469
+ type: Schema3.Literal("text-delta"),
1470
+ messageId: Schema3.String,
1471
+ delta: Schema3.String
1472
+ }),
1473
+ Schema3.Struct({
1474
+ type: Schema3.Literal("markdown-snapshot"),
1475
+ messageId: Schema3.String,
1476
+ html: Schema3.String,
1477
+ codeBlocks: Schema3.Array(AgentMarkdownCodeBlock)
1478
+ }),
1479
+ Schema3.Struct({
1480
+ type: Schema3.Literal("tool-call"),
1481
+ messageId: Schema3.String,
1482
+ toolCallId: Schema3.String,
1483
+ name: Schema3.String,
1484
+ input: Schema3.Unknown,
1485
+ metadata: AgentToolMetadata
1486
+ }),
1487
+ Schema3.Struct({
1488
+ type: Schema3.Literal("tool-result"),
1489
+ toolCallId: Schema3.String,
1490
+ name: Schema3.String,
1491
+ isFailure: Schema3.Boolean
1492
+ }),
1493
+ Schema3.Struct({
1494
+ type: Schema3.Literal("approval-required"),
1495
+ approvalId: Schema3.String,
1496
+ toolCallId: Schema3.String
1497
+ }),
1498
+ Schema3.Struct({
1499
+ type: Schema3.Literal("history"),
1500
+ value: Schema3.String
1501
+ }),
1502
+ Schema3.Struct({ type: Schema3.Literal("finish") }),
1503
+ Schema3.Struct({
1504
+ type: Schema3.Literal("error"),
1505
+ code: Schema3.Literals(["unavailable", "invalid-request", "stream-failed"])
1506
+ })
1507
+ ]).annotate({
1508
+ identifier: "AgentEvent",
1509
+ title: "Agent stream event",
1510
+ description: "An event emitted by the agent endpoint."
1511
+ });
1512
+ var AgentStreamError = Schema3.Struct({
1513
+ code: Schema3.Literals(["unavailable", "stream-failed"])
1514
+ }).annotate({
1515
+ identifier: "AgentStreamError",
1516
+ title: "Agent stream error",
1517
+ description: "A recoverable agent stream failure."
1518
+ });
1519
+
1520
+ // ../../src/components/agent/react.tsx
1521
+ import { useKrakstackLocale as useKrakstackLocale3 } from "@krak-stack/registry/krakstack-provider/react";
1522
+
1523
+ // ../../src/components/agent/index.ts
1524
+ import { Context, Effect as Effect3, Layer, Redacted as Redacted3, Schema as Schema5, Stream } from "effect";
1525
+ import { AtomRegistry } from "effect/reactivity";
1526
+ import { Command as Command3, Component as Component3, Subscription, UiSchema as UiSchema2 } from "effect/ui";
1527
+
1528
+ // ../../src/components/agent/schema.ts
1529
+ import { Schema as Schema4 } from "effect";
1530
+ var AgentWidgetSharedPropsSchema = Schema4.Struct({
1531
+ locale: Schema4.optional(Schema4.String)
1532
+ }).annotate({ identifier: "AgentWidgetSharedProps" });
1533
+ var AgentWidgetSnapshotSchema = Schema4.Struct({
1534
+ context: Schema4.optional(Schema4.Struct({ key: Schema4.String, label: Schema4.String })),
1535
+ availableReferences: Schema4.Array(Schema4.Struct({ key: Schema4.String, label: Schema4.String })),
1536
+ contextLocked: Schema4.Boolean,
1537
+ pending: Schema4.Boolean,
1538
+ error: Schema4.optional(Schema4.Literals(["invalid-request", "stream-failed", "unavailable"])),
1539
+ messages: Schema4.Array(Schema4.Struct({
1540
+ id: Schema4.String,
1541
+ role: Schema4.Literals(["user", "assistant"]),
1542
+ text: Schema4.String,
1543
+ markdown: Schema4.optional(Schema4.Struct({
1544
+ html: Schema4.String,
1545
+ codeBlocks: Schema4.Array(AgentMarkdownCodeBlock)
1546
+ })),
1547
+ tools: Schema4.Array(Schema4.Struct({
1548
+ type: Schema4.Literal("tool-call"),
1549
+ toolCallId: Schema4.String,
1550
+ messageId: Schema4.String,
1551
+ name: Schema4.String,
1552
+ input: Schema4.Unknown,
1553
+ metadata: AgentToolMetadata,
1554
+ approvalId: Schema4.optional(Schema4.String),
1555
+ status: Schema4.Literals([
1556
+ "running",
1557
+ "approval-required",
1558
+ "approved",
1559
+ "denied",
1560
+ "completed",
1561
+ "failed"
1562
+ ])
1563
+ }))
1564
+ }))
1565
+ }).annotate({ identifier: "AgentWidgetSnapshot" });
1566
+ var AgentWidgetDraftSchema = Schema4.Redacted(Schema4.String, {
1567
+ disallowJsonEncode: true
1568
+ });
1569
+ var AgentWidgetTextSchema = Schema4.String.check(Schema4.isBetweenLength(1, 4000)).annotate({ identifier: "AgentWidgetText" });
1570
+ var AgentWidgetIntentSchema = Schema4.Union([
1571
+ Schema4.TaggedStruct("Submit", {
1572
+ text: Schema4.Redacted(AgentWidgetTextSchema, { disallowJsonEncode: true }),
1573
+ referenceKeys: Schema4.Array(Schema4.String).check(Schema4.isMaxLength(AGENT_REFERENCE_LIMIT))
1574
+ }),
1575
+ Schema4.TaggedStruct("DecideApproval", {
1576
+ approvalId: Schema4.String,
1577
+ toolCallId: Schema4.String,
1578
+ approved: Schema4.Boolean
1579
+ }),
1580
+ Schema4.TaggedStruct("Interrupt", {}),
1581
+ Schema4.TaggedStruct("Reset", {}),
1582
+ Schema4.TaggedStruct("RemoveContext", {})
1583
+ ]).annotate({ identifier: "AgentWidgetIntent" });
1584
+
1585
+ // ../../src/components/agent/index.ts
1586
+ class ConversationHost extends Context.Service()("agent/ConversationHost") {
1587
+ static layer = (host) => Layer.merge(Layer.succeed(ConversationHost, host), DispatchIntent.toLayer(({ intent }) => Effect3.suspend(() => host.dispatch(intent)).pipe(Effect3.match({
1588
+ onSuccess: () => AgentWidgetMessage.Delivered({ success: true }),
1589
+ onFailure: () => AgentWidgetMessage.Delivered({ success: false })
1590
+ }))));
1591
+ }
1592
+ var hasPendingApproval = (messages) => messages.some((message) => message.tools.some((tool) => tool.status === "approval-required"));
1593
+ var agentDraftText = (input) => input.trim();
1594
+ var agentToolInput = (input) => JSON.stringify(input, null, 2) ?? String(input);
1595
+ var defaultMessages = {
1596
+ en: {
1597
+ approve: "Approve",
1598
+ approved: "Approved",
1599
+ approvalDestructive: "This may permanently remove data. Check the action before continuing.",
1600
+ approvalDestructiveLabel: "Destructive",
1601
+ approvalRequired: "The assistant needs your confirmation before making this change.",
1602
+ cancel: "Cancel",
1603
+ close: "Close",
1604
+ completed: "Completed",
1605
+ conversation: "Conversation",
1606
+ description: "Ask questions and use available tools to get things done.",
1607
+ errors: {
1608
+ "invalid-request": "The request could not be processed. Start a new conversation and try again.",
1609
+ "stream-failed": "The response was interrupted. Please try again.",
1610
+ unavailable: "The assistant is currently unavailable."
1611
+ },
1612
+ maximize: "Maximize assistant",
1613
+ open: "Open AI Assistant",
1614
+ placeholder: "Ask a question...",
1615
+ removeContext: "Remove context",
1616
+ references: "References",
1617
+ reset: "New conversation",
1618
+ restore: "Restore assistant window",
1619
+ send: "Send message",
1620
+ stop: "Stop response",
1621
+ title: "AI Assistant",
1622
+ toolActivity: "Tool activity",
1623
+ toolDenied: "Cancelled",
1624
+ toolFailed: "Failed",
1625
+ toolRunning: "Working",
1626
+ viewMore: "View more",
1627
+ welcome: "How can I help?",
1628
+ you: "You"
1629
+ },
1630
+ fr: {
1631
+ approve: "Approuver",
1632
+ approved: "Approuvé",
1633
+ approvalDestructive: "Cette action peut supprimer définitivement des données. Vérifiez-la avant de continuer.",
1634
+ approvalDestructiveLabel: "Destructif",
1635
+ approvalRequired: "L'assistant a besoin de votre confirmation avant d'effectuer cette modification.",
1636
+ cancel: "Annuler",
1637
+ close: "Fermer",
1638
+ completed: "Terminé",
1639
+ conversation: "Conversation",
1640
+ description: "Posez des questions et utilisez les outils disponibles pour accomplir vos tâches.",
1641
+ errors: {
1642
+ "invalid-request": "La demande n'a pas pu être traitée. Commencez une nouvelle conversation et réessayez.",
1643
+ "stream-failed": "La réponse a été interrompue. Veuillez réessayer.",
1644
+ unavailable: "L'assistant est actuellement indisponible."
1645
+ },
1646
+ maximize: "Agrandir l'assistant",
1647
+ open: "Ouvrir l'assistant IA",
1648
+ placeholder: "Posez une question...",
1649
+ removeContext: "Supprimer le contexte",
1650
+ references: "Références",
1651
+ reset: "Nouvelle conversation",
1652
+ restore: "Restaurer la fenêtre de l'assistant",
1653
+ send: "Envoyer le message",
1654
+ stop: "Arrêter la réponse",
1655
+ title: "Assistant IA",
1656
+ toolActivity: "Activité des outils",
1657
+ toolDenied: "Annulé",
1658
+ toolFailed: "Échec",
1659
+ toolRunning: "En cours",
1660
+ viewMore: "Voir plus",
1661
+ welcome: "Comment puis-je vous aider?",
1662
+ you: "Vous"
1663
+ }
1664
+ };
1665
+ var visibleSnapshot = Schema5.Redacted(AgentWidgetSnapshotSchema, {
1666
+ disallowJsonEncode: true
1667
+ });
1668
+ var AgentWidgetMessage = UiSchema2.TaggedEnum({
1669
+ Received: { snapshot: visibleSnapshot },
1670
+ Disconnected: {},
1671
+ OpenChanged: { open: Schema5.Boolean },
1672
+ ToggleMaximize: {},
1673
+ DraftChanged: { value: AgentWidgetDraftSchema },
1674
+ ReferenceToggled: { key: Schema5.String },
1675
+ Send: {},
1676
+ Approval: {
1677
+ approvalId: Schema5.String,
1678
+ toolCallId: Schema5.String,
1679
+ approved: Schema5.Boolean
1680
+ },
1681
+ Interrupt: {},
1682
+ Reset: {},
1683
+ RemoveContext: {},
1684
+ Delivered: { success: Schema5.Boolean }
1685
+ }).annotate({ identifier: "AgentWidgetMessage" });
1686
+
1687
+ class DispatchIntent extends Command3.Service()("agent/DispatchIntent", { args: { intent: AgentWidgetIntentSchema }, success: AgentWidgetMessage }) {
1688
+ }
1689
+ var agentWidgetOptions = {
1690
+ name: "AgentWidget",
1691
+ props: AgentWidgetSharedPropsSchema,
1692
+ model: Schema5.Struct({
1693
+ snapshot: Schema5.NullOr(visibleSnapshot),
1694
+ draft: AgentWidgetDraftSchema,
1695
+ references: Schema5.Array(Schema5.String),
1696
+ sending: Schema5.NullOr(Schema5.Literals([
1697
+ "Submit",
1698
+ "DecideApproval",
1699
+ "Interrupt",
1700
+ "Reset",
1701
+ "RemoveContext"
1702
+ ])),
1703
+ open: Schema5.Boolean,
1704
+ maximized: Schema5.Boolean,
1705
+ deliveryFailed: Schema5.Boolean,
1706
+ disconnected: Schema5.Boolean
1707
+ }).annotate({ identifier: "AgentWidgetModel" }),
1708
+ message: AgentWidgetMessage,
1709
+ restore: false
1710
+ };
1711
+ var Definition2 = Component3.define(agentWidgetOptions);
1712
+ var readAgentWidgetSnapshot = (model) => model.snapshot && Redacted3.value(model.snapshot);
1713
+ var canCompose = (model) => {
1714
+ const snapshot = readAgentWidgetSnapshot(model);
1715
+ return !!snapshot && !snapshot.pending && !hasPendingApproval(snapshot.messages) && !model.sending && !model.disconnected;
1716
+ };
1717
+ var canSend = (model) => canCompose(model) && Schema5.is(AgentWidgetTextSchema)(agentDraftText(Redacted3.value(model.draft)));
1718
+ var clearComposer = { draft: Redacted3.make(""), references: [] };
1719
+ var allowedKeys = (snapshot) => snapshot.availableReferences.filter(({ key }) => key !== snapshot.context?.key).map(({ key }) => key);
1720
+ var sendIntent = ($, intent) => $.evolve({ sending: intent._tag, deliveryFailed: false }).run(DispatchIntent.make({ intent }));
1721
+ var agentWidgetBehaviours = {
1722
+ init: () => ({
1723
+ ...clearComposer,
1724
+ snapshot: null,
1725
+ sending: null,
1726
+ deliveryFailed: false,
1727
+ disconnected: false,
1728
+ open: false,
1729
+ maximized: false
1730
+ }),
1731
+ subscriptions: () => [
1732
+ Subscription.make("agent/conversation", Stream.unwrap(Effect3.map(ConversationHost, (host) => host.snapshots.pipe(Stream.map((snapshot) => AgentWidgetMessage.Received({
1733
+ snapshot: Redacted3.make(snapshot)
1734
+ })), Stream.concat(Stream.make(AgentWidgetMessage.Disconnected()))))))
1735
+ ],
1736
+ update: Definition2.update({
1737
+ Received: ($, { snapshot }) => {
1738
+ const valid = new Set(allowedKeys(Redacted3.value(snapshot)));
1739
+ return $.evolve({
1740
+ snapshot,
1741
+ references: $.model.references.filter((key) => valid.has(key))
1742
+ });
1743
+ },
1744
+ Disconnected: ($) => $.evolve({ disconnected: true }),
1745
+ OpenChanged: ($, { open }) => $.evolve({ open }),
1746
+ ToggleMaximize: ($) => $.evolve({ maximized: !$.model.maximized }),
1747
+ DraftChanged: ($, { value }) => canCompose($.model) ? $.evolve({ draft: value }) : $.model,
1748
+ ReferenceToggled: ($, { key }) => {
1749
+ const snapshot = readAgentWidgetSnapshot($.model);
1750
+ const { references } = $.model;
1751
+ if (!canCompose($.model) || !snapshot || !allowedKeys(snapshot).includes(key))
1752
+ return $.model;
1753
+ if (references.includes(key))
1754
+ return $.evolve({
1755
+ references: references.filter((entry) => entry !== key)
1756
+ });
1757
+ return references.length < AGENT_REFERENCE_LIMIT ? $.evolve({ references: [...references, key] }) : $.model;
1758
+ },
1759
+ Send: ($) => canSend($.model) ? sendIntent($, {
1760
+ _tag: "Submit",
1761
+ text: Redacted3.make(agentDraftText(Redacted3.value($.model.draft))),
1762
+ referenceKeys: $.model.references
1763
+ }) : $.model,
1764
+ Approval: ($, { approved, approvalId, toolCallId }) => {
1765
+ const snapshot = readAgentWidgetSnapshot($.model);
1766
+ return !snapshot?.pending && !$.model.sending && !$.model.disconnected && snapshot?.messages.some(({ tools }) => tools.some((tool) => tool.status === "approval-required" && tool.approvalId === approvalId && tool.toolCallId === toolCallId)) ? sendIntent($, {
1767
+ _tag: "DecideApproval",
1768
+ approved,
1769
+ approvalId,
1770
+ toolCallId
1771
+ }) : $.model;
1772
+ },
1773
+ Interrupt: ($) => !$.model.sending && !$.model.disconnected && readAgentWidgetSnapshot($.model)?.pending ? sendIntent($, { _tag: "Interrupt" }) : $.model,
1774
+ Reset: ($) => !$.model.sending && !$.model.disconnected && $.model.snapshot ? sendIntent($, { _tag: "Reset" }) : $.model,
1775
+ RemoveContext: ($) => {
1776
+ const snapshot = readAgentWidgetSnapshot($.model);
1777
+ return snapshot?.context && !snapshot.contextLocked && canCompose($.model) ? sendIntent($, { _tag: "RemoveContext" }) : $.model;
1778
+ },
1779
+ Delivered: ($, { success }) => $.evolve({
1780
+ ...success && ($.model.sending === "Submit" || $.model.sending === "Reset") ? clearComposer : {},
1781
+ sending: null,
1782
+ deliveryFailed: !success
1783
+ })
1784
+ })
1785
+ };
1786
+
1787
+ // ../../src/components/agent/react.tsx
1788
+ import { jsx as jsx19, jsxs as jsxs7 } from "react/jsx-runtime";
1789
+ var messages2 = {
1790
+ en: {
1791
+ codeDescription: (language) => `${language} code`,
1792
+ copied: "Copied",
1793
+ copy: "Copy",
1794
+ minimize: "Minimize assistant",
1795
+ noReferences: "No references found.",
1796
+ scrollLatest: "Scroll to latest message",
1797
+ toolWorked: (seconds) => `Worked for ${seconds} ${seconds === 1 ? "second" : "seconds"}`,
1798
+ viewLess: "View less"
1799
+ },
1800
+ fr: {
1801
+ codeDescription: (language) => `code ${language}`,
1802
+ copied: "Copié",
1803
+ copy: "Copier",
1804
+ minimize: "Réduire l'assistant",
1805
+ noReferences: "Aucune référence trouvée.",
1806
+ scrollLatest: "Défiler jusqu'au dernier message",
1807
+ toolWorked: (seconds) => `A travaillé pendant ${seconds} ${seconds === 1 ? "seconde" : "secondes"}`,
1808
+ viewLess: "Voir moins"
1809
+ }
1810
+ };
1811
+ var agentWidgetMessages = (locale = "en", translations) => {
1812
+ const language = locale.startsWith("fr") ? "fr" : "en";
1813
+ const {
1814
+ approved: _approved,
1815
+ completed: _completed,
1816
+ conversation: _conversation,
1817
+ errors,
1818
+ reset: _reset,
1819
+ you: _you,
1820
+ ...shared
1821
+ } = defaultMessages[language];
1822
+ return {
1823
+ ...shared,
1824
+ ...messages2[language],
1825
+ errorInvalidRequest: errors["invalid-request"],
1826
+ errorStreamFailed: errors["stream-failed"],
1827
+ errorUnavailable: errors.unavailable,
1828
+ ...translations?.[locale.split("-")[0] ?? locale],
1829
+ ...translations?.[locale]
1830
+ };
1831
+ };
1832
+ var errorMessage = (code, labels) => {
1833
+ switch (code) {
1834
+ case "invalid-request":
1835
+ return labels.errorInvalidRequest;
1836
+ case "stream-failed":
1837
+ return labels.errorStreamFailed;
1838
+ case "unavailable":
1839
+ return labels.errorUnavailable;
1840
+ }
1841
+ };
1842
+ var escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1843
+ var referenceMentionPattern = (label) => new RegExp(`@${escapeRegExp(label)}(?![\\p{L}\\p{N}_-])`, "u");
1844
+ var hasReferenceMention = (input, label) => referenceMentionPattern(label).test(input);
1845
+ var highlightedInput = (input, references) => {
1846
+ const mentions = references.map(({ label }) => `@${label}`).sort((left, right) => right.length - left.length);
1847
+ if (mentions.length === 0)
1848
+ return input;
1849
+ const mentionPattern = new RegExp(`(${mentions.map(escapeRegExp).join("|")})(?![\\p{L}\\p{N}_-])`, "gu");
1850
+ const mentionSet = new Set(mentions);
1851
+ return input.split(mentionPattern).map((part, index) => mentionSet.has(part) ? /* @__PURE__ */ jsx19("span", {
1852
+ className: "bg-primary text-primary-foreground rounded-sm [box-shadow:2px_0_0_var(--primary),-2px_0_0_var(--primary)]",
1853
+ children: part
1854
+ }, `${part}:${index}`) : part);
1855
+ };
1856
+ var referenceSearchAtCursor = (input, cursor) => {
1857
+ const beforeCursor = input.slice(0, cursor);
1858
+ const match = beforeCursor.match(/(?:^|\s)@([^@\n]*)$/);
1859
+ if (!match)
1860
+ return;
1861
+ return {
1862
+ start: beforeCursor.lastIndexOf("@"),
1863
+ end: cursor,
1864
+ query: match[1].trimEnd()
1865
+ };
1866
+ };
1867
+ var insertReferenceMention = (input, search, label) => {
1868
+ const suffix = input.slice(search.end);
1869
+ const mention = `@${label}`;
1870
+ const separator = /^[ \t]/.test(suffix) ? "" : " ";
1871
+ return {
1872
+ input: `${input.slice(0, search.start)}${mention}${separator}${suffix}`,
1873
+ cursor: search.start + mention.length + 1
1874
+ };
1875
+ };
1876
+ var completesSelectedReference = (input, search, references) => {
1877
+ const searchText = input.slice(search.start + 1, search.end);
1878
+ return references.some(({ label }) => searchText.startsWith(`${label} `));
1879
+ };
1880
+ var ToolInput = ({
1881
+ labels,
1882
+ locale,
1883
+ tool
1884
+ }) => /* @__PURE__ */ jsxs7("div", {
1885
+ className: "min-w-0 space-y-2",
1886
+ children: [
1887
+ tool.metadata.description ? /* @__PURE__ */ jsx19("p", {
1888
+ children: tool.metadata.description
1889
+ }) : null,
1890
+ /* @__PURE__ */ jsx19(CodeBlock, {
1891
+ code: agentToolInput(tool.input),
1892
+ language: "json",
1893
+ locale,
1894
+ messages: {
1895
+ [locale]: {
1896
+ codeDescription: labels.codeDescription,
1897
+ copied: labels.copied,
1898
+ copy: labels.copy
1899
+ }
1900
+ }
1901
+ })
1902
+ ]
1903
+ });
1904
+ var ToolApproval = ({
1905
+ disabled,
1906
+ labels,
1907
+ locale,
1908
+ onApproval,
1909
+ tool
1910
+ }) => /* @__PURE__ */ jsxs7(Item, {
1911
+ variant: "outline",
1912
+ size: "sm",
1913
+ role: "group",
1914
+ "aria-label": tool.metadata.title ?? tool.name,
1915
+ children: [
1916
+ /* @__PURE__ */ jsx19(ItemMedia, {
1917
+ variant: "icon",
1918
+ children: /* @__PURE__ */ jsx19(WrenchIcon, {})
1919
+ }),
1920
+ /* @__PURE__ */ jsxs7(ItemContent, {
1921
+ className: "min-w-0",
1922
+ children: [
1923
+ /* @__PURE__ */ jsxs7(ItemTitle, {
1924
+ className: "line-clamp-none",
1925
+ children: [
1926
+ tool.metadata.title ?? tool.name,
1927
+ tool.metadata.destructive ? /* @__PURE__ */ jsx19(Badge, {
1928
+ variant: "destructive",
1929
+ children: labels.approvalDestructiveLabel
1930
+ }) : null
1931
+ ]
1932
+ }),
1933
+ /* @__PURE__ */ jsx19(ItemDescription, {
1934
+ className: "line-clamp-none",
1935
+ children: tool.metadata.destructive ? labels.approvalDestructive : labels.approvalRequired
1936
+ })
1937
+ ]
1938
+ }),
1939
+ /* @__PURE__ */ jsxs7(ItemActions, {
1940
+ children: [
1941
+ /* @__PURE__ */ jsx19(Button, {
1942
+ size: "sm",
1943
+ variant: tool.metadata.destructive ? "destructive" : "default",
1944
+ disabled,
1945
+ onClick: () => onApproval(tool, true),
1946
+ children: labels.approve
1947
+ }),
1948
+ /* @__PURE__ */ jsx19(Button, {
1949
+ size: "sm",
1950
+ variant: "outline",
1951
+ disabled,
1952
+ onClick: () => onApproval(tool, false),
1953
+ children: labels.cancel
1954
+ })
1955
+ ]
1956
+ }),
1957
+ /* @__PURE__ */ jsx19(ItemFooter, {
1958
+ className: "block min-w-0",
1959
+ children: /* @__PURE__ */ jsx19(Trace, {
1960
+ children: /* @__PURE__ */ jsxs7(TraceCollapsible, {
1961
+ children: [
1962
+ /* @__PURE__ */ jsx19(TraceCollapsibleTrigger, {
1963
+ children: /* @__PURE__ */ jsx19(TraceLine, {
1964
+ children: /* @__PURE__ */ jsx19(TraceTitle, {
1965
+ children: labels.viewMore
1966
+ })
1967
+ })
1968
+ }),
1969
+ /* @__PURE__ */ jsx19(TraceCollapsibleContent, {
1970
+ children: /* @__PURE__ */ jsx19(ToolInput, {
1971
+ labels,
1972
+ locale,
1973
+ tool
1974
+ })
1975
+ })
1976
+ ]
1977
+ })
1978
+ })
1979
+ })
1980
+ ]
1981
+ });
1982
+ var ToolActivity = ({
1983
+ labels,
1984
+ locale,
1985
+ pending,
1986
+ tool
1987
+ }) => {
1988
+ const running = pending && (tool.status === "running" || tool.status === "approved");
1989
+ const statusLabel = tool.status === "failed" ? labels.toolFailed : tool.status === "denied" ? labels.toolDenied : running ? labels.toolRunning : undefined;
1990
+ const line = /* @__PURE__ */ jsxs7(TraceLine, {
1991
+ status: tool.status === "failed" ? "error" : running ? "running" : undefined,
1992
+ children: [
1993
+ /* @__PURE__ */ jsx19(TraceIcon, {
1994
+ children: /* @__PURE__ */ jsx19(WrenchIcon, {})
1995
+ }),
1996
+ /* @__PURE__ */ jsx19(TraceTitle, {
1997
+ children: tool.metadata.title ?? tool.name
1998
+ }),
1999
+ statusLabel ? /* @__PURE__ */ jsx19(TraceDescription, {
2000
+ children: statusLabel
2001
+ }) : null
2002
+ ]
2003
+ });
2004
+ if (running)
2005
+ return line;
2006
+ return /* @__PURE__ */ jsxs7(TraceCollapsible, {
2007
+ children: [
2008
+ /* @__PURE__ */ jsx19(TraceCollapsibleTrigger, {
2009
+ children: line
2010
+ }),
2011
+ /* @__PURE__ */ jsx19(TraceCollapsibleContent, {
2012
+ children: /* @__PURE__ */ jsx19(ToolInput, {
2013
+ labels,
2014
+ locale,
2015
+ tool
2016
+ })
2017
+ })
2018
+ ]
2019
+ });
2020
+ };
2021
+ function ToolActivityLog({
2022
+ disabled,
2023
+ labels,
2024
+ locale,
2025
+ onApproval,
2026
+ pending,
2027
+ tools,
2028
+ workedSeconds
2029
+ }) {
2030
+ const [open, setOpen] = useState3();
2031
+ const approvals = tools.filter((tool) => tool.status === "approval-required");
2032
+ const activity = tools.filter((tool) => tool.status !== "approval-required");
2033
+ const currentTool = activity.at(-1);
2034
+ const running = pending && approvals.length === 0;
2035
+ const failed = activity.some((tool) => tool.status === "failed");
2036
+ if (tools.length === 0) {
2037
+ return /* @__PURE__ */ jsx19(Trace, {
2038
+ children: /* @__PURE__ */ jsxs7(TraceLine, {
2039
+ status: pending ? "running" : undefined,
2040
+ children: [
2041
+ /* @__PURE__ */ jsx19(TraceIcon, {
2042
+ children: /* @__PURE__ */ jsx19(WrenchIcon, {})
2043
+ }),
2044
+ /* @__PURE__ */ jsx19(TraceTitle, {
2045
+ children: labels.toolRunning
2046
+ })
2047
+ ]
2048
+ })
2049
+ });
2050
+ }
2051
+ return /* @__PURE__ */ jsxs7("div", {
2052
+ className: "flex flex-col gap-2",
2053
+ children: [
2054
+ currentTool ? /* @__PURE__ */ jsx19(Trace, {
2055
+ children: /* @__PURE__ */ jsxs7(TraceCollapsible, {
2056
+ open: open ?? running,
2057
+ onOpenChange: setOpen,
2058
+ children: [
2059
+ /* @__PURE__ */ jsx19(TraceCollapsibleTrigger, {
2060
+ children: /* @__PURE__ */ jsxs7(TraceLine, {
2061
+ status: failed ? "error" : running ? "running" : undefined,
2062
+ children: [
2063
+ /* @__PURE__ */ jsx19(TraceIcon, {
2064
+ children: /* @__PURE__ */ jsx19(WrenchIcon, {})
2065
+ }),
2066
+ /* @__PURE__ */ jsx19(TraceTitle, {
2067
+ children: approvals.length > 0 || running ? labels.toolActivity : workedSeconds !== undefined ? labels.toolWorked(workedSeconds) : currentTool.metadata.title ?? currentTool.name
2068
+ }),
2069
+ failed || running ? /* @__PURE__ */ jsx19(TraceDescription, {
2070
+ children: failed ? labels.toolFailed : labels.toolRunning
2071
+ }) : null
2072
+ ]
2073
+ })
2074
+ }),
2075
+ /* @__PURE__ */ jsx19(TraceCollapsibleContent, {
2076
+ children: /* @__PURE__ */ jsx19(Trace, {
2077
+ children: activity.map((tool) => /* @__PURE__ */ jsx19(ToolActivity, {
2078
+ labels,
2079
+ locale,
2080
+ pending,
2081
+ tool
2082
+ }, tool.toolCallId))
2083
+ })
2084
+ })
2085
+ ]
2086
+ })
2087
+ }) : null,
2088
+ approvals.map((tool) => /* @__PURE__ */ jsx19(ToolApproval, {
2089
+ disabled,
2090
+ labels,
2091
+ locale,
2092
+ onApproval,
2093
+ tool
2094
+ }, tool.toolCallId))
2095
+ ]
2096
+ });
2097
+ }
2098
+ function AgentMessageRow({
2099
+ disabled,
2100
+ labels,
2101
+ locale,
2102
+ message,
2103
+ onApproval,
2104
+ pending
2105
+ }) {
2106
+ const isUser = message.role === "user";
2107
+ const activeStartedAt = useRef3(undefined);
2108
+ const activeMilliseconds = useRef3(0);
2109
+ const wasPending = useRef3(pending);
2110
+ const [workedSeconds, setWorkedSeconds] = useState3();
2111
+ const hasPendingApproval = message.tools.some((tool) => tool.status === "approval-required");
2112
+ useEffect2(() => {
2113
+ const isWorking = pending && !hasPendingApproval;
2114
+ if (isWorking) {
2115
+ wasPending.current = true;
2116
+ activeStartedAt.current ??= Date.now();
2117
+ return;
2118
+ }
2119
+ if (activeStartedAt.current !== undefined) {
2120
+ activeMilliseconds.current += Date.now() - activeStartedAt.current;
2121
+ activeStartedAt.current = undefined;
2122
+ }
2123
+ const completed = !isUser && message.tools.length > 0 && !hasPendingApproval && (message.text.length > 0 || !pending);
2124
+ if (!completed || !wasPending.current || workedSeconds !== undefined) {
2125
+ return;
2126
+ }
2127
+ setWorkedSeconds(Math.max(1, Math.round(activeMilliseconds.current / 1000)));
2128
+ }, [
2129
+ hasPendingApproval,
2130
+ isUser,
2131
+ message.text,
2132
+ message.tools.length,
2133
+ pending,
2134
+ workedSeconds
2135
+ ]);
2136
+ return /* @__PURE__ */ jsx19(Message, {
2137
+ align: isUser ? "end" : "start",
2138
+ children: /* @__PURE__ */ jsxs7(MessageContent, {
2139
+ children: [
2140
+ !isUser && (message.tools.length > 0 || pending && !message.text) ? /* @__PURE__ */ jsx19(ToolActivityLog, {
2141
+ disabled,
2142
+ labels,
2143
+ locale,
2144
+ onApproval,
2145
+ pending,
2146
+ tools: message.tools,
2147
+ workedSeconds
2148
+ }) : null,
2149
+ message.text ? isUser ? /* @__PURE__ */ jsx19(Bubble, {
2150
+ align: "end",
2151
+ children: /* @__PURE__ */ jsx19(BubbleContent, {
2152
+ className: "whitespace-pre-wrap",
2153
+ children: message.text
2154
+ })
2155
+ }) : /* @__PURE__ */ jsx19(Bubble, {
2156
+ variant: "ghost",
2157
+ className: "w-full",
2158
+ children: /* @__PURE__ */ jsx19(BubbleContent, {
2159
+ className: "w-full",
2160
+ children: message.markdown ? /* @__PURE__ */ jsx19(MarkdownContent, {
2161
+ className: "w-full",
2162
+ codeBlocks: message.markdown.codeBlocks,
2163
+ html: message.markdown.html,
2164
+ messages: {
2165
+ [locale]: {
2166
+ codeDescription: labels.codeDescription,
2167
+ copied: labels.copied,
2168
+ copy: labels.copy
2169
+ }
2170
+ },
2171
+ locale
2172
+ }) : /* @__PURE__ */ jsx19("div", {
2173
+ className: "whitespace-pre-wrap",
2174
+ children: message.text
2175
+ })
2176
+ })
2177
+ }) : null
2178
+ ]
2179
+ })
2180
+ });
2181
+ }
2182
+ function AgentWidget({
2183
+ availableReferences = [],
2184
+ context,
2185
+ locale: localeOverride,
2186
+ messages: messageOverrides,
2187
+ onInterrupt,
2188
+ onRemoveContext,
2189
+ onReset,
2190
+ onSubmit,
2191
+ state
2192
+ }) {
2193
+ const locale = useKrakstackLocale3(localeOverride);
2194
+ const labels = agentWidgetMessages(locale, messageOverrides);
2195
+ const referenceInputId = useId();
2196
+ const referenceListId = `${referenceInputId}-list`;
2197
+ const [open, setOpen] = useState3(false);
2198
+ const [maximized, setMaximized] = useState3(false);
2199
+ const [referencePickerOpen, setReferencePickerOpen] = useState3(false);
2200
+ const [activeReferenceKey, setActiveReferenceKey] = useState3("");
2201
+ const [activeReferenceSearch, setActiveReferenceSearch] = useState3();
2202
+ const [input, setInput] = useState3("");
2203
+ const inputRef = useRef3(null);
2204
+ const inputOverlayRef = useRef3(null);
2205
+ const [references, setReferences] = useState3([]);
2206
+ const activeContext = state.contextLocked ? state.context ? {
2207
+ ...state.context,
2208
+ icon: availableReferences.find(({ key }) => key === state.context?.key)?.icon
2209
+ } : undefined : context;
2210
+ const referenceQuery = activeReferenceSearch?.query;
2211
+ const selectedKeys = new Set(references.map(({ key }) => key));
2212
+ const selectedLabels = new Set(references.map(({ label }) => label));
2213
+ const selectableReferences = availableReferences.filter((reference) => references.length < AGENT_REFERENCE_LIMIT && reference.key !== activeContext?.key && !selectedKeys.has(reference.key) && !selectedLabels.has(reference.label));
2214
+ const matchingReferences = selectableReferences.filter((reference) => referenceQuery === undefined ? false : `${reference.label} ${reference.key}`.toLocaleLowerCase().includes(referenceQuery.toLocaleLowerCase()));
2215
+ const activeReferenceIndex = Math.max(0, matchingReferences.findIndex((reference) => reference.key === activeReferenceKey));
2216
+ const activeReference = matchingReferences[activeReferenceIndex];
2217
+ const hasPendingApproval2 = hasPendingApproval(state.messages);
2218
+ const sendMessage = () => {
2219
+ const text = agentDraftText(input);
2220
+ if (!text || state.pending || hasPendingApproval2)
2221
+ return;
2222
+ setInput("");
2223
+ setReferences([]);
2224
+ setActiveReferenceSearch(undefined);
2225
+ setReferencePickerOpen(false);
2226
+ const messageReferences = references.length > 0 ? references.map(({ label, resource }) => ({ label, resource })) : undefined;
2227
+ const action = {
2228
+ type: "message",
2229
+ text,
2230
+ references: messageReferences
2231
+ };
2232
+ onSubmit(action);
2233
+ };
2234
+ const respondToApproval = (tool, approved) => {
2235
+ if (!tool.approvalId || state.pending)
2236
+ return;
2237
+ onSubmit({
2238
+ type: "approval",
2239
+ approvalId: tool.approvalId,
2240
+ toolCallId: tool.toolCallId,
2241
+ approved
2242
+ });
2243
+ };
2244
+ const selectReference = (reference) => {
2245
+ if (!activeReferenceSearch)
2246
+ return;
2247
+ const replacement = insertReferenceMention(input, activeReferenceSearch, reference.label);
2248
+ setReferences((current) => [...current, reference]);
2249
+ setInput(replacement.input);
2250
+ setActiveReferenceSearch(undefined);
2251
+ setReferencePickerOpen(false);
2252
+ requestAnimationFrame(() => {
2253
+ inputRef.current?.focus();
2254
+ inputRef.current?.setSelectionRange(replacement.cursor, replacement.cursor);
2255
+ });
2256
+ };
2257
+ const clearConversation = () => {
2258
+ onInterrupt();
2259
+ onReset();
2260
+ setInput("");
2261
+ setReferences([]);
2262
+ setActiveReferenceSearch(undefined);
2263
+ setReferencePickerOpen(false);
2264
+ };
2265
+ const handleOpenChange = (nextOpen) => {
2266
+ if (!nextOpen) {
2267
+ clearConversation();
2268
+ setMaximized(false);
2269
+ }
2270
+ setOpen(nextOpen);
2271
+ };
2272
+ return /* @__PURE__ */ jsxs7(Dialog, {
2273
+ open,
2274
+ onOpenChange: handleOpenChange,
2275
+ modal: false,
2276
+ disablePointerDismissal: true,
2277
+ children: [
2278
+ /* @__PURE__ */ jsxs7(DialogTrigger, {
2279
+ render: /* @__PURE__ */ jsx19(Button, {
2280
+ size: "icon-lg",
2281
+ className: "fixed right-4 bottom-4 z-9999 rounded-full shadow-lg md:right-6 md:bottom-6"
2282
+ }),
2283
+ children: [
2284
+ /* @__PURE__ */ jsx19(BotIcon, {}),
2285
+ /* @__PURE__ */ jsx19("span", {
2286
+ className: "sr-only",
2287
+ children: labels.open
2288
+ })
2289
+ ]
2290
+ }),
2291
+ /* @__PURE__ */ jsx19(DialogPortal, {
2292
+ children: /* @__PURE__ */ jsxs7(DialogPrimitive2.Popup, {
2293
+ "data-slot": "dialog-content",
2294
+ className: cn("bg-popover text-popover-foreground ring-foreground/10 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 fixed z-50 flex flex-col gap-0 overflow-hidden rounded-xl text-sm shadow-lg ring-1 duration-100 outline-none", maximized ? "inset-4 max-h-none max-w-none md:inset-6" : "right-4 bottom-20 h-[min(42rem,calc(100svh-6rem))] w-[calc(100%-2rem)] max-w-md md:right-6"),
2295
+ children: [
2296
+ /* @__PURE__ */ jsx19(DialogHeader, {
2297
+ className: "shrink-0 border-b p-4",
2298
+ children: /* @__PURE__ */ jsxs7("div", {
2299
+ className: "flex items-center gap-1",
2300
+ children: [
2301
+ /* @__PURE__ */ jsx19(DialogTitle, {
2302
+ className: "min-w-0 flex-1 truncate text-sm leading-none font-medium",
2303
+ children: labels.title
2304
+ }),
2305
+ /* @__PURE__ */ jsxs7(Button, {
2306
+ variant: "ghost",
2307
+ size: "icon-sm",
2308
+ onClick: () => setOpen(false),
2309
+ children: [
2310
+ /* @__PURE__ */ jsx19(MinusIcon, {}),
2311
+ /* @__PURE__ */ jsx19("span", {
2312
+ className: "sr-only",
2313
+ children: labels.minimize
2314
+ })
2315
+ ]
2316
+ }),
2317
+ /* @__PURE__ */ jsxs7(Button, {
2318
+ variant: "ghost",
2319
+ size: "icon-sm",
2320
+ onClick: () => setMaximized((current) => !current),
2321
+ children: [
2322
+ maximized ? /* @__PURE__ */ jsx19(Minimize2Icon, {}) : /* @__PURE__ */ jsx19(Maximize2Icon, {}),
2323
+ /* @__PURE__ */ jsx19("span", {
2324
+ className: "sr-only",
2325
+ children: maximized ? labels.restore : labels.maximize
2326
+ })
2327
+ ]
2328
+ }),
2329
+ /* @__PURE__ */ jsxs7(DialogClose, {
2330
+ render: /* @__PURE__ */ jsx19(Button, {
2331
+ variant: "ghost",
2332
+ size: "icon-sm"
2333
+ }),
2334
+ children: [
2335
+ /* @__PURE__ */ jsx19(XIcon2, {}),
2336
+ /* @__PURE__ */ jsx19("span", {
2337
+ className: "sr-only",
2338
+ children: labels.close
2339
+ })
2340
+ ]
2341
+ })
2342
+ ]
2343
+ })
2344
+ }),
2345
+ /* @__PURE__ */ jsx19("div", {
2346
+ className: "min-h-0 flex-1 overflow-hidden",
2347
+ children: state.messages.length === 0 && !state.error ? /* @__PURE__ */ jsx19(Empty, {
2348
+ className: "h-full",
2349
+ children: /* @__PURE__ */ jsxs7(EmptyHeader, {
2350
+ children: [
2351
+ /* @__PURE__ */ jsx19(EmptyMedia, {
2352
+ variant: "icon",
2353
+ children: /* @__PURE__ */ jsx19(MessageCircleDashedIcon, {})
2354
+ }),
2355
+ /* @__PURE__ */ jsx19(EmptyTitle, {
2356
+ children: labels.welcome
2357
+ }),
2358
+ /* @__PURE__ */ jsx19(EmptyDescription, {
2359
+ children: labels.description
2360
+ })
2361
+ ]
2362
+ })
2363
+ }) : /* @__PURE__ */ jsx19(MessageScrollerProvider, {
2364
+ autoScroll: true,
2365
+ children: /* @__PURE__ */ jsxs7(MessageScroller, {
2366
+ children: [
2367
+ /* @__PURE__ */ jsx19(MessageScrollerViewport, {
2368
+ "aria-label": labels.title,
2369
+ children: /* @__PURE__ */ jsxs7(MessageScrollerContent, {
2370
+ "aria-busy": state.pending,
2371
+ className: "p-4",
2372
+ children: [
2373
+ state.messages.map((message, index) => /* @__PURE__ */ jsx19(MessageScrollerItem, {
2374
+ messageId: message.id,
2375
+ scrollAnchor: message.role === "user",
2376
+ children: /* @__PURE__ */ jsx19(AgentMessageRow, {
2377
+ disabled: state.pending,
2378
+ labels,
2379
+ locale,
2380
+ message,
2381
+ onApproval: respondToApproval,
2382
+ pending: state.pending && index === state.messages.length - 1
2383
+ })
2384
+ }, message.id)),
2385
+ state.error ? /* @__PURE__ */ jsx19(MessageScrollerItem, {
2386
+ messageId: "error",
2387
+ children: /* @__PURE__ */ jsxs7(Alert, {
2388
+ variant: "destructive",
2389
+ children: [
2390
+ /* @__PURE__ */ jsx19(AlertTitle, {
2391
+ children: labels.title
2392
+ }),
2393
+ /* @__PURE__ */ jsx19(AlertDescription, {
2394
+ children: errorMessage(state.error, labels)
2395
+ })
2396
+ ]
2397
+ })
2398
+ }) : null
2399
+ ]
2400
+ })
2401
+ }),
2402
+ /* @__PURE__ */ jsxs7(MessageScrollerButton, {
2403
+ children: [
2404
+ /* @__PURE__ */ jsx19(ArrowDownIcon2, {}),
2405
+ /* @__PURE__ */ jsx19("span", {
2406
+ className: "sr-only",
2407
+ children: labels.scrollLatest
2408
+ })
2409
+ ]
2410
+ })
2411
+ ]
2412
+ })
2413
+ })
2414
+ }),
2415
+ /* @__PURE__ */ jsx19("form", {
2416
+ className: "shrink-0 border-t p-3",
2417
+ onSubmit: (event) => {
2418
+ event.preventDefault();
2419
+ sendMessage();
2420
+ },
2421
+ children: /* @__PURE__ */ jsxs7(InputGroup, {
2422
+ children: [
2423
+ activeContext ? /* @__PURE__ */ jsx19(InputGroupAddon, {
2424
+ align: "block-start",
2425
+ children: /* @__PURE__ */ jsxs7(Attachment, {
2426
+ size: "xs",
2427
+ className: "min-w-0",
2428
+ children: [
2429
+ activeContext.icon ? /* @__PURE__ */ jsx19(AttachmentMedia, {
2430
+ children: activeContext.icon
2431
+ }) : null,
2432
+ /* @__PURE__ */ jsx19(AttachmentContent, {
2433
+ children: /* @__PURE__ */ jsx19(AttachmentTitle, {
2434
+ children: activeContext.label
2435
+ })
2436
+ }),
2437
+ onRemoveContext ? /* @__PURE__ */ jsx19(AttachmentActions, {
2438
+ children: /* @__PURE__ */ jsx19(AttachmentAction, {
2439
+ type: "button",
2440
+ "aria-label": `${labels.removeContext}: ${activeContext.label}`,
2441
+ onClick: onRemoveContext,
2442
+ children: /* @__PURE__ */ jsx19(XIcon2, {})
2443
+ })
2444
+ }) : null
2445
+ ]
2446
+ })
2447
+ }) : null,
2448
+ /* @__PURE__ */ jsxs7("div", {
2449
+ className: "relative w-full min-w-0 self-stretch text-left",
2450
+ children: [
2451
+ /* @__PURE__ */ jsx19("div", {
2452
+ ref: inputOverlayRef,
2453
+ "aria-hidden": "true",
2454
+ className: "text-foreground pointer-events-none absolute inset-0 [scrollbar-width:thin] [scrollbar-gutter:stable] overflow-hidden px-2.5 py-2 text-left font-[inherit] text-base break-words whitespace-pre-wrap md:text-sm",
2455
+ children: highlightedInput(input, references)
2456
+ }),
2457
+ /* @__PURE__ */ jsxs7(Popover, {
2458
+ open: referencePickerOpen,
2459
+ triggerId: referenceInputId,
2460
+ children: [
2461
+ /* @__PURE__ */ jsx19(PopoverTrigger, {
2462
+ id: referenceInputId,
2463
+ nativeButton: false,
2464
+ onKeyDown: (event) => event.preventBaseUIHandler(),
2465
+ onKeyUp: (event) => event.preventBaseUIHandler(),
2466
+ render: /* @__PURE__ */ jsx19(InputGroupTextarea, {
2467
+ ref: inputRef,
2468
+ className: "caret-foreground selection:bg-primary selection:text-primary-foreground relative max-h-32 w-full [scrollbar-width:thin] [scrollbar-color:var(--border)_transparent] [scrollbar-gutter:stable] overflow-y-auto overscroll-contain text-left text-transparent",
2469
+ value: input,
2470
+ placeholder: labels.placeholder,
2471
+ "aria-label": labels.placeholder,
2472
+ "aria-activedescendant": referencePickerOpen && activeReference ? `${referenceInputId}-reference-${activeReferenceIndex}` : undefined,
2473
+ "aria-autocomplete": "list",
2474
+ "aria-controls": referenceListId,
2475
+ "aria-expanded": referencePickerOpen,
2476
+ disabled: state.pending || hasPendingApproval2,
2477
+ role: "combobox",
2478
+ rows: 2,
2479
+ onScroll: (event) => {
2480
+ if (inputOverlayRef.current) {
2481
+ inputOverlayRef.current.scrollTop = event.currentTarget.scrollTop;
2482
+ }
2483
+ },
2484
+ onChange: (event) => {
2485
+ const value = event.target.value;
2486
+ const candidate = referenceSearchAtCursor(value, event.currentTarget.selectionStart);
2487
+ const search = candidate && !completesSelectedReference(value, candidate, references) ? candidate : undefined;
2488
+ setInput(value);
2489
+ setActiveReferenceSearch(search);
2490
+ setReferences((current) => current.filter(({ label }) => hasReferenceMention(value, label)));
2491
+ setReferencePickerOpen(search !== undefined && selectableReferences.length > 0);
2492
+ },
2493
+ onKeyDown: (event) => {
2494
+ if (event.key === "Escape" && referencePickerOpen) {
2495
+ event.preventDefault();
2496
+ setReferencePickerOpen(false);
2497
+ return;
2498
+ }
2499
+ if (referencePickerOpen && (event.key === "ArrowDown" || event.key === "ArrowUp") && matchingReferences.length > 0) {
2500
+ event.preventDefault();
2501
+ const offset = event.key === "ArrowDown" ? 1 : -1;
2502
+ const nextIndex = Math.min(matchingReferences.length - 1, Math.max(0, activeReferenceIndex + offset));
2503
+ setActiveReferenceKey(matchingReferences[nextIndex].key);
2504
+ return;
2505
+ }
2506
+ if (event.key === "Enter" && !event.shiftKey && referencePickerOpen && activeReference) {
2507
+ event.preventDefault();
2508
+ selectReference(activeReference);
2509
+ return;
2510
+ }
2511
+ if (event.key === "Enter" && !event.shiftKey) {
2512
+ event.preventDefault();
2513
+ event.currentTarget.form?.requestSubmit();
2514
+ }
2515
+ }
2516
+ })
2517
+ }),
2518
+ /* @__PURE__ */ jsx19(PopoverContent, {
2519
+ align: "start",
2520
+ initialFocus: false,
2521
+ side: "top",
2522
+ className: "w-[min(24rem,calc(100vw-2rem))] p-0",
2523
+ children: /* @__PURE__ */ jsx19(Command2, {
2524
+ shouldFilter: false,
2525
+ value: activeReference?.key ?? "",
2526
+ onValueChange: setActiveReferenceKey,
2527
+ children: /* @__PURE__ */ jsxs7(CommandList, {
2528
+ id: referenceListId,
2529
+ children: [
2530
+ /* @__PURE__ */ jsx19(CommandEmpty, {
2531
+ children: labels.noReferences
2532
+ }),
2533
+ matchingReferences.length > 0 ? /* @__PURE__ */ jsx19(CommandGroup, {
2534
+ heading: labels.references,
2535
+ children: matchingReferences.map((reference, index) => /* @__PURE__ */ jsxs7(CommandItem, {
2536
+ id: `${referenceInputId}-reference-${index}`,
2537
+ value: reference.key,
2538
+ onSelect: () => selectReference(reference),
2539
+ children: [
2540
+ reference.icon,
2541
+ /* @__PURE__ */ jsx19("span", {
2542
+ className: "truncate",
2543
+ children: reference.label
2544
+ })
2545
+ ]
2546
+ }, reference.key))
2547
+ }) : null
2548
+ ]
2549
+ })
2550
+ })
2551
+ })
2552
+ ]
2553
+ })
2554
+ ]
2555
+ }),
2556
+ /* @__PURE__ */ jsx19(InputGroupAddon, {
2557
+ align: "block-end",
2558
+ className: "justify-end",
2559
+ children: state.pending ? /* @__PURE__ */ jsxs7(InputGroupButton, {
2560
+ size: "icon-xs",
2561
+ onClick: onInterrupt,
2562
+ children: [
2563
+ /* @__PURE__ */ jsx19(SquareIcon, {}),
2564
+ /* @__PURE__ */ jsx19("span", {
2565
+ className: "sr-only",
2566
+ children: labels.stop
2567
+ })
2568
+ ]
2569
+ }) : /* @__PURE__ */ jsxs7(InputGroupButton, {
2570
+ type: "submit",
2571
+ size: "icon-xs",
2572
+ disabled: !input.trim() || hasPendingApproval2,
2573
+ children: [
2574
+ /* @__PURE__ */ jsx19(SendIcon, {}),
2575
+ /* @__PURE__ */ jsx19("span", {
2576
+ className: "sr-only",
2577
+ children: labels.send
2578
+ })
2579
+ ]
2580
+ })
2581
+ })
2582
+ ]
2583
+ })
2584
+ })
2585
+ ]
2586
+ })
2587
+ })
2588
+ ]
2589
+ });
2590
+ }
2591
+ export {
2592
+ AgentWidget,
2593
+ agentWidgetMessages
2594
+ };