dimcode-web 0.0.0-stage → 0.1.0-alpha.4

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 (218) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +13 -4
  3. package/release-manifest.json +227 -0
  4. package/web/assets/CodeBlockNode-dNQRJI7x.js +43 -0
  5. package/web/assets/PreCodeBlock-D6Vrdwmh.js +1 -0
  6. package/web/assets/Tooltip-ZLwIccO5.js +1 -0
  7. package/web/assets/andromeeda-C4gqWexZ.js +1 -0
  8. package/web/assets/angular-html-BpR8Pn47.js +1 -0
  9. package/web/assets/arc-DPLvnfEZ.js +1 -0
  10. package/web/assets/architectureDiagram-3BPJPVTR-Dp46r6qo.js +36 -0
  11. package/web/assets/aurora-x-D-2ljcwZ.js +1 -0
  12. package/web/assets/ayu-dark-DYE7WIF3.js +1 -0
  13. package/web/assets/ayu-light-BA47KaF1.js +1 -0
  14. package/web/assets/ayu-mirage-32ctXXKs.js +1 -0
  15. package/web/assets/blockDiagram-GPEHLZMM-CNkSu7fi.js +132 -0
  16. package/web/assets/c-BIGW1oBm.js +1 -0
  17. package/web/assets/c4Diagram-AAUBKEIU-CQpKn4Qu.js +10 -0
  18. package/web/assets/catppuccin-frappe-DFWUc33u.js +1 -0
  19. package/web/assets/catppuccin-latte-C9dUb6Cb.js +1 -0
  20. package/web/assets/catppuccin-macchiato-DQyhUUbL.js +1 -0
  21. package/web/assets/catppuccin-mocha-D87Tk5Gz.js +1 -0
  22. package/web/assets/channel-CJ35sLov.js +1 -0
  23. package/web/assets/chunk-2J33WTMH-UvZy7f86.js +1 -0
  24. package/web/assets/chunk-4BX2VUAB-BeOeLZBs.js +1 -0
  25. package/web/assets/chunk-55IACEB6-BMehs481.js +1 -0
  26. package/web/assets/chunk-727SXJPM-BRrHfUVX.js +206 -0
  27. package/web/assets/chunk-AQP2D5EJ-DlFPEC70.js +231 -0
  28. package/web/assets/chunk-FMBD7UC4-BmrNedMT.js +15 -0
  29. package/web/assets/chunk-ND2GUHAM-BktGAoA7.js +1 -0
  30. package/web/assets/chunk-QZHKN3VN-Cn0Ufw6g.js +1 -0
  31. package/web/assets/classDiagram-4FO5ZUOK-CjlBIWs5.js +1 -0
  32. package/web/assets/classDiagram-v2-Q7XG4LA2-CjlBIWs5.js +1 -0
  33. package/web/assets/cmake-D1j8_8rp.js +1 -0
  34. package/web/assets/cose-bilkent-S5V4N54A-Bg8zNVyQ.js +1 -0
  35. package/web/assets/cpp-B-lmv-kZ.js +1 -0
  36. package/web/assets/csharp-COcwbKMJ.js +1 -0
  37. package/web/assets/css-DPfMkruS.js +1 -0
  38. package/web/assets/csv-fuZLfV_i.js +1 -0
  39. package/web/assets/cynefin-OW5HDTMX-DK7JR-k7.js +178 -0
  40. package/web/assets/cytoscape.esm-Ix0LnXOy.js +331 -0
  41. package/web/assets/dagre-BM42HDAG-BH4Aku3T.js +4 -0
  42. package/web/assets/dark-plus-C3mMm8J8.js +1 -0
  43. package/web/assets/defaultLocale-DX6XiGOO.js +1 -0
  44. package/web/assets/diagram-2AECGRRQ-C8nUJJQE.js +43 -0
  45. package/web/assets/diagram-5GNKFQAL-PvBz3O1i.js +10 -0
  46. package/web/assets/diagram-KO2AKTUF-CLJk2tgT.js +3 -0
  47. package/web/assets/diagram-LMA3HP47-XYR2Iaou.js +24 -0
  48. package/web/assets/diagram-OG6HWLK6-C6TwDtIj.js +24 -0
  49. package/web/assets/diff-D97Zzqfu.js +1 -0
  50. package/web/assets/docker-BcOcwvcX.js +1 -0
  51. package/web/assets/dracula-BzJJZx-M.js +1 -0
  52. package/web/assets/dracula-soft-BXkSAIEj.js +1 -0
  53. package/web/assets/elixir-CDX3lj18.js +1 -0
  54. package/web/assets/erDiagram-TEJ5UH35-D0IvMBhT.js +85 -0
  55. package/web/assets/erlang-DsQrWhSR.js +1 -0
  56. package/web/assets/everforest-dark-BgDCqdQA.js +1 -0
  57. package/web/assets/everforest-light-C8M2exoo.js +1 -0
  58. package/web/assets/extended-p72mFE2C.js +1 -0
  59. package/web/assets/floating-ui.dom-rMPa4aDr.js +1 -0
  60. package/web/assets/flowDiagram-I6XJVG4X-DCcPqJtr.js +162 -0
  61. package/web/assets/ganttDiagram-6RSMTGT7-Dd6jNilZ.js +292 -0
  62. package/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
  63. package/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
  64. package/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
  65. package/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
  66. package/web/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
  67. package/web/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
  68. package/web/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
  69. package/web/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
  70. package/web/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
  71. package/web/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
  72. package/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
  73. package/web/assets/gitGraphDiagram-PVQCEYII-dLEYc9sf.js +106 -0
  74. package/web/assets/github-dark-DHJKELXO.js +1 -0
  75. package/web/assets/github-dark-default-Cuk6v7N8.js +1 -0
  76. package/web/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
  77. package/web/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
  78. package/web/assets/github-light-DAi9KRSo.js +1 -0
  79. package/web/assets/github-light-default-D7oLnXFd.js +1 -0
  80. package/web/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
  81. package/web/assets/go-CxLEBnE3.js +1 -0
  82. package/web/assets/graph-CAnANduQ.js +1 -0
  83. package/web/assets/graphql-ChdNCCLP.js +1 -0
  84. package/web/assets/groovy-gcz8RCvz.js +1 -0
  85. package/web/assets/gruvbox-dark-hard-CFHQjOhq.js +1 -0
  86. package/web/assets/gruvbox-dark-medium-GsRaNv29.js +1 -0
  87. package/web/assets/gruvbox-dark-soft-CVdnzihN.js +1 -0
  88. package/web/assets/gruvbox-light-hard-CH1njM8p.js +1 -0
  89. package/web/assets/gruvbox-light-medium-DRw_LuNl.js +1 -0
  90. package/web/assets/gruvbox-light-soft-hJgmCMqR.js +1 -0
  91. package/web/assets/haskell-Df6bDoY_.js +1 -0
  92. package/web/assets/hcl-BWvSN4gD.js +1 -0
  93. package/web/assets/horizon-BUw7H-hv.js +1 -0
  94. package/web/assets/horizon-bright-Cn-bp-IR.js +1 -0
  95. package/web/assets/houston-DnULxvSX.js +1 -0
  96. package/web/assets/html-GMplVEZG.js +1 -0
  97. package/web/assets/index-BdrW2KdJ.js +173 -0
  98. package/web/assets/index-CeeeNh8y.css +1 -0
  99. package/web/assets/index-RuQTkZJb.js +220 -0
  100. package/web/assets/index-sbvImgCO.js +329 -0
  101. package/web/assets/index10-CYBa-X9L.js +8 -0
  102. package/web/assets/index5-0ddz3aZZ.js +1 -0
  103. package/web/assets/index6-sINF5Zn7.js +1 -0
  104. package/web/assets/index8-DOHEQLGI.js +2 -0
  105. package/web/assets/index9-BBZwrvIj.js +1 -0
  106. package/web/assets/infoDiagram-5YYISTIA-CsYbsXnr.js +2 -0
  107. package/web/assets/ini-BEwlwnbL.js +1 -0
  108. package/web/assets/init-Gi6I4Gst.js +1 -0
  109. package/web/assets/ishikawaDiagram-YF4QCWOH-BRTrHa87.js +70 -0
  110. package/web/assets/java-CylS5w8V.js +1 -0
  111. package/web/assets/javascript-wDzz0qaB.js +1 -0
  112. package/web/assets/journeyDiagram-JHISSGLW-CA4FF1Bb.js +139 -0
  113. package/web/assets/json-Cp-IABpG.js +1 -0
  114. package/web/assets/json5-C9tS-k6U.js +1 -0
  115. package/web/assets/jsonc-Des-eS-w.js +1 -0
  116. package/web/assets/jsx-g9-lgVsj.js +1 -0
  117. package/web/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
  118. package/web/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
  119. package/web/assets/kanagawa-wave-DWedfzmr.js +1 -0
  120. package/web/assets/kanban-definition-UN3LZRKU-CUj3vX_Y.js +89 -0
  121. package/web/assets/katex-C5jXJg4s.js +257 -0
  122. package/web/assets/kotlin-BdnUsdx6.js +1 -0
  123. package/web/assets/laserwave-DUszq2jm.js +1 -0
  124. package/web/assets/latex-CR2LgHuU.js +1 -0
  125. package/web/assets/layout-DGIYPm2g.js +1 -0
  126. package/web/assets/layout-DloY-SLW.js +4 -0
  127. package/web/assets/light-plus-B7mTdjB0.js +1 -0
  128. package/web/assets/linear-DJ-jo7u7.js +1 -0
  129. package/web/assets/lua-BaeVxFsk.js +1 -0
  130. package/web/assets/make-CHLpvVh8.js +1 -0
  131. package/web/assets/markdown-Cvjx9yec.js +1 -0
  132. package/web/assets/markstream-CzP-U2lR.js +7 -0
  133. package/web/assets/material-theme-D5KoaKCx.js +1 -0
  134. package/web/assets/material-theme-darker-BfHTSMKl.js +1 -0
  135. package/web/assets/material-theme-lighter-B0m2ddpp.js +1 -0
  136. package/web/assets/material-theme-ocean-CyktbL80.js +1 -0
  137. package/web/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
  138. package/web/assets/mermaid.core-BvSKTRe8.js +309 -0
  139. package/web/assets/mhchem-MNFFEueS.js +1 -0
  140. package/web/assets/min-dark-CafNBF8u.js +1 -0
  141. package/web/assets/min-light-CTRr51gU.js +1 -0
  142. package/web/assets/mindmap-definition-RKZ34NQL-h3AulNua.js +96 -0
  143. package/web/assets/monokai-D4h5O-jR.js +1 -0
  144. package/web/assets/nginx-BpAMiNFr.js +1 -0
  145. package/web/assets/night-owl-C39BiMTA.js +1 -0
  146. package/web/assets/night-owl-light-CMTm3GFP.js +1 -0
  147. package/web/assets/nord-Ddv68eIx.js +1 -0
  148. package/web/assets/objective-c-DXmwc3jG.js +1 -0
  149. package/web/assets/one-dark-pro-DVMEJ2y_.js +1 -0
  150. package/web/assets/one-light-C3Wv6jpd.js +1 -0
  151. package/web/assets/ordinal-Cboi1Yqb.js +1 -0
  152. package/web/assets/perl-C0TMdlhV.js +1 -0
  153. package/web/assets/php-Dhbhpdrm.js +1 -0
  154. package/web/assets/pieDiagram-4H26LBE5-CPpwBWjO.js +30 -0
  155. package/web/assets/pierre-dark-CyvmCCZW.js +1 -0
  156. package/web/assets/pierre-dark-protanopia-deuteranopia-Rgc0TwpF.js +1 -0
  157. package/web/assets/pierre-dark-soft-BHGpRqa4.js +1 -0
  158. package/web/assets/pierre-dark-tritanopia-Beq2gCRQ.js +1 -0
  159. package/web/assets/pierre-dark-vibrant-BWBVywrn.js +1 -0
  160. package/web/assets/pierre-light-480U9XYS.js +1 -0
  161. package/web/assets/pierre-light-protanopia-deuteranopia-CaVOBURG.js +1 -0
  162. package/web/assets/pierre-light-soft-CVdyfjmI.js +1 -0
  163. package/web/assets/pierre-light-tritanopia-B4_gpKOM.js +1 -0
  164. package/web/assets/pierre-light-vibrant-DdTDNdfJ.js +1 -0
  165. package/web/assets/plastic-3e1v2bzS.js +1 -0
  166. package/web/assets/poimandres-CS3Unz2-.js +1 -0
  167. package/web/assets/powershell-Dpen1YoG.js +1 -0
  168. package/web/assets/preCodeDiffMetrics-6xZ6qvnP.js +1 -0
  169. package/web/assets/proto-C7zT0LnQ.js +1 -0
  170. package/web/assets/python-B6aJPvgy.js +1 -0
  171. package/web/assets/quadrantDiagram-W4KKPZXB-BnLu4itc.js +7 -0
  172. package/web/assets/r-Dspwwk_N.js +1 -0
  173. package/web/assets/red-bN70gL4F.js +1 -0
  174. package/web/assets/regexp-CDVJQ6XC.js +1 -0
  175. package/web/assets/requirementDiagram-4Y6WPE33-jUcosDJE.js +84 -0
  176. package/web/assets/rose-pine-dawn-DHQR4-dF.js +1 -0
  177. package/web/assets/rose-pine-moon-D4_iv3hh.js +1 -0
  178. package/web/assets/rose-pine-qdsjHGoJ.js +1 -0
  179. package/web/assets/ruby-BymL1q8G.js +1 -0
  180. package/web/assets/rust-B1yitclQ.js +1 -0
  181. package/web/assets/sankeyDiagram-5OEKKPKP-DSLSRtBi.js +40 -0
  182. package/web/assets/scala-C151Ov-r.js +1 -0
  183. package/web/assets/scss-OYdSNvt2.js +1 -0
  184. package/web/assets/sequenceDiagram-3UESZ5HK-B0cLrDIf.js +162 -0
  185. package/web/assets/shellscript-Yzrsuije.js +1 -0
  186. package/web/assets/slack-dark-BthQWCQV.js +1 -0
  187. package/web/assets/slack-ochin-DqwNpetd.js +1 -0
  188. package/web/assets/snazzy-light-Bw305WKR.js +1 -0
  189. package/web/assets/solarized-dark-DXbdFlpD.js +1 -0
  190. package/web/assets/solarized-light-L9t79GZl.js +1 -0
  191. package/web/assets/sql-BLtJtn59.js +1 -0
  192. package/web/assets/stateDiagram-AJRCARHV-Cm32tcPC.js +1 -0
  193. package/web/assets/stateDiagram-v2-BHNVJYJU-CB0cqS10.js +1 -0
  194. package/web/assets/svelte-DZMnMd3x.js +1 -0
  195. package/web/assets/swift-D82vCrfD.js +1 -0
  196. package/web/assets/synthwave-84-CbfX1IO0.js +1 -0
  197. package/web/assets/timeline-definition-PNZ67QCA-CQKopER7.js +120 -0
  198. package/web/assets/tokyo-night-hegEt444.js +1 -0
  199. package/web/assets/toml-vGWfd6FD.js +1 -0
  200. package/web/assets/tsx-COt5Ahok.js +1 -0
  201. package/web/assets/typescript-BPQ3VLAy.js +1 -0
  202. package/web/assets/unused-optional-NNwleJvF.js +1 -0
  203. package/web/assets/vendor-vue-CrmKjNvT.js +53 -0
  204. package/web/assets/vennDiagram-CIIHVFJN-BH2oewdT.js +34 -0
  205. package/web/assets/vesper-DU1UobuO.js +1 -0
  206. package/web/assets/vitesse-black-Bkuqu6BP.js +1 -0
  207. package/web/assets/vitesse-dark-D0r3Knsf.js +1 -0
  208. package/web/assets/vitesse-light-CVO1_9PV.js +1 -0
  209. package/web/assets/vue-DVfSmUF7.js +1 -0
  210. package/web/assets/wardleyDiagram-YWT4CUSO-DLTd3l42.js +78 -0
  211. package/web/assets/xml-sdJ4AIDG.js +1 -0
  212. package/web/assets/xychartDiagram-2RQKCTM6-BPMX-u0w.js +7 -0
  213. package/web/assets/yaml-Buea-lGh.js +1 -0
  214. package/web/assets/zh-CN-BQXM47_T.js +1 -0
  215. package/web/assets/zig-VOosw3JB.js +1 -0
  216. package/web/dimcode-web.json +5 -0
  217. package/web/index.html +44 -0
  218. package/README.md +0 -3
