@constructive-io/ui 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (487) hide show
  1. package/README.md +1 -1
  2. package/dist/{ai-CiaH2sfF.js → ai-B7XNnqYL.js} +1674 -228
  3. package/dist/ai-B7XNnqYL.js.map +1 -0
  4. package/dist/{ai-lAkichk8.cjs → ai-DJ-YPj8c.cjs} +1768 -226
  5. package/dist/ai-DJ-YPj8c.cjs.map +1 -0
  6. package/dist/{alert-BXuP0ayz.d.ts → alert-CJ4Qyk6W.d.cts} +4 -2
  7. package/dist/{alert-BXuP0ayz.d.cts → alert-CJ4Qyk6W.d.ts} +4 -2
  8. package/dist/components/accordion.cjs +60 -0
  9. package/dist/components/accordion.cjs.map +1 -0
  10. package/dist/components/accordion.d.cts +14 -0
  11. package/dist/components/accordion.d.ts +14 -0
  12. package/dist/components/accordion.js +54 -0
  13. package/dist/components/accordion.js.map +1 -0
  14. package/dist/components/ai/index.cjs +17 -1
  15. package/dist/components/ai/index.d.cts +2 -2
  16. package/dist/components/ai/index.d.ts +2 -2
  17. package/dist/components/ai/index.js +2 -2
  18. package/dist/components/alert-dialog.cjs +17 -8
  19. package/dist/components/alert-dialog.cjs.map +1 -1
  20. package/dist/components/alert-dialog.d.cts +1 -1
  21. package/dist/components/alert-dialog.d.ts +1 -1
  22. package/dist/components/alert-dialog.js +17 -8
  23. package/dist/components/alert-dialog.js.map +1 -1
  24. package/dist/components/alert.cjs +18 -8
  25. package/dist/components/alert.cjs.map +1 -1
  26. package/dist/components/alert.d.cts +2 -2
  27. package/dist/components/alert.d.ts +2 -2
  28. package/dist/components/alert.js +18 -9
  29. package/dist/components/alert.js.map +1 -1
  30. package/dist/components/autocomplete.cjs +9 -5
  31. package/dist/components/autocomplete.cjs.map +1 -1
  32. package/dist/components/autocomplete.js +9 -5
  33. package/dist/components/autocomplete.js.map +1 -1
  34. package/dist/components/avatar.cjs +9 -3
  35. package/dist/components/avatar.cjs.map +1 -1
  36. package/dist/components/avatar.d.cts +6 -0
  37. package/dist/components/avatar.d.ts +6 -0
  38. package/dist/components/avatar.js +9 -3
  39. package/dist/components/avatar.js.map +1 -1
  40. package/dist/components/badge.cjs +25 -18
  41. package/dist/components/badge.cjs.map +1 -1
  42. package/dist/components/badge.js +25 -18
  43. package/dist/components/badge.js.map +1 -1
  44. package/dist/components/breadcrumb.cjs +9 -6
  45. package/dist/components/breadcrumb.cjs.map +1 -1
  46. package/dist/components/breadcrumb.js +9 -6
  47. package/dist/components/breadcrumb.js.map +1 -1
  48. package/dist/components/button-group.cjs +57 -0
  49. package/dist/components/button-group.cjs.map +1 -0
  50. package/dist/components/button-group.d.cts +16 -0
  51. package/dist/components/button-group.d.ts +16 -0
  52. package/dist/components/button-group.js +51 -0
  53. package/dist/components/button-group.js.map +1 -0
  54. package/dist/components/button.cjs +59 -15
  55. package/dist/components/button.cjs.map +1 -1
  56. package/dist/components/button.d.cts +32 -2
  57. package/dist/components/button.d.ts +32 -2
  58. package/dist/components/button.js +59 -15
  59. package/dist/components/button.js.map +1 -1
  60. package/dist/components/calendar-rac.cjs +14 -8
  61. package/dist/components/calendar-rac.cjs.map +1 -1
  62. package/dist/components/calendar-rac.js +14 -8
  63. package/dist/components/calendar-rac.js.map +1 -1
  64. package/dist/components/card.cjs +35 -23
  65. package/dist/components/card.cjs.map +1 -1
  66. package/dist/components/card.d.cts +3 -2
  67. package/dist/components/card.d.ts +3 -2
  68. package/dist/components/card.js +35 -23
  69. package/dist/components/card.js.map +1 -1
  70. package/dist/components/checkbox.cjs +5 -5
  71. package/dist/components/checkbox.cjs.map +1 -1
  72. package/dist/components/checkbox.js +5 -5
  73. package/dist/components/checkbox.js.map +1 -1
  74. package/dist/components/collapsible.cjs +3 -3
  75. package/dist/components/collapsible.cjs.map +1 -1
  76. package/dist/components/collapsible.js +3 -3
  77. package/dist/components/collapsible.js.map +1 -1
  78. package/dist/components/combobox.cjs +24 -12
  79. package/dist/components/combobox.cjs.map +1 -1
  80. package/dist/components/combobox.d.cts +2 -1
  81. package/dist/components/combobox.d.ts +2 -1
  82. package/dist/components/combobox.js +24 -12
  83. package/dist/components/combobox.js.map +1 -1
  84. package/dist/components/command.cjs +25 -14
  85. package/dist/components/command.cjs.map +1 -1
  86. package/dist/components/command.d.cts +6 -2
  87. package/dist/components/command.d.ts +6 -2
  88. package/dist/components/command.js +25 -14
  89. package/dist/components/command.js.map +1 -1
  90. package/dist/components/dialog.cjs +22 -12
  91. package/dist/components/dialog.cjs.map +1 -1
  92. package/dist/components/dialog.d.cts +5 -2
  93. package/dist/components/dialog.d.ts +5 -2
  94. package/dist/components/dialog.js +22 -12
  95. package/dist/components/dialog.js.map +1 -1
  96. package/dist/components/dock.cjs +50 -27
  97. package/dist/components/dock.cjs.map +1 -1
  98. package/dist/components/dock.d.cts +1 -1
  99. package/dist/components/dock.d.ts +1 -1
  100. package/dist/components/dock.js +51 -28
  101. package/dist/components/dock.js.map +1 -1
  102. package/dist/components/drawer.cjs +22 -14
  103. package/dist/components/drawer.cjs.map +1 -1
  104. package/dist/components/drawer.js +22 -14
  105. package/dist/components/drawer.js.map +1 -1
  106. package/dist/components/dropdown-menu.cjs +34 -28
  107. package/dist/components/dropdown-menu.cjs.map +1 -1
  108. package/dist/components/dropdown-menu.d.cts +2 -2
  109. package/dist/components/dropdown-menu.d.ts +2 -2
  110. package/dist/components/dropdown-menu.js +52 -46
  111. package/dist/components/dropdown-menu.js.map +1 -1
  112. package/dist/components/empty.cjs +4 -4
  113. package/dist/components/empty.cjs.map +1 -1
  114. package/dist/components/empty.js +4 -4
  115. package/dist/components/empty.js.map +1 -1
  116. package/dist/components/field.cjs +33 -33
  117. package/dist/components/field.cjs.map +1 -1
  118. package/dist/components/field.d.cts +1 -1
  119. package/dist/components/field.d.ts +1 -1
  120. package/dist/components/field.js +34 -34
  121. package/dist/components/field.js.map +1 -1
  122. package/dist/components/flickering-grid.cjs +1 -1
  123. package/dist/components/flickering-grid.cjs.map +1 -1
  124. package/dist/components/flickering-grid.js +1 -1
  125. package/dist/components/flickering-grid.js.map +1 -1
  126. package/dist/components/flow-zoom-panel.cjs +10 -5
  127. package/dist/components/flow-zoom-panel.cjs.map +1 -1
  128. package/dist/components/flow-zoom-panel.d.cts +8 -1
  129. package/dist/components/flow-zoom-panel.d.ts +8 -1
  130. package/dist/components/flow-zoom-panel.js +10 -5
  131. package/dist/components/flow-zoom-panel.js.map +1 -1
  132. package/dist/components/form-control.cjs +12 -8
  133. package/dist/components/form-control.cjs.map +1 -1
  134. package/dist/components/form-control.js +12 -8
  135. package/dist/components/form-control.js.map +1 -1
  136. package/dist/components/form.cjs +5 -5
  137. package/dist/components/form.cjs.map +1 -1
  138. package/dist/components/form.js +5 -5
  139. package/dist/components/form.js.map +1 -1
  140. package/dist/components/input-group.cjs +13 -7
  141. package/dist/components/input-group.cjs.map +1 -1
  142. package/dist/components/input-group.d.cts +2 -2
  143. package/dist/components/input-group.d.ts +2 -2
  144. package/dist/components/input-group.js +11 -7
  145. package/dist/components/input-group.js.map +1 -1
  146. package/dist/components/input-otp.cjs +252 -0
  147. package/dist/components/input-otp.cjs.map +1 -0
  148. package/dist/components/input-otp.d.cts +44 -0
  149. package/dist/components/input-otp.d.ts +44 -0
  150. package/dist/components/input-otp.js +251 -0
  151. package/dist/components/input-otp.js.map +1 -0
  152. package/dist/components/input.cjs +10 -4
  153. package/dist/components/input.cjs.map +1 -1
  154. package/dist/components/input.d.cts +11 -2
  155. package/dist/components/input.d.ts +11 -2
  156. package/dist/components/input.js +10 -4
  157. package/dist/components/input.js.map +1 -1
  158. package/dist/components/item.cjs +151 -0
  159. package/dist/components/item.cjs.map +1 -0
  160. package/dist/components/item.d.cts +37 -0
  161. package/dist/components/item.d.ts +37 -0
  162. package/dist/components/item.js +137 -0
  163. package/dist/components/item.js.map +1 -0
  164. package/dist/components/json-input.cjs +4 -143
  165. package/dist/components/json-input.d.cts +6 -4
  166. package/dist/components/json-input.d.ts +6 -4
  167. package/dist/components/json-input.js +2 -140
  168. package/dist/components/kbd.cjs +35 -0
  169. package/dist/components/kbd.cjs.map +1 -0
  170. package/dist/components/kbd.d.cts +16 -0
  171. package/dist/components/kbd.d.ts +16 -0
  172. package/dist/components/kbd.js +31 -0
  173. package/dist/components/kbd.js.map +1 -0
  174. package/dist/components/label.cjs +3 -3
  175. package/dist/components/label.cjs.map +1 -1
  176. package/dist/components/label.js +3 -3
  177. package/dist/components/label.js.map +1 -1
  178. package/dist/components/motion-grid.cjs +20 -8
  179. package/dist/components/motion-grid.cjs.map +1 -1
  180. package/dist/components/motion-grid.js +20 -8
  181. package/dist/components/motion-grid.js.map +1 -1
  182. package/dist/components/multi-select.cjs +77 -67
  183. package/dist/components/multi-select.cjs.map +1 -1
  184. package/dist/components/multi-select.js +77 -67
  185. package/dist/components/multi-select.js.map +1 -1
  186. package/dist/components/page-header.cjs +12 -9
  187. package/dist/components/page-header.cjs.map +1 -1
  188. package/dist/components/page-header.js +12 -9
  189. package/dist/components/page-header.js.map +1 -1
  190. package/dist/components/pagination.cjs +10 -4
  191. package/dist/components/pagination.cjs.map +1 -1
  192. package/dist/components/pagination.d.cts +1 -1
  193. package/dist/components/pagination.d.ts +1 -1
  194. package/dist/components/pagination.js +10 -4
  195. package/dist/components/pagination.js.map +1 -1
  196. package/dist/components/phone-input.cjs +228 -0
  197. package/dist/components/phone-input.cjs.map +1 -0
  198. package/dist/components/phone-input.d.cts +42 -0
  199. package/dist/components/phone-input.d.ts +42 -0
  200. package/dist/components/phone-input.js +220 -0
  201. package/dist/components/phone-input.js.map +1 -0
  202. package/dist/components/popover.cjs +5 -4
  203. package/dist/components/popover.cjs.map +1 -1
  204. package/dist/components/popover.js +5 -4
  205. package/dist/components/popover.js.map +1 -1
  206. package/dist/components/progress.cjs +20 -3
  207. package/dist/components/progress.cjs.map +1 -1
  208. package/dist/components/progress.d.cts +1 -1
  209. package/dist/components/progress.d.ts +1 -1
  210. package/dist/components/progress.js +20 -3
  211. package/dist/components/progress.js.map +1 -1
  212. package/dist/components/progressive-blur-scroll-container.cjs +2 -2
  213. package/dist/components/progressive-blur-scroll-container.cjs.map +1 -1
  214. package/dist/components/progressive-blur-scroll-container.d.cts +1 -1
  215. package/dist/components/progressive-blur-scroll-container.d.ts +1 -1
  216. package/dist/components/progressive-blur-scroll-container.js +2 -2
  217. package/dist/components/progressive-blur-scroll-container.js.map +1 -1
  218. package/dist/components/progressive-blur.cjs +3 -2
  219. package/dist/components/progressive-blur.cjs.map +1 -1
  220. package/dist/components/progressive-blur.js +3 -2
  221. package/dist/components/progressive-blur.js.map +1 -1
  222. package/dist/components/radio-group.cjs +2 -2
  223. package/dist/components/radio-group.cjs.map +1 -1
  224. package/dist/components/radio-group.js +2 -2
  225. package/dist/components/radio-group.js.map +1 -1
  226. package/dist/components/record-picker.cjs +1 -1
  227. package/dist/components/record-picker.js +1 -1
  228. package/dist/components/resizable.cjs +2 -2
  229. package/dist/components/resizable.cjs.map +1 -1
  230. package/dist/components/resizable.js +2 -2
  231. package/dist/components/resizable.js.map +1 -1
  232. package/dist/components/responsive-diagram.cjs +43 -21
  233. package/dist/components/responsive-diagram.cjs.map +1 -1
  234. package/dist/components/responsive-diagram.d.cts +7 -1
  235. package/dist/components/responsive-diagram.d.ts +7 -1
  236. package/dist/components/responsive-diagram.js +43 -21
  237. package/dist/components/responsive-diagram.js.map +1 -1
  238. package/dist/components/scroll-area.cjs +2 -2
  239. package/dist/components/scroll-area.cjs.map +1 -1
  240. package/dist/components/scroll-area.js +2 -2
  241. package/dist/components/scroll-area.js.map +1 -1
  242. package/dist/components/select.cjs +84 -20
  243. package/dist/components/select.cjs.map +1 -1
  244. package/dist/components/select.d.cts +12 -7
  245. package/dist/components/select.d.ts +12 -7
  246. package/dist/components/select.js +84 -20
  247. package/dist/components/select.js.map +1 -1
  248. package/dist/components/separator.cjs +1 -1
  249. package/dist/components/separator.cjs.map +1 -1
  250. package/dist/components/separator.d.cts +11 -2
  251. package/dist/components/separator.d.ts +11 -2
  252. package/dist/components/separator.js +1 -1
  253. package/dist/components/separator.js.map +1 -1
  254. package/dist/components/sheet.cjs +1 -1
  255. package/dist/components/sheet.d.cts +11 -5
  256. package/dist/components/sheet.d.ts +12 -6
  257. package/dist/components/sheet.js +1 -1
  258. package/dist/components/sidebar.cjs +2 -1
  259. package/dist/components/sidebar.d.cts +7 -6
  260. package/dist/components/sidebar.d.ts +7 -6
  261. package/dist/components/sidebar.js +2 -1
  262. package/dist/components/slider.cjs +47 -0
  263. package/dist/components/slider.cjs.map +1 -0
  264. package/dist/components/slider.d.cts +8 -0
  265. package/dist/components/slider.d.ts +8 -0
  266. package/dist/components/slider.js +44 -0
  267. package/dist/components/slider.js.map +1 -0
  268. package/dist/components/sonner.cjs +15 -4
  269. package/dist/components/sonner.cjs.map +1 -1
  270. package/dist/components/sonner.d.cts +10 -1
  271. package/dist/components/sonner.d.ts +10 -1
  272. package/dist/components/sonner.js +16 -5
  273. package/dist/components/sonner.js.map +1 -1
  274. package/dist/components/spinner.cjs +25 -0
  275. package/dist/components/spinner.cjs.map +1 -0
  276. package/dist/components/spinner.d.cts +16 -0
  277. package/dist/components/spinner.d.ts +16 -0
  278. package/dist/components/spinner.js +22 -0
  279. package/dist/components/spinner.js.map +1 -0
  280. package/dist/components/stack/index.cjs +1 -1
  281. package/dist/components/stack/index.js +1 -1
  282. package/dist/components/stepper.cjs +23 -17
  283. package/dist/components/stepper.cjs.map +1 -1
  284. package/dist/components/stepper.d.cts +2 -2
  285. package/dist/components/stepper.d.ts +2 -2
  286. package/dist/components/stepper.js +23 -17
  287. package/dist/components/stepper.js.map +1 -1
  288. package/dist/components/switch.cjs +5 -5
  289. package/dist/components/switch.cjs.map +1 -1
  290. package/dist/components/switch.js +5 -5
  291. package/dist/components/switch.js.map +1 -1
  292. package/dist/components/table.cjs +26 -7
  293. package/dist/components/table.cjs.map +1 -1
  294. package/dist/components/table.d.cts +20 -2
  295. package/dist/components/table.d.ts +20 -2
  296. package/dist/components/table.js +26 -8
  297. package/dist/components/table.js.map +1 -1
  298. package/dist/components/tabs.cjs +61 -8
  299. package/dist/components/tabs.cjs.map +1 -1
  300. package/dist/components/tabs.d.cts +13 -2
  301. package/dist/components/tabs.d.ts +13 -2
  302. package/dist/components/tabs.js +63 -11
  303. package/dist/components/tabs.js.map +1 -1
  304. package/dist/components/tags.cjs +10 -5
  305. package/dist/components/tags.cjs.map +1 -1
  306. package/dist/components/tags.d.cts +1 -1
  307. package/dist/components/tags.d.ts +1 -1
  308. package/dist/components/tags.js +10 -5
  309. package/dist/components/tags.js.map +1 -1
  310. package/dist/components/textarea.cjs +5 -4
  311. package/dist/components/textarea.cjs.map +1 -1
  312. package/dist/components/textarea.js +5 -4
  313. package/dist/components/textarea.js.map +1 -1
  314. package/dist/components/toast/index.cjs +1 -1
  315. package/dist/components/toast/index.d.cts +2 -2
  316. package/dist/components/toast/index.d.ts +2 -2
  317. package/dist/components/toast/index.js +1 -1
  318. package/dist/components/toggle-group.cjs +69 -0
  319. package/dist/components/toggle-group.cjs.map +1 -0
  320. package/dist/components/toggle-group.d.cts +27 -0
  321. package/dist/components/toggle-group.d.ts +27 -0
  322. package/dist/components/toggle-group.js +65 -0
  323. package/dist/components/toggle-group.js.map +1 -0
  324. package/dist/components/toggle.cjs +54 -0
  325. package/dist/components/toggle.cjs.map +1 -0
  326. package/dist/components/toggle.d.cts +13 -0
  327. package/dist/components/toggle.d.ts +13 -0
  328. package/dist/components/toggle.js +50 -0
  329. package/dist/components/toggle.js.map +1 -0
  330. package/dist/components/tooltip.cjs +18 -6
  331. package/dist/components/tooltip.cjs.map +1 -1
  332. package/dist/components/tooltip.d.cts +1 -1
  333. package/dist/components/tooltip.d.ts +1 -1
  334. package/dist/components/tooltip.js +18 -6
  335. package/dist/components/tooltip.js.map +1 -1
  336. package/dist/components/unlink-button.cjs +2 -2
  337. package/dist/components/unlink-button.cjs.map +1 -1
  338. package/dist/components/unlink-button.d.cts +1 -0
  339. package/dist/components/unlink-button.d.ts +1 -0
  340. package/dist/components/unlink-button.js +2 -2
  341. package/dist/components/unlink-button.js.map +1 -1
  342. package/dist/components/workspace-kit/index.cjs +1477 -0
  343. package/dist/components/workspace-kit/index.cjs.map +1 -0
  344. package/dist/components/workspace-kit/index.d.cts +716 -0
  345. package/dist/components/workspace-kit/index.d.ts +716 -0
  346. package/dist/components/workspace-kit/index.js +1410 -0
  347. package/dist/components/workspace-kit/index.js.map +1 -0
  348. package/dist/compose-refs-Mbma1O3M.js +47 -0
  349. package/dist/compose-refs-Mbma1O3M.js.map +1 -0
  350. package/dist/compose-refs-uPrvNoiU.cjs +52 -0
  351. package/dist/compose-refs-uPrvNoiU.cjs.map +1 -0
  352. package/dist/fluid-highlight-AW-OITqJ.cjs +124 -0
  353. package/dist/fluid-highlight-AW-OITqJ.cjs.map +1 -0
  354. package/dist/fluid-highlight-DxWeZ7iu.js +119 -0
  355. package/dist/fluid-highlight-DxWeZ7iu.js.map +1 -0
  356. package/dist/{index-UnM04j0t.d.ts → index-BQZxmMpw.d.cts} +11 -31
  357. package/dist/{index-UnM04j0t.d.cts → index-BQZxmMpw.d.ts} +11 -31
  358. package/dist/{index-CyaFaZe2.d.cts → index-CiO-3M_X.d.cts} +334 -18
  359. package/dist/{index-B0wXxIAb.d.ts → index-z3LqQ5L5.d.ts} +334 -18
  360. package/dist/index.cjs +107 -17
  361. package/dist/index.d.cts +63 -13
  362. package/dist/index.d.ts +63 -13
  363. package/dist/index.js +27 -14
  364. package/dist/initial-focus-B8RLtyOZ.cjs +67 -0
  365. package/dist/initial-focus-B8RLtyOZ.cjs.map +1 -0
  366. package/dist/initial-focus-j2E0EnIx.js +61 -0
  367. package/dist/initial-focus-j2E0EnIx.js.map +1 -0
  368. package/dist/initials-DSkWTOb0.cjs +127 -0
  369. package/dist/initials-DSkWTOb0.cjs.map +1 -0
  370. package/dist/initials-kCcHgrSy.js +97 -0
  371. package/dist/initials-kCcHgrSy.js.map +1 -0
  372. package/dist/json-input-CH5aEmoA.js +293 -0
  373. package/dist/json-input-CH5aEmoA.js.map +1 -0
  374. package/dist/json-input-D8yM578l.cjs +311 -0
  375. package/dist/json-input-D8yM578l.cjs.map +1 -0
  376. package/dist/{motion-config-COCFHq1L.cjs → motion-config-DZ7w5Uhq.cjs} +32 -2
  377. package/dist/motion-config-DZ7w5Uhq.cjs.map +1 -0
  378. package/dist/{motion-config-COsZ6azM.js → motion-config-DoFp4I8f.js} +21 -3
  379. package/dist/motion-config-DoFp4I8f.js.map +1 -0
  380. package/dist/{record-picker-Bz4FApxD.cjs → record-picker-BQ1-Vx0g.cjs} +23 -8
  381. package/dist/record-picker-BQ1-Vx0g.cjs.map +1 -0
  382. package/dist/{record-picker-BbxngCeV.js → record-picker-DSRo4RXV.js} +23 -8
  383. package/dist/record-picker-DSRo4RXV.js.map +1 -0
  384. package/dist/{sheet-BdA0rfIz.cjs → sheet-OxWlnT_G.cjs} +25 -32
  385. package/dist/sheet-OxWlnT_G.cjs.map +1 -0
  386. package/dist/{sheet-BLHnhLRH.js → sheet-wPF_l9Cn.js} +25 -32
  387. package/dist/sheet-wPF_l9Cn.js.map +1 -0
  388. package/dist/{sidebar-BavjjJp0.cjs → sidebar-BEEWmJwC.cjs} +74 -57
  389. package/dist/sidebar-BEEWmJwC.cjs.map +1 -0
  390. package/dist/{sidebar-DeoL2ttp.js → sidebar-DWl1Azyv.js} +74 -57
  391. package/dist/sidebar-DWl1Azyv.js.map +1 -0
  392. package/dist/{stack-ci2lkfkr.cjs → stack-CEvmUSwF.cjs} +12 -10
  393. package/dist/stack-CEvmUSwF.cjs.map +1 -0
  394. package/dist/{stack-C9GROTGA.js → stack-Kqu7YaR0.js} +12 -10
  395. package/dist/stack-Kqu7YaR0.js.map +1 -0
  396. package/dist/text-runs-CdmlS5C7.cjs +52 -0
  397. package/dist/text-runs-CdmlS5C7.cjs.map +1 -0
  398. package/dist/text-runs-DqcEO8L_.js +45 -0
  399. package/dist/text-runs-DqcEO8L_.js.map +1 -0
  400. package/dist/theme-DTTTlylA.d.cts +520 -0
  401. package/dist/theme-DTTTlylA.d.ts +520 -0
  402. package/dist/theme-dials-config.cjs +273 -0
  403. package/dist/theme-dials-config.cjs.map +1 -0
  404. package/dist/theme-dials-config.d.cts +95 -0
  405. package/dist/theme-dials-config.d.ts +95 -0
  406. package/dist/theme-dials-config.js +269 -0
  407. package/dist/theme-dials-config.js.map +1 -0
  408. package/dist/theme-presets.cjs +922 -0
  409. package/dist/theme-presets.cjs.map +1 -0
  410. package/dist/theme-presets.d.cts +89 -0
  411. package/dist/theme-presets.d.ts +89 -0
  412. package/dist/theme-presets.js +912 -0
  413. package/dist/theme-presets.js.map +1 -0
  414. package/dist/theme-tuning-DjgDvV8V.d.ts +158 -0
  415. package/dist/theme-tuning-TJ76tnxZ.d.cts +158 -0
  416. package/dist/theme-tuning.cjs +349 -0
  417. package/dist/theme-tuning.cjs.map +1 -0
  418. package/dist/theme-tuning.d.cts +2 -0
  419. package/dist/theme-tuning.d.ts +2 -0
  420. package/dist/theme-tuning.js +333 -0
  421. package/dist/theme-tuning.js.map +1 -0
  422. package/dist/theme.cjs +432 -0
  423. package/dist/theme.cjs.map +1 -0
  424. package/dist/theme.d.cts +2 -0
  425. package/dist/theme.d.ts +2 -0
  426. package/dist/theme.js +430 -0
  427. package/dist/theme.js.map +1 -0
  428. package/dist/toast-08jF1DBQ.cjs +193 -0
  429. package/dist/toast-08jF1DBQ.cjs.map +1 -0
  430. package/dist/toast-CVW5XY4u.js +164 -0
  431. package/dist/toast-CVW5XY4u.js.map +1 -0
  432. package/dist/toast-details-BdxxSLlN.cjs +209 -0
  433. package/dist/toast-details-BdxxSLlN.cjs.map +1 -0
  434. package/dist/toast-details-CfsB1Vxb.js +198 -0
  435. package/dist/toast-details-CfsB1Vxb.js.map +1 -0
  436. package/dist/{tooltip-CTRQoN1A.d.ts → tooltip-Fqb4JK-g.d.cts} +2 -2
  437. package/dist/{tooltip-CTRQoN1A.d.cts → tooltip-Fqb4JK-g.d.ts} +2 -2
  438. package/dist/tuning-BKVFsxLr.js +48 -0
  439. package/dist/tuning-BKVFsxLr.js.map +1 -0
  440. package/dist/tuning-BRPG7U1U.cjs +71 -0
  441. package/dist/tuning-BRPG7U1U.cjs.map +1 -0
  442. package/dist/use-document-theme-BSEuNsEE.cjs +43 -0
  443. package/dist/use-document-theme-BSEuNsEE.cjs.map +1 -0
  444. package/dist/use-document-theme-Ch_PqxZz.js +38 -0
  445. package/dist/use-document-theme-Ch_PqxZz.js.map +1 -0
  446. package/dist/use-scroll-fade-CaHp52u4.cjs +79 -0
  447. package/dist/use-scroll-fade-CaHp52u4.cjs.map +1 -0
  448. package/dist/use-scroll-fade-ilq-o00-.js +72 -0
  449. package/dist/use-scroll-fade-ilq-o00-.js.map +1 -0
  450. package/package.json +163 -27
  451. package/src/styles/globals.css +176 -97
  452. package/dist/ai-CiaH2sfF.js.map +0 -1
  453. package/dist/ai-lAkichk8.cjs.map +0 -1
  454. package/dist/button-DBRYW_AI.d.cts +0 -20
  455. package/dist/button-DBRYW_AI.d.ts +0 -20
  456. package/dist/components/app-bar.cjs +0 -81
  457. package/dist/components/app-bar.cjs.map +0 -1
  458. package/dist/components/app-bar.d.cts +0 -27
  459. package/dist/components/app-bar.d.ts +0 -27
  460. package/dist/components/app-bar.js +0 -77
  461. package/dist/components/app-bar.js.map +0 -1
  462. package/dist/components/app-shell.cjs +0 -267
  463. package/dist/components/app-shell.cjs.map +0 -1
  464. package/dist/components/app-shell.d.cts +0 -98
  465. package/dist/components/app-shell.d.ts +0 -98
  466. package/dist/components/app-shell.js +0 -264
  467. package/dist/components/app-shell.js.map +0 -1
  468. package/dist/components/json-input.cjs.map +0 -1
  469. package/dist/components/json-input.js.map +0 -1
  470. package/dist/input-CBrCuMH8.d.cts +0 -11
  471. package/dist/input-CBrCuMH8.d.ts +0 -11
  472. package/dist/motion-config-COCFHq1L.cjs.map +0 -1
  473. package/dist/motion-config-COsZ6azM.js.map +0 -1
  474. package/dist/record-picker-BbxngCeV.js.map +0 -1
  475. package/dist/record-picker-Bz4FApxD.cjs.map +0 -1
  476. package/dist/separator-BQEsr0Rc.d.cts +0 -11
  477. package/dist/separator-BQEsr0Rc.d.ts +0 -11
  478. package/dist/sheet-BLHnhLRH.js.map +0 -1
  479. package/dist/sheet-BdA0rfIz.cjs.map +0 -1
  480. package/dist/sidebar-BavjjJp0.cjs.map +0 -1
  481. package/dist/sidebar-DeoL2ttp.js.map +0 -1
  482. package/dist/stack-C9GROTGA.js.map +0 -1
  483. package/dist/stack-ci2lkfkr.cjs.map +0 -1
  484. package/dist/toast-D6MqijT2.cjs +0 -316
  485. package/dist/toast-D6MqijT2.cjs.map +0 -1
  486. package/dist/toast-D_BOLzm3.js +0 -287
  487. package/dist/toast-D_BOLzm3.js.map +0 -1
