@xpert-ai/chatkit-ui 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (611) hide show
  1. package/dist/app/assets/_baseUniq-p9H3Gzep.js +1 -0
  2. package/dist/app/assets/abap-bJX3iBqH.js +1 -0
  3. package/dist/app/assets/abnf-BoiZ35EE.js +1 -0
  4. package/dist/app/assets/actionscript-D-H9vZ8b.js +1 -0
  5. package/dist/app/assets/ada-Bne3WpOl.js +1 -0
  6. package/dist/app/assets/agda-C938cagi.js +1 -0
  7. package/dist/app/assets/al-Dcxw3Vj0.js +1 -0
  8. package/dist/app/assets/antlr4-uTm2QqyV.js +1 -0
  9. package/dist/app/assets/apacheconf-D52D513G.js +1 -0
  10. package/dist/app/assets/apex-B76H7J4g.js +1 -0
  11. package/dist/app/assets/apl-CzLk42pF.js +1 -0
  12. package/dist/app/assets/applescript-Dx8Ig-Eo.js +1 -0
  13. package/dist/app/assets/aql-wjx32tAU.js +1 -0
  14. package/dist/app/assets/arc-B32_yhh0.js +1 -0
  15. package/dist/app/assets/architectureDiagram-Q4EWVU46-Ba-C8DAI.js +36 -0
  16. package/dist/app/assets/arduino-BwKDxTSS.js +1 -0
  17. package/dist/app/assets/arff-DrkRViyY.js +1 -0
  18. package/dist/app/assets/asciidoc-BGLZq9v8.js +1 -0
  19. package/dist/app/assets/asm6502-MsEWIyJj.js +1 -0
  20. package/dist/app/assets/asmatmel-CeHxqS5T.js +1 -0
  21. package/dist/app/assets/aspnet-CmsQfR5a.js +1 -0
  22. package/dist/app/assets/autohotkey-Cusm-zTm.js +1 -0
  23. package/dist/app/assets/autoit-Da8gsEm-.js +1 -0
  24. package/dist/app/assets/avisynth-C46xLzyo.js +1 -0
  25. package/dist/app/assets/avro-idl-D2WmoYBG.js +1 -0
  26. package/dist/app/assets/{basic-B4YxRCle.js → bash-BrsKn3za.js} +1 -1
  27. package/dist/app/assets/basic-Dt5oGQ8B.js +1 -0
  28. package/dist/app/assets/batch-DtrIlfXi.js +1 -0
  29. package/dist/app/assets/bbcode-BWYlAYoE.js +1 -0
  30. package/dist/app/assets/bicep-C4sxks0f.js +1 -0
  31. package/dist/app/assets/birb-gYyyIZ-F.js +1 -0
  32. package/dist/app/assets/bison-or-umhj6.js +1 -0
  33. package/dist/app/assets/blockDiagram-DXYQGD6D-5oqbPp8P.js +132 -0
  34. package/dist/app/assets/bnf-BQR7hfk2.js +1 -0
  35. package/dist/app/assets/brainfuck-DkQqhNHv.js +1 -0
  36. package/dist/app/assets/brightscript-rGhg0HBT.js +1 -0
  37. package/dist/app/assets/bro-CIgtBg0f.js +1 -0
  38. package/dist/app/assets/bsl-C4geIkQv.js +1 -0
  39. package/dist/app/assets/c-Cw5181Rv.js +1 -0
  40. package/dist/app/assets/c4Diagram-AHTNJAMY-BKyN5n0Y.js +10 -0
  41. package/dist/app/assets/cfscript-DHPNMvWS.js +1 -0
  42. package/dist/app/assets/chaiscript-Cd8c0hJ8.js +1 -0
  43. package/dist/app/assets/channel-Cx11sSAI.js +1 -0
  44. package/dist/app/assets/chunk-4BX2VUAB-CfLubn_X.js +1 -0
  45. package/dist/app/assets/chunk-4TB4RGXK-Bhehm3S4.js +206 -0
  46. package/dist/app/assets/chunk-55IACEB6-D0Zgi2qX.js +1 -0
  47. package/dist/app/assets/chunk-EDXVE4YY-DzMULs0l.js +1 -0
  48. package/dist/app/assets/chunk-FMBD7UC4-CEU9agAN.js +15 -0
  49. package/dist/app/assets/chunk-OYMX7WX6-C-avxOs6.js +231 -0
  50. package/dist/app/assets/chunk-QZHKN3VN-C66xsvBW.js +1 -0
  51. package/dist/app/assets/chunk-YZCP3GAM-DZlwMcoL.js +1 -0
  52. package/dist/app/assets/cil-L3oWT8Nl.js +1 -0
  53. package/dist/app/assets/classDiagram-6PBFFD2Q-BQrwJXsB.js +1 -0
  54. package/dist/app/assets/classDiagram-v2-HSJHXN6E-BQrwJXsB.js +1 -0
  55. package/dist/app/assets/clike-CHF9NJQa.js +1 -0
  56. package/dist/app/assets/clojure-YgRWUbgr.js +1 -0
  57. package/dist/app/assets/clone-DHPdZQ_6.js +1 -0
  58. package/dist/app/assets/cmake-TK-Cvlxu.js +1 -0
  59. package/dist/app/assets/cobol-XSbSVVcZ.js +1 -0
  60. package/dist/app/assets/coffeescript-HxNd9-Ob.js +1 -0
  61. package/dist/app/assets/concurnas-DK3wUjjD.js +1 -0
  62. package/dist/app/assets/coq-B9Rq7NUE.js +1 -0
  63. package/dist/app/assets/core-B1vWjEfj.js +1 -0
  64. package/dist/app/assets/cose-bilkent-S5V4N54A-4PebjqsX.js +1 -0
  65. package/dist/app/assets/cpp-DUWMh-8O.js +1 -0
  66. package/dist/app/assets/crystal-rYgGF4lS.js +1 -0
  67. package/dist/app/assets/csharp-eqTMyksU.js +1 -0
  68. package/dist/app/assets/cshtml-DSv9-mpk.js +1 -0
  69. package/dist/app/assets/csp-DyZfVzvb.js +1 -0
  70. package/dist/app/assets/css-DYXyUyJe.js +1 -0
  71. package/dist/app/assets/css-extras-FP15zHq8.js +1 -0
  72. package/dist/app/assets/csv-Bp1iUR7c.js +1 -0
  73. package/dist/app/assets/cypher-BjXgs7Y3.js +1 -0
  74. package/dist/app/assets/cytoscape.esm-DkOyvmE4.js +321 -0
  75. package/dist/app/assets/d-Bquc1S6a.js +1 -0
  76. package/dist/app/assets/dagre-KV5264BT-D9OICDLb.js +4 -0
  77. package/dist/app/assets/dart-DrKyO7TC.js +1 -0
  78. package/dist/app/assets/dataweave-BgpsWzO7.js +1 -0
  79. package/dist/app/assets/dax-BwP1SyCZ.js +1 -0
  80. package/dist/app/assets/defaultLocale-DX6XiGOO.js +1 -0
  81. package/dist/app/assets/dhall-BA5nXB8V.js +1 -0
  82. package/dist/app/assets/diagram-5BDNPKRD-BIFTIy6n.js +10 -0
  83. package/dist/app/assets/diagram-G4DWMVQ6-BCVIBrZ2.js +24 -0
  84. package/dist/app/assets/diagram-MMDJMWI5-43z4NaFN.js +43 -0
  85. package/dist/app/assets/diagram-TYMM5635-BDZjM1c_.js +24 -0
  86. package/dist/app/assets/diff-Yc6a7YOT.js +3 -0
  87. package/dist/app/assets/django-B61BBi1t.js +1 -0
  88. package/dist/app/assets/dns-zone-file-DtXhOJHq.js +1 -0
  89. package/dist/app/assets/docker-BLh9n10i.js +1 -0
  90. package/dist/app/assets/dot-BbSnn0Ap.js +1 -0
  91. package/dist/app/assets/ebnf-D_ljHBdb.js +1 -0
  92. package/dist/app/assets/editorconfig-BQXrLGC5.js +1 -0
  93. package/dist/app/assets/eiffel-Cm3FUI5X.js +1 -0
  94. package/dist/app/assets/ejs-CIp2UdDw.js +1 -0
  95. package/dist/app/assets/elixir-DXlWBe5R.js +1 -0
  96. package/dist/app/assets/elm-ECxjLCR-.js +1 -0
  97. package/dist/app/assets/erDiagram-SMLLAGMA-B9I89ndp.js +85 -0
  98. package/dist/app/assets/erb-FzgX8ydn.js +1 -0
  99. package/dist/app/assets/erlang-CzvdSvoz.js +1 -0
  100. package/dist/app/assets/etlua-C3Zsz3RA.js +1 -0
  101. package/dist/app/assets/excel-formula-Cua38PQJ.js +1 -0
  102. package/dist/app/assets/factor-CSAzXoQb.js +1 -0
  103. package/dist/app/assets/false-NSFMCUjP.js +1 -0
  104. package/dist/app/assets/firestore-security-rules-BjNYwvNe.js +1 -0
  105. package/dist/app/assets/flow-BuZaM8y6.js +1 -0
  106. package/dist/app/assets/flowDiagram-DWJPFMVM-CWmW_muY.js +162 -0
  107. package/dist/app/assets/fortran-Cc_f_mSH.js +1 -0
  108. package/dist/app/assets/fsharp-IelQ4Z-Z.js +1 -0
  109. package/dist/app/assets/ftl-Ddl9DDyG.js +1 -0
  110. package/dist/app/assets/ganttDiagram-T4ZO3ILL-CuR1J7dx.js +292 -0
  111. package/dist/app/assets/gap-D3W6p-Jp.js +1 -0
  112. package/dist/app/assets/gcode-Bn8O4UOx.js +1 -0
  113. package/dist/app/assets/gdscript-B4nck3Az.js +1 -0
  114. package/dist/app/assets/gedcom-BCTZRsxn.js +1 -0
  115. package/dist/app/assets/gherkin-CFCJQug9.js +1 -0
  116. package/dist/app/assets/git-Dd2t83_l.js +1 -0
  117. package/dist/app/assets/gitGraphDiagram-UUTBAWPF-DzscVnaS.js +106 -0
  118. package/dist/app/assets/glsl-NXGZDuA9.js +1 -0
  119. package/dist/app/assets/gml-DtS9_99j.js +1 -0
  120. package/dist/app/assets/gn-C6VmNt4U.js +1 -0
  121. package/dist/app/assets/go-module-CmBM8SA1.js +1 -0
  122. package/dist/app/assets/go-otK-v_nb.js +1 -0
  123. package/dist/app/assets/graph-BelNBDAZ.js +1 -0
  124. package/dist/app/assets/graphql-JPlPKrhh.js +1 -0
  125. package/dist/app/assets/groovy-CkMUqzIt.js +1 -0
  126. package/dist/app/assets/haml-DwaIQOGd.js +1 -0
  127. package/dist/app/assets/handlebars-Ck6RB1iw.js +1 -0
  128. package/dist/app/assets/haskell-BxYLBxBa.js +1 -0
  129. package/dist/app/assets/haxe-C4OMV9zJ.js +1 -0
  130. package/dist/app/assets/hcl-DVznmODf.js +1 -0
  131. package/dist/app/assets/hlsl-Z_ySkish.js +1 -0
  132. package/dist/app/assets/hoon-UWT3k4H8.js +1 -0
  133. package/dist/app/assets/hpkp-CXa39f7J.js +1 -0
  134. package/dist/app/assets/hsts-CJF4yNvU.js +1 -0
  135. package/dist/app/assets/http-BxOKxlr4.js +1 -0
  136. package/dist/app/assets/ichigojam-Csb66zY2.js +1 -0
  137. package/dist/app/assets/icon-DxphTQI9.js +1 -0
  138. package/dist/app/assets/icu-message-format-CSZfssuP.js +1 -0
  139. package/dist/app/assets/idris-BmXANiaa.js +1 -0
  140. package/dist/app/assets/iecst-FfznJdjL.js +1 -0
  141. package/dist/app/assets/ignore-C3IKkXMi.js +1 -0
  142. package/dist/app/assets/index-D972kqET.css +1 -0
  143. package/dist/app/assets/index-DmMWBDJR.js +747 -0
  144. package/dist/app/assets/infoDiagram-42DDH7IO-rTeQPEt4.js +2 -0
  145. package/dist/app/assets/inform7-Dk4gPo4b.js +1 -0
  146. package/dist/app/assets/ini-CClGKGMe.js +1 -0
  147. package/dist/app/assets/init-Gi6I4Gst.js +1 -0
  148. package/dist/app/assets/io-6YtqLtET.js +1 -0
  149. package/dist/app/assets/ishikawaDiagram-UXIWVN3A-BBnJ9iuN.js +70 -0
  150. package/dist/app/assets/j-DBPrIcAG.js +1 -0
  151. package/dist/app/assets/java-CopGP3Lu.js +1 -0
  152. package/dist/app/assets/javadoc-C8F3ifW2.js +1 -0
  153. package/dist/app/assets/javadoclike-BNVFpoJC.js +1 -0
  154. package/dist/app/assets/javascript-BMkkas2q.js +1 -0
  155. package/dist/app/assets/javastacktrace-DuykBujE.js +1 -0
  156. package/dist/app/assets/jexl-BSWOm8s5.js +1 -0
  157. package/dist/app/assets/jolie-CdkOmKFM.js +1 -0
  158. package/dist/app/assets/journeyDiagram-VCZTEJTY-CRDpL_1T.js +139 -0
  159. package/dist/app/assets/jq-Nr0Kxpxc.js +1 -0
  160. package/dist/app/assets/js-extras-CA8iZ_E5.js +1 -0
  161. package/dist/app/assets/js-templates-BoqcQW67.js +1 -0
  162. package/dist/app/assets/jsdoc-CeMFl6xP.js +1 -0
  163. package/dist/app/assets/json-CrSHUueM.js +1 -0
  164. package/dist/app/assets/json5-BBfX460l.js +1 -0
  165. package/dist/app/assets/jsonp-DHEqmGWL.js +1 -0
  166. package/dist/app/assets/jsstacktrace-BK3SuvsS.js +1 -0
  167. package/dist/app/assets/jsx-CjR3dp14.js +1 -0
  168. package/dist/app/assets/julia-BJJ6LUnI.js +1 -0
  169. package/dist/app/assets/kanban-definition-6JOO6SKY-Dztk4Auy.js +89 -0
  170. package/dist/app/assets/keepalived-CjGUJvsk.js +1 -0
  171. package/dist/app/assets/keyman-Bogz-7f0.js +1 -0
  172. package/dist/app/assets/kotlin-DGdetcAk.js +1 -0
  173. package/dist/app/assets/kumir-Czhml4-j.js +1 -0
  174. package/dist/app/assets/kusto-BuL9qwXk.js +1 -0
  175. package/dist/app/assets/latex-BAc_zS_4.js +1 -0
  176. package/dist/app/assets/latte-BzZFX_wH.js +1 -0
  177. package/dist/app/assets/layout-DOHRtR3x.js +1 -0
  178. package/dist/app/assets/less-DATW_Ot3.js +1 -0
  179. package/dist/app/assets/lilypond-DSmAdE7B.js +1 -0
  180. package/dist/app/assets/linear-rr7FzlEM.js +1 -0
  181. package/dist/app/assets/liquid-CF8lqz9m.js +1 -0
  182. package/dist/app/assets/lisp-BUPAsWUh.js +1 -0
  183. package/dist/app/assets/livescript-B8CIEQDH.js +1 -0
  184. package/dist/app/assets/llvm-DGaRc9w0.js +1 -0
  185. package/dist/app/assets/log-XuE3Wqn5.js +1 -0
  186. package/dist/app/assets/lolcode-Clk-p_j2.js +1 -0
  187. package/dist/app/assets/{java-DvhwWZfy.js → lua-BLczZbJa.js} +1 -1
  188. package/dist/app/assets/magma-DTO3ftgF.js +1 -0
  189. package/dist/app/assets/makefile-OSVaZHmV.js +1 -0
  190. package/dist/app/assets/markdown-InD7dXs9.js +1 -0
  191. package/dist/app/assets/markup-BN6MlRZT.js +1 -0
  192. package/dist/app/assets/markup-templating-DRXAmI1c.js +1 -0
  193. package/dist/app/assets/matlab-CV_q70_G.js +1 -0
  194. package/dist/app/assets/maxscript-Ck_8H__C.js +1 -0
  195. package/dist/app/assets/mel-D9MU0rZa.js +1 -0
  196. package/dist/app/assets/mermaid-DshECBS6.js +1 -0
  197. package/dist/app/assets/min-CfLzpwyh.js +1 -0
  198. package/dist/app/assets/mindmap-definition-QFDTVHPH-C7XGlydX.js +96 -0
  199. package/dist/app/assets/mizar-WBJ-SwIG.js +1 -0
  200. package/dist/app/assets/mongodb-CmzRTKBq.js +1 -0
  201. package/dist/app/assets/monkey-W1yB--1T.js +1 -0
  202. package/dist/app/assets/moonscript-BD5hlCXn.js +1 -0
  203. package/dist/app/assets/n1ql-CwugAEoM.js +1 -0
  204. package/dist/app/assets/n4js-tFC-Lsvd.js +1 -0
  205. package/dist/app/assets/nand2tetris-hdl-hzvfBJxH.js +1 -0
  206. package/dist/app/assets/naniscript-DUtjoUL1.js +1 -0
  207. package/dist/app/assets/nasm-Dcckq6ib.js +1 -0
  208. package/dist/app/assets/neon-DeVv09BE.js +1 -0
  209. package/dist/app/assets/nevod-CAq9Kfwt.js +1 -0
  210. package/dist/app/assets/nginx-C8GHDEqt.js +1 -0
  211. package/dist/app/assets/nim-BqdyUedD.js +1 -0
  212. package/dist/app/assets/nix-514mCcjs.js +1 -0
  213. package/dist/app/assets/nsis-CdKqXn3g.js +1 -0
  214. package/dist/app/assets/objectivec-uPp8iMUn.js +1 -0
  215. package/dist/app/assets/ocaml-D4EB6rFL.js +1 -0
  216. package/dist/app/assets/opencl-BN8tmrp-.js +1 -0
  217. package/dist/app/assets/openqasm-CZT9yVLH.js +1 -0
  218. package/dist/app/assets/ordinal-Cboi1Yqb.js +1 -0
  219. package/dist/app/assets/oz-xEnzbfGI.js +1 -0
  220. package/dist/app/assets/parigp-PN33G_ZS.js +1 -0
  221. package/dist/app/assets/parser-YigtK2Gn.js +1 -0
  222. package/dist/app/assets/pascal-BSQHqJO2.js +1 -0
  223. package/dist/app/assets/pascaligo-B3om_nlX.js +1 -0
  224. package/dist/app/assets/pcaxis-B_qwjIH4.js +1 -0
  225. package/dist/app/assets/peoplecode-G3CTxh8q.js +1 -0
  226. package/dist/app/assets/perl-CBvGMSZZ.js +1 -0
  227. package/dist/app/assets/php-DewJLtev.js +1 -0
  228. package/dist/app/assets/php-extras-BT2DdjGn.js +1 -0
  229. package/dist/app/assets/phpdoc-DiQXOd9D.js +1 -0
  230. package/dist/app/assets/pieDiagram-DEJITSTG-CYXmqIpD.js +30 -0
  231. package/dist/app/assets/plsql-BzUO3h3t.js +1 -0
  232. package/dist/app/assets/powerquery-D_713gdU.js +1 -0
  233. package/dist/app/assets/powershell-D7IGyPyT.js +1 -0
  234. package/dist/app/assets/processing-CULfTuKk.js +1 -0
  235. package/dist/app/assets/prolog-DI8sHw_1.js +1 -0
  236. package/dist/app/assets/promql-DdWPpZzX.js +1 -0
  237. package/dist/app/assets/properties-UUBptvjg.js +1 -0
  238. package/dist/app/assets/protobuf-Yh4lBroy.js +1 -0
  239. package/dist/app/assets/psl-CKuqp255.js +1 -0
  240. package/dist/app/assets/pug-Duz4hJlP.js +1 -0
  241. package/dist/app/assets/puppet-Tenfq4aE.js +1 -0
  242. package/dist/app/assets/pure-CTE3YKFb.js +1 -0
  243. package/dist/app/assets/purebasic-BzV6ZqWW.js +1 -0
  244. package/dist/app/assets/purescript-CjSCYtGb.js +1 -0
  245. package/dist/app/assets/q-BTX8RKFy.js +1 -0
  246. package/dist/app/assets/qml-CGjBjP81.js +1 -0
  247. package/dist/app/assets/qore-5Gggmt2I.js +1 -0
  248. package/dist/app/assets/qsharp-DhqE1FPx.js +1 -0
  249. package/dist/app/assets/quadrantDiagram-34T5L4WZ-BbnPMKp-.js +7 -0
  250. package/dist/app/assets/r-Dr0jr5tD.js +1 -0
  251. package/dist/app/assets/racket-NVUa01EO.js +1 -0
  252. package/dist/app/assets/reason-Bx5CI0l0.js +1 -0
  253. package/dist/app/assets/regex-12879jLK.js +1 -0
  254. package/dist/app/assets/rego-w2Fhvb_N.js +1 -0
  255. package/dist/app/assets/renpy-gPxX0z3Q.js +1 -0
  256. package/dist/app/assets/requirementDiagram-MS252O5E-BhOU7uOd.js +84 -0
  257. package/dist/app/assets/rest-C39bU2b1.js +1 -0
  258. package/dist/app/assets/rip-RLtTVF0Y.js +1 -0
  259. package/dist/app/assets/roboconf-BJckt4oD.js +1 -0
  260. package/dist/app/assets/robotframework-DCR96jiT.js +1 -0
  261. package/dist/app/assets/ruby-CRs8uxXB.js +1 -0
  262. package/dist/app/assets/rust-C0bGL254.js +1 -0
  263. package/dist/app/assets/sankeyDiagram-XADWPNL6-CFgkd6GO.js +10 -0
  264. package/dist/app/assets/sas-CkLtpL1M.js +1 -0
  265. package/dist/app/assets/sass-FNfCYuQd.js +1 -0
  266. package/dist/app/assets/scala-Dy5lip5O.js +1 -0
  267. package/dist/app/assets/scheme-pkKED5As.js +1 -0
  268. package/dist/app/assets/scss-DrZ4F_S5.js +1 -0
  269. package/dist/app/assets/sequenceDiagram-FGHM5R23-t5z2WRg9.js +157 -0
  270. package/dist/app/assets/shell-session-tfqRzQ64.js +1 -0
  271. package/dist/app/assets/smali-D9oJJF_a.js +1 -0
  272. package/dist/app/assets/smalltalk-FhicZwdZ.js +1 -0
  273. package/dist/app/assets/smarty-RTVkhvGe.js +1 -0
  274. package/dist/app/assets/sml-8jU1U62j.js +1 -0
  275. package/dist/app/assets/solidity-DLvpuywG.js +1 -0
  276. package/dist/app/assets/solution-file-BOwCbL9x.js +1 -0
  277. package/dist/app/assets/soy-Dye6FppK.js +1 -0
  278. package/dist/app/assets/sparql-BRIOTA6e.js +1 -0
  279. package/dist/app/assets/splunk-spl-xjEKSM5T.js +1 -0
  280. package/dist/app/assets/sqf-BTXRZqz9.js +1 -0
  281. package/dist/app/assets/sql-LIGcsz7H.js +1 -0
  282. package/dist/app/assets/squirrel-D1i-yP9F.js +1 -0
  283. package/dist/app/assets/stan-Bz-MTQlG.js +1 -0
  284. package/dist/app/assets/stateDiagram-FHFEXIEX-INV79XkW.js +1 -0
  285. package/dist/app/assets/stateDiagram-v2-QKLJ7IA2-DkwGLXRp.js +1 -0
  286. package/dist/app/assets/stylus-CPcHbGGR.js +1 -0
  287. package/dist/app/assets/swift-CMnIAhC_.js +1 -0
  288. package/dist/app/assets/systemd-CnQ86vtn.js +2 -0
  289. package/dist/app/assets/t4-cs-ClADD8kZ.js +1 -0
  290. package/dist/app/assets/t4-templating-BxEXIn9V.js +1 -0
  291. package/dist/app/assets/t4-vb-BuQFrDQM.js +1 -0
  292. package/dist/app/assets/tap-D-OeTv7J.js +1 -0
  293. package/dist/app/assets/tcl-D4EWmvqA.js +1 -0
  294. package/dist/app/assets/textile-vCa5WeBr.js +1 -0
  295. package/dist/app/assets/timeline-definition-GMOUNBTQ-CZVpkWZR.js +120 -0
  296. package/dist/app/assets/toml-CyQfWyMg.js +1 -0
  297. package/dist/app/assets/tremor-DTpakXR3.js +1 -0
  298. package/dist/app/assets/tt2-I3k-jzpY.js +1 -0
  299. package/dist/app/assets/turtle-BjS87MX7.js +1 -0
  300. package/dist/app/assets/twig-BYK2hDMY.js +1 -0
  301. package/dist/app/assets/typescript-DNEOvUVG.js +1 -0
  302. package/dist/app/assets/typoscript-hqzFge6d.js +1 -0
  303. package/dist/app/assets/unrealscript-_-NzaZj0.js +1 -0
  304. package/dist/app/assets/uorazor-BMR9qMW5.js +1 -0
  305. package/dist/app/assets/uri-BSGWfMxZ.js +1 -0
  306. package/dist/app/assets/v-CLtdeXIK.js +1 -0
  307. package/dist/app/assets/vala-wzCcqtKA.js +1 -0
  308. package/dist/app/assets/{turtle-BtZWKoZ_.js → vbnet-DGCLmXdC.js} +1 -1
  309. package/dist/app/assets/velocity-DX_5gTOq.js +1 -0
  310. package/dist/app/assets/vennDiagram-DHZGUBPP-Dq1FXdcO.js +34 -0
  311. package/dist/app/assets/verilog-DeAFTKrK.js +1 -0
  312. package/dist/app/assets/vhdl-CgPp3m3I.js +1 -0
  313. package/dist/app/assets/vim-ZY6C4NgO.js +1 -0
  314. package/dist/app/assets/visual-basic-DmV7laqn.js +1 -0
  315. package/dist/app/assets/wardley-RL74JXVD-OqiGOeix.js +162 -0
  316. package/dist/app/assets/wardleyDiagram-NUSXRM2D-XXEOUAR6.js +20 -0
  317. package/dist/app/assets/warpscript-CST9Acbf.js +1 -0
  318. package/dist/app/assets/wasm-D44TvCcf.js +1 -0
  319. package/dist/app/assets/web-idl-CUAX3ogm.js +1 -0
  320. package/dist/app/assets/wiki-KNEqZQWK.js +1 -0
  321. package/dist/app/assets/wolfram-CZdD1bRd.js +1 -0
  322. package/dist/app/assets/wren-PITvEkQ4.js +1 -0
  323. package/dist/app/assets/xeora-BM_ABt9y.js +1 -0
  324. package/dist/app/assets/xml-doc-249eg8mF.js +1 -0
  325. package/dist/app/assets/xojo-M3SASV_b.js +1 -0
  326. package/dist/app/assets/xquery-BWv2VkcM.js +1 -0
  327. package/dist/app/assets/xychartDiagram-5P7HB3ND-CvXT15VO.js +7 -0
  328. package/dist/app/assets/yaml-B70AwQ7Y.js +1 -0
  329. package/dist/app/assets/yang-DffrsIpd.js +1 -0
  330. package/dist/app/assets/zig-C9vlYfKL.js +1 -0
  331. package/dist/app/index.html +2 -2
  332. package/dist/index.cjs +1315 -485
  333. package/dist/index.d.cts +3 -2
  334. package/dist/index.d.ts +3 -2
  335. package/dist/index.js +1342 -501
  336. package/package.json +6 -2
  337. package/dist/app/assets/abap-DMqO-Um8.js +0 -1
  338. package/dist/app/assets/abnf-CBYpoE1H.js +0 -1
  339. package/dist/app/assets/actionscript-ieE-wJMz.js +0 -1
  340. package/dist/app/assets/ada-0-3Dx7g-.js +0 -1
  341. package/dist/app/assets/agda-uvq9b4Kv.js +0 -1
  342. package/dist/app/assets/al-BmajJCAx.js +0 -1
  343. package/dist/app/assets/antlr4-DnRRgAfR.js +0 -1
  344. package/dist/app/assets/apacheconf-BWoRK3Q3.js +0 -1
  345. package/dist/app/assets/apex-u3cbevj3.js +0 -1
  346. package/dist/app/assets/apl-Cifc7IZj.js +0 -1
  347. package/dist/app/assets/applescript-CpHbiQqz.js +0 -1
  348. package/dist/app/assets/aql-C_VCCvUl.js +0 -1
  349. package/dist/app/assets/arduino-CSAc4iDr.js +0 -1
  350. package/dist/app/assets/arff-B8hSQDyJ.js +0 -1
  351. package/dist/app/assets/asciidoc-Guc1Uqnw.js +0 -1
  352. package/dist/app/assets/asm6502-CxPqNdV6.js +0 -1
  353. package/dist/app/assets/asmatmel-C76CHB5e.js +0 -1
  354. package/dist/app/assets/aspnet-BQFc33QF.js +0 -1
  355. package/dist/app/assets/autohotkey-uQeN2mix.js +0 -1
  356. package/dist/app/assets/autoit-Bmy0PsAQ.js +0 -1
  357. package/dist/app/assets/avisynth-BvuIlb62.js +0 -1
  358. package/dist/app/assets/avro-idl-DWeVWQR3.js +0 -1
  359. package/dist/app/assets/bash-HypWaeXO.js +0 -1
  360. package/dist/app/assets/batch-B1yKhArW.js +0 -1
  361. package/dist/app/assets/bbcode-BIDNxh7c.js +0 -1
  362. package/dist/app/assets/bicep-DkupOIs7.js +0 -1
  363. package/dist/app/assets/birb-Jo6NYQYX.js +0 -1
  364. package/dist/app/assets/bison-BjPiLxuX.js +0 -1
  365. package/dist/app/assets/bnf-BjygHCSE.js +0 -1
  366. package/dist/app/assets/brainfuck-CsnLnGPx.js +0 -1
  367. package/dist/app/assets/brightscript-CwmmyoHc.js +0 -1
  368. package/dist/app/assets/bro-BNKXu22N.js +0 -1
  369. package/dist/app/assets/bsl-DOwsbsXU.js +0 -1
  370. package/dist/app/assets/c-DyedRTs7.js +0 -1
  371. package/dist/app/assets/cfscript-DCpmh-J_.js +0 -1
  372. package/dist/app/assets/chaiscript-DRaisf-4.js +0 -1
  373. package/dist/app/assets/cil-C5bobqND.js +0 -1
  374. package/dist/app/assets/clike-CvmXR497.js +0 -1
  375. package/dist/app/assets/clojure-BH_u6xTK.js +0 -1
  376. package/dist/app/assets/cmake-CZruZSdT.js +0 -1
  377. package/dist/app/assets/cobol-qc5xAkcg.js +0 -1
  378. package/dist/app/assets/coffeescript-DGM4CLoq.js +0 -1
  379. package/dist/app/assets/concurnas-DFyZRxPp.js +0 -1
  380. package/dist/app/assets/coq-DbZe2f_H.js +0 -1
  381. package/dist/app/assets/core-BWUnDrKt.js +0 -1
  382. package/dist/app/assets/cpp-CidpRyAJ.js +0 -1
  383. package/dist/app/assets/crystal-DZE9-h5D.js +0 -1
  384. package/dist/app/assets/csharp-Cf2K5CJJ.js +0 -1
  385. package/dist/app/assets/cshtml-DRjf7C5F.js +0 -1
  386. package/dist/app/assets/csp-dEoRcP0N.js +0 -1
  387. package/dist/app/assets/css-BWUfAyau.js +0 -1
  388. package/dist/app/assets/css-extras-pPY_Crez.js +0 -1
  389. package/dist/app/assets/csv-DdkqZn4I.js +0 -1
  390. package/dist/app/assets/cypher-BXQbix41.js +0 -1
  391. package/dist/app/assets/d-BctgRQp0.js +0 -1
  392. package/dist/app/assets/dart-DuiikcDB.js +0 -1
  393. package/dist/app/assets/dataweave-ClZ_D-Ju.js +0 -1
  394. package/dist/app/assets/dax-DXNfCTH9.js +0 -1
  395. package/dist/app/assets/dhall-Cbz5hfMr.js +0 -1
  396. package/dist/app/assets/diff-bify6WLh.js +0 -3
  397. package/dist/app/assets/django-5DdvW3LZ.js +0 -1
  398. package/dist/app/assets/dns-zone-file-DIIW7lsW.js +0 -1
  399. package/dist/app/assets/docker-BxIMVoJD.js +0 -1
  400. package/dist/app/assets/dot-DLEHPnum.js +0 -1
  401. package/dist/app/assets/ebnf-DHWaG3pk.js +0 -1
  402. package/dist/app/assets/editorconfig-D2gTUSqU.js +0 -1
  403. package/dist/app/assets/eiffel-C3dcM2dq.js +0 -1
  404. package/dist/app/assets/ejs-0qd3jtKi.js +0 -1
  405. package/dist/app/assets/elixir-BbBaHIGe.js +0 -1
  406. package/dist/app/assets/elm-KJmeOU7e.js +0 -1
  407. package/dist/app/assets/erb-BncgAY0M.js +0 -1
  408. package/dist/app/assets/erlang-DS2SHYdK.js +0 -1
  409. package/dist/app/assets/etlua-CvdrPEPO.js +0 -1
  410. package/dist/app/assets/excel-formula-BSj1zROW.js +0 -1
  411. package/dist/app/assets/factor-DAbcpTN7.js +0 -1
  412. package/dist/app/assets/false-CI895JmG.js +0 -1
  413. package/dist/app/assets/firestore-security-rules-CJ33YIQv.js +0 -1
  414. package/dist/app/assets/flow-a2eNz08o.js +0 -1
  415. package/dist/app/assets/fortran-Bt9e6qJa.js +0 -1
  416. package/dist/app/assets/fsharp-Y0Qf2U16.js +0 -1
  417. package/dist/app/assets/ftl-D-TrqPet.js +0 -1
  418. package/dist/app/assets/gap-CP5bMoJx.js +0 -1
  419. package/dist/app/assets/gcode-DQNcGCou.js +0 -1
  420. package/dist/app/assets/gdscript-Bxt6W-z5.js +0 -1
  421. package/dist/app/assets/gedcom-Cqgp4wkt.js +0 -1
  422. package/dist/app/assets/gherkin-D7pNUe8Z.js +0 -1
  423. package/dist/app/assets/git-C4ec-8cM.js +0 -1
  424. package/dist/app/assets/glsl-8sVKxech.js +0 -1
  425. package/dist/app/assets/gml-TuwFoFK6.js +0 -1
  426. package/dist/app/assets/gn-BwHrmBhU.js +0 -1
  427. package/dist/app/assets/go-module-cqolzX_W.js +0 -1
  428. package/dist/app/assets/go-vGJJNlGP.js +0 -1
  429. package/dist/app/assets/graphql-Do6Lisgl.js +0 -1
  430. package/dist/app/assets/groovy--87wZh42.js +0 -1
  431. package/dist/app/assets/haml-vhodueeI.js +0 -1
  432. package/dist/app/assets/handlebars-CNLRaZ5R.js +0 -1
  433. package/dist/app/assets/haskell-BWTsCqP4.js +0 -1
  434. package/dist/app/assets/haxe-CSb0SWYW.js +0 -1
  435. package/dist/app/assets/hcl-ftOASTH-.js +0 -1
  436. package/dist/app/assets/hlsl-BnaGHwDi.js +0 -1
  437. package/dist/app/assets/hoon-wyj1oNzn.js +0 -1
  438. package/dist/app/assets/hpkp-Broim0YQ.js +0 -1
  439. package/dist/app/assets/hsts-BSMt-Rhs.js +0 -1
  440. package/dist/app/assets/http-yK1zPe9M.js +0 -1
  441. package/dist/app/assets/ichigojam-Bpzuxs1S.js +0 -1
  442. package/dist/app/assets/icon-DjPW0ImK.js +0 -1
  443. package/dist/app/assets/icu-message-format-CTS86FWW.js +0 -1
  444. package/dist/app/assets/idris-DkPie8bu.js +0 -1
  445. package/dist/app/assets/iecst-CG1KmB8U.js +0 -1
  446. package/dist/app/assets/ignore-D9eho3CQ.js +0 -1
  447. package/dist/app/assets/index-4J46qBCc.js +0 -445
  448. package/dist/app/assets/index-DTn9OjqV.css +0 -1
  449. package/dist/app/assets/inform7-DD1mc6Wh.js +0 -1
  450. package/dist/app/assets/ini-Db6U4nBT.js +0 -1
  451. package/dist/app/assets/io-BRkH6hzB.js +0 -1
  452. package/dist/app/assets/j-CD22iLrA.js +0 -1
  453. package/dist/app/assets/javadoc-Ecoxhe_9.js +0 -1
  454. package/dist/app/assets/javadoclike-Realhpv4.js +0 -1
  455. package/dist/app/assets/javascript-BBd1k8wl.js +0 -1
  456. package/dist/app/assets/javastacktrace-C8QW0vuU.js +0 -1
  457. package/dist/app/assets/jexl-CT2UXrnH.js +0 -1
  458. package/dist/app/assets/jolie-qtyDXXST.js +0 -1
  459. package/dist/app/assets/jq-CNJQULTZ.js +0 -1
  460. package/dist/app/assets/js-extras-DwIZLd4T.js +0 -1
  461. package/dist/app/assets/js-templates-glA_Un9b.js +0 -1
  462. package/dist/app/assets/jsdoc-BsXlBBjy.js +0 -1
  463. package/dist/app/assets/json-BC3xmMOU.js +0 -1
  464. package/dist/app/assets/json5-CiePGcB9.js +0 -1
  465. package/dist/app/assets/jsonp-B9HJmhak.js +0 -1
  466. package/dist/app/assets/jsstacktrace-3xS0eyZd.js +0 -1
  467. package/dist/app/assets/jsx-B5kMqxBm.js +0 -1
  468. package/dist/app/assets/julia-B5Udq0EY.js +0 -1
  469. package/dist/app/assets/keepalived-CI0hMS1b.js +0 -1
  470. package/dist/app/assets/keyman-BCtXwe5i.js +0 -1
  471. package/dist/app/assets/kotlin-B3l0V1Fn.js +0 -1
  472. package/dist/app/assets/kumir-BmC_PBOp.js +0 -1
  473. package/dist/app/assets/kusto-B0p1ppsT.js +0 -1
  474. package/dist/app/assets/latex-CHwNDYz_.js +0 -1
  475. package/dist/app/assets/latte-DihAtCCl.js +0 -1
  476. package/dist/app/assets/less-BLGkFSp1.js +0 -1
  477. package/dist/app/assets/lilypond-CCsAc8Nl.js +0 -1
  478. package/dist/app/assets/liquid-jBSQx5I5.js +0 -1
  479. package/dist/app/assets/lisp-CgzQXnYE.js +0 -1
  480. package/dist/app/assets/livescript-u96H-zdx.js +0 -1
  481. package/dist/app/assets/llvm-WmVcvcNM.js +0 -1
  482. package/dist/app/assets/log-990P-Rch.js +0 -1
  483. package/dist/app/assets/lolcode-DdFIjfxs.js +0 -1
  484. package/dist/app/assets/lua-GkhnMu0T.js +0 -1
  485. package/dist/app/assets/magma-wajb6K9F.js +0 -1
  486. package/dist/app/assets/makefile-CGHjuGaS.js +0 -1
  487. package/dist/app/assets/markdown-BFWQ31vs.js +0 -1
  488. package/dist/app/assets/markup-1ihI0X17.js +0 -1
  489. package/dist/app/assets/markup-templating-DblqKZLi.js +0 -1
  490. package/dist/app/assets/matlab-CPqo7ZUC.js +0 -1
  491. package/dist/app/assets/maxscript-CTgVjA7o.js +0 -1
  492. package/dist/app/assets/mel-Cxah6vYr.js +0 -1
  493. package/dist/app/assets/mermaid-BAgJSsZ7.js +0 -1
  494. package/dist/app/assets/mizar-BL3spn8_.js +0 -1
  495. package/dist/app/assets/mongodb-DXzP7tR0.js +0 -1
  496. package/dist/app/assets/monkey-anPtBsfj.js +0 -1
  497. package/dist/app/assets/moonscript-Y_tcmLfW.js +0 -1
  498. package/dist/app/assets/n1ql-B7NGFYRY.js +0 -1
  499. package/dist/app/assets/n4js-zh8URwWB.js +0 -1
  500. package/dist/app/assets/nand2tetris-hdl-CDUtzUHw.js +0 -1
  501. package/dist/app/assets/naniscript-CjJGU6C6.js +0 -1
  502. package/dist/app/assets/nasm-D6biC9Vr.js +0 -1
  503. package/dist/app/assets/neon-C3Z0pCuH.js +0 -1
  504. package/dist/app/assets/nevod-BT4Ivkzb.js +0 -1
  505. package/dist/app/assets/nginx-vHHTRs1B.js +0 -1
  506. package/dist/app/assets/nim-Jk1NOWk0.js +0 -1
  507. package/dist/app/assets/nix-CEkA_w3B.js +0 -1
  508. package/dist/app/assets/nsis-Du9w_Qb8.js +0 -1
  509. package/dist/app/assets/objectivec-BciYUGRR.js +0 -1
  510. package/dist/app/assets/ocaml-CpZ_M4DP.js +0 -1
  511. package/dist/app/assets/opencl-C-4M-Mvx.js +0 -1
  512. package/dist/app/assets/openqasm-CilZXlSe.js +0 -1
  513. package/dist/app/assets/oz-DluYJ10T.js +0 -1
  514. package/dist/app/assets/parigp-BlIaVN51.js +0 -1
  515. package/dist/app/assets/parser-BZVTYRp4.js +0 -1
  516. package/dist/app/assets/pascal-CMz_wkC0.js +0 -1
  517. package/dist/app/assets/pascaligo-DLQY1QwY.js +0 -1
  518. package/dist/app/assets/pcaxis-C-5nzMDp.js +0 -1
  519. package/dist/app/assets/peoplecode-BhTicHl8.js +0 -1
  520. package/dist/app/assets/perl-BArlZZ8M.js +0 -1
  521. package/dist/app/assets/php-C6zNUOf5.js +0 -1
  522. package/dist/app/assets/php-extras-DD5Glhrz.js +0 -1
  523. package/dist/app/assets/phpdoc-Buj0qa-9.js +0 -1
  524. package/dist/app/assets/plsql-o2-C-Ezr.js +0 -1
  525. package/dist/app/assets/powerquery-Cl0Dbp57.js +0 -1
  526. package/dist/app/assets/powershell-BVFtl1FS.js +0 -1
  527. package/dist/app/assets/processing-BHJTqgxZ.js +0 -1
  528. package/dist/app/assets/prolog-C9gykhtA.js +0 -1
  529. package/dist/app/assets/promql-TzYBDR1F.js +0 -1
  530. package/dist/app/assets/properties-Bi8GxxCM.js +0 -1
  531. package/dist/app/assets/protobuf-s08U24Jk.js +0 -1
  532. package/dist/app/assets/psl-By228u9L.js +0 -1
  533. package/dist/app/assets/pug-CahxgaMR.js +0 -1
  534. package/dist/app/assets/puppet-BAY6TBQY.js +0 -1
  535. package/dist/app/assets/pure-IA8ihD9R.js +0 -1
  536. package/dist/app/assets/purebasic-B6joY-ZH.js +0 -1
  537. package/dist/app/assets/purescript-DczXEj8E.js +0 -1
  538. package/dist/app/assets/q-CEXq_tpX.js +0 -1
  539. package/dist/app/assets/qml-ND31CBLa.js +0 -1
  540. package/dist/app/assets/qore-DAjVLL2F.js +0 -1
  541. package/dist/app/assets/qsharp-jccBvH6Y.js +0 -1
  542. package/dist/app/assets/r-pv5Xhvsd.js +0 -1
  543. package/dist/app/assets/racket-xRigDwdL.js +0 -1
  544. package/dist/app/assets/reason-DnAP7dec.js +0 -1
  545. package/dist/app/assets/regex-Dwkma1bN.js +0 -1
  546. package/dist/app/assets/rego-3dHPz-ut.js +0 -1
  547. package/dist/app/assets/renpy-Czxc7hu0.js +0 -1
  548. package/dist/app/assets/rest-BP_JQ_AG.js +0 -1
  549. package/dist/app/assets/rip-Nredd5kD.js +0 -1
  550. package/dist/app/assets/roboconf-CkR4ACer.js +0 -1
  551. package/dist/app/assets/robotframework-CYYV7JaP.js +0 -1
  552. package/dist/app/assets/ruby-EA_sSyU6.js +0 -1
  553. package/dist/app/assets/rust-BM2hEYJt.js +0 -1
  554. package/dist/app/assets/sas-jaxOWx-0.js +0 -1
  555. package/dist/app/assets/sass-pkiTdYnF.js +0 -1
  556. package/dist/app/assets/scala-lTsQiijh.js +0 -1
  557. package/dist/app/assets/scheme-DkPZYA1o.js +0 -1
  558. package/dist/app/assets/scss-DZjxUgqE.js +0 -1
  559. package/dist/app/assets/shell-session-CKXJ0a90.js +0 -1
  560. package/dist/app/assets/smali-DVWpHHAX.js +0 -1
  561. package/dist/app/assets/smalltalk-ChiRh9QF.js +0 -1
  562. package/dist/app/assets/smarty-C4i7AVoC.js +0 -1
  563. package/dist/app/assets/sml-v9dKzil3.js +0 -1
  564. package/dist/app/assets/solidity-DaxM8K8t.js +0 -1
  565. package/dist/app/assets/solution-file-Ch7ajMI6.js +0 -1
  566. package/dist/app/assets/soy-CHeWJZPl.js +0 -1
  567. package/dist/app/assets/sparql-f56EhPSR.js +0 -1
  568. package/dist/app/assets/splunk-spl-CNX2IshN.js +0 -1
  569. package/dist/app/assets/sqf-B9Z5kTgF.js +0 -1
  570. package/dist/app/assets/sql-PZTLdUd4.js +0 -1
  571. package/dist/app/assets/squirrel-_QTHEJtD.js +0 -1
  572. package/dist/app/assets/stan-y02QaMQQ.js +0 -1
  573. package/dist/app/assets/stylus-CGYq1GKp.js +0 -1
  574. package/dist/app/assets/swift-BBMLpv3H.js +0 -1
  575. package/dist/app/assets/systemd-CD7Dfv8Y.js +0 -2
  576. package/dist/app/assets/t4-cs-BtxQixNP.js +0 -1
  577. package/dist/app/assets/t4-templating-BX2jWZwS.js +0 -1
  578. package/dist/app/assets/t4-vb-CX3AQUVf.js +0 -1
  579. package/dist/app/assets/tap-BRBB20R0.js +0 -1
  580. package/dist/app/assets/tcl-CWrqc_vL.js +0 -1
  581. package/dist/app/assets/textile-EJMS8IJv.js +0 -1
  582. package/dist/app/assets/toml-DLWr0_Sd.js +0 -1
  583. package/dist/app/assets/tremor-D0DGH64h.js +0 -1
  584. package/dist/app/assets/tt2-CaSD1IpZ.js +0 -1
  585. package/dist/app/assets/twig-BQ0AWwu3.js +0 -1
  586. package/dist/app/assets/typescript-sByRs_H7.js +0 -1
  587. package/dist/app/assets/typoscript-Bs3x5DVu.js +0 -1
  588. package/dist/app/assets/unrealscript-BPk-JGuX.js +0 -1
  589. package/dist/app/assets/uorazor-Dxr1B729.js +0 -1
  590. package/dist/app/assets/uri-B18d7fGy.js +0 -1
  591. package/dist/app/assets/v-B-4se_c_.js +0 -1
  592. package/dist/app/assets/vala-CZJMpckw.js +0 -1
  593. package/dist/app/assets/vbnet-Bon1nLZm.js +0 -1
  594. package/dist/app/assets/velocity-Ck8gHF4B.js +0 -1
  595. package/dist/app/assets/verilog-zADKtd-6.js +0 -1
  596. package/dist/app/assets/vhdl-Ce3jhJNh.js +0 -1
  597. package/dist/app/assets/vim-CwgyIdo-.js +0 -1
  598. package/dist/app/assets/visual-basic-BWQC7pBF.js +0 -1
  599. package/dist/app/assets/warpscript-CVp7w3zz.js +0 -1
  600. package/dist/app/assets/wasm-yPowz3sM.js +0 -1
  601. package/dist/app/assets/web-idl-BkghLEob.js +0 -1
  602. package/dist/app/assets/wiki-TBH4TnLK.js +0 -1
  603. package/dist/app/assets/wolfram-BmgF1AlB.js +0 -1
  604. package/dist/app/assets/wren-CJ8nrMy_.js +0 -1
  605. package/dist/app/assets/xeora-N6_5XQpC.js +0 -1
  606. package/dist/app/assets/xml-doc-GBGxTNFc.js +0 -1
  607. package/dist/app/assets/xojo-CmpAfzYO.js +0 -1
  608. package/dist/app/assets/xquery-BA22D3yp.js +0 -1
  609. package/dist/app/assets/yaml-CDGmAMpu.js +0 -1
  610. package/dist/app/assets/yang-rFKIXOjI.js +0 -1
  611. package/dist/app/assets/zig-rH4Tzjve.js +0 -1