@@ -0,0 +1,173 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-RuQTkZJb.js","assets/vendor-vue-CrmKjNvT.js"])))=>i.map(i=>d[i]);
2
+ var Ft=Object.defineProperty;var Wt=(s,t,e)=>t in s?Ft(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var D=(s,t,e)=>Wt(s,typeof t!="symbol"?t+"":t,e);import{R as Le,d as N,p as m,i as Z,G as F,H as B,a as c,b as h,n as qe,W as he,r as T,u as S,X as Qe,Y as Dt,D as Ne,Z as j,z as l,c as q,t as w,_ as le,A as xe,e as z,s as A,g as X,$ as ve,f as se,h as H,w as Y,a0 as je,m as oe,o as pe,a1 as Te,a2 as Nt,k as we,a3 as jt,K as _t,q as Bt,M as Vt,U as et,T as Ht,a4 as It,a5 as Ut,a6 as Kt,a7 as Yt,a8 as Gt}from"./vendor-vue-CrmKjNvT.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))n(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&n(a)}).observe(document,{childList:!0,subtree:!0});function e(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(o){if(o.ep)return;o.ep=!0;const i=e(o);fetch(o.href,i)}})();/**
3
+ * @license lucide-vue-next v0.577.0 - ISC
4
+ *
5
+ * This source code is licensed under the ISC license.
6
+ * See the LICENSE file in the root directory of this source tree.
7
+ */const Zt=s=>{for(const t in s)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
8
+ * @license lucide-vue-next v0.577.0 - ISC
9
+ *
10
+ * This source code is licensed under the ISC license.
11
+ * See the LICENSE file in the root directory of this source tree.
12
+ */const tt=s=>s==="";/**
13
+ * @license lucide-vue-next v0.577.0 - ISC
14
+ *
15
+ * This source code is licensed under the ISC license.
16
+ * See the LICENSE file in the root directory of this source tree.
17
+ */const Jt=(...s)=>s.filter((t,e,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===e).join(" ").trim();/**
18
+ * @license lucide-vue-next v0.577.0 - ISC
19
+ *
20
+ * This source code is licensed under the ISC license.
21
+ * See the LICENSE file in the root directory of this source tree.
22
+ */const st=s=>s.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
23
+ * @license lucide-vue-next v0.577.0 - ISC
24
+ *
25
+ * This source code is licensed under the ISC license.
26
+ * See the LICENSE file in the root directory of this source tree.
27
+ */const Xt=s=>s.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,e,n)=>n?n.toUpperCase():e.toLowerCase());/**
28
+ * @license lucide-vue-next v0.577.0 - ISC
29
+ *
30
+ * This source code is licensed under the ISC license.
31
+ * See the LICENSE file in the root directory of this source tree.
32
+ */const Qt=s=>{const t=Xt(s);return t.charAt(0).toUpperCase()+t.slice(1)};/**
33
+ * @license lucide-vue-next v0.577.0 - ISC
34
+ *
35
+ * This source code is licensed under the ISC license.
36
+ * See the LICENSE file in the root directory of this source tree.
37
+ */var fe={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};/**
38
+ * @license lucide-vue-next v0.577.0 - ISC
39
+ *
40
+ * This source code is licensed under the ISC license.
41
+ * See the LICENSE file in the root directory of this source tree.
42
+ */const es=({name:s,iconNode:t,absoluteStrokeWidth:e,"absolute-stroke-width":n,strokeWidth:o,"stroke-width":i,size:a=fe.width,color:r=fe.stroke,...p},{slots:v})=>Le("svg",{...fe,...p,width:a,height:a,stroke:r,"stroke-width":tt(e)||tt(n)||e===!0||n===!0?Number(o||i||fe["stroke-width"])*24/Number(a):o||i||fe["stroke-width"],class:Jt("lucide",p.class,...s?[`lucide-${st(Qt(s))}-icon`,`lucide-${st(s)}`]:["lucide-icon"]),...!v.default&&!Zt(p)&&{"aria-hidden":"true"}},[...t.map(f=>Le(...f)),...v.default?[v.default()]:[]]);/**
43
+ * @license lucide-vue-next v0.577.0 - ISC
44
+ *
45
+ * This source code is licensed under the ISC license.
46
+ * See the LICENSE file in the root directory of this source tree.
47
+ */const W=(s,t)=>(e,{slots:n,attrs:o})=>Le(es,{...o,...e,iconNode:t,name:s},n);/**
48
+ * @license lucide-vue-next v0.577.0 - ISC
49
+ *
50
+ * This source code is licensed under the ISC license.
51
+ * See the LICENSE file in the root directory of this source tree.
52
+ */const ts=W("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
53
+ * @license lucide-vue-next v0.577.0 - ISC
54
+ *
55
+ * This source code is licensed under the ISC license.
56
+ * See the LICENSE file in the root directory of this source tree.
57
+ */const be=W("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
58
+ * @license lucide-vue-next v0.577.0 - ISC
59
+ *
60
+ * This source code is licensed under the ISC license.
61
+ * See the LICENSE file in the root directory of this source tree.
62
+ */const Be=W("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
63
+ * @license lucide-vue-next v0.577.0 - ISC
64
+ *
65
+ * This source code is licensed under the ISC license.
66
+ * See the LICENSE file in the root directory of this source tree.
67
+ */const Se=W("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
68
+ * @license lucide-vue-next v0.577.0 - ISC
69
+ *
70
+ * This source code is licensed under the ISC license.
71
+ * See the LICENSE file in the root directory of this source tree.
72
+ */const ss=W("circle-slash-2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/**
73
+ * @license lucide-vue-next v0.577.0 - ISC
74
+ *
75
+ * This source code is licensed under the ISC license.
76
+ * See the LICENSE file in the root directory of this source tree.
77
+ */const $t=W("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
78
+ * @license lucide-vue-next v0.577.0 - ISC
79
+ *
80
+ * This source code is licensed under the ISC license.
81
+ * See the LICENSE file in the root directory of this source tree.
82
+ */const ns=W("file-pen",[["path",{d:"M12.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v9.34",key:"o6klzx"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10.378 12.622a1 1 0 0 1 3 3.003L8.36 20.637a2 2 0 0 1-.854.506l-2.867.837a.5.5 0 0 1-.62-.62l.836-2.869a2 2 0 0 1 .506-.853z",key:"zhnas1"}]]);/**
83
+ * @license lucide-vue-next v0.577.0 - ISC
84
+ *
85
+ * This source code is licensed under the ISC license.
86
+ * See the LICENSE file in the root directory of this source tree.
87
+ */const os=W("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
88
+ * @license lucide-vue-next v0.577.0 - ISC
89
+ *
90
+ * This source code is licensed under the ISC license.
91
+ * See the LICENSE file in the root directory of this source tree.
92
+ */const Pe=W("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
93
+ * @license lucide-vue-next v0.577.0 - ISC
94
+ *
95
+ * This source code is licensed under the ISC license.
96
+ * See the LICENSE file in the root directory of this source tree.
97
+ */const is=W("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
98
+ * @license lucide-vue-next v0.577.0 - ISC
99
+ *
100
+ * This source code is licensed under the ISC license.
101
+ * See the LICENSE file in the root directory of this source tree.
102
+ */const as=W("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
103
+ * @license lucide-vue-next v0.577.0 - ISC
104
+ *
105
+ * This source code is licensed under the ISC license.
106
+ * See the LICENSE file in the root directory of this source tree.
107
+ */const Ve=W("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
108
+ * @license lucide-vue-next v0.577.0 - ISC
109
+ *
110
+ * This source code is licensed under the ISC license.
111
+ * See the LICENSE file in the root directory of this source tree.
112
+ */const xt=W("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);/**
113
+ * @license lucide-vue-next v0.577.0 - ISC
114
+ *
115
+ * This source code is licensed under the ISC license.
116
+ * See the LICENSE file in the root directory of this source tree.
117
+ */const rs=W("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
118
+ * @license lucide-vue-next v0.577.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ */const ls=W("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
123
+ * @license lucide-vue-next v0.577.0 - ISC
124
+ *
125
+ * This source code is licensed under the ISC license.
126
+ * See the LICENSE file in the root directory of this source tree.
127
+ */const St=W("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
128
+ * @license lucide-vue-next v0.577.0 - ISC
129
+ *
130
+ * This source code is licensed under the ISC license.
131
+ * See the LICENSE file in the root directory of this source tree.
132
+ */const He=W("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/**
133
+ * @license lucide-vue-next v0.577.0 - ISC
134
+ *
135
+ * This source code is licensed under the ISC license.
136
+ * See the LICENSE file in the root directory of this source tree.
137
+ */const cs=W("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
138
+ * @license lucide-vue-next v0.577.0 - ISC
139
+ *
140
+ * This source code is licensed under the ISC license.
141
+ * See the LICENSE file in the root directory of this source tree.
142
+ */const ds=W("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);/**
143
+ * @license lucide-vue-next v0.577.0 - ISC
144
+ *
145
+ * This source code is licensed under the ISC license.
146
+ * See the LICENSE file in the root directory of this source tree.
147
+ */const us=W("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
148
+ * @license lucide-vue-next v0.577.0 - ISC
149
+ *
150
+ * This source code is licensed under the ISC license.
151
+ * See the LICENSE file in the root directory of this source tree.
152
+ */const hs=W("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/**
153
+ * @license lucide-vue-next v0.577.0 - ISC
154
+ *
155
+ * This source code is licensed under the ISC license.
156
+ * See the LICENSE file in the root directory of this source tree.
157
+ */const ps=W("wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]]);/**
158
+ * @license lucide-vue-next v0.577.0 - ISC
159
+ *
160
+ * This source code is licensed under the ISC license.
161
+ * See the LICENSE file in the root directory of this source tree.
162
+ */const Fe=W("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ms=["d"],fs=N({__name:"BrandMark",props:{animated:{type:Boolean,default:!1}},setup(s){const t=[{delay:"-1.6s",d:"M52.042 34C50.8561 34.0001 49.8945 34.9615 49.8945 36.1475V46.1689C49.8946 47.3549 50.8561 48.3163 52.042 48.3164H77.958C79.144 48.3164 80.1054 47.3549 80.1055 46.1689V36.1475C80.1055 34.9615 79.144 34 77.958 34H52.042Z"},{delay:"-1.333s",d:"M83.8311 49.8945C82.6452 49.8947 81.6836 50.8561 81.6836 52.042V62.0635C81.6838 63.2493 82.6453 64.2108 83.8311 64.2109H93.8525C95.0384 64.2109 95.9998 63.2493 96 62.0635V52.042C96 50.856 95.0385 49.8945 93.8525 49.8945H83.8311Z"},{delay:"-1.067s",d:"M83.8311 65.7891C82.6453 65.7892 81.6838 66.7508 81.6836 67.9365V77.958C81.6836 79.1439 82.6452 80.1053 83.8311 80.1055H93.8525C95.0385 80.1055 96 79.144 96 77.958V67.9365C95.9998 66.7507 95.0384 65.7891 93.8525 65.7891H83.8311Z"},{delay:"-0.8s",d:"M52.042 81.6836C50.8561 81.6837 49.8946 82.6452 49.8945 83.8311V93.8525C49.8945 95.0385 50.8561 95.9999 52.042 96H77.958C79.144 96 80.1055 95.0385 80.1055 93.8525V83.8311C80.1054 82.6451 79.1439 81.6836 77.958 81.6836H52.042Z"},{delay:"-0.533s",d:"M36.1475 65.7891C34.9616 65.7891 34.0002 66.7507 34 67.9365V77.958C34 79.144 34.9615 80.1055 36.1475 80.1055H46.1689C47.3548 80.1054 48.3164 79.1439 48.3164 77.958V67.9365C48.3162 66.7507 47.3547 65.7892 46.1689 65.7891H36.1475Z"},{delay:"-0.267s",d:"M36.1475 49.8945C34.9615 49.8945 34 50.856 34 52.042V62.0635C34.0002 63.2493 34.9616 64.2109 36.1475 64.2109H46.1689C47.3547 64.2108 48.3162 63.2493 48.3164 62.0635V52.042C48.3164 50.8561 47.3548 49.8946 46.1689 49.8945H36.1475Z"}];return(e,n)=>(c(),m("svg",{viewBox:"34 34 62 62","aria-hidden":"true",class:Z(["brand-mark",{"is-animated":s.animated}])},[(c(),m(F,null,B(t,o=>h("path",{key:o.d,fill:"currentColor",d:o.d,style:qe({animationDelay:o.delay})},null,12,ms)),64))],2))}}),ee=(s,t)=>{const e=s.__vccOpts||s;for(const[n,o]of t)e[n]=o;return e},Ee=ee(fs,[["__scopeId","data-v-44bc694b"]]),nt=3,ae="main";class re extends Error{constructor(){super(...arguments);D(this,"name","ProtocolError")}}function ie(s,t){throw new re(`Invalid ${s}: expected ${t}`)}function P(s,t){return(s===null||typeof s!="object"||Array.isArray(s))&&ie(t,"an object"),s}function ne(s,t){return Array.isArray(s)||ie(t,"an array"),s}function C(s,t,e){const n=s[t];return typeof n!="string"&&ie(`${e}.${t}`,"a string"),n}function Ce(s,t,e){return s[t]===void 0||s[t]===null?void 0:C(s,t,e)}function J(s,t,e){const n=s[t];return(typeof n!="number"||!Number.isSafeInteger(n)||n<0)&&ie(`${e}.${t}`,"a nonnegative safe integer"),n}function ue(s,t,e){const n=s[t];return typeof n!="boolean"&&ie(`${e}.${t}`,"a boolean"),n}function Ue(s,t){const e=P(s,t);return{providerId:C(e,"providerId",t),modelId:C(e,"modelId",t)}}function vs(s){const t=P(s,"hello");return{instanceId:C(t,"instanceId","hello"),serverVersion:C(t,"serverVersion","hello"),protocolVersion:J(t,"protocolVersion","hello"),features:ne(t.features,"hello.features").map((e,n)=>(typeof e!="string"&&ie(`hello.features[${n}]`,"a string"),e))}}function _e(s){P(s,"reply")}function gs(s){return ne(s,"session.summaries").map((t,e)=>{const n=`session.summaries[${e}]`,o=P(t,n),i=Ce(o,"preview",n);return{sessionId:C(o,"sessionId",n),cwd:C(o,"cwd",n),model:Ue(o.model,`${n}.model`),createdAt:J(o,"createdAt",n),running:ue(o,"running",n),sequence:J(o,"sequence",n),...i===void 0?{}:{preview:i},updatedAt:J(o,"updatedAt",n)}})}function ys(s){const t=P(s,"session.create");return{sessionId:C(t,"sessionId","session.create"),model:Ue(t.model,"session.create.model"),sequence:J(t,"sequence","session.create")}}function ws(s){const t=P(s,"session.history");return{events:ne(t.events,"session.history.events").map((e,n)=>Mt(e,`session.history.events[${n}]`)),through:J(t,"through","session.history"),nextAfter:J(t,"nextAfter","session.history"),done:ue(t,"done","session.history")}}function bs(s){const t=P(s,"session.model.update");return{model:Ue(t.model,"session.model.update.model"),outcome:C(t,"outcome","session.model.update")}}function ks(s){const t=P(s,"provider.list");return ne(t.providers,"provider.list.providers").map((e,n)=>{const o=`provider.list.providers[${n}]`,i=P(e,o);return{providerId:C(i,"providerId",o),displayName:C(i,"displayName",o),enabled:ue(i,"enabled",o),credentialConfigured:ue(i,"credentialConfigured",o)}})}function _s(s){const t=P(s,"provider.catalog");if(t.catalog===null)return;const e=P(t.catalog,"provider.catalog.catalog");return{models:ne(e.models,"provider.catalog.models").map((n,o)=>{const i=`provider.catalog.models[${o}]`,a=P(n,i),r=Ce(a,"unavailableReason",i);return{id:C(a,"id",i),name:C(a,"name",i),...r===void 0?{}:{unavailableReason:r}}}),disabledModelIds:ne(e.disabledModelIds,"provider.catalog.disabledModelIds").map((n,o)=>(typeof n!="string"&&ie(`provider.catalog.disabledModelIds[${o}]`,"a string"),n))}}function Is(s){const t=P(s,"provider.selection");if(t.selection===null)return;const e=P(t.selection,"provider.selection.selection");return{providerId:C(e,"provider_id","provider.selection"),modelId:C(e,"model_id","provider.selection")}}function Ct(s,t){return ne(s,t).flatMap((e,n)=>{const o=P(e,`${t}[${n}]`);return o.type==="text"?[C(o,"text",`${t}[${n}]`)]:[]}).join(`
163
+ `)}function ot(s,t){const e=P(s,t),n=typeof e.content=="string"?e.content:Ct(e.content,`${t}.content`),o=e.structuredContent===void 0||e.structuredContent===null?void 0:P(e.structuredContent,`${t}.structuredContent`),i=typeof(o==null?void 0:o.diff)=="string"?o.diff:void 0;return{text:n,isError:e.isError===!0,...i===void 0?{}:{diff:i}}}function $s(s,t,e,n){switch(`${s}/${t}`){case"input/message":return e.user===void 0||e.user===null?{kind:"input"}:{kind:"input",text:Ct(P(e.user,`${n}.user`).content,`${n}.user.content`)};case"turn/end":{const o=C(e,"status",n);o!=="completed"&&o!=="failed"&&o!=="cancelled"&&ie(`${n}.status`,"a turn outcome");const i=o==="failed"?C(e,"error",n):void 0;return{kind:"turn-end",outcome:o,...i===void 0?{}:{error:i}}}case"step/model-start":return{kind:"model-start",requestId:C(e,"request_id",n)};case"step/thinking":return{kind:"thinking",requestId:C(e,"request_id",n),delta:C(e,"delta",n)};case"step/text":return{kind:"text",requestId:C(e,"request_id",n),delta:C(e,"delta",n)};case"step/tool-use":{const o=P(e.call,`${n}.call`);return{kind:"tool-use",requestId:C(e,"request_id",n),callId:C(o,"id",`${n}.call`),name:C(o,"name",`${n}.call`),input:P(o.input,`${n}.call.input`)}}case"step/tool-completed":return{kind:"tool-completed",callId:C(e,"call_id",n),result:ot(e.result,`${n}.result`)};case"step/tool-result":return{kind:"tool-result",results:ne(e.results,`${n}.results`).map((o,i)=>{const a=P(o,`${n}.results[${i}]`);return{callId:C(a,"call_id",`${n}.results[${i}]`),result:ot(a.result,`${n}.results[${i}].result`)}})};case"step/model-output-end":{const o=C(e,"status",n)==="failed"?C(e,"error",n):void 0;return{kind:"model-end",requestId:C(e,"request_id",n),...o===void 0?{}:{error:o}}}case"context/configured":return{kind:"context-configured",model:{providerId:C(e,"provider_id",n),modelId:C(e,"model_id",n)}};default:return{kind:"other"}}}function Mt(s,t){const e=P(s,t),n=C(e,"type",t),o=C(e,"name",t);return{sequence:J(e,"sequence",t),createAt:J(e,"create_at",t),content:$s(n,o,P(e.data,`${t}.data`),`${t}.data`)}}function xs(s){const t="approval.request",e=P(s.call,`${t}.call`),n=P(s.source,`${t}.source`),o=n.kind==="tool"?C(n,"call_id",`${t}.source`):void 0;return{sessionId:C(s,"sessionId",t),branchId:C(s,"branchId",t),requestId:C(s,"requestId",t),...o===void 0?{}:{callId:o},call:{name:C(e,"name",`${t}.call`),input:P(e.input,`${t}.call.input`)},reason:C(s,"reason",t)}}function Ss(s,t){const e=P(t??{},s);switch(s){case"session.event":return{method:s,sessionId:C(e,"sessionId",s),branchId:C(e,"branchId",s),event:Mt(e.event,`${s}.event`)};case"session.state":return{method:s,sessionId:C(e,"sessionId",s),branchId:C(e,"branchId",s),running:ue(e,"running",s),stopping:ue(e,"stopping",s)};case"session.model.progress":{const n=Ce(e,"requestId",s);return{method:s,progress:{sessionId:C(e,"sessionId",s),branchId:C(e,"branchId",s),...n===void 0?{}:{requestId:n},text:C(e,"text",s),textOffset:J(e,"textOffset",s),thinking:C(e,"thinking",s),thinkingOffset:J(e,"thinkingOffset",s)}}}case"approval.request":return{method:s,request:xs(e)};case"approval.cancelled":return{method:s,sessionId:C(e,"sessionId",s),branchId:C(e,"branchId",s),requestId:C(e,"requestId",s)};case"session.closed":{const n=Ce(e,"reason",s);return{method:s,sessionId:C(e,"sessionId",s),...n===void 0?{}:{reason:n}}}default:return}}class Ke extends Error{constructor(e,n,o){super(n);D(this,"name","RpcError");this.code=e,this.appError=o}}class $e extends Error{constructor(){super(...arguments);D(this,"name","ConnectionLost")}}const Cs=3e4,Ms=2e4,Ts=1e4,it=[500,1e3,2e3,4e3,8e3,15e3];class Es{constructor(t){D(this,"socket");D(this,"nextId",1);D(this,"pending",new Map);D(this,"heartbeat");D(this,"retry");D(this,"attempt",0);D(this,"connectedOnce",!1);D(this,"stopped",!1);this.handlers=t}start(){this.stopped=!1,this.open()}stop(){var t;this.stopped=!0,clearTimeout(this.retry),(t=this.socket)==null||t.close()}retryNow(){this.socket!==void 0||this.stopped||(clearTimeout(this.retry),this.open())}call(t,e,n,o=Cs){const i=this.socket;if(i===void 0||i.readyState!==WebSocket.OPEN)return Promise.reject(new $e("Not connected"));const a=this.nextId++;return new Promise((r,p)=>{const v=setTimeout(()=>{this.pending.delete(a),p(new $e(`${t} timed out`))},o);this.pending.set(a,{resolve:r,reject:p,timer:v}),i.send(JSON.stringify({jsonrpc:"2.0",id:a,method:t,params:e}))}).then(n)}open(){this.handlers.phase(this.connectedOnce?"reconnecting":"connecting");const t=location.protocol==="https:"?"wss:":"ws:",e=new WebSocket(`${t}//${location.host}/ws`);this.socket=e;let n=!1;e.onopen=()=>{n=!0,this.handshake()},e.onmessage=o=>this.receive(o.data),e.onclose=()=>{if(this.socket===e){this.socket=void 0,clearInterval(this.heartbeat);for(const[o,i]of this.pending)clearTimeout(i.timer),i.reject(new $e("Connection closed")),this.pending.delete(o);this.stopped||(n?this.schedule():this.diagnoseRefusal())}}}async handshake(){var n,o;let t;try{t=await this.call("hello",{protocolVersion:nt,clientKind:"web",clientName:"dim-web"},vs)}catch(i){i instanceof Ke&&i.appError==="protocol_version"&&(this.stopped=!0,this.handlers.phase("version-mismatch")),(n=this.socket)==null||n.close();return}if(t.protocolVersion!==nt){this.stopped=!0,this.handlers.phase("version-mismatch"),(o=this.socket)==null||o.close();return}const e=this.connectedOnce;this.connectedOnce=!0,this.attempt=0,this.heartbeat=setInterval(()=>{this.call("daemon.ping",{},()=>{},Ts).catch(()=>{var i;return(i=this.socket)==null?void 0:i.close()})},Ms),this.handlers.phase("connected"),this.handlers.ready(t,e)}async diagnoseRefusal(){let t=!1;try{t=(await fetch("/api/auth/session",{cache:"no-store"})).status===401}catch{t=!1}this.stopped||(t?(this.stopped=!0,this.handlers.phase("unauthenticated")):this.schedule())}schedule(){this.handlers.phase(this.connectedOnce?"reconnecting":"connecting");const t=it[Math.min(this.attempt,it.length-1)];this.attempt+=1,this.retry=setTimeout(()=>this.open(),t)}receive(t){let e;try{const o=JSON.parse(String(t));if(o===null||typeof o!="object"||Array.isArray(o))throw new re("Expected a JSON-RPC object");e=o}catch(o){this.handlers.invalid(o instanceof re?o:new re("Invalid JSON frame"));return}if(typeof e.id=="number"){const o=this.pending.get(e.id);if(o===void 0)return;this.pending.delete(e.id),clearTimeout(o.timer),"error"in e?o.reject(Os(e.error)):o.resolve(e.result);return}if(typeof e.method!="string")return;let n;try{n=Ss(e.method,e.params)}catch(o){this.handlers.invalid(o instanceof re?o:new re(String(o)));return}n!==void 0&&this.handlers.notification(n)}}function Os(s){const t=s!==null&&typeof s=="object"?s:{},e=t.data!==null&&typeof t.data=="object"?t.data:{};return new Ke(typeof t.code=="number"?t.code:-32603,typeof t.message=="string"?t.message:"Request failed",typeof e.appError=="string"?e.appError:void 0)}async function As(){const s=new URLSearchParams(location.hash.slice(1)).get("bootstrap");if(s!==null){history.replaceState(history.state,"",`${location.pathname}${location.search}`);try{await fetch("/api/auth/exchange",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:s})})}catch{}}}class Rs{constructor(){D(this,"rows",[]);D(this,"cursor",0);D(this,"model");D(this,"answers",new Map);D(this,"thoughts",new Map);D(this,"requestStarts",new Map);D(this,"tools",new Map)}apply(t){if(t.sequence<=this.cursor)return!1;this.cursor=t.sequence;const e=t.content;switch(e.kind){case"input":e.text!==void 0&&this.push({kind:"user",key:`user-${t.sequence}`,text:e.text,at:t.createAt});break;case"model-start":this.requestStarts.set(e.requestId,t.createAt);break;case"thinking":{const n=this.openThinking(e.requestId);at(n,e.delta);const o=this.requestStarts.get(e.requestId);this.update(n.index,{text:Ie(n),...o===void 0?{}:{elapsedMs:Math.max(0,t.createAt-o)}});break}case"text":{this.closeThinking(e.requestId);const n=this.openAnswer(e.requestId);at(n,e.delta),this.update(n.index,{text:Ie(n)});break}case"tool-use":this.closeThinking(e.requestId),this.closeAnswer(e.requestId),this.requestStarts.delete(e.requestId),this.tools.set(e.callId,this.push({kind:"tool",key:`tool-${e.callId}`,callId:e.callId,name:e.name,input:e.input,pending:!0}));break;case"tool-completed":this.completeTool(e.callId,e.result);break;case"tool-result":for(const n of e.results)this.completeTool(n.callId,n.result);break;case"model-end":this.closeThinking(e.requestId),this.closeAnswer(e.requestId),this.requestStarts.delete(e.requestId),e.error!==void 0&&this.push({kind:"error",key:`error-${t.sequence}`,text:e.error});break;case"turn-end":for(const n of[...this.thoughts.keys()])this.closeThinking(n);for(const n of[...this.answers.keys()])this.closeAnswer(n);this.requestStarts.clear(),e.outcome==="failed"&&this.push({kind:"error",key:`error-${t.sequence}`,text:e.error??""}),e.outcome==="cancelled"&&this.push({kind:"stopped",key:`stopped-${t.sequence}`});break;case"context-configured":this.model=e.model;break}return!0}progress(t){const e=t.requestId;if(e!==void 0){if(t.thinking!==""){const n=this.openThinking(e);n.progress={text:t.thinking,offset:t.thinkingOffset},this.update(n.index,{text:Ie(n)})}if(t.text!==""){const n=this.openAnswer(e);n.progress={text:t.text,offset:t.textOffset},this.update(n.index,{text:Ie(n)})}}}push(t){return this.rows.push(t),this.rows.length-1}update(t,e){this.rows[t]={...this.rows[t],...e}}openThinking(t){let e=this.thoughts.get(t);return e===void 0&&(e={index:this.push({kind:"thinking",key:`thinking-${t}-${this.rows.length}`,text:"",streaming:!0}),written:"",writtenChars:0},this.thoughts.set(t,e)),e}openAnswer(t){let e=this.answers.get(t);return e===void 0&&(e={index:this.push({kind:"assistant",key:`assistant-${t}-${this.rows.length}`,text:"",streaming:!0}),written:"",writtenChars:0},this.answers.set(t,e)),e}closeThinking(t){const e=this.thoughts.get(t);e!==void 0&&(this.thoughts.delete(t),this.update(e.index,{text:e.written,streaming:!1}))}closeAnswer(t){const e=this.answers.get(t);e!==void 0&&(this.answers.delete(t),this.update(e.index,{text:e.written,streaming:!1}))}completeTool(t,e){const n=this.tools.get(t);n!==void 0&&(this.tools.delete(t),this.update(n,{pending:!1,result:e}))}}function at(s,t){s.written+=t,s.writtenChars+=[...t].length}function Ie(s){const t=s.progress;if(t===void 0)return s.written;const e=s.writtenChars-t.offset;if(e<0)return s.written;const n=[...t.text];return e>=n.length?(s.progress=void 0,s.written):s.written+n.slice(e).join("")}const U=he("sessions",()=>{const s=T([]),t=T(!1),e=T("");let n;const o=S(()=>new Map(s.value.map(f=>[f.sessionId,f]))),i=S(()=>{const f=new Map;for(const g of s.value){const y=f.get(g.cwd);y===void 0?f.set(g.cwd,[g]):y.push(g)}return[...f].map(([g,y])=>(y.sort((b,$)=>$.updatedAt-b.updatedAt),{cwd:g,name:Oe(g),sessions:y,updatedAt:y[0].updatedAt})).sort((g,y)=>y.updatedAt-g.updatedAt)});function a(){return n??(n=K().client.call("session.summaries",{},gs).then(f=>{s.value=f,t.value=!0,e.value=""}).catch(f=>{e.value=f instanceof Error?f.message:String(f)}).finally(()=>{n=void 0})),n}async function r(f,g){const y={cwd:f};g!==void 0&&(y.model={provider:g.providerId,modelId:g.modelId});const b=await K().client.call("session.create",y,ys);return a(),b.sessionId}function p(f,g){const y=o.value.get(f);y!==void 0&&y.running!==g&&(y.running=g)}function v(f){s.value=s.value.filter(g=>g.sessionId!==f)}return{summaries:s,loaded:t,error:e,byId:o,workspaces:i,refresh:a,create:r,setRunning:p,forget:v}});function Oe(s){return s.replace(/[\\/]+$/,"").split(/[\\/]/).at(-1)||s}const zs=256,Ls=6e4,qs=16,ge=he("chat",()=>{const s=Qe({}),t=new Map;let e;function n(){return K().client}function o(d){var x,M;if(t.has(d))return;const _=Qe({sessionId:d,status:"loading",error:"",rows:[],running:((x=U().byId.get(d))==null?void 0:x.running)??!1,stopping:!1,approvals:[],model:(M=U().byId.get(d))==null?void 0:M.model}),I={view:_,projection:new Rs,syncing:!1,queued:[],publishTimer:void 0};t.set(d,I),s[d]=_,a(I)}function i(){for(const d of t.values())d.view.status!=="closed"&&a(d)}async function a(d){const{view:_,projection:I}=d;d.syncing=!0,d.queued=[],_.approvals=[];try{await n().call("session.attach",{sessionId:_.sessionId},_e);let x=I.cursor,M;for(;;){const R=await n().call("session.history",{sessionId:_.sessionId,branchId:ae,after:x,limit:zs,...M===void 0?{}:{through:M}},ws,Ls);if(M!==void 0&&R.through!==M||R.nextAfter<x||R.nextAfter>R.through||!R.done&&R.nextAfter===x)throw new re("Invalid history page cursor");M=R.through;for(const O of R.events)I.apply(O);if(x=R.nextAfter,R.done)break}for(const R of d.queued)p(d,R);_.status="ready",_.error=""}catch(x){x instanceof Ke&&x.appError==="session_closed"?_.status="closed":x instanceof $e||(_.status="failed",_.error=x instanceof Error?x.message:String(x))}finally{d.syncing=!1,d.queued=[],f(d)}}function r(d){const _=d.method==="session.model.progress"?d.progress.sessionId:d.method==="approval.request"?d.request.sessionId:d.sessionId,I=t.get(_);if(I!==void 0){if(I.syncing&&(d.method==="session.event"||d.method==="session.model.progress")){I.queued.push(d);return}p(I,d)}}function p(d,_){const I=d.view;switch(_.method){case"session.event":_.branchId===ae&&d.projection.apply(_.event)&&v(d);break;case"session.model.progress":_.progress.branchId===ae&&(d.projection.progress(_.progress),v(d));break;case"session.state":if(_.branchId!==ae)break;I.running&&!_.running&&g(),I.running=_.running,I.stopping=_.stopping,U().setRunning(I.sessionId,_.running);break;case"approval.request":I.approvals.some(x=>x.requestId===_.request.requestId)||(I.approvals=[...I.approvals,_.request]);break;case"approval.cancelled":y(I,_.requestId);break;case"session.closed":I.status="closed",I.running=!1,I.approvals=[],U().forget(I.sessionId);break}}function v(d){d.publishTimer??(d.publishTimer=setTimeout(()=>f(d),qs))}function f(d){var _;clearTimeout(d.publishTimer),d.publishTimer=void 0,d.view.rows=d.projection.rows.slice(),d.view.model=d.projection.model??((_=U().byId.get(d.view.sessionId))==null?void 0:_.model)}function g(){clearTimeout(e),e=setTimeout(()=>void U().refresh(),500)}function y(d,_){d.approvals=d.approvals.filter(I=>I.requestId!==_)}async function b(d,_){await n().call("session.submit",{sessionId:d,branchId:ae,submissionId:crypto.randomUUID(),text:_,mode:"queue"},_e)}async function $(d){await n().call("session.stop",{sessionId:d,branchId:ae,reason:"Stopped from the web workspace"},_e)}async function k(d,_,I){await n().call("approval.respond",{sessionId:d,branchId:_.branchId,requestId:_.requestId,decision:I},_e);const x=s[d];x!==void 0&&y(x,_.requestId)}async function u(d,_){const I=await n().call("session.model.update",{sessionId:d,branchId:ae,providerId:_.providerId,modelId:_.modelId},bs),x=t.get(d);x!==void 0&&(x.projection.model=I.model,f(x))}return{views:s,open:o,resync:i,receive:r,submit:b,stop:$,respond:k,setModel:u}}),Ps=4e3,Ye=he("toast",()=>{const s=T([]),t=new Map;let e=0;function n(r){clearTimeout(t.get(r)),t.delete(r),s.value=s.value.filter(p=>p.id!==r)}function o(r){clearTimeout(t.get(r)),t.set(r,setTimeout(()=>n(r),Ps))}function i(r){clearTimeout(t.get(r)),t.delete(r)}function a(r){const p=++e,v=[...s.value,{...r,id:p}];for(const f of v.slice(0,-3))i(f.id);s.value=v.slice(-3),o(p)}return{toasts:s,push:a,dismiss:n,pause:i,resume:o}}),Fs="modulepreload",Ws=function(s){return"/"+s},rt={},Tt=function(t,e,n){let o=Promise.resolve();if(e&&e.length>0){let a=function(v){return Promise.all(v.map(f=>Promise.resolve(f).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const r=document.querySelector("meta[property=csp-nonce]"),p=(r==null?void 0:r.nonce)||(r==null?void 0:r.getAttribute("nonce"));o=a(e.map(v=>{if(v=Ws(v),v in rt)return;rt[v]=!0;const f=v.endsWith(".css"),g=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${v}"]${g}`))return;const y=document.createElement("link");if(y.rel=f?"stylesheet":Fs,f||(y.as="script"),y.crossOrigin="",y.href=v,p&&y.setAttribute("nonce",p),document.head.appendChild(y),f)return new Promise((b,$)=>{y.addEventListener("load",b),y.addEventListener("error",()=>$(new Error(`Unable to preload CSS for ${v}`)))})}))}function i(a){const r=new Event("vite:preloadError",{cancelable:!0});if(r.payload=a,window.dispatchEvent(r),!r.defaultPrevented)throw a}return o.then(a=>{for(const r of a||[])r.status==="rejected"&&i(r.reason);return t().catch(i)})},Ds={"a11y.mainContent":"Main content","a11y.primaryNavigation":"Primary navigation","a11y.workspaceSessionIndex":"Workspace and session index","auth.connectingTitle":"Connecting to Dim…","auth.expiredTitle":"This link has expired","auth.expiredBefore":"This browser is not signed in to the web workspace, or the workspace was reopened. Run ","auth.expiredAfter":" to get a fresh link.","auth.versionTitle":"Update the browser page","auth.versionDescription":"This page and the App Server speak different protocol versions. Reload the page; if it persists, run dimcode web again.","brand.product":"Dim","brand.webHost":"Web workspace","chat.assistant":"Dim","chat.composer":"Message composer","chat.copyFailed":"Clipboard access failed.","chat.emptyTimeline":"Send a message to begin.","chat.pathCopied":"Path copied","chat.removedDescription":"This session is closed or no longer exists on the App Server.","chat.removedTitle":"Session closed","chat.you":"You","common.close":"Close","common.loading":"Loading…","common.search":"Search","common.skipToContent":"Skip to content","composer.modelLoadRetry":"Load failed · Retry","composer.modelLoading":"Loading models…","composer.noModels":"No models available","composer.notConfigured":"Default model","composer.searchModels":"Search models...","composer.send":"Send","composer.sendMessage":"Send a message...","composer.stopResponse":"Stop response","connection.accessRequired":"Access required","connection.connecting":"Connecting","connection.host":"App Server","connection.live":"Live","connection.protocolError":"Unexpected data from the App Server","connection.reconnecting":"Reconnecting","connection.versionMismatch":"Version mismatch","detail.output":"Output","message.collapse":"Collapse message","message.copy":"Copy entire message","message.expand":"Show full message","newThread.pathLabel":"Absolute directory path","newThread.pathPlaceholder":"/path/to/project","newThread.selectWorkspace":"Select workspace...","newThread.title":"Start Build","newThread.usePath":"Use","newThread.workspaceRequired":"Choose a workspace or type an absolute directory.","page.notFoundDescription":"There is nothing at this address.","page.reconnecting":"Connection lost. Reconnecting…","prompt.actionRequest":"Dim wants to: {action}","prompt.allowOnce":"Allow once","prompt.awaitingApproval":"Awaiting approval","prompt.input":"Input","prompt.permissionSubmitFailed":"Failed to submit tool permission","prompt.reject":"Reject","prompt.useTool":"Use a tool","route.newSession":"New session","route.notFound":"Page not found","route.session":"Session","sidebar.closeMenu":"Close navigation","sidebar.collapseWorkspace":"Collapse {name}","sidebar.expandWorkspace":"Expand {name}","sidebar.newInWorkspace":"New session in {name}","sidebar.newSession":"New session","sidebar.noMatches":"No workspaces or sessions match.","sidebar.noWorkspaces":"No sessions yet.","sidebar.openMenu":"Open navigation","sidebar.searchPlaceholder":"Search workspaces and sessions","sidebar.showLess":"Show less","sidebar.showMore":"Show more","sidebar.untitled":"New session","sidebar.workspaces":"Workspaces","status.running":"Running","status.stopping":"Stopping","timeline.copied":"Copied","timeline.copy":"Copy","timeline.noticeStopped":"Stopped","timeline.scrollToBottom":"Scroll to bottom","tool.edit":"Edit","tool.glob":"Find","tool.grep":"Search content","tool.listFiles":"List files","tool.read":"Read","tool.run":"Run","tool.runBackground":"Run (background)","tool.webFetch":"Fetch webpage","tool.webSearch":"Search web","tool.write":"Write","work.actionSeparator":", ","work.command":"{count} command | {count} commands","work.edit":"{count} edit | {count} edits","work.processing":"Processing","work.read":"{count} read | {count} reads","work.search":"{count} search | {count} searches","work.separator":" · ","work.thinking":"Thinking","work.thinkingSteps":"Thought once | Thought {count} times","work.thoughtFor":"Thought for {duration}","work.unknown":"{count} tool | {count} tools","work.webFetch":"{count} fetch | {count} fetches","work.webSearch":"{count} web search | {count} web searches"},Ns=()=>Tt(()=>import("./zh-CN-BQXM47_T.js"),[]),de=Dt({legacy:!1,locale:"en",fallbackLocale:"en",messages:{en:Ds}});function js(s){return s.toLowerCase().startsWith("zh")?"zh-CN":"en"}async function Bs(s){const t=js(s);t==="zh-CN"&&!de.global.availableLocales.includes(t)&&de.global.setLocaleMessage(t,(await Ns()).default),de.global.locale.value=t}function Vs(s,t){return de.global.t(s,{})}const K=he("connection",()=>{const s=T("connecting"),t=Ne(),e=T(!1),n=new Es({phase(i){s.value=i},ready(i,a){t.value=i,e.value=!0,U().refresh(),a&&ge().resync()},notification(i){ge().receive(i)},invalid(i){console.error(i),Ye().push({tone:"danger",title:Vs("connection.protocolError"),description:i.message})}});function o(i){var a;return((a=t.value)==null?void 0:a.features.includes(i))??!1}return{phase:s,hello:t,everConnected:e,client:n,supports:o}}),Hs=["data-state"],Us=N({__name:"ConnectionBadge",setup(s){const t=K(),{t:e}=j(),n=S(()=>({connecting:e("connection.connecting"),connected:e("connection.live"),reconnecting:e("connection.reconnecting"),unauthenticated:e("connection.accessRequired"),"version-mismatch":e("connection.versionMismatch")})[t.phase]);return(o,i)=>(c(),m("div",{class:"connection-badge","aria-live":"polite","data-state":l(t).phase},[l(t).phase==="connected"?(c(),q(l(hs),{key:0,size:14,"aria-hidden":"true"})):(c(),q(l(us),{key:1,size:14,"aria-hidden":"true"})),h("span",null,[h("strong",null,w(n.value),1),h("small",null,w(l(e)("connection.host")),1)])],8,Hs))}}),Ks=1440*60*1e3;function lt(s){const t=new Date(s);return t.setHours(0,0,0,0),t.getTime()}function Ys(s,t,e=new Date){const n=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(s);return lt(e)-lt(s)<7*Ks?`${new Intl.DateTimeFormat(t,{weekday:"long"}).format(s)} ${n}`:`${new Intl.DateTimeFormat(t,{...s.getFullYear()===e.getFullYear()?{}:{year:"numeric"},month:"short",day:"numeric"}).format(s)} ${n}`}function Gs(s,t=Date.now()){const e=Math.max(0,t-s.getTime());return e<6e4?"now":e<36e5?`${Math.floor(e/6e4)}m`:e<864e5?`${Math.floor(e/36e5)}h`:`${Math.floor(e/864e5)}d`}function Zs(s){const t=Math.max(s,0),e=Math.floor(t/1e3);if(e<60)return e===0&&t>0?`${Math.round(t/100)/10}s`:`${e}s`;const n=Math.floor(e/60),o=e%60;return o>0?`${n}m ${o}s`:`${n}m`}const Js={class:"workspace-group"},Xs=["aria-expanded","aria-label"],Qs={class:"workspace-disclosure","aria-hidden":"true"},en=["data-open"],tn={class:"workspace-disclosure-icon"},sn=["title"],nn={key:0,class:"workspace-running","aria-hidden":"true"},on={key:0,class:"session-list"},an=["data-state"],rn={key:0},Ae=5,ln=20,cn=N({__name:"SidebarWorkspaceGroup",props:{workspace:{},expanded:{type:Boolean},activeSessionId:{},nowMs:{}},emits:["toggle","navigate"],setup(s,{emit:t}){const e=s,n=t,{t:o}=j(),i=T(Ae),a=S(()=>e.workspace.sessions.slice(0,i.value)),r=S(()=>e.workspace.sessions.length>i.value),p=S(()=>!e.expanded&&e.workspace.sessions.some(f=>f.running));function v(){i.value=r.value?i.value+ln:Ae}return(f,g)=>{const y=le("tooltip");return c(),m("section",Js,[h("div",{class:"workspace-row",onClick:g[3]||(g[3]=b=>n("toggle"))},[h("button",{class:"workspace-toggle",type:"button","aria-expanded":s.expanded,"aria-label":l(o)(s.expanded?"sidebar.collapseWorkspace":"sidebar.expandWorkspace",{name:s.workspace.name}),onClick:g[0]||(g[0]=xe(b=>n("toggle"),["stop"]))},[h("span",Qs,[h("span",{class:"workspace-disclosure-chevron","data-open":s.expanded?"true":void 0},[z(l(Se),{size:14})],8,en),h("span",tn,[s.expanded?(c(),q(l(os),{key:0,size:14})):(c(),q(l(Pe),{key:1,size:14}))])]),h("strong",{title:s.workspace.cwd},w(s.workspace.name),9,sn)],8,Xs),p.value?(c(),m("span",nn,[z(l(Ve),{size:14,class:"is-spinning"})])):A("",!0),h("div",{class:"workspace-row-actions",onClick:g[2]||(g[2]=xe(()=>{},["stop"]))},[X((c(),q(l(ve),{class:"ui-icon-button workspace-add","data-variant":"ghost","data-size":"sm",to:{name:"chat-new",query:{cwd:s.workspace.cwd}},"aria-label":l(o)("sidebar.newInWorkspace",{name:s.workspace.name}),onClick:g[1]||(g[1]=b=>n("navigate"))},{default:se(()=>[z(l(St),{"aria-hidden":"true"})]),_:1},8,["to","aria-label"])),[[y,l(o)("sidebar.newInWorkspace",{name:s.workspace.name})]])])]),s.expanded?(c(),m("ul",on,[(c(!0),m(F,null,B(a.value,b=>(c(),m("li",{key:b.sessionId},[z(l(ve),{class:"session-open",to:{name:"chat-session",params:{sessionId:b.sessionId}},"data-open":b.sessionId===s.activeSessionId?"true":void 0,"aria-current":b.sessionId===s.activeSessionId?"page":void 0,title:b.preview,onClick:g[4]||(g[4]=$=>n("navigate"))},{default:se(()=>[h("span",{class:"status-dot","data-state":b.running?"running":"idle","aria-hidden":"true"},null,8,an),h("strong",null,w(b.preview??l(o)("sidebar.untitled")),1),h("small",null,w(l(Gs)(new Date(b.updatedAt),s.nowMs)),1)]),_:2},1032,["to","data-open","aria-current","title"])]))),128)),s.workspace.sessions.length>Ae?(c(),m("li",rn,[h("button",{class:"ui-button reveal-more","data-variant":"ghost","data-size":"sm",type:"button",onClick:v},[z(l(Se),{"data-open":r.value?void 0:"true","aria-hidden":"true"},null,8,["data-open"]),H(" "+w(l(o)(r.value?"sidebar.showMore":"sidebar.showLess")),1)])])):A("",!0)])):A("",!0)])}}}),dn=ee(cn,[["__scopeId","data-v-883a0b20"]]),Et="dim-web.ui.v1";function un(){const s={sidebarCollapsed:!1,collapsedWorkspaces:[],lastSessionId:void 0};try{const t=JSON.parse(localStorage.getItem(Et)??"null");if(t===null||typeof t!="object")return s;const e=t;return{sidebarCollapsed:e.sidebarCollapsed===!0,collapsedWorkspaces:Array.isArray(e.collapsedWorkspaces)?e.collapsedWorkspaces.filter(n=>typeof n=="string"):[],lastSessionId:typeof e.lastSessionId=="string"?e.lastSessionId:void 0}}catch{return s}}const me=he("ui",()=>{const s=un(),t=T(s.sidebarCollapsed),e=T(s.collapsedWorkspaces),n=T(s.lastSessionId),o=T(!1),i=T(960),a=S(()=>i.value<720?"compact":i.value<960?"regular":"wide");Y([t,e,n],()=>{try{localStorage.setItem(Et,JSON.stringify({sidebarCollapsed:t.value,collapsedWorkspaces:e.value,lastSessionId:n.value}))}catch{}},{deep:!0});const r=matchMedia("(prefers-color-scheme: dark)"),p=()=>{document.documentElement.classList.toggle("dark",r.matches)};p(),r.addEventListener("change",p);function v(y){i.value=y,a.value!=="compact"&&(o.value=!1)}function f(y){return!e.value.includes(y)}function g(y){e.value=f(y)?[...e.value,y]:e.value.filter(b=>b!==y)}return{sidebarCollapsed:t,lastSessionId:n,drawerOpen:o,shellWidth:i,shellMode:a,setShellWidth:v,isWorkspaceExpanded:f,toggleWorkspace:g}}),hn=["aria-label"],pn={class:"brand-row"},mn={class:"brand-copy"},fn=["aria-label"],vn=["aria-label"],gn={class:"sidebar-new-label"},yn={class:"ui-field-wrap sidebar-search"},wn=["placeholder","aria-label"],bn={class:"workspace-scroll app-scroll-viewport"},kn={class:"section-label"},_n={key:0,class:"sidebar-empty",role:"alert"},In={key:1,class:"sidebar-empty"},$n={class:"sidebar-footer"},xn=N({__name:"AppSidebar",emits:["navigate"],setup(s){const{t}=j(),e=je(),n=U(),o=me(),i=T(""),a=T(Date.now());let r;oe(()=>{r=setInterval(()=>{a.value=Date.now()},6e4)}),pe(()=>clearInterval(r));const p=S(()=>typeof e.params.sessionId=="string"?e.params.sessionId:void 0),v=S(()=>{var b;return p.value===void 0||(b=n.byId.get(p.value))==null?void 0:b.cwd}),f=S(()=>({name:"chat-new",...v.value===void 0?{}:{query:{cwd:v.value}}})),g=S(()=>i.value.trim().toLocaleLowerCase()),y=S(()=>n.workspaces.flatMap(b=>{if(g.value==="")return[b];const k=b.name.toLocaleLowerCase().includes(g.value)||b.cwd.toLocaleLowerCase().includes(g.value)?b.sessions:b.sessions.filter(u=>{var d;return(d=u.preview)==null?void 0:d.toLocaleLowerCase().includes(g.value)});return k.length===0?[]:[{...b,sessions:k}]}));return(b,$)=>(c(),m("aside",{class:"app-sidebar","aria-label":l(t)("a11y.workspaceSessionIndex")},[h("header",pn,[z(Ee,{class:"brand-logo"}),h("strong",mn,w(l(t)("brand.product")),1),h("button",{class:"ui-icon-button sidebar-collapse","data-variant":"ghost","data-size":"sm",type:"button","aria-label":l(t)("sidebar.closeMenu"),onClick:$[0]||($[0]=k=>l(o).sidebarCollapsed=!0)},[z(l(rs),{"aria-hidden":"true"})],8,fn)]),h("nav",{class:"primary-actions","aria-label":l(t)("a11y.primaryNavigation")},[z(l(ve),{class:"ui-button sidebar-new","data-variant":"secondary","data-size":"md",to:f.value,onClick:$[1]||($[1]=k=>b.$emit("navigate"))},{default:se(()=>[z(l(St),{"aria-hidden":"true"}),h("span",gn,w(l(t)("sidebar.newSession")),1)]),_:1},8,["to"])],8,vn),h("div",yn,[z(l(He),{"aria-hidden":"true"}),X(h("input",{"onUpdate:modelValue":$[2]||($[2]=k=>i.value=k),class:"ui-field","data-size":"md",type:"search",placeholder:l(t)("sidebar.searchPlaceholder"),"aria-label":l(t)("common.search")},null,8,wn),[[Te,i.value]])]),h("div",bn,[h("p",kn,w(l(t)("sidebar.workspaces")),1),l(n).error&&!l(n).loaded?(c(),m("p",_n,w(l(n).error),1)):l(n).loaded&&y.value.length===0?(c(),m("p",In,w(l(t)(g.value?"sidebar.noMatches":"sidebar.noWorkspaces")),1)):A("",!0),(c(!0),m(F,null,B(y.value,k=>(c(),q(dn,{key:k.cwd,workspace:k,expanded:g.value!==""||l(o).isWorkspaceExpanded(k.cwd),"active-session-id":p.value,"now-ms":a.value,onToggle:u=>l(o).toggleWorkspace(k.cwd),onNavigate:$[3]||($[3]=u=>b.$emit("navigate"))},null,8,["workspace","expanded","active-session-id","now-ms","onToggle"]))),128))]),h("footer",$n,[z(Us)])],8,hn))}}),ct=ee(xn,[["__scopeId","data-v-716c88db"]]),Sn=["role","onMouseenter","onMouseleave","onFocusin","onFocusout"],Cn=["data-tone"],Mn={class:"ui-toast-title"},Tn={key:0,class:"ui-toast-description"},En=["onClick"],On=["aria-label","onClick"],An=N({__name:"ToastRegion",setup(s){const{t}=j(),e=Ye();function n(o){var i;e.dismiss(o.id),(i=o.action)==null||i.run()}return(o,i)=>(c(),q(Nt,{name:"ui-toast",tag:"div",class:"ui-toast-region","aria-live":"polite"},{default:se(()=>[(c(!0),m(F,null,B(l(e).toasts,a=>(c(),m("div",{key:a.id,class:"ui-toast",role:a.tone==="danger"?"alert":"status",onMouseenter:r=>l(e).pause(a.id),onMouseleave:r=>l(e).resume(a.id),onFocusin:r=>l(e).pause(a.id),onFocusout:r=>l(e).resume(a.id)},[h("span",{class:"ui-toast-icon","data-tone":a.tone},[a.tone==="danger"?(c(),q(l(Fe),{key:0,"aria-hidden":"true"})):a.tone==="info"?(c(),q(l(as),{key:1,"aria-hidden":"true"})):(c(),q(l(be),{key:2,"aria-hidden":"true"}))],8,Cn),h("div",null,[h("p",Mn,w(a.title),1),a.description?(c(),m("p",Tn,w(a.description),1)):A("",!0)]),a.action?(c(),m("button",{key:0,type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:r=>n(a)},w(a.action.label),9,En)):(c(),m("button",{key:1,type:"button",class:"ui-icon-button","data-variant":"close","data-size":"xs","aria-label":l(t)("common.close"),onClick:r=>l(e).dismiss(a.id)},[z(l(Fe),{"aria-hidden":"true"})],8,On))],40,Sn))),128))]),_:1}))}}),Rn=["data-mode","data-sidebar-collapsed","data-chat-route"],zn={key:0,class:"compact-header"},Ln=["aria-label"],qn={class:"compact-title"},Pn={class:"sr-only"},Fn=["aria-label"],Wn={class:"content-region"},Dn=["aria-label"],Nn=["aria-label"],jn={class:"main-header"},Bn={key:1,class:"reconnect-banner",role:"status"},dt="details.session-menu[open], details.composer-popover[open]",Vn=N({__name:"AppShell",setup(s){const t=je(),{t:e}=j(),n=K(),o=U(),i=me(),a=T(),r=T();let p;const v=S(()=>t.name==="chat-new"||t.name==="chat-session"),f=S(()=>{if(t.name==="chat-session"&&typeof t.params.sessionId=="string"){const k=o.byId.get(t.params.sessionId);return(k==null?void 0:k.preview)??(k===void 0?e("route.session"):Oe(k.cwd))}return t.name==="not-found"?e("route.notFound"):e("route.newSession")});Y(f,k=>{document.title=`${k} — Dim`},{immediate:!0}),Y(()=>i.drawerOpen,async k=>{await we();const u=r.value;u!==void 0&&(k&&!u.open?u.showModal():!k&&u.open&&u.close())});function g(k){const u=k.target instanceof Node?k.target:void 0;for(const d of document.querySelectorAll(dt))(u===void 0||!d.contains(u))&&(d.open=!1)}function y(k){if(k.key==="Escape"){for(const d of document.querySelectorAll(dt))d.open=!1;return}(navigator.userAgent.includes("Mac")?k.metaKey:k.ctrlKey)&&!k.altKey&&!k.shiftKey&&k.key.toLowerCase()==="b"&&(k.preventDefault(),i.shellMode==="compact"?i.drawerOpen=!i.drawerOpen:i.sidebarCollapsed=!i.sidebarCollapsed)}function b(){n.phase==="connected"&&o.refresh()}oe(()=>{a.value!==void 0&&(p=new ResizeObserver(([k])=>{k!==void 0&&i.setShellWidth(k.contentRect.width)}),p.observe(a.value)),window.addEventListener("keydown",y),window.addEventListener("focus",b),document.addEventListener("pointerdown",g,!0)}),pe(()=>{p==null||p.disconnect(),window.removeEventListener("keydown",y),window.removeEventListener("focus",b),document.removeEventListener("pointerdown",g,!0)});function $(k){k.target===r.value&&(i.drawerOpen=!1)}return(k,u)=>{var _;const d=le("tooltip");return c(),m("div",{ref_key:"root",ref:a,class:"app-shell","data-mode":l(i).shellMode,"data-sidebar-collapsed":l(i).sidebarCollapsed,"data-chat-route":v.value,style:{"--sidebar-width":"280px"}},[z(An),l(i).shellMode==="compact"?(c(),m("header",zn,[h("button",{class:"ui-icon-button","data-variant":"ghost","data-size":"md",type:"button","aria-label":l(e)("sidebar.openMenu"),onClick:u[0]||(u[0]=I=>l(i).drawerOpen=!0)},[z(l(xt),{"aria-hidden":"true"})],8,Ln),h("span",qn,w(f.value),1)])):A("",!0),l(i).shellMode==="compact"?(c(),m("dialog",{key:1,ref_key:"drawer",ref:r,class:"drawer-content",onClick:$,onClose:u[3]||(u[3]=I=>l(i).drawerOpen=!1)},[h("h2",Pn,w(l(e)("sidebar.workspaces")),1),h("button",{autofocus:"",class:"ui-icon-button drawer-close","data-variant":"ghost","data-size":"md",type:"button","aria-label":l(e)("sidebar.closeMenu"),onClick:u[1]||(u[1]=I=>l(i).drawerOpen=!1)},[z(l(Fe),{"aria-hidden":"true"})],8,Fn),z(ct,{onNavigate:u[2]||(u[2]=I=>l(i).drawerOpen=!1)})],544)):A("",!0),l(i).shellMode!=="compact"&&!l(i).sidebarCollapsed?(c(),q(ct,{key:2,class:"inline-sidebar"})):A("",!0),h("div",Wn,[h("main",{id:"main",class:"main-region","aria-label":l(e)("a11y.mainContent")},[l(i).sidebarCollapsed&&l(i).shellMode!=="compact"?X((c(),m("button",{key:0,class:"ui-icon-button sidebar-reopen","data-variant":"ghost","data-size":"md",type:"button","aria-label":l(e)("sidebar.openMenu"),onClick:u[4]||(u[4]=I=>l(i).sidebarCollapsed=!1)},[z(l(ls),{"aria-hidden":"true"})],8,Nn)),[[d,l(e)("sidebar.openMenu")]]):A("",!0),h("header",jn,[h("div",null,[h("p",null,"Dim "+w((_=l(n).hello)==null?void 0:_.serverVersion),1),h("strong",null,w(f.value),1)])]),l(n).phase==="reconnecting"?(c(),m("p",Bn,w(l(e)("page.reconnecting")),1)):A("",!0),(c(),q(l(jt),{key:l(t).fullPath}))],8,Dn)])],8,Rn)}}}),Hn={class:"skip-link",href:"#main"},Un={key:1,id:"main",class:"boot-page",tabindex:"-1","aria-busy":"true"},Kn={class:"sr-only"},Yn={key:2,id:"main",class:"auth-page",tabindex:"-1"},Gn={class:"eyebrow"},Zn={key:0},Jn={key:1},Xn=N({__name:"AppRoot",setup(s){const{t}=j(),e=K(),n=S(()=>e.everConnected&&e.phase!=="unauthenticated"&&e.phase!=="version-mismatch"),o=S(()=>e.phase==="unauthenticated"?t("auth.expiredTitle"):e.phase==="version-mismatch"?t("auth.versionTitle"):t("auth.connectingTitle"));return Y([n,o],([i,a])=>{i||(document.title=`${a} — Dim`)},{immediate:!0}),(i,a)=>(c(),m(F,null,[h("a",Hn,w(l(t)("common.skipToContent")),1),n.value?(c(),q(Vn,{key:0})):l(e).phase==="connecting"||l(e).phase==="reconnecting"?(c(),m("main",Un,[z(Ee,{animated:"",class:"boot-mark"}),h("h1",Kn,w(o.value),1)])):(c(),m("main",Yn,[a[1]||(a[1]=h("span",{class:"auth-signal","aria-hidden":"true"},null,-1)),h("p",Gn,w(l(t)("brand.webHost")),1),h("h1",null,w(o.value),1),l(e).phase==="unauthenticated"?(c(),m("p",Zn,[H(w(l(t)("auth.expiredBefore")),1),a[0]||(a[0]=h("code",null,"dimcode web",-1)),H(w(l(t)("auth.expiredAfter")),1)])):(c(),m("p",Jn,w(l(t)("auth.versionDescription")),1))]))],64))}}),Qn=400,eo=300,ut=6,Re=8,Ge="ui-tooltip";let V,Q,ye,Ot=0,We=null,Ze=!1;function to(){return V!==void 0||(V=document.createElement("div"),V.id=Ge,V.className="ui-tooltip",V.setAttribute("role","tooltip"),V.popover="manual",Object.assign(V.style,{position:"fixed",inset:"auto",margin:"0",border:"0",overflow:"visible"}),document.body.append(V)),V}function Me(s){clearTimeout(ye);const t=s._tooltip;if(!t||!s.isConnected)return;const e=to();e.textContent=t,e.matches(":popover-open")||e.showPopover(),Q=s,s.getAttribute("aria-label")!==t&&s.setAttribute("aria-describedby",Ge),so(s,e)}function so(s,t){const e=s.getBoundingClientRect(),n=t.getBoundingClientRect(),o=e.top-ut-n.height,i=o>=Re?o:e.bottom+ut,a=e.left+e.width/2-n.width/2,r=Math.min(Math.max(a,Re),window.innerWidth-Re-n.width);t.style.left=`${Math.round(r)}px`,t.style.top=`${Math.round(i)}px`}function te(){clearTimeout(ye),ye=void 0,Q!==void 0&&(Q.getAttribute("aria-describedby")===Ge&&Q.removeAttribute("aria-describedby"),Q=void 0,V!=null&&V.matches(":popover-open")&&V.hidePopover())}function no(s){const t=s.currentTarget;clearTimeout(ye),!Ze&&(performance.now()<Ot?Me(t):ye=setTimeout(()=>Me(t),Qn))}function oo(){Q!==void 0&&(Ot=performance.now()+eo),te()}function io(s){const t=s.currentTarget;if(t===We){We=null;return}t.matches(":focus-visible")&&Me(t)}function ao(s){Ze=s.pointerType==="touch",Q!==void 0&&!(s.target instanceof Node&&Q.contains(s.target))&&te()}function ro(){We=document.activeElement,te()}function lo(s){s.key==="Escape"&&te()}const ht=[["mouseenter",no],["mouseleave",oo],["focus",io],["blur",te],["pointerdown",te],["keydown",lo]];let pt=!1;function co(){pt||(pt=!0,window.addEventListener("scroll",te,{capture:!0,passive:!0}),window.addEventListener("blur",ro),document.addEventListener("pointermove",ao,{passive:!0}),document.addEventListener("pointerdown",s=>{Ze=s.pointerType==="touch"},{capture:!0,passive:!0}))}const uo={mounted(s,t){s._tooltip=t.value;for(const[e,n]of ht)s.addEventListener(e,n);co()},updated(s,t){s._tooltip=t.value,Q===s&&(t.value?Me(s):te())},beforeUnmount(s){Q===s&&te();for(const[t,e]of ht)s.removeEventListener(t,e)}};let ho;function At(){return ho??(ho=Tt(async()=>{const{default:s}=await import("./index-RuQTkZJb.js").then(t=>t.a4);return{default:s}},__vite__mapDeps([0,1])).then(({default:s})=>s))}const mt={read:"tool.read",read_file:"tool.read",write:"tool.write",write_file:"tool.write",edit:"tool.edit",edit_file:"tool.edit",apply_patch:"tool.edit",grep:"tool.grep",rg:"tool.grep",glob:"tool.glob"};function po(s){const t=s.trim().toLowerCase();return t.split(/(?:__|[./\s:-])+/).filter(Boolean).at(-1)??t}function Je(s,t){const e=s.trim().toLowerCase();if(e.startsWith("mcp__"))return{renderer:"generic",labelKey:"prompt.useTool"};const n=po(s);if(["exec","bash","shell","run_command","exec_command"].includes(n))return{renderer:"command",labelKey:t.runInBackground===!0?"tool.runBackground":"tool.run"};if(["grep","rg","glob","find","ls","list_files"].includes(n)){const o=typeof t.pattern=="string"?t.pattern:void 0;return{renderer:"search",labelKey:n==="glob"&&(!o||o==="*")?"tool.listFiles":mt[n]??"tool.grep"}}return["read","read_file","write","write_file","edit","edit_file","apply_patch"].includes(n)?{renderer:"file",labelKey:mt[n]??"tool.edit"}:e.includes("web_search")||n==="websearch"?{renderer:"web",labelKey:"tool.webSearch"}:e.includes("web_fetch")||n==="webfetch"?{renderer:"web",labelKey:"tool.webFetch"}:{renderer:"generic",labelKey:"prompt.useTool"}}function Rt(s,t){if(t!==void 0)return t.split(`
164
+ `).filter(o=>!o.startsWith("---")&&!o.startsWith("+++")&&!o.startsWith("@@")).map(o=>{const i=o.startsWith("+")?"+":o.startsWith("-")?"-":" ";return{sign:i,text:i===" "?o.replace(/^ /,""):o.slice(1)}});const e=typeof s.oldText=="string"?s.oldText:void 0,n=typeof s.newText=="string"?s.newText:void 0;return e===void 0||n===void 0?[]:[...e.split(`
165
+ `).map(o=>({sign:"-",text:o})),...n.split(`
166
+ `).map(o=>({sign:"+",text:o}))]}const mo={class:"prompt-card","data-inline-interaction-prompt":""},fo={class:"prompt-header"},vo={class:"prompt-icon","aria-hidden":"true"},go={class:"prompt-title"},yo={class:"ui-badge","data-tone":"warning"},wo={key:0,class:"prompt-subtitle"},bo={key:1,class:"approval-command"},ko={key:0,class:"approval-muted"},_o={key:2,class:"approval-panel"},Io={class:"approval-panel-header"},$o={key:0,class:"approval-panel-body"},xo={key:1,class:"approval-panel-body"},So={class:"approval-line-number"},Co={key:3,class:"approval-panel"},Mo={class:"approval-panel-header"},To={class:"approval-panel-body"},Eo={key:0},Oo={key:1},Ao={key:2},Ro={key:3,class:"approval-muted"},zo={key:4,class:"approval-panel"},Lo={class:"approval-panel-header is-mono"},qo={class:"approval-panel-body"},Po={key:5,class:"approval-panel"},Fo={class:"approval-panel-body approval-muted"},Wo={key:6,class:"prompt-error",role:"alert"},Do={class:"prompt-buttons"},No=["disabled"],jo=["disabled"],Bo=N({__name:"ApprovalPrompt",props:{sessionId:{},request:{}},setup(s){const t=s,{t:e}=j(),n=ge(),o=T(!1),i=T(""),a=S(()=>t.request.call.input),r=S(()=>Je(t.request.call.name,a.value)),p={command:ds,search:He,file:ns,web:is,generic:ps};function v(u){const d=a.value[u];return typeof d=="string"&&d.trim()!==""?d:void 0}const f=S(()=>t.request.call.name.trim().toLowerCase()),g=S(()=>f.value==="edit"?Rt(a.value,void 0):[]),y=S(()=>f.value==="write"?v("content"):void 0),b=S(()=>Object.entries(a.value).filter(([u])=>!["command","cwd","path","pattern","oldText","newText","content","query","url"].includes(u)).map(([u,d])=>({key:u,value:typeof d=="string"?d:JSON.stringify(d)})));async function $(u){if(!o.value){o.value=!0,i.value="";try{await n.respond(t.sessionId,t.request,u)}catch(d){i.value=d instanceof Error&&d.message?d.message:e("prompt.permissionSubmitFailed"),o.value=!1}}}function k(u){if(o.value||u.defaultPrevented||document.querySelector("dialog[open]")!==null)return;const d=u.target;d instanceof HTMLElement&&(d.tagName==="INPUT"||d.tagName==="TEXTAREA"||d.isContentEditable)||(u.key==="Enter"||u.key==="y"||u.key==="Y"?(u.preventDefault(),$("allow")):(u.key==="Escape"||u.key==="n"||u.key==="N")&&(u.preventDefault(),$("deny")))}return oe(()=>window.addEventListener("keydown",k)),pe(()=>window.removeEventListener("keydown",k)),(u,d)=>(c(),m("article",mo,[h("header",fo,[h("span",vo,[(c(),q(_t(p[r.value.renderer]),{size:12,"stroke-width":2.25}))]),h("h2",go,w(l(e)("prompt.actionRequest",{action:r.value.renderer==="generic"?s.request.call.name:l(e)(r.value.labelKey)})),1),h("span",yo,w(l(e)("prompt.awaitingApproval")),1)]),s.request.reason?(c(),m("p",wo,w(s.request.reason),1)):A("",!0),r.value.renderer==="command"?(c(),m("div",bo,[h("div",null,[d[2]||(d[2]=h("span",{class:"approval-muted"},"$",-1)),H(" "+w(v("command")),1)]),v("cwd")?(c(),m("div",ko," cwd: "+w(v("cwd")),1)):A("",!0)])):r.value.renderer==="file"?(c(),m("div",_o,[h("div",Io,w(v("path")??s.request.call.name),1),g.value.length?(c(),m("div",$o,[(c(!0),m(F,null,B(g.value,(_,I)=>(c(),m("div",{key:I,class:Z(_.sign==="-"?"approval-diff-del":"approval-diff-add")},w(_.sign)+" "+w(_.text),3))),128))])):y.value!==void 0?(c(),m("div",xo,[(c(!0),m(F,null,B(y.value.split(`
167
+ `),(_,I)=>(c(),m("div",{key:I,class:"approval-code-line"},[h("span",So,w(I+1),1),H(w(_),1)]))),128))])):A("",!0)])):r.value.renderer==="search"||r.value.renderer==="web"?(c(),m("div",Co,[h("div",Mo,w(l(e)("prompt.input")),1),h("div",To,[v("pattern")?(c(),m("div",Eo,"pattern: "+w(v("pattern")),1)):A("",!0),v("query")?(c(),m("div",Oo,"query: "+w(v("query")),1)):A("",!0),v("url")?(c(),m("div",Ao,"url: "+w(v("url")),1)):A("",!0),v("path")?(c(),m("div",Ro,"path: "+w(v("path")),1)):A("",!0)])])):(c(),m("div",zo,[h("div",Lo,w(s.request.call.name),1),h("pre",qo,w(JSON.stringify(a.value,null,2)),1)])),r.value.renderer!=="generic"&&b.value.length?(c(),m("div",Po,[h("div",Fo,[(c(!0),m(F,null,B(b.value,_=>(c(),m("div",{key:_.key},w(_.key)+": "+w(_.value),1))),128))])])):A("",!0),i.value?(c(),m("p",Wo,w(i.value),1)):A("",!0),h("div",Do,[h("button",{type:"button",class:"ui-button","data-size":"md","data-variant":"ghost",disabled:o.value,onClick:d[0]||(d[0]=_=>$("deny"))},w(l(e)("prompt.reject")),9,No),h("button",{type:"button",class:"ui-button","data-size":"md","data-variant":"primary",disabled:o.value,onClick:d[1]||(d[1]=_=>$("allow"))},w(l(e)("prompt.allowOnce")),9,jo)])]))}}),zt=he("models",()=>{const s=T(),t=T("");let e;const n=S(()=>{const p=K();return p.supports("provider.list")&&p.supports("provider.catalog")});function o(){return e??(e=i().finally(()=>{e=void 0})),e}async function i(){const p=K().client;t.value="";try{const f=(await p.call("provider.list",{},ks)).filter(y=>y.enabled&&y.credentialConfigured),g=await Promise.all(f.map(y=>p.call("provider.catalog",{providerId:y.providerId},_s).catch(()=>{})));s.value=f.flatMap((y,b)=>{const $=g[b];if($===void 0)return[];const k=new Set($.disabledModelIds),u=$.models.filter(d=>d.unavailableReason===void 0&&!k.has(d.id));return u.length===0?[]:[{providerId:y.providerId,name:y.displayName,models:u}]})}catch(v){t.value=v instanceof Error?v.message:String(v)}}async function a(p){if(K().supports("provider.selection"))return K().client.call("provider.selection",{cwd:p},Is).catch(()=>{})}function r(p){var f,g;const v=(f=s.value)==null?void 0:f.find(y=>y.providerId===p.providerId);return((g=v==null?void 0:v.models.find(y=>y.id===p.modelId))==null?void 0:g.name)??p.modelId}return{providers:s,error:t,available:n,load:o,defaultFor:a,nameOf:r}}),Vo={key:0,class:"ui-button model-trigger","data-variant":"ghost","data-size":"sm","aria-disabled":"true"},Ho={class:"model-trigger-label"},Uo={class:"ui-button model-trigger","data-variant":"ghost","data-size":"sm"},Ko={key:0,class:"provider-badge","aria-hidden":"true"},Yo={class:"model-trigger-label"},Go={class:"composer-popover-content is-end ui-popover model-content","data-width":"xl"},Zo={class:"ui-menu-search model-search"},Jo=["placeholder","aria-label"],Xo={key:0,class:"menu-empty"},Qo={key:1,class:"menu-empty"},ei={key:2,class:"model-panes"},ti={key:0,class:"provider-pane"},si=["aria-current","onClick"],ni={class:"provider-badge","aria-hidden":"true"},oi=["aria-label"],ii={key:0,class:"menu-empty"},ai=["aria-selected","data-highlighted","title","onMouseenter","onClick"],ri={class:"model-check"},li={key:0,class:"provider-badge","aria-hidden":"true"},ci={class:"model-name"},di=N({__name:"ComposerModelMenu",props:{model:{},selectable:{type:Boolean},disabled:{type:Boolean}},emits:["select"],setup(s,{emit:t}){const e=s,n=t,{t:o}=j(),i=zt(),a=T(),r=T(),p=T(""),v=T(),f=T(0),g=S(()=>i.providers??[]),y=S(()=>g.value.flatMap(M=>M.models.map(R=>({providerId:M.providerId,providerName:M.name,modelId:R.id,name:R.name})))),b=S(()=>p.value.trim()!==""),$=S(()=>{if(!b.value)return y.value.filter(R=>R.providerId===v.value);const M=p.value.trim().toLocaleLowerCase();return y.value.filter(R=>[R.name,R.modelId,R.providerName].some(O=>O.toLocaleLowerCase().includes(M)))}),k=S(()=>e.model===void 0?o("composer.notConfigured"):i.nameOf(e.model));oe(()=>{e.selectable&&i.available&&i.providers===void 0&&i.load()});function u(M){var R;return M.providerId===((R=e.model)==null?void 0:R.providerId)&&M.modelId===e.model.modelId}function d(M){return M.trim().charAt(0).toLocaleUpperCase()}async function _(){var M,R,O,E;((M=a.value)==null?void 0:M.open)===!0&&(i.providers===void 0&&await i.load(),p.value="",v.value=((R=e.model)==null?void 0:R.providerId)??((O=g.value[0])==null?void 0:O.providerId),f.value=Math.max(0,$.value.findIndex(u)),await we(),matchMedia("(pointer: coarse)").matches||(E=r.value)==null||E.focus())}function I(M){a.value&&(a.value.open=!1),u(M)||n("select",{providerId:M.providerId,modelId:M.modelId})}function x(M){if(M.key==="ArrowDown")M.preventDefault(),f.value=Math.min($.value.length-1,f.value+1);else if(M.key==="ArrowUp")M.preventDefault(),f.value=Math.max(0,f.value-1);else if(M.key==="Enter"){M.preventDefault();const R=$.value[f.value];R!==void 0&&I(R)}}return(M,R)=>{const O=le("tooltip");return!s.selectable||!l(i).available?(c(),m("span",Vo,[h("span",Ho,w(k.value),1)])):(c(),m("details",{key:1,ref_key:"details",ref:a,class:Z(["composer-popover model-menu",{"is-disabled":s.disabled}]),onToggle:_},[X((c(),m("summary",Uo,[s.model?(c(),m("span",Ko,w(d(s.model.providerId)),1)):A("",!0),h("span",Yo,w(k.value),1)])),[[O,s.model?`${k.value} · ${s.model.providerId}`:void 0]]),h("div",Go,[h("label",Zo,[z(l(He),{"aria-hidden":"true"}),X(h("input",{ref_key:"searchInput",ref:r,"onUpdate:modelValue":R[0]||(R[0]=E=>p.value=E),type:"text",placeholder:l(o)("composer.searchModels"),"aria-label":l(o)("composer.searchModels"),onKeydown:x,onInput:R[1]||(R[1]=E=>f.value=0)},null,40,Jo),[[Te,p.value]])]),l(i).providers===void 0&&!l(i).error?(c(),m("p",Xo,[z(l(Ve),{class:"is-spinning","aria-hidden":"true"}),H(w(l(o)("composer.modelLoading")),1)])):l(i).error?(c(),m("p",Qo,[h("button",{type:"button",class:"ui-button","data-variant":"danger-ghost","data-size":"sm",onClick:R[2]||(R[2]=E=>l(i).load())},w(l(o)("composer.modelLoadRetry")),1)])):(c(),m("div",ei,[b.value?A("",!0):(c(),m("div",ti,[(c(!0),m(F,null,B(g.value,E=>(c(),m("button",{key:E.providerId,type:"button",class:"ui-menu-item","aria-current":v.value===E.providerId,onClick:L=>{v.value=E.providerId,f.value=0}},[h("span",ni,w(d(E.name)),1),h("span",null,w(E.name),1)],8,si))),128))])),h("div",{class:"model-pane",role:"listbox","aria-label":l(o)("composer.searchModels")},[$.value.length===0?(c(),m("p",ii,w(l(o)("composer.noModels")),1)):A("",!0),(c(!0),m(F,null,B($.value,(E,L)=>(c(),m("button",{key:`${E.providerId}:${E.modelId}`,type:"button",role:"option",class:"ui-menu-item","aria-selected":u(E),"data-highlighted":L===f.value?"":void 0,title:`${E.name} · ${E.providerName}`,onMouseenter:G=>f.value=L,onClick:G=>I(E)},[h("span",ri,[u(E)?(c(),q(l(be),{key:0,"aria-hidden":"true"})):A("",!0)]),b.value?(c(),m("span",li,w(d(E.providerName)),1)):A("",!0),h("span",ci,w(E.name),1)],40,ai))),128))],8,oi)]))])],34))}}}),ui=ee(di,[["__scopeId","data-v-2d7995f0"]]),hi=["aria-label"],pi={key:0,class:"inline-error",role:"alert"},mi=["placeholder","aria-label"],fi={class:"composer-toolbar"},vi={class:"composer-run-group"},gi=["data-variant","aria-label","disabled"],yi={key:1,class:"composer-statusbar"},wi={class:"composer-status-start"},bi=N({__name:"ComposerPanel",props:{running:{type:Boolean},stopping:{type:Boolean},model:{},modelSelectable:{type:Boolean},send:{type:Function},stop:{type:Function},selectModel:{type:Function}},setup(s,{expose:t}){const e=s,{t:n}=j(),o=T(),i=T(""),a=T(!1),r=T(!1),p=T(""),v=S(()=>e.running&&e.stop!==void 0&&i.value.trim()===""),f=S(()=>i.value.trim()!==""&&!a.value);function g(){const u=o.value;u!==void 0&&(u.style.height="auto",u.style.height=`${Math.min(u.scrollHeight,300)}px`)}async function y(){if(!f.value)return;const u=i.value;a.value=!0,p.value="";try{await e.send(u),i.value===u&&(i.value=""),await we(),g()}catch(d){p.value=d instanceof Error?d.message:String(d)}finally{a.value=!1}}async function b(){var u;p.value="";try{await((u=e.stop)==null?void 0:u.call(e))}catch(d){p.value=d instanceof Error?d.message:String(d)}}async function $(u){r.value=!0,p.value="";try{await e.selectModel(u)}catch(d){p.value=d instanceof Error?d.message:String(d)}finally{r.value=!1}}function k(u){u.key==="Enter"&&!u.shiftKey&&!u.altKey&&!u.isComposing&&(u.preventDefault(),y())}return oe(()=>{var u;return(u=o.value)==null?void 0:u.focus()}),t({focus:()=>{var u;return(u=o.value)==null?void 0:u.focus()}}),(u,d)=>{const _=le("tooltip");return c(),m("section",{class:"composer-panel","aria-label":l(n)("chat.composer")},[p.value?(c(),m("p",pi,w(p.value),1)):A("",!0),h("div",{class:"composer-surface",onClick:d[2]||(d[2]=I=>{var x;return(x=o.value)==null?void 0:x.focus()})},[X(h("textarea",{ref_key:"field",ref:o,"onUpdate:modelValue":d[0]||(d[0]=I=>i.value=I),class:"composer-input",rows:"2",placeholder:l(n)("composer.sendMessage"),"aria-label":l(n)("composer.sendMessage"),onInput:g,onKeydown:k},null,40,mi),[[Te,i.value]]),h("footer",fi,[d[3]||(d[3]=h("div",{class:"composer-tool-group"},null,-1)),h("div",vi,[z(ui,{model:s.model,selectable:s.modelSelectable,disabled:r.value,onSelect:$},null,8,["model","selectable","disabled"]),X((c(),m("button",{class:"ui-icon-button","data-variant":v.value?"contrast":"primary","data-size":"sm",type:"button","aria-label":v.value?l(n)("composer.stopResponse"):l(n)("composer.send"),disabled:v.value?s.stopping:!f.value,onClick:d[1]||(d[1]=xe(I=>v.value?b():y(),["stop"]))},[v.value?(c(),q(l(cs),{key:0,fill:"currentColor","aria-hidden":"true"})):(c(),q(l(ts),{key:1,"stroke-width":2.25,"aria-hidden":"true"}))],8,gi)),[[_,v.value?l(n)("composer.stopResponse"):l(n)("composer.send")]])])])]),u.$slots.status?(c(),m("div",yi,[h("div",wi,[Bt(u.$slots,"status",{},void 0,!0)])])):A("",!0)],8,hi)}}}),Lt=ee(bi,[["__scopeId","data-v-a481a4dd"]]);function ce(s,t,e){let n=e.initialDeps??[],o,i=!0;function a(){var r,p,v;let f;e.key&&((r=e.debug)!=null&&r.call(e))&&(f=Date.now());const g=s();if(!(g.length!==n.length||g.some(($,k)=>n[k]!==$)))return o;n=g;let b;if(e.key&&((p=e.debug)!=null&&p.call(e))&&(b=Date.now()),o=t(...g),e.key&&((v=e.debug)!=null&&v.call(e))){const $=Math.round((Date.now()-f)*100)/100,k=Math.round((Date.now()-b)*100)/100,u=k/16,d=(_,I)=>{for(_=String(_);_.length<I;)_=" "+_;return _};console.info(`%c⏱ ${d(k,5)} /${d($,5)} ms`,`
168
+ font-size: .6rem;
169
+ font-weight: bold;
170
+ color: hsl(${Math.max(0,Math.min(120-120*u,120))}deg 100% 31%);`,e==null?void 0:e.key)}return e!=null&&e.onChange&&!(i&&e.skipInitialOnChange)&&e.onChange(o),i=!1,o}return a.updateDeps=r=>{n=r},a}function ft(s,t){if(s===void 0)throw new Error("Unexpected undefined");return s}const ki=(s,t)=>Math.abs(s-t)<1.01,_i=(s,t,e)=>{let n;return function(...o){s.clearTimeout(n),n=s.setTimeout(()=>t.apply(this,o),e)}},vt=s=>{const{offsetWidth:t,offsetHeight:e}=s;return{width:t,height:e}},Ii=s=>s,$i=s=>{const t=Math.max(s.startIndex-s.overscan,0),e=Math.min(s.endIndex+s.overscan,s.count-1),n=[];for(let o=t;o<=e;o++)n.push(o);return n},xi=(s,t)=>{const e=s.scrollElement;if(!e)return;const n=s.targetWindow;if(!n)return;const o=a=>{const{width:r,height:p}=a;t({width:Math.round(r),height:Math.round(p)})};if(o(vt(e)),!n.ResizeObserver)return()=>{};const i=new n.ResizeObserver(a=>{const r=()=>{const p=a[0];if(p!=null&&p.borderBoxSize){const v=p.borderBoxSize[0];if(v){o({width:v.inlineSize,height:v.blockSize});return}}o(vt(e))};s.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return i.observe(e,{box:"border-box"}),()=>{i.unobserve(e)}},gt={passive:!0},yt=typeof window>"u"?!0:"onscrollend"in window,Si=(s,t)=>{const e=s.scrollElement;if(!e)return;const n=s.targetWindow;if(!n)return;let o=0;const i=s.options.useScrollendEvent&&yt?()=>{}:_i(n,()=>{t(o,!1)},s.options.isScrollingResetDelay),a=f=>()=>{const{horizontal:g,isRtl:y}=s.options;o=g?e.scrollLeft*(y&&-1||1):e.scrollTop,i(),t(o,f)},r=a(!0),p=a(!1);e.addEventListener("scroll",r,gt);const v=s.options.useScrollendEvent&&yt;return v&&e.addEventListener("scrollend",p,gt),()=>{e.removeEventListener("scroll",r),v&&e.removeEventListener("scrollend",p)}},Ci=(s,t,e)=>{if(t!=null&&t.borderBoxSize){const n=t.borderBoxSize[0];if(n)return Math.round(n[e.options.horizontal?"inlineSize":"blockSize"])}return s[e.options.horizontal?"offsetWidth":"offsetHeight"]},Mi=(s,{adjustments:t=0,behavior:e},n)=>{var o,i;const a=s+t;(i=(o=n.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[n.options.horizontal?"left":"top"]:a,behavior:e})};class Ti{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e,n,o;return((o=(n=(e=this.targetWindow)==null?void 0:e.performance)==null?void 0:n.now)==null?void 0:o.call(n))??Date.now()},this.observer=(()=>{let e=null;const n=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(o=>{o.forEach(i=>{const a=()=>{const r=i.target,p=this.indexFromElement(r);if(!r.isConnected){this.observer.unobserve(r),this.elementsCache.delete(this.options.getItemKey(p));return}this.shouldMeasureDuringScroll(p)&&this.resizeItem(p,this.options.measureElement(r,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var o;(o=n())==null||o.disconnect(),e=null},observe:o=>{var i;return(i=n())==null?void 0:i.observe(o,{box:"border-box"})},unobserve:o=>{var i;return(i=n())==null?void 0:i.unobserve(o)}}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([n,o])=>{typeof o>"u"&&delete e[n]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Ii,rangeExtractor:$i,onChange:()=>{},measureElement:Ci,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...e}},this.notify=e=>{var n,o;(o=(n=this.options).onChange)==null||o.call(n,this,e)},this.maybeNotify=ce(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;const n=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==n){if(this.cleanup(),!n){this.maybeNotify();return}this.scrollElement=n,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((e=this.scrollElement)==null?void 0:e.window)??null,this.elementsCache.forEach(o=>{this.observer.observe(o)}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=i,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,n)=>{const o=new Map,i=new Map;for(let a=n-1;a>=0;a--){const r=e[a];if(o.has(r.lane))continue;const p=i.get(r.lane);if(p==null||r.end>p.end?i.set(r.lane,r):r.end<p.end&&o.set(r.lane,!0),o.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((a,r)=>a.end===r.end?a.index-r.index:a.end-r.end)[0]:void 0},this.getMeasurementOptions=ce(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,n,o,i,a,r)=>(this.prevLanes!==void 0&&this.prevLanes!==r&&(this.lanesChangedFlag=!0),this.prevLanes=r,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:a,lanes:r}),{key:!1}),this.getMeasurements=ce(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:a,lanes:r},p)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const y of this.laneAssignments.keys())y>=e&&this.laneAssignments.delete(y);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(y=>{this.itemSizeCache.set(y.key,y.size)}));const v=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);const f=this.measurementsCache.slice(0,v),g=new Array(r).fill(void 0);for(let y=0;y<v;y++){const b=f[y];b&&(g[b.lane]=y)}for(let y=v;y<e;y++){const b=i(y),$=this.laneAssignments.get(y);let k,u;if($!==void 0&&this.options.lanes>1){k=$;const x=g[k],M=x!==void 0?f[x]:void 0;u=M?M.end+this.options.gap:n+o}else{const x=this.options.lanes===1?f[y-1]:this.getFurthestMeasurement(f,y);u=x?x.end+this.options.gap:n+o,k=x?x.lane:y%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(y,k)}const d=p.get(b),_=typeof d=="number"?d:this.options.estimateSize(y),I=u+_;f[y]={index:y,start:u,size:_,end:I,key:b,lane:k},g[k]=y}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ce(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,o,i)=>this.range=e.length>0&&n>0?Ei({measurements:e,outerSize:n,scrollOffset:o,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ce(()=>{let e=null,n=null;const o=this.calculateRange();return o&&(e=o.startIndex,n=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,n]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,n]},(e,n,o,i,a)=>i===null||a===null?[]:e({startIndex:i,endIndex:a,overscan:n,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{const n=this.options.indexAttribute,o=e.getAttribute(n);return o?parseInt(o,10):(console.warn(`Missing attribute name '${n}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var n;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((n=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:n.index);if(o!==void 0&&this.range){const i=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),a=Math.max(0,o-i),r=Math.min(this.options.count-1,o+i);return e>=a&&e<=r}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((a,r)=>{a.isConnected||(this.observer.unobserve(a),this.elementsCache.delete(r))});return}const n=this.indexFromElement(e),o=this.options.getItemKey(n),i=this.elementsCache.get(o);i!==e&&(i&&this.observer.unobserve(i),this.observer.observe(e),this.elementsCache.set(o,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,n)=>{var o;const i=this.measurementsCache[e];if(!i)return;const a=this.itemSizeCache.get(i.key)??i.size,r=n-a;r!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,r,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,n)),this.notify(!1))},this.getVirtualItems=ce(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{const o=[];for(let i=0,a=e.length;i<a;i++){const r=e[i],p=n[r];o.push(p)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const n=this.getMeasurements();if(n.length!==0)return ft(n[qt(0,n.length-1,o=>ft(n[o]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,n,o=0)=>{if(!this.scrollElement)return 0;const i=this.getSize(),a=this.getScrollOffset();n==="auto"&&(n=e>=a+i?"end":"start"),n==="center"?e+=(o-i)/2:n==="end"&&(e-=i);const r=this.getMaxScrollOffset();return Math.max(Math.min(r,e),0)},this.getOffsetForIndex=(e,n="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));const o=this.getSize(),i=this.getScrollOffset(),a=this.measurementsCache[e];if(!a)return;if(n==="auto")if(a.end>=i+o-this.options.scrollPaddingEnd)n="end";else if(a.start<=i+this.options.scrollPaddingStart)n="start";else return[i,n];if(n==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),n];const r=n==="end"?a.end+this.options.scrollPaddingEnd:a.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(r,n,a.size),n]},this.scrollToOffset=(e,{align:n="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(e,n),a=this.now();this.scrollState={index:null,align:n,behavior:o,startedAt:a,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:n="auto",behavior:o="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));const i=this.getOffsetForIndex(e,n);if(!i)return;const[a,r]=i,p=this.now();this.scrollState={index:e,align:r,behavior:o,startedAt:p,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:n="auto"}={})=>{const o=this.getScrollOffset()+e,i=this.now();this.scrollState={index:null,align:"start",behavior:n,startedAt:i,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;const n=this.getMeasurements();let o;if(n.length===0)o=this.options.paddingStart;else if(this.options.lanes===1)o=((e=n[n.length-1])==null?void 0:e.end)??0;else{const i=Array(this.options.lanes).fill(null);let a=n.length-1;for(;a>=0&&i.some(r=>r===null);){const r=n[a];i[r.lane]===null&&(i[r.lane]=r.end),a--}o=Math.max(...i.filter(r=>r!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:n,behavior:o})=>{this.options.scrollToFn(e,{behavior:o,adjustments:n},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(t)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const n=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=n?n[0]:this.scrollState.lastTargetOffset,i=1,a=o!==this.scrollState.lastTargetOffset;if(!a&&ki(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.scrollState=null;return}}else this.scrollState.stableFrames=0,a&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const qt=(s,t,e,n)=>{for(;s<=t;){const o=(s+t)/2|0,i=e(o);if(i<n)s=o+1;else if(i>n)t=o-1;else return o}return s>0?s-1:0};function Ei({measurements:s,outerSize:t,scrollOffset:e,lanes:n}){const o=s.length-1,i=p=>s[p].start;if(s.length<=n)return{startIndex:0,endIndex:o};let a=qt(0,o,i,e),r=a;if(n===1)for(;r<o&&s[r].end<e+t;)r++;else if(n>1){const p=Array(n).fill(0);for(;r<o&&p.some(f=>f<e+t);){const f=s[r];p[f.lane]=f.end,r++}const v=Array(n).fill(e+t);for(;a>=0&&v.some(f=>f>=e);){const f=s[a];v[f.lane]=f.start,a--}a=Math.max(0,a-a%n),r=Math.min(o,r+(n-1-r%n))}return{startIndex:a,endIndex:r}}function Oi(s){const t=new Ti(l(s)),e=Ne(t),n=t._didMount();return Y(()=>l(s).getScrollElement(),o=>{o&&t._willUpdate()},{immediate:!0}),Y(()=>l(s),o=>{t.setOptions({...o,onChange:(i,a)=>{var r;et(e),(r=o.onChange)==null||r.call(o,i,a)}}),t._willUpdate(),et(e)},{immediate:!0}),Vt(n),e}function Ai(s){return Oi(S(()=>({observeElementRect:xi,observeElementOffset:Si,scrollToFn:Mi,...l(s)})))}async function Xe(s){if(window.isSecureContext)return navigator.clipboard.writeText(s);const t=document.activeElement instanceof HTMLElement?document.activeElement:null,e=document.createElement("textarea");e.value=s,e.setAttribute("readonly",""),e.style.cssText="position:fixed;top:0;left:-9999px;font-size:16px;opacity:0",document.body.append(e),e.select(),e.setSelectionRange(0,s.length);const n=document.execCommand("copy");if(e.remove(),t==null||t.focus({preventScroll:!0}),!n)throw new Error("Copy to clipboard failed")}const Ri=/^[a-z][a-z\d+.-]*:/i;function wt(s){try{return decodeURIComponent(s)}catch{return s}}function zi(s){if(!(s===""||s.startsWith("#"))){if(s.startsWith("file:"))return wt(s.replace(/^file:(\/\/)?/,""));if(!Ri.test(s))return wt(s.split(/[?#]/)[0]??s)}}const Li={key:1,class:"chat-markdown chat-markdown--pending"};let ze;const qi=N({__name:"ChatMarkdown",props:{content:{},final:{type:Boolean},messageId:{}},setup(s){const{t}=j(),e=Ye(),n={fontSize:13,lineHeight:20},o=Ne(ze),i=T(!1);let a;function r(){i.value=document.documentElement.dataset.theme==="dark"||document.documentElement.classList.contains("dark")}oe(async()=>{r(),a=new MutationObserver(r),a.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),ze??(ze=await At()),o.value=ze}),pe(()=>a==null?void 0:a.disconnect());async function p(v){const f=v.target instanceof Element?v.target.closest("a[href]"):null,g=f===null?void 0:zi(f.getAttribute("href")??"");if(g!==void 0){v.preventDefault();try{await Xe(g),e.push({tone:"success",title:t("chat.pathCopied"),description:g})}catch{e.push({tone:"danger",title:t("chat.copyFailed")})}}}return(v,f)=>o.value?(c(),q(_t(o.value),{key:0,class:Z(["chat-markdown",{dark:i.value}]),content:s.content,final:s.final,"index-key":s.messageId,"is-dark":i.value,"code-block-options":n,"html-policy":"escape",mode:"chat","node-virtual":!1,onClick:p},null,8,["class","content","final","index-key","is-dark"])):(c(),m("div",Li,w(s.content),1))}}),Pi={class:"user-message","data-role":"user"},Fi={class:"sr-only"},Wi={class:"user-bubble"},Di=["aria-expanded"],Ni={class:"user-actions"},ji={class:"user-sent-time timestamp"},Bi=["aria-label"],Vi=N({__name:"TimelineUserMessage",props:{text:{},at:{}},setup(s){const t=s,{t:e,locale:n}=j(),o=T(),i=T(!1),a=T(!1),r=T(!1);let p;const v=S(()=>Ys(new Date(t.at),n.value));oe(async()=>{var g;await we(),i.value=(((g=o.value)==null?void 0:g.scrollHeight)??0)>300}),pe(()=>clearTimeout(p));async function f(){await Xe(t.text),r.value=!0,clearTimeout(p),p=setTimeout(()=>{r.value=!1},1500)}return(g,y)=>{const b=le("tooltip");return c(),m("article",Pi,[h("strong",Fi,w(l(e)("chat.you")),1),h("div",Wi,[h("div",{ref_key:"content",ref:o,class:Z(["user-bubble-content",{"is-clipped":i.value&&!a.value}])},w(s.text),3),i.value?(c(),m("button",{key:0,type:"button",class:"ui-button user-bubble-expand","data-variant":"ghost","data-size":"xs","aria-expanded":a.value,onClick:y[0]||(y[0]=$=>a.value=!a.value)},[z(l(Be),{"aria-hidden":"true",class:Z({"is-expanded":a.value})},null,8,["class"]),h("span",null,w(a.value?l(e)("message.collapse"):l(e)("message.expand")),1)],8,Di)):A("",!0)]),h("div",Ni,[h("span",ji,w(v.value),1),X((c(),m("button",{class:"ui-icon-button","data-variant":"ghost","data-size":"sm",type:"button","aria-label":l(e)("message.copy"),onClick:f},[r.value?(c(),q(l(be),{key:0,class:"is-copied","aria-hidden":"true"})):(c(),q(l($t),{key:1,"aria-hidden":"true"}))],8,Bi)),[[b,l(e)("message.copy")]])])])}}}),Hi=ee(Vi,[["__scopeId","data-v-243ff721"]]),Ui={class:"timeline-work-item"},Ki=["aria-expanded"],Yi=["title"],Gi={key:0},Zi={key:1,class:"timeline-work-item-summary"},Ji={class:"timeline-work-stat","data-tone":"success"},Xi={key:0,class:"timeline-work-stat","data-tone":"danger"},Qi={key:0,class:"timeline-work-item-details"},ea={key:0,class:"timeline-thinking-quote"},ta={key:1,class:"tool-panel"},sa={class:"tool-panel-label"},na=["title"],oa=["onClick"],ia={key:0,class:"tool-panel-code"},aa={class:"is-strong"},ra={key:0,class:"is-faint"},la={key:1,class:"tool-panel-code"},ca={class:"is-strong"},da={key:0,class:"is-faint"},ua={key:2,class:"tool-panel-diff"},ha=["data-sign"],pa={class:"tool-panel-sign","aria-hidden":"true"},ma={key:3,class:"tool-panel-lines"},fa={class:"tool-panel-line-number","aria-hidden":"true"},va={class:"tool-panel-line"},bt=2e4,ga=N({__name:"TimelineWorkItem",props:{item:{},expanded:{type:Boolean}},emits:["toggle"],setup(s,{emit:t}){const e=s,n=t,{t:o}=j(),i=S(()=>e.item.kind==="tool"?e.item:void 0),a=S(()=>i.value===void 0?void 0:Je(i.value.name,i.value.input)),r=S(()=>{const O=a.value;return O===void 0||i.value===void 0?"":O.renderer==="generic"?i.value.name:o(O.labelKey)}),p=S(()=>e.item.kind!=="thinking"?"":e.item.running?o("work.thinking"):o("work.thoughtFor",{duration:e.item.durationMs===void 0?"…":Zs(e.item.durationMs)})),v=S(()=>e.item.kind==="thinking"?e.item.content.trim():"");function f(O){return O.length<=bt?O:`${O.slice(0,bt)}…`}function g(O){var L;const E=(L=i.value)==null?void 0:L.input[O];return typeof E=="string"&&E!==""?E:void 0}const y=S(()=>{var O,E;return f((((E=(O=i.value)==null?void 0:O.result)==null?void 0:E.text)??"").replace(/\s+$/u,""))}),b=S(()=>{var O;return((O=i.value)==null?void 0:O.status)==="error"}),$=S(()=>{var O;return((O=i.value)==null?void 0:O.name.trim().toLowerCase())??""}),k=S(()=>{var O,E,L;return $.value==="edit"?Rt(((O=i.value)==null?void 0:O.input)??{},(L=(E=i.value)==null?void 0:E.result)==null?void 0:L.diff):[]}),u=S(()=>$.value==="write"?f(g("content")??""):""),d=S(()=>{if(k.value.length>0)return{added:k.value.filter(O=>O.sign==="+").length,removed:k.value.filter(O=>O.sign==="-").length};if(u.value!=="")return{added:u.value.split(`
171
+ `).length,removed:0}}),_=S(()=>{const O=i.value;if(O===void 0||a.value===void 0)return[];const E=y.value?[{id:"output",label:o("detail.output"),copy:y.value,body:"pre"}]:[];switch(a.value.renderer){case"command":{const L=g("command");return[...L===void 0?[]:[{id:"input",label:o("prompt.input"),copy:L,body:"command"}],...E]}case"search":{const L=g("pattern")??g("path");return[...L===void 0?[]:[{id:"input",label:o("prompt.input"),copy:L,body:"search"}],...E]}case"file":{const L=g("path")??O.name;return k.value.length>0?[{id:"file",label:L,copy:k.value.map(G=>`${G.sign}${G.text}`).join(`
172
+ `),body:"diff"},...b.value?E:[]]:u.value!==""?[{id:"file",label:L,copy:u.value,body:"lines"},...b.value?E:[]]:b.value?E:[]}default:{const L=Object.keys(O.input).length===0?"":f(JSON.stringify(O.input,null,2));return[...L?[{id:"input",label:o("prompt.input"),copy:L,body:"pre"}]:[],...E]}}}),I=S(()=>e.item.kind==="thinking"?v.value!=="":_.value.length>0),x=T();let M;pe(()=>clearTimeout(M));async function R(O){await Xe(O.copy),x.value=O.id,clearTimeout(M),M=setTimeout(()=>{x.value=void 0},1500)}return(O,E)=>(c(),m("div",Ui,[h("button",{type:"button",class:Z(["timeline-work-item-toggle",{"is-running":s.item.kind==="thinking"?s.item.running:s.item.status==="running","is-error":b.value,"is-static":!I.value}]),"aria-expanded":I.value?s.expanded:void 0,onClick:E[0]||(E[0]=L=>I.value&&n("toggle"))},[z(l(Se),{size:14,"aria-hidden":"true",class:Z({"is-expanded":s.expanded&&I.value})},null,8,["class"]),i.value?(c(),m("span",{key:0,class:"timeline-work-item-summary",title:[r.value,i.value.primary].filter(Boolean).join(" ")},[h("span",null,w(r.value),1),i.value.primary?(c(),m("small",Gi,w(i.value.primary),1)):A("",!0)],8,Yi)):(c(),m("span",Zi,[h("span",null,w(p.value),1)])),d.value?(c(),m(F,{key:2},[h("span",Ji,"+"+w(d.value.added),1),d.value.removed?(c(),m("span",Xi,"−"+w(d.value.removed),1)):A("",!0)],64)):A("",!0)],10,Ki),s.expanded&&I.value?(c(),m("div",Qi,[s.item.kind==="thinking"?(c(),m("div",ea,w(v.value),1)):(c(),m("div",ta,[(c(!0),m(F,null,B(_.value,L=>(c(),m(F,{key:L.id},[h("div",sa,[h("span",{title:L.label},w(L.label),9,na),h("button",{type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:G=>R(L)},[x.value===L.id?(c(),q(l(be),{key:0,"aria-hidden":"true"})):(c(),q(l($t),{key:1,"aria-hidden":"true"})),H(w(l(o)(x.value===L.id?"timeline.copied":"timeline.copy")),1)],8,oa)]),L.body==="command"?(c(),m("div",ia,[h("div",aa,[E[1]||(E[1]=h("span",{class:"is-muted"},"$",-1)),H(" "+w(L.copy),1)]),g("cwd")?(c(),m("div",ra," cwd: "+w(g("cwd")),1)):A("",!0)])):L.body==="search"?(c(),m("div",la,[h("div",ca,w(L.copy),1),g("pattern")&&g("path")?(c(),m("div",da," path: "+w(g("path")),1)):A("",!0)])):L.body==="diff"?(c(),m("div",ua,[(c(!0),m(F,null,B(k.value,(G,ke)=>(c(),m("div",{key:ke,class:"tool-panel-diff-line","data-sign":G.sign},[h("span",pa,w(G.sign),1),H(w(G.text),1)],8,ha))),128))])):L.body==="lines"?(c(),m("div",ma,[(c(!0),m(F,null,B(u.value.split(`
173
+ `),(G,ke)=>(c(),m(F,{key:ke},[h("span",fa,w(ke+1),1),h("span",va,w(G),1)],64))),128))])):(c(),m("pre",{key:4,class:Z(["tool-panel-pre",{"is-error":b.value&&L.id==="output"}])},w(L.copy),3))],64))),128))]))])):A("",!0)]))}}),kt=ee(ga,[["__scopeId","data-v-e3447865"]]),ya={class:"timeline-work-row"},wa=["aria-expanded"],ba={key:0,class:"timeline-work-group-content"},ka=N({__name:"TimelineWorkRow",props:{items:{},expanded:{type:Boolean},expandedItemIds:{}},emits:["toggle","toggleItem"],setup(s,{emit:t}){const e=s,n=t,{t:o}=j(),i={read:"work.read",edit:"work.edit",command:"work.command",search:"work.search",web_search:"work.webSearch",web_fetch:"work.webFetch",unknown:"work.unknown"},a=Object.keys(i),r=S(()=>{let v="",f;const g=e.items.filter(b=>b.kind==="thinking").length;g>0&&(v=o("work.thinkingSteps",{count:g},g),f="thinking");const y=new Map;for(const b of e.items)b.kind==="tool"&&y.set(b.category,(y.get(b.category)??0)+1);for(const b of a){const $=y.get(b);$!==void 0&&(f!==void 0&&(v+=o(f==="thinking"?"work.separator":"work.actionSeparator")),v+=o(i[b],{count:$},$),f=b)}return v}),p=S(()=>e.items.some(v=>v.kind==="thinking"?v.running:v.status==="running"));return(v,f)=>(c(),m("div",ya,[s.items.length>1?(c(),m(F,{key:0},[h("button",{type:"button",class:Z(["timeline-work-group-toggle",{"is-running":p.value}]),"aria-expanded":s.expanded,onClick:f[0]||(f[0]=g=>n("toggle"))},[z(l(Se),{size:14,"aria-hidden":"true",class:Z({"is-expanded":s.expanded})},null,8,["class"]),h("span",null,w(r.value),1)],10,wa),s.expanded?(c(),m("div",ba,[(c(!0),m(F,null,B(s.items,g=>(c(),q(kt,{key:g.id,item:g,expanded:s.expandedItemIds[g.id]===!0,onToggle:y=>n("toggleItem",g.id)},null,8,["item","expanded","onToggle"]))),128))])):A("",!0)],64)):s.items[0]?(c(),q(kt,{key:1,item:s.items[0],expanded:s.expandedItemIds[s.items[0].id]===!0,onToggle:f[1]||(f[1]=g=>n("toggleItem",s.items[0].id))},null,8,["item","expanded"])):A("",!0)]))}});function _a(s){var o;const t=[];let e=[];const n=()=>{e.length>0&&t.push({key:`work-${e[0].id}`,kind:"work",items:e}),e=[]};for(const i of s)if(i.kind==="thinking"){if(i.text===""&&!i.streaming)continue;e.push({id:i.key,kind:"thinking",content:i.text,running:i.streaming,...i.elapsedMs===void 0?{}:{durationMs:i.elapsedMs}})}else if(i.kind==="tool"){const a=Ia(i.name,i.input),r=$a(a,i.input);e.push({id:i.key,kind:"tool",name:i.name,category:a,...r===void 0?{}:{primary:r},status:i.pending?"running":((o=i.result)==null?void 0:o.isError)===!0?"error":"complete",input:i.input,...i.result===void 0?{}:{result:i.result}})}else n(),t.push({key:i.key,kind:"row",row:i});return n(),t}function Ia(s,t){const{renderer:e,labelKey:n}=Je(s,t);switch(e){case"command":return"command";case"search":return"search";case"file":return n==="tool.read"?"read":"edit";case"web":return n==="tool.webSearch"?"web_search":"web_fetch";case"generic":return"unknown"}}function $a(s,t){const n=(s==="command"?["command"]:s==="web_search"?["query"]:s==="web_fetch"?["url"]:s==="search"?["pattern","path"]:["path"]).map(i=>t[i]).find(i=>typeof i=="string"&&i.trim()!=="");if(n===void 0)return;const o=s==="read"||s==="edit"?n.replaceAll("\\","/").split("/").at(-1)??n:n;return o.length<=80?o:`${o.slice(0,79)}…`}const xa={class:"timeline-shell"},Sa={key:0,class:"timeline-empty"},Ca=["data-index"],Ma={key:2,class:"timeline-row","data-role":"assistant"},Ta={class:"sr-only"},Ea={key:3,class:"notice-row error-row",role:"alert"},Oa={key:4,class:"timeline-notice"},Aa={key:1,class:"processing-row",role:"status"},Ra=["aria-label"],za=96,La=N({__name:"TimelineView",props:{rows:{},running:{type:Boolean}},setup(s){const t=s,{t:e}=j(),n=T(),o=T(),i=T(!0),a=T({}),r=T({}),p=S(()=>_a(t.rows)),v=Ai(S(()=>({count:p.value.length,getScrollElement:()=>n.value??null,estimateSize:()=>72,overscan:6,getItemKey:u=>p.value[u].key})));v.value.shouldAdjustScrollPositionOnItemSizeChange=(u,d,_)=>{var M;const I=n.value;return I===void 0||o.value===void 0?!1:(_.getTotalSize(),(((M=_.measurementsCache[u.index])==null?void 0:M.start)??u.start)<I.scrollTop-o.value.offsetTop)};const f=S(()=>v.value.getVirtualItems()),g=S(()=>v.value.getTotalSize());function y(u){u instanceof Element&&v.value.measureElement(u)}function b(){const u=n.value;u!==void 0&&(i.value=u.scrollHeight-u.scrollTop-u.clientHeight<=za)}async function $(){await we();const u=n.value;u!==void 0&&(u.scrollTop=u.scrollHeight)}function k(){i.value=!0,$()}return Y([()=>p.value.length,g,()=>t.rows.at(-1),()=>t.running],()=>{i.value&&$()}),oe(()=>void $()),(u,d)=>{const _=le("tooltip");return c(),m("div",xa,[h("div",{ref_key:"viewport",ref:n,class:"timeline app-scroll-viewport",onScrollPassive:b},[p.value.length===0&&!s.running?(c(),m("p",Sa,w(l(e)("chat.emptyTimeline")),1)):A("",!0),h("div",{ref_key:"list",ref:o,class:"virtual-timeline",style:qe({height:`${g.value}px`,position:"relative"})},[(c(!0),m(F,null,B(f.value,I=>(c(),m("div",{key:String(I.key),ref_for:!0,ref:y,class:"virtual-timeline-row","data-index":I.index,style:qe({position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${I.start}px)`})},[(c(!0),m(F,null,B([p.value[I.index]],x=>(c(),m(F,{key:x.key},[x.kind==="work"?(c(),q(ka,{key:0,items:x.items,expanded:a.value[x.key]===!0,"expanded-item-ids":r.value,onToggle:M=>a.value[x.key]=!a.value[x.key],onToggleItem:d[0]||(d[0]=M=>r.value[M]=!r.value[M])},null,8,["items","expanded","expanded-item-ids","onToggle"])):x.row.kind==="user"?(c(),q(Hi,{key:1,text:x.row.text,at:x.row.at},null,8,["text","at"])):x.row.kind==="assistant"?(c(),m("article",Ma,[h("strong",Ta,w(l(e)("chat.assistant")),1),z(qi,{content:x.row.text,final:!x.row.streaming,"message-id":x.row.key},null,8,["content","final","message-id"])])):x.row.kind==="error"?(c(),m("div",Ea,[h("span",null,w(x.row.text),1)])):(c(),m("p",Oa,w(l(e)("timeline.noticeStopped")),1))],64))),128))],12,Ca))),128))],4),s.running?(c(),m("div",Aa,[z(l(Ve),{size:14,class:"is-spinning","aria-hidden":"true"}),h("span",null,w(l(e)("work.processing")),1)])):A("",!0)],544),z(Ht,{name:"jump-latest"},{default:se(()=>[i.value?A("",!0):X((c(),m("button",{key:0,class:"ui-icon-button jump-latest","data-variant":"secondary","data-size":"md",type:"button","aria-label":l(e)("timeline.scrollToBottom"),onClick:k},[z(l(Be),{"aria-hidden":"true"})],8,Ra)),[[_,l(e)("timeline.scrollToBottom")]])]),_:1})])}}}),qa=ee(La,[["__scopeId","data-v-6c33467c"]]),Pa={key:0,class:"removed-state route-page"},Fa={"data-route-heading":"",tabindex:"-1"},Wa={key:1,class:"removed-state route-page"},Da={"data-route-heading":"",tabindex:"-1"},Na={role:"alert"},ja={key:2,class:"chat-loading","aria-busy":"true"},Ba={class:"sr-only"},Va={key:3,class:"chat-page"},Ha={class:"chat-page-top"},Ua={class:"session-header"},Ka=["aria-label"],Ya={class:"session-heading"},Ga=["title"],Za=["title"],Ja={key:1,class:"ui-badge session-running","data-tone":"primary"},Xa={key:0,class:"composer-panel"},Qa=N({__name:"ChatPage",props:{sessionId:{}},setup(s){const t=s,{t:e}=j(),n=ge(),o=K(),i=U(),a=me();Y(()=>t.sessionId,$=>n.open($),{immediate:!0});const r=S(()=>n.views[t.sessionId]),p=S(()=>i.byId.get(t.sessionId)),v=S(()=>{var $;return(($=p.value)==null?void 0:$.preview)??e("sidebar.untitled")}),f=S(()=>{var $;return($=r.value)==null?void 0:$.approvals[0]});function g($){return n.submit(t.sessionId,$)}function y(){return n.stop(t.sessionId)}function b($){return n.setModel(t.sessionId,$)}return($,k)=>{var u,d;return((u=r.value)==null?void 0:u.status)==="closed"?(c(),m("section",Pa,[h("h1",Fa,w(l(e)("chat.removedTitle")),1),h("p",null,w(l(e)("chat.removedDescription")),1),z(l(ve),{to:"/chat/new"},{default:se(()=>[H(w(l(e)("sidebar.newSession")),1)]),_:1})])):((d=r.value)==null?void 0:d.status)==="failed"?(c(),m("section",Wa,[h("h1",Da,w(v.value),1),h("p",Na,w(r.value.error),1)])):!r.value||r.value.status==="loading"?(c(),m("section",ja,[h("h1",Ba,w(l(e)("route.session")),1),z(Ee,{animated:"",class:"boot-mark"}),h("p",null,w(l(e)("common.loading")),1)])):(c(),m("section",Va,[h("div",Ha,[h("header",Ua,[l(a).shellMode==="compact"?(c(),m("button",{key:0,class:"ui-icon-button session-nav","data-variant":"ghost","data-size":"md",type:"button","aria-label":l(e)("sidebar.openMenu"),onClick:k[0]||(k[0]=_=>l(a).drawerOpen=!0)},[z(l(xt),{"aria-hidden":"true"})],8,Ka)):A("",!0),h("div",Ya,[p.value?(c(),m(F,{key:0},[h("span",{class:"workspace-crumb",title:p.value.cwd},w(l(Oe)(p.value.cwd)),9,Ga),k[1]||(k[1]=h("span",{class:"workspace-crumb-separator","aria-hidden":"true"},"/",-1))],64)):A("",!0),h("h1",{"data-route-heading":"",tabindex:"-1",title:v.value},w(v.value),9,Za)]),r.value.running?(c(),m("span",Ja,[k[2]||(k[2]=h("span",{class:"status-dot","data-state":"running","aria-hidden":"true"},null,-1)),H(w(l(e)(r.value.stopping?"status.stopping":"status.running")),1)])):A("",!0)])]),z(qa,{rows:r.value.rows,running:r.value.running},null,8,["rows","running"]),f.value?(c(),m("div",Xa,[(c(),q(Bo,{key:f.value.requestId,"session-id":s.sessionId,request:f.value},null,8,["session-id","request"]))])):(c(),q(Lt,{key:1,running:r.value.running,stopping:r.value.stopping,model:r.value.model,send:g,stop:y,"model-selectable":l(o).supports("session.model.update"),"select-model":b},null,8,["running","stopping","model","model-selectable"]))]))}}}),er=ee(Qa,[["__scopeId","data-v-7fa61730"]]),tr={class:"new-session-page"},sr={class:"new-session-hero"},nr={"data-route-heading":"",tabindex:"-1"},or={class:"ui-button","data-variant":"ghost","data-size":"xs","data-trailing":""},ir={class:"workspace-trigger-label"},ar={class:"composer-popover-content workspace-menu-content ui-popover","data-width":"lg"},rr=["placeholder","aria-label"],lr=["disabled"],cr={key:0,class:"ui-menu-separator"},dr=["aria-label"],ur=["aria-selected","onClick"],hr={class:"ui-menu-desc workspace-path"},pr=N({__name:"NewSessionPage",setup(s){const{t}=j(),e=je(),n=It(),o=U(),i=ge(),a=zt(),r=T(),p=T(typeof e.query.cwd=="string"?e.query.cwd:""),v=T("");Y(()=>o.workspaces,u=>{p.value===""&&u[0]!==void 0&&(p.value=u[0].cwd)},{immediate:!0});const f=T(),g=T();Y(p,async u=>{if(g.value=void 0,u==="")return;const d=await a.defaultFor(u);p.value===u&&(g.value=d)},{immediate:!0});const y=S(()=>f.value??g.value);function b(u){p.value=u,r.value&&(r.value.open=!1)}function $(){const u=v.value.trim();u!==""&&(b(u),v.value="")}async function k(u){if(p.value==="")throw new Error(t("newThread.workspaceRequired"));const d=await o.create(p.value,f.value);i.open(d),await i.submit(d,u),await n.push({name:"chat-session",params:{sessionId:d}})}return(u,d)=>{const _=le("tooltip");return c(),m("section",tr,[h("div",sr,[z(Ee,{class:"new-session-mark"}),h("h1",nr,w(l(t)("newThread.title")),1)]),z(Lt,{class:"is-new-thread",running:!1,model:y.value,"model-selectable":!0,send:k,"select-model":I=>{f.value=I}},{status:se(()=>[h("details",{ref_key:"menu",ref:r,class:"composer-popover workspace-menu"},[X((c(),m("summary",or,[z(l(Pe),{"aria-hidden":"true"}),h("span",ir,w(p.value?l(Oe)(p.value):l(t)("newThread.selectWorkspace")),1),z(l(Be),{class:"workspace-chevron","aria-hidden":"true"})])),[[_,p.value||void 0]]),h("div",ar,[h("form",{class:"workspace-path-form",onSubmit:xe($,["prevent"])},[X(h("input",{"onUpdate:modelValue":d[0]||(d[0]=I=>v.value=I),class:"ui-field","data-size":"sm",type:"text",spellcheck:"false",autocapitalize:"off",placeholder:l(t)("newThread.pathPlaceholder"),"aria-label":l(t)("newThread.pathLabel")},null,8,rr),[[Te,v.value]]),h("button",{type:"submit",class:"ui-button","data-variant":"secondary","data-size":"sm",disabled:v.value.trim()===""},w(l(t)("newThread.usePath")),9,lr)],32),l(o).workspaces.length?(c(),m("hr",cr)):A("",!0),h("div",{class:"workspace-list",role:"listbox","aria-label":l(t)("sidebar.workspaces")},[(c(!0),m(F,null,B(l(o).workspaces,I=>(c(),m("button",{key:I.cwd,type:"button",role:"option",class:"ui-menu-item","data-two-line":"","aria-selected":I.cwd===p.value,onClick:x=>b(I.cwd)},[z(l(Pe),{"aria-hidden":"true"}),h("span",null,[H(w(I.name),1),h("span",hr,w(I.cwd),1)]),I.cwd===p.value?(c(),q(l(be),{key:0,class:"ui-menu-check","aria-hidden":"true"})):A("",!0)],8,ur))),128))],8,dr)])],512)]),_:1},8,["model","select-model"])])}}}),mr=ee(pr,[["__scopeId","data-v-2350b414"]]),fr={class:"chat-loading","aria-busy":"true"},vr=N({__name:"RootRedirect",setup(s){const{t}=j(),e=It(),n=U(),o=me();return Y(()=>n.loaded||n.error!=="",i=>{if(!i)return;const a=o.lastSessionId;e.replace(a!==void 0&&n.byId.has(a)?{name:"chat-session",params:{sessionId:a}}:{name:"chat-new"})},{immediate:!0}),(i,a)=>(c(),m("section",fr,[h("p",null,w(l(t)("common.loading")),1)]))}}),gr={class:"route-page app-scroll-viewport"},yr={"data-route-heading":"",tabindex:"-1"},wr={class:"page-description"},br=N({__name:"NotFoundView",setup(s){const{t}=j();return(e,n)=>(c(),m("section",gr,[z(l(ss),{size:20,class:"state-icon","aria-hidden":"true"}),h("h1",yr,w(l(t)("route.notFound")),1),h("p",wr,w(l(t)("page.notFoundDescription")),1),z(l(ve),{to:"/chat/new"},{default:se(()=>[H(w(l(t)("sidebar.newSession")),1)]),_:1})]))}}),Pt=Ut({history:Kt(),routes:[{path:"/",name:"root",component:vr},{path:"/chat/new",name:"chat-new",component:mr},{path:"/chat/:sessionId",name:"chat-session",component:er,props:!0},{path:"/:pathMatch(.*)*",name:"not-found",component:br}]});Pt.afterEach(s=>{s.name==="chat-session"&&typeof s.params.sessionId=="string"&&(me().lastSessionId=s.params.sessionId)});Y(de.global.locale,s=>{document.documentElement.lang=s},{immediate:!0});const De=Yt();me(De);Promise.all([As(),Bs(navigator.language)]).then(()=>{K(De).client.start(),Gt(Xn).use(De).use(de).use(Pt).directive("tooltip",uo).mount("#app"),setTimeout(()=>void At(),0)});export{Tt as _};