@@ -3,10 +3,14 @@ const require_rolldown_runtime = require('./rolldown-runtime-D_qnwXdH.cjs');
3
3
  const require_utils = require('./utils-CzTQ3-VI.cjs');
4
4
  const require_components_button = require('./components/button.cjs');
5
5
  const require_components_badge = require('./components/badge.cjs');
6
+ const require_components_kbd = require('./components/kbd.cjs');
7
+ const require_components_spinner = require('./components/spinner.cjs');
6
8
  const require_components_alert = require('./components/alert.cjs');
7
9
  const require_components_tooltip = require('./components/tooltip.cjs');
10
+ const require_components_popover = require('./components/popover.cjs');
8
11
  const require_components_collapsible = require('./components/collapsible.cjs');
9
12
  const require_components_avatar = require('./components/avatar.cjs');
13
+ const require_components_command = require('./components/command.cjs');
10
14
  let react = require("react");
11
15
  react = require_rolldown_runtime.__toESM(react, 1);
12
16
  let react_jsx_runtime = require("react/jsx-runtime");
@@ -24,7 +28,8 @@ function TextShimmer({ className, active = true, children, ...props }) {
24
28
  "data-slot": "text-shimmer",
25
29
  "data-active": active ? "true" : "false",
26
30
  className: require_utils.cn("inline-block font-medium", active ? [
27
- "bg-[linear-gradient(90deg,var(--muted-foreground)_35%,var(--foreground)_50%,var(--muted-foreground)_65%)]",
31
+ "bg-[linear-gradient(90deg,var(--muted-foreground)_35%,color-mix(in_oklab,var(--muted-foreground),var(--background)_55%)_50%,var(--muted-foreground)_65%)]",
32
+ "dark:bg-[linear-gradient(90deg,var(--muted-foreground)_35%,var(--foreground)_50%,var(--muted-foreground)_65%)]",
28
33
  "bg-size-[200%_100%] bg-clip-text text-transparent",
29
34
  "animate-[ai-shimmer-text_1.4s_linear_infinite]",
30
35
  "motion-reduce:animate-none motion-reduce:bg-none motion-reduce:text-muted-foreground"
@@ -38,7 +43,7 @@ function TextShimmer({ className, active = true, children, ...props }) {
38
43
  //#region src/components/ai/agent-loader.tsx
39
44
  const REDUCED_MOTION_QUERY = "(prefers-reduced-motion: reduce)";
40
45
  function subscribeToReducedMotion(onStoreChange) {
41
- if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => void 0;
46
+ if (typeof window === "undefined" || typeof window.matchMedia !== "function") return () => {};
42
47
  const mediaQuery = window.matchMedia(REDUCED_MOTION_QUERY);
43
48
  mediaQuery.addEventListener("change", onStoreChange);
44
49
  return () => mediaQuery.removeEventListener("change", onStoreChange);
@@ -82,7 +87,7 @@ const PIXEL_PATTERNS = {
82
87
  round: false
83
88
  }
84
89
  };
85
- function formatElapsed(totalSeconds) {
90
+ function formatElapsed$1(totalSeconds) {
86
91
  if (totalSeconds < 60) return `${totalSeconds.toFixed(1)}s`;
87
92
  return `${Math.floor(totalSeconds / 60)}m ${(totalSeconds % 60).toFixed(1)}s`;
88
93
  }
@@ -209,8 +214,8 @@ function PulseDot({ size, className }) {
209
214
  });
210
215
  }
211
216
  /**
212
- * Agent loading indicator. Pixel variants (drive / dots / orbit) match the
213
- * Beautiful UI craft; simple variants cover common chat spinners.
217
+ * Agent loading indicator. Pixel variants (drive / dots / orbit) give the
218
+ * agent a distinct presence; simple variants cover common chat spinners.
214
219
  */
215
220
  function AgentLoader({ variant = "drive", label = "Working", showElapsed = true, elapsedMs, size = "md", className, text }) {
216
221
  const reducedMotion = react.useSyncExternalStore(subscribeToReducedMotion, getReducedMotionSnapshot, () => true);
@@ -229,16 +234,16 @@ function AgentLoader({ variant = "drive", label = "Working", showElapsed = true,
229
234
  reducedMotion
230
235
  }),
231
236
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextShimmer, {
232
- className: "text-[13px]",
237
+ className: "text-[0.8125rem]",
233
238
  children: statusText
234
239
  }),
235
240
  showElapsed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
236
241
  className: "font-mono text-xs tabular-nums text-muted-foreground",
237
- children: formatElapsed(elapsed)
242
+ children: formatElapsed$1(elapsed)
238
243
  }) : null,
239
244
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
240
245
  className: "sr-only",
241
- children: [statusText, showElapsed ? `, ${formatElapsed(elapsed)}` : ""]
246
+ children: [statusText, showElapsed ? `, ${formatElapsed$1(elapsed)}` : ""]
242
247
  })
243
248
  ]
244
249
  });
@@ -254,7 +259,7 @@ function AgentLoader({ variant = "drive", label = "Working", showElapsed = true,
254
259
  if (variant === "loading-dots") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
255
260
  "data-slot": "agent-loader",
256
261
  role: "status",
257
- className: require_utils.cn("inline-flex items-center gap-0.5 font-medium text-primary", className),
262
+ className: require_utils.cn("inline-flex items-center gap-0.5 font-medium text-link", className),
258
263
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
259
264
  className: require_utils.cn(size === "sm" && "text-xs", size === "md" && "text-sm", size === "lg" && "text-base"),
260
265
  children: statusText
@@ -332,7 +337,7 @@ function PromptInput({ className, isLoading = false, maxHeight = 240, value, onV
332
337
  "data-shape": shape,
333
338
  "data-loading": isLoading ? "true" : "false",
334
339
  onClick: handleClick,
335
- className: require_utils.cn("cursor-text border border-input bg-background p-2 shadow-xs", "transition-shadow focus-within:border-primary/60 focus-within:ring-[3px] focus-within:ring-primary/35", shape === "pill" ? "rounded-3xl" : "rounded-xl", disabled && "cursor-not-allowed opacity-60", className),
340
+ className: require_utils.cn("cursor-text border border-input bg-background p-2 shadow-xs", "transition-shadow focus-within:border-ring/60 focus-within:ring-[3px] focus-within:ring-ring/35", shape === "pill" ? "rounded-3xl" : "rounded-lg", disabled && "cursor-not-allowed opacity-60", className),
336
341
  ...props,
337
342
  children
338
343
  })
@@ -375,7 +380,7 @@ function PromptInputTextarea({ className, onKeyDown, disableAutosize = false, ..
375
380
  onKeyDown: handleKeyDown,
376
381
  disabled,
377
382
  rows: 1,
378
- className: require_utils.cn("min-h-11 w-full resize-none border-none bg-transparent px-2 py-1.5 text-sm outline-none", "placeholder:text-muted-foreground disabled:cursor-not-allowed", className),
383
+ className: require_utils.cn("min-h-11 w-full resize-none border-none bg-transparent px-2 py-1.5 text-sm outline-none pointer-coarse:text-base", "placeholder:text-subtle-foreground disabled:cursor-not-allowed", className),
379
384
  ...props
380
385
  });
381
386
  }
@@ -460,10 +465,24 @@ function escapeHtml(value) {
460
465
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
461
466
  }
462
467
  /**
468
+ * `*` starts emphasis only in front of text, at the start of a word, and ends
469
+ * it only right after text. That keeps `A * B * C`, `src/**\/*.test.ts` and
470
+ * `*.md files` as the characters the writer typed instead of eating them.
471
+ *
472
+ * The text between the markers cannot contain the marker itself (`**` for
473
+ * strong, `***` for both), so an opener that never finds its closer gives up at
474
+ * the next marker instead of scanning to the end of the line: a long line of
475
+ * unmatched `**` takes time in proportion to its length, not its square.
476
+ */
477
+ const STRONG_EM = /(?<![\w*])\*\*\*(?=[^\s*])((?:[^*\n]|\*(?!\*\*))*?[^\s*])\*\*\*(?![\w*])/g;
478
+ const STRONG = /(?<![\w*])\*\*(?=[^\s*])((?:[^*\n]|\*(?!\*))*?[^\s*])\*\*(?![\w*])/g;
479
+ const EM = /(?<![\w*])\*(?=[^\s*])([^\n*]*?[^\s*])\*(?![\w*])/g;
480
+ /**
463
481
  * Lightweight markdown → HTML without hard deps.
464
- * Handles paragraphs, bold, italic, inline code, fenced code, links, lists.
465
- * Hosts that need full GFM can pass pre-rendered HTML via a future `html` prop
466
- * or wrap with their own marked+DOMPurify pipeline.
482
+ * Handles paragraphs (consecutive lines stay together, joined with line
483
+ * breaks), headings, bold, italic, inline code, fenced code, links, lists.
484
+ * Tables and footnotes are outside this subset: hosts that need full GFM wrap
485
+ * their own marked+DOMPurify pipeline.
467
486
  */
468
487
  function renderBasicMarkdown(source) {
469
488
  const fences = [];
@@ -474,9 +493,15 @@ function renderBasicMarkdown(source) {
474
493
  return `\u0000FENCE${index}\u0000`;
475
494
  });
476
495
  text = escapeHtml(text);
477
- text = text.replace(/`([^`\n]+)`/g, "<code class=\"ai-md-code\">$1</code>");
478
- text = text.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
479
- text = text.replace(/(?<!\*)\*([^*]+)\*(?!\*)/g, "<em>$1</em>");
496
+ const spans = [];
497
+ text = text.replace(/`([^`\n]+)`/g, (_match, code) => {
498
+ spans.push(`<code class="ai-md-code">${code}</code>`);
499
+ return `\u0001CODE${spans.length - 1}\u0001`;
500
+ });
501
+ text = text.replace(STRONG_EM, "<strong><em>$1</em></strong>");
502
+ text = text.replace(STRONG, "<strong>$1</strong>");
503
+ text = text.replace(EM, "<em>$1</em>");
504
+ text = text.replace(/\u0001CODE(\d+)\u0001/g, (_match, index) => spans[Number(index)] ?? "");
480
505
  text = text.replace(/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/g, "<a href=\"$2\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ai-md-link\">$1</a>");
481
506
  const lines = text.split("\n");
482
507
  const html = [];
@@ -487,11 +512,19 @@ function renderBasicMarkdown(source) {
487
512
  listOpen = null;
488
513
  }
489
514
  };
515
+ let paragraph = [];
516
+ const flushParagraph = () => {
517
+ if (paragraph.length > 0) {
518
+ html.push(`<p class="ai-md-p">${paragraph.join("<br>")}</p>`);
519
+ paragraph = [];
520
+ }
521
+ };
490
522
  for (const line of lines) {
491
523
  const unordered = line.match(/^[-*]\s+(.+)$/);
492
524
  const ordered = line.match(/^\d+\.\s+(.+)$/);
493
- const heading = line.match(/^(#{1,3})\s+(.+)$/);
525
+ const heading = line.match(/^(#{1,6})\s+(.+)$/);
494
526
  if (unordered) {
527
+ flushParagraph();
495
528
  if (listOpen !== "ul") {
496
529
  closeList();
497
530
  html.push("<ul class=\"ai-md-list\">");
@@ -501,6 +534,7 @@ function renderBasicMarkdown(source) {
501
534
  continue;
502
535
  }
503
536
  if (ordered) {
537
+ flushParagraph();
504
538
  if (listOpen !== "ol") {
505
539
  closeList();
506
540
  html.push("<ol class=\"ai-md-list\">");
@@ -511,20 +545,23 @@ function renderBasicMarkdown(source) {
511
545
  }
512
546
  closeList();
513
547
  if (heading) {
548
+ flushParagraph();
514
549
  const level = heading[1].length;
515
550
  html.push(`<h${level} class="ai-md-h">${heading[2]}</h${level}>`);
516
551
  continue;
517
552
  }
518
553
  if (line.trim() === "") {
519
- html.push("");
554
+ flushParagraph();
520
555
  continue;
521
556
  }
522
557
  if (line.includes("\0FENCE")) {
558
+ flushParagraph();
523
559
  html.push(line.replace(/\u0000FENCE(\d+)\u0000/g, (_m, i) => fences[Number(i)] ?? ""));
524
560
  continue;
525
561
  }
526
- html.push(`<p class="ai-md-p">${line}</p>`);
562
+ paragraph.push(line);
527
563
  }
564
+ flushParagraph();
528
565
  closeList();
529
566
  return html.join("\n").replace(/\u0000FENCE(\d+)\u0000/g, (_m, i) => fences[Number(i)] ?? "");
530
567
  }
@@ -539,7 +576,7 @@ function Markdown({ className, children, streaming = false, ...props }) {
539
576
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
540
577
  "data-slot": "markdown",
541
578
  "data-streaming": streaming ? "true" : "false",
542
- className: require_utils.cn("ai-markdown max-w-none space-y-3 break-words text-sm leading-relaxed text-foreground", "[&_.ai-md-p]:my-0", "[&_.ai-md-h]:font-semibold", "[&_h1.ai-md-h]:text-lg [&_h2.ai-md-h]:text-base [&_h3.ai-md-h]:text-sm", "[&_.ai-md-list]:my-1 [&_.ai-md-list]:list-disc [&_.ai-md-list]:space-y-1 [&_.ai-md-list]:pl-5", "[&_ol.ai-md-list]:list-decimal", "[&_.ai-md-code]:rounded-md [&_.ai-md-code]:bg-muted [&_.ai-md-code]:px-1 [&_.ai-md-code]:py-0.5 [&_.ai-md-code]:font-mono [&_.ai-md-code]:text-[0.85em]", "[&_.ai-md-pre]:overflow-x-auto [&_.ai-md-pre]:rounded-lg [&_.ai-md-pre]:border [&_.ai-md-pre]:border-border [&_.ai-md-pre]:bg-muted/50 [&_.ai-md-pre]:p-3 [&_.ai-md-pre]:font-mono [&_.ai-md-pre]:text-xs", "[&_.ai-md-link]:text-primary [&_.ai-md-link]:underline-offset-2 hover:[&_.ai-md-link]:underline", className),
579
+ className: require_utils.cn("ai-markdown max-w-none space-y-3 text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]", "[&_.ai-md-p]:my-0", "[&_.ai-md-h]:font-semibold", "[&_h1.ai-md-h]:text-lg [&_h2.ai-md-h]:text-base [&_h3.ai-md-h]:text-sm [&_h4.ai-md-h]:text-sm [&_h5.ai-md-h]:text-[0.8125rem] [&_h6.ai-md-h]:text-xs", "[&_.ai-md-list]:my-1 [&_.ai-md-list]:list-disc [&_.ai-md-list]:space-y-1 [&_.ai-md-list]:ps-5", "[&_ol.ai-md-list]:list-decimal", "[&_.ai-md-code]:rounded-md [&_.ai-md-code]:bg-muted [&_.ai-md-code]:px-1 [&_.ai-md-code]:py-0.5 [&_.ai-md-code]:font-mono [&_.ai-md-code]:text-[0.85em]", "[&_.ai-md-pre]:overflow-x-auto [&_.ai-md-pre]:rounded-lg [&_.ai-md-pre]:border [&_.ai-md-pre]:border-border [&_.ai-md-pre]:bg-muted/50 [&_.ai-md-pre]:p-3 [&_.ai-md-pre]:font-mono [&_.ai-md-pre]:text-xs", "[&_.ai-md-link]:text-link [&_.ai-md-link]:underline-offset-2 hover:[&_.ai-md-link]:underline", className),
543
580
  dangerouslySetInnerHTML: { __html: html },
544
581
  ...props
545
582
  });
@@ -569,7 +606,7 @@ function MessageAvatar({ src, alt = "", fallback, className, delay }) {
569
606
  });
570
607
  }
571
608
  function MessageContent({ className, markdown = false, streaming = false, children, ...props }) {
572
- const contentClassName = require_utils.cn("min-w-0 max-w-[min(100%,42rem)] text-sm leading-relaxed text-foreground", className);
609
+ const contentClassName = require_utils.cn("min-w-0 max-w-[min(100%,42rem)] text-sm leading-relaxed text-foreground [overflow-wrap:anywhere]", typeof children === "string" && !markdown && "whitespace-pre-wrap", className);
573
610
  if (markdown && typeof children === "string") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
574
611
  "data-slot": "message-content",
575
612
  streaming,
@@ -718,28 +755,28 @@ function CodeBlock({ code, language, filename, showCopy = true, highlight: highl
718
755
  children: [
719
756
  hasHeader ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
720
757
  "data-slot": "code-block-header",
721
- className: "flex items-center gap-2 border-b border-border/70 bg-muted/50 px-2.5 py-1.5",
758
+ className: "flex items-center gap-2 border-b border-border bg-muted/50 px-2.5 py-1.5",
722
759
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
723
760
  className: "flex min-w-0 flex-1 items-center gap-2",
724
761
  children: [
725
762
  filename ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
726
763
  "data-slot": "code-block-filename",
727
- className: "min-w-0 truncate font-mono text-[12px] text-foreground/80",
764
+ className: "min-w-0 truncate font-mono text-[0.75rem] text-foreground/80",
728
765
  title: filename,
729
766
  children: filename
730
767
  }) : language ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
731
768
  "data-slot": "code-block-language",
732
- className: "min-w-0 truncate font-mono text-[12px] text-foreground/80",
769
+ className: "min-w-0 truncate font-mono text-[0.75rem] text-foreground/80",
733
770
  children: language
734
771
  }) : null,
735
772
  filename && language ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
736
773
  "data-slot": "code-block-language",
737
- className: require_utils.cn("inline-flex shrink-0 items-center rounded-md px-1.5 py-0.5", "border border-border/60 bg-background/50", "font-sans text-[10px] font-medium tracking-wide text-muted-foreground uppercase"),
774
+ className: require_utils.cn("inline-flex shrink-0 items-center rounded-md px-1.5 py-0.5", "border border-border bg-background/50", "font-sans text-[0.625rem] font-medium tracking-wide text-muted-foreground uppercase"),
738
775
  children: language
739
776
  }) : null,
740
777
  collapsible ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
741
778
  "data-slot": "code-block-meta",
742
- className: "hidden shrink-0 font-sans text-[11px] tabular-nums text-muted-foreground/70 sm:inline",
779
+ className: "hidden shrink-0 font-sans text-[0.6875rem] tabular-nums text-muted-foreground/70 sm:inline",
743
780
  children: [lineCount, " lines"]
744
781
  }) : null
745
782
  ]
