@krak-stack/registry 0.10.20 → 0.11.2

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