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