@@ -757,7 +794,7 @@ function CodeBlock({ code, language, filename, showCopy = true, highlight: highl
757
794
  "data-slot": "code-block-body",
758
795
  className: "relative",
759
796
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
760
- className: require_utils.cn("overflow-x-auto p-3 font-mono text-xs leading-relaxed text-foreground", "[&_.sh__line]:block", "transition-[max-height] duration-300 ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none", isCollapsed && "overflow-y-hidden", !isCollapsed && maxExpandedHeight !== false && collapsible && "overflow-y-auto"),
797
+ className: require_utils.cn("overflow-x-auto p-3 font-mono text-xs leading-relaxed text-foreground", "[&_.sh__line]:block", "transition-[max-height] duration-(--duration-slow) ease-out motion-reduce:transition-none", isCollapsed && "overflow-y-hidden", !isCollapsed && maxExpandedHeight !== false && collapsible && "overflow-y-auto"),
761
798
  style: isCollapsed ? { maxHeight: collapsedMaxHeight } : collapsible && maxExpandedHeight !== false ? { maxHeight: maxExpandedHeight } : void 0,
762
799
  children: highlightedHtml ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { dangerouslySetInnerHTML: { __html: highlightedHtml } }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", { children: visible })
763
800
  }), isCollapsed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -768,15 +805,15 @@ function CodeBlock({ code, language, filename, showCopy = true, highlight: highl
768
805
  }),
769
806
  collapsible ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
770
807
  "data-slot": "code-block-footer",
771
- className: "border-t border-border/70 bg-muted/40",
808
+ className: "border-t border-border bg-muted/40",
772
809
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
773
810
  type: "button",
774
811
  "data-slot": "code-block-expand",
775
812
  "aria-expanded": expanded,
776
813
  onClick: () => setExpanded(!expanded),
777
- className: require_utils.cn("flex w-full items-center justify-center gap-1.5 px-3 py-2", "text-[12px] font-medium text-muted-foreground", "outline-none transition-colors duration-150", "hover:bg-muted/70 hover:text-foreground", "focus-visible:bg-muted/70 focus-visible:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset"),
814
+ className: require_utils.cn("flex w-full items-center justify-center gap-1.5 px-3 py-2", "text-[0.75rem] font-medium text-muted-foreground", "outline-none transition-[color,background-color,border-color,text-decoration-color,fill,stroke,box-shadow] duration-(--duration-moderate)", "hover:bg-muted/70 hover:text-foreground", "focus-visible:bg-muted/70 focus-visible:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-inset"),
778
815
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: expanded ? "Show less" : hiddenLineCount === 1 ? "Show 1 more line" : `Show ${hiddenLineCount} more lines` }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, {
779
- className: require_utils.cn("size-3.5 opacity-70 transition-transform duration-200 ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none", expanded && "rotate-180"),
816
+ className: require_utils.cn("size-3.5 opacity-70 transition-transform duration-(--duration-slow) ease-out motion-reduce:transition-none", expanded && "rotate-180"),
780
817
  "aria-hidden": true
781
818
  })]
782
819
  })
@@ -826,7 +863,7 @@ function ResponseStream({ text, mode = "typewriter", speed = 2, className, markd
826
863
  className: require_utils.cn("whitespace-pre-wrap text-sm leading-relaxed text-foreground", mode === "fade" && streaming && "animate-[fade-in_200ms_ease-out]", className),
827
864
  children: [visible, streaming ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
828
865
  "aria-hidden": true,
829
- className: "ml-0.5 inline-block h-3.5 w-px translate-y-0.5 bg-foreground/70 animate-pulse motion-reduce:animate-none"
866
+ className: "ms-0.5 inline-block h-3.5 w-px translate-y-0.5 bg-foreground/70 animate-pulse motion-reduce:animate-none"
830
867
  }) : null]
831
868
  });
832
869
  }
@@ -924,7 +961,7 @@ function ScrollButton({ className, visible, label = "Scroll to latest", onClick,
924
961
  type,
925
962
  "aria-label": label,
926
963
  "data-slot": "scroll-button",
927
- className: require_utils.cn("absolute bottom-4 left-1/2 z-10 flex size-9 -translate-x-1/2 items-center justify-center", "rounded-full border border-border/80 bg-background/95 text-muted-foreground", "shadow-md shadow-black/10 backdrop-blur-md", "dark:border-border dark:bg-card/90 dark:shadow-black/40", "outline-none transition-[transform,background-color,color,box-shadow,border-color] duration-150 ease-out", "hover:border-border hover:bg-accent hover:text-foreground hover:shadow-lg", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "motion-safe:active:scale-[0.96]", "animate-[fade-in_150ms_ease-out] motion-reduce:animate-none", className),
964
+ className: require_utils.cn("absolute bottom-4 left-1/2 z-10 flex size-9 -translate-x-1/2 items-center justify-center", "rounded-full border border-border bg-background/95 text-muted-foreground", "shadow-lg backdrop-blur-md", "dark:border-border dark:bg-card/90 dark:shadow-black/40", "outline-none transition-[transform,background-color,color,box-shadow,border-color] duration-(--duration-moderate) ease-out", "hover:border-border hover:bg-accent hover:text-foreground hover:shadow-lg", "focus-visible:ring-[3px] focus-visible:ring-ring/50", "motion-safe:active:scale-[0.96]", "animate-[fade-in_150ms_ease-out] motion-reduce:animate-none", className),
928
965
  onClick: (event) => {
929
966
  scrollToBottom("smooth");
930
967
  onClick?.(event);
@@ -947,7 +984,7 @@ function SystemMessage({ className, title, variant = "info", children, ...props
947
984
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_alert.Alert, {
948
985
  "data-slot": "system-message",
949
986
  variant,
950
- className: require_utils.cn("text-left", className),
987
+ className: require_utils.cn("text-start", className),
951
988
  ...props,
952
989
  children: [title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_alert.AlertTitle, { children: title }) : null, children ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_alert.AlertDescription, { children }) : null]
953
990
  });
@@ -957,12 +994,17 @@ function SystemMessage({ className, title, variant = "info", children, ...props
957
994
  //#region src/components/ai/format-duration.ts
958
995
  /** Format elapsed ms for "Thought for …" / "Worked for …" labels. */
959
996
  function formatDuration(ms) {
960
- if (ms < 1e3) return `${Math.max(1, Math.round(ms))}ms`;
997
+ const wholeMs = Math.round(ms);
998
+ if (wholeMs < 1e3) return `${Math.max(1, wholeMs)}ms`;
961
999
  const seconds = ms / 1e3;
962
- if (seconds < 10) return `${seconds.toFixed(1)}s`;
963
- if (seconds < 60) return `${Math.round(seconds)}s`;
964
- const minutes = Math.floor(seconds / 60);
965
- const rem = Math.round(seconds % 60);
1000
+ const tenths = Math.round(seconds * 10) / 10;
1001
+ if (tenths < 10) return `${tenths.toFixed(1)}s`;
1002
+ const total = Math.round(seconds);
1003
+ if (total < 60) return `${total}s`;
1004
+ const hours = Math.floor(total / 3600);
1005
+ const minutes = Math.floor(total % 3600 / 60);
1006
+ const rem = total % 60;
1007
+ if (hours > 0) return minutes === 0 ? `${hours}h` : `${hours}h ${minutes}m`;
966
1008
  return rem === 0 ? `${minutes}m` : `${minutes}m ${rem}s`;
967
1009
  }
968
1010
 
@@ -1011,31 +1053,31 @@ function Reasoning({ children, content, isStreaming = false, durationMs = null,
1011
1053
  className: require_utils.cn("w-full", className),
1012
1054
  "data-slot": "reasoning",
1013
1055
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.CollapsibleTrigger, {
1014
- className: require_utils.cn("group flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-left text-[13px]", "text-muted-foreground transition-colors duration-150 hover:bg-accent hover:text-foreground", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"),
1056
+ className: require_utils.cn("group flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1.5 text-start text-[0.8125rem]", "text-muted-foreground transition-[box-shadow] duration-(--duration-moderate) hover:bg-accent hover:text-foreground", "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50"),
1015
1057
  children: [
1016
1058
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Brain, { className: "size-3.5 shrink-0 opacity-80" }),
1017
1059
  isStreaming ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextShimmer, {
1018
- className: "text-[13px] font-medium",
1060
+ className: "text-[0.8125rem] font-medium tabular-nums",
1019
1061
  children: label
1020
1062
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1021
- className: "font-medium",
1063
+ className: "font-medium tabular-nums",
1022
1064
  children: label
1023
1065
  }),
1024
1066
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, {
1025
1067
  "data-slot": "collapsible-icon",
1026
- className: "size-3.5 shrink-0 opacity-60 transition-transform duration-200"
1068
+ className: "size-3.5 shrink-0 opacity-60 transition-transform duration-(--duration-slow)"
1027
1069
  })
1028
1070
  ]
1029
1071
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_collapsible.CollapsibleContent, {
1030
1072
  innerClassName: "py-0",
1031
1073
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1032
- className: "my-1 ml-1.5 border-l border-border/70 py-1 pl-3",
1074
+ className: "my-1 ms-1.5 border-s border-border/70 py-1 ps-3",
1033
1075
  children: markdown && typeof body === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, {
1034
1076
  streaming: isStreaming,
1035
- className: "text-[13px] text-muted-foreground",
1077
+ className: "text-[0.8125rem] text-muted-foreground",
1036
1078
  children: body
1037
1079
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1038
- className: "whitespace-pre-wrap text-[13px] leading-relaxed text-muted-foreground",
1080
+ className: "whitespace-pre-wrap text-[0.8125rem] leading-relaxed text-muted-foreground",
1039
1081
  children: body
1040
1082
  })
1041
1083
  })
@@ -1050,7 +1092,7 @@ function ThinkingBar({ className, text = "Thinking", onStop, stopLabel = "Answer
1050
1092
  children: [onClick ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1051
1093
  type: "button",
1052
1094
  onClick,
1053
- className: "flex items-center gap-1 text-sm transition-opacity duration-150 hover:opacity-80",
1095
+ className: "flex items-center gap-1 text-sm transition-opacity duration-(--duration-moderate) hover:opacity-80",
1054
1096
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextShimmer, {
1055
1097
  className: "font-medium",
1056
1098
  children: text
@@ -1061,7 +1103,7 @@ function ThinkingBar({ className, text = "Thinking", onStop, stopLabel = "Answer
1061
1103
  }), onStop ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1062
1104
  type: "button",
1063
1105
  onClick: onStop,
1064
- className: "border-b border-dotted border-muted-foreground/50 text-sm text-muted-foreground transition-colors duration-150 hover:border-foreground hover:text-foreground",
1106
+ className: "border-b border-dotted border-muted-foreground/50 text-sm text-muted-foreground transition-[color,background-color,border-color,text-decoration-color,fill,stroke,box-shadow] duration-(--duration-moderate) hover:border-foreground hover:text-foreground",
1065
1107
  children: stopLabel
1066
1108
  }) : null]
1067
1109
  });
@@ -1070,7 +1112,7 @@ function ThinkingBar({ className, text = "Thinking", onStop, stopLabel = "Answer
1070
1112
  //#endregion
1071
1113
  //#region src/components/ai/thinking-trace.tsx
1072
1114
  /**
1073
- * Beautiful UI–style expandable agent trace with mode variants.
1115
+ * Expandable agent trace with mode variants.
1074
1116
  * Production hosts pass rows + streaming; demos can drive visibleCount.
1075
1117
  */
1076
1118
  function ThinkingTrace({ mode = "steps", activeLabel, doneLabel, durationMs = null, isStreaming = false, rows, query, open: openProp, onOpenChange, className, visibleCount }) {
@@ -1108,14 +1150,14 @@ function ThinkingTrace({ mode = "steps", activeLabel, doneLabel, durationMs = nu
1108
1150
  open,
1109
1151
  onOpenChange: setOpen,
1110
1152
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.CollapsibleTrigger, {
1111
- className: require_utils.cn("group -mx-1.5 flex w-fit items-center gap-2 rounded-md px-1.5 py-1 text-left", "transition-colors duration-150 hover:bg-accent"),
1153
+ className: require_utils.cn("group -mx-1.5 flex w-fit items-center gap-2 rounded-md px-1.5 py-1.5 text-start", "hover:bg-accent"),
1112
1154
  children: [
1113
1155
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Sparkles, { className: require_utils.cn("size-3.5 shrink-0", isStreaming ? "text-muted-foreground" : "text-muted-foreground/70") }),
1114
1156
  isStreaming ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(TextShimmer, {
1115
- className: "text-[13px] font-medium whitespace-nowrap",
1157
+ className: "text-[0.8125rem] font-medium whitespace-nowrap",
1116
1158
  children: workingLabel
1117
1159
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1118
- className: "text-[13px] font-medium whitespace-nowrap text-muted-foreground animate-[fade-in_350ms_ease-out_both] motion-reduce:animate-none",
1160
+ className: "text-[0.8125rem] font-medium whitespace-nowrap text-muted-foreground animate-[fade-in_350ms_ease-out_both] motion-reduce:animate-none",
1119
1161
  children: settledLabel
1120
1162
  }),
1121
1163
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, {
@@ -1126,10 +1168,11 @@ function ThinkingTrace({ mode = "steps", activeLabel, doneLabel, durationMs = nu
1126
1168
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_collapsible.CollapsibleContent, {
1127
1169
  innerClassName: "py-0",
1128
1170
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1129
- className: "relative mt-1 ml-1.5 border-l border-border/70 pl-3",
1171
+ className: "relative mt-1 ms-1.5 border-s border-border/70 ps-3",
1130
1172
  children: [mode === "search" && query ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1131
- className: "mb-2 flex items-center gap-1.5 text-[12px] text-muted-foreground",
1173
+ className: "mb-2 flex items-center gap-1.5 text-[0.75rem] text-muted-foreground",
1132
1174
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Globe, { className: "size-3 shrink-0" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1175
+ title: query,
1133
1176
  className: "truncate font-mono",
1134
1177
  children: query
1135
1178
  })]
@@ -1138,7 +1181,7 @@ function ThinkingTrace({ mode = "steps", activeLabel, doneLabel, durationMs = nu
1138
1181
  children: shown.map((row, index) => {
1139
1182
  const settled = !isStreaming || index < shown.length - 1 || count >= rows.length;
1140
1183
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
1141
- className: "flex min-w-0 items-start gap-2 text-[13px] animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none",
1184
+ className: "flex min-w-0 items-start gap-2 text-[0.8125rem] animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none",
1142
1185
  style: { animationDelay: `${Math.min(index, 6) * 40}ms` },
1143
1186
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1144
1187
  className: "mt-0.5 shrink-0",
@@ -1156,20 +1199,20 @@ function ThinkingTrace({ mode = "steps", activeLabel, doneLabel, durationMs = nu
1156
1199
  className: "font-medium text-foreground underline-offset-2 hover:underline",
1157
1200
  children: row.primary
1158
1201
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1159
- className: require_utils.cn("text-foreground", row.mono && "font-mono text-[12px]", mode === "reasoning" && "text-muted-foreground"),
1202
+ className: require_utils.cn("text-foreground", row.mono && "font-mono text-[0.75rem]", mode === "reasoning" && "text-muted-foreground"),
1160
1203
  children: row.primary
1161
1204
  }),
1162
1205
  row.secondary ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1163
- className: require_utils.cn("ml-1.5 text-muted-foreground", row.mono && "font-mono text-[12px]"),
1206
+ className: require_utils.cn("ms-1.5 text-muted-foreground", row.mono && "font-mono text-[0.75rem]"),
1164
1207
  children: row.secondary
1165
1208
  }) : null,
1166
1209
  (row.add != null || row.del != null) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1167
- className: "ml-1.5 font-mono text-[11px] tabular-nums",
1210
+ className: "ms-1.5 font-mono text-[0.6875rem] tabular-nums",
1168
1211
  children: [row.add != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1169
1212
  className: "text-success",
1170
1213
  children: ["+", row.add]
1171
1214
  }) : null, row.del != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1172
- className: "ml-1 text-destructive",
1215
+ className: "ms-1 text-destructive",
1173
1216
  children: ["-", row.del]
1174
1217
  }) : null]
1175
1218
  })
@@ -1221,7 +1264,7 @@ const MODE_DEFAULTS = {
1221
1264
  const RAIL = 15;
1222
1265
  /** Air between icon edge and the vertical segment (px). */
1223
1266
  const GAP = 6;
1224
- const STATUS_LABEL = {
1267
+ const STATUS_LABEL$1 = {
1225
1268
  pending: "Pending",
1226
1269
  running: "In progress",
1227
1270
  done: "Completed",
@@ -1249,7 +1292,7 @@ function Steps({ children, className, open, onOpenChange, defaultOpen = true, ti
1249
1292
  className: require_utils.cn("w-full min-w-0", className),
1250
1293
  "data-slot": "steps",
1251
1294
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.CollapsibleTrigger, {
1252
- className: require_utils.cn("group flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1 text-[13px]", "text-muted-foreground transition-colors duration-150 hover:bg-accent hover:text-foreground"),
1295
+ className: require_utils.cn("group flex w-fit max-w-full items-center gap-1.5 rounded-md px-1.5 py-1.5 text-[0.8125rem]", "text-muted-foreground hover:bg-accent hover:text-foreground"),
1253
1296
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1254
1297
  className: "min-w-0 truncate font-medium",
1255
1298
  children: title
@@ -1316,7 +1359,7 @@ function Step({ children, title, description, status = "pending", className }) {
1316
1359
  }
1317
1360
  })]
1318
1361
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1319
- className: require_utils.cn("min-w-0 flex-1 text-[13px]", "pb-3.5 group-last/step:pb-0"),
1362
+ className: require_utils.cn("min-w-0 flex-1 text-[0.8125rem]", "pb-3.5 group-last/step:pb-0"),
1320
1363
  children: [
1321
1364
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1322
1365
  className: require_utils.cn("break-words font-medium", status === "running" && "text-foreground", status === "done" && "text-muted-foreground", status === "pending" && "text-muted-foreground/80", status === "error" && "text-destructive"),
@@ -1326,16 +1369,16 @@ function Step({ children, title, description, status = "pending", className }) {
1326
1369
  },
1327
1370
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1328
1371
  className: "sr-only",
1329
- children: [STATUS_LABEL[status], ": "]
1372
+ children: [STATUS_LABEL$1[status], ": "]
1330
1373
  }), title]
1331
1374
  }),
1332
1375
  description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1333
- className: "mt-1 break-words text-[12px] leading-snug text-muted-foreground",
1376
+ className: "mt-1 break-words text-[0.75rem] leading-snug text-muted-foreground",
1334
1377
  children: description
1335
1378
  }) : null,
1336
1379
  children ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1337
1380
  "data-slot": "step-body",
1338
- className: require_utils.cn("mt-1.5 min-w-0 break-words text-[12px] leading-snug text-muted-foreground", "[&_pre]:mt-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:border [&_pre]:border-border [&_pre]:bg-muted/40 [&_pre]:p-2 [&_pre]:font-mono [&_pre]:text-[11px] [&_pre]:leading-relaxed", "[&_code]:rounded-sm [&_code]:bg-muted/50 [&_code]:px-1 [&_code]:py-px [&_code]:font-mono [&_code]:text-[11.5px]"),
1381
+ className: require_utils.cn("mt-1.5 min-w-0 break-words text-[0.75rem] leading-snug text-muted-foreground", "[&_pre]:mt-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:border [&_pre]:border-border [&_pre]:bg-muted/40 [&_pre]:p-2 [&_pre]:font-mono [&_pre]:text-[0.6875rem] [&_pre]:leading-relaxed", "[&_code]:rounded-sm [&_code]:bg-muted/50 [&_code]:px-1 [&_code]:py-px [&_code]:font-mono [&_code]:text-[0.71875rem]"),
1339
1382
  children
1340
1383
  }) : null
1341
1384
  ]
@@ -1419,11 +1462,12 @@ function Tool({ name, status: statusProp = "pending", summary, input, output, er
1419
1462
  "data-slot": "tool",
1420
1463
  "data-variant": "chip",
1421
1464
  "data-status": status,
1422
- className: require_utils.cn("inline-flex max-w-full items-center gap-1.5 rounded-md border border-border/80 bg-muted/40 px-2 py-1 text-[12px]", className),
1465
+ className: require_utils.cn("inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2 py-1 text-[0.75rem]", className),
1423
1466
  children: [
1424
1467
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status }),
1425
1468
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1426
- className: "shrink-0 font-medium text-foreground",
1469
+ title: name,
1470
+ className: "max-w-[9rem] shrink-0 truncate font-medium text-foreground",
1427
1471
  children: name
1428
1472
  }),
1429
1473
  summary ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -1433,77 +1477,79 @@ function Tool({ name, status: statusProp = "pending", summary, input, output, er
1433
1477
  ]
1434
1478
  });
1435
1479
  const trigger = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1436
- className: require_utils.cn("flex min-w-0 max-w-full items-center gap-1.5 text-[13px] text-muted-foreground", variant === "card" && "w-full justify-between font-normal"),
1480
+ className: require_utils.cn("flex min-w-0 max-w-full items-center gap-1.5 text-[0.8125rem] text-muted-foreground", variant === "card" && "w-full justify-between font-normal"),
1437
1481
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1438
1482
  className: "flex min-w-0 items-center gap-1.5",
1439
1483
  children: [
1440
1484
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StatusIcon, { status }),
1441
1485
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1442
- className: "shrink-0 font-medium text-foreground/90",
1486
+ title: name,
1487
+ className: "max-w-[45%] shrink-0 truncate font-medium text-foreground/90",
1443
1488
  children: name
1444
1489
  }),
1445
1490
  summary ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1446
- className: require_utils.cn("min-w-0 truncate rounded-md bg-muted px-1.5 py-0.5 font-mono text-[11.5px] text-muted-foreground"),
1491
+ className: require_utils.cn("min-w-0 truncate rounded-md bg-muted px-1.5 py-0.5 font-mono text-[0.71875rem] text-muted-foreground"),
1447
1492
  children: summary
1448
1493
  }) : null,
1449
1494
  variant === "card" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1450
- className: require_utils.cn("rounded-full border px-2 py-0.5 text-[11px] font-medium", statusBadge(status).className),
1495
+ className: require_utils.cn("shrink-0 rounded-full border px-2 py-0.5 text-[0.6875rem] font-medium", statusBadge(status).className),
1451
1496
  children: statusBadge(status).label
1452
1497
  }) : null
1453
1498
  ]
1454
1499
  }), hasBody ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, {
1455
1500
  "data-slot": "collapsible-icon",
1456
- className: "size-3.5 shrink-0 opacity-0 transition-[opacity,transform] duration-150 group-hover/tool:opacity-100 group-data-[panel-open]/collapsible:opacity-100"
1501
+ className: "size-3.5 shrink-0 opacity-0 transition-[opacity,transform] duration-(--duration-moderate) group-hover/tool:opacity-100 group-data-[panel-open]/collapsible:opacity-100"
1457
1502
  }) : null]
1458
1503
  });
1459
1504
  if (!hasBody) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1460
1505
  "data-slot": "tool",
1461
1506
  "data-variant": variant,
1462
1507
  "data-status": status,
1463
- className: require_utils.cn("flex w-full items-center py-0.5 text-left", className),
1508
+ className: require_utils.cn("flex w-full items-center py-0.5 text-start", className),
1464
1509
  children: trigger
1465
1510
  });
1466
1511
  const body = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1467
- className: "space-y-2 text-[12.5px]",
1512
+ className: "space-y-2 text-[0.78125rem]",
1468
1513
  children: [
1469
1514
  children,
1470
1515
  detail?.map((line, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1471
- className: require_utils.cn("font-mono leading-relaxed text-muted-foreground", line.tone === "add" && "text-success"),
1516
+ className: require_utils.cn("font-mono leading-relaxed text-muted-foreground [overflow-wrap:anywhere]", line.tone === "add" && "text-success"),
1472
1517
  children: line.text
1473
1518
  }, i)),
1474
1519
  input !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
1475
1520
  className: "mb-1 text-xs font-medium text-muted-foreground",
1476
1521
  children: "Input"