package/dist/index.cjs CHANGED
@@ -66,8 +66,8 @@ __export(index_exports, {
66
66
  module.exports = __toCommonJS(index_exports);
67
67
 
68
68
  // src/components/chat.tsx
69
- var React21 = __toESM(require("react"), 1);
70
- var import_lucide_react10 = require("lucide-react");
69
+ var React22 = __toESM(require("react"), 1);
70
+ var import_lucide_react11 = require("lucide-react");
71
71
 
72
72
  // src/lib/utils.ts
73
73
  var import_clsx = require("clsx");
@@ -283,6 +283,9 @@ function isObjectLike(value) {
283
283
  function isNonEmptyString(value) {
284
284
  return typeof value === "string" && value.trim().length > 0;
285
285
  }
286
+ function isOptionalString(value) {
287
+ return value === void 0 || typeof value === "string";
288
+ }
286
289
  function toOptionalString(value) {
287
290
  return isNonEmptyString(value) ? value.trim() : void 0;
288
291
  }
@@ -295,42 +298,90 @@ function toLineNumber(value) {
295
298
  }
296
299
  return null;
297
300
  }
298
- function normalizeCodeReference(candidate) {
299
- const path = toOptionalString(candidate.path);
300
- const text = toReferenceText(candidate.text);
301
- const startLine = toLineNumber(candidate.startLine);
302
- const endLine = toLineNumber(candidate.endLine);
303
- if (!path || !text || startLine === null || endLine === null) {
304
- return null;
301
+ function isOptionalNumber(value) {
302
+ return value === void 0 || Number.isFinite(value);
303
+ }
304
+ function toOptionalNumber(value, options) {
305
+ const allowZero = options?.allowZero ?? false;
306
+ if (!Number.isFinite(value)) {
307
+ return void 0;
308
+ }
309
+ const numberValue = value;
310
+ if (numberValue > 0 || allowZero && numberValue === 0) {
311
+ return numberValue;
305
312
  }
313
+ return void 0;
314
+ }
315
+ function hasImageReferenceLocator(candidate) {
316
+ return isNonEmptyString(candidate.fileId) || isNonEmptyString(candidate.url) || isNonEmptyString(candidate.name) || isNonEmptyString(candidate.label) || isNonEmptyString(candidate.text);
317
+ }
318
+ function isCodeReferenceCandidate(value) {
319
+ if (!isObjectLike(value)) {
320
+ return false;
321
+ }
322
+ const candidate = value;
323
+ return isNonEmptyString(candidate.path) && toLineNumber(candidate.startLine) !== null && toLineNumber(candidate.endLine) !== null && toReferenceText(candidate.text) !== null && isOptionalString(candidate.id) && isOptionalString(candidate.label) && isOptionalString(candidate.language) && isOptionalString(candidate.taskId);
324
+ }
325
+ function isQuoteReferenceCandidate(value) {
326
+ if (!isObjectLike(value)) {
327
+ return false;
328
+ }
329
+ const candidate = value;
330
+ return candidate.type === "quote" && toReferenceText(candidate.text) !== null && isOptionalString(candidate.id) && isOptionalString(candidate.label) && isOptionalString(candidate.messageId) && isOptionalString(candidate.source);
331
+ }
332
+ function isImageReferenceCandidate(value) {
333
+ if (!isObjectLike(value)) {
334
+ return false;
335
+ }
336
+ const candidate = value;
337
+ return candidate.type === "image" && isOptionalString(candidate.id) && isOptionalString(candidate.label) && isOptionalString(candidate.text) && isOptionalString(candidate.fileId) && isOptionalString(candidate.url) && isOptionalString(candidate.mimeType) && isOptionalString(candidate.name) && isOptionalNumber(candidate.size) && isOptionalNumber(candidate.width) && isOptionalNumber(candidate.height) && hasImageReferenceLocator(candidate);
338
+ }
339
+ function toCodeReference(candidate) {
306
340
  return {
307
341
  type: "code",
308
342
  ...toOptionalString(candidate.id) ? { id: toOptionalString(candidate.id) } : {},
309
343
  ...toOptionalString(candidate.label) ? { label: toOptionalString(candidate.label) } : {},
310
- path,
311
- startLine,
312
- endLine,
313
- text,
344
+ path: candidate.path.trim(),
345
+ startLine: candidate.startLine,
346
+ endLine: candidate.endLine,
347
+ text: candidate.text,
314
348
  ...toOptionalString(candidate.language) ? { language: toOptionalString(candidate.language) } : {},
315
349
  ...toOptionalString(candidate.taskId) ? { taskId: toOptionalString(candidate.taskId) } : {}
316
350
  };
317
351
  }
318
- function normalizeQuoteReference(candidate) {
319
- const text = toReferenceText(candidate.text);
320
- if (!text) {
321
- return null;
322
- }
352
+ function toQuoteReference(candidate) {
323
353
  return {
324
354
  type: "quote",
325
355
  ...toOptionalString(candidate.id) ? { id: toOptionalString(candidate.id) } : {},
326
356
  ...toOptionalString(candidate.label) ? { label: toOptionalString(candidate.label) } : {},
327
- text,
357
+ text: candidate.text,
328
358
  ...toOptionalString(candidate.messageId) ? { messageId: toOptionalString(candidate.messageId) } : {},
329
359
  ...toOptionalString(candidate.source) ? { source: toOptionalString(candidate.source) } : {}
330
360
  };
331
361
  }
362
+ function toImageReference(candidate) {
363
+ const fileId = toOptionalString(candidate.fileId);
364
+ const url = toOptionalString(candidate.url);
365
+ const name = toOptionalString(candidate.name);
366
+ const label = toOptionalString(candidate.label);
367
+ const rawText = toReferenceText(candidate.text);
368
+ const text = rawText ?? name ?? label ?? "Pasted image";
369
+ return {
370
+ type: "image",
371
+ ...toOptionalString(candidate.id) ? { id: toOptionalString(candidate.id) } : {},
372
+ ...label ? { label } : {},
373
+ text,
374
+ ...fileId ? { fileId } : {},
375
+ ...url ? { url } : {},
376
+ ...toOptionalString(candidate.mimeType) ? { mimeType: toOptionalString(candidate.mimeType) } : {},
377
+ ...name ? { name } : {},
378
+ ...toOptionalNumber(candidate.size, { allowZero: true }) !== void 0 ? { size: toOptionalNumber(candidate.size, { allowZero: true }) } : {},
379
+ ...toOptionalNumber(candidate.width) !== void 0 ? { width: toOptionalNumber(candidate.width) } : {},
380
+ ...toOptionalNumber(candidate.height) !== void 0 ? { height: toOptionalNumber(candidate.height) } : {}
381
+ };
382
+ }
332
383
  function isLegacyCodeReference(candidate) {
333
- return isNonEmptyString(candidate.path) && toLineNumber(candidate.startLine) !== null && toLineNumber(candidate.endLine) !== null && toReferenceText(candidate.text) !== null;
384
+ return candidate.type === void 0 && isNonEmptyString(candidate.path) && toLineNumber(candidate.startLine) !== null && toLineNumber(candidate.endLine) !== null && toReferenceText(candidate.text) !== null;
334
385
  }
335
386
  function normalizeReference(value) {
336
387
  if (!isObjectLike(value)) {
@@ -338,14 +389,17 @@ function normalizeReference(value) {
338
389
  }
339
390
  const candidate = value;
340
391
  const type = toOptionalString(candidate.type);
341
- if (type === "code") {
342
- return normalizeCodeReference(candidate);
392
+ if (type === "code" && isCodeReferenceCandidate(candidate)) {
393
+ return toCodeReference(candidate);
394
+ }
395
+ if (isQuoteReferenceCandidate(candidate)) {
396
+ return toQuoteReference(candidate);
343
397
  }
344
- if (type === "quote") {
345
- return normalizeQuoteReference(candidate);
398
+ if (isImageReferenceCandidate(candidate)) {
399
+ return toImageReference(candidate);
346
400
  }
347
401
  if (type === void 0 && isLegacyCodeReference(candidate)) {
348
- return normalizeCodeReference(candidate);
402
+ return toCodeReference(candidate);
349
403
  }
350
404
  return null;
351
405
  }
@@ -368,7 +422,32 @@ function getQuoteExcerpt(reference) {
368
422
  function getCodeReferenceLocation(reference) {
369
423
  return `${reference.path}:${getCodeReferenceRange(reference)}`;
370
424
  }
425
+ function formatReferenceSize(size2) {
426
+ if (size2 < 1024) {
427
+ return `${size2} B`;
428
+ }
429
+ if (size2 < 1024 * 1024) {
430
+ return `${(size2 / 1024).toFixed(size2 < 10 * 1024 ? 1 : 0)} KB`;
431
+ }
432
+ return `${(size2 / (1024 * 1024)).toFixed(size2 < 10 * 1024 * 1024 ? 1 : 0)} MB`;
433
+ }
434
+ function getImageReferenceDimensions(reference) {
435
+ if (!reference.width || !reference.height) {
436
+ return null;
437
+ }
438
+ return `${reference.width}x${reference.height}`;
439
+ }
440
+ function getImageReferenceMetaParts(reference) {
441
+ return [
442
+ reference.mimeType?.trim() || null,
443
+ getImageReferenceDimensions(reference),
444
+ typeof reference.size === "number" ? formatReferenceSize(reference.size) : null
445
+ ].filter((part) => Boolean(part));
446
+ }
371
447
  function getReferenceKey(reference) {
448
+ if (reference.type === "image" && reference.fileId?.trim()) {
449
+ return `image:${reference.fileId.trim()}`;
450
+ }
372
451
  if (reference.id && reference.id.trim()) {
373
452
  return reference.id.trim();
374
453
  }
@@ -381,6 +460,18 @@ function getReferenceKey(reference) {
381
460
  reference.text
382
461
  ].join(":");
383
462
  }
463
+ if (reference.type === "image") {
464
+ return [
465
+ reference.type,
466
+ reference.url ?? "",
467
+ reference.name ?? "",
468
+ reference.mimeType ?? "",
469
+ reference.size ?? "",
470
+ reference.width ?? "",
471
+ reference.height ?? "",
472
+ reference.text
473
+ ].join(":");
474
+ }
384
475
  return [
385
476
  reference.type,
386
477
  reference.messageId ?? "",
@@ -410,6 +501,9 @@ function getReferenceLabel(reference) {
410
501
  const fileName = segments[segments.length - 1] || reference.path;
411
502
  return `${fileName} ${getCodeReferenceRange(reference)}`;
412
503
  }
504
+ if (reference.type === "image") {
505
+ return reference.name?.trim() || "Pasted image";
506
+ }
413
507
  if (reference.source && reference.source.trim()) {
414
508
  return reference.source.trim();
415
509
  }
@@ -419,6 +513,10 @@ function getReferenceMetaLine(reference) {
419
513
  if (reference.type === "code") {
420
514
  return getCodeReferenceLocation(reference);
421
515
  }
516
+ if (reference.type === "image") {
517
+ const parts = getImageReferenceMetaParts(reference);
518
+ return parts.length ? parts.join(" \u2022 ") : null;
519
+ }
422
520
  if (reference.source && reference.source.trim()) {
423
521
  return getQuoteExcerpt(reference);
424
522
  }
@@ -433,6 +531,21 @@ function getReferenceTitle(reference) {
433
531
 
434
532
  ${reference.text}`;
435
533
  }
534
+ if (reference.type === "image") {
535
+ const titleLines = [getReferenceLabel(reference)];
536
+ const metaLine = getReferenceMetaLine(reference);
537
+ const url = reference.url?.trim() && !reference.url.trim().startsWith("data:") ? reference.url.trim() : null;
538
+ if (metaLine) {
539
+ titleLines.push(metaLine);
540
+ }
541
+ if (url) {
542
+ titleLines.push(url);
543
+ }
544
+ if (reference.text.trim() && reference.text.trim() !== getReferenceLabel(reference)) {
545
+ titleLines.push("", reference.text.trim());
546
+ }
547
+ return titleLines.join("\n");
548
+ }
436
549
  const header = reference.label?.trim() || reference.source?.trim() || "Quoted text";
437
550
  return `${header}
438
551
 
@@ -837,6 +950,17 @@ function resolveUsedContextSize(options) {
837
950
  return normalizeContextUsageNumber(options.fallbackUsedTokens) ?? 0;
838
951
  }
839
952
 
953
+ // src/lib/follow-ups.ts
954
+ function getComposerFollowUpShortcutLabels(queueShortcutLabel) {
955
+ return {
956
+ steer: "Enter",
957
+ queue: queueShortcutLabel
958
+ };
959
+ }
960
+ function getBusyComposerShortcutFollowUpMode(useQueueShortcut) {
961
+ return useQueueShortcut ? "queue" : "steer";
962
+ }
963
+
840
964
  // src/providers/Stream.tsx
841
965
  var import_jsx_runtime2 = require("react/jsx-runtime");
842
966
  var import_meta = {};
@@ -1029,7 +1153,16 @@ var en_US_default = {
1029
1153
  close: "Close"
1030
1154
  },
1031
1155
  markdown: {
1032
- copy: "Copy"
1156
+ copy: "Copy",
1157
+ mermaid: {
1158
+ title: "Mermaid",
1159
+ diagram: "Diagram",
1160
+ code: "Code",
1161
+ download: "Download SVG",
1162
+ fullScreen: "Open full screen",
1163
+ rendering: "Rendering diagram",
1164
+ failed: "Failed to render diagram"
1165
+ }
1033
1166
  },
1034
1167
  thread: {
1035
1168
  errorToast: "An error occurred. Please try again.",
@@ -1075,7 +1208,7 @@ var zh_CN_default = {
1075
1208
  pending: "\u5F85\u5904\u7406 Follow-up",
1076
1209
  queue: "\u6392\u961F",
1077
1210
  steer: "\u5F15\u5BFC",
1078
- steerAction: "Steer",
1211
+ steerAction: "\u5F15\u5BFC",
1079
1212
  promoteToSteer: "\u8F6C\u4E3A\u5F15\u5BFC",
1080
1213
  sendNow: "\u7ACB\u5373\u53D1\u9001",
1081
1214
  remove: "\u79FB\u9664\u6B64\u5F85\u5904\u7406 Follow-up",
@@ -1124,7 +1257,16 @@ var zh_CN_default = {
1124
1257
  close: "\u5173\u95ED"
1125
1258
  },
1126
1259
  markdown: {
1127
- copy: "\u590D\u5236"
1260
+ copy: "\u590D\u5236",
1261
+ mermaid: {
1262
+ title: "Mermaid",
1263
+ diagram: "\u56FE\u8868",
1264
+ code: "\u4EE3\u7801",
1265
+ download: "\u4E0B\u8F7D SVG",
1266
+ fullScreen: "\u5168\u5C4F\u67E5\u770B",
1267
+ rendering: "\u6B63\u5728\u6E32\u67D3\u56FE\u8868",
1268
+ failed: "\u56FE\u8868\u6E32\u67D3\u5931\u8D25"
1269
+ }
1128
1270
  },
1129
1271
  thread: {
1130
1272
  errorToast: "\u53D1\u751F\u9519\u8BEF\uFF0C\u8BF7\u91CD\u8BD5\u3002",
@@ -1657,19 +1799,86 @@ function ComposerMenu({
1657
1799
 
1658
1800
  // src/components/composer/SendButton.tsx
1659
1801
  var import_lucide_react2 = require("lucide-react");
1802
+
1803
+ // src/components/ui/tooltip.tsx
1804
+ var React6 = require("react");
1805
+ var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
1660
1806
  var import_jsx_runtime7 = require("react/jsx-runtime");
1807
+ function TooltipProvider({
1808
+ delayDuration = 0,
1809
+ ...props
1810
+ }) {
1811
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1812
+ TooltipPrimitive.Provider,
1813
+ {
1814
+ "data-slot": "tooltip-provider",
1815
+ delayDuration,
1816
+ ...props
1817
+ }
1818
+ );
1819
+ }
1820
+ function Tooltip({
1821
+ ...props
1822
+ }) {
1823
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1824
+ TooltipPrimitive.Root,
1825
+ {
1826
+ "data-slot": "tooltip",
1827
+ ...props
1828
+ }
1829
+ ) });
1830
+ }
1831
+ function TooltipTrigger({
1832
+ ...props
1833
+ }) {
1834
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1835
+ TooltipPrimitive.Trigger,
1836
+ {
1837
+ "data-slot": "tooltip-trigger",
1838
+ ...props
1839
+ }
1840
+ );
1841
+ }
1842
+ function TooltipContent({
1843
+ className,
1844
+ sideOffset = 0,
1845
+ hideArrow = false,
1846
+ children,
1847
+ ...props
1848
+ }) {
1849
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
1850
+ TooltipPrimitive.Content,
1851
+ {
1852
+ "data-slot": "tooltip-content",
1853
+ sideOffset,
1854
+ className: cn(
1855
+ "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-md px-3 py-1.5 text-xs text-balance",
1856
+ className
1857
+ ),
1858
+ ...props,
1859
+ children: [
1860
+ children,
1861
+ !hideArrow ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" }) : null
1862
+ ]
1863
+ }
1864
+ ) });
1865
+ }
1866
+
1867
+ // src/components/composer/SendButton.tsx
1868
+ var import_jsx_runtime8 = require("react/jsx-runtime");
1661
1869
  function SendButton({
1662
1870
  disabled = false,
1663
1871
  isLoading = false,
1664
1872
  showStop = isLoading,
1665
1873
  onStop,
1666
1874
  stopLabel = "Stop",
1667
- sendLabel = "Send"
1875
+ sendLabel = "Send",
1876
+ shortcuts
1668
1877
  }) {
1669
1878
  const { theme } = useTheme();
1670
1879
  const roundedClass = getRoundedClass(theme.radius);
1671
1880
  if (showStop) {
1672
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1881
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1673
1882
  "button",
1674
1883
  {
1675
1884
  type: "button",
@@ -1682,11 +1891,11 @@ function SendButton({
1682
1891
  "hover:scale-105 active:scale-95"
1683
1892
  ),
1684
1893
  "aria-label": stopLabel,
1685
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.Square, { size: 14, fill: "currentColor", stroke: "currentColor", strokeWidth: 0 })
1894
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Square, { size: 14, fill: "currentColor", stroke: "currentColor", strokeWidth: 0 })
1686
1895
  }
1687
1896
  );
1688
1897
  }
1689
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1898
+ const button = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1690
1899
  "button",
1691
1900
  {
1692
1901
  type: "submit",
@@ -1700,34 +1909,63 @@ function SendButton({
1700
1909
  "disabled:opacity-40 disabled:cursor-not-allowed disabled:hover:scale-100"
1701
1910
  ),
1702
1911
  "aria-label": sendLabel,
1703
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.ArrowUp, { size: 18, strokeWidth: 2.5 })
1912
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.ArrowUp, { size: 18, strokeWidth: 2.5 })
1704
1913
  }
1705
1914
  );
1915
+ if (!shortcuts?.length || disabled) {
1916
+ return button;
1917
+ }
1918
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Tooltip, { children: [
1919
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipTrigger, { asChild: true, children: button }),
1920
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1921
+ TooltipContent,
1922
+ {
1923
+ side: "top",
1924
+ sideOffset: 10,
1925
+ hideArrow: true,
1926
+ className: cn(
1927
+ "min-w-36 border border-border/70 bg-background px-3 py-2 text-foreground shadow-lg",
1928
+ roundedClass
1929
+ ),
1930
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "space-y-1", children: shortcuts.map((shortcut) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1931
+ "div",
1932
+ {
1933
+ className: "flex items-center justify-between gap-4 text-sm",
1934
+ children: [
1935
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "font-medium", children: shortcut.label }),
1936
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("kbd", { className: "inline-flex min-w-16 items-center justify-center rounded-full bg-muted px-2.5 py-0.5 text-xs font-medium text-muted-foreground", children: shortcut.keys })
1937
+ ]
1938
+ },
1939
+ `${shortcut.label}-${shortcut.keys}`
1940
+ )) })
1941
+ }
1942
+ )
1943
+ ] });
1706
1944
  }