1477
1522
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
1478
- className: "max-h-40 overflow-auto rounded-md border border-border bg-background p-2 font-mono text-[11.5px] leading-relaxed",
1523
+ className: "max-h-40 overflow-auto rounded-md border border-border bg-background p-2 font-mono text-[0.71875rem] leading-relaxed",
1479
1524
  children: formatValue(input)
1480
1525
  })] }) : null,
1481
1526
  output !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h4", {
1482
1527
  className: "mb-1 text-xs font-medium text-muted-foreground",
1483
1528
  children: "Output"
1484
1529
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
1485
- className: "max-h-48 overflow-auto rounded-md border border-border bg-background p-2 font-mono text-[11.5px] leading-relaxed",
1530
+ className: "max-h-48 overflow-auto rounded-md border border-border bg-background p-2 font-mono text-[0.71875rem] leading-relaxed",
1486
1531
  children: formatValue(output)
1487
1532
  })] }) : null,
1488
1533
  errorText ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("section", {
1489
- className: "rounded-md border border-destructive/30 bg-destructive/8 p-2 text-destructive",
1534
+ className: "rounded-md border border-destructive/30 bg-destructive/8 p-2 text-destructive [overflow-wrap:anywhere]",
1490
1535
  children: errorText
1491
1536
  }) : null,
1492
1537
  diffs.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1493
1538
  className: "flex flex-wrap gap-1.5 pt-0.5",
1494
1539
  children: diffs.map((d) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1495
- className: "inline-flex items-center gap-1.5 rounded-md border border-border bg-muted/50 px-1.5 py-0.5 font-mono text-[11px]",
1540
+ className: "inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted/50 px-1.5 py-0.5 font-mono text-[0.6875rem]",
1496
1541
  children: [
1497
1542
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1498
- className: "text-foreground",
1543
+ title: d.file,
1544
+ className: "min-w-0 break-all text-foreground",
1499
1545
  children: d.file
1500
1546
  }),
1501
1547
  d.add != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1502
- className: "text-success",
1548
+ className: "shrink-0 text-success",
1503
1549
  children: ["+", d.add]
1504
1550
  }) : null,
1505
1551
  d.del != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1506
- className: "text-destructive",
1552
+ className: "shrink-0 text-destructive",
1507
1553
  children: ["-", d.del]
1508
1554
  }) : null
1509
1555
  ]
@@ -1522,7 +1568,7 @@ function Tool({ name, status: statusProp = "pending", summary, input, output, er
1522
1568
  onOpenChange,
1523
1569
  className: "group/tool group/collapsible",
1524
1570
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_collapsible.CollapsibleTrigger, {
1525
- className: "w-full bg-background px-3 py-2 hover:bg-accent/40",
1571
+ className: "w-full bg-background px-3 py-2.5 hover:bg-accent/40",
1526
1572
  children: trigger
1527
1573
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_collapsible.CollapsibleContent, {
1528
1574
  className: "border-t border-border",
@@ -1542,10 +1588,10 @@ function Tool({ name, status: statusProp = "pending", summary, input, output, er
1542
1588
  onOpenChange,
1543
1589
  className: "group/tool group/collapsible",
1544
1590
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_collapsible.CollapsibleTrigger, {
1545
- className: require_utils.cn("group/row -mx-1 flex min-h-8 w-[calc(100%+0.5rem)] min-w-0 items-center gap-2 rounded-md px-1 py-1 text-left", "transition-colors duration-150 hover:bg-accent", "pointer-coarse:min-h-11"),
1591
+ className: require_utils.cn("group/row -mx-1 flex min-h-8 w-[calc(100%+0.5rem)] min-w-0 items-center gap-2 rounded-md px-1 py-1 text-start", "hover:bg-accent", "pointer-coarse:min-h-11"),
1546
1592
  children: trigger
1547
1593
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_collapsible.CollapsibleContent, {
1548
- innerClassName: "py-1 pl-5",
1594
+ innerClassName: "py-1 ps-5",
1549
1595
  children: body
1550
1596
  })]
1551
1597
  })
@@ -1559,7 +1605,7 @@ function ToolGroup({ label, children, defaultOpen = true, className }) {
1559
1605
  defaultOpen,
1560
1606
  className: "group/collapsible",
1561
1607
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.CollapsibleTrigger, {
1562
- className: require_utils.cn("-mx-1.5 flex w-fit items-center gap-1.5 rounded-md px-1.5 py-1 text-[12.5px]", "text-muted-foreground transition-colors duration-150 hover:bg-accent hover:text-foreground"),
1608
+ className: require_utils.cn("-mx-1.5 flex w-fit items-center gap-1.5 rounded-md px-1.5 py-1.5 text-[0.78125rem]", "text-muted-foreground hover:bg-accent hover:text-foreground"),
1563
1609
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, {
1564
1610
  "data-slot": "collapsible-icon",
1565
1611
  className: "size-3"
@@ -1621,7 +1667,7 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
1621
1667
  };
1622
1668
  if (sent) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1623
1669
  "data-slot": "approval-card",
1624
- className: require_utils.cn("flex min-h-28 w-full max-w-sm flex-col items-center justify-center gap-2 rounded-xl border border-border bg-card p-4 shadow-xs", className),
1670
+ className: require_utils.cn("flex min-h-28 w-full max-w-sm flex-col items-center justify-center gap-2 rounded-lg bg-card p-4 shadow-card", className),
1625
1671
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1626
1672
  className: "flex size-6 items-center justify-center rounded-full bg-success text-white animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both]",
1627
1673
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
@@ -1629,24 +1675,24 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
1629
1675
  strokeWidth: 3
1630
1676
  })
1631
1677
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1632
- className: "text-[13px] font-medium text-foreground",
1678
+ className: "text-[0.8125rem] font-medium text-foreground",
1633
1679
  children: "Approved"
1634
1680
  })]
1635
1681
  });
1636
1682
  if (!multi) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1637
1683
  "data-slot": "approval-card",
1638
1684
  "data-destructive": destructive ? "true" : "false",
1639
- className: require_utils.cn("w-full max-w-md overflow-hidden rounded-xl border bg-card shadow-xs", destructive ? "border-destructive/35" : "border-border", className),
1685
+ className: require_utils.cn("w-full max-w-md overflow-hidden rounded-lg bg-card shadow-card", destructive ? "border-destructive/35" : "border-border", className),
1640
1686
  children: [
1641
1687
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1642
1688
  className: "flex items-start justify-between gap-2 px-3 pt-3",
1643
1689
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1644
1690
  className: "min-w-0 space-y-1",
1645
1691
  children: [title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1646
- className: "text-[13px] font-medium text-pretty text-foreground",
1692
+ className: "text-[0.8125rem] font-medium text-pretty text-foreground [overflow-wrap:anywhere]",
1647
1693
  children: title
1648
1694
  }) : null, description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1649
- className: "text-xs text-pretty text-muted-foreground",
1695
+ className: "text-xs text-pretty text-muted-foreground [overflow-wrap:anywhere]",
1650
1696
  children: description
1651
1697
  }) : null]
1652
1698
  }), onDismiss ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
@@ -1659,20 +1705,22 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
1659
1705
  }) : null]
1660
1706
  }),
1661
1707
  preview ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1662
- className: "px-3 pt-2",
1708
+ className: "min-w-0 overflow-x-auto px-3 pt-2 [overflow-wrap:anywhere]",
1663
1709
  children: preview
1664
1710
  }) : null,
1665
1711
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1666
- className: "flex items-center justify-end gap-1.5 px-3 py-2.5",
1712
+ className: "flex flex-wrap items-center justify-end gap-1.5 px-3 py-2.5",
1667
1713
  children: [onSkip ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
1668
1714
  type: "button",
1669
1715
  variant: "ghost",
1670
1716
  size: "sm",
1717
+ wrap: true,
1671
1718
  onClick: onSkip,
1672
1719
  children: skipLabel
1673
1720
  }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
1674
1721
  type: "button",
1675
1722
  size: "sm",
1723
+ wrap: true,
1676
1724
  variant: destructive ? "destructive" : "default",
1677
1725
  onClick: () => {
1678
1726
  setSent(true);
@@ -1687,21 +1735,21 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
1687
1735
  const canAdvance = selected.length > 0;
1688
1736
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1689
1737
  "data-slot": "approval-card",
1690
- className: require_utils.cn("w-full max-w-sm overflow-hidden rounded-xl border border-border bg-card shadow-xs", className),
1738
+ className: require_utils.cn("w-full max-w-sm overflow-hidden rounded-lg shadow-card", className),
1691
1739
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1692
1740
  className: "p-3 animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none",
1693
1741
  children: [
1694
1742
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1695
1743
  className: "flex items-start justify-between gap-2",
1696
1744
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1697
- className: "text-[13px] font-medium text-pretty text-foreground",
1745
+ className: "min-w-0 text-[0.8125rem] font-medium text-pretty text-foreground [overflow-wrap:anywhere]",
1698
1746
  children: question.prompt
1699
1747
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1700
- className: "flex items-center gap-1",
1748
+ className: "flex shrink-0 items-center gap-1",
1701
1749
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1702
1750
  className: "flex items-center gap-0.5",
1703
1751
  "aria-hidden": true,
1704
- children: progress.map((on, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_utils.cn("h-1 rounded-full transition-[width,background-color] duration-200", on ? "w-3 bg-primary" : "w-1.5 bg-border") }, i))
1752
+ children: progress.map((on, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_utils.cn("h-1 rounded-full transition-[width,background-color] duration-(--duration-slow)", on ? "w-3 bg-primary" : "w-1.5 bg-border") }, i))
1705
1753
  }), onDismiss ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
1706
1754
  type: "button",
1707
1755
  variant: "ghost",
@@ -1720,7 +1768,7 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
1720
1768
  type: "button",
1721
1769
  "aria-pressed": on,
1722
1770
  onClick: () => toggleOption(option.id),
1723
- className: require_utils.cn("-mx-1.5 flex min-h-10 items-start gap-2 rounded-md px-1.5 py-1.5 text-left text-[13px]", "transition-colors duration-150 hover:bg-accent", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", on && "bg-accent"),
1771
+ className: require_utils.cn("-mx-1.5 flex min-h-10 items-start gap-2 rounded-md px-1.5 py-1.5 text-start text-[0.8125rem]", "transition-[box-shadow] duration-(--duration-moderate) hover:bg-accent", "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", on && "bg-accent"),
1724
1772
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1725
1773
  className: require_utils.cn("mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border", on ? "border-primary bg-primary text-primary-foreground" : "border-border"),
1726
1774
  children: on ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
@@ -1730,10 +1778,10 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
1730
1778
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1731
1779
  className: "min-w-0",
1732
1780
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1733
- className: "font-medium text-foreground",
1781
+ className: "font-medium text-foreground [overflow-wrap:anywhere]",
1734
1782
  children: option.label
1735
1783
  }), option.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1736
- className: "mt-0.5 block text-xs text-muted-foreground",
1784
+ className: "mt-0.5 block text-xs text-muted-foreground [overflow-wrap:anywhere]",
1737
1785
  children: option.description
1738
1786
  }) : null]
1739
1787
  })]
@@ -1756,22 +1804,68 @@ function ApprovalCard({ title, description, questions, confirmLabel = "Confirm",
1756
1804
  });
1757
1805
  }
1758
1806
 
1807
+ //#endregion
1808
+ //#region src/components/ai/use-image-failed.ts
1809
+ /**
1810
+ * Whether an `<img>` failed to load, for a fallback such as initials or an icon.
1811
+ *
1812
+ * `onError` alone misses an image that failed before React was listening: a
1813
+ * server-rendered page can hydrate after the browser has already given up on a
1814
+ * dead URL, and that `error` event is never replayed. So the ref also checks the
1815
+ * element when it mounts. A finished image with no pixels either failed or is an
1816
+ * SVG without an intrinsic size (which reports a natural width of 0 as well), and
1817
+ * `decode()` tells the two apart; a browser without it counts the image as failed.
1818
+ *
1819
+ * `failed` stays set for the life of the component that calls the hook, so key
1820
+ * that component by the image address and a new address gets a fresh attempt:
1821
+ *
1822
+ * ```tsx
1823
+ * function Photo({ src, fallback }: { src: string; fallback: React.ReactNode }) {
1824
+ * const { failed, ref, onError } = useImageFailed();
1825
+ * return failed ? fallback : <img ref={ref} src={src} onError={onError} alt="" />;
1826
+ * }
1827
+ * // <Photo key={url} src={url} fallback={<Initials />} />
1828
+ * ```
1829
+ */
1830
+ function useImageFailed() {
1831
+ const [failed, setFailed] = react.useState(false);
1832
+ const onError = react.useCallback(() => setFailed(true), []);
1833
+ return {
1834
+ failed,
1835
+ ref: react.useCallback((image) => {
1836
+ if (!image || !image.complete || image.naturalWidth > 0) return;
1837
+ if (typeof image.decode !== "function") setFailed(true);
1838
+ else image.decode().catch(() => setFailed(true));
1839
+ }, []),
1840
+ onError
1841
+ };
1842
+ }
1843
+
1759
1844
  //#endregion
1760
1845
  //#region src/components/ai/source.tsx
1761
- function Source({ href, title, description, favicon, domain, className }) {
1846
+ /** The site's icon, or a document glyph when there is none or it does not load. */
1847
+ function SourceFavicon({ src }) {
1848
+ const { failed, ref, onError } = useImageFailed();
1849
+ return src && !failed ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
1850
+ ref,
1851
+ src,
1852
+ alt: "",
1853
+ onError,
1854
+ className: "size-3.5 rounded-sm outline outline-1 outline-black/10 dark:outline-white/10"
1855
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.FileText, { className: "size-3 shrink-0 opacity-70" });
1856
+ }
1857
+ function Source({ href, title, description, favicon, domain, showTitle = false, className }) {
1762
1858
  const host = domain ?? (href ? safeHost(href) : void 0);
1859
+ const label = showTitle ? title : host ?? title;
1763
1860
  const content = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1764
1861
  "data-slot": "source",
1765
- className: require_utils.cn("inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted/50 px-2 py-0.5 text-[12px]", "text-muted-foreground transition-colors duration-150 hover:bg-accent hover:text-foreground", className),
1862
+ className: require_utils.cn("inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted/50 px-2 py-1.5 text-[0.75rem]", "text-muted-foreground hover:bg-accent hover:text-foreground", className),
1766
1863
  children: [
1767
- favicon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
1768
- src: favicon,
1769
- alt: "",
1770
- className: "size-3.5 rounded-sm outline outline-1 outline-black/10 dark:outline-white/10"
1771
- }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.FileText, { className: "size-3 shrink-0 opacity-70" }),
1864
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SourceFavicon, { src: favicon }, favicon),
1772
1865
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1866
+ title: label,
1773
1867
  className: "min-w-0 truncate font-medium",
1774
- children: host ?? title
1868
+ children: label
1775
1869
  }),
1776
1870
  href ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ExternalLink, { className: "size-3 shrink-0 opacity-50" }) : null
1777
1871
  ]
@@ -1783,7 +1877,7 @@ function Source({ href, title, description, favicon, domain, className }) {
1783
1877
  className: "inline-flex max-w-full",
1784
1878
  children: content
1785
1879
  }) : content;
1786
- if (!description && title === host) return chip;
1880
+ if (!description && title === label) return chip;
1787
1881
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_tooltip.Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipTrigger, {
1788
1882
  asChild: true,
1789
1883
  children: chip
@@ -1802,7 +1896,8 @@ function Source({ href, title, description, favicon, domain, className }) {
1802
1896
  children: description
1803
1897
  }) : null,
1804
1898
  href ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1805
- className: "truncate font-mono text-[10px] opacity-70",
1899
+ title: href,
1900
+ className: "truncate font-mono text-[0.625rem] opacity-70",
1806
1901
  children: href
1807
1902
  }) : null
1808
1903
  ]
@@ -1810,15 +1905,19 @@ function Source({ href, title, description, favicon, domain, className }) {
1810
1905
  })] });
1811
1906
  }
1812
1907
  function Sources({ children, className, label }) {
1908
+ const hostOf = (props) => props.domain ?? (props.href ? safeHost(props.href) : void 0) ?? props.title;
1909
+ const counts = /* @__PURE__ */ new Map();
1910
+ for (const child of react.Children.toArray(children)) if (react.isValidElement(child) && child.type === Source) counts.set(hostOf(child.props), (counts.get(hostOf(child.props)) ?? 0) + 1);
1911
+ const shown = react.Children.map(children, (child) => react.isValidElement(child) && child.type === Source && (counts.get(hostOf(child.props)) ?? 0) > 1 ? react.cloneElement(child, { showTitle: true }) : child);
1813
1912
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1814
1913
  "data-slot": "sources",
1815
1914
  className: require_utils.cn("flex flex-col gap-1.5", className),
1816
1915
  children: [label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1817
- className: "text-[11px] font-medium text-muted-foreground",
1916
+ className: "text-[0.6875rem] font-medium text-muted-foreground",
1818
1917
  children: label
1819
1918
  }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1820
1919
  className: "flex flex-wrap gap-1.5",
1821
- children
1920
+ children: shown
1822
1921
  })]
1823
1922
  });
1824
1923
  }
@@ -1831,65 +1930,221 @@ function safeHost(url) {
1831
1930
  }
1832
1931
 
1833
1932
  //#endregion
1834
- //#region src/components/ai/inline-diff.tsx
1835
- /** Naive line diff for presentation (not a full Myers algorithm). */
1836
- function lineDiff(before, after) {
1837
- const a = before.split("\n");
1838
- const b = after.split("\n");
1839
- const aSet = new Set(a);
1840
- const bSet = new Set(b);
1933
+ //#region src/components/ai/line-diff.ts
1934
+ const DIFF_LIMITS = {
1935
+ maxCells: 4e6,
1936
+ maxEdits: 2e3,
1937
+ maxWork: 8e6
1938
+ };
1939
+ const context = (text) => ({
1940
+ type: "context",
1941
+ text
1942
+ });
1943
+ const added = (text) => ({
1944
+ type: "add",
1945
+ text
1946
+ });
1947
+ const removed = (text) => ({
1948
+ type: "del",
1949
+ text
1950
+ });
1951
+ /** Longest-common-subsequence diff of two line lists, in order. Cost is the product of the lengths. */
1952
+ function exactDiff(a, b) {
1953
+ const cols = b.length + 1;
1954
+ const table = new Uint32Array((a.length + 1) * cols);
1955
+ for (let i = a.length - 1; i >= 0; i--) for (let j = b.length - 1; j >= 0; j--) table[i * cols + j] = a[i] === b[j] ? table[(i + 1) * cols + j + 1] + 1 : Math.max(table[(i + 1) * cols + j], table[i * cols + j + 1]);
1841
1956
  const lines = [];
1842
- for (const line of a) if (!bSet.has(line)) lines.push({
1843
- type: "del",
1844
- text: line
1845
- });
1846
- for (const line of b) if (!aSet.has(line)) lines.push({
1847
- type: "add",
1848
- text: line
1849
- });
1850
- else if (!lines.some((l) => l.type === "context" && l.text === line)) {}
1851
- if (lines.length === 0 && before !== after) return [...a.map((text) => ({
1852
- type: "del",
1853
- text
1854
- })), ...b.map((text) => ({
1855
- type: "add",
1856
- text
1857
- }))];
1858
- const dels = a.filter((line) => !bSet.has(line)).map((text) => ({
1859
- type: "del",
1860
- text
1861
- }));
1862
- const adds = b.filter((line) => !aSet.has(line)).map((text) => ({
1863
- type: "add",
1864
- text
1865
- }));
1866
- const shared = b.filter((line) => aSet.has(line)).map((text) => ({
1867
- type: "context",
1868
- text
1869
- }));
1870
- if (shared.length > 6) return [...dels, ...adds];
1957
+ let i = 0;
1958
+ let j = 0;
1959
+ while (i < a.length && j < b.length) if (a[i] === b[j]) {
1960
+ lines.push(context(a[i]));
1961
+ i += 1;
1962
+ j += 1;
1963
+ } else if (table[(i + 1) * cols + j] >= table[i * cols + j + 1]) {
1964
+ lines.push(removed(a[i]));
1965
+ i += 1;
1966
+ } else {
1967
+ lines.push(added(b[j]));
1968
+ j += 1;
1969
+ }
1970
+ for (; i < a.length; i++) lines.push(removed(a[i]));
1971
+ for (; j < b.length; j++) lines.push(added(b[j]));
1972
+ return lines;
1973
+ }
1974
+ /** Within each run of changes, every removal comes before every addition, as the exact comparison writes them. */
1975
+ function removalsFirst(lines) {
1976
+ const ordered = [];
1977
+ let dropped = [];
1978
+ let gained = [];
1979
+ const flush = () => {
1980
+ for (const line of dropped) ordered.push(line);
1981
+ for (const line of gained) ordered.push(line);
1982
+ dropped = [];
1983
+ gained = [];
1984
+ };
1985
+ for (const line of lines) if (line.type === "context") {
1986
+ flush();
1987
+ ordered.push(line);
1988
+ } else if (line.type === "del") dropped.push(line);
1989
+ else gained.push(line);
1990
+ flush();
1991
+ return ordered;
1992
+ }
1993
+ /**
1994
+ * Shortest edit script by Myers' greedy search, which takes time proportional
1995
+ * to the lines times the number of edits rather than to the product of the
1996
+ * lengths, so a few edits in a long file stay cheap however far apart they are.
1997
+ * Gives up (`null`) when more than `maxEdits` edits or `maxWork` steps are needed.
1998
+ */
1999
+ function boundedDiff(a, b, { maxEdits, maxWork }) {
2000
+ const n = a.length;
2001
+ const m = b.length;
2002
+ const limit = Math.min(n + m, maxEdits);
2003
+ const offset = limit + 1;
2004
+ const furthest = new Int32Array(2 * limit + 3);
2005
+ const trace = [];
2006
+ let work = 0;
2007
+ for (let d = 0; d <= limit; d++) {
2008
+ trace.push(furthest.slice(offset - d, offset + d + 1));
2009
+ for (let k = -d; k <= d; k += 2) {
2010
+ let x = k === -d || k !== d && furthest[offset + k - 1] < furthest[offset + k + 1] ? furthest[offset + k + 1] : furthest[offset + k - 1] + 1;
2011
+ let y = x - k;
2012
+ const start = x;
2013
+ while (x < n && y < m && a[x] === b[y]) {
2014
+ x += 1;
2015
+ y += 1;
2016
+ }
2017
+ work += 1 + x - start;
2018
+ furthest[offset + k] = x;
2019
+ if (x >= n && y >= m) return removalsFirst(walkBack(a, b, trace, d));
2020
+ if (work > maxWork) return null;
2021
+ }
2022
+ }
2023
+ return null;
2024
+ }
2025
+ /** The path of a finished search, from the end back to the start, as lines in order. */
2026
+ function walkBack(a, b, trace, edits) {
2027
+ const lines = [];
2028
+ let x = a.length;
2029
+ let y = b.length;
2030
+ for (let d = edits; d >= 0; d--) {
2031
+ const before = trace[d];
2032
+ const k = x - y;
2033
+ let fromAbove = false;
2034
+ let previousX = 0;
2035
+ let previousY = 0;
2036
+ if (d > 0) {
2037
+ fromAbove = k === -d || k !== d && before[k - 1 + d] < before[k + 1 + d];
2038
+ const previousK = fromAbove ? k + 1 : k - 1;
2039
+ previousX = before[previousK + d];
2040
+ previousY = previousX - previousK;
2041
+ }
2042
+ while (x > previousX && y > previousY) {
2043
+ lines.push(context(a[x - 1]));
2044
+ x -= 1;
2045
+ y -= 1;
2046
+ }
2047
+ if (d > 0) lines.push(fromAbove ? added(b[y - 1]) : removed(a[x - 1]));
2048
+ x = previousX;
2049
+ y = previousY;
2050
+ }
2051
+ return lines.reverse();
2052
+ }
2053
+ /** The part of two line lists between their common head and tail, compared as exactly as `limits` allow. */
2054
+ function diffMiddle(a, b, limits) {
2055
+ if (a.length === 0) return b.map(added);
2056
+ if (b.length === 0) return a.map(removed);
2057
+ if (a.length * b.length <= limits.maxCells) return exactDiff(a, b);
2058
+ return boundedDiff(a, b, limits) ?? [...a.map(removed), ...b.map(added)];
2059
+ }
2060
+ /**
2061
+ * Line diff between two line lists, in order: unchanged lines as `context`,
2062
+ * removed lines as `del`, new lines as `add`. The common head and tail are
2063
+ * trimmed first, so a small edit to a long file stays cheap, and a line that
2064
+ * also appears elsewhere is matched by position, so a repeated line is shown as
2065
+ * added or removed rather than hidden.
2066
+ */
2067
+ function diffLines(before, after, limits = DIFF_LIMITS) {
2068
+ let head = 0;
2069
+ while (head < before.length && head < after.length && before[head] === after[head]) head += 1;
2070
+ let tailBefore = before.length;
2071
+ let tailAfter = after.length;
2072
+ while (tailBefore > head && tailAfter > head && before[tailBefore - 1] === after[tailAfter - 1]) {
2073
+ tailBefore -= 1;
2074
+ tailAfter -= 1;
2075
+ }
1871
2076
  return [
1872
- ...shared.slice(0, 2),
1873
- ...dels,
1874
- ...adds,
1875
- ...shared.slice(2)
2077
+ ...before.slice(0, head).map(context),
2078
+ ...diffMiddle(before.slice(head, tailBefore), after.slice(head, tailAfter), limits),
2079
+ ...before.slice(tailBefore).map(context)
1876
2080
  ];
1877
2081
  }
2082
+
2083
+ //#endregion
2084
+ //#region src/components/ai/inline-diff.tsx
2085
+ /** Unchanged lines kept on each side of a change. */
2086
+ const CONTEXT_LINES = 2;
2087
+ /**
2088
+ * Line diff between two texts, in order: unchanged lines as `context`, removed
2089
+ * lines as `del`, new lines as `add`. A line that also appears elsewhere is
2090
+ * matched by position, so a repeated line is shown as added or removed rather
2091
+ * than hidden. The common head and tail are trimmed before the comparison, and
2092
+ * a long file is compared by its edits rather than by a table of every pair of
2093
+ * lines, so a few edits stay cheap however far apart they are.
2094
+ */
2095
+ function lineDiff(before, after) {
2096
+ return diffLines(before.split("\n"), after.split("\n"));
2097
+ }
2098
+ /** Keeps `CONTEXT_LINES` unchanged lines around each change and folds longer unchanged runs into one gap row. */
2099
+ function withContext(lines) {
2100
+ if (lines.every((line) => line.type === "context")) return lines;
2101
+ const keep = lines.map(() => false);
2102
+ lines.forEach((line, index) => {
2103
+ if (line.type === "context") return;
2104
+ for (let near = Math.max(0, index - CONTEXT_LINES); near <= Math.min(lines.length - 1, index + CONTEXT_LINES); near++) keep[near] = true;
2105
+ });
2106
+ const rows = [];
2107
+ let skipped = 0;
2108
+ const flush = (index) => {
2109
+ if (skipped === 1) rows.push(lines[index - 1]);
2110
+ else if (skipped > 1) rows.push({
2111
+ type: "gap",
2112
+ count: skipped
2113
+ });
2114
+ skipped = 0;
2115
+ };
2116
+ lines.forEach((line, index) => {
2117
+ if (keep[index]) {
2118
+ flush(index);
2119
+ rows.push(line);
2120
+ } else skipped += 1;
2121
+ });
2122
+ flush(lines.length);
2123
+ return rows;
2124
+ }
1878
2125
  function InlineDiff({ source, className, maxLines = 40 }) {
1879
- const lines = react.useMemo(() => lineDiff(source.before, source.after), [source.before, source.after]);
2126
+ const lines = react.useMemo(() => withContext(lineDiff(source.before, source.after)), [source.before, source.after]);
1880
2127
  const visible = lines.slice(0, maxLines);
1881
2128
  const hidden = lines.length - visible.length;
1882
2129
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1883
2130
  "data-slot": "inline-diff",
1884
- className: require_utils.cn("overflow-hidden rounded-lg border border-border bg-muted/30 font-mono text-[11.5px] leading-relaxed", className),
2131
+ className: require_utils.cn("overflow-hidden rounded-lg border border-border bg-muted/30 font-mono text-[0.71875rem] leading-relaxed", className),
1885
2132
  children: [
1886
2133
  source.fileName ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1887
- className: "border-b border-border/80 bg-muted/50 px-2.5 py-1 text-xs text-muted-foreground",
2134
+ title: source.fileName,
2135
+ className: "border-b border-border bg-muted/50 px-2.5 py-1 text-xs break-all text-muted-foreground",
1888
2136
  children: source.fileName
1889
2137
  }) : null,
1890
2138
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
1891
2139
  className: "overflow-x-auto p-0",
1892
- children: visible.map((line, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2140
+ children: visible.map((line, i) => line.type === "gap" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2141
+ className: "px-2.5 py-0.5 text-center text-[0.6875rem] text-subtle-foreground select-none",
2142
+ children: [
2143
+ line.count,
2144
+ " unchanged ",
2145
+ line.count === 1 ? "line" : "lines"
2146
+ ]
2147
+ }, i) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1893
2148
  className: require_utils.cn("flex gap-2 px-2.5 py-0.5", line.type === "add" && "bg-success/10 text-success", line.type === "del" && "bg-destructive/10 text-destructive", line.type === "context" && "text-muted-foreground"),
1894
2149
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1895
2150
  className: "w-3 shrink-0 select-none opacity-70",
@@ -1901,7 +2156,7 @@ function InlineDiff({ source, className, maxLines = 40 }) {
1901
2156
  }, i))
1902
2157
  }),
1903
2158
  hidden > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1904
- className: "border-t border-border/60 px-2.5 py-1 text-[11px] text-muted-foreground",
2159
+ className: "border-t border-border px-2.5 py-1 text-[0.6875rem] text-muted-foreground",
1905
2160
  children: [
1906
2161
  "+",
1907
2162
  hidden,
@@ -1935,7 +2190,7 @@ function FeedbackBar({ className, onCopy, onRegenerate, onFeedback, copyText, sh
1935
2190
  };
1936
2191
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipProvider, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1937
2192
  "data-slot": "feedback-bar",
1938
- className: require_utils.cn("flex items-center gap-0.5 text-muted-foreground", className),
2193
+ className: require_utils.cn("flex items-center gap-2 text-muted-foreground", className),
1939
2194
  children: [
1940
2195
  showCopy ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Action, {
1941
2196
  tip: copied ? "Copied" : "Copy",
@@ -1991,7 +2246,7 @@ function PromptSuggestion({ children, onClick, className }) {
1991
2246
  type: "button",
1992
2247
  "data-slot": "prompt-suggestion",
1993
2248
  onClick,
1994
- className: require_utils.cn("inline-flex max-w-full items-center rounded-full border border-border bg-background px-3 py-1.5", "text-left text-[13px] text-foreground shadow-xs", "transition-[background-color,box-shadow,transform] duration-150 ease-out", "hover:bg-accent hover:shadow-sm", "motion-safe:active:scale-[0.98]", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", className),
2249
+ className: require_utils.cn("inline-flex max-w-full items-center rounded-full border border-border bg-background px-3 py-1.5", "text-start text-[0.8125rem] text-foreground shadow-xs", "transition-[background-color,box-shadow,transform] duration-(--duration-moderate) ease-out", "hover:bg-accent hover:shadow-card", "motion-safe:active:scale-[0.98]", "focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", className),
1995
2250
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1996
2251
  className: "min-w-0 truncate",
1997
2252
  children
@@ -2003,7 +2258,7 @@ function PromptSuggestions({ children, className, label = "Follow-ups" }) {
2003
2258
  "data-slot": "prompt-suggestions",
2004
2259
  className: require_utils.cn("flex flex-col gap-2", className),
2005
2260
  children: [label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2006
- className: "text-[12px] font-medium text-muted-foreground",
2261
+ className: "text-[0.75rem] font-medium text-muted-foreground",
2007
2262
  children: label
2008
2263
  }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2009
2264
  className: "flex flex-wrap gap-1.5",
@@ -2059,7 +2314,7 @@ function StreamingText({ text = "", tokens, sources = [], followUps = [], onFoll
2059
2314
  className: require_utils.cn("flex w-full flex-col gap-3", className),
2060
2315
  children: [
2061
2316
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2062
- className: "text-[13px] leading-relaxed text-pretty text-foreground",
2317
+ className: "text-[0.8125rem] leading-relaxed text-pretty text-foreground",
2063
2318
  children: tokens ? tokens.slice(0, visible).map((tok, i) => {
2064
2319
  if (tok.type === "cite") {
2065
2320
  const src = sources.find((s) => s.id === tok.id);
@@ -2069,16 +2324,16 @@ function StreamingText({ text = "", tokens, sources = [], followUps = [], onFoll
2069
2324
  title: src?.title ?? tok.id,
2070
2325
  href: src?.href,
2071
2326
  description: src?.description,
2072
- className: "align-super text-[10px]"
2327
+ className: "align-super text-[0.625rem]"
2073
2328
  })
2074
2329
  }, i);
2075
2330
  }
2076
2331
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2077
- className: require_utils.cn("transition-[filter,opacity] duration-200 ease-out motion-reduce:transition-none", i === visible - 1 && revealing ? "opacity-90 blur-[2px] motion-reduce:blur-0" : "opacity-100 blur-0"),
2332
+ className: require_utils.cn("transition-[filter,opacity] duration-(--duration-slow) ease-out motion-reduce:transition-none", i === visible - 1 && revealing ? "opacity-90 blur-[2px] motion-reduce:blur-0" : "opacity-100 blur-0"),
2078
2333
  children: tok.text
2079
2334
  }, i);
2080
2335
  }) : words?.slice(0, visible).map((w, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2081
- className: require_utils.cn("transition-[filter,opacity] duration-200 ease-out motion-reduce:transition-none", i === visible - 1 && revealing && !/^\s+$/.test(w) ? "opacity-90 blur-[2px] motion-reduce:blur-0" : "opacity-100 blur-0"),
2336
+ className: require_utils.cn("transition-[filter,opacity] duration-(--duration-slow) ease-out motion-reduce:transition-none", i === visible - 1 && revealing && !/^\s+$/.test(w) ? "opacity-90 blur-[2px] motion-reduce:blur-0" : "opacity-100 blur-0"),
2082
2337
  children: w
2083
2338
  }, i))
2084
2339
  }),
@@ -2131,31 +2386,31 @@ function DiffTable({ title = "Proposed changes", columns, rows, addedRows = [],
2131
2386
  const showAdded = stage >= 2 && addedRows.length > 0;
2132
2387
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2133
2388
  "data-slot": "diff-table",
2134
- className: require_utils.cn("w-full overflow-hidden rounded-xl border border-border bg-card shadow-xs", className),
2389
+ className: require_utils.cn("w-full overflow-hidden rounded-lg bg-card shadow-card", className),
2135
2390
  children: [title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2136
2391
  className: "flex items-center justify-between border-b border-border px-3 py-2",
2137
2392
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2138
- className: "text-[12.5px] font-medium text-foreground",
2393
+ className: "text-[0.78125rem] font-medium text-foreground",
2139
2394
  children: title
2140
2395
  })
2141
2396
  }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2142
2397
  className: "overflow-x-auto",
2143
2398
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("table", {
2144
- className: "w-full border-collapse text-left text-[13px]",
2399
+ className: "w-full border-collapse text-start text-[0.8125rem]",
2145
2400
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
2146
2401
  className: "border-b border-border",
2147
2402
  children: columns.map((col) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("th", {
2148
2403
  scope: "col",
2149
- className: require_utils.cn("px-3 py-2 text-[12px] font-medium text-muted-foreground", col.className),
2404
+ className: require_utils.cn("px-3 py-2 text-[0.75rem] font-medium text-muted-foreground", col.className),
2150
2405
  children: col.header
2151
2406
  }, col.id))
2152
2407
  }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("tbody", { children: [rows.map((row) => {
2153
2408
  const out = Boolean(row.removed && showRemovedTint);
2154
2409
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("tr", {
2155
2410
  "data-removed": out ? "true" : void 0,
2156
- className: require_utils.cn("border-b border-border last:border-0", "transition-colors duration-200 ease-out motion-reduce:transition-none", out && "bg-destructive/8"),
2411
+ className: require_utils.cn("border-b border-border last:border-0", "transition-colors duration-(--duration-slow) ease-out motion-reduce:transition-none", out && "bg-destructive/8"),
2157
2412
  children: columns.map((col, colIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("td", {
2158
- className: require_utils.cn("px-3 py-2 align-middle transition-colors duration-200 motion-reduce:transition-none", out && "text-destructive", out && colIndex > 0 && "line-through decoration-destructive/50", !out && colIndex === 0 && "font-medium text-foreground", !out && colIndex > 0 && "text-muted-foreground", col.className),
2413
+ className: require_utils.cn("px-3 py-2 align-middle transition-colors duration-(--duration-slow) motion-reduce:transition-none", out && "text-destructive", out && colIndex > 0 && "line-through decoration-destructive/50", !out && colIndex === 0 && "font-medium text-foreground", !out && colIndex > 0 && "text-muted-foreground", col.className),
2159
2414
  children: col.cell(row)
2160
2415
  }, col.id))
2161
2416
  }, row.id);
@@ -2165,14 +2420,14 @@ function DiffTable({ title = "Proposed changes", columns, rows, addedRows = [],
2165
2420
  colSpan: columns.length,
2166
2421
  className: "p-0",
2167
2422
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2168
- className: require_utils.cn("grid transition-[grid-template-rows,opacity] duration-300 ease-out motion-reduce:transition-none", showAdded ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"),
2423
+ className: require_utils.cn("grid transition-[grid-template-rows,opacity] duration-(--duration-slow) ease-out motion-reduce:transition-none", showAdded ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"),
2169
2424
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2170
2425
  className: "overflow-hidden bg-success/8",
2171
2426
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2172
2427
  className: "grid items-center border-t border-border",
2173
2428
  style: { gridTemplateColumns: `repeat(${columns.length}, minmax(0, 1fr))` },
2174
2429
  children: row.cells.map((cell, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2175
- className: require_utils.cn("px-3 py-2 text-success", i === 0 && "font-medium"),
2430
+ className: require_utils.cn("min-w-0 px-3 py-2 text-success [overflow-wrap:anywhere]", i === 0 && "font-medium"),
2176
2431
  children: cell
2177
2432
  }, i))
2178
2433
  })
@@ -2207,18 +2462,18 @@ function PlanTracker({ plan, streaming = false, className, flushBottom = true, d
2207
2462
  onOpenChange,
2208
2463
  className: "group/collapsible",
2209
2464
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2210
- className: require_utils.cn("border border-input bg-muted/40", flushBottom ? "rounded-t-xl border-b-0" : "rounded-xl"),
2465
+ className: require_utils.cn("border border-input bg-muted/40", flushBottom ? "rounded-t-lg border-b-0" : "rounded-lg"),
2211
2466
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.CollapsibleTrigger, {
2212
- className: require_utils.cn("group flex w-full items-center gap-1.5 px-3 py-2 text-left text-[13px]", "text-muted-foreground transition-colors duration-150 hover:text-foreground"),
2467
+ className: require_utils.cn("group flex w-full items-center gap-1.5 px-3 py-2 text-start text-[0.8125rem]", "text-muted-foreground hover:text-foreground"),
2213
2468
  children: [
2214
2469
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ListChecks, { className: "size-3.5 shrink-0" }),
2215
2470
  complete ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2216
- className: "min-w-0 flex-1 truncate font-medium",
2471
+ className: "min-w-0 flex-1 truncate font-medium tabular-nums",
2217
2472
  children: `${total}/${total} done`
2218
2473
  }) : focusStep ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2219
2474
  className: "min-w-0 flex-1 truncate font-medium",
2220
2475
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2221
- className: "mr-1.5 font-mono text-[12px] font-normal tabular-nums text-muted-foreground/60",
2476
+ className: "me-1.5 font-mono text-[0.75rem] font-normal tabular-nums text-muted-foreground/60",
2222
2477
  children: [
2223
2478
  focusIndex + 1,
2224
2479
  "/",
@@ -2247,7 +2502,7 @@ function PlanTracker({ plan, streaming = false, className, flushBottom = true, d
2247
2502
  }
2248
2503
  function PlanRow({ step }) {
2249
2504
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
2250
- className: "flex items-center gap-2 rounded-md px-1.5 py-1 text-[13px]",
2505
+ className: "flex items-center gap-2 rounded-md px-1.5 py-1 text-[0.8125rem]",
2251
2506
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(StepIcon, { status: step.status }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2252
2507
  className: require_utils.cn("min-w-0 flex-1 truncate", step.status === "done" ? "text-muted-foreground line-through" : "text-foreground"),
2253
2508
  children: step.label
@@ -2262,16 +2517,13 @@ function StepIcon({ status }) {
2262
2517
 
2263
2518
  //#endregion
2264
2519
  //#region src/components/ai/context-ring.tsx
2520
+ const compactNumber = new Intl.NumberFormat("en-US", {
2521
+ notation: "compact",
2522
+ maximumFractionDigits: 1
2523
+ });
2524
+ /** `1048576` is "1M", `999500` is "999.5K" and `9960` is "10K": rounding rolls up to the next unit instead of printing "1000K" or "10.0K". */
2265
2525
  function formatCompact(n) {
2266
- if (n >= 1e6) {
2267
- const m = n / 1e6;
2268
- return `${Number.isInteger(m) ? m : m.toFixed(m < 10 ? 2 : 1)}M`;
2269
- }
2270
- if (n >= 1e3) {
2271
- const k = n / 1e3;
2272
- return `${Number.isInteger(k) ? k : k.toFixed(k < 10 ? 1 : 0)}K`;
2273
- }
2274
- return String(n);
2526
+ return Number.isFinite(n) ? compactNumber.format(n) : String(n);
2275
2527
  }
2276
2528
  function meterTone(pct, recomputing, hasUsage) {
2277
2529
  if (!hasUsage) return "idle";
@@ -2315,7 +2567,8 @@ function ContextRing({ usage, size = 24, stroke = 2, className }) {
2315
2567
  const center = size / 2;
2316
2568
  const glowPad = snap(Math.max(4, size * .18));
2317
2569
  const recomputing = !!usage && usage.tokens === null;
2318
- const pct = usage && usage.percent != null ? Math.max(0, Math.min(100, usage.percent)) : 0;
2570
+ const reported = usage?.percent ?? (usage && usage.tokens !== null && usage.contextWindow > 0 ? usage.tokens / usage.contextWindow * 100 : null);
2571
+ const pct = reported != null ? Math.max(0, Math.min(100, reported)) : 0;
2319
2572
  const tone = meterTone(pct, recomputing, !!usage);
2320
2573
  const color = toneStroke(tone);
2321
2574
  const hit = Math.max(size, 32);
@@ -2330,7 +2583,7 @@ function ContextRing({ usage, size = 24, stroke = 2, className }) {
2330
2583
  let tooltip;
2331
2584
  if (!usage) tooltip = "No usage yet";
2332
2585
  else if (usage.tokens === null) tooltip = "Recomputing after compaction…";
2333
- else tooltip = `${Math.round(usage.percent ?? 0)}% used · ${formatCompact(usage.tokens)} / ${formatCompact(usage.contextWindow)}`;
2586
+ else tooltip = `${Math.round(Math.max(0, reported ?? 0))}% used · ${formatCompact(usage.tokens)} / ${formatCompact(usage.contextWindow)}`;
2334
2587
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_tooltip.Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipTrigger, {
2335
2588
  asChild: true,
2336
2589
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
@@ -2384,13 +2637,14 @@ function ContextRing({ usage, size = 24, stroke = 2, className }) {
2384
2637
  strokeLinecap: "round",
2385
2638
  opacity: filled ? recomputing ? .55 : isFrontier ? 1 : .92 : usage ? .38 : .28,
2386
2639
  filter: filled ? `url(#${glowId})` : void 0,
2387
- className: "transition-[stroke,opacity] duration-200 ease-out"
2640
+ className: "transition-[stroke,opacity] duration-(--duration-slow) ease-out"
2388
2641
  }, i);
2389
2642
  })]
2390
2643
  })
2391
2644
  })
2392
2645
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipContent, {
2393
2646
  side: "top",
2647
+ className: "tabular-nums",
2394
2648
  children: tooltip
2395
2649
  })] });
2396
2650
  }
@@ -2427,8 +2681,8 @@ function TaskRow({ label, meta, status, progress, details, onRetry, className, d
2427
2681
  strokeDasharray: `${2 * Math.PI * 10 * .28} ${2 * Math.PI * 10 * .72}`
2428
2682
  })]
2429
2683
  }), progress != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2430
- className: "relative text-[10px] font-semibold tabular-nums text-foreground",
2431
- children: Math.round(progress)
2684
+ className: "relative text-[0.625rem] font-semibold tabular-nums text-foreground",
2685
+ children: Math.round(Math.max(0, Math.min(100, progress)))
2432
2686
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Loader2, { className: "relative size-3 animate-spin text-muted-foreground motion-reduce:animate-none" })] }) : status === "completed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2433
2687
  className: "flex size-5 items-center justify-center rounded-full bg-success text-white",
2434
2688
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
@@ -2446,20 +2700,22 @@ function TaskRow({ label, meta, status, progress, details, onRetry, className, d
2446
2700
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2447
2701
  className: "min-w-0 flex-1",
2448
2702
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2449
- className: "truncate text-[13px] font-medium text-foreground",
2703
+ title: typeof label === "string" ? label : void 0,
2704
+ className: "truncate text-[0.8125rem] font-medium text-foreground",
2450
2705
  children: label
2451
2706
  }), meta ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2452
- className: "truncate text-[12px] text-muted-foreground",
2707
+ title: typeof meta === "string" ? meta : void 0,
2708
+ className: "truncate text-[0.75rem] text-muted-foreground",
2453
2709
  children: meta
2454
2710
  }) : null]
2455
2711
  }),
2456
2712
  status === "completed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2457
- className: "inline-flex h-5 items-center rounded-full bg-success/10 px-2 text-[11.5px] font-medium text-success",
2713
+ className: "inline-flex h-5 items-center rounded-full bg-success/10 px-2 text-[0.71875rem] font-medium text-success",
2458
2714
  children: "Completed"
2459
2715
  }) : status === "failed" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2460
2716
  className: "inline-flex items-center gap-1",
2461
2717
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2462
- className: "inline-flex h-5 items-center rounded-full bg-destructive/10 px-2 text-[11.5px] font-medium text-destructive",
2718
+ className: "inline-flex h-5 items-center rounded-full bg-destructive/10 px-2 text-[0.71875rem] font-medium text-destructive",
2463
2719
  children: "Failed"
2464
2720
  }), onRetry ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
2465
2721
  type: "button",
@@ -2479,25 +2735,25 @@ function TaskRow({ label, meta, status, progress, details, onRetry, className, d
2479
2735
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2480
2736
  "data-slot": "task-row",
2481
2737
  "data-status": status,
2482
- className: require_utils.cn("rounded-lg border border-border/80 bg-card px-2.5 py-2 shadow-xs", "animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none", className),
2738
+ className: require_utils.cn("rounded-lg bg-card px-2.5 py-2 shadow-card", "animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none", className),
2483
2739
  style: { animationDelay: `${index * 80}ms` },
2484
2740
  children: hasDetails ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.Collapsible, {
2485
2741
  defaultOpen,
2486
2742
  className: "group/collapsible",
2487
2743
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_collapsible.CollapsibleTrigger, {
2488
- className: "w-full text-left",
2744
+ className: "w-full text-start",
2489
2745
  children: header
2490
2746
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_collapsible.CollapsibleContent, {
2491
- innerClassName: "py-1.5 pl-8",
2747
+ innerClassName: "py-1.5 ps-8",
2492
2748
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
2493
2749
  className: "space-y-1",
2494
2750
  children: details.map((d, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
2495
- className: "flex items-center justify-between gap-2 text-[12px]",
2751
+ className: "flex items-center justify-between gap-2 text-[0.75rem]",
2496
2752
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2497
- className: "text-muted-foreground",
2753
+ className: "min-w-0 text-muted-foreground [overflow-wrap:anywhere]",
2498
2754
  children: d.label
2499
2755
  }), d.meta ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2500
- className: "font-mono tabular-nums text-muted-foreground/80",
2756
+ className: "max-w-[55%] min-w-0 text-end font-mono tabular-nums text-muted-foreground/80 [overflow-wrap:anywhere]",
2501
2757
  children: d.meta
2502
2758
  }) : null]
2503
2759
  }, i))