1707
1945
 
1708
1946
  // src/components/history/HistorySidebar.tsx
1709
- var React8 = __toESM(require("react"), 1);
1947
+ var React9 = __toESM(require("react"), 1);
1710
1948
  var import_lucide_react4 = require("lucide-react");
1711
1949
 
1712
1950
  // src/components/ui/scroll-area.tsx
1713
- var React6 = __toESM(require("react"), 1);
1951
+ var React7 = __toESM(require("react"), 1);
1714
1952
  var ScrollAreaPrimitive = __toESM(require("@radix-ui/react-scroll-area"), 1);
1715
- var import_jsx_runtime8 = require("react/jsx-runtime");
1716
- var ScrollArea = React6.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
1953
+ var import_jsx_runtime9 = require("react/jsx-runtime");
1954
+ var ScrollArea = React7.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
1717
1955
  ScrollAreaPrimitive.Root,
1718
1956
  {
1719
1957
  ref,
1720
1958
  className: cn("relative overflow-hidden", className),
1721
1959
  ...props,
1722
1960
  children: [
1723
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
1724
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ScrollBar, {}),
1725
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ScrollAreaPrimitive.Corner, {})
1961
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ScrollAreaPrimitive.Viewport, { className: "h-full w-full rounded-[inherit]", children }),
1962
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ScrollBar, {}),
1963
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ScrollAreaPrimitive.Corner, {})
1726
1964
  ]
1727
1965
  }
1728
1966
  ));
1729
1967
  ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName;
1730
- var ScrollBar = React6.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1968
+ var ScrollBar = React7.forwardRef(({ className, orientation = "vertical", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
1731
1969
  ScrollAreaPrimitive.ScrollAreaScrollbar,
1732
1970
  {
1733
1971
  ref,
@@ -1739,30 +1977,30 @@ var ScrollBar = React6.forwardRef(({ className, orientation = "vertical", ...pro
1739
1977
  className
1740
1978
  ),
1741
1979
  ...props,
1742
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
1980
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
1743
1981
  }
1744
1982
  ));
1745
1983
  ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
1746
1984
 
1747
1985
  // src/components/ui/sheet.tsx
1748
- var React7 = require("react");
1986
+ var React8 = require("react");
1749
1987
  var import_lucide_react3 = require("lucide-react");
1750
1988
  var SheetPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
1751
- var import_jsx_runtime9 = require("react/jsx-runtime");
1989
+ var import_jsx_runtime10 = require("react/jsx-runtime");
1752
1990
  function Sheet({ ...props }) {
1753
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SheetPrimitive.Root, { ...props });
1991
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SheetPrimitive.Root, { ...props });
1754
1992
  }
1755
1993
  function SheetTrigger({ ...props }) {
1756
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SheetPrimitive.Trigger, { ...props });
1994
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SheetPrimitive.Trigger, { ...props });
1757
1995
  }
1758
1996
  function SheetPortal({ ...props }) {
1759
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SheetPrimitive.Portal, { ...props });
1997
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SheetPrimitive.Portal, { ...props });
1760
1998
  }