@@ -2519,34 +2775,35 @@ function TaskList({ children, className }) {
2519
2775
  function ContextCard({ title, body, meta, sourceType, sourceName, className, index = 0 }) {
2520
2776
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
2521
2777
  "data-slot": "context-card",
2522
- className: require_utils.cn("rounded-xl border border-border bg-card p-3 shadow-xs", "animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none", className),
2778
+ className: require_utils.cn("rounded-lg bg-card p-3 shadow-card", "animate-[ai-fade-up_300ms_cubic-bezier(0.23,1,0.32,1)_both] motion-reduce:animate-none", className),
2523
2779
  style: { animationDelay: `${index * 60}ms` },
2524
2780
  children: [
2525
2781
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2526
2782
  className: "flex items-start justify-between gap-2",
2527
2783
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
2528
- className: "text-[13px] font-medium text-balance text-foreground",
2784
+ className: "min-w-0 text-[0.8125rem] font-medium text-balance text-foreground [overflow-wrap:anywhere]",
2529
2785
  children: title
2530
2786
  }), meta ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2531
- className: "shrink-0 text-[11px] tabular-nums text-muted-foreground",
2787
+ className: "shrink-0 text-[0.6875rem] tabular-nums text-muted-foreground",
2532
2788
  children: meta
2533
2789
  }) : null]
2534
2790
  }),
2535
2791
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
2536
- className: "mt-1.5 text-[13px] text-pretty leading-relaxed text-muted-foreground",
2792
+ className: "mt-1.5 text-[0.8125rem] text-pretty leading-relaxed text-muted-foreground [overflow-wrap:anywhere]",
2537
2793
  children: body
2538
2794
  }),
2539
2795
  (sourceType || sourceName) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2540
- className: "mt-2.5 flex items-center gap-1.5 text-[12px] text-muted-foreground",
2796
+ className: "mt-2.5 flex flex-wrap items-center gap-x-1.5 gap-y-1 text-[0.75rem] text-muted-foreground",
2541
2797
  children: [
2542
2798
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.FileText, { className: "size-3 shrink-0 opacity-70" }),
2543
2799
  sourceType ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_badge.Badge, {
2544
2800
  variant: "secondary",
2545
- className: "h-5 px-1.5 text-[10px] font-medium",
2801
+ className: "h-5 px-1.5 text-[0.625rem] font-medium",
2546
2802
  children: sourceType
2547
2803
  }) : null,
2548
2804
  sourceName ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2549
- className: "min-w-0 truncate",
2805
+ title: typeof sourceName === "string" ? sourceName : void 0,
2806
+ className: "max-w-full min-w-0 truncate",
2550
2807
  children: sourceName
2551
2808
  }) : null
2552
2809
  ]
@@ -2559,7 +2816,7 @@ function ContextCards({ children, className, label = "Chunks", count }) {
2559
2816
  "data-slot": "context-cards",
2560
2817
  className: require_utils.cn("flex flex-col gap-2", className),
2561
2818
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2562
- className: "flex items-center gap-2 text-[12px] text-muted-foreground",
2819
+ className: "flex items-center gap-2 text-[0.75rem] text-muted-foreground",
2563
2820
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2564
2821
  className: "font-medium",
2565
2822
  children: label
@@ -2586,22 +2843,22 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
2586
2843
  const pct = confidence != null ? Math.round(Math.max(0, Math.min(1, confidence)) * 100) : null;
2587
2844
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2588
2845
  "data-slot": "recommendation-card",
2589
- className: require_utils.cn("w-full max-w-md overflow-hidden rounded-xl border border-border bg-card shadow-xs", className),
2846
+ className: require_utils.cn("w-full max-w-md overflow-hidden rounded-lg bg-card shadow-card", className),
2590
2847
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2591
2848
  className: "space-y-3 p-3",
2592
2849
  children: [
2593
2850
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2594
- className: "text-[12px] font-medium text-muted-foreground",
2851
+ className: "text-[0.75rem] font-medium text-muted-foreground",
2595
2852
  children: title
2596
2853
  }),
2597
2854
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2598
- className: "text-[13px] text-pretty leading-relaxed text-foreground",
2855
+ className: "text-[0.8125rem] text-pretty leading-relaxed text-foreground [overflow-wrap:anywhere]",
2599
2856
  children: displayBody
2600
2857
  }),
2601
2858
  pct != null ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2602
2859
  className: "space-y-1",
2603
2860
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2604
- className: "flex items-center justify-between text-[11px] text-muted-foreground",
2861
+ className: "flex items-center justify-between text-[0.6875rem] text-muted-foreground",
2605
2862
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: confidenceLabel ?? "Confidence" }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2606
2863
  className: "tabular-nums font-medium text-foreground",
2607
2864
  children: [pct, "%"]
@@ -2609,7 +2866,7 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
2609
2866
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2610
2867
  className: "h-1.5 overflow-hidden rounded-full bg-muted",
2611
2868
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2612
- className: "h-full origin-left rounded-full bg-primary transition-transform duration-200 ease-out motion-reduce:transition-none",
2869
+ className: "h-full origin-left rounded-full bg-primary rtl:origin-right transition-transform duration-(--duration-slow) ease-out motion-reduce:transition-none",
2613
2870
  style: { transform: `scaleX(${pct / 100})` }
2614
2871
  })
2615
2872
  })]
@@ -2617,7 +2874,7 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
2617
2874
  alternatives.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.Collapsible, {
2618
2875
  className: "group/collapsible",
2619
2876
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.CollapsibleTrigger, {
2620
- className: require_utils.cn("flex w-full items-center justify-between rounded-md border border-border/80 px-2.5 py-1.5 text-[12.5px]", "text-muted-foreground transition-colors duration-150 hover:bg-accent hover:text-foreground"),
2877
+ className: require_utils.cn("flex w-full items-center justify-between rounded-md border border-border px-2.5 py-1.5 text-[0.78125rem]", "text-muted-foreground hover:bg-accent hover:text-foreground"),
2621
2878
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Other options" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, {
2622
2879
  "data-slot": "collapsible-icon",
2623
2880
  className: "size-3.5"
@@ -2634,7 +2891,7 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
2634
2891
  onClick: () => {
2635
2892
  setInternalId(opt.id);
2636
2893
  },
2637
- className: require_utils.cn("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-[13px]", "transition-colors duration-150 hover:bg-accent", on && "bg-accent"),
2894
+ className: require_utils.cn("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-start text-[0.8125rem]", "hover:bg-accent", on && "bg-accent"),
2638
2895
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2639
2896
  className: require_utils.cn("mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-full border", on ? "border-primary bg-primary text-primary-foreground" : "border-border"),
2640
2897
  children: on ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
@@ -2644,10 +2901,10 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
2644
2901
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2645
2902
  className: "min-w-0 flex-1",
2646
2903
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2647
- className: "font-medium text-foreground",
2904
+ className: "font-medium text-foreground [overflow-wrap:anywhere]",
2648
2905
  children: opt.label
2649
2906
  }), opt.badge ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
2650
- className: "ml-1.5 text-[11px] text-muted-foreground",
2907
+ className: "ms-1.5 text-[0.6875rem] text-muted-foreground",
2651
2908
  children: opt.badge
2652
2909
  }) : null]
2653
2910
  })]
@@ -2657,10 +2914,11 @@ function RecommendationCard({ title = "Recommendation", body, confidence, confid
2657
2914
  })]
2658
2915
  }) : null,
2659
2916
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2660
- className: "flex justify-end",
2917
+ className: "flex flex-wrap justify-end",
2661
2918
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
2662
2919
  type: "button",
2663
2920
  size: "sm",
2921
+ wrap: true,
2664
2922
  onClick: () => onAccept?.(selectedId),
2665
2923
  children: acceptLabel
2666
2924
  })
@@ -2754,14 +3012,14 @@ function FileUpload({ files: filesProp, onFilesChange, multiple = true, accept,
2754
3012
  onDragOver: (e) => e.preventDefault(),
2755
3013
  onDragLeave: () => setDragging(false),
2756
3014
  onDrop,
2757
- className: require_utils.cn("flex cursor-pointer flex-col items-center justify-center gap-2 rounded-xl border border-dashed px-4 py-6 text-center", "transition-colors duration-150", dragging ? "border-primary bg-primary/5" : "border-border bg-muted/30 hover:bg-muted/50", disabled && "pointer-events-none opacity-60"),
3015
+ className: require_utils.cn("flex cursor-pointer items-center justify-center gap-2 rounded-lg border border-dashed px-4 text-center", "transition-colors duration-(--duration-moderate)", variant === "compact" ? "flex-row rounded-md py-3" : "flex-col py-6", dragging ? "border-primary bg-primary/5" : "border-border bg-muted/30 hover:bg-muted/50", disabled && "pointer-events-none opacity-60"),
2758
3016
  children: [
2759
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Upload, { className: "size-5 text-muted-foreground" }),
3017
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Upload, { className: require_utils.cn("text-muted-foreground", variant === "compact" ? "size-4" : "size-5") }),
2760
3018
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2761
- className: "text-[13px] font-medium text-foreground",
3019
+ className: "text-[0.8125rem] font-medium text-foreground",
2762
3020
  children: "Drop files or click to upload"
2763
3021
  }),
2764
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3022
+ variant === "compact" ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2765
3023
  className: "text-xs text-muted-foreground",
2766
3024
  children: multiple ? "Multiple files supported" : "Single file"
2767
3025
  })
@@ -2770,10 +3028,11 @@ function FileUpload({ files: filesProp, onFilesChange, multiple = true, accept,
2770
3028
  files.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
2771
3029
  className: "flex flex-col gap-1",
2772
3030
  children: files.map((file, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
2773
- className: "flex items-center gap-2 rounded-md border border-border bg-card px-2 py-1.5 text-[12.5px]",
3031
+ className: "flex items-center gap-2 rounded-md border border-border bg-card px-2 py-1.5 text-[0.78125rem]",
2774
3032
  children: [
2775
3033
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Paperclip, { className: "size-3.5 shrink-0 text-muted-foreground" }),
2776
3034
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3035
+ title: file.name,
2777
3036
  className: "min-w-0 flex-1 truncate font-medium",
2778
3037
  children: file.name
2779
3038
  }),
@@ -2831,12 +3090,1205 @@ function AiImage({ data, mimeType = "image/png", src, bytes, alt = "", className
2831
3090
  "data-slot": "ai-image",
2832
3091
  src: resolved,
2833
3092
  alt,
2834
- className: require_utils.cn("max-h-80 max-w-full rounded-lg object-contain", "outline outline-1 outline-black/10 dark:outline-white/10", className),
3093
+ className: require_utils.cn("max-h-80 max-w-full rounded-lg object-contain", "outline outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10", className),
3094
+ ...props
3095
+ });
3096
+ }
3097
+
3098
+ //#endregion
3099
+ //#region src/components/ai/mark-tile.tsx
3100
+ const SIZE = {
3101
+ xs: "size-4 rounded-[5px] text-[0.5625rem] [&_svg:not([class*=size-])]:size-2.5",
3102
+ sm: "size-6 rounded-md text-[0.6875rem] [&_svg:not([class*=size-])]:size-3.5",
3103
+ md: "size-8 rounded-lg text-sm [&_svg:not([class*=size-])]:size-4"
3104
+ };
3105
+ /**
3106
+ * Square tile that frames an app mark or glyph. The edge is an inset outline
3107
+ * rather than a border, so pale marks keep a shape on any surface without the
3108
+ * tile growing.
3109
+ */
3110
+ function MarkTile({ size = "xs", className, children, ...props }) {
3111
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3112
+ "aria-hidden": "true",
3113
+ "data-slot": "mark-tile",
3114
+ className: require_utils.cn("grid shrink-0 place-items-center overflow-hidden bg-card leading-none text-muted-foreground", "outline-1 -outline-offset-1 outline-black/10 dark:outline-white/10", SIZE[size], className),
3115
+ ...props,
3116
+ children
3117
+ });
3118
+ }
3119
+ /**
3120
+ * Enter treatment for icons that appear on a state change (a check replacing a
3121
+ * spinner, a settled chip). Uses `@starting-style` so it needs no keyframes.
3122
+ */
3123
+ const iconEnterClass = "transition-[opacity,scale,filter] duration-300 ease-[cubic-bezier(0.2,0,0,1)] starting:scale-25 starting:opacity-0 starting:blur-[4px] motion-reduce:transition-none";
3124
+
3125
+ //#endregion
3126
+ //#region src/components/ai/tool-trace.tsx
3127
+ const STATUS_LABEL = {
3128
+ pending: "Queued",
3129
+ running: "Running",
3130
+ done: "Done"
3131
+ };
3132
+ /** Delay between rows as a trace enters, so it reads top to bottom. */
3133
+ const ROW_STAGGER_MS = 80;
3134
+ /**
3135
+ * Quiet tool-call trace: a heading row followed by one row per call, joined by
3136
+ * short connectors. Each row morphs from spinner to check as the call settles.
3137
+ */
3138
+ function ToolTrace({ title = "Read tools", icon, steps, className, ...props }) {
3139
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("ol", {
3140
+ "data-slot": "tool-trace",
3141
+ className: require_utils.cn("flex flex-col gap-2", className),
3142
+ ...props,
3143
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
3144
+ className: "flex h-7 items-center gap-2",
3145
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkTile, { children: icon ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.BookOpen, {}) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3146
+ className: "text-[0.8125rem] text-foreground",
3147
+ children: title
3148
+ })]
3149
+ }), steps.map((step, index) => {
3150
+ const status = step.status ?? "done";
3151
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
3152
+ "data-status": status,
3153
+ style: { animationDelay: `${(index + 1) * ROW_STAGGER_MS}ms` },
3154
+ className: "relative flex h-7 animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] items-center gap-2 motion-reduce:animate-none",
3155
+ children: [
3156
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3157
+ "aria-hidden": "true",
3158
+ className: "absolute -top-2 left-2 h-2 w-px -translate-x-1/2 bg-subtle-foreground/35"
3159
+ }),
3160
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3161
+ className: "grid size-4 shrink-0 place-items-center text-subtle-foreground",
3162
+ children: [status === "done" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
3163
+ "aria-hidden": "true",
3164
+ className: require_utils.cn("size-3", iconEnterClass),
3165
+ strokeWidth: 2
3166
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_spinner.Spinner, {
3167
+ "aria-hidden": "true",
3168
+ role: void 0,
3169
+ className: "size-3.5",
3170
+ strokeWidth: 1.5
3171
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3172
+ className: "sr-only",
3173
+ children: STATUS_LABEL[status]
3174
+ })]
3175
+ }),
3176
+ step.icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkTile, {
3177
+ className: "text-foreground",
3178
+ children: step.icon
3179
+ }) : null,
3180
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3181
+ className: require_utils.cn("truncate text-[0.8125rem]", status === "running" ? "text-foreground" : "text-muted-foreground"),
3182
+ children: step.label
3183
+ })
3184
+ ]
3185
+ }, step.id);
3186
+ })]
3187
+ });
3188
+ }
3189
+
3190
+ //#endregion
3191
+ //#region src/components/ai/thinking-status.tsx
3192
+ function formatElapsed(totalSeconds) {
3193
+ const minutes = Math.floor(totalSeconds / 60);
3194
+ const seconds = totalSeconds % 60;
3195
+ return minutes > 0 ? `${minutes}m ${seconds}s` : `${seconds}s`;
3196
+ }
3197
+ function ThinkingGlyph() {
3198
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3199
+ "aria-hidden": "true",
3200
+ className: "grid size-4 grid-cols-3 place-items-center gap-px p-0.5",
3201
+ children: Array.from({ length: 9 }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3202
+ className: "size-[3px] rounded-full bg-muted-foreground animate-[ai-pulse-dot_1.2s_ease-in-out_infinite] motion-reduce:animate-none",
3203
+ style: { animationDelay: `${index * 5 % 9 * 110}ms` }
3204
+ }, index))
3205
+ });
3206
+ }
3207
+ /**
3208
+ * Compact in-flight status: pulsing glyph, label, elapsed time, and token
3209
+ * spend. Digits are tabular so the row never jitters while it ticks.
3210
+ */
3211
+ function ThinkingStatus({ label = "Thinking", elapsedSeconds = 0, tokens, live = true, tokensPerTick = 0, className, ...props }) {
3212
+ const [ticks, setTicks] = react.useState({
3213
+ seconds: 0,
3214
+ tokens: 0
3215
+ });
3216
+ react.useEffect(() => {
3217
+ if (!live) return;
3218
+ const id = window.setInterval(() => {
3219
+ setTicks((current) => ({
3220
+ seconds: current.seconds + 1,
3221
+ tokens: current.tokens + (tokensPerTick ? Math.round(tokensPerTick * (.6 + Math.random() * .8)) : 0)
3222
+ }));
3223
+ }, 1e3);
3224
+ return () => window.clearInterval(id);
3225
+ }, [live, tokensPerTick]);
3226
+ const seconds = elapsedSeconds + (live ? ticks.seconds : 0);
3227
+ const spent = (tokens ?? 0) + (live ? ticks.tokens : 0);
3228
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3229
+ role: "status",
3230
+ "aria-live": "polite",
3231
+ "data-slot": "thinking-status",
3232
+ className: require_utils.cn("flex h-7 items-center gap-2 text-[0.8125rem]", className),
3233
+ ...props,
3234
+ children: [
3235
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ThinkingGlyph, {}),
3236
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3237
+ className: "text-muted-foreground",
3238
+ children: label
3239
+ }),
3240
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3241
+ "aria-hidden": "true",
3242
+ className: "flex items-center gap-1.5 text-subtle-foreground tabular-nums",
3243
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: formatElapsed(seconds) }), tokens !== void 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3244
+ "aria-hidden": "true",
3245
+ className: "size-0.5 rounded-full bg-current"
3246
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [formatCompact(spent), " tokens"] })] }) : null]
3247
+ })
3248
+ ]
3249
+ });
3250
+ }
3251
+
3252
+ //#endregion
3253
+ //#region src/components/ai/prompt-input-tray.tsx
3254
+ const TONE_COLOR = {
3255
+ neutral: "var(--muted-foreground)",
3256
+ info: "var(--info)",
3257
+ warning: "var(--warning)",
3258
+ danger: "var(--destructive)"
3259
+ };
3260
+ /**
3261
+ * Tinted shell that docks status rows onto a composer so the two read as one
3262
+ * surface. The tray is 18px with a 4px inset, so the composer inside is
3263
+ * rounded to 14px (concentric). Tone tints the tray, its edge, and the icon in
3264
+ * each row; text stays at full contrast. Renders the composer alone when there
3265
+ * is nothing to dock.
3266
+ */
3267
+ function PromptInputTray({ tone = "neutral", header, footer, children, className, style, ...props }) {
3268
+ if (!header && !footer) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children });
3269
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3270
+ "data-slot": "prompt-input-tray",
3271
+ "data-tone": tone,
3272
+ style: {
3273
+ "--tray-tone": TONE_COLOR[tone],
3274
+ ...style
3275
+ },
3276
+ className: require_utils.cn("flex flex-col rounded-[18px] p-1", "bg-[color-mix(in_oklab,var(--tray-tone)_8%,var(--card))] dark:bg-[color-mix(in_oklab,var(--tray-tone)_13%,var(--card))]", "shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--tray-tone)_22%,transparent)]", "[&_[data-slot=prompt-input]]:rounded-[14px] [&_[data-slot=prompt-input]]:bg-card", className),
3277
+ ...props,
3278
+ children: [
3279
+ header ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3280
+ "data-slot": "prompt-input-tray-header",
3281
+ children: header
3282
+ }) : null,
3283
+ children,
3284
+ footer ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3285
+ "data-slot": "prompt-input-tray-footer",
3286
+ children: footer
3287
+ }) : null
3288
+ ]
3289
+ });
3290
+ }
3291
+ /** One line inside a tray: tone-colored icon, text, and trailing actions. */
3292
+ function PromptInputTrayRow({ icon, children, actions, className, ...props }) {
3293
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3294
+ "data-slot": "prompt-input-tray-row",
3295
+ className: require_utils.cn("flex min-h-8 items-center gap-2 px-2.5 py-1 text-[0.8125rem] text-foreground", className),
3296
+ ...props,
3297
+ children: [
3298
+ icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3299
+ "aria-hidden": "true",
3300
+ className: "grid size-4 shrink-0 place-items-center text-[color-mix(in_oklab,var(--tray-tone,var(--muted-foreground)),var(--foreground)_20%)] [&_svg]:size-3.5",
3301
+ children: icon
3302
+ }) : null,
3303
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3304
+ className: "min-w-0 flex-1 text-pretty",
3305
+ children
3306
+ }),
3307
+ actions ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3308
+ className: "flex shrink-0 items-center gap-1",
3309
+ children: actions
3310
+ }) : null
3311
+ ]
3312
+ });
3313
+ }
3314
+
3315
+ //#endregion
3316
+ //#region src/components/ai/usage-notice.tsx
3317
+ /** Tray tone for a budget share: calm below 75%, warning to 90%, danger beyond. */
3318
+ function usageTone(percent) {
3319
+ if (percent >= 90) return "danger";
3320
+ if (percent >= 75) return "warning";
3321
+ return "info";
3322
+ }
3323
+ const linkClass = "rounded-sm font-medium text-link underline-offset-2 outline-none hover:underline focus-visible:ring-[3px] focus-visible:ring-ring/50";
3324
+ /**
3325
+ * Plan-budget line for the header of a `PromptInputTray`:
3326
+ *
3327
+ * ```tsx
3328
+ * <PromptInputTray tone={usageTone(80)} header={<UsageNotice percent={80} onDismiss={dismiss} />}>
3329
+ * <PromptInput … />
3330
+ * </PromptInputTray>
3331
+ * ```
3332
+ */
3333
+ function UsageNotice({ percent, message, actionLabel = "View usage", actionHref, onAction, onDismiss, ...props }) {
3334
+ const tone = usageTone(percent);
3335
+ const action = actionHref ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
3336
+ className: linkClass,
3337
+ href: actionHref,
3338
+ onClick: onAction,
3339
+ children: actionLabel
3340
+ }) : onAction ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3341
+ type: "button",
3342
+ className: require_utils.cn(linkClass, "cursor-pointer"),
3343
+ onClick: onAction,
3344
+ children: actionLabel
3345
+ }) : null;
3346
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PromptInputTrayRow, {
3347
+ "data-slot": "usage-notice",
3348
+ "data-tone": tone,
3349
+ icon: tone === "info" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Gauge, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.TriangleAlert, {}),
3350
+ actions: onDismiss ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3351
+ type: "button",
3352
+ "aria-label": "Dismiss",
3353
+ onClick: onDismiss,
3354
+ className: "relative grid size-6 shrink-0 cursor-pointer place-items-center rounded-md text-muted-foreground outline-none before:absolute before:-inset-2 hover:bg-overlay-hover hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 pointer-coarse:before:-inset-2.5",
3355
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {
3356
+ "aria-hidden": "true",
3357
+ className: "size-3.5"
3358
+ })
3359
+ }) : null,
3360
+ ...props,
3361
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", { children: [message ?? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3362
+ "You've used ",
3363
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3364
+ className: "tabular-nums",
3365
+ children: [Math.round(percent), "%"]
3366
+ }),
3367
+ " of your tokens."
3368
+ ] }), action ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [" ", action] }) : null] })
3369
+ });
3370
+ }
3371
+
3372
+ //#endregion
3373
+ //#region src/components/ai/model-selector.tsx
3374
+ const TAG_LABEL = {
3375
+ new: "New",
3376
+ free: "Free",
3377
+ beta: "Beta",
3378
+ preview: "Preview",
3379
+ deprecated: "Deprecated"
3380
+ };
3381
+ function levelOf(model, levelId) {
3382
+ return model.levels?.find((level) => level.id === levelId) ?? model.levels?.find((level) => level.id === model.defaultLevel) ?? model.levels?.[0];
3383
+ }
3384
+ function pricingOf(model, level) {
3385
+ return level?.pricing ?? model.pricing;
3386
+ }
3387
+ function formatPrice(amount, currency = "USD") {
3388
+ return new Intl.NumberFormat("en-US", {
3389
+ style: "currency",
3390
+ currency,
3391
+ minimumFractionDigits: Number.isInteger(amount) ? 0 : 2,
3392
+ maximumFractionDigits: amount > 0 && amount < 1 ? 3 : 2
3393
+ }).format(amount);
3394
+ }
3395
+ function formatTokens(tokens) {
3396
+ return formatCompact(tokens);
3397
+ }
3398
+ /** Blended cost used to rank models on the meter: output weighted 3:1, as in typical chat traffic. */
3399
+ function blendedCost(pricing) {
3400
+ return pricing ? (pricing.input + pricing.output * 3) / 4 : 0;
3401
+ }
3402
+ function isFree(pricing) {
3403
+ return pricing !== void 0 && pricing.input === 0 && pricing.output === 0;
3404
+ }
3405
+ /** Number of blocks in the cost indicator. */
3406
+ const COST_TIERS = 4;
3407
+ /** Maps a log-scaled cost share (0-1) to 1-4 blocks. Free models get 0. */
3408
+ function costTier(share, free) {
3409
+ if (free) return 0;
3410
+ return Math.min(COST_TIERS, Math.max(1, Math.ceil(share * COST_TIERS)));
3411
+ }
3412
+ /**
3413
+ * Relative cost as a row of building blocks: one to four filled in the accent
3414
+ * color, stepping up in height like a stack being built. Discrete tiers read
3415
+ * faster than a continuous bar and keep the list calm while scanning.
3416
+ */
3417
+ function CostBlocks({ tier }) {
3418
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3419
+ role: "img",
3420
+ "aria-label": `Cost tier ${tier} of ${COST_TIERS}`,
3421
+ className: "flex h-3 shrink-0 items-end gap-[3px]",
3422
+ children: Array.from({ length: COST_TIERS }, (_, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3423
+ "aria-hidden": "true",
3424
+ className: require_utils.cn("w-1.5 rounded-[1.5px]", index < tier ? "bg-primary" : "bg-[color-mix(in_oklab,currentColor_14%,transparent)]"),
3425
+ style: { height: `${6 + index * 2}px` }
3426
+ }, index))
3427
+ });
3428
+ }
3429
+ function PriceText({ pricing }) {
3430
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3431
+ className: "text-xs text-muted-foreground tabular-nums",
3432
+ children: [
3433
+ formatPrice(pricing.input, pricing.currency),
3434
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3435
+ className: "text-subtle-foreground",
3436
+ children: " / "
3437
+ }),
3438
+ formatPrice(pricing.output, pricing.currency)
3439
+ ]
3440
+ });
3441
+ }
3442
+ /** Tags shown on a model row before the rest collapse into a count. */
3443
+ const MAX_ROW_TAGS = 2;
3444
+ function Tag({ tag }) {
3445
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3446
+ className: require_utils.cn("shrink-0 text-xs font-medium", tag === "deprecated" ? "text-muted-foreground line-through" : "text-link"),
3447
+ children: TAG_LABEL[tag]
3448
+ });
3449
+ }
3450
+ function ModelGlyph({ model }) {
3451
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkTile, {
3452
+ className: "text-foreground",
3453
+ children: model.icon ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3454
+ className: "font-semibold",
3455
+ children: model.provider.charAt(0)
3456
+ })
3457
+ });
3458
+ }
3459
+ /** A model's reasoning levels as a stacked menu: one row each, with its description and a check on the current one. */
3460
+ function LevelMenu({ model, levelId, onPick }) {
3461
+ if (!model.levels?.length) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3462
+ className: "px-2 py-1.5 text-xs text-muted-foreground",
3463
+ children: "One mode, no reasoning levels"
3464
+ });
3465
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3466
+ role: "radiogroup",
3467
+ "aria-label": `${model.name} reasoning level`,
3468
+ className: "flex flex-col gap-px",
3469
+ children: model.levels.map((level) => {
3470
+ const checked = level.id === levelId;
3471
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
3472
+ type: "button",
3473
+ role: "radio",
3474
+ "aria-checked": checked,
3475
+ onMouseDown: (event) => event.preventDefault(),
3476
+ onClick: () => onPick(level.id),
3477
+ className: require_utils.cn("flex min-h-8 w-full cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-start outline-none pointer-coarse:min-h-11", "hover:bg-overlay-hover focus-visible:ring-[3px] focus-visible:ring-ring/50", checked && "bg-overlay-hover"),
3478
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3479
+ className: "flex min-w-0 flex-1 flex-col",
3480
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3481
+ className: require_utils.cn("text-[0.8125rem]", checked ? "font-medium text-foreground" : "text-foreground/85"),
3482
+ children: level.label
3483
+ }), level.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3484
+ className: "text-xs text-muted-foreground",
3485
+ children: level.description
3486
+ }) : null]
3487
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
3488
+ "aria-hidden": "true",
3489
+ className: require_utils.cn("size-3.5 shrink-0 text-foreground", checked ? "opacity-100" : "opacity-0")
3490
+ })]
3491
+ }, level.id);
3492
+ })
3493
+ });
3494
+ }
3495
+ /**
3496
+ * The side card for the active model: what it is, its reasoning levels as a
3497
+ * menu, and its prices. It opens beside the list like a submenu, so the list
3498
+ * never changes size while moving through it.
3499
+ */
3500
+ function ModelDetails({ model, levelId, onPickLevel }) {
3501
+ const level = levelOf(model, levelId);
3502
+ const pricing = pricingOf(model, level);
3503
+ const free = isFree(pricing);
3504
+ const price = (amount) => free ? "Free" : amount === void 0 || !pricing ? "—" : formatPrice(amount, pricing.currency);
3505
+ const facts = [
3506
+ {
3507
+ label: "Input /1M",
3508
+ value: price(pricing?.input)
3509
+ },
3510
+ {
3511
+ label: "Output /1M",
3512
+ value: price(pricing?.output)
3513
+ },
3514
+ {
3515
+ label: "Cached /1M",
3516
+ value: free ? "Free" : price(pricing?.cachedInput)
3517
+ },
3518
+ {
3519
+ label: "Context",
3520
+ value: model.contextWindow ? formatTokens(model.contextWindow) : "—"
3521
+ }
3522
+ ];
3523
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3524
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3525
+ className: "flex items-center gap-2 px-3 pt-3 pb-2",
3526
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelGlyph, { model }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3527
+ className: "min-w-0",
3528
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3529
+ title: model.name,
3530
+ className: "truncate text-[0.8125rem] font-medium text-foreground",
3531
+ children: model.name
3532
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3533
+ title: model.description ?? model.provider,
3534
+ className: "truncate text-xs text-muted-foreground",
3535
+ children: model.description ?? model.provider
3536
+ })]
3537
+ })]
3538
+ }),
3539
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3540
+ className: "px-1 pb-1",
3541
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LevelMenu, {
3542
+ model,
3543
+ levelId: level?.id,
3544
+ onPick: onPickLevel
3545
+ })
3546
+ }),
3547
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dl", {
3548
+ className: "grid grid-cols-2 gap-x-3 gap-y-2 border-t border-border px-3 py-2.5",
3549
+ children: facts.map((fact) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3550
+ className: "min-w-0",
3551
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
3552
+ className: "truncate text-[0.6875rem] leading-4 text-muted-foreground",
3553
+ children: fact.label
3554
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", {
3555
+ className: "truncate text-xs leading-4 text-foreground tabular-nums",
3556
+ children: fact.value
3557
+ })]
3558
+ }, fact.label))
3559
+ }),
3560
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
3561
+ className: "hidden h-8 items-center gap-1 border-t border-border px-3 text-[0.6875rem] text-muted-foreground pointer-fine:flex",
3562
+ children: [
3563
+ model.levels && model.levels.length > 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3564
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_kbd.Kbd, { children: "←" }),
3565
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_kbd.Kbd, { children: "→" }),
3566
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3567
+ className: "me-2",
3568
+ children: "level"
3569
+ })
3570
+ ] }) : null,
3571
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_kbd.Kbd, { children: "↵" }),
3572
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "choose" })
3573
+ ]
3574
+ })
3575
+ ] });
3576
+ }
3577
+ /** Whether `point` lies inside the triangle `a b c` (sign test). */
3578
+ function inTriangle(point, a, b, c) {
3579
+ const side = (p, q, r) => (p.x - r.x) * (q.y - r.y) - (q.x - r.x) * (p.y - r.y);
3580
+ const d1 = side(point, a, b);
3581
+ const d2 = side(point, b, c);
3582
+ const d3 = side(point, c, a);
3583
+ return !((d1 < 0 || d2 < 0 || d3 < 0) && (d1 > 0 || d2 > 0 || d3 > 0));
3584
+ }
3585
+ /** How long a row crossed on the way to the side card waits before taking it over. */
3586
+ const PANEL_INTENT_MS = 240;
3587
+ /**
3588
+ * Model picker for composers: searchable list with pinned routers, recent and
3589
+ * recommended sections, per-provider groups, reasoning levels, relative cost
3590
+ * or per-million pricing, tags, and a side card for the highlighted model
3591
+ * with its reasoning levels.
3592
+ * Controlled: the host owns the selection and persists recents.
3593
+ */
3594
+ function ModelSelector({ models, value, onValueChange, pinnedIds = [], recentIds = [], recommendedIds = [], priceDisplay: priceDisplayProp = "meter", allowPriceToggle, disabled, align = "start", side = "top", triggerClassName, contentClassName, label = "Model" }) {
3595
+ const [open, setOpen] = react.useState(false);
3596
+ const [query, setQuery] = react.useState("");
3597
+ const [highlighted, setHighlighted] = react.useState("");
3598
+ const [pendingLevels, setPendingLevels] = react.useState({});
3599
+ const [priceDisplay, setPriceDisplay] = react.useState(priceDisplayProp);
3600
+ /** The row the side card shows. Follows the highlight, except while the pointer heads for the card. */
3601
+ const [active, setActive] = react.useState("");
3602
+ const [panel, setPanel] = react.useState({
3603
+ top: 0,
3604
+ side: "right"
3605
+ });
3606
+ const contentRef = react.useRef(null);
3607
+ const panelRef = react.useRef(null);
3608
+ const trail = react.useRef([]);
3609
+ const intentTimer = react.useRef(void 0);
3610
+ const byId = react.useMemo(() => new Map(models.map((model) => [model.id, model])), [models]);
3611
+ const selected = byId.get(value.modelId);
3612
+ const selectedLevel = selected ? levelOf(selected, value.levelId) : void 0;
3613
+ const hasPricing = models.some((model) => model.pricing || model.levels?.some((level) => level.pricing));
3614
+ const canTogglePrice = (allowPriceToggle ?? hasPricing) && priceDisplayProp !== "none";
3615
+ const maxCost = react.useMemo(() => Math.max(0, ...models.map((model) => blendedCost(pricingOf(model, levelOf(model, void 0))))), [models]);
3616
+ const sections = react.useMemo(() => {
3617
+ const pick = (ids) => ids.map((id) => byId.get(id)).filter((model) => Boolean(model));
3618
+ const providers = /* @__PURE__ */ new Map();
3619
+ for (const model of [...models].sort((a, b) => Number(Boolean(a.disabled)) - Number(Boolean(b.disabled)))) {
3620
+ if (pinnedIds.includes(model.id)) continue;
3621
+ const group = providers.get(model.provider);
3622
+ if (group) group.push(model);
3623
+ else providers.set(model.provider, [model]);
3624
+ }
3625
+ const browsing = [
3626
+ {
3627
+ id: "pinned",
3628
+ label: void 0,
3629
+ items: pick(pinnedIds)
3630
+ },
3631
+ {
3632
+ id: "recent",
3633
+ label: "Recently used",
3634
+ items: pick(recentIds)
3635
+ },
3636
+ {
3637
+ id: "recommended",
3638
+ label: "Recommended",
3639
+ items: pick(recommendedIds)
3640
+ }
3641
+ ];
3642
+ const all = [...providers].map(([provider, items]) => ({
3643
+ id: `provider:${provider}`,
3644
+ label: provider,
3645
+ items
3646
+ }));
3647
+ return {
3648
+ browsing: browsing.filter((section) => section.items.length > 0),
3649
+ all
3650
+ };
3651
+ }, [
3652
+ byId,
3653
+ models,
3654
+ pinnedIds,
3655
+ recentIds,
3656
+ recommendedIds
3657
+ ]);
3658
+ const levelFor = (model) => pendingLevels[model.id] ?? (model.id === value.modelId ? value.levelId : void 0) ?? levelOf(model, void 0)?.id;
3659
+ const choose = (model, levelId = levelFor(model)) => {
3660
+ if (model.disabled) return;
3661
+ onValueChange({
3662
+ modelId: model.id,
3663
+ levelId
3664
+ });
3665
+ setOpen(false);
3666
+ };
3667
+ const highlightedModel = byId.get(highlighted.split("::")[1] ?? "");
3668
+ /** Falls back to the selection so the card is present from the first frame. */
3669
+ const detailModel = byId.get(active.split("::")[1] ?? "") ?? selected;
3670
+ /** The pointer is moving toward the side card through the rows between (the submenu "safe triangle"). */
3671
+ const headingToPanel = () => {
3672
+ const card = panelRef.current?.getBoundingClientRect();
3673
+ const from = trail.current[0];
3674
+ const to = trail.current[trail.current.length - 1];
3675
+ if (!card || !from || !to || panel.side === "below") return false;
3676
+ const edge = panel.side === "right" ? card.left : card.right;
3677
+ return (panel.side === "right" ? to.x > from.x : to.x < from.x) && inTriangle(to, from, {
3678
+ x: edge,
3679
+ y: card.top - 8
3680
+ }, {
3681
+ x: edge,
3682
+ y: card.bottom + 8
3683
+ });
3684
+ };
3685
+ react.useEffect(() => {
3686
+ if (!open) return;
3687
+ if (headingToPanel()) intentTimer.current = window.setTimeout(() => setActive(highlighted), PANEL_INTENT_MS);
3688
+ else setActive(highlighted);
3689
+ return () => window.clearTimeout(intentTimer.current);
3690
+ }, [highlighted, open]);
3691
+ /** Lines the card up with its row, clamped to the list, on whichever side has room. */
3692
+ const placePanel = react.useCallback(() => {
3693
+ const content = contentRef.current;
3694
+ const card = panelRef.current;
3695
+ if (!content || !card) return;
3696
+ if (window.innerWidth < 640) {
3697
+ setPanel((current) => current.side === "below" ? current : {
3698
+ top: 0,
3699
+ side: "below"
3700
+ });
3701
+ return;
3702
+ }
3703
+ const box = content.getBoundingClientRect();
3704
+ const rows = Array.from(content.querySelectorAll("[data-model-value]"));
3705
+ const row = rows.find((element) => element.dataset.modelValue === active) ?? rows.find((element) => element.dataset.modelValue?.endsWith(`::${value.modelId}`));
3706
+ const rowTop = row ? row.getBoundingClientRect().top - box.top - 4 : 0;
3707
+ const top = Math.round(Math.min(Math.max(8 - box.top, rowTop), window.innerHeight - box.top - card.offsetHeight - 8));
3708
+ const side = box.right + card.offsetWidth + 8 > window.innerWidth ? "left" : "right";
3709
+ setPanel((current) => current.top === top && current.side === side ? current : {
3710
+ top,
3711
+ side
3712
+ });
3713
+ }, [active, value.modelId]);
3714
+ react.useLayoutEffect(() => {
3715
+ if (!open) return;
3716
+ placePanel();
3717
+ let frame = requestAnimationFrame(() => {
3718
+ frame = requestAnimationFrame(placePanel);
3719
+ });
3720
+ return () => cancelAnimationFrame(frame);
3721
+ }, [
3722
+ open,
3723
+ placePanel,
3724
+ detailModel
3725
+ ]);
3726
+ const onKeyDown = (event) => {
3727
+ window.clearTimeout(intentTimer.current);
3728
+ trail.current = [];
3729
+ if (query || !highlightedModel?.levels?.length || event.key !== "ArrowLeft" && event.key !== "ArrowRight") return;
3730
+ event.preventDefault();
3731
+ const levels = highlightedModel.levels;
3732
+ const index = levels.findIndex((level) => level.id === levelFor(highlightedModel));
3733
+ const next = levels[Math.min(levels.length - 1, Math.max(0, index + (event.key === "ArrowRight" ? 1 : -1)))];
3734
+ if (next) setPendingLevels((current) => ({
3735
+ ...current,
3736
+ [highlightedModel.id]: next.id
3737
+ }));
3738
+ };
3739
+ /** Right-aligned column with a fixed minimum width, so prices, blocks, and checks line up down the list. */
3740
+ const trailing = (model, pricing) => {
3741
+ if (model.disabled && model.disabledReason) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3742
+ title: model.disabledReason,
3743
+ className: "truncate text-xs text-muted-foreground",
3744
+ children: model.disabledReason
3745
+ });
3746
+ if (priceDisplay === "none" || !pricing) return null;
3747
+ if (isFree(pricing)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3748
+ className: "text-xs font-medium text-link",
3749
+ children: "Free"
3750
+ });
3751
+ if (priceDisplay === "price") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PriceText, { pricing });
3752
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CostBlocks, { tier: costTier(maxCost > 0 ? Math.log1p(blendedCost(pricing)) / Math.log1p(maxCost) : 0, false) });
3753
+ };
3754
+ const renderItem = (model, section) => {
3755
+ const level = levelOf(model, levelFor(model));
3756
+ const pricing = pricingOf(model, level);
3757
+ const tags = model.tags?.filter((tag) => !(tag === "free" && isFree(pricing) && priceDisplay !== "none"));
3758
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_command.CommandItem, {
3759
+ value: `${section}::${model.id}`,
3760
+ "data-model-value": `${section}::${model.id}`,
3761
+ keywords: [
3762
+ model.name,
3763
+ model.provider,
3764
+ ...model.levels?.map((entry) => entry.label) ?? [],
3765
+ ...model.tags ?? []
3766
+ ],
3767
+ disabled: model.disabled,
3768
+ onSelect: () => choose(model),
3769
+ className: "h-9 gap-2 rounded-sm pointer-coarse:h-11",
3770
+ children: [
3771
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelGlyph, { model }),
3772
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3773
+ className: "flex min-w-0 flex-1 items-baseline gap-1.5",
3774
+ children: [
3775
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3776
+ title: model.name,
3777
+ className: "truncate text-foreground",
3778
+ children: model.name
3779
+ }),
3780
+ level ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3781
+ title: level.label,
3782
+ className: "shrink truncate text-muted-foreground",
3783
+ children: level.label
3784
+ }) : null,
3785
+ tags?.slice(0, MAX_ROW_TAGS).map((tag) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, { tag }, tag)),
3786
+ tags && tags.length > MAX_ROW_TAGS ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
3787
+ title: tags.slice(MAX_ROW_TAGS).map((tag) => TAG_LABEL[tag]).join(", "),
3788
+ className: "shrink-0 text-xs text-muted-foreground tabular-nums",
3789
+ children: ["+", tags.length - MAX_ROW_TAGS]
3790
+ }) : null
3791
+ ]
3792
+ }),
3793
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3794
+ className: "flex min-w-14 shrink-0 justify-end text-muted-foreground",
3795
+ children: trailing(model, pricing)
3796
+ }),
3797
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
3798
+ "aria-hidden": "true",
3799
+ className: require_utils.cn("size-3.5 shrink-0 text-foreground", model.id === value.modelId ? "opacity-100" : "opacity-0")
3800
+ })
3801
+ ]
3802
+ }, `${section}::${model.id}`);
3803
+ };
3804
+ const visible = query ? sections.all : [...sections.browsing, ...sections.all];
3805
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_popover.Popover, {
3806
+ open,
3807
+ onOpenChange: (next) => {
3808
+ setOpen(next);
3809
+ if (next) {
3810
+ setQuery("");
3811
+ setPendingLevels({});
3812
+ const home = [...sections.browsing, ...sections.all].find((section) => section.items.some((model) => model.id === value.modelId));
3813
+ if (home) setHighlighted(`${home.id}::${value.modelId}`);
3814
+ }
3815
+ },
3816
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_popover.PopoverTrigger, {
3817
+ "aria-label": selected ? `${label}: ${selected.name}${selectedLevel ? `, ${selectedLevel.label}` : ""}` : label,
3818
+ disabled,
3819
+ onClick: (event) => event.stopPropagation(),
3820
+ className: require_utils.cn("flex h-8 max-w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-md px-2 text-[0.8125rem] text-foreground outline-none", "hover:bg-overlay-hover focus-visible:ring-[3px] focus-visible:ring-ring/50 data-popup-open:bg-overlay-hover", "transition-transform duration-(--duration-fast) motion-safe:active:scale-[0.96] disabled:cursor-not-allowed disabled:opacity-64", triggerClassName),
3821
+ children: [
3822
+ selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelGlyph, { model: selected }) : null,
3823
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3824
+ title: selected?.name ?? "Choose a model",
3825
+ className: "truncate",
3826
+ children: selected?.name ?? "Choose a model"
3827
+ }),
3828
+ selectedLevel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3829
+ title: selectedLevel.label,
3830
+ className: "truncate text-muted-foreground",
3831
+ children: selectedLevel.label
3832
+ }) : null,
3833
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, {
3834
+ "aria-hidden": "true",
3835
+ className: "size-3.5 shrink-0 text-muted-foreground"
3836
+ })
3837
+ ]
3838
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_popover.PopoverContent, {
3839
+ side,
3840
+ align,
3841
+ className: require_utils.cn("relative w-[min(22rem,calc(100vw-1.5rem))] p-0", contentClassName),
3842
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3843
+ ref: contentRef,
3844
+ onPointerMove: (event) => {
3845
+ trail.current = [...trail.current.slice(-3), {
3846
+ x: event.clientX,
3847
+ y: event.clientY
3848
+ }];
3849
+ },
3850
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_command.Command, {
3851
+ value: highlighted,
3852
+ onValueChange: setHighlighted,
3853
+ onKeyDown,
3854
+ loop: true,
3855
+ className: "rounded-[inherit]",
3856
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3857
+ className: "relative border-b border-border",
3858
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_command.CommandInput, {
3859
+ value: query,
3860
+ onValueChange: setQuery,
3861
+ placeholder: "Search models",
3862
+ className: "pe-9"
3863
+ }), canTogglePrice ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_tooltip.Tooltip, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipTrigger, { render: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3864
+ type: "button",
3865
+ "aria-label": "Show prices per million tokens",
3866
+ "aria-pressed": priceDisplay === "price",
3867
+ onClick: () => setPriceDisplay((current) => current === "price" ? "meter" : "price"),
3868
+ className: require_utils.cn("absolute top-1/2 end-2.5 grid size-7 -translate-y-1/2 cursor-pointer place-items-center rounded-md outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50", priceDisplay === "price" ? "bg-muted text-foreground" : "text-muted-foreground hover:bg-overlay-hover hover:text-foreground"),
3869
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleDollarSign, {
3870
+ "aria-hidden": "true",
3871
+ className: "size-4"
3872
+ })
3873
+ }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_tooltip.TooltipContent, { children: priceDisplay === "price" ? "Show relative cost" : "Show prices per 1M tokens" })] }) : null]
3874
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_command.CommandList, {
3875
+ className: "h-[min(20rem,50vh)] max-h-none p-1 not-empty:p-1",
3876
+ onScroll: placePanel,
3877
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_command.CommandEmpty, {
3878
+ className: "py-6 text-center text-sm text-muted-foreground",
3879
+ children: "No models matched"
3880
+ }), visible.map((section) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_command.CommandGroup, {
3881
+ heading: section.label,
3882
+ children: section.items.map((model) => renderItem(model, section.id))
3883
+ }, section.id))]
3884
+ })]
3885
+ })
3886
+ }), detailModel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3887
+ ref: panelRef,
3888
+ "data-slot": "model-selector-details",
3889
+ onPointerEnter: () => {
3890
+ window.clearTimeout(intentTimer.current);
3891
+ if (active && active !== highlighted) setHighlighted(active);
3892
+ },
3893
+ style: panel.side === "below" ? void 0 : { top: panel.top },
3894
+ className: require_utils.cn(panel.side === "below" ? "border-t border-border" : require_utils.cn("absolute w-64 rounded-lg border bg-popover text-popover-foreground shadow-lg", panel.side === "right" ? "left-full ml-1.5" : "right-full mr-1.5")),
3895
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ModelDetails, {
3896
+ model: detailModel,
3897
+ levelId: levelFor(detailModel),
3898
+ onPickLevel: (levelId) => {
3899
+ setPendingLevels((current) => ({
3900
+ ...current,
3901
+ [detailModel.id]: levelId
3902
+ }));
3903
+ choose(detailModel, levelId);
3904
+ }
3905
+ })
3906
+ }) : null]
3907
+ })]
3908
+ });
3909
+ }
3910
+
3911
+ //#endregion
3912
+ //#region src/components/ai/prompt-input-attachment.tsx
3913
+ /**
3914
+ * Staged file chip shown inside a composer before sending: thumbnail or icon,
3915
+ * name, meta, upload state, and remove.
3916
+ */
3917
+ function PromptInputAttachment({ name, meta, previewUrl, icon, status = "ready", onRemove, className, ...props }) {
3918
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3919
+ "data-slot": "prompt-input-attachment",
3920
+ "data-status": status,
3921
+ className: require_utils.cn("relative flex h-10 max-w-56 min-w-0 items-center gap-2 rounded-lg bg-muted/70 pe-1.5 ps-1 text-start dark:bg-muted", status === "error" && "bg-destructive/8 dark:bg-destructive/16", className),
3922
+ ...props,
3923
+ children: [
3924
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkTile, {
3925
+ size: "md",
3926
+ className: require_utils.cn("rounded-md", status === "error" && "text-destructive"),
3927
+ children: status === "uploading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_spinner.Spinner, {
3928
+ "aria-hidden": "true",
3929
+ role: void 0,
3930
+ className: "size-4",
3931
+ strokeWidth: 1.5
3932
+ }) : status === "error" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleAlert, {}) : previewUrl ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
3933
+ src: previewUrl,
3934
+ alt: "",
3935
+ className: "size-full object-cover"
3936
+ }) : icon ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.FileText, {})
3937
+ }),
3938
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3939
+ className: "min-w-0 flex-1 leading-tight",
3940
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3941
+ title: name,
3942
+ className: "truncate text-[0.8125rem] text-foreground",
3943
+ children: name
3944
+ }), meta ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3945
+ className: require_utils.cn("truncate text-xs", status === "error" ? "text-destructive" : "text-muted-foreground"),
3946
+ children: meta
3947
+ }) : null]
3948
+ }),
3949
+ status === "uploading" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3950
+ className: "sr-only",
3951
+ children: "Uploading"
3952
+ }) : null,
3953
+ onRemove ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3954
+ type: "button",
3955
+ "aria-label": `Remove ${name}`,
3956
+ onClick: onRemove,
3957
+ className: "relative grid size-5 shrink-0 cursor-pointer place-items-center rounded-full text-muted-foreground outline-none before:absolute before:-inset-2 hover:bg-overlay-active hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 pointer-coarse:before:-inset-3",
3958
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {
3959
+ "aria-hidden": "true",
3960
+ className: "size-3"
3961
+ })
3962
+ }) : null
3963
+ ]
3964
+ });
3965
+ }
3966
+ /** Wrapping row of attachment chips, placed above the textarea. */
3967
+ function PromptInputAttachments({ className, ...props }) {
3968
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3969
+ role: "group",
3970
+ "aria-label": "Attachments",
3971
+ "data-slot": "prompt-input-attachments",
3972
+ className: require_utils.cn("flex flex-wrap gap-1.5 px-1 pt-0.5 pb-1 [&>*]:shrink-0", className),
2835
3973
  ...props
2836
3974
  });