1761
1999
  function SheetOverlay({
1762
2000
  className,
1763
2001
  ...props
1764
2002
  }) {
1765
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2003
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1766
2004
  SheetPrimitive.Overlay,
1767
2005
  {
1768
2006
  className: cn(
@@ -1786,9 +2024,9 @@ function SheetContent({
1786
2024
  left: "inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",
1787
2025
  right: "inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"
1788
2026
  };
1789
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(SheetPortal, { children: [
1790
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SheetOverlay, {}),
1791
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
2027
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(SheetPortal, { children: [
2028
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SheetOverlay, {}),
2029
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
1792
2030
  SheetPrimitive.Content,
1793
2031
  {
1794
2032
  className: cn(
@@ -1799,9 +2037,9 @@ function SheetContent({
1799
2037
  ...props,
1800
2038
  children: [
1801
2039
  children,
1802
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
1803
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react3.X, { size: 16 }),
1804
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "sr-only", children: t("sheet.close") })
2040
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
2041
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react3.X, { size: 16 }),
2042
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only", children: t("sheet.close") })
1805
2043
  ] })
1806
2044
  ]
1807
2045
  }
@@ -1812,7 +2050,7 @@ function SheetHeader({
1812
2050
  className,
1813
2051
  ...props
1814
2052
  }) {
1815
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2053
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1816
2054
  "div",
1817
2055
  {
1818
2056
  className: cn(
@@ -1827,7 +2065,7 @@ function SheetTitle({
1827
2065
  className,
1828
2066
  ...props
1829
2067
  }) {
1830
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2068
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1831
2069
  SheetPrimitive.Title,
1832
2070
  {
1833
2071
  className: cn("text-lg font-semibold text-foreground", className),
@@ -1837,7 +2075,7 @@ function SheetTitle({
1837
2075
  }
1838
2076
 
1839
2077
  // src/components/history/HistorySidebar.tsx
1840
- var import_jsx_runtime10 = require("react/jsx-runtime");
2078
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1841
2079
  function HistorySidebar({
1842
2080
  threads = [],
1843
2081
  currentThreadId,
@@ -1848,7 +2086,7 @@ function HistorySidebar({
1848
2086
  disabled = false
1849
2087
  }) {
1850
2088
  const { t } = useChatkitTranslation();
1851
- const [open, setOpen] = React8.useState(false);
2089
+ const [open, setOpen] = React9.useState(false);
1852
2090
  const handleNewThread = () => {
1853
2091
  onNewThread?.();
1854
2092
  setOpen(false);
@@ -1857,8 +2095,8 @@ function HistorySidebar({
1857
2095
  onSelectThread?.(id);
1858
2096
  setOpen(false);
1859
2097
  };
1860
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Sheet, { open, onOpenChange: setOpen, children: [
1861
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SheetTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2098
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(Sheet, { open, onOpenChange: setOpen, children: [
2099
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SheetTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1862
2100
  Button,
1863
2101
  {
1864
2102
  variant: "ghost",
@@ -1866,26 +2104,26 @@ function HistorySidebar({
1866
2104
  disabled,
1867
2105
  className: "h-8 w-8 cursor-pointer",
1868
2106
  children: [
1869
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.History, { size: 16 }),
1870
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "sr-only", children: t("history.threadHistory") })
2107
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.History, { size: 16 }),
2108
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: t("history.threadHistory") })
1871
2109
  ]
1872
2110
  }
1873
2111
  ) }),
1874
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(SheetContent, { side: "right", className: "w-80 p-0", children: [
1875
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SheetHeader, { className: "border-b p-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SheetTitle, { children: t("history.title") }) }),
1876
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2112
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(SheetContent, { side: "right", className: "w-80 p-0", children: [
2113
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SheetHeader, { className: "border-b p-4", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SheetTitle, { children: t("history.title") }) }),
2114
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1877
2115
  Button,
1878
2116
  {
1879
2117
  onClick: handleNewThread,
1880
2118
  className: "w-full justify-start gap-2",
1881
2119
  variant: "secondary",
1882
2120
  children: [
1883
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.PlusCircle, { size: 16 }),
2121
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.PlusCircle, { size: 16 }),
1884
2122
  t("history.newThread")
1885
2123
  ]
1886
2124
  }
1887
2125
  ) }),
1888
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ScrollArea, { className: "h-[calc(100vh-140px)]", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "px-4 pb-4", children: threads.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "py-8 text-center text-sm text-muted-foreground", children: t("history.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "space-y-1", children: threads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
2126
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ScrollArea, { className: "h-[calc(100vh-140px)]", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "px-4 pb-4", children: threads.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "py-8 text-center text-sm text-muted-foreground", children: t("history.empty") }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "space-y-1", children: threads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1889
2127
  "div",
1890
2128
  {
1891
2129
  className: cn(
@@ -1895,9 +2133,9 @@ function HistorySidebar({
1895
2133
  ),
1896
2134
  onClick: () => handleSelectThread(thread.id),
1897
2135
  children: [
1898
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.MessageSquare, { size: 16 }) }),
1899
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "flex-1 truncate", children: thread.title }),
1900
- showDelete && onDeleteThread && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2136
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.MessageSquare, { size: 16 }) }),
2137
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "flex-1 truncate", children: thread.title }),
2138
+ showDelete && onDeleteThread && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1901
2139
  "button",
1902
2140
  {
1903
2141
  type: "button",
@@ -1906,7 +2144,7 @@ function HistorySidebar({
1906
2144
  onDeleteThread(thread.id);
1907
2145
  },
1908
2146
  className: "opacity-0 group-hover:opacity-100 p-1 rounded hover:bg-destructive/10 hover:text-destructive transition-all",
1909
- children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_lucide_react4.Trash2, { size: 14 })
2147
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react4.Trash2, { size: 14 })
1910
2148
  }
1911
2149
  )
1912
2150
  ]
@@ -1920,71 +2158,6 @@ function HistorySidebar({
1920
2158
  // src/components/composer/pending-follow-ups.tsx
1921
2159
  var React10 = __toESM(require("react"), 1);
1922
2160
  var import_lucide_react5 = require("lucide-react");
1923
-
1924
- // src/components/ui/tooltip.tsx
1925
- var React9 = require("react");
1926
- var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
1927
- var import_jsx_runtime11 = require("react/jsx-runtime");
1928
- function TooltipProvider({
1929
- delayDuration = 0,
1930
- ...props
1931
- }) {
1932
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1933
- TooltipPrimitive.Provider,
1934
- {
1935
- "data-slot": "tooltip-provider",
1936
- delayDuration,
1937
- ...props
1938
- }
1939
- );
1940
- }
1941
- function Tooltip({
1942
- ...props
1943
- }) {
1944
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1945
- TooltipPrimitive.Root,
1946
- {
1947
- "data-slot": "tooltip",
1948
- ...props
1949
- }
1950
- ) });
1951
- }
1952
- function TooltipTrigger({
1953
- ...props
1954
- }) {
1955
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1956
- TooltipPrimitive.Trigger,
1957
- {
1958
- "data-slot": "tooltip-trigger",
1959
- ...props
1960
- }
1961
- );
1962
- }
1963
- function TooltipContent({
1964
- className,
1965
- sideOffset = 0,
1966
- children,
1967
- ...props
1968
- }) {
1969
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1970
- TooltipPrimitive.Content,
1971
- {
1972
- "data-slot": "tooltip-content",
1973
- sideOffset,
1974
- className: cn(
1975
- "bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit rounded-md px-3 py-1.5 text-xs text-balance",
1976
- className
1977
- ),
1978
- ...props,
1979
- children: [
1980
- children,
1981
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
1982
- ]
1983
- }
1984
- ) });
1985
- }
1986
-
1987
- // src/components/composer/pending-follow-ups.tsx
1988
2161
  var import_jsx_runtime12 = require("react/jsx-runtime");
1989
2162
  function getPendingFollowUpText(item, referencedContentFallback) {
1990
2163
  const text = item.request?.input?.input?.trim() ?? "";
@@ -2279,8 +2452,8 @@ function PendingFollowUps({
2279
2452
  }
2280
2453
 
2281
2454
  // src/components/thread/messages/ai.tsx
2282
- var React14 = __toESM(require("react"), 1);
2283
- var import_lucide_react7 = require("lucide-react");
2455
+ var React15 = __toESM(require("react"), 1);
2456
+ var import_lucide_react8 = require("lucide-react");
2284
2457
 
2285
2458
  // src/components/ui/badge.tsx
2286
2459
  var React11 = __toESM(require("react"), 1);
@@ -2358,7 +2531,7 @@ var TabsList = React13.forwardRef(
2358
2531
  {
2359
2532
  ref,
2360
2533
  className: cn(
2361
- "inline-flex h-11 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
2534
+ "inline-flex items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
2362
2535
  className
2363
2536
  ),
2364
2537
  role: "tablist",
@@ -2383,7 +2556,7 @@ var TabsTrigger = React13.forwardRef(
2383
2556
  "aria-selected": isActive,
2384
2557
  "data-state": isActive ? "active" : "inactive",
2385
2558
  className: cn(
2386
- "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-2 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
2559
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ring-offset-background disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
2387
2560
  className
2388
2561
  ),
2389
2562
  onClick: (event) => {
@@ -2425,7 +2598,7 @@ var import_remark_gfm = __toESM(require("remark-gfm"), 1);
2425
2598
  var import_rehype_katex = __toESM(require("rehype-katex"), 1);
2426
2599
  var import_remark_math = __toESM(require("remark-math"), 1);
2427
2600
  var import_react6 = require("react");
2428
- var import_lucide_react6 = require("lucide-react");
2601
+ var import_lucide_react7 = require("lucide-react");
2429
2602
 
2430
2603
  // src/components/thread/syntax-highlighter.tsx
2431
2604
  var import_react_syntax_highlighter = require("react-syntax-highlighter");
@@ -2461,6 +2634,12 @@ var SyntaxHighlighter = ({
2461
2634
  );
2462
2635
  };
2463
2636
 
2637
+ // src/components/thread/mermaid-block.tsx
2638
+ var Dialog = __toESM(require("@radix-ui/react-dialog"), 1);
2639
+ var import_mermaid = __toESM(require("mermaid"), 1);
2640
+ var import_lucide_react6 = require("lucide-react");
2641
+ var React14 = __toESM(require("react"), 1);
2642
+
2464
2643
  // src/components/thread/tooltip-icon-button.tsx
2465
2644
  var import_react5 = require("react");
2466
2645
  var import_jsx_runtime17 = require("react/jsx-runtime");
@@ -2485,15 +2664,506 @@ var TooltipIconButton = (0, import_react5.forwardRef)(({ children, tooltip, side
2485
2664
  });
2486
2665
  TooltipIconButton.displayName = "TooltipIconButton";
2487
2666
 
2667
+ // src/components/thread/mermaid-block.tsx
2668
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2669
+ var HEX_COLOR_PATTERN = /^#([\da-f]{3,8})$/i;
2670
+ var MERMAID_DIRECTIVE_PATTERN = /%{2}{\s*(?:(\w+)\s*:|(\w+))\s*(?:(\w+)|((?:(?!}%{2}).|\r?\n)*))?\s*(?:}%{2})?/gi;
2671
+ var MERMAID_FRONTMATTER_PATTERN = /^-{3}\s*[\n\r](.*?)[\n\r]-{3}\s*[\n\r]+/s;
2672
+ var OKLCH_COLOR_PATTERN = /^oklch\((.+)\)$/i;
2673
+ var RGB_COLOR_PATTERN = /^rgba?\((.+)\)$/i;
2674
+ var MERMAID_SECURE_KEYS = [
2675
+ "fontFamily",
2676
+ "maxEdges",
2677
+ "maxTextSize",
2678
+ "securityLevel",
2679
+ "secure",
2680
+ "startOnLoad",
2681
+ "suppressErrorRendering",
2682
+ "theme",
2683
+ "themeVariables"
2684
+ ];
2685
+ function clamp(value, min, max) {
2686
+ return Math.min(max, Math.max(min, value));
2687
+ }
2688
+ function normalizeMermaidCode(code) {
2689
+ return code.replace(MERMAID_FRONTMATTER_PATTERN, "").replace(MERMAID_DIRECTIVE_PATTERN, "").trim();
2690
+ }
2691
+ function parseAlpha(value) {
2692
+ if (!value) return 1;
2693
+ const normalized = value.trim();
2694
+ if (!normalized) return 1;
2695
+ if (normalized.endsWith("%")) {
2696
+ return clamp(Number.parseFloat(normalized) / 100, 0, 1);
2697
+ }
2698
+ return clamp(Number.parseFloat(normalized), 0, 1);
2699
+ }
2700
+ function parseHexColor(value) {
2701
+ const match = value.trim().match(HEX_COLOR_PATTERN);
2702
+ if (!match) return null;
2703
+ const hex = match[1];
2704
+ if (hex.length === 3 || hex.length === 4) {
2705
+ const [r, g, b, a = "f"] = hex.split("");
2706
+ return {
2707
+ r: Number.parseInt(r + r, 16),
2708
+ g: Number.parseInt(g + g, 16),
2709
+ b: Number.parseInt(b + b, 16),
2710
+ a: Number.parseInt(a + a, 16) / 255
2711
+ };
2712
+ }
2713
+ if (hex.length === 6 || hex.length === 8) {
2714
+ const alphaHex = hex.length === 8 ? hex.slice(6, 8) : "ff";
2715
+ return {
2716
+ r: Number.parseInt(hex.slice(0, 2), 16),
2717
+ g: Number.parseInt(hex.slice(2, 4), 16),
2718
+ b: Number.parseInt(hex.slice(4, 6), 16),
2719
+ a: Number.parseInt(alphaHex, 16) / 255
2720
+ };
2721
+ }
2722
+ return null;
2723
+ }
2724
+ function parseRgbChannel(value) {
2725
+ const normalized = value.trim();
2726
+ if (normalized.endsWith("%")) {
2727
+ return clamp(Math.round(Number.parseFloat(normalized) / 100 * 255), 0, 255);
2728
+ }
2729
+ return clamp(Math.round(Number.parseFloat(normalized)), 0, 255);
2730
+ }
2731
+ function parseRgbColor(value) {
2732
+ const match = value.trim().match(RGB_COLOR_PATTERN);
2733
+ if (!match) return null;
2734
+ const parts = match[1].split(/[,\s/]+/).map((part) => part.trim()).filter(Boolean);
2735
+ if (parts.length < 3) return null;
2736
+ return {
2737
+ r: parseRgbChannel(parts[0]),
2738
+ g: parseRgbChannel(parts[1]),
2739
+ b: parseRgbChannel(parts[2]),
2740
+ a: parseAlpha(parts[3])
2741
+ };
2742
+ }
2743
+ function parseOklchLightness(value) {
2744
+ const normalized = value.trim();
2745
+ if (normalized.endsWith("%")) {
2746
+ return clamp(Number.parseFloat(normalized) / 100, 0, 1);
2747
+ }
2748
+ return clamp(Number.parseFloat(normalized), 0, 1);
2749
+ }
2750
+ function parseHue(value) {
2751
+ const normalized = value.trim().toLowerCase();
2752
+ const numeric = Number.parseFloat(normalized);
2753
+ if (Number.isNaN(numeric)) return 0;
2754
+ if (normalized.endsWith("turn")) return numeric * 360;
2755
+ if (normalized.endsWith("rad")) return numeric * (180 / Math.PI);
2756
+ if (normalized.endsWith("grad")) return numeric * 0.9;
2757
+ return numeric;
2758
+ }
2759
+ function linearToSrgb(linear) {
2760
+ if (linear <= 31308e-7) {
2761
+ return 12.92 * linear;
2762
+ }
2763
+ return 1.055 * Math.pow(linear, 1 / 2.4) - 0.055;
2764
+ }
2765
+ function parseOklchColor(value) {
2766
+ const match = value.trim().match(OKLCH_COLOR_PATTERN);
2767
+ if (!match) return null;
2768
+ const [base2, alphaSegment] = match[1].split("/");
2769
+ const parts = base2.trim().split(/\s+/).map((part) => part.trim()).filter(Boolean);
2770
+ if (parts.length < 3) return null;
2771
+ const lightness = parseOklchLightness(parts[0]);
2772
+ const chroma = Number.parseFloat(parts[1]);
2773
+ const hueRadians = parseHue(parts[2]) * Math.PI / 180;
2774
+ const alpha = parseAlpha(alphaSegment);
2775
+ const a = chroma * Math.cos(hueRadians);
2776
+ const b = chroma * Math.sin(hueRadians);
2777
+ const l_ = lightness + 0.3963377774 * a + 0.2158037573 * b;
2778
+ const m_ = lightness - 0.1055613458 * a - 0.0638541728 * b;
2779
+ const s_ = lightness - 0.0894841775 * a - 1.291485548 * b;
2780
+ const l = l_ * l_ * l_;
2781
+ const m = m_ * m_ * m_;
2782
+ const s = s_ * s_ * s_;
2783
+ const linearR = 4.0767416621 * l - 3.3077115913 * m + 0.2309699292 * s;
2784
+ const linearG = -1.2684380046 * l + 2.6097574011 * m - 0.3413193965 * s;
2785
+ const linearB = -0.0041960863 * l - 0.7034186147 * m + 1.707614701 * s;
2786
+ return {
2787
+ r: clamp(Math.round(linearToSrgb(linearR) * 255), 0, 255),
2788
+ g: clamp(Math.round(linearToSrgb(linearG) * 255), 0, 255),
2789
+ b: clamp(Math.round(linearToSrgb(linearB) * 255), 0, 255),
2790
+ a: alpha
2791
+ };
2792
+ }
2793
+ function parseCssColor(value) {
2794
+ const normalized = value.trim();
2795
+ if (!normalized) return null;
2796
+ return parseHexColor(normalized) ?? parseRgbColor(normalized) ?? parseOklchColor(normalized);
2797
+ }
2798
+ function compositeColor(foreground, background) {
2799
+ const alpha = foreground.a + background.a * (1 - foreground.a);
2800
+ if (alpha <= 0) {
2801
+ return { r: 0, g: 0, b: 0, a: 0 };
2802
+ }
2803
+ const r = (foreground.r * foreground.a + background.r * background.a * (1 - foreground.a)) / alpha;
2804
+ const g = (foreground.g * foreground.a + background.g * background.a * (1 - foreground.a)) / alpha;
2805
+ const b = (foreground.b * foreground.a + background.b * background.a * (1 - foreground.a)) / alpha;
2806
+ return {
2807
+ r: clamp(Math.round(r), 0, 255),
2808
+ g: clamp(Math.round(g), 0, 255),
2809
+ b: clamp(Math.round(b), 0, 255),
2810
+ a: clamp(alpha, 0, 1)
2811
+ };
2812
+ }
2813
+ function toHexChannel(value) {
2814
+ return value.toString(16).padStart(2, "0");
2815
+ }
2816
+ function rgbaToHex(value) {
2817
+ return `#${toHexChannel(value.r)}${toHexChannel(value.g)}${toHexChannel(value.b)}`;
2818
+ }
2819
+ function getFallbackPalette(isDarkMode) {
2820
+ if (isDarkMode) {
2821
+ return {
2822
+ background: "#171717",
2823
+ border: "#52525b",
2824
+ fontFamily: "Inter Variable, sans-serif",
2825
+ line: "#a1a1aa",
2826
+ surface: "#262626",
2827
+ surfaceAlt: "#3f3f46",
2828
+ text: "#fafafa"
2829
+ };
2830
+ }
2831
+ return {
2832
+ background: "#ffffff",
2833
+ border: "#e4e4e7",
2834
+ fontFamily: "Inter Variable, sans-serif",
2835
+ line: "#71717a",
2836
+ surface: "#ffffff",
2837
+ surfaceAlt: "#f4f4f5",
2838
+ text: "#18181b"
2839
+ };
2840
+ }
2841
+ function resolveColor(styles, property, fallback, background) {
2842
+ const parsed = parseCssColor(styles.getPropertyValue(property));
2843
+ if (!parsed) return fallback;
2844
+ if (parsed.a < 1 && background) {
2845
+ return rgbaToHex(compositeColor(parsed, background));
2846
+ }
2847
+ return rgbaToHex(parsed);
2848
+ }
2849
+ function resolvePalette(element, isDarkMode) {
2850
+ const fallback = getFallbackPalette(isDarkMode);
2851
+ const styles = window.getComputedStyle(element);
2852
+ const backgroundColor = parseCssColor(styles.getPropertyValue("--card")) ?? parseCssColor(styles.getPropertyValue("--background")) ?? parseCssColor(fallback.surface);
2853
+ return {
2854
+ background: resolveColor(styles, "--background", fallback.background, backgroundColor),
2855
+ border: resolveColor(styles, "--border", fallback.border, backgroundColor),
2856
+ fontFamily: styles.getPropertyValue("font-family").trim() || fallback.fontFamily,
2857
+ line: resolveColor(styles, "--muted-foreground", fallback.line, backgroundColor),
2858
+ surface: resolveColor(styles, "--card", fallback.surface, backgroundColor),
2859
+ surfaceAlt: resolveColor(styles, "--muted", fallback.surfaceAlt, backgroundColor),
2860
+ text: resolveColor(styles, "--foreground", fallback.text, backgroundColor)
2861
+ };
2862
+ }
2863
+ function buildThemeVariables(palette) {
2864
+ return {
2865
+ background: palette.background,
2866
+ clusterBkg: palette.surfaceAlt,
2867
+ clusterBorder: palette.border,
2868
+ edgeLabelBackground: palette.surface,
2869
+ fontFamily: palette.fontFamily,
2870
+ lineColor: palette.line,
2871
+ mainBkg: palette.surface,
2872
+ nodeBorder: palette.border,
2873
+ nodeTextColor: palette.text,
2874
+ primaryBorderColor: palette.border,
2875
+ primaryColor: palette.surfaceAlt,
2876
+ primaryTextColor: palette.text,
2877
+ secondaryBorderColor: palette.border,
2878
+ secondaryColor: palette.surface,
2879
+ secondaryTextColor: palette.text,
2880
+ tertiaryBorderColor: palette.border,
2881
+ tertiaryColor: palette.surface,
2882
+ tertiaryTextColor: palette.text,
2883
+ textColor: palette.text
2884
+ };
2885
+ }
2886
+ async function renderMermaidDiagram({
2887
+ code,
2888
+ host,
2889
+ id,
2890
+ palette
2891
+ }) {
2892
+ host.innerHTML = "";
2893
+ import_mermaid.default.initialize({
2894
+ flowchart: {
2895
+ htmlLabels: false,
2896
+ useMaxWidth: true
2897
+ },
2898
+ fontFamily: palette.fontFamily,
2899
+ secure: [...MERMAID_SECURE_KEYS],
2900
+ securityLevel: "strict",
2901
+ startOnLoad: false,
2902
+ theme: "base",
2903
+ themeVariables: buildThemeVariables(palette)
2904
+ });
2905
+ const { svg } = await import_mermaid.default.render(id, code, host);
2906
+ host.innerHTML = "";
2907
+ return svg;
2908
+ }
2909
+ function MermaidPreviewDialog({
2910
+ closeLabel,
2911
+ onOpenChange,
2912
+ open,
2913
+ svgMarkup,
2914
+ title
2915
+ }) {
2916
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog.Root, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Dialog.Portal, { children: [
2917
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog.Overlay, { className: "fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0" }),
2918
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Dialog.Content, { className: "fixed inset-[5vh] z-50 flex flex-col overflow-hidden rounded-3xl border border-border bg-background shadow-2xl outline-none data-[state=closed]:animate-out data-[state=open]:animate-in data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", children: [
2919
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between gap-4 border-b border-border px-5 py-4", children: [
2920
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog.Title, { className: "text-base font-semibold text-foreground", children: title }),
2921
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Dialog.Close, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
2922
+ "button",
2923
+ {
2924
+ type: "button",
2925
+ className: "inline-flex size-10 items-center justify-center rounded-full border border-border bg-card text-muted-foreground transition-colors hover:text-foreground",
2926
+ children: [
2927
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.X, { className: "size-4" }),
2928
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "sr-only", children: closeLabel })
2929
+ ]
2930
+ }
2931
+ ) })
2932
+ ] }),
2933
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex-1 overflow-auto bg-card p-6", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2934
+ "div",
2935
+ {
2936
+ "data-slot": "mermaid-preview",
2937
+ className: "min-h-full rounded-[calc(var(--radius)+0.5rem)] border border-border bg-background p-6 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-none",
2938
+ dangerouslySetInnerHTML: { __html: svgMarkup }
2939
+ }
2940
+ ) })
2941
+ ] })
2942
+ ] }) });
2943
+ }
2944
+ function MermaidBlock({ code }) {
2945
+ const { t } = useChatkitTranslation();
2946
+ const { theme, isDarkMode } = useTheme();
2947
+ const containerRef = React14.useRef(null);
2948
+ const renderHostRef = React14.useRef(null);
2949
+ const renderSequenceRef = React14.useRef(0);
2950
+ const copyResetTimeoutRef = React14.useRef(null);
2951
+ const diagramId = React14.useId().replace(/:/g, "");
2952
+ const [activeTab, setActiveTab] = React14.useState("diagram");
2953
+ const [isCopied, setIsCopied] = React14.useState(false);
2954
+ const [isPreviewOpen, setIsPreviewOpen] = React14.useState(false);
2955
+ const [isRendering, setIsRendering] = React14.useState(true);
2956
+ const [renderError, setRenderError] = React14.useState(null);
2957
+ const [svgMarkup, setSvgMarkup] = React14.useState(null);
2958
+ const normalizedCode = React14.useMemo(() => normalizeMermaidCode(code), [code]);
2959
+ const clearCopyResetTimeout = React14.useCallback(() => {
2960
+ if (copyResetTimeoutRef.current === null) return;
2961
+ window.clearTimeout(copyResetTimeoutRef.current);
2962
+ copyResetTimeoutRef.current = null;
2963
+ }, []);
2964
+ React14.useEffect(() => {
2965
+ let isActive = true;
2966
+ async function runRender() {
2967
+ const container = containerRef.current;
2968
+ const renderHost = renderHostRef.current;
2969
+ if (!container || !renderHost) return;
2970
+ setIsRendering(true);
2971
+ setRenderError(null);
2972
+ try {
2973
+ renderSequenceRef.current += 1;
2974
+ const svg = await renderMermaidDiagram({
2975
+ code: normalizedCode,
2976
+ host: renderHost,
2977
+ id: `mermaid-${diagramId}-${renderSequenceRef.current}`,
2978
+ palette: resolvePalette(container, isDarkMode)
2979
+ });
2980
+ if (!isActive) return;
2981
+ setSvgMarkup(svg);
2982
+ } catch (error) {
2983
+ if (!isActive) return;
2984
+ setSvgMarkup(null);
2985
+ setRenderError(error instanceof Error ? error.message : "render_failed");
2986
+ setActiveTab((currentTab) => currentTab === "diagram" ? "code" : currentTab);
2987
+ } finally {
2988
+ if (isActive) {
2989
+ setIsRendering(false);
2990
+ renderHost.innerHTML = "";
2991
+ }
2992
+ }
2993
+ }
2994
+ void runRender();
2995
+ return () => {
2996
+ isActive = false;
2997
+ if (renderHostRef.current) {
2998
+ renderHostRef.current.innerHTML = "";
2999
+ }
3000
+ };
3001
+ }, [diagramId, isDarkMode, normalizedCode, theme]);
3002
+ React14.useEffect(() => {
3003
+ clearCopyResetTimeout();
3004
+ setIsCopied(false);
3005
+ }, [activeTab, clearCopyResetTimeout, code]);
3006
+ React14.useEffect(
3007
+ () => () => {
3008
+ clearCopyResetTimeout();
3009
+ },
3010
+ [clearCopyResetTimeout]
3011
+ );
3012
+ const handleDownload = React14.useCallback(() => {
3013
+ if (!svgMarkup) return;
3014
+ const blob = new Blob([svgMarkup], {
3015
+ type: "image/svg+xml;charset=utf-8"
3016
+ });
3017
+ const url = window.URL.createObjectURL(blob);
3018
+ const anchor = document.createElement("a");
3019
+ anchor.href = url;
3020
+ anchor.download = `mermaid-diagram-${diagramId}.svg`;
3021
+ document.body.append(anchor);
3022
+ anchor.click();
3023
+ anchor.remove();
3024
+ window.URL.revokeObjectURL(url);
3025
+ }, [diagramId, svgMarkup]);
3026
+ const handleCopyCode = React14.useCallback(() => {
3027
+ if (!code || isCopied) return;
3028
+ navigator.clipboard.writeText(code).then(() => {
3029
+ setIsCopied(true);
3030
+ clearCopyResetTimeout();
3031
+ copyResetTimeoutRef.current = window.setTimeout(() => {
3032
+ setIsCopied(false);
3033
+ copyResetTimeoutRef.current = null;
3034
+ }, 3e3);
3035
+ }).catch(() => {
3036
+ });
3037
+ }, [clearCopyResetTimeout, code, isCopied]);
3038
+ const hasRenderedDiagram = svgMarkup !== null && !renderError;
3039
+ const statusMessage = isRendering ? t("markdown.mermaid.rendering") : t("markdown.mermaid.failed");
3040
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
3041
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3042
+ Tabs,
3043
+ {
3044
+ className: "w-full",
3045
+ onValueChange: (value) => setActiveTab(value),
3046
+ value: activeTab,
3047
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3048
+ "div",
3049
+ {
3050
+ ref: containerRef,
3051
+ "data-slot": "mermaid-block",
3052
+ className: "relative overflow-hidden text-card-foreground",
3053
+ children: [
3054
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3055
+ "div",
3056
+ {
3057
+ ref: renderHostRef,
3058
+ "aria-hidden": "true",
3059
+ className: "pointer-events-none absolute inset-0 -z-10 overflow-hidden opacity-0",
3060
+ "data-slot": "mermaid-render-host"
3061
+ }
3062
+ ),
3063
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-wrap items-center justify-between gap-3 px-4 py-3", children: [
3064
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex min-w-0 items-center gap-3", children: [
3065
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "inline-flex size-9 shrink-0 items-center justify-center rounded-full bg-muted text-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.Code2Icon, { className: "size-4" }) }),
3066
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "truncate text-base font-semibold text-foreground", children: t("markdown.mermaid.title") })
3067
+ ] }),
3068
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex shrink-0 items-center gap-2", children: [
3069
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-1", children: [
3070
+ activeTab === "diagram" && hasRenderedDiagram ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3071
+ TooltipIconButton,
3072
+ {
3073
+ onClick: handleDownload,
3074
+ tooltip: t("markdown.mermaid.download"),
3075
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.DownloadIcon, { className: "size-4" })
3076
+ }
3077
+ ) : null,
3078
+ activeTab === "diagram" && hasRenderedDiagram ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3079
+ TooltipIconButton,
3080
+ {
3081
+ onClick: () => setIsPreviewOpen(true),
3082
+ tooltip: t("markdown.mermaid.fullScreen"),
3083
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.ExpandIcon, { className: "size-4" })
3084
+ }
3085
+ ) : null,
3086
+ activeTab === "code" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3087
+ TooltipIconButton,
3088
+ {
3089
+ onClick: handleCopyCode,
3090
+ tooltip: t("markdown.copy"),
3091
+ children: isCopied ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.CheckIcon, { className: "size-4" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.CopyIcon, { className: "size-4" })
3092
+ }
3093
+ ) : null
3094
+ ] }),
3095
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(TabsList, { children: [
3096
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabsTrigger, { value: "diagram", children: t("markdown.mermaid.diagram") }),
3097
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabsTrigger, { value: "code", children: t("markdown.mermaid.code") })
3098
+ ] })
3099
+ ] })
3100
+ ] }),
3101
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "border-t border-border pt-4", children: [
3102
+ renderError ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { role: "alert", className: "mb-4 text-sm font-medium text-destructive", children: t("markdown.mermaid.failed") }) : null,
3103
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabsContent, { value: "diagram", className: "mt-0 space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3104
+ "div",
3105
+ {
3106
+ className: cn(
3107
+ "relative overflow-auto rounded-[calc(var(--radius)+0.5rem)] border border-border bg-background p-4",
3108
+ hasRenderedDiagram ? "[&_svg]:mx-auto [&_svg]:h-auto [&_svg]:w-full [&_svg]:max-w-none" : "min-h-[14rem]"
3109
+ ),
3110
+ children: hasRenderedDiagram ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3111
+ "div",
3112
+ {
3113
+ "data-slot": "mermaid-diagram",
3114
+ dangerouslySetInnerHTML: { __html: svgMarkup }
3115
+ }
3116
+ ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex min-h-[12rem] flex-col items-center justify-center gap-3 text-center text-muted-foreground", children: [
3117
+ isRendering ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.Loader2, { className: "size-5 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.TriangleAlert, { className: "size-5 text-destructive" }),
3118
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3119
+ "p",
3120
+ {
3121
+ className: cn("text-sm font-medium", !isRendering && "text-destructive"),
3122
+ role: renderError ? "alert" : void 0,
3123
+ children: statusMessage
3124
+ }
3125
+ )
3126
+ ] })
3127
+ }
3128
+ ) }),
3129
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabsContent, { value: "code", className: "mt-0", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3130
+ "pre",
3131
+ {
3132
+ "data-slot": "mermaid-code",
3133
+ className: "overflow-x-auto rounded-[calc(var(--radius)+0.5rem)] border border-border bg-zinc-950 px-4 py-4 text-sm text-zinc-50",
3134
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("code", { className: "block whitespace-pre font-mono", children: code })
3135
+ }
3136
+ ) })
3137
+ ] })
3138
+ ]
3139
+ }
3140
+ )
3141
+ }
3142
+ ),
3143
+ svgMarkup ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3144
+ MermaidPreviewDialog,
3145
+ {
3146
+ closeLabel: t("sheet.close"),
3147
+ onOpenChange: setIsPreviewOpen,
3148
+ open: isPreviewOpen,
3149
+ svgMarkup,
3150
+ title: t("markdown.mermaid.title")
3151
+ }
3152
+ ) : null
3153
+ ] });
3154
+ }
3155
+
2488
3156
  // src/components/thread/markdown-text.tsx