2837
3975
  }
2838
3976
 
2839
3977
  //#endregion
3978
+ //#region src/components/ai/ask-card.tsx
3979
+ const KEYS = "ABCDEFGHIJ";
3980
+ function QuestionHeading({ id, children }) {
3981
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
3982
+ className: "flex min-h-7 items-start gap-2 px-1 py-1",
3983
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleHelp, {
3984
+ "aria-hidden": "true",
3985
+ className: "mt-0.5 size-4 shrink-0 text-muted-foreground"
3986
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3987
+ id,
3988
+ className: "min-w-0 text-pretty text-sm text-foreground [overflow-wrap:anywhere]",
3989
+ children
3990
+ })]
3991
+ });
3992
+ }
3993
+ function KeyBadge({ children, active }) {
3994
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3995
+ "aria-hidden": "true",
3996
+ className: require_utils.cn("grid size-5 shrink-0 place-items-center rounded-[5px] border text-[0.6875rem] font-medium tabular-nums", active ? "border-primary bg-primary text-primary-foreground" : "border-border bg-muted text-muted-foreground"),
3997
+ children
3998
+ });
3999
+ }
4000
+ function AskQuestionField({ question, choice, onChoose, otherLabel, disabled }) {
4001
+ const headingId = react.useId();
4002
+ const otherValue = choice && "other" in choice ? choice.other : "";
4003
+ const rowClass = "flex min-h-9 w-full items-center gap-2.5 rounded-sm border px-2 py-1.5 text-start text-sm outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50";
4004
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4005
+ className: "flex flex-col gap-1.5",
4006
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(QuestionHeading, {
4007
+ id: headingId,
4008
+ children: question.question
4009
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4010
+ role: "radiogroup",
4011
+ "aria-labelledby": headingId,
4012
+ className: "flex flex-col gap-1.5",
4013
+ children: [question.options.map((option, index) => {
4014
+ const checked = Boolean(choice && "option" in choice && choice.option === option.id);
4015
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
4016
+ type: "button",
4017
+ role: "radio",
4018
+ "aria-checked": checked,
4019
+ disabled,
4020
+ onClick: () => onChoose({ option: option.id }),
4021
+ className: require_utils.cn(rowClass, "cursor-pointer disabled:cursor-not-allowed disabled:opacity-64", checked ? "border-primary/40 bg-primary/6 text-foreground" : "border-border bg-card text-foreground hover:bg-overlay-hover"),
4022
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(KeyBadge, {
4023
+ active: checked,
4024
+ children: KEYS[index]
4025
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4026
+ className: "min-w-0 flex-1 [overflow-wrap:anywhere]",
4027
+ children: option.label
4028
+ })]
4029
+ }, option.id);
4030
+ }), question.allowOther !== false ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
4031
+ className: require_utils.cn(rowClass, "cursor-text focus-within:ring-[3px] focus-within:ring-ring/50", otherValue ? "border-primary/40 bg-primary/6" : "border-border bg-card"),
4032
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(KeyBadge, {
4033
+ active: Boolean(otherValue),
4034
+ children: KEYS[question.options.length]
4035
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
4036
+ type: "text",
4037
+ value: otherValue,
4038
+ disabled,
4039
+ placeholder: `${otherLabel}…`,
4040
+ "aria-label": otherLabel,
4041
+ onChange: (event) => onChoose(event.target.value ? { other: event.target.value } : void 0),
4042
+ className: "min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-subtle-foreground pointer-coarse:text-base"
4043
+ })]
4044
+ }) : null]
4045
+ })]
4046
+ });
4047
+ }
4048
+ function AnswerChip({ children, muted }) {
4049
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4050
+ className: require_utils.cn("inline-flex h-6 max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-1.5 text-[0.8125rem]", muted ? "text-muted-foreground" : "text-foreground"),
4051
+ children: [muted ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleCheck, {
4052
+ "aria-hidden": "true",
4053
+ className: require_utils.cn("size-3.5 shrink-0 fill-primary text-primary-foreground", iconEnterClass)
4054
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4055
+ title: typeof children === "string" ? children : void 0,
4056
+ className: "truncate",
4057
+ children
4058
+ })]
4059
+ });
4060
+ }
4061
+ /**
4062
+ * Inline clarifying questions from an agent. Each question offers lettered
4063
+ * options plus a free-text row; the card settles into a one-line summary per
4064
+ * question once answered or skipped.
4065
+ */
4066
+ function AskCard({ questions, answer, onSubmit, onSkip, continueLabel = "Continue", skipLabel = "Skip", otherLabel = "Something else", disabled, className, ...props }) {
4067
+ const [choices, setChoices] = react.useState({});
4068
+ const complete = questions.every((question) => {
4069
+ const choice = choices[question.id];
4070
+ return choice && ("option" in choice || choice.other.trim().length > 0);
4071
+ });
4072
+ if (answer) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4073
+ "data-slot": "ask-card",
4074
+ "data-state": "answered",
4075
+ className: require_utils.cn("flex animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] flex-col gap-1 motion-reduce:animate-none", className),
4076
+ ...props,
4077
+ children: questions.map((question) => {
4078
+ const choice = "choices" in answer ? answer.choices[question.id] : void 0;
4079
+ const label = choice ? "option" in choice ? question.options.find((option) => option.id === choice.option)?.label : `“${choice.other}”` : void 0;
4080
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4081
+ className: "flex flex-wrap items-center gap-x-2 gap-y-1",
4082
+ children: [
4083
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CircleHelp, {
4084
+ "aria-hidden": "true",
4085
+ className: "size-4 shrink-0 text-muted-foreground"
4086
+ }),
4087
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4088
+ className: "min-w-0 text-pretty text-sm text-foreground [overflow-wrap:anywhere]",
4089
+ children: question.question
4090
+ }),
4091
+ label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnswerChip, { children: label }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnswerChip, {
4092
+ muted: true,
4093
+ children: "Skipped"
4094
+ })
4095
+ ]
4096
+ }, question.id);
4097
+ })
4098
+ });
4099
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4100
+ "data-slot": "ask-card",
4101
+ "data-state": "open",
4102
+ className: require_utils.cn("flex animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] flex-col gap-3 rounded-xl bg-card p-2 shadow-card motion-reduce:animate-none", className),
4103
+ ...props,
4104
+ children: [questions.map((question) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AskQuestionField, {
4105
+ question,
4106
+ choice: choices[question.id],
4107
+ disabled,
4108
+ otherLabel,
4109
+ onChoose: (choice) => setChoices((current) => {
4110
+ const next = { ...current };
4111
+ if (choice) next[question.id] = choice;
4112
+ else delete next[question.id];
4113
+ return next;
4114
+ })
4115
+ }, question.id)), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4116
+ className: "flex flex-wrap items-center gap-2",
4117
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
4118
+ size: "xs",
4119
+ disabled: disabled || !complete,
4120
+ onClick: () => onSubmit?.(choices),
4121
+ children: continueLabel
4122
+ }), onSkip ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
4123
+ size: "xs",
4124
+ variant: "outline",
4125
+ disabled,
4126
+ onClick: onSkip,
4127
+ children: skipLabel
4128
+ }) : null]
4129
+ })]
4130
+ });
4131
+ }
4132
+
4133
+ //#endregion
4134
+ //#region src/components/ai/connect-prompt.tsx
4135
+ /**
4136
+ * Inline request from an agent to connect a missing app before it continues.
4137
+ * Settles into a quiet "Connected" or "Skipped" chip.
4138
+ */
4139
+ function ConnectPrompt({ icon, name, description, status = "idle", connectLabel = "Connect", skipLabel, onConnect, onSkip, className, ...props }) {
4140
+ const settled = status === "connected" || status === "skipped";
4141
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4142
+ "data-slot": "connect-prompt",
4143
+ "data-status": status,
4144
+ className: require_utils.cn("flex animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] flex-wrap items-center gap-x-3 gap-y-2 rounded-xl bg-card p-3 shadow-card motion-reduce:animate-none", className),
4145
+ ...props,
4146
+ children: [
4147
+ icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkTile, {
4148
+ size: "md",
4149
+ className: "text-foreground",
4150
+ children: icon
4151
+ }) : null,
4152
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4153
+ className: "min-w-40 flex-1",
4154
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4155
+ title: typeof name === "string" ? name : void 0,
4156
+ className: "line-clamp-2 text-sm font-medium text-foreground [overflow-wrap:anywhere]",
4157
+ children: name
4158
+ }), description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
4159
+ title: typeof description === "string" ? description : void 0,
4160
+ className: "line-clamp-2 text-[0.8125rem] text-muted-foreground [overflow-wrap:anywhere]",
4161
+ children: description
4162
+ }) : null]
4163
+ }),
4164
+ settled ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4165
+ className: "ms-auto inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md bg-muted px-2 text-[0.8125rem] text-foreground",
4166
+ children: [status === "connected" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
4167
+ "aria-hidden": "true",
4168
+ className: require_utils.cn("size-3.5", iconEnterClass)
4169
+ }) : null, status === "connected" ? "Connected" : "Skipped"]
4170
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4171
+ className: "ms-auto flex max-w-full flex-wrap items-center justify-end gap-2",
4172
+ children: [skipLabel && onSkip ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
4173
+ size: "xs",
4174
+ variant: "outline",
4175
+ wrap: true,
4176
+ disabled: status === "connecting",
4177
+ onClick: onSkip,
4178
+ children: skipLabel
4179
+ }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
4180
+ size: "xs",
4181
+ wrap: true,
4182
+ disabled: status === "connecting",
4183
+ onClick: onConnect,
4184
+ children: connectLabel
4185
+ })]
4186
+ })
4187
+ ]
4188
+ });
4189
+ }
4190
+
4191
+ //#endregion
4192
+ //#region src/components/ai/agent-draft-card.tsx
4193
+ /**
4194
+ * Proposed agent spec an assistant drafts in chat: schedule, tools, and the
4195
+ * ordered steps it will run. Nothing runs until the host handles an action.
4196
+ */
4197
+ function AgentDraftCard({ name, badge = "Draft", schedule, tools = [], steps = [], actions = [], chosenActionId, onAction, defaultOpen = true, className, ...props }) {
4198
+ const chosen = actions.find((action) => action.id === chosenActionId);
4199
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4200
+ "data-slot": "agent-draft-card",
4201
+ className: require_utils.cn("animate-[ai-fade-up_var(--duration-slow)_var(--ease-out)_both] overflow-hidden rounded-xl bg-card shadow-card motion-reduce:animate-none", className),
4202
+ ...props,
4203
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.Collapsible, {
4204
+ defaultOpen,
4205
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
4206
+ className: "flex h-10 items-center gap-2 px-2",
4207
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.CollapsibleTrigger, {
4208
+ className: "group flex min-w-0 flex-1 cursor-pointer items-center justify-start gap-2 rounded-md font-normal py-1 text-start outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",
4209
+ children: [
4210
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronRight, {
4211
+ "aria-hidden": "true",
4212
+ className: "size-3.5 shrink-0 text-muted-foreground transition-transform duration-(--duration-moderate) ease-out group-data-panel-open:rotate-90 motion-reduce:transition-none rtl:-scale-x-100 rtl:group-data-panel-open:scale-x-100"
4213
+ }),
4214
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkTile, {
4215
+ className: "size-5 [&_svg:not([class*=size-])]:size-3",
4216
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Bot, {})
4217
+ }),
4218
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4219
+ title: typeof name === "string" ? name : void 0,
4220
+ className: "truncate font-mono text-[0.8125rem] text-foreground",
4221
+ children: name
4222
+ })
4223
+ ]
4224
+ }), badge ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4225
+ className: "inline-flex h-5 shrink-0 items-center rounded-[5px] border border-border px-1.5 text-xs text-muted-foreground",
4226
+ children: badge
4227
+ }) : null]
4228
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_collapsible.CollapsibleContent, { children: [schedule || tools.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dl", {
4229
+ className: "grid grid-cols-[5.5rem_minmax(0,1fr)] gap-x-3 gap-y-2 border-t border-border px-4 py-3 text-[0.8125rem]",
4230
+ children: [schedule ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
4231
+ className: "text-muted-foreground",
4232
+ children: "Runs"
4233
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("dd", {
4234
+ className: "min-w-0 text-foreground [overflow-wrap:anywhere]",
4235
+ children: schedule
4236
+ })] }) : null, tools.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("dt", {
4237
+ className: "text-muted-foreground",
4238
+ children: "Tools"
4239
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("dd", {
4240
+ className: "flex min-w-0 items-center gap-2 text-foreground",
4241
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4242
+ className: "flex -space-x-1",
4243
+ children: tools.map((tool) => tool.icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(MarkTile, {
4244
+ className: "text-foreground ring-2 ring-card",
4245
+ children: tool.icon
4246
+ }, tool.id) : null)
4247
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4248
+ title: tools.map((tool) => tool.label).join(", "),
4249
+ className: "truncate",
4250
+ children: tools.map((tool) => tool.label).join(", ")
4251
+ })]
4252
+ })] }) : null]
4253
+ }) : null, steps.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
4254
+ className: "flex flex-col gap-1.5 border-t border-border px-4 py-3 text-[0.8125rem] text-muted-foreground",
4255
+ children: steps.map((step, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
4256
+ className: "flex gap-3",
4257
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4258
+ className: "w-3 shrink-0 text-end tabular-nums text-subtle-foreground",
4259
+ children: index + 1
4260
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4261
+ className: "min-w-0 text-pretty [overflow-wrap:anywhere]",
4262
+ children: step
4263
+ })]
4264
+ }, index))
4265
+ }) : null] })]
4266
+ }), actions.length ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
4267
+ className: "flex flex-wrap items-center gap-2 border-t border-border p-2",
4268
+ children: chosen ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4269
+ className: "inline-flex min-h-7 max-w-full items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-[0.8125rem] text-foreground [overflow-wrap:anywhere]",
4270
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Check, {
4271
+ "aria-hidden": "true",
4272
+ className: require_utils.cn("size-3.5 shrink-0", iconEnterClass)
4273
+ }), chosen.chosenLabel ?? chosen.label]
4274
+ }) : actions.map((action, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_button.Button, {
4275
+ size: "xs",
4276
+ wrap: true,
4277
+ variant: action.variant ?? (index === 0 ? "default" : "outline"),
4278
+ onClick: () => onAction?.(action.id),
4279
+ children: action.label
4280
+ }, action.id))
4281
+ }) : null]
4282
+ });
4283
+ }
4284
+
4285
+ //#endregion
4286
+ Object.defineProperty(exports, 'AgentDraftCard', {
4287
+ enumerable: true,
4288
+ get: function () {
4289
+ return AgentDraftCard;
4290
+ }
4291
+ });
2840
4292
  Object.defineProperty(exports, 'AgentLoader', {
2841
4293
  enumerable: true,
2842
4294
  get: function () {
@@ -2855,6 +4307,12 @@ Object.defineProperty(exports, 'ApprovalCard', {
2855
4307
  return ApprovalCard;
2856
4308
  }
2857
4309
  });
4310
+ Object.defineProperty(exports, 'AskCard', {
4311
+ enumerable: true,
4312
+ get: function () {
4313
+ return AskCard;
4314
+ }
4315
+ });
2858
4316
  Object.defineProperty(exports, 'ChainOfThought', {
2859
4317
  enumerable: true,
2860
4318
  get: function () {
@@ -2885,6 +4343,12 @@ Object.defineProperty(exports, 'CodeBlock', {
2885
4343
  return CodeBlock;
2886
4344
  }
2887
4345
  });
4346
+ Object.defineProperty(exports, 'ConnectPrompt', {
4347
+ enumerable: true,
4348
+ get: function () {
4349
+ return ConnectPrompt;
4350
+ }
4351
+ });
2888
4352
  Object.defineProperty(exports, 'ContextCard', {
2889
4353
  enumerable: true,
2890
4354
  get: function () {
@@ -2903,6 +4367,12 @@ Object.defineProperty(exports, 'ContextRing', {
2903
4367
  return ContextRing;
2904
4368
  }
2905
4369
  });
4370
+ Object.defineProperty(exports, 'CostBlocks', {
4371
+ enumerable: true,
4372
+ get: function () {
4373
+ return CostBlocks;
4374
+ }
4375
+ });
2906
4376
  Object.defineProperty(exports, 'DiffTable', {
2907
4377
  enumerable: true,
2908
4378
  get: function () {
@@ -2933,6 +4403,12 @@ Object.defineProperty(exports, 'Loader', {
2933
4403
  return Loader;
2934
4404
  }
2935
4405
  });
4406
+ Object.defineProperty(exports, 'MarkTile', {
4407
+ enumerable: true,
4408
+ get: function () {
4409
+ return MarkTile;
4410
+ }
4411
+ });
2936
4412
  Object.defineProperty(exports, 'Markdown', {
2937
4413
  enumerable: true,
2938
4414
  get: function () {
@@ -2969,6 +4445,12 @@ Object.defineProperty(exports, 'MessageContent', {
2969
4445
  return MessageContent;
2970
4446
  }
2971
4447
  });
4448
+ Object.defineProperty(exports, 'ModelSelector', {
4449
+ enumerable: true,
4450
+ get: function () {
4451
+ return ModelSelector;
4452
+ }
4453
+ });
2972
4454
  Object.defineProperty(exports, 'PlanTracker', {
2973
4455
  enumerable: true,
2974
4456
  get: function () {
@@ -2993,6 +4475,18 @@ Object.defineProperty(exports, 'PromptInputActions', {
2993
4475
  return PromptInputActions;
2994
4476
  }
2995
4477
  });
4478
+ Object.defineProperty(exports, 'PromptInputAttachment', {
4479
+ enumerable: true,
4480
+ get: function () {
4481
+ return PromptInputAttachment;
4482
+ }
4483
+ });
4484
+ Object.defineProperty(exports, 'PromptInputAttachments', {
4485
+ enumerable: true,
4486
+ get: function () {
4487
+ return PromptInputAttachments;
4488
+ }
4489
+ });
2996
4490
  Object.defineProperty(exports, 'PromptInputBody', {
2997
4491
  enumerable: true,
2998
4492
  get: function () {
@@ -3005,6 +4499,18 @@ Object.defineProperty(exports, 'PromptInputTextarea', {
3005
4499
  return PromptInputTextarea;
3006
4500
  }
3007
4501
  });
4502
+ Object.defineProperty(exports, 'PromptInputTray', {
4503
+ enumerable: true,
4504
+ get: function () {
4505
+ return PromptInputTray;
4506
+ }
4507
+ });
4508
+ Object.defineProperty(exports, 'PromptInputTrayRow', {
4509
+ enumerable: true,
4510
+ get: function () {
4511
+ return PromptInputTrayRow;
4512
+ }
4513
+ });
3008
4514
  Object.defineProperty(exports, 'PromptSuggestion', {
3009
4515
  enumerable: true,
3010
4516
  get: function () {
@@ -3113,6 +4619,12 @@ Object.defineProperty(exports, 'ThinkingBar', {
3113
4619
  return ThinkingBar;
3114
4620
  }
3115
4621
  });
4622
+ Object.defineProperty(exports, 'ThinkingStatus', {
4623
+ enumerable: true,
4624
+ get: function () {
4625
+ return ThinkingStatus;
4626
+ }
4627
+ });
3116
4628
  Object.defineProperty(exports, 'ThinkingTrace', {
3117
4629
  enumerable: true,
3118
4630
  get: function () {
@@ -3131,6 +4643,18 @@ Object.defineProperty(exports, 'ToolGroup', {
3131
4643
  return ToolGroup;
3132
4644
  }
3133
4645
  });
4646
+ Object.defineProperty(exports, 'ToolTrace', {
4647
+ enumerable: true,
4648
+ get: function () {
4649
+ return ToolTrace;
4650
+ }
4651
+ });
4652
+ Object.defineProperty(exports, 'UsageNotice', {
4653
+ enumerable: true,
4654
+ get: function () {
4655
+ return UsageNotice;
4656
+ }
4657
+ });
3134
4658
  Object.defineProperty(exports, 'formatCompact', {
3135
4659
  enumerable: true,
3136
4660
  get: function () {
@@ -3143,6 +4667,18 @@ Object.defineProperty(exports, 'formatDuration', {
3143
4667
  return formatDuration;
3144
4668
  }
3145
4669
  });
4670
+ Object.defineProperty(exports, 'formatElapsed', {
4671
+ enumerable: true,
4672
+ get: function () {
4673
+ return formatElapsed;
4674
+ }
4675
+ });
4676
+ Object.defineProperty(exports, 'iconEnterClass', {
4677
+ enumerable: true,
4678
+ get: function () {
4679
+ return iconEnterClass;
4680
+ }
4681
+ });
3146
4682
  Object.defineProperty(exports, 'lineDiff', {
3147
4683
  enumerable: true,
3148
4684
  get: function () {
@@ -3161,6 +4697,12 @@ Object.defineProperty(exports, 'renderBasicMarkdown', {
3161
4697
  return renderBasicMarkdown;
3162
4698
  }
3163
4699
  });
4700
+ Object.defineProperty(exports, 'usageTone', {
4701
+ enumerable: true,
4702
+ get: function () {
4703
+ return usageTone;
4704
+ }
4705
+ });
3164
4706
  Object.defineProperty(exports, 'useChatContainer', {
3165
4707
  enumerable: true,
3166
4708
  get: function () {
@@ -3179,4 +4721,4 @@ Object.defineProperty(exports, 'useThrottledText', {
3179
4721
  return useThrottledText;
3180
4722
  }
3181
4723
  });
3182
- //# sourceMappingURL=ai-lAkichk8.cjs.map
4724
+ //# sourceMappingURL=ai-DJ-YPj8c.cjs.map