2489
3157
  var import_katex_min = require("katex/dist/katex.min.css");
2490
- var import_jsx_runtime18 = require("react/jsx-runtime");
3158
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2491
3159
  var getTextContent = (children) => import_react6.Children.toArray(children).map((child) => {
2492
3160
  if (typeof child === "string" || typeof child === "number") {
2493
3161
  return String(child);
2494
3162
  }
2495
3163
  return "";
2496
3164
  }).join("");
3165
+ var isMermaidBlockChild = (child) => (0, import_react6.isValidElement)(child) && child.type === MermaidBlock;
3166
+ var isMermaidCodeElement = (child) => (0, import_react6.isValidElement)(child) && typeof child.props.className === "string" && child.props.className.includes("language-mermaid");
2497
3167
  var useCopyToClipboard = ({
2498
3168
  copiedDuration = 3e3
2499
3169
  } = {}) => {
@@ -2514,23 +3184,23 @@ var CodeHeader = ({ language, code }) => {
2514
3184
  if (!code || isCopied) return;
2515
3185
  copyToClipboard(code);
2516
3186
  };
2517
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center justify-between gap-4 rounded-t-lg bg-zinc-900 px-4 py-2 text-sm font-semibold text-white", children: [
2518
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "lowercase [&>span]:text-xs", children: language }),
2519
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
3187
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center justify-between gap-4 rounded-t-lg bg-zinc-900 px-4 py-2 text-sm font-semibold text-white", children: [
3188
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "lowercase [&>span]:text-xs", children: language }),
3189
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
2520
3190
  TooltipIconButton,
2521
3191
  {
2522
3192
  tooltip: t("markdown.copy"),
2523
3193
  onClick: onCopy,
2524
3194
  children: [
2525
- !isCopied && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.CopyIcon, {}),
2526
- isCopied && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react6.CheckIcon, {})
3195
+ !isCopied && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.CopyIcon, {}),
3196
+ isCopied && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react7.CheckIcon, {})
2527
3197
  ]
2528
3198
  }
2529
3199
  )
2530
3200
  ] });
2531
3201
  };
2532
3202
  var defaultComponents = {
2533
- h1: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3203
+ h1: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2534
3204
  "h1",
2535
3205
  {
2536
3206
  className: cn(
@@ -2540,7 +3210,7 @@ var defaultComponents = {
2540
3210
  ...props
2541
3211
  }
2542
3212
  ),
2543
- h2: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3213
+ h2: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2544
3214
  "h2",
2545
3215
  {
2546
3216
  className: cn(
@@ -2550,7 +3220,7 @@ var defaultComponents = {
2550
3220
  ...props
2551
3221
  }
2552
3222
  ),
2553
- h3: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3223
+ h3: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2554
3224
  "h3",
2555
3225
  {
2556
3226
  className: cn(
@@ -2560,7 +3230,7 @@ var defaultComponents = {
2560
3230
  ...props
2561
3231
  }
2562
3232
  ),
2563
- h4: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3233
+ h4: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2564
3234
  "h4",
2565
3235
  {
2566
3236
  className: cn(
@@ -2570,7 +3240,7 @@ var defaultComponents = {
2570
3240
  ...props
2571
3241
  }
2572
3242
  ),
2573
- h5: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3243
+ h5: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2574
3244
  "h5",
2575
3245
  {
2576
3246
  className: cn(
@@ -2580,21 +3250,21 @@ var defaultComponents = {
2580
3250
  ...props
2581
3251
  }
2582
3252
  ),
2583
- h6: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3253
+ h6: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2584
3254
  "h6",
2585
3255
  {
2586
3256
  className: cn("my-4 font-semibold first:mt-0 last:mb-0", className),
2587
3257
  ...props
2588
3258
  }
2589
3259
  ),
2590
- p: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3260
+ p: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2591
3261
  "p",
2592
3262
  {
2593
3263
  className: cn("mt-5 mb-5 leading-7 first:mt-0 last:mb-0", className),
2594
3264
  ...props
2595
3265
  }
2596
3266
  ),
2597
- a: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3267
+ a: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2598
3268
  "a",
2599
3269
  {
2600
3270
  className: cn(
@@ -2610,7 +3280,7 @@ var defaultComponents = {
2610
3280
  className,
2611
3281
  node: _node,
2612
3282
  ...props
2613
- }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3283
+ }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2614
3284
  "blockquote",
2615
3285
  {
2616
3286
  className: cn(
@@ -2620,21 +3290,21 @@ var defaultComponents = {
2620
3290
  ...props
2621
3291
  }
2622
3292
  ),
2623
- ul: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3293
+ ul: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2624
3294
  "ul",
2625
3295
  {
2626
3296
  className: cn("my-5 list-outside list-disc pl-6 [&>li]:mt-2", className),
2627
3297
  ...props
2628
3298
  }
2629
3299
  ),
2630
- ol: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3300
+ ol: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2631
3301
  "ol",
2632
3302
  {
2633
3303
  className: cn("my-5 list-outside list-decimal pl-8 [&>li]:mt-2", className),
2634
3304
  ...props
2635
3305
  }
2636
3306
  ),
2637
- hr: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3307
+ hr: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2638
3308
  "hr",
2639
3309
  {
2640
3310
  className: cn("my-5 border-b", className),
@@ -2645,7 +3315,7 @@ var defaultComponents = {
2645
3315
  className,
2646
3316
  node: _node,
2647
3317
  ...props
2648
- }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3318
+ }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2649
3319
  "table",
2650
3320
  {
2651
3321
  className: cn(
@@ -2655,7 +3325,7 @@ var defaultComponents = {
2655
3325
  ...props
2656
3326
  }
2657
3327
  ),
2658
- th: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3328
+ th: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2659
3329
  "th",
2660
3330
  {
2661
3331
  className: cn(
@@ -2665,7 +3335,7 @@ var defaultComponents = {
2665
3335
  ...props
2666
3336
  }
2667
3337
  ),
2668
- td: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3338
+ td: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2669
3339
  "td",
2670
3340
  {
2671
3341
  className: cn(
@@ -2675,7 +3345,7 @@ var defaultComponents = {
2675
3345
  ...props
2676
3346
  }
2677
3347
  ),
2678
- tr: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3348
+ tr: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2679
3349
  "tr",
2680
3350
  {
2681
3351
  className: cn(
@@ -2685,21 +3355,21 @@ var defaultComponents = {
2685
3355
  ...props
2686
3356
  }
2687
3357
  ),
2688
- sup: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3358
+ sup: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2689
3359
  "sup",
2690
3360
  {
2691
3361
  className: cn("[&>a]:text-xs [&>a]:no-underline", className),
2692
3362
  ...props
2693
3363
  }
2694
3364
  ),
2695
- pre: ({ className, node: _node, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3365
+ pre: ({ className, children, node: _node }) => import_react6.Children.toArray(children).length === 1 && (isMermaidBlockChild(import_react6.Children.toArray(children)[0]) || isMermaidCodeElement(import_react6.Children.toArray(children)[0])) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2696
3366
  "div",
2697
3367
  {
2698
3368
  className: cn(
2699
3369
  "max-w-4xl overflow-x-auto rounded-lg text-sm bg-black text-white dark:bg-zinc-800",
2700
3370
  className
2701
3371
  ),
2702
- ...props
3372
+ children
2703
3373
  }
2704
3374
  ),
2705
3375
  code: ({
@@ -2708,21 +3378,24 @@ var defaultComponents = {
2708
3378
  node: _node,
2709
3379
  ...props
2710
3380
  }) => {
2711
- const match = /language-(\w+)/.exec(className || "");
3381
+ const match = /language-([\w-]+)/.exec(className || "");
2712
3382
  const code = getTextContent(children);
2713
3383
  const isBlockCode = code.includes("\n");
2714
3384
  if (match) {
2715
3385
  const language = match[1];
2716
3386
  const normalizedCode = code.replace(/\n$/, "");
2717
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2718
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3387
+ if (language === "mermaid") {
3388
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MermaidBlock, { code: normalizedCode });
3389
+ }
3390
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
3391
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2719
3392
  CodeHeader,
2720
3393
  {
2721
3394
  language,
2722
3395
  code: normalizedCode
2723
3396
  }
2724
3397
  ),
2725
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3398
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2726
3399
  SyntaxHighlighter,
2727
3400
  {
2728
3401
  language,
@@ -2733,7 +3406,7 @@ var defaultComponents = {
2733
3406
  ] });
2734
3407
  }
2735
3408
  if (isBlockCode) {
2736
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3409
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2737
3410
  "code",
2738
3411
  {
2739
3412
  className: cn(
@@ -2745,7 +3418,7 @@ var defaultComponents = {
2745
3418
  }
2746
3419
  );
2747
3420
  }
2748
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3421
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2749
3422
  "code",
2750
3423
  {
2751
3424
  className: cn(
@@ -2759,7 +3432,7 @@ var defaultComponents = {
2759
3432
  }
2760
3433
  };
2761
3434
  var MarkdownTextImpl = ({ children }) => {
2762
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "markdown-content", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
3435
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "markdown-content", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2763
3436
  import_react_markdown.default,
2764
3437
  {
2765
3438
  remarkPlugins: [import_remark_gfm.default, import_remark_math.default],
@@ -2773,18 +3446,18 @@ var MarkdownText = (0, import_react6.memo)(MarkdownTextImpl);
2773
3446
 
2774
3447
  // src/components/thread/messages/widget.tsx
2775
3448
  var import_a2ui_react = require("@xpert-ai/a2ui-react");
2776
- var import_jsx_runtime19 = require("react/jsx-runtime");
3449
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2777
3450
  function WidgetMessage({ messageId, data }) {
2778
3451
  const widgets = Array.isArray(data.widgets) ? data.widgets : [];
2779
3452
  if (widgets.length === 0) return null;
2780
3453
  const baseSurfaceId = `widget-${messageId}`;
2781
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "space-y-3", children: widgets.map((widget, index) => {
3454
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "space-y-3", children: widgets.map((widget, index) => {
2782
3455
  const config = widget?.config;
2783
3456
  if (!config || typeof config !== "object") {
2784
3457
  return null;
2785
3458
  }
2786
3459
  const surfaceId = widgets.length > 1 ? `${baseSurfaceId}-${index}` : baseSurfaceId;
2787
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3460
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2788
3461
  import_a2ui_react.SurfaceRenderer,
2789
3462
  {
2790
3463
  surfaceId,
@@ -2796,7 +3469,7 @@ function WidgetMessage({ messageId, data }) {
2796
3469
  }
2797
3470
 
2798
3471
  // src/components/thread/messages/ai.tsx
2799
- var import_jsx_runtime20 = require("react/jsx-runtime");
3472
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2800
3473
  function isTextContent(content) {
2801
3474
  return content.type === "text";
2802
3475
  }
@@ -2812,15 +3485,15 @@ function isComponentContent(content) {
2812
3485
  var statusConfig = {
2813
3486
  success: {
2814
3487
  iconClass: "border-green-500 text-green-700",
2815
- icon: import_lucide_react7.CheckCircle2
3488
+ icon: import_lucide_react8.CheckCircle2
2816
3489
  },
2817
3490
  fail: {
2818
3491
  iconClass: "border-red-500 text-red-700",
2819
- icon: import_lucide_react7.XCircle
3492
+ icon: import_lucide_react8.XCircle
2820
3493
  },
2821
3494
  running: {
2822
3495
  iconClass: "border-blue-500 text-blue-700",
2823
- icon: import_lucide_react7.Loader2
3496
+ icon: import_lucide_react8.Loader2
2824
3497
  }
2825
3498
  };
2826
3499
  function isWidgetComponent(content) {
@@ -2837,14 +3510,17 @@ function safeJson(value) {
2837
3510
  return String(value);
2838
3511
  }
2839
3512
  }
3513
+ function formatDisplayValue(value) {
3514
+ return typeof value === "string" ? value : safeJson(value);
3515
+ }
2840
3516
  function ReasoningBlock({ reasoning }) {
2841
3517
  const blocks = reasoning.filter((item) => item.text?.trim());
2842
3518
  if (blocks.length === 0) return null;
2843
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3519
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "space-y-2", children: blocks.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2844
3520
  "div",
2845
3521
  {
2846
3522
  className: "rounded-lg border bg-muted/40 p-3 text-xs text-muted-foreground",
2847
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
3523
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "whitespace-pre-wrap wrap-break-word leading-relaxed", children: item.text })
2848
3524
  },
2849
3525
  item.id ?? `reasoning-${index}`
2850
3526
  )) });
@@ -2852,27 +3528,27 @@ function ReasoningBlock({ reasoning }) {
2852
3528
  function ImageBlock({ content }) {
2853
3529
  const imageUrl = typeof content.image_url === "string" ? content.image_url : typeof content.image_url?.url === "string" ? content.image_url.url : null;
2854
3530
  if (!imageUrl) {
2855
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Card, { children: [
2856
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CardTitle, { className: "text-sm", children: "Image" }) }),
2857
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: safeJson(content) })
3531
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Card, { children: [
3532
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardHeader, { className: "space-y-1", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardTitle, { className: "text-sm", children: "Image" }) }),
3533
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: safeJson(content) })
2858
3534
  ] });
2859
3535
  }
2860
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("img", { src: imageUrl, alt: "Assistant output", className: "h-auto w-full object-cover" }) });
3536
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("figure", { className: "overflow-hidden rounded-lg border bg-background", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("img", { src: imageUrl, alt: "Assistant output", className: "h-auto w-full object-cover" }) });
2861
3537
  }
2862
3538
  function MemoryBlock({ content }) {
2863
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Card, { children: [
2864
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
2865
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CardTitle, { className: "text-sm", children: "Memory" }),
2866
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Badge, { variant: "secondary", children: "Memory" })
3539
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Card, { children: [
3540
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
3541
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardTitle, { className: "text-sm", children: "Memory" }),
3542
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Badge, { variant: "secondary", children: "Memory" })
2867
3543
  ] }),
2868
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson(content.data ?? []) }) })
3544
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: safeJson(content.data ?? []) }) })
2869
3545
  ] });
2870
3546
  }
2871
3547
  function ComponentBlock({ content }) {
2872
- const [isExpanded, setIsExpanded] = React14.useState(false);
2873
- const contentRef = React14.useRef(null);
2874
- const shouldAutoScrollRef = React14.useRef(true);
2875
- const previousScrollTopRef = React14.useRef(0);
3548
+ const [isExpanded, setIsExpanded] = React15.useState(false);
3549
+ const contentRef = React15.useRef(null);
3550
+ const shouldAutoScrollRef = React15.useRef(true);
3551
+ const previousScrollTopRef = React15.useRef(0);
2876
3552
  const data = content.data ?? {};
2877
3553
  const category = data.category ?? "Component";
2878
3554
  const title = data.tool && category === "Tool" ? data.tool : data.title ?? data.type ?? "Component";
@@ -2880,12 +3556,12 @@ function ComponentBlock({ content }) {
2880
3556
  const message = data.message ?? null;
2881
3557
  const output = data.output ?? null;
2882
3558
  const error = data.error ?? null;
2883
- const fallback = message ?? output ?? safeJson(data.data ?? data);
3559
+ const fallback = message ?? output ?? data.data ?? data;
2884
3560
  const hasOutput = message !== null || output !== null;
2885
- React14.useEffect(() => {
3561
+ React15.useEffect(() => {
2886
3562
  if (status === "running" && output !== null) setIsExpanded(true);
2887
3563
  }, [status, output]);
2888
- React14.useEffect(() => {
3564
+ React15.useEffect(() => {
2889
3565
  const element = contentRef.current;
2890
3566
  if (!element) return;
2891
3567
  previousScrollTopRef.current = element.scrollTop;
@@ -2905,7 +3581,7 @@ function ComponentBlock({ content }) {
2905
3581
  element.removeEventListener("scroll", updateAutoScrollState);
2906
3582
  };
2907
3583
  }, [isExpanded]);
2908
- React14.useEffect(() => {
3584
+ React15.useEffect(() => {
2909
3585
  if (status !== "running") {
2910
3586
  shouldAutoScrollRef.current = true;
2911
3587
  return;
@@ -2918,21 +3594,21 @@ function ComponentBlock({ content }) {
2918
3594
  }, [isExpanded, output, status]);
2919
3595
  const config = status ? statusConfig[status] : null;
2920
3596
  const StatusIcon = config?.icon;
2921
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Card, { children: [
2922
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [
2923
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
2924
- status && StatusIcon && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(StatusIcon, { className: cn("h-4 w-4", config?.iconClass, status === "running" && "animate-spin") }),
2925
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CardTitle, { className: "text-sm truncate", children: title })
3597
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Card, { children: [
3598
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2 px-2 py-1 cursor-pointer", onClick: () => setIsExpanded(!isExpanded), children: [
3599
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-center space-x-1 flex-1 min-w-0", children: [
3600
+ status && StatusIcon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(StatusIcon, { className: cn("h-4 w-4", config?.iconClass, status === "running" && "animate-spin") }),
3601
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardTitle, { className: "text-sm truncate", children: title })
2926
3602
  ] }),
2927
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
2928
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
2929
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3603
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex flex-wrap items-center gap-2 shrink-0", children: [
3604
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Badge, { variant: "secondary", className: "rounded-lg px-1.5", children: category }),
3605
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2930
3606
  "button",
2931
3607
  {
2932
3608
  className: "text-muted-foreground hover:text-foreground transition-colors",
2933
3609
  "aria-label": isExpanded ? "Collapse" : "Expand",
2934
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
2935
- import_lucide_react7.ChevronDown,
3610
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3611
+ import_lucide_react8.ChevronDown,
2936
3612
  {
2937
3613
  className: cn("h-4 w-4 transition-transform", isExpanded && "rotate-180")
2938
3614
  }
@@ -2941,55 +3617,55 @@ function ComponentBlock({ content }) {
2941
3617
  )
2942
3618
  ] })
2943
3619
  ] }),
2944
- isExpanded && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(CardContent, { ref: contentRef, className: "text-xs text-muted-foreground max-h-60 overflow-auto", children: [
2945
- data.input && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: JSON.stringify(data.input, null, 2) }),
2946
- error ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: typeof error === "string" ? error : safeJson(error) }) : hasOutput && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: fallback })
3620
+ isExpanded && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(CardContent, { ref: contentRef, className: "text-xs text-muted-foreground max-h-60 overflow-auto", children: [
3621
+ data.input && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue(data.input) }),
3622
+ error ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word text-destructive", children: formatDisplayValue(error) }) : hasOutput && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "whitespace-pre-wrap wrap-break-word", children: formatDisplayValue(fallback) })
2947
3623
  ] })
2948
3624
  ] });
2949
3625
  }
2950
3626
  function UnknownBlock({ content }) {
2951
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Card, { children: [
2952
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
2953
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CardTitle, { className: "text-sm", children: "Assistant Content" }),
2954
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Badge, { variant: "outline", children: content.type ?? "unknown" })
3627
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(Card, { children: [
3628
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(CardHeader, { className: "flex flex-row items-center justify-between gap-2", children: [
3629
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardTitle, { className: "text-sm", children: "Assistant Content" }),
3630
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Badge, { variant: "outline", children: content.type ?? "unknown" })
2955
3631
  ] }),
2956
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("pre", { className: "whitespace-pre-wrap break-words", children: safeJson(content) }) })
3632
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CardContent, { className: "text-xs text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("pre", { className: "whitespace-pre-wrap break-words", children: safeJson(content) }) })
2957
3633
  ] });
2958
3634
  }
2959
3635
  function renderContentItem(content, index, messageId) {
2960
3636
  if (typeof content === "string") {
2961
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { children: [
2962
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MarkdownText, { children: content }),
3637
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
3638
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MarkdownText, { children: content }),
2963
3639
  ";"
2964
3640
  ] }, `text-${index}`);
2965
3641
  }
2966
3642
  if (isTextContent(content)) {
2967
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
3643
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MarkdownText, { children: content.text }) }, content.id ?? `text-${index}`);
2968
3644
  }
2969
3645
  if (isReasoningContent(content)) {
2970
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
3646
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ReasoningBlock, { reasoning: [content] }) }, content.id ?? `reasoning-${index}`);
2971
3647
  }
2972
3648
  if (isImageContent(content)) {
2973
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ImageBlock, { content }) }, content.id ?? `image-${index}`);
3649
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ImageBlock, { content }) }, content.id ?? `image-${index}`);
2974
3650
  }
2975
3651
  if (isComponentContent(content)) {
2976
3652
  if (isWidgetComponent(content)) {
2977
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
3653
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(WidgetMessage, { messageId, data: content.data }) }, content.id ?? `widget-${index}`);
2978
3654
  }
2979
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
3655
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ComponentBlock, { content }) }, content.id ?? `component-${index}`);
2980
3656
  }
2981
3657
  if (isMemoryContent(content)) {
2982
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
3658
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MemoryBlock, { content }) }, content.id ?? `memory-${index}`);
2983
3659
  }
2984
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
3660
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(UnknownBlock, { content }) }, content.id ?? `unknown-${index}`);
2985
3661
  }
2986
3662
  function renderContent(content, messageId) {
2987
3663
  if (typeof content === "string") {
2988
3664
  if (!content.trim()) return null;
2989
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(MarkdownText, { children: content });
3665
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(MarkdownText, { children: content });
2990
3666
  }
2991
3667
  if (!Array.isArray(content) || content.length === 0) return null;
2992
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "space-y-3", children: content.map((item, index) => renderContentItem(item, index, messageId)) });
3668
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "space-y-3", children: content.map((item, index) => renderContentItem(item, index, messageId)) });
2993
3669
  }
2994
3670
  function AssistantStreamingIndicator({
2995
3671
  status,
@@ -3001,19 +3677,19 @@ function AssistantStreamingIndicator({
3001
3677
  thinking: t("message.thinking"),
3002
3678
  answering: t("message.answering")
3003
3679
  };
3004
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cn("flex items-center gap-2 text-xs text-muted-foreground", className), children: [
3005
- status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react7.Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
3006
- status === "thinking" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
3007
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
3008
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
3009
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
3680
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cn("flex items-center gap-2 text-xs text-muted-foreground", className), children: [
3681
+ status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.Loader2, { className: "h-3.5 w-3.5 animate-spin" }),
3682
+ status === "thinking" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
3683
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.3s]" }),
3684
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce [animation-delay:-0.15s]" }),
3685
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "h-1.5 w-1.5 rounded-full bg-current animate-bounce" })
3010
3686
  ] }),
3011
- status === "answering" && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
3012
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
3013
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
3014
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
3687
+ status === "answering" && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "flex items-end gap-1", "aria-hidden": "true", children: [
3688
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "h-2 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.25s]" }),
3689
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "h-3 w-0.5 rounded-full bg-current animate-pulse [animation-delay:-0.1s]" }),
3690
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { className: "h-2.5 w-0.5 rounded-full bg-current animate-pulse" })
3015
3691
  ] }),
3016
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: labelMap[status] })
3692
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { children: labelMap[status] })
3017
3693
  ] });
3018
3694
  }
3019
3695
  function AssistantMessage({
@@ -3027,42 +3703,42 @@ function AssistantMessage({
3027
3703
  const hasReasoning = hasRenderableReasoning(message.reasoning);
3028
3704
  const resolvedStreamingStatus = streamingStatus ?? getAssistantStreamingStatus(message, isStreaming);
3029
3705
  const answerNode = renderContent(message.content, message.id);
3030
- const reasoningNode = hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ReasoningBlock, { reasoning: message.reasoning ?? [] }) : null;
3706
+ const reasoningNode = hasReasoning ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ReasoningBlock, { reasoning: message.reasoning ?? [] }) : null;
3031
3707
  if (!hasRenderableAssistantMessage(message) && !resolvedStreamingStatus) return null;
3032
3708
  const streamingClass = isStreaming ? "streaming-active" : "";
3033
3709
  if (!hasRenderableAssistantMessage(message) && resolvedStreamingStatus) {
3034
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
3710
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: cn("space-y-3", streamingClass, className), children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) });
3035
3711
  }
3036
3712
  if (hasContent && hasReasoning) {
3037
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
3038
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
3713
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
3714
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3039
3715
  Tabs,
3040
3716
  {
3041
3717
  defaultValue: message.status === "reasoning" ? "reasoning" : "answer",
3042
3718
  className: "w-full",
3043
3719
  children: [
3044
- /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(TabsList, { className: "h-9", children: [
3045
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TabsTrigger, { value: "answer", children: t("message.answer") }),
3046
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
3720
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(TabsList, { className: "", children: [
3721
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TabsTrigger, { value: "answer", children: t("message.answer") }),
3722
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TabsTrigger, { value: "reasoning", children: t("message.reasoning") })
3047
3723
  ] }),
3048
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
3049
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
3724
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TabsContent, { value: "answer", className: "space-y-3", children: answerNode }),
3725
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TabsContent, { value: "reasoning", className: "space-y-3", children: reasoningNode })
3050
3726
  ]
3051
3727
  }
3052
3728
  ),
3053
- resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
3729
+ resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
3054
3730
  ] });
3055
3731
  }
3056
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
3732
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: cn("space-y-3", streamingClass, className), children: [
3057
3733
  hasReasoning ? reasoningNode : answerNode,
3058
- resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
3734
+ resolvedStreamingStatus ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AssistantStreamingIndicator, { status: resolvedStreamingStatus }) : null
3059
3735
  ] });
3060
3736
  }
3061
3737
 
3062
3738
  // src/components/thread/MessageActions.tsx
3063
- var React15 = __toESM(require("react"), 1);
3064
- var import_lucide_react8 = require("lucide-react");
3065
- var import_jsx_runtime21 = require("react/jsx-runtime");
3739
+ var React16 = __toESM(require("react"), 1);
3740
+ var import_lucide_react9 = require("lucide-react");
3741
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3066
3742
  function MessageActions({
3067
3743
  content,
3068
3744
  isAssistant = false,
@@ -3071,7 +3747,7 @@ function MessageActions({
3071
3747
  className
3072
3748
  }) {
3073
3749
  const { t } = useChatkitTranslation();
3074
- const [copied, setCopied] = React15.useState(false);
3750
+ const [copied, setCopied] = React16.useState(false);
3075
3751
  const handleCopy = async () => {
3076
3752
  try {
3077
3753
  await navigator.clipboard.writeText(content);
@@ -3084,7 +3760,7 @@ function MessageActions({
3084
3760
  if (isStreaming) {
3085
3761
  return null;
3086
3762
  }
3087
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
3763
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3088
3764
  "div",
3089
3765
  {
3090
3766
  className: cn(
@@ -3092,7 +3768,7 @@ function MessageActions({
3092
3768
  className
3093
3769
  ),
3094
3770
  children: [
3095
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3771
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3096
3772
  "button",
3097
3773
  {
3098
3774
  type: "button",
@@ -3102,17 +3778,17 @@ function MessageActions({
3102
3778
  copied && "text-green-500"
3103
3779
  ),
3104
3780
  title: copied ? t("messageActions.copied") : t("messageActions.copy"),
3105
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.Copy, { size: 14 })
3781
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.Check, { size: 14 }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.Copy, { size: 14 })
3106
3782
  }
3107
3783
  ),
3108
- isAssistant && onRetry && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3784
+ isAssistant && onRetry && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3109
3785
  "button",
3110
3786
  {
3111
3787
  type: "button",
3112
3788
  onClick: onRetry,
3113
3789
  className: "p-1.5 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",
3114
3790
  title: t("messageActions.regenerate"),
3115
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_lucide_react8.RefreshCw, { size: 14 })
3791
+ children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.RefreshCw, { size: 14 })
3116
3792
  }
3117
3793
  )
3118
3794
  ]
@@ -3121,20 +3797,20 @@ function MessageActions({
3121
3797
  }
3122
3798
 
3123
3799
  // src/components/thread/StartScreen.tsx
3124
- var React16 = require("react");
3125
- var import_lucide_react9 = require("lucide-react");
3126
- var import_jsx_runtime22 = require("react/jsx-runtime");
3800
+ var React17 = require("react");
3801
+ var import_lucide_react10 = require("lucide-react");
3802
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3127
3803
  function getIconComponent2(icon) {
3128
3804
  const iconMap = {
3129
- "circle-question": /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.HelpCircle, { size: 20 }),
3130
- "lightbulb": /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.Lightbulb, { size: 20 }),
3131
- "sparkle": /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.Sparkles, { size: 20 }),
3132
- "write": /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.Pencil, { size: 20 }),
3133
- "search": /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.Search, { size: 20 }),
3134
- "globe": /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.Globe, { size: 20 }),
3135
- "book-open": /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.BookOpen, { size: 20 }),
3136
- "compass": /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.Compass, { size: 20 }),
3137
- "bolt": /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_lucide_react9.Zap, { size: 20 })
3805
+ "circle-question": /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.HelpCircle, { size: 20 }),
3806
+ "lightbulb": /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Lightbulb, { size: 20 }),
3807
+ "sparkle": /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Sparkles, { size: 20 }),
3808
+ "write": /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Pencil, { size: 20 }),
3809
+ "search": /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Search, { size: 20 }),
3810
+ "globe": /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Globe, { size: 20 }),
3811
+ "book-open": /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.BookOpen, { size: 20 }),
3812
+ "compass": /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Compass, { size: 20 }),
3813
+ "bolt": /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react10.Zap, { size: 20 })
3138
3814
  };
3139
3815
  return icon ? iconMap[icon] || iconMap["sparkle"] : iconMap["sparkle"];
3140
3816
  }
@@ -3142,9 +3818,9 @@ function StartScreen({ startScreen, onPromptClick, className }) {
3142
3818
  const { t } = useChatkitTranslation();
3143
3819
  const greeting = startScreen?.greeting ?? t("startScreen.greeting");
3144
3820
  const prompts = startScreen?.prompts ?? [];
3145
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: cn("flex flex-col items-center justify-center py-12 px-4", className), children: [
3146
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "mb-8 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
3147
- prompts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
3821
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: cn("flex flex-col items-center justify-center py-12 px-4", className), children: [
3822
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mb-8 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h2", { className: "text-2xl font-semibold text-foreground mb-2", children: greeting }) }),
3823
+ prompts.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-full max-w-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3", children: prompts.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
3148
3824
  "button",
3149
3825
  {
3150
3826
  type: "button",
@@ -3155,8 +3831,8 @@ function StartScreen({ startScreen, onPromptClick, className }) {
3155
3831
  "focus:outline-none focus:ring-2 focus:ring-primary/20"
3156
3832
  ),
3157
3833
  children: [
3158
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
3159
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "text-sm font-medium text-foreground", children: item.label })
3834
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary", children: getIconComponent2(item.icon) }),
3835
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "text-sm font-medium text-foreground", children: item.label })
3160
3836
  ]
3161
3837
  },
3162
3838
  `prompt-${index}`
@@ -3165,13 +3841,13 @@ function StartScreen({ startScreen, onPromptClick, className }) {
3165
3841
  }
3166
3842
 
3167
3843
  // src/components/ui/chatkit-avatar.tsx
3168
- var React18 = require("react");
3844
+ var React19 = require("react");
3169
3845
 
3170
3846
  // src/components/ui/avatar.tsx
3171
- var React17 = __toESM(require("react"), 1);
3847
+ var React18 = __toESM(require("react"), 1);
3172
3848
  var AvatarPrimitive = __toESM(require("@radix-ui/react-avatar"), 1);
3173
- var import_jsx_runtime23 = require("react/jsx-runtime");
3174
- var Avatar = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3849
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3850
+ var Avatar = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3175
3851
  AvatarPrimitive.Root,
3176
3852
  {
3177
3853
  ref,
@@ -3183,7 +3859,7 @@ var Avatar = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
3183
3859
  }
3184
3860
  ));
3185
3861
  Avatar.displayName = AvatarPrimitive.Root.displayName;
3186
- var AvatarImage = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3862
+ var AvatarImage = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3187
3863
  AvatarPrimitive.Image,
3188
3864
  {
3189
3865
  ref,
@@ -3192,7 +3868,7 @@ var AvatarImage = React17.forwardRef(({ className, ...props }, ref) => /* @__PUR
3192
3868
  }
3193
3869
  ));
3194
3870
  AvatarImage.displayName = AvatarPrimitive.Image.displayName;
3195
- var AvatarFallback = React17.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3871
+ var AvatarFallback = React18.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3196
3872
  AvatarPrimitive.Fallback,
3197
3873
  {
3198
3874
  ref,
@@ -3206,7 +3882,7 @@ var AvatarFallback = React17.forwardRef(({ className, ...props }, ref) => /* @__
3206
3882
  AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
3207
3883
 
3208
3884
  // src/components/ui/chatkit-avatar.tsx
3209
- var import_jsx_runtime24 = require("react/jsx-runtime");
3885
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3210
3886
  function asRecord(value) {
3211
3887
  return value && typeof value === "object" ? value : null;
3212
3888
  }
@@ -3279,21 +3955,21 @@ function ChatkitAvatar({
3279
3955
  const fallbackStyle = {
3280
3956
  ...avatar?.background ? { background: avatar.background } : {}
3281
3957
  };
3282
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Avatar, { className: cn(roundedClass, className), style, ...props, children: [
3283
- avatar?.url ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AvatarImage, { className: imageClassName, src: avatar.url, alt: label }) : null,
3284
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3958
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(Avatar, { className: cn(roundedClass, className), style, ...props, children: [
3959
+ avatar?.url ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AvatarImage, { className: imageClassName, src: avatar.url, alt: label }) : null,
3960
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3285
3961
  AvatarFallback,
3286
3962
  {
3287
3963
  className: cn(roundedClass, "text-sm font-medium text-foreground", fallbackClassName),
3288
3964
  style: fallbackStyle,
3289
- children: emojiCharacter ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "text-[1.1em] leading-none", style: emojiStyle, children: emojiCharacter }) : fallbackText
3965
+ children: emojiCharacter ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-[1.1em] leading-none", style: emojiStyle, children: emojiCharacter }) : fallbackText
3290
3966
  }
3291
3967
  )
3292
3968
  ] });
3293
3969
  }
3294
3970
 
3295
3971
  // src/hooks/useThreads.ts
3296
- var React19 = __toESM(require("react"), 1);
3972
+ var React20 = __toESM(require("react"), 1);
3297
3973
  var DEFAULT_LIMIT = 50;
3298
3974
  var getThreadTitle = (threadRecord) => {
3299
3975
  const title = threadRecord.title?.trim();
@@ -3331,16 +4007,16 @@ function useThreads(limit = DEFAULT_LIMIT) {
3331
4007
  isReady,
3332
4008
  isLoading: isStreamLoading
3333
4009
  } = useStreamContext();
3334
- const [threadRecords, setThreadRecords] = React19.useState([]);
3335
- const [isLoading, setIsLoading] = React19.useState(false);
3336
- const [error, setError] = React19.useState(null);
3337
- const upsertThreadRecord = React19.useCallback((threadRecord) => {
4010
+ const [threadRecords, setThreadRecords] = React20.useState([]);
4011
+ const [isLoading, setIsLoading] = React20.useState(false);
4012
+ const [error, setError] = React20.useState(null);
4013
+ const upsertThreadRecord = React20.useCallback((threadRecord) => {
3338
4014
  setThreadRecords((prev) => {
3339
4015
  const next = prev.filter((item) => item.id !== threadRecord.id);
3340
4016
  return sortThreadRecords([threadRecord, ...next]);
3341
4017
  });
3342
4018
  }, []);
3343
- const refreshThreads = React19.useCallback(async () => {
4019
+ const refreshThreads = React20.useCallback(async () => {
3344
4020
  setIsLoading(true);
3345
4021
  setError(null);
3346
4022
  try {
@@ -3356,7 +4032,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
3356
4032
  setIsLoading(false);
3357
4033
  }
3358
4034
  }, [client, limit, assistantId]);
3359
- const createThread = React19.useCallback(
4035
+ const createThread = React20.useCallback(
3360
4036
  async (input) => {
3361
4037
  setError(null);
3362
4038
  const payload = {};
@@ -3370,7 +4046,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
3370
4046
  },
3371
4047
  [client, upsertThreadRecord]
3372
4048
  );
3373
- const updateThread = React19.useCallback(
4049
+ const updateThread = React20.useCallback(
3374
4050
  async (recordId, payload) => {
3375
4051
  setError(null);
3376
4052
  const updated = await client.conversations.update(recordId, payload);
@@ -3379,7 +4055,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
3379
4055
  },
3380
4056
  [client, upsertThreadRecord]
3381
4057
  );
3382
- const deleteThread = React19.useCallback(
4058
+ const deleteThread = React20.useCallback(
3383
4059
  async (recordId) => {
3384
4060
  setError(null);
3385
4061
  await client.conversations.delete(recordId);
@@ -3387,23 +4063,24 @@ function useThreads(limit = DEFAULT_LIMIT) {
3387
4063
  },
3388
4064
  [client]
3389
4065
  );
3390
- React19.useEffect(() => {
4066
+ React20.useEffect(() => {
3391
4067
  if (!isReady) return;
3392
4068
  void refreshThreads();
3393
4069
  }, [refreshThreads, isReady]);
3394
- React19.useEffect(() => {
4070
+ React20.useEffect(() => {
3395
4071
  if (!threadId || !isStreamLoading) return;
3396
4072
  const now = (/* @__PURE__ */ new Date()).toISOString();
4073
+ const busyStatus = "busy";
3397
4074
  setThreadRecords((prev) => {
3398
4075
  let changed = false;
3399
4076
  const next = prev.map((item) => {
3400
4077
  const isCurrentThread = item.threadId === threadId || item.id === threadId;
3401
4078
  if (!isCurrentThread) return item;
3402
- if (item.status === "busy" && !item.error) return item;
4079
+ if (item.status === busyStatus && !item.error) return item;
3403
4080
  changed = true;
3404
4081
  return {
3405
4082
  ...item,
3406
- status: "busy",
4083
+ status: busyStatus,
3407
4084
  error: void 0,
3408
4085
  updatedAt: now
3409
4086
  };
@@ -3411,7 +4088,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
3411
4088
  return changed ? sortThreadRecords(next) : prev;
3412
4089
  });
3413
4090
  }, [threadId, isStreamLoading]);
3414
- React19.useEffect(() => {
4091
+ React20.useEffect(() => {
3415
4092
  if (!isReady || !threadId || isStreamLoading) return;
3416
4093
  let cancelled = false;
3417
4094
  void client.conversations.search({ where: { threadId }, limit: 1 }).then((result) => {
@@ -3425,7 +4102,7 @@ function useThreads(limit = DEFAULT_LIMIT) {
3425
4102
  cancelled = true;
3426
4103
  };
3427
4104
  }, [client, threadId, upsertThreadRecord, isReady, isStreamLoading]);
3428
- const threads = React19.useMemo(
4105
+ const threads = React20.useMemo(
3429
4106
  () => threadRecords.map((threadRecord) => toThreadItem(threadRecord)),
3430
4107
  [threadRecords]
3431
4108
  );
@@ -3442,22 +4119,22 @@ function useThreads(limit = DEFAULT_LIMIT) {
3442
4119
  }
3443
4120
 
3444
4121
  // src/components/thread/context-usage-indicator.tsx
3445
- var React20 = __toESM(require("react"), 1);
4122
+ var React21 = __toESM(require("react"), 1);
3446
4123
 
3447
4124
  // src/components/ui/progress-circle.tsx
3448
- var import_jsx_runtime25 = (
4125
+ var import_jsx_runtime26 = (
3449
4126
  // biome-ignore lint/a11y/useFocusableInteractive: false positive (progress + progressbar are not focusable interactives)
3450
4127
  // biome-ignore lint/nursery/useAriaPropsSupportedByRole: biome rule at odds with mdn docs (presumed nursary bug with rule)
3451
4128
  require("react/jsx-runtime")
3452
4129
  );
3453
- function clamp(input, a, b) {
4130
+ function clamp2(input, a, b) {
3454
4131
  return Math.max(Math.min(input, Math.max(a, b)), Math.min(a, b));
3455
4132
  }
3456
4133
  var size = 24;
3457
4134
  var strokeWidth = 4;
3458
4135
  var total = 100;
3459
4136
  var ProgressCircle = ({ value, className, ...restSvgProps }) => {
3460
- const normalizedValue = clamp(value, 0, total);
4137
+ const normalizedValue = clamp2(value, 0, total);
3461
4138
  const radius = (size - strokeWidth) / 2;
3462
4139
  const circumference = 2 * Math.PI * radius;
3463
4140
  const progress = normalizedValue / total * circumference;
@@ -3469,7 +4146,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
3469
4146
  fill: "none",
3470
4147
  strokeWidth
3471
4148
  };
3472
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
4149
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3473
4150
  "svg",
3474
4151
  {
3475
4152
  role: "progressbar",
@@ -3480,8 +4157,8 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
3480
4157
  "aria-valuemax": 100,
3481
4158
  ...restSvgProps,
3482
4159
  children: [
3483
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("circle", { ...commonParams, className: "stroke-current/25" }),
3484
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
4160
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("circle", { ...commonParams, className: "stroke-current/25" }),
4161
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3485
4162
  "circle",
3486
4163
  {
3487
4164
  ...commonParams,
@@ -3499,7 +4176,7 @@ var ProgressCircle = ({ value, className, ...restSvgProps }) => {
3499
4176
  };
3500
4177
 
3501
4178
  // src/components/thread/context-usage-indicator.tsx
3502
- var import_jsx_runtime26 = require("react/jsx-runtime");
4179
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3503
4180
  var kNumberFormatter = new Intl.NumberFormat("en-US", {
3504
4181
  minimumFractionDigits: 0,
3505
4182
  maximumFractionDigits: 1
@@ -3532,20 +4209,20 @@ function ContextUsageIndicator({
3532
4209
  }) {
3533
4210
  const { t } = useChatkitTranslation();
3534
4211
  const stream = useStreamContext();
3535
- const [maxContextSize, setMaxContextSize] = React20.useState(null);
3536
- const [usedContextSize, setUsedContextSize] = React20.useState(null);
3537
- const [assistantAgentKey, setAssistantAgentKey] = React20.useState(null);
3538
- const latestRealtimeUsageRef = React20.useRef({
4212
+ const [maxContextSize, setMaxContextSize] = React21.useState(null);
4213
+ const [usedContextSize, setUsedContextSize] = React21.useState(null);
4214
+ const [assistantAgentKey, setAssistantAgentKey] = React21.useState(null);
4215
+ const latestRealtimeUsageRef = React21.useRef({
3539
4216
  threadId: null,
3540
4217
  agentKey: null,
3541
4218
  usedTokens: null
3542
4219
  });
3543
- const realtimeUsage = React20.useMemo(
4220
+ const realtimeUsage = React21.useMemo(
3544
4221
  () => getThreadContextUsage(stream.contextUsageByAgentKey, assistantAgentKey),
3545
4222
  [assistantAgentKey, stream.contextUsageByAgentKey]
3546
4223
  );
3547
4224
  const realtimeUsedContextSize = getThreadContextUsageTotalTokens(realtimeUsage);
3548
- React20.useEffect(() => {
4225
+ React21.useEffect(() => {
3549
4226
  if (!stream.client || !stream.assistantId) {
3550
4227
  setMaxContextSize(null);
3551
4228
  setAssistantAgentKey(null);
@@ -3565,18 +4242,18 @@ function ContextUsageIndicator({
3565
4242
  cancelled = true;
3566
4243
  };
3567
4244
  }, [stream.client, stream.assistantId]);
3568
- React20.useEffect(() => {
4245
+ React21.useEffect(() => {
3569
4246
  latestRealtimeUsageRef.current = {
3570
4247
  threadId: stream.threadId ?? null,
3571
4248
  agentKey: assistantAgentKey,
3572
4249
  usedTokens: realtimeUsedContextSize
3573
4250
  };
3574
4251
  }, [assistantAgentKey, realtimeUsedContextSize, stream.threadId]);
3575
- React20.useEffect(() => {
4252
+ React21.useEffect(() => {
3576
4253
  if (realtimeUsedContextSize == null) return;
3577
4254
  setUsedContextSize(realtimeUsedContextSize);
3578
4255
  }, [realtimeUsedContextSize]);
3579
- React20.useEffect(() => {
4256
+ React21.useEffect(() => {
3580
4257
  if (!stream.client) {
3581
4258
  setUsedContextSize(null);
3582
4259
  return;
@@ -3641,8 +4318,8 @@ function ContextUsageIndicator({
3641
4318
  });
3642
4319
  const usageLabelWithSuffix = usageLabel.endsWith(":") ? usageLabel : `${usageLabel}:`;
3643
4320
  const progressClassName = percent >= 90 ? "text-destructive" : percent >= 75 ? "text-amber-500" : "text-primary dark:text-zinc-300";
3644
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Tooltip, { children: [
3645
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
4321
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Tooltip, { children: [
4322
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3646
4323
  "button",
3647
4324
  {
3648
4325
  type: "button",
@@ -3651,22 +4328,74 @@ function ContextUsageIndicator({
3651
4328
  className
3652
4329
  ),
3653
4330
  "aria-label": `${usageLabelWithSuffix} ${usageFullLabel}. ${usageTokensLabel}`,
3654
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
4331
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ProgressCircle, { value: percent, className: cn("size-3.5", progressClassName) })
3655
4332
  }
3656
4333
  ) }),
3657
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
3658
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
3659
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
3660
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "text-sm font-semibold", children: usageTokensLabel })
4334
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(TooltipContent, { side: "top", sideOffset: 6, className: "space-y-0.5 px-3 py-2 text-center", children: [
4335
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-primary-foreground/70", children: usageLabelWithSuffix }),
4336
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "font-medium text-primary-foreground/80", children: usageFullLabel }),
4337
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-sm font-semibold", children: usageTokensLabel })
3661
4338
  ] })
3662
4339
  ] });
3663
4340
  }
3664
4341
 
3665
4342
  // src/components/chat.tsx
3666
- var import_jsx_runtime27 = require("react/jsx-runtime");
4343
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3667
4344
  var import_meta2 = {};
3668
4345
  var defaultApiUrl2 = import_meta2.env.VITE_XPERTAI_API_URL;
3669
4346
  var COMPOSER_INPUT_MAX_HEIGHT = 128;
4347
+ var LONG_TEXT_REFERENCE_THRESHOLD = 5e3;
4348
+ async function readImageDimensions(file) {
4349
+ if (typeof window === "undefined" || typeof URL === "undefined") {
4350
+ return {};
4351
+ }
4352
+ return new Promise((resolve) => {
4353
+ const objectUrl = URL.createObjectURL(file);
4354
+ const image = new window.Image();
4355
+ const cleanup = () => {
4356
+ URL.revokeObjectURL(objectUrl);
4357
+ };
4358
+ image.onload = () => {
4359
+ resolve({
4360
+ width: image.naturalWidth || void 0,
4361
+ height: image.naturalHeight || void 0
4362
+ });
4363
+ cleanup();
4364
+ };
4365
+ image.onerror = () => {
4366
+ resolve({});
4367
+ cleanup();
4368
+ };
4369
+ image.src = objectUrl;
4370
+ });
4371
+ }
4372
+ function getStorageFileUrl(file) {
4373
+ return file.url ?? file.fileUrl ?? file.thumbUrl;
4374
+ }
4375
+ function buildPastedImageReference(file, storageFile, dimensions) {
4376
+ const name = storageFile.originalName?.trim() || file.name.trim() || "Pasted image";
4377
+ const mimeType = storageFile.mimetype?.trim() || file.type.trim() || "image/*";
4378
+ const size2 = storageFile.size ?? file.size;
4379
+ const width = dimensions?.width;
4380
+ const height = dimensions?.height;
4381
+ const metaParts = [
4382
+ mimeType,
4383
+ width && height ? `${width}x${height}` : null,
4384
+ typeof size2 === "number" ? `${size2} bytes` : null
4385
+ ].filter((part) => Boolean(part));
4386
+ return {
4387
+ type: "image",
4388
+ id: storageFile.id,
4389
+ fileId: storageFile.id,
4390
+ url: getStorageFileUrl(storageFile),
4391
+ mimeType,
4392
+ name,
4393
+ ...typeof size2 === "number" ? { size: size2 } : {},
4394
+ ...width ? { width } : {},
4395
+ ...height ? { height } : {},
4396
+ text: `Pasted image${metaParts.length ? ` (${metaParts.join(", ")})` : ""}: ${name}`
4397
+ };
4398
+ }
3670
4399
  function formatMessageContent(content) {
3671
4400
  if (typeof content === "string") {
3672
4401
  return content;
@@ -3703,8 +4432,8 @@ function ReferenceChip({
3703
4432
  }) {
3704
4433
  const metaLine = getReferenceMetaLine(reference);
3705
4434
  const isComposer = variant === "composer";
3706
- const Icon = reference.type === "quote" ? import_lucide_react10.Quote : import_lucide_react10.FileText;
3707
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
4435
+ const Icon = reference.type === "quote" ? import_lucide_react11.Quote : reference.type === "image" ? import_lucide_react11.ImageIcon : import_lucide_react11.FileText;
4436
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
3708
4437
  "div",
3709
4438
  {
3710
4439
  className: cn(
@@ -3713,7 +4442,7 @@ function ReferenceChip({
3713
4442
  ),
3714
4443
  title: getReferenceTitle(reference),
3715
4444
  children: [
3716
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4445
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3717
4446
  Icon,
3718
4447
  {
3719
4448
  size: isComposer ? 14 : 12,
@@ -3723,29 +4452,29 @@ function ReferenceChip({
3723
4452
  )
3724
4453
  }
3725
4454
  ),
3726
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "min-w-0 flex-1", children: [
3727
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4455
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "min-w-0 flex-1", children: [
4456
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3728
4457
  "div",
3729
4458
  {
3730
4459
  className: cn(
3731
- "truncate",
4460
+ "truncate whitespace-pre-wrap",
3732
4461
  isComposer ? "text-sm" : "text-xs font-medium"
3733
4462
  ),
3734
4463
  children: getReferenceLabel(reference)
3735
4464
  }
3736
4465
  ),
3737
- metaLine && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4466
+ metaLine && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3738
4467
  "div",
3739
4468
  {
3740
4469
  className: cn(
3741
- "truncate",
4470
+ "truncate whitespace-pre-wrap",
3742
4471
  isComposer ? "text-xs text-muted-foreground" : "text-[10px] text-primary-foreground/75"
3743
4472
  ),
3744
4473
  children: metaLine
3745
4474
  }
3746
4475
  )
3747
4476
  ] }),
3748
- onRemove && removeLabel && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4477
+ onRemove && removeLabel && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3749
4478
  "button",
3750
4479
  {
3751
4480
  type: "button",
@@ -3756,7 +4485,7 @@ function ReferenceChip({
3756
4485
  ),
3757
4486
  title: removeLabel,
3758
4487
  "aria-label": removeLabel,
3759
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react10.X, { size: 12 })
4488
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react11.X, { size: 12 })
3760
4489
  }
3761
4490
  )
3762
4491
  ]
@@ -3780,20 +4509,20 @@ function Chat({
3780
4509
  const { setStream } = useStreamManager();
3781
4510
  const stream = useStreamContext();
3782
4511
  const { theme } = useTheme();
3783
- const [isHistoryLoading, setIsHistoryLoading] = React21.useState(false);
3784
- const [historyError, setHistoryError] = React21.useState(null);
3785
- const [assistantName, setAssistantName] = React21.useState(null);
3786
- const [assistantAvatar, setAssistantAvatar] = React21.useState(null);
4512
+ const [isHistoryLoading, setIsHistoryLoading] = React22.useState(false);
4513
+ const [historyError, setHistoryError] = React22.useState(null);
4514
+ const [assistantName, setAssistantName] = React22.useState(null);
4515
+ const [assistantAvatar, setAssistantAvatar] = React22.useState(null);
3787
4516
  const LOADING_DOTS_MIN_DURATION = 800;
3788
4517
  const STREAMING_STATUS_REFRESH_MS = 250;
3789
- const [showLoadingDots, setShowLoadingDots] = React21.useState(false);
3790
- const [streamingNow, setStreamingNow] = React21.useState(() => Date.now());
3791
- const loadingStartTimeRef = React21.useRef(null);
3792
- const lastStreamOutputAtRef = React21.useRef(null);
3793
- React21.useEffect(() => {
4518
+ const [showLoadingDots, setShowLoadingDots] = React22.useState(false);
4519
+ const [streamingNow, setStreamingNow] = React22.useState(() => Date.now());
4520
+ const loadingStartTimeRef = React22.useRef(null);
4521
+ const lastStreamOutputAtRef = React22.useRef(null);
4522
+ React22.useEffect(() => {
3794
4523
  setStream(stream);
3795
4524
  }, [setStream, stream]);
3796
- React21.useEffect(() => {
4525
+ React22.useEffect(() => {
3797
4526
  if (stream.isLoading) {
3798
4527
  if (!loadingStartTimeRef.current) {
3799
4528
  loadingStartTimeRef.current = Date.now();
@@ -3816,7 +4545,7 @@ function Chat({
3816
4545
  }
3817
4546
  }
3818
4547
  }, [stream.isLoading]);
3819
- React21.useEffect(() => {
4548
+ React22.useEffect(() => {
3820
4549
  if (!stream.isLoading) {
3821
4550
  lastStreamOutputAtRef.current = null;
3822
4551
  setStreamingNow(Date.now());
@@ -3826,7 +4555,7 @@ function Chat({
3826
4555
  lastStreamOutputAtRef.current = now;
3827
4556
  setStreamingNow(now);
3828
4557
  }, [stream.messages, stream.isLoading]);
3829
- React21.useEffect(() => {
4558
+ React22.useEffect(() => {
3830
4559
  if (!stream.isLoading) {
3831
4560
  return;
3832
4561
  }
@@ -3835,51 +4564,52 @@ function Chat({
3835
4564
  }, STREAMING_STATUS_REFRESH_MS);
3836
4565
  return () => window.clearInterval(timer);
3837
4566
  }, [stream.isLoading]);
3838
- const [draft, setDraft] = React21.useState("");
3839
- const [selectedTool, setSelectedTool] = React21.useState(
4567
+ const [draft, setDraft] = React22.useState("");
4568
+ const [selectedTool, setSelectedTool] = React22.useState(
3840
4569
  null
3841
4570
  );
3842
- const [attachments, setAttachments] = React21.useState([]);
3843
- const [references, setReferences] = React21.useState([]);
3844
- const [quoteSelection, setQuoteSelection] = React21.useState(null);
3845
- const [isAtBottom, setIsAtBottom] = React21.useState(true);
3846
- const [hasUpdatesBelow, setHasUpdatesBelow] = React21.useState(false);
4571
+ const [attachments, setAttachments] = React22.useState([]);
4572
+ const [references, setReferences] = React22.useState([]);
4573
+ const [isUploadingReferenceImages, setIsUploadingReferenceImages] = React22.useState(false);
4574
+ const [quoteSelection, setQuoteSelection] = React22.useState(null);
4575
+ const [isAtBottom, setIsAtBottom] = React22.useState(true);
4576
+ const [hasUpdatesBelow, setHasUpdatesBelow] = React22.useState(false);
3847
4577
  const {
3848
4578
  threads,
3849
4579
  deleteThread,
3850
4580
  refreshThreads,
3851
4581
  isLoading: isThreadsLoading
3852
4582
  } = useThreads();
3853
- const viewportRef = React21.useRef(null);
3854
- const fileInputRef = React21.useRef(null);
3855
- const composerInputRef = React21.useRef(null);
3856
- const shouldAutoScrollRef = React21.useRef(true);
3857
- const forceFollowRef = React21.useRef(false);
3858
- const previousMessageCountRef = React21.useRef(0);
3859
- const previousScrollTopRef = React21.useRef(0);
3860
- const autoScrollFrameRef = React21.useRef(null);
3861
- const isPointerDownRef = React21.useRef(false);
3862
- const lastTouchYRef = React21.useRef(null);
4583
+ const viewportRef = React22.useRef(null);
4584
+ const fileInputRef = React22.useRef(null);
4585
+ const composerInputRef = React22.useRef(null);
4586
+ const shouldAutoScrollRef = React22.useRef(true);
4587
+ const forceFollowRef = React22.useRef(false);
4588
+ const previousMessageCountRef = React22.useRef(0);
4589
+ const previousScrollTopRef = React22.useRef(0);
4590
+ const autoScrollFrameRef = React22.useRef(null);
4591
+ const isPointerDownRef = React22.useRef(false);
4592
+ const lastTouchYRef = React22.useRef(null);
3863
4593
  const resolvedTitle = title ?? t("chat.title");
3864
4594
  const resolvedPlaceholder = placeholder ?? t("chat.placeholder");
3865
4595
  const inputPlaceholder = selectedTool?.placeholderOverride ?? composer?.placeholder ?? resolvedPlaceholder;
3866
- const messages = React21.useMemo(
4596
+ const messages = React22.useMemo(
3867
4597
  () => stream.messages ?? [],
3868
4598
  [stream.messages]
3869
4599
  );
3870
4600
  const trimmedDraft = draft.trim();
3871
4601
  const hasReferences = references.length > 0;
3872
- const pendingFollowUps = React21.useMemo(
4602
+ const pendingFollowUps = React22.useMemo(
3873
4603
  () => [...stream.pendingFollowUps ?? []].sort(
3874
4604
  (a, b) => a.createdAt - b.createdAt
3875
4605
  ),
3876
4606
  [stream.pendingFollowUps]
3877
4607
  );
3878
- const clearQuoteSelection = React21.useCallback(() => {
4608
+ const clearQuoteSelection = React22.useCallback(() => {
3879
4609
  setQuoteSelection(null);
3880
4610
  }, []);
3881
4611
  useParentMessenger({
3882
- onSetComposerValue: React21.useCallback(
4612
+ onSetComposerValue: React22.useCallback(
3883
4613
  (payload) => {
3884
4614
  if (!payload) {
3885
4615
  return;
@@ -3902,11 +4632,11 @@ function Chat({
3902
4632
  },
3903
4633
  [composer?.tools]
3904
4634
  ),
3905
- onFocusComposer: React21.useCallback(() => {
4635
+ onFocusComposer: React22.useCallback(() => {
3906
4636
  composerInputRef.current?.focus();
3907
4637
  }, [])
3908
4638
  });
3909
- const syncQuoteSelection = React21.useCallback(() => {
4639
+ const syncQuoteSelection = React22.useCallback(() => {
3910
4640
  if (typeof window === "undefined") {
3911
4641
  clearQuoteSelection();
3912
4642
  return;
@@ -3951,23 +4681,23 @@ function Chat({
3951
4681
  left
3952
4682
  });
3953
4683
  }, [clearQuoteSelection]);
3954
- const cancelPendingAutoScroll = React21.useCallback(() => {
4684
+ const cancelPendingAutoScroll = React22.useCallback(() => {
3955
4685
  if (autoScrollFrameRef.current !== null) {
3956
4686
  cancelAnimationFrame(autoScrollFrameRef.current);
3957
4687
  autoScrollFrameRef.current = null;
3958
4688
  }
3959
4689
  }, []);
3960
- const disableAutoFollow = React21.useCallback(() => {
4690
+ const disableAutoFollow = React22.useCallback(() => {
3961
4691
  forceFollowRef.current = false;
3962
4692
  shouldAutoScrollRef.current = false;
3963
4693
  cancelPendingAutoScroll();
3964
4694
  }, [cancelPendingAutoScroll]);
3965
- const enableAutoFollow = React21.useCallback(() => {
4695
+ const enableAutoFollow = React22.useCallback(() => {
3966
4696
  forceFollowRef.current = true;
3967
4697
  shouldAutoScrollRef.current = true;
3968
4698
  setHasUpdatesBelow(false);
3969
4699
  }, []);
3970
- const scrollToBottom = React21.useCallback(
4700
+ const scrollToBottom = React22.useCallback(
3971
4701
  (smooth = false, force = false) => {
3972
4702
  if (force) {
3973
4703
  enableAutoFollow();
@@ -3989,7 +4719,7 @@ function Chat({
3989
4719
  },
3990
4720
  [cancelPendingAutoScroll, enableAutoFollow]
3991
4721
  );
3992
- React21.useEffect(() => {
4722
+ React22.useEffect(() => {
3993
4723
  const viewport = viewportRef.current;
3994
4724
  if (!viewport) return;
3995
4725
  previousScrollTopRef.current = viewport.scrollTop;
@@ -4070,14 +4800,14 @@ function Chat({
4070
4800
  window.removeEventListener("pointercancel", stopPointerTracking);
4071
4801
  };
4072
4802
  }, [cancelPendingAutoScroll, disableAutoFollow]);
4073
- React21.useEffect(() => {
4803
+ React22.useEffect(() => {
4074
4804
  shouldAutoScrollRef.current = true;
4075
4805
  forceFollowRef.current = false;
4076
4806
  previousScrollTopRef.current = 0;
4077
4807
  setIsAtBottom(true);
4078
4808
  setHasUpdatesBelow(false);
4079
4809
  }, [stream.threadId]);
4080
- React21.useEffect(() => {
4810
+ React22.useEffect(() => {
4081
4811
  const messageCountChanged = messages.length !== previousMessageCountRef.current;
4082
4812
  previousMessageCountRef.current = messages.length;
4083
4813
  if (!shouldAutoScrollRef.current) {
@@ -4096,7 +4826,7 @@ function Chat({
4096
4826
  clientSecret: effectiveClientSecret
4097
4827
  });
4098
4828
  const missingConfig = Boolean(missingConfigKind);
4099
- const missingConfigShortMessage = React21.useMemo(() => {
4829
+ const missingConfigShortMessage = React22.useMemo(() => {
4100
4830
  switch (missingConfigKind) {
4101
4831
  case "apiUrl":
4102
4832
  return t("chat.missingApiUrlShort");
@@ -4108,7 +4838,7 @@ function Chat({
4108
4838
  return t("chat.missingConfigShort");
4109
4839
  }
4110
4840
  }, [missingConfigKind, t]);
4111
- const missingConfigDetailMessage = React21.useMemo(() => {
4841
+ const missingConfigDetailMessage = React22.useMemo(() => {
4112
4842
  switch (missingConfigKind) {
4113
4843
  case "apiUrl":
4114
4844
  return t("chat.missingApiUrlDetail");
@@ -4122,8 +4852,8 @@ function Chat({
4122
4852
  }, [missingConfigKind, t]);
4123
4853
  const showMissingConfig = !isClientSecretInitializing && missingConfig;
4124
4854
  const hasUploadingFiles = attachments.some((a) => a.status === "uploading");
4125
- const isSendDisabled = !trimmedDraft && !hasReferences || missingConfig || isHistoryLoading || hasUploadingFiles;
4126
- const resizeComposerInput = React21.useCallback(() => {
4855
+ const isSendDisabled = !trimmedDraft && !hasReferences || missingConfig || isHistoryLoading || hasUploadingFiles || isUploadingReferenceImages;
4856
+ const resizeComposerInput = React22.useCallback(() => {
4127
4857
  const textarea = composerInputRef.current;
4128
4858
  if (!textarea) {
4129
4859
  return;
@@ -4136,16 +4866,16 @@ function Chat({
4136
4866
  textarea.style.height = `${nextHeight}px`;
4137
4867
  textarea.style.overflowY = textarea.scrollHeight > COMPOSER_INPUT_MAX_HEIGHT ? "auto" : "hidden";
4138
4868
  }, []);
4139
- React21.useEffect(() => {
4869
+ React22.useEffect(() => {
4140
4870
  resizeComposerInput();
4141
4871
  }, [draft, resizeComposerInput]);
4142
- React21.useEffect(() => {
4872
+ React22.useEffect(() => {
4143
4873
  document.addEventListener("selectionchange", syncQuoteSelection);
4144
4874
  return () => {
4145
4875
  document.removeEventListener("selectionchange", syncQuoteSelection);
4146
4876
  };
4147
4877
  }, [syncQuoteSelection]);
4148
- React21.useEffect(() => {
4878
+ React22.useEffect(() => {
4149
4879
  const viewport = viewportRef.current;
4150
4880
  if (!viewport) {
4151
4881
  return;
@@ -4162,14 +4892,14 @@ function Chat({
4162
4892
  window.removeEventListener("resize", handleViewportScroll);
4163
4893
  };
4164
4894
  }, [clearQuoteSelection]);
4165
- React21.useEffect(() => {
4895
+ React22.useEffect(() => {
4166
4896
  clearQuoteSelection();
4167
4897
  }, [messages.length, stream.threadId, clearQuoteSelection]);
4168
- React21.useEffect(() => {
4898
+ React22.useEffect(() => {
4169
4899
  if (missingConfig) return;
4170
4900
  void refreshThreads();
4171
4901
  }, [missingConfig, refreshThreads]);
4172
- React21.useEffect(() => {
4902
+ React22.useEffect(() => {
4173
4903
  if (missingConfig || !stream.client || !stream.assistantId) {
4174
4904
  setAssistantName(null);
4175
4905
  setAssistantAvatar(null);
@@ -4200,7 +4930,7 @@ function Chat({
4200
4930
  mimetype: a.storageFile?.mimetype ?? a.file.type,
4201
4931
  size: a.storageFile?.size ?? a.file.size
4202
4932
  }));
4203
- const submitDraft = React21.useCallback(
4933
+ const submitDraft = React22.useCallback(
4204
4934
  (followUpOverride) => {
4205
4935
  if (isSendDisabled) return;
4206
4936
  const filesToSend = uploadedFiles.length > 0 ? [...uploadedFiles] : void 0;
@@ -4274,7 +5004,7 @@ function Chat({
4274
5004
  event.preventDefault();
4275
5005
  submitDraft();
4276
5006
  };
4277
- const handleEditPendingFollowUp = React21.useCallback(
5007
+ const handleEditPendingFollowUp = React22.useCallback(
4278
5008
  (id) => {
4279
5009
  const item = pendingFollowUps.find(
4280
5010
  (entry) => entry.id === id && entry.mode === "queue"
@@ -4301,7 +5031,7 @@ function Chat({
4301
5031
  },
4302
5032
  [pendingFollowUps, stream]
4303
5033
  );
4304
- const handleQuoteSelection = React21.useCallback(() => {
5034
+ const handleQuoteSelection = React22.useCallback(() => {
4305
5035
  if (!quoteSelection) {
4306
5036
  return;
4307
5037
  }
@@ -4317,21 +5047,14 @@ function Chat({
4317
5047
  const handleAttachmentClick = () => {
4318
5048
  fileInputRef.current?.click();
4319
5049
  };
5050
+ const uploadContextFile = React22.useCallback(
5051
+ (file) => stream.client.contexts.uploadFile(file),
5052
+ [stream.client]
5053
+ );
4320
5054
  const handleComposerKeyDown = (event) => {
4321
5055
  if (event.key !== "Enter") {
4322
5056
  return;
4323
5057
  }
4324
- if (event.shiftKey && (event.metaKey || event.ctrlKey)) {
4325
- if (event.nativeEvent.isComposing) {
4326
- return;
4327
- }
4328
- event.preventDefault();
4329
- if (isSendDisabled) {
4330
- return;
4331
- }
4332
- submitDraft(stream.followUpBehavior === "queue" ? "steer" : "queue");
4333
- return;
4334
- }
4335
5058
  if (event.shiftKey) {
4336
5059
  return;
4337
5060
  }
@@ -4342,12 +5065,108 @@ function Chat({
4342
5065
  if (isSendDisabled) {
4343
5066
  return;
4344
5067
  }
5068
+ if (stream.isLoading) {
5069
+ submitDraft(
5070
+ getBusyComposerShortcutFollowUpMode(event.metaKey || event.ctrlKey)
5071
+ );
5072
+ return;
5073
+ }
4345
5074
  submitDraft();
4346
5075
  };
4347
- const uploadFile = React21.useCallback(
5076
+ const handleComposerPaste = React22.useCallback(
5077
+ (event) => {
5078
+ const clipboardData = event.clipboardData;
5079
+ if (!clipboardData) {
5080
+ return;
5081
+ }
5082
+ const imageFiles = Array.from(clipboardData.items).filter(
5083
+ (item) => item.kind === "file" && item.type.startsWith("image/")
5084
+ ).map((item) => item.getAsFile()).filter((item) => Boolean(item));
5085
+ if (imageFiles.length > 0) {
5086
+ event.preventDefault();
5087
+ const maxCount = composer?.attachments?.maxCount ?? 10;
5088
+ const maxSize = composer?.attachments?.maxSize ?? 100 * 1024 * 1024;
5089
+ const currentImageReferenceCount = references.filter(
5090
+ (reference) => reference.type === "image"
5091
+ ).length;
5092
+ const availableSlots = Math.max(
5093
+ 0,
5094
+ maxCount - currentImageReferenceCount
5095
+ );
5096
+ const nextFiles = imageFiles.filter((file) => file.size <= maxSize).slice(0, availableSlots);
5097
+ if (nextFiles.length === 0) {
5098
+ return;
5099
+ }
5100
+ setIsUploadingReferenceImages(true);
5101
+ void Promise.allSettled(
5102
+ nextFiles.map(async (file) => {
5103
+ const [dimensions, storageFile] = await Promise.all([
5104
+ readImageDimensions(file),
5105
+ uploadContextFile(file)
5106
+ ]);
5107
+ return buildPastedImageReference(file, storageFile, dimensions);
5108
+ })
5109
+ ).then((results) => {
5110
+ const nextReferences = results.filter(
5111
+ (result) => result.status === "fulfilled"
5112
+ ).map((result) => result.value);
5113
+ if (nextReferences.length > 0) {
5114
+ setReferences(
5115
+ (previous) => mergeReferences(previous, nextReferences)
5116
+ );
5117
+ composerInputRef.current?.focus();
5118
+ }
5119
+ results.filter(
5120
+ (result) => result.status === "rejected"
5121
+ ).forEach((result) => {
5122
+ console.warn(
5123
+ "[Chat] Failed to upload pasted image reference:",
5124
+ result.reason
5125
+ );
5126
+ });
5127
+ }).finally(() => {
5128
+ setIsUploadingReferenceImages(false);
5129
+ });
5130
+ return;
5131
+ }
5132
+ const pastedText = clipboardData.getData("text/plain");
5133
+ if (pastedText.trim().length <= LONG_TEXT_REFERENCE_THRESHOLD) {
5134
+ return;
5135
+ }
5136
+ event.preventDefault();
5137
+ setReferences(
5138
+ (previous) => mergeReferences(previous, [
5139
+ {
5140
+ type: "quote",
5141
+ source: "Pasted text",
5142
+ text: pastedText
5143
+ }
5144
+ ])
5145
+ );
5146
+ composerInputRef.current?.focus();
5147
+ },
5148
+ [
5149
+ composer?.attachments?.maxCount,
5150
+ composer?.attachments?.maxSize,
5151
+ references,
5152
+ uploadContextFile
5153
+ ]
5154
+ );
5155
+ const alternateFollowUpShortcutLabel = React22.useMemo(() => {
5156
+ if (typeof navigator === "undefined") {
5157
+ return "\u2318Enter";
5158
+ }
5159
+ const platform = navigator.platform || navigator.userAgent;
5160
+ return /Mac|iPhone|iPad|iPod/i.test(platform) ? "\u2318Enter" : "Ctrl+Enter";
5161
+ }, []);
5162
+ const followUpShortcutLabels = React22.useMemo(
5163
+ () => getComposerFollowUpShortcutLabels(alternateFollowUpShortcutLabel),
5164
+ [alternateFollowUpShortcutLabel]
5165
+ );
5166
+ const uploadFile = React22.useCallback(
4348
5167
  async (localId, file) => {
4349
5168
  try {
4350
- const result = await stream.client.contexts.uploadFile(file);
5169
+ const result = await uploadContextFile(file);
4351
5170
  setAttachments(
4352
5171
  (prev) => prev.map(
4353
5172
  (item) => item.localId === localId ? { ...item, status: "success", storageFile: result } : item
@@ -4365,9 +5184,9 @@ function Chat({
4365
5184
  );
4366
5185
  }
4367
5186
  },
4368
- [stream.client]
5187
+ [uploadContextFile]
4369
5188
  );
4370
- const handleRetryUpload = React21.useCallback(
5189
+ const handleRetryUpload = React22.useCallback(
4371
5190
  (localId) => {
4372
5191
  const attachment = attachments.find((a) => a.localId === localId);
4373
5192
  if (!attachment || attachment.status !== "error") return;
@@ -4452,7 +5271,7 @@ function Chat({
4452
5271
  );
4453
5272
  scrollToBottom(true, true);
4454
5273
  };
4455
- const loadConversationMessages = React21.useCallback(
5274
+ const loadConversationMessages = React22.useCallback(
4456
5275
  async (recordId) => {
4457
5276
  if (missingConfig) {
4458
5277
  setHistoryError(missingConfigShortMessage);
@@ -4538,18 +5357,18 @@ function Chat({
4538
5357
  }
4539
5358
  };
4540
5359
  const acceptMimes = composer?.attachments?.accept ? Object.entries(composer.attachments.accept).map(([mime, exts]) => [mime, ...exts.map((e) => `.${e}`)].join(",")).join(",") : void 0;
4541
- const currentThread = React21.useMemo(
5360
+ const currentThread = React22.useMemo(
4542
5361
  () => threads.find((item) => item.id === stream.threadId),
4543
5362
  [threads, stream.threadId]
4544
5363
  );
4545
5364
  const errorMessage = stream.error instanceof Error ? stream.error.message : void 0;
4546
- const threadErrorMessage = React21.useMemo(() => {
5365
+ const threadErrorMessage = React22.useMemo(() => {
4547
5366
  if (currentThread?.status !== "error") return void 0;
4548
5367
  const message = currentThread.error?.trim();
4549
5368
  return message || t("thread.errorToast");
4550
5369
  }, [currentThread, t]);
4551
5370
  const assistantTitle = assistantName || resolvedTitle;
4552
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5371
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4553
5372
  "div",
4554
5373
  {
4555
5374
  ref: viewportRef,
@@ -4558,10 +5377,10 @@ function Chat({
4558
5377
  className
4559
5378
  ),
4560
5379
  children: [
4561
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
4562
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
4563
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative shrink-0", children: [
4564
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5380
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center justify-between border-b p-2 sticky top-0 z-10 bg-background", children: [
5381
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-3 overflow-hidden", children: [
5382
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "relative shrink-0", children: [
5383
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4565
5384
  ChatkitAvatar,
4566
5385
  {
4567
5386
  avatar: assistantAvatar,
@@ -4569,10 +5388,10 @@ function Chat({
4569
5388
  label: assistantTitle
4570
5389
  }
4571
5390
  ),
4572
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
5391
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full border-2 border-background bg-green-500" })
4573
5392
  ] }),
4574
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "truncate", children: [
4575
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5393
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "truncate", children: [
5394
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4576
5395
  "h2",
4577
5396
  {
4578
5397
  className: "text-lg font-semibold truncate",
@@ -4580,11 +5399,11 @@ function Chat({
4580
5399
  children: assistantTitle
4581
5400
  }
4582
5401
  ),
4583
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
5402
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("p", { className: "text-xs text-muted-foreground", children: t("chat.statusOnline") })
4584
5403
  ] })
4585
5404
  ] }),
4586
- history?.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1", children: [
4587
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5405
+ history?.enabled !== false && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex items-center gap-1", children: [
5406
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4588
5407
  "button",
4589
5408
  {
4590
5409
  type: "button",
@@ -4597,10 +5416,10 @@ function Chat({
4597
5416
  "disabled:opacity-50 disabled:cursor-not-allowed"
4598
5417
  ),
4599
5418
  title: t("history.newThread"),
4600
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react10.Pencil, { size: 16 })
5419
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react11.Pencil, { size: 16 })
4601
5420
  }
4602
5421
  ),
4603
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5422
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4604
5423
  HistorySidebar,
4605
5424
  {
4606
5425
  threads,
@@ -4614,18 +5433,18 @@ function Chat({
4614
5433
  )
4615
5434
  ] })
4616
5435
  ] }),
4617
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex-1 p-4", children: [
4618
- errorMessage && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
4619
- historyError && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
4620
- showMissingConfig && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
4621
- isHistoryLoading && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
4622
- messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5436
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex-1 p-4", children: [
5437
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-4 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: errorMessage }),
5438
+ historyError && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: historyError }),
5439
+ showMissingConfig && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900", children: missingConfigDetailMessage }),
5440
+ isHistoryLoading && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-4 rounded-lg border border-muted px-3 py-2 text-sm text-muted-foreground", children: t("chat.loadingThread") }),
5441
+ messages.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4623
5442
  StartScreen,
4624
5443
  {
4625
5444
  startScreen,
4626
5445
  onPromptClick: handlePromptClick
4627
5446
  }
4628
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-4", children: [
5447
+ ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "space-y-4", children: [
4629
5448
  messages.map((message, index) => {
4630
5449
  const messageType = String(message.type);
4631
5450
  const isAssistantMessage = messageType === "assistant" || messageType === "ai";
@@ -4652,7 +5471,7 @@ function Chat({
4652
5471
  if (!isAssistantMessage && !hasPlainRenderableContent && !hasHumanAttachments && humanReferences.length === 0) {
4653
5472
  return null;
4654
5473
  }
4655
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5474
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4656
5475
  "div",
4657
5476
  {
4658
5477
  className: cn(
@@ -4660,8 +5479,8 @@ function Chat({
4660
5479
  message.type === "human" ? "justify-end" : "justify-start -ml-1"
4661
5480
  // AI messages: slightly closer to left
4662
5481
  ),
4663
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col px-3 overflow-hidden", children: [
4664
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5482
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col px-3 overflow-hidden", children: [
5483
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4665
5484
  "div",
4666
5485
  {
4667
5486
  ...canQuoteMessage ? {
@@ -4673,7 +5492,7 @@ function Chat({
4673
5492
  message.type === "human" ? "bg-primary text-primary-foreground px-4 py-2.5" : message.type === "system" ? "bg-muted text-muted-foreground text-xs px-4 py-2.5" : "py-1 text-chat-foreground"
4674
5493
  // AI messages: use chat-specific foreground color
4675
5494
  ),
4676
- children: isAssistantMessage ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5495
+ children: isAssistantMessage ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4677
5496
  AssistantMessage,
4678
5497
  {
4679
5498
  message: {
@@ -4683,8 +5502,8 @@ function Chat({
4683
5502
  isStreaming: isStreamingMessage,
4684
5503
  streamingStatus
4685
5504
  }
4686
- ) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
4687
- message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5505
+ ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
5506
+ message.type === "human" && humanReferences.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-2 flex flex-wrap gap-1.5", children: humanReferences.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4688
5507
  ReferenceChip,
4689
5508
  {
4690
5509
  reference,
@@ -4692,29 +5511,29 @@ function Chat({
4692
5511
  },
4693
5512
  getReferenceKey(reference)
4694
5513
  )) }),
4695
- message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5514
+ message.type === "human" && humanAttachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex flex-wrap gap-1.5 mb-2", children: humanAttachments.map((file, fileIndex) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4696
5515
  "div",
4697
5516
  {
4698
5517
  className: "flex items-center gap-1.5 rounded-md bg-primary-foreground/20 px-2 py-1 text-xs",
4699
5518
  children: [
4700
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react10.FileText, { size: 12 }),
4701
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "max-w-[100px] truncate", children: file.originalName })
5519
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react11.FileText, { size: 12 }),
5520
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "max-w-[100px] truncate", children: file.originalName })
4702
5521
  ]
4703
5522
  },
4704
5523
  fileIndex
4705
5524
  )) }),
4706
- Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5525
+ Array.isArray(message.content) ? message.content.map((part, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4707
5526
  "p",
4708
5527
  {
4709
5528
  className: "wrap-break-word text-sm leading-relaxed",
4710
5529
  children: formatMessageContent(part)
4711
5530
  },
4712
5531
  `${part.type}-${partIndex}`
4713
- )) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
5532
+ )) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "wrap-break-word text-sm leading-relaxed", children: formatMessageContent(message.content) })
4714
5533
  ] })
4715
5534
  }
4716
5535
  ),
4717
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5536
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4718
5537
  MessageActions,
4719
5538
  {
4720
5539
  content: messageContent,
@@ -4750,7 +5569,7 @@ function Chat({
4750
5569
  stream.isLoading,
4751
5570
  { now: streamingNow }
4752
5571
  );
4753
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5572
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex justify-start gap-3 -ml-2", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "max-w-full rounded-2xl py-2.5", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4754
5573
  AssistantStreamingIndicator,
4755
5574
  {
4756
5575
  status: fallbackStreamingStatus ?? "loading"
@@ -4759,7 +5578,7 @@ function Chat({
4759
5578
  })()
4760
5579
  ] })
4761
5580
  ] }),
4762
- !isAtBottom && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5581
+ !isAtBottom && messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "sticky bottom-20 z-20 flex justify-center px-4 pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4763
5582
  Button,
4764
5583
  {
4765
5584
  type: "button",
@@ -4772,10 +5591,10 @@ function Chat({
4772
5591
  onClick: () => scrollToBottom(true, true),
4773
5592
  "aria-label": t("chat.scrollToBottom"),
4774
5593
  title: t("chat.scrollToBottom"),
4775
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react10.ArrowDown, { size: 16 })
5594
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react11.ArrowDown, { size: 16 })
4776
5595
  }
4777
5596
  ) }),
4778
- quoteSelection && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5597
+ quoteSelection && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4779
5598
  "div",
4780
5599
  {
4781
5600
  className: "pointer-events-none fixed z-50",
@@ -4784,7 +5603,7 @@ function Chat({
4784
5603
  left: `${quoteSelection.left}px`,
4785
5604
  transform: "translateX(-50%)"
4786
5605
  },
4787
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5606
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4788
5607
  Button,
4789
5608
  {
4790
5609
  type: "button",
@@ -4796,16 +5615,16 @@ function Chat({
4796
5615
  "aria-label": t("composer.quoteSelection"),
4797
5616
  title: t("composer.quoteSelection"),
4798
5617
  children: [
4799
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react10.Quote, { size: 14 }),
5618
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react11.Quote, { size: 14 }),
4800
5619
  t("composer.quoteSelection")
4801
5620
  ]
4802
5621
  }
4803
5622
  )
4804
5623
  }
4805
5624
  ),
4806
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
4807
- threadErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mb-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive overflow-auto", children: threadErrorMessage }),
4808
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5625
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "p-2 sticky bottom-0 z-10 bg-background", children: [
5626
+ threadErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive overflow-auto", children: threadErrorMessage }),
5627
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4809
5628
  "input",
4810
5629
  {
4811
5630
  ref: fileInputRef,
@@ -4816,7 +5635,7 @@ function Chat({
4816
5635
  className: "hidden"
4817
5636
  }
4818
5637
  ),
4819
- attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: attachments.map((item) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5638
+ attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: attachments.map((item) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4820
5639
  "div",
4821
5640
  {
4822
5641
  className: cn(
@@ -4824,16 +5643,16 @@ function Chat({
4824
5643
  item.status === "error" ? "bg-destructive/10 border border-destructive/30" : "bg-muted"
4825
5644
  ),
4826
5645
  children: [
4827
- item.status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4828
- import_lucide_react10.Loader2,
5646
+ item.status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5647
+ import_lucide_react11.Loader2,
4829
5648
  {
4830
5649
  size: 14,
4831
5650
  className: "animate-spin text-muted-foreground"
4832
5651
  }
4833
5652
  ),
4834
- item.status === "success" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react10.FileText, { size: 14, className: "text-muted-foreground" }),
4835
- item.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react10.FileText, { size: 14, className: "text-destructive" }),
4836
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5653
+ item.status === "success" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react11.FileText, { size: 14, className: "text-muted-foreground" }),
5654
+ item.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react11.FileText, { size: 14, className: "text-destructive" }),
5655
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4837
5656
  "span",
4838
5657
  {
4839
5658
  className: cn(
@@ -4843,17 +5662,17 @@ function Chat({
4843
5662
  children: item.file.name
4844
5663
  }
4845
5664
  ),
4846
- item.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5665
+ item.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4847
5666
  "button",
4848
5667
  {
4849
5668
  type: "button",
4850
5669
  onClick: () => handleRetryUpload(item.localId),
4851
5670
  className: "ml-1 rounded-full p-0.5 text-destructive hover:bg-destructive/20",
4852
5671
  title: t("chat.retryUpload"),
4853
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react10.RefreshCw, { size: 12 })
5672
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react11.RefreshCw, { size: 12 })
4854
5673
  }
4855
5674
  ),
4856
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5675
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4857
5676
  "button",
4858
5677
  {
4859
5678
  type: "button",
@@ -4862,14 +5681,14 @@ function Chat({
4862
5681
  "ml-1 rounded-full p-0.5",
4863
5682
  item.status === "error" ? "text-destructive hover:bg-destructive/20" : "hover:bg-muted-foreground/20"
4864
5683
  ),
4865
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react10.X, { size: 12 })
5684
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react11.X, { size: 12 })
4866
5685
  }
4867
5686
  )
4868
5687
  ]
4869
5688
  },
4870
5689
  item.localId
4871
5690
  )) }),
4872
- references.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5691
+ references.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mb-3 flex flex-wrap gap-2", children: references.map((reference) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4873
5692
  ReferenceChip,
4874
5693
  {
4875
5694
  reference,
@@ -4883,19 +5702,19 @@ function Chat({
4883
5702
  },
4884
5703
  getReferenceKey(reference)
4885
5704
  )) }),
4886
- selectedTool && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "mb-2 flex items-center gap-2", children: [
4887
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary", children: selectedTool.shortLabel ?? selectedTool.label }),
4888
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5705
+ selectedTool && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mb-2 flex items-center gap-2", children: [
5706
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary", children: selectedTool.shortLabel ?? selectedTool.label }),
5707
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4889
5708
  "button",
4890
5709
  {
4891
5710
  type: "button",
4892
5711
  onClick: () => setSelectedTool(null),
4893
5712
  className: "rounded-full p-0.5 text-muted-foreground hover:bg-muted",
4894
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react10.X, { size: 12 })
5713
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react11.X, { size: 12 })
4895
5714
  }
4896
5715
  )
4897
5716
  ] }),
4898
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5717
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4899
5718
  PendingFollowUps,
4900
5719
  {
4901
5720
  items: pendingFollowUps,
@@ -4909,7 +5728,7 @@ function Chat({
4909
5728
  onRemove: stream.removePendingFollowUp
4910
5729
  }
4911
5730
  ),
4912
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
5731
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("form", { className: "flex items-end", onSubmit: handleSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4913
5732
  "div",
4914
5733
  {
4915
5734
  className: cn(
@@ -4921,7 +5740,7 @@ function Chat({
4921
5740
  getRoundedClass(theme.radius)
4922
5741
  ),
4923
5742
  children: [
4924
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5743
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4925
5744
  ComposerMenu,
4926
5745
  {
4927
5746
  composer,
@@ -4931,12 +5750,13 @@ function Chat({
4931
5750
  disabled: missingConfig || isHistoryLoading
4932
5751
  }
4933
5752
  ),
4934
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5753
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4935
5754
  "textarea",
4936
5755
  {
4937
5756
  ref: composerInputRef,
4938
5757
  value: draft,
4939
5758
  onChange: (event) => setDraft(event.target.value),
5759
+ onPaste: handleComposerPaste,
4940
5760
  onKeyDown: handleComposerKeyDown,
4941
5761
  rows: 1,
4942
5762
  placeholder: inputPlaceholder,
@@ -4948,7 +5768,7 @@ function Chat({
4948
5768
  )
4949
5769
  }
4950
5770
  ),
4951
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5771
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4952
5772
  SendButton,
4953
5773
  {
4954
5774
  disabled: isSendDisabled,
@@ -4956,13 +5776,23 @@ function Chat({
4956
5776
  showStop: stream.isLoading && !trimmedDraft,
4957
5777
  onStop: () => stream.stop(),
4958
5778
  stopLabel: t("chat.stop"),
4959
- sendLabel: t("chat.send")
5779
+ sendLabel: t("chat.send"),
5780
+ shortcuts: stream.isLoading && trimmedDraft ? [
5781
+ {
5782
+ label: t("chat.followUps.steer"),
5783
+ keys: followUpShortcutLabels.steer
5784
+ },
5785
+ {
5786
+ label: t("chat.followUps.queue"),
5787
+ keys: followUpShortcutLabels.queue
5788
+ }
5789
+ ] : void 0
4960
5790
  }
4961
5791
  )
4962
5792
  ]
4963
5793
  }
4964
5794
  ) }),
4965
- disclaimer?.text && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
5795
+ disclaimer?.text && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4966
5796
  "p",
4967
5797
  {
4968
5798
  className: cn(
@@ -4972,9 +5802,9 @@ function Chat({
4972
5802
  children: disclaimer.text
4973
5803
  }
4974
5804
  ),
4975
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
4976
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { children: t("chat.poweredBy") }),
4977
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContextUsageIndicator, { className: "absolute right-4" })
5805
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground", children: [
5806
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children: t("chat.poweredBy") }),
5807
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(ContextUsageIndicator, { className: "absolute right-4" })
4978
5808
  ] })
4979
5809
  ] })
4980
5810
  ]
@@ -4983,11 +5813,11 @@ function Chat({
4983
5813
  }
4984
5814
 
4985
5815
  // src/components/ui/input.tsx
4986
- var React22 = __toESM(require("react"), 1);
4987
- var import_jsx_runtime28 = require("react/jsx-runtime");
4988
- var Input = React22.forwardRef(
5816
+ var React23 = __toESM(require("react"), 1);
5817
+ var import_jsx_runtime29 = require("react/jsx-runtime");
5818
+ var Input = React23.forwardRef(
4989
5819
  ({ className, type, ...props }, ref) => {
4990
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
5820
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4991
5821
  "input",
4992
5822
  {
4993
5823
  ref,
@@ -5004,10 +5834,10 @@ var Input = React22.forwardRef(
5004
5834
  Input.displayName = "Input";
5005
5835
 
5006
5836
  // src/components/ui/separator.tsx
5007
- var React23 = __toESM(require("react"), 1);
5008
- var import_jsx_runtime29 = require("react/jsx-runtime");
5009
- var Separator = React23.forwardRef(
5010
- ({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5837
+ var React24 = __toESM(require("react"), 1);
5838
+ var import_jsx_runtime30 = require("react/jsx-runtime");
5839
+ var Separator = React24.forwardRef(
5840
+ ({ className, orientation = "horizontal", ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
5011
5841
  "div",
5012
5842
  {
5013
5843
  ref,