dimcode-web 0.1.0-alpha.14 → 0.1.0-alpha.16
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.
- package/package.json +1 -1
- package/release-manifest.json +91 -92
- package/web/assets/AccountSettings-CuNxjb5M.js +1 -0
- package/web/assets/AccountSettings-DnfPPG7u.css +1 -0
- package/web/assets/AgentSettings-B1kyVC9H.js +1 -0
- package/web/assets/{AppearanceSettings-C6T82OEq.js → AppearanceSettings-BImLkd19.js} +2 -2
- package/web/assets/AppearanceSettings-WVGDYAhR.css +1 -0
- package/web/assets/ArchivedSettings-BO8xL_Zc.css +1 -0
- package/web/assets/ArchivedSettings-C6UPMqfk.js +1 -0
- package/web/assets/{CodeBlockNode-DsUHD3_k.js → CodeBlockNode-Cm4qQWYp.js} +5 -5
- package/web/assets/DiagnosticsSettings-Bf1nv4em.css +1 -0
- package/web/assets/DiagnosticsSettings-YSRtq2dI.js +1 -0
- package/web/assets/GeneralSettingsStatus.vue_vue_type_script_setup_true_lang-CWInOGTv.js +1 -0
- package/web/assets/McpSettings-BhAZ-WL2.css +1 -0
- package/web/assets/McpSettings-y4Wzg8CT.js +1 -0
- package/web/assets/ModalitySettings-BpFvRd--.js +1 -0
- package/web/assets/PermissionsSettings-CGumt3Ix.css +1 -0
- package/web/assets/PermissionsSettings-DQV3cdej.js +1 -0
- package/web/assets/PluginSettings-BF6eSPEd.js +1 -0
- package/web/assets/PluginSettings-rv5I0LON.css +1 -0
- package/web/assets/PreCodeBlock-DH2VwXzi.js +1 -0
- package/web/assets/ProviderAuthFlow.vue_vue_type_script_setup_true_lang-opd2fMYR.js +11 -0
- package/web/assets/ProviderSettings-A8WG9V7m.js +2 -0
- package/web/assets/ProviderSettings-Cc10ophS.css +1 -0
- package/web/assets/SettingsPage-DmhRtj9e.js +51 -0
- package/web/assets/SkillSettings-CZ98gDWn.js +3 -0
- package/web/assets/SkillSettings-DjDPbVAE.css +1 -0
- package/web/assets/{Tooltip-BJL7Jk33.js → Tooltip--ZEIq327.js} +1 -1
- package/web/assets/{arc-cA0USBj0.js → arc-BSskkHkz.js} +1 -1
- package/web/assets/{architectureDiagram-3BPJPVTR-D4GyRGsi.js → architectureDiagram-3BPJPVTR-B3e2_Mi5.js} +1 -1
- package/web/assets/arrow-left-mbUIwPsq.js +6 -0
- package/web/assets/{blockDiagram-GPEHLZMM-CaMtk8X8.js → blockDiagram-GPEHLZMM-BSII-1bz.js} +1 -1
- package/web/assets/{c4Diagram-AAUBKEIU-By4NO5z_.js → c4Diagram-AAUBKEIU-DA3DfWUR.js} +1 -1
- package/web/assets/channel-DrR7UcgS.js +1 -0
- package/web/assets/{chunk-2J33WTMH-DVR8RXjF.js → chunk-2J33WTMH-B112AqHa.js} +1 -1
- package/web/assets/{chunk-4BX2VUAB-BOCw1xVb.js → chunk-4BX2VUAB-DnNs4Y-E.js} +1 -1
- package/web/assets/{chunk-55IACEB6-nIfgcEjn.js → chunk-55IACEB6-BEqL8hBV.js} +1 -1
- package/web/assets/{chunk-727SXJPM-RYvblIbW.js → chunk-727SXJPM-DBBS3g7k.js} +1 -1
- package/web/assets/{chunk-AQP2D5EJ-BO5Su4MY.js → chunk-AQP2D5EJ-B9jCastR.js} +1 -1
- package/web/assets/{chunk-FMBD7UC4-Q206iq7t.js → chunk-FMBD7UC4-DllPbdIS.js} +1 -1
- package/web/assets/{chunk-ND2GUHAM-BEHXSkEZ.js → chunk-ND2GUHAM-D9KZG0cK.js} +1 -1
- package/web/assets/{chunk-QZHKN3VN-B4wImiUI.js → chunk-QZHKN3VN-BoD6R3M0.js} +1 -1
- package/web/assets/classDiagram-4FO5ZUOK-DGOBz3OV.js +1 -0
- package/web/assets/classDiagram-v2-Q7XG4LA2-DGOBz3OV.js +1 -0
- package/web/assets/context-Grqd_9Lt.js +1 -0
- package/web/assets/{cose-bilkent-S5V4N54A-BJj5g70v.js → cose-bilkent-S5V4N54A-BXVnnRnw.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-C-fnPT_y.js → cynefin-OW5HDTMX-B-6oGbPp.js} +1 -1
- package/web/assets/{dagre-BM42HDAG-CpAodSX7.js → dagre-BM42HDAG-B22lGQ6O.js} +1 -1
- package/web/assets/{diagram-2AECGRRQ-C0jz5rBL.js → diagram-2AECGRRQ-CJpCn-CU.js} +1 -1
- package/web/assets/{diagram-5GNKFQAL-CKvRsL1_.js → diagram-5GNKFQAL-CXv-E4RN.js} +1 -1
- package/web/assets/{diagram-KO2AKTUF-C9_QTnZb.js → diagram-KO2AKTUF-DE6YITcQ.js} +1 -1
- package/web/assets/{diagram-LMA3HP47-B0gvGn3Z.js → diagram-LMA3HP47-C6a1LN_b.js} +1 -1
- package/web/assets/{diagram-OG6HWLK6-CoW4sNwB.js → diagram-OG6HWLK6-lzlMxndk.js} +1 -1
- package/web/assets/{erDiagram-TEJ5UH35-B1YPrM8R.js → erDiagram-TEJ5UH35-C33pLVdS.js} +1 -1
- package/web/assets/{flowDiagram-I6XJVG4X-DbSCyQ1o.js → flowDiagram-I6XJVG4X-CNEnFS_c.js} +1 -1
- package/web/assets/{ganttDiagram-6RSMTGT7-DCU_-HcU.js → ganttDiagram-6RSMTGT7-Dvt_IgnY.js} +1 -1
- package/web/assets/{gitGraphDiagram-PVQCEYII-BnwXK64G.js → gitGraphDiagram-PVQCEYII-DEM3UDeh.js} +1 -1
- package/web/assets/{index-gSmHRsHg.js → index-AEXvUA5U.js} +1 -1
- package/web/assets/{index-B9cemsjA.js → index-B4STIxMF.js} +86 -86
- package/web/assets/index-BbPaKBmv.css +1 -0
- package/web/assets/index-CenMTLFY.js +247 -0
- package/web/assets/{index10-B-_2OEd6.js → index10-BMLJ-2NW.js} +1 -1
- package/web/assets/{index5-CFV5-M95.js → index5-BvcjsDmt.js} +1 -1
- package/web/assets/{index6-C3q8vusa.js → index6-CxMZBEKt.js} +1 -1
- package/web/assets/{index8-Cg5dteH_.js → index8-bIdcFO9W.js} +1 -1
- package/web/assets/{index9-DOQm5ENJ.js → index9-DBx_o1y8.js} +1 -1
- package/web/assets/{infoDiagram-5YYISTIA-B_F1M87B.js → infoDiagram-5YYISTIA-BYT4MYJl.js} +1 -1
- package/web/assets/{ishikawaDiagram-YF4QCWOH-DXtU3ayb.js → ishikawaDiagram-YF4QCWOH-C9V1Zhoz.js} +1 -1
- package/web/assets/{journeyDiagram-JHISSGLW-DiP3bT6x.js → journeyDiagram-JHISSGLW-Be6x6oc7.js} +1 -1
- package/web/assets/{kanban-definition-UN3LZRKU-8kyelCSQ.js → kanban-definition-UN3LZRKU-BctYKWYf.js} +1 -1
- package/web/assets/{linear-aMkA3ImE.js → linear-Dl_nEC-L.js} +1 -1
- package/web/assets/{markstream-ybWMrpCV.js → markstream-CvxnTmYJ.js} +2 -2
- package/web/assets/{mermaid.core-BWfn-FFw.js → mermaid.core-qKUR3_rw.js} +4 -4
- package/web/assets/{mindmap-definition-RKZ34NQL-Dge0FtvP.js → mindmap-definition-RKZ34NQL-CeMPPNxO.js} +1 -1
- package/web/assets/{pieDiagram-4H26LBE5-D7MzngYj.js → pieDiagram-4H26LBE5-DDfXBtNB.js} +1 -1
- package/web/assets/{quadrantDiagram-W4KKPZXB-cjwaMhCa.js → quadrantDiagram-W4KKPZXB-DM7LwKAJ.js} +1 -1
- package/web/assets/{requirementDiagram-4Y6WPE33-ACmBdhUc.js → requirementDiagram-4Y6WPE33-CaWzWB7c.js} +1 -1
- package/web/assets/{sankeyDiagram-5OEKKPKP-Rva02Dvb.js → sankeyDiagram-5OEKKPKP-DC1oe_AT.js} +1 -1
- package/web/assets/{sequenceDiagram-3UESZ5HK-DzazUDns.js → sequenceDiagram-3UESZ5HK-BZM66sLw.js} +1 -1
- package/web/assets/settings-general-dc8P6dA0.js +1 -0
- package/web/assets/{stateDiagram-AJRCARHV-BODPWGjc.js → stateDiagram-AJRCARHV-BAaUZKRp.js} +1 -1
- package/web/assets/stateDiagram-v2-BHNVJYJU-DTfJIIDB.js +1 -0
- package/web/assets/{timeline-definition-PNZ67QCA-D5UqFLNW.js → timeline-definition-PNZ67QCA-Boz2EyqB.js} +1 -1
- package/web/assets/{vendor-vue-Ci9TYO_I.js → vendor-vue-CncuOShJ.js} +1 -1
- package/web/assets/{vennDiagram-CIIHVFJN-CtcagJ7K.js → vennDiagram-CIIHVFJN-ByQmaid9.js} +1 -1
- package/web/assets/{wardleyDiagram-YWT4CUSO-G86oBHE2.js → wardleyDiagram-YWT4CUSO-ByOBzspB.js} +1 -1
- package/web/assets/{xychartDiagram-2RQKCTM6-BJ1nXYiQ.js → xychartDiagram-2RQKCTM6-BNgy6nQp.js} +1 -1
- package/web/assets/zh-CN-DtOnK_oD.js +1 -0
- package/web/dimcode-web.json +2 -2
- package/web/index.html +3 -3
- package/web/assets/AccountSettings-4uSrBroj.js +0 -1
- package/web/assets/AccountSettings-DuC-j6CL.css +0 -1
- package/web/assets/AgentSettings-BDiSW65Y.js +0 -1
- package/web/assets/AppearanceSettings-CX6_CvK6.css +0 -1
- package/web/assets/ArchivedSettings-DDK-qro_.js +0 -1
- package/web/assets/ArchivedSettings-De1WaCgP.css +0 -1
- package/web/assets/ConfirmDialog.vue_vue_type_script_setup_true_lang-KPZUoxNU.js +0 -6
- package/web/assets/DiagnosticsSettings-BmWPEGHb.css +0 -1
- package/web/assets/DiagnosticsSettings-CiDVWqJz.js +0 -1
- package/web/assets/GeneralSettingsStatus.vue_vue_type_script_setup_true_lang-DY1_UG_g.js +0 -1
- package/web/assets/McpSettings-DCYV728D.css +0 -1
- package/web/assets/McpSettings-nYhoS35F.js +0 -1
- package/web/assets/ModalitySettings-BkeyOoQt.css +0 -1
- package/web/assets/ModalitySettings-mIAic7i5.js +0 -1
- package/web/assets/PermissionsSettings-DVv7C2io.css +0 -1
- package/web/assets/PermissionsSettings-Dh9gF7YF.js +0 -1
- package/web/assets/PluginSettings-BMQazfW6.js +0 -1
- package/web/assets/PluginSettings-EhulK7fw.css +0 -1
- package/web/assets/PreCodeBlock-DXIuTGLt.js +0 -1
- package/web/assets/ProviderAuthFlow.vue_vue_type_script_setup_true_lang-DHd2sgtZ.js +0 -11
- package/web/assets/ProviderSettings-Dc3kVfiC.js +0 -2
- package/web/assets/ProviderSettings-O7kVWRtj.css +0 -1
- package/web/assets/SettingsPage-YJcDRLr9.js +0 -56
- package/web/assets/SkillSettings-C16em-eW.css +0 -1
- package/web/assets/SkillSettings-ovHdSPTe.js +0 -3
- package/web/assets/channel-rxJrCDWw.js +0 -1
- package/web/assets/classDiagram-4FO5ZUOK-BtU1pWhP.js +0 -1
- package/web/assets/classDiagram-v2-Q7XG4LA2-BtU1pWhP.js +0 -1
- package/web/assets/context-ChGKk1Cc.js +0 -1
- package/web/assets/index-BKJW0i9Q.js +0 -225
- package/web/assets/index-GnV5W03u.css +0 -1
- package/web/assets/settings-general-d_R-CH6R.js +0 -1
- package/web/assets/stateDiagram-v2-BHNVJYJU-CJ6CdQEh.js +0 -1
- package/web/assets/zh-CN-CSwtlg0N.js +0 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B4STIxMF.js","assets/vendor-vue-CncuOShJ.js","assets/SettingsPage-DmhRtj9e.js","assets/context-Grqd_9Lt.js","assets/arrow-left-mbUIwPsq.js","assets/AccountSettings-CuNxjb5M.js","assets/settings-general-dc8P6dA0.js","assets/ProviderAuthFlow.vue_vue_type_script_setup_true_lang-opd2fMYR.js","assets/AccountSettings-DnfPPG7u.css","assets/AppearanceSettings-BImLkd19.js","assets/AppearanceSettings-WVGDYAhR.css","assets/AgentSettings-B1kyVC9H.js","assets/GeneralSettingsStatus.vue_vue_type_script_setup_true_lang-CWInOGTv.js","assets/ProviderSettings-A8WG9V7m.js","assets/ProviderSettings-Cc10ophS.css","assets/ModalitySettings-BpFvRd--.js","assets/McpSettings-y4Wzg8CT.js","assets/McpSettings-BhAZ-WL2.css","assets/PluginSettings-BF6eSPEd.js","assets/PluginSettings-rv5I0LON.css","assets/SkillSettings-CZ98gDWn.js","assets/SkillSettings-DjDPbVAE.css","assets/PermissionsSettings-DQV3cdej.js","assets/PermissionsSettings-CGumt3Ix.css","assets/ArchivedSettings-C6UPMqfk.js","assets/ArchivedSettings-BO8xL_Zc.css","assets/DiagnosticsSettings-YSRtq2dI.js","assets/DiagnosticsSettings-Bf1nv4em.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
var In=Object.defineProperty;var $n=(s,t,e)=>t in s?In(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var de=(s,t,e)=>$n(s,typeof t!="symbol"?t+"":t,e);import{$ as Bt,d as ve,c as u,m as Ae,F as ee,E as ue,o as c,e as d,n as kt,a6 as ut,r as A,z as C,a7 as xn,w as ye,a8 as us,I as Gt,f as pe,u as a,h as se,t as m,a9 as st,B as ke,j as K,a as L,l as $e,R as at,k as je,b as fe,P as At,x as Ue,g as pt,C as $t,aa as Sn,Q as Ns,q as Be,ab as Vt,y as Cn,O as Lt,V as ps,W as Mn,a1 as hs,T as Tn,a5 as En,ac as ms,ad as An,ae as Ln,af as qn,ag as On}from"./vendor-vue-CncuOShJ.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 r of i.addedNodes)r.tagName==="LINK"&&r.rel==="modulepreload"&&n(r)}).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 Rn=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 vs=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 Pn=(...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 fs=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 zn=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 Dn=s=>{const t=zn(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 yt={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 Fn=({name:s,iconNode:t,absoluteStrokeWidth:e,"absolute-stroke-width":n,strokeWidth:o,"stroke-width":i,size:r=yt.width,color:l=yt.stroke,...h},{slots:w})=>Bt("svg",{...yt,...h,width:r,height:r,stroke:l,"stroke-width":vs(e)||vs(n)||e===!0||n===!0?Number(o||i||yt["stroke-width"])*24/Number(r):o||i||yt["stroke-width"],class:Pn("lucide",h.class,...s?[`lucide-${fs(Dn(s))}-icon`,`lucide-${fs(s)}`]:["lucide-icon"]),...!w.default&&!Rn(h)&&{"aria-hidden":"true"}},[...t.map(f=>Bt(...f)),...w.default?[w.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 ce=(s,t)=>(e,{slots:n,attrs:o})=>Bt(Fn,{...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 jn=ce("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 rt=ce("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 Qt=ce("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 Tt=ce("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 Wn=ce("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
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 Nn=ce("circle-slash-2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/**
|
|
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 Bs=ce("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"}]]);/**
|
|
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 Bn=ce("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"}]]);/**
|
|
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 Vn=ce("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"}]]);/**
|
|
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 Ut=ce("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"}]]);/**
|
|
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 nt=ce("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]]);/**
|
|
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 Un=ce("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"}]]);/**
|
|
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 Hn=ce("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
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 Kn=ce("list-tree",[["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"M3 10a2 2 0 0 0 2 2h3",key:"1npucw"}],["path",{d:"M3 5v12a2 2 0 0 0 2 2h3",key:"x1gjn2"}]]);/**
|
|
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 qt=ce("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 Gn=ce("maximize-2",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);/**
|
|
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 Vs=ce("menu",[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]]);/**
|
|
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 Qn=ce("minimize-2",[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]]);/**
|
|
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 Jn=ce("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"}]]);/**
|
|
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 Yn=ce("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"}]]);/**
|
|
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 Jt=ce("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 Xn=ce("quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
|
|
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 Zn=ce("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
|
|
163
|
+
* @license lucide-vue-next v0.577.0 - ISC
|
|
164
|
+
*
|
|
165
|
+
* This source code is licensed under the ISC license.
|
|
166
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
+
*/const Yt=ce("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/**
|
|
168
|
+
* @license lucide-vue-next v0.577.0 - ISC
|
|
169
|
+
*
|
|
170
|
+
* This source code is licensed under the ISC license.
|
|
171
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
+
*/const eo=ce("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
173
|
+
* @license lucide-vue-next v0.577.0 - ISC
|
|
174
|
+
*
|
|
175
|
+
* This source code is licensed under the ISC license.
|
|
176
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
+
*/const to=ce("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
|
|
178
|
+
* @license lucide-vue-next v0.577.0 - ISC
|
|
179
|
+
*
|
|
180
|
+
* This source code is licensed under the ISC license.
|
|
181
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
+
*/const so=ce("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
183
|
+
* @license lucide-vue-next v0.577.0 - ISC
|
|
184
|
+
*
|
|
185
|
+
* This source code is licensed under the ISC license.
|
|
186
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
+
*/const no=ce("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);/**
|
|
188
|
+
* @license lucide-vue-next v0.577.0 - ISC
|
|
189
|
+
*
|
|
190
|
+
* This source code is licensed under the ISC license.
|
|
191
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
192
|
+
*/const oo=ce("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
193
|
+
* @license lucide-vue-next v0.577.0 - ISC
|
|
194
|
+
*
|
|
195
|
+
* This source code is licensed under the ISC license.
|
|
196
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
+
*/const io=ce("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"}]]);/**
|
|
198
|
+
* @license lucide-vue-next v0.577.0 - ISC
|
|
199
|
+
*
|
|
200
|
+
* This source code is licensed under the ISC license.
|
|
201
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
+
*/const ao=ce("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"}]]);/**
|
|
203
|
+
* @license lucide-vue-next v0.577.0 - ISC
|
|
204
|
+
*
|
|
205
|
+
* This source code is licensed under the ISC license.
|
|
206
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
207
|
+
*/const ro=ce("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"}]]);/**
|
|
208
|
+
* @license lucide-vue-next v0.577.0 - ISC
|
|
209
|
+
*
|
|
210
|
+
* This source code is licensed under the ISC license.
|
|
211
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
212
|
+
*/const lt=ce("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Xt={en:{confirm:"Confirm",settings:"Settings",account:"Account",appearance:"Appearance",agent:"Agent defaults",providers:"Providers",modality:"Modality",mcp:"MCP",plugins:"Plugins",skills:"Skills",permissions:"Permissions",archived:"Archived sessions",diagnostics:"Diagnostics",back:"Back",cancel:"Cancel",save:"Save changes",saving:"Saving…",loading:"Loading…",refresh:"Refresh",retry:"Retry",close:"Close",search:"Search providers or models",add:"Add provider",custom:"Custom provider",configured:"Configured",connected:"Connected",signedOut:"Not signed in",enabled:"Enabled",disabled:"Disabled",enable:"Enable",disable:"Disable",remove:"Delete",edit:"Edit",reset:"Reset",name:"Name",id:"ID",models:"Models",noModels:"No models. Refresh the catalog or add a model.",noProviders:"No providers configured. Add one to get started.",noResults:"No matches",connection:"Connection",driver:"Adapter",baseUrl:"Base URL",apiKey:"API key",keepSecret:"Leave blank to keep the existing secret",clearSecret:"Remove stored credential",headers:"Headers",headerName:"Header name",headerValue:"New header value",addHeader:"Add header",proxy:"Proxy URL",timeout:"Timeout (ms)",default:"Default",probe:"Test connection",probeResult:"Connection succeeded. Models found:",create:"Create",modelIds:"Model IDs (one per line)",addModel:"Add model",modelId:"Model ID",context:"Context window",output:"Max output tokens",tools:"Tool calling",vision:"Vision",reasoning:"Reasoning",effort:"Reasoning effort",tier:"Service tier",endpoint:"Endpoint override",inherit:"Use provider default",preferences:"Model preferences",unavailable:"Unavailable",knownProviders:"Available providers",authType:"Authentication",headerPrefix:"Header prefix",secretRequired:"A credential is required before enabling this provider.",conflict:"The provider changed. Reload before saving again; your draft has been preserved.",discard:"Discard unsaved changes?",deleteConfirm:"Delete this provider and its saved configuration?",modelDeleteConfirm:"Delete this model?",resetConfirm:"Reset this model to the provider defaults?",signOutConfirm:"Sign out of this provider on the CLI host?",accountDescription:"Your Dim account is shared with the CLI on this host.",providerDescription:"Connect accounts and API providers, and manage the models available in chat.",signIn:"Sign in to Dim",login:"Sign in",enterprise:"Enterprise sign-in",email:"Enterprise email",browser:"Browser",device:"Device code",openAuth:"Open authorization page",copy:"Copy",copied:"Copied",callback:"Authorization callback URL",callbackHint:"After authorization, copy the full localhost redirect URL from your browser and paste it here. It also works when the browser and CLI are on different machines.",finish:"Complete sign-in",waiting:"Waiting for authorization…",expired:"This sign-in attempt expired. Start again.",cancelled:"Sign-in cancelled.",failed:"Sign-in failed. Try again.",expires:"Expires",signOut:"Sign out",plan:"Plan and usage",credits:"Credits",unlimited:"Unlimited",remaining:"Remaining",usageUnavailable:"Usage could not be loaded",viewPlan:"View plan",choosePlan:"Choose a plan",region:"Account region",cn:"China",global:"Global",uid:"User ID",accountUnavailable:"This CLI build has no Dim account provider. Use an account-enabled build to sign in.",missingMethod:"This server does not support this settings action. Update the CLI and reconnect.",reload:"Reload",unknownLimits:"Not declared",advanced:"Advanced",modelDescription:"Changes apply to future model selections; existing sessions retain their configuration.",status:"Status",working:"Working…",referral:"Invite friends",resetCredits:"Usage reset credits"},"zh-CN":{confirm:"确认",settings:"设置",account:"账户",appearance:"外观",agent:"Agent 默认设置",providers:"模型提供商",modality:"多模态",mcp:"MCP",plugins:"插件",skills:"技能",permissions:"权限",archived:"已归档会话",diagnostics:"诊断",back:"返回",cancel:"取消",save:"保存更改",saving:"保存中…",loading:"加载中…",refresh:"刷新",retry:"重试",close:"关闭",search:"搜索提供商或模型",add:"添加提供商",custom:"自定义提供商",configured:"已配置",connected:"已连接",signedOut:"未登录",enabled:"已启用",disabled:"已禁用",enable:"启用",disable:"禁用",remove:"删除",edit:"编辑",reset:"重置",name:"名称",id:"ID",models:"模型",noModels:"暂无模型,请刷新模型列表或手动添加。",noProviders:"尚未配置提供商,添加一个即可开始使用。",noResults:"没有匹配项",connection:"连接配置",driver:"适配器",baseUrl:"接口地址",apiKey:"API 密钥",keepSecret:"留空保留已有密钥",clearSecret:"移除已存储的凭据",headers:"请求头",headerName:"请求头名称",headerValue:"新的请求头值",addHeader:"添加请求头",proxy:"代理地址",timeout:"超时时间(毫秒)",default:"默认",probe:"测试连接",probeResult:"连接成功,发现模型:",create:"创建",modelIds:"模型 ID(每行一个)",addModel:"添加模型",modelId:"模型 ID",context:"上下文窗口",output:"最大输出 Token",tools:"工具调用",vision:"视觉",reasoning:"推理",effort:"推理强度",tier:"服务等级",endpoint:"端点覆盖",inherit:"使用提供商默认值",preferences:"模型偏好",unavailable:"不可用",knownProviders:"可用提供商",authType:"认证方式",headerPrefix:"请求头前缀",secretRequired:"启用此提供商前需要配置凭据。",conflict:"提供商配置已变更。请重新加载后再保存,当前草稿已保留。",discard:"放弃未保存的更改?",deleteConfirm:"删除此提供商及其已保存的配置?",modelDeleteConfirm:"删除此模型?",resetConfirm:"将此模型重置为提供商默认配置?",signOutConfirm:"退出 CLI 主机上此提供商的登录?",accountDescription:"Dim 账户与此主机上的 CLI 共享。",providerDescription:"连接账户和 API 提供商,管理聊天中可用的模型。",signIn:"登录 Dim",login:"登录",enterprise:"企业登录",email:"企业邮箱",browser:"浏览器",device:"设备码",openAuth:"打开授权页面",copy:"复制",copied:"已复制",callback:"授权回调 URL",callbackHint:"授权后,从浏览器地址栏复制完整的 localhost 回调地址并粘贴到这里。浏览器和 CLI 不在同一台机器时也可使用。",finish:"完成登录",waiting:"等待授权…",expired:"本次登录已过期,请重新开始。",cancelled:"已取消登录。",failed:"登录失败,请重试。",expires:"到期时间",signOut:"退出登录",plan:"套餐与用量",credits:"额度",unlimited:"无限制",remaining:"剩余",usageUnavailable:"无法加载用量",viewPlan:"查看套餐",choosePlan:"选择套餐",region:"账户区域",cn:"中国",global:"全球",uid:"用户 ID",accountUnavailable:"当前 CLI 构建未包含 Dim 账户提供商,请使用支持账户登录的构建。",missingMethod:"服务端不支持此设置操作,请更新 CLI 后重新连接。",reload:"重新加载",unknownLimits:"未声明",advanced:"高级设置",modelDescription:"更改在之后选择模型时生效,已有会话保留其配置。",status:"状态",working:"处理中…",referral:"邀请好友",resetCredits:"用量重置额度"}},lo=["d"],co=ve({__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(),u("svg",{viewBox:"34 34 62 62","aria-hidden":"true",class:Ae(["brand-mark",{"is-animated":s.animated}])},[(c(),u(ee,null,ue(t,o=>d("path",{key:o.d,fill:"currentColor",d:o.d,style:kt({animationDelay:o.delay})},null,12,lo)),64))],2))}}),xe=(s,t)=>{const e=s.__vccOpts||s;for(const[n,o]of t)e[n]=o;return e},Ot=xe(co,[["__scopeId","data-v-44bc694b"]]),gs=3,oe="main";class qe extends Error{constructor(){super(...arguments);de(this,"name","ProtocolError")}}function we(s,t){throw new qe(`Invalid ${s}: expected ${t}`)}function J(s,t){return(s===null||typeof s!="object"||Array.isArray(s))&&we(t,"an object"),s}function Me(s,t){return Array.isArray(s)||we(t,"an array"),s}function E(s,t,e){const n=s[t];return typeof n!="string"&&we(`${e}.${t}`,"a string"),n}function et(s,t,e){return s[t]===void 0||s[t]===null?void 0:E(s,t,e)}function Ce(s,t,e){const n=s[t];return(typeof n!="number"||!Number.isSafeInteger(n)||n<0)&&we(`${e}.${t}`,"a nonnegative safe integer"),n}function xt(s,t,e){const n=s[t];return(typeof n!="number"||!Number.isFinite(n)||n<0)&&we(`${e}.${t}`,"a nonnegative number"),n}function ct(s,t,e){const n=s[t];return typeof n!="boolean"&&we(`${e}.${t}`,"a boolean"),n}function Zt(s,t){const e=J(s,t);return{providerId:E(e,"providerId",t),modelId:E(e,"modelId",t)}}function uo(s){const t=J(s,"hello");return{instanceId:E(t,"instanceId","hello"),serverVersion:E(t,"serverVersion","hello"),protocolVersion:Ce(t,"protocolVersion","hello"),features:Me(t.features,"hello.features").map((e,n)=>(typeof e!="string"&&we(`hello.features[${n}]`,"a string"),e))}}function Xe(s){J(s,"reply")}function po(s){const t="session.methods";return Me(J(s,t).methods,`${t}.methods`).map((e,n)=>E(J(e,`${t}.methods[${n}]`),"name",`${t}.methods[${n}]`))}function ho(s){const t="session.context.compact",e=J(s,t),n=E(e,"status",t);if(n==="completed")return{status:n};if(n==="skipped")return{status:n,reason:E(e,"reason",t)};we(`${t}.status`,"completed or skipped")}function mo(s){const t="session.context.usage",e=J(s,t);return{contextWindow:xt(e,"contextWindow",t),outputTokens:xt(e,"outputTokens",t),thresholdTokens:xt(e,"thresholdTokens",t),estimatedInputTokens:xt(e,"estimatedInputTokens",t),baselineSource:E(e,"baselineSource",t)}}function vo(s){return E(J(s,"session.fork"),"sessionId","session.fork")}function Us(s){return Me(s,"session.summaries").map((t,e)=>{const n=`session.summaries[${e}]`,o=J(t,n),i=et(o,"preview",n);return{sessionId:E(o,"sessionId",n),cwd:E(o,"cwd",n),model:Zt(o.model,`${n}.model`),createdAt:Ce(o,"createdAt",n),running:ct(o,"running",n),sequence:Ce(o,"sequence",n),...i===void 0?{}:{preview:i},updatedAt:Ce(o,"updatedAt",n)}})}function fo(s){const t=J(s,"session.create");return{sessionId:E(t,"sessionId","session.create"),model:Zt(t.model,"session.create.model"),sequence:Ce(t,"sequence","session.create")}}function go(s){const t=J(s,"session.branch_create"),e=J(t.branch,"session.branch_create.branch"),n="session.branch_create.branch";return{branchId:E(e,"branchId",n),...e.parentBranchId===void 0||e.parentBranchId===null?{}:{parentBranchId:E(e,"parentBranchId",n)},...e.branchPoint===void 0||e.branchPoint===null?{}:{branchPoint:Ce(e,"branchPoint",n)},...e.createEvent===void 0||e.createEvent===null?{}:{createEvent:Ce(e,"createEvent",n)}}}function bo(s){const t=J(s,"session.history");return{events:Me(t.events,"session.history.events").map((e,n)=>Gs(e,`session.history.events[${n}]`)),through:Ce(t,"through","session.history"),nextAfter:Ce(t,"nextAfter","session.history"),done:ct(t,"done","session.history")}}function yo(s){const t=J(s,"session.model.update");return{model:Zt(t.model,"session.model.update.model"),outcome:E(t,"outcome","session.model.update")}}function wo(s,t){return s==="read-only"||s==="workspace-write"||s==="full-access"?s:we(t,"a permission preset")}function Hs(s,t){const e=J(s,t),n=et(e,"fileAccess",t),o=et(e,"toolApproval",t);n!==void 0&&n!=="read-only"&&n!=="workspace-read-write"&&n!=="unrestricted"&&we(`${t}.fileAccess`,"a file access policy"),o!==void 0&&o!=="ask"&&o!=="bypass"&&we(`${t}.toolApproval`,"a tool approval policy");const i=r=>Me(e[r],`${t}.${r}`).map((l,h)=>(typeof l!="string"&&we(`${t}.${r}[${h}]`,"a string"),l));return{preset:wo(e.preset,`${t}.preset`),...n===void 0?{}:{fileAccess:n},...o===void 0?{}:{toolApproval:o},allowedTools:i("allowedTools"),disallowedTools:i("disallowedTools")}}function bs(s){const t="session.permission.get",e=J(s,t);return{version:Ce(e,"version",t),policy:Hs(e.policy,`${t}.policy`)}}function ko(s){return Ce(J(s,"session.permission.update"),"version","session.permission.update")}function _o(s){const t="session.files.search";return Me(J(s,t).candidates,`${t}.candidates`).map((e,n)=>{const o=`${t}.candidates[${n}]`,i=J(e,o);return{relativePath:E(i,"relativePath",o),absolutePath:E(i,"absolutePath",o),dir:ct(i,"dir",o)}})}function Io(s){return E(J(s,"attachment.put"),"path","attachment.put")}function $o(s){return E(J(s,"session.model.update"),"outcome","session.model.update")}function xo(s){const t=J(s,"provider.list");return Me(t.providers,"provider.list.providers").map((e,n)=>{const o=`provider.list.providers[${n}]`,i=J(e,o);return{providerId:E(i,"providerId",o),displayName:E(i,"displayName",o),enabled:ct(i,"enabled",o),credentialConfigured:ct(i,"credentialConfigured",o)}})}function So(s){return Me(s,"account.providers").map((t,e)=>{const n=`account.providers[${e}]`,o=J(t,n);return{providerId:E(o,"providerId",n),displayName:E(o,"displayName",n)}})}function Co(s,t){const e=s.metadata===void 0||s.metadata===null?void 0:J(s.metadata,`${t}.metadata`),n=(e==null?void 0:e.reasoning)===void 0||e.reasoning===null?void 0:J(e.reasoning,`${t}.metadata.reasoning`);if(n===void 0||n.supported!==!0||J(s.capabilities,`${t}.capabilities`).reasoning!==!0)return;const i=n.effortOptions===void 0||n.effortOptions===null?[]:Me(n.effortOptions,`${t}.metadata.reasoning.effortOptions`).map((r,l)=>(typeof r!="string"&&we(`${t}.metadata.reasoning.effortOptions[${l}]`,"a string"),r));return n.off!==void 0&&n.off!==null&&!i.includes("none")&&i.push("none"),i}function Mo(s){const t=J(s,"provider.catalog");if(t.catalog===null)return;const e=J(t.catalog,"provider.catalog.catalog");return{models:Me(e.models,"provider.catalog.models").map((n,o)=>{const i=`provider.catalog.models[${o}]`,r=J(n,i),l=et(r,"unavailableReason",i),h=Co(r,i);return{id:E(r,"id",i),name:E(r,"name",i),...l===void 0?{}:{unavailableReason:l},...h===void 0?{}:{reasoningEfforts:h}}}),disabledModelIds:Me(e.disabledModelIds,"provider.catalog.disabledModelIds").map((n,o)=>(typeof n!="string"&&we(`provider.catalog.disabledModelIds[${o}]`,"a string"),n))}}function To(s){const t=J(s,"provider.selection");if(t.selection===null)return;const e=J(t.selection,"provider.selection.selection");return{providerId:E(e,"provider_id","provider.selection"),modelId:E(e,"model_id","provider.selection")}}function Eo(s,t){return{content:Me(s.content,`${t}.content`).map((e,n)=>J(e,`${t}.content[${n}]`))}}function Ao(s){const t="session.input.withdraw",e=E(J(s,t),"status",t);if(e==="deleted"||e==="notHeld")return{status:e};we(`${t}.status`,"deleted or notHeld")}function Ks(s,t){return Me(s,t).flatMap((e,n)=>{const o=J(e,`${t}[${n}]`);return o.type==="text"?[E(o,"text",`${t}[${n}]`)]:[]}).join(`
|
|
213
|
+
`)}function ys(s,t){const e=J(s,t),n=typeof e.content=="string"?e.content:Ks(e.content,`${t}.content`),o=e.structuredContent===void 0||e.structuredContent===null?void 0:J(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 Lo(s,t){return s==null?[]:Me(s,t).flatMap((e,n)=>{const o=J(e,`${t}[${n}]`);if(o.type!=="raw")return[];const i=et(o,"key",`${t}[${n}]`);return[{text:E(o,"text",`${t}[${n}]`),...i===void 0?{}:{key:i},retire:o.retire===!0}]})}function Dt(s,t){const e=J(s,t),n=E(e,"kind",t);return n==="tool"?{kind:n,turnId:E(e,"turn_id",t),requestId:E(e,"request_id",t),callId:E(e,"call_id",t)}:n==="host"?{kind:n,operationId:E(e,"operation_id",t)}:we(t,"a branch source")}function qo(s,t){const e=J(s,t);switch(E(e,"kind",t)){case"sequence":return Ce(e,"sequence",t);case"create":return;default:return we(t,"a branch cut")}}function Oo(s,t,e,n){switch(`${s}/${t}`){case"input/message":{const o=Lo(e.blocks,`${n}.blocks`);if(e.user===void 0||e.user===null){if(o.length===0)return{kind:"input",blocks:o};const r=et(e,"mode",n);return{kind:"source-input",text:o.map(h=>h.text).find(h=>h.startsWith("<dim-branch-"))??o[0].text,blocks:o,...r===void 0?{}:{mode:r}}}const i=J(e.user,`${n}.user`);return{kind:"input",text:Ks(i.content,`${n}.user.content`),user:Eo(i,`${n}.user`),blocks:o}}case"input/applied":return{kind:"input-applied",inputId:E(e,"input_id",n)};case"permission/changed":return{kind:"permission-changed",policy:Hs(e.policy,`${n}.policy`)};case"input/deleted":return{kind:"input-deleted",inputId:E(e,"input_id",n)};case"branch/start":return{kind:"branch-start"};case"session/forked":return{kind:"session-forked"};case"branch/create":return{kind:"branch-create",branchId:E(e,"branch",n),at:qo(e.at,`${n}.at`),prompt:E(e,"prompt",n),source:Dt(e.source,`${n}.source`)};case"branch/create-failed":{const o=E(e,"status",n);return o!=="failed"&&o!=="cancelled"&&we(`${n}.status`,"a creation outcome"),{kind:"branch-create-failed",branchId:E(e,"branch",n),status:o,error:E(e,o==="failed"?"error":"reason",n)}}case"branch/end":return{kind:"branch-end",source:Dt(e.source,`${n}.source`),...e.ancestor===void 0||e.ancestor===null?{}:{ancestor:E(e,"ancestor",n)}};case"branch/ended":return{kind:"branch-ended",branchId:E(e,"branch",n),source:Dt(e.source,`${n}.source`),...e.ancestor===void 0||e.ancestor===null?{}:{ancestor:E(e,"ancestor",n)}};case"turn/end":{const o=E(e,"status",n);o!=="completed"&&o!=="failed"&&o!=="cancelled"&&we(`${n}.status`,"a turn outcome");const i=o==="failed"?E(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:E(e,"request_id",n)};case"step/thinking":return{kind:"thinking",requestId:E(e,"request_id",n),delta:E(e,"delta",n)};case"step/text":return{kind:"text",requestId:E(e,"request_id",n),delta:E(e,"delta",n)};case"step/tool-call":return{kind:"tool-call",requestId:E(e,"request_id",n),asks:zo(Me(e.calls,`${n}.calls`),`${n}.calls`)};case"step/tool-use":{const o=J(e.call,`${n}.call`);return{kind:"tool-use",requestId:E(e,"request_id",n),callId:E(o,"id",`${n}.call`),name:E(o,"name",`${n}.call`),input:J(o.input,`${n}.call.input`)}}case"step/tool-completed":return{kind:"tool-completed",callId:E(e,"call_id",n),result:ys(e.result,`${n}.result`)};case"step/tool-result":return{kind:"tool-result",requestId:E(e,"request_id",n),results:Me(e.results,`${n}.results`).map((o,i)=>{const r=J(o,`${n}.results[${i}]`);return{callId:E(r,"call_id",`${n}.results[${i}]`),result:ys(r.result,`${n}.results[${i}].result`)}})};case"step/model-output-end":{const o=E(e,"status",n)==="failed"?E(e,"error",n):void 0;return{kind:"model-end",requestId:E(e,"request_id",n),...o===void 0?{}:{error:o}}}case"context/configured":return{kind:"context-configured",model:{providerId:E(e,"provider_id",n),modelId:E(e,"model_id",n)}};default:return{kind:"other"}}}function Ro(s){if(!Array.isArray(s.questions)||s.questions.length<1||s.questions.length>4)return;const t=new Set,e=[];for(const[n,o]of s.questions.entries()){const i=Po(o,String(n+1));if(i===void 0||t.has(i.id))return;t.add(i.id),e.push(i)}return e}function Po(s,t){if(s===null||typeof s!="object"||Array.isArray(s))return;const e=s,n=e.id??t;if(typeof n!="string"||n===""||e.header!==void 0&&typeof e.header!="string"||typeof e.header=="string"&&[...e.header].length>40||typeof e.question!="string"||e.question.trim()===""||!Array.isArray(e.options)||e.options.length<2||e.options.length>6)return;const o=new Set,i=[];for(const r of e.options){if(r===null||typeof r!="object"||Array.isArray(r))return;const l=r;if(typeof l.label!="string"||l.label.trim()===""||o.has(l.label)||l.description!==void 0&&typeof l.description!="string")return;o.add(l.label),i.push({label:l.label,...typeof l.description=="string"?{description:l.description}:{}})}if(!(e.multiSelect!==void 0&&typeof e.multiSelect!="boolean"||e.allowCustom!==void 0&&typeof e.allowCustom!="boolean"))return{id:n,...typeof e.header=="string"?{header:e.header}:{},question:e.question,options:i,multiSelect:e.multiSelect===!0,allowCustom:e.allowCustom!==!1}}function zo(s,t){const e=[];for(const[n,o]of s.entries()){const i=J(o,`${t}[${n}]`);if(E(i,"name",`${t}[${n}]`)!=="ask_user")continue;const r=Ro(J(i.input,`${t}[${n}].input`));r!==void 0&&e.push({callId:E(i,"id",`${t}[${n}]`),questions:r})}return e}function Gs(s,t){const e=J(s,t),n=E(e,"type",t),o=E(e,"name",t);return{id:E(e,"id",t),sequence:Ce(e,"sequence",t),createAt:Ce(e,"create_at",t),content:Oo(n,o,J(e.data,`${t}.data`),`${t}.data`)}}function Do(s){const t="approval.request",e=J(s.call,`${t}.call`),n=J(s.source,`${t}.source`),o=n.kind==="tool"?E(n,"call_id",`${t}.source`):void 0;return{sessionId:E(s,"sessionId",t),branchId:E(s,"branchId",t),requestId:E(s,"requestId",t),...o===void 0?{}:{callId:o},call:{name:E(e,"name",`${t}.call`),input:J(e.input,`${t}.call.input`)},reason:E(s,"reason",t)}}function Fo(s){const t="session.collaboration.approval.get",e=J(s,t);if(e.state==="ended")return{state:"ended"};e.state!=="pending"&&we(t,"pending or ended");const n=J(e.descriptor,`${t}.descriptor`),o=J(n.member,`${t}.member`),i=J(n.call,`${t}.call`);return{state:"pending",approvalId:E(e,"approvalId",t),descriptor:{delegationId:E(n,"delegationId",t),requestId:E(n,"requestId",t),reason:E(n,"reason",t),member:{agentId:E(o,"agentId",t),sessionId:E(o,"sessionId",t),branchId:E(o,"branchId",t)},call:{name:E(i,"name",t),input:J(i.input,t)}}}}function jo(s,t){const e=J(t??{},s);switch(s){case"session.event":return{method:s,sessionId:E(e,"sessionId",s),branchId:E(e,"branchId",s),event:Gs(e.event,`${s}.event`)};case"session.state":return{method:s,sessionId:E(e,"sessionId",s),branchId:E(e,"branchId",s),running:ct(e,"running",s),stopping:ct(e,"stopping",s)};case"session.model.progress":{const n=et(e,"requestId",s);return{method:s,progress:{sessionId:E(e,"sessionId",s),branchId:E(e,"branchId",s),...n===void 0?{}:{requestId:n},text:E(e,"text",s),textOffset:Ce(e,"textOffset",s),thinking:E(e,"thinking",s),thinkingOffset:Ce(e,"thinkingOffset",s)}}}case"approval.request":return{method:s,request:Do(e)};case"approval.resolved":case"approval.cancelled":return{method:s,sessionId:E(e,"sessionId",s),branchId:E(e,"branchId",s),requestId:E(e,"requestId",s)};case"session.notice":{if(e.source!=="Collaboration"||e.kind!=="memberApprovalEnded")return;const n=J(e.data,s);return{method:"memberApprovalEnded",sessionId:E(e,"sessionId",s),branchId:E(n,"branchId",s),approvalId:E(n,"approvalId",s)}}case"session.closed":{const n=et(e,"reason",s);return{method:s,sessionId:E(e,"sessionId",s),...n===void 0?{}:{reason:n}}}default:return}}class Ze extends Error{constructor(e,n,o){super(n);de(this,"name","RpcError");this.code=e,this.appError=o}}class _t extends Error{constructor(){super(...arguments);de(this,"name","ConnectionLost")}}const Wo=3e4,No=2e4,Bo=1e4,ws=[500,1e3,2e3,4e3,8e3,15e3];class Vo{constructor(t){de(this,"socket");de(this,"nextId",1);de(this,"pending",new Map);de(this,"heartbeat");de(this,"retry");de(this,"attempt",0);de(this,"connectedOnce",!1);de(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=Wo){const i=this.socket;if(i===void 0||i.readyState!==WebSocket.OPEN)return Promise.reject(new _t("Not connected"));const r=this.nextId++;return new Promise((l,h)=>{const w=setTimeout(()=>{this.pending.delete(r),h(new _t(`${t} timed out`))},o);this.pending.set(r,{resolve:l,reject:h,timer:w}),i.send(JSON.stringify({jsonrpc:"2.0",id:r,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 _t("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:gs,clientKind:"web",clientName:"dim-web"},uo)}catch(i){i instanceof Ze&&i.appError==="protocol_version"&&(this.stopped=!0,this.handlers.phase("version-mismatch")),(n=this.socket)==null||n.close();return}if(t.protocolVersion!==gs){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",{},()=>{},Bo).catch(()=>{var i;return(i=this.socket)==null?void 0:i.close()})},No),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=ws[Math.min(this.attempt,ws.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 qe("Expected a JSON-RPC object");e=o}catch(o){this.handlers.invalid(o instanceof qe?o:new qe("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(Uo(e.error)):o.resolve(e.result);return}if(typeof e.method!="string")return;let n;try{n=jo(e.method,e.params)}catch(o){this.handlers.invalid(o instanceof qe?o:new qe(String(o)));return}n!==void 0&&this.handlers.notification(n)}}function Uo(s){const t=s!==null&&typeof s=="object"?s:{},e=t.data!==null&&typeof t.data=="object"?t.data:{};return new Ze(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 Ho(){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{}}}const Ko=/[;&|`()<>$\r\n]/;function Qs(s){if(s.call.name!=="exec"&&s.call.name!=="execute")return;const t=s.call.input.command;if(!(typeof t!="string"||Ko.test(t)||t.trim()===""))return t}function Go(s){return{command:s.split(/\s+/).filter(t=>t!=="").join(" "),match:"exact",decision:"allow"}}function Qo(s,t){return s.decision===t.decision&&s.match===t.match&&s.command.split(/\s+/).filter(e=>e!=="").join(" ")===t.command}function Js(s){const t=s.call.name;if(t!=="read"&&t!=="write"&&t!=="edit")return;const e=s.call.input.path;if(typeof e=="string")return{path:e,kind:"file",mode:t==="read"?"read":"write"}}const Ft="goal:objective",Jo="goal:status",ks="<dim-goal ";class Yo{constructor(){de(this,"blocks",[]);de(this,"deleted",new Set)}apply(t){const e=t.content;switch(e.kind){case"branch-start":case"session-forked":this.blocks=[];break;case"input":case"source-input":for(const n of e.blocks)this.add(t.id,n);break;case"input-deleted":this.blocks.some(n=>n.input===e.inputId)&&this.deleted.add(e.inputId);break}}goal(){let t,e=!1,n;for(const o of this.blocks)if(!this.deleted.has(o.input))switch(o.kind){case"objective":t=o.text,o.set&&(e=o.judge==="evaluator");break;case"objective-retire":t=void 0,e=!1;break;case"status":if(o.status.kind==="completed"&&!o.byEvaluator&&e)break;n=o.status;break;case"status-retire":n=void 0;break}if(t!==void 0)return{objective:t,status:n??{kind:"none"},evaluator:e}}add(t,e){const{text:n}=e;if(e.key!==Ft&&e.key!==Jo||Xs(n)===void 0)return;if(e.retire){this.blocks.push(e.key===Ft?{kind:"objective-retire",input:t}:{kind:"status-retire",input:t});return}if(e.key===Ft){this.blocks.push({kind:"objective",input:t,text:Zo(n,"Objective:"),set:vt(n,"op")==="set",judge:vt(n,"judge")});return}const o=Xo(n);o!==void 0&&this.blocks.push({kind:"status",input:t,status:o,byEvaluator:vt(n,"by")==="evaluator"})}}function Xo(s){if(vt(s,"kind")==="status")return{kind:"active"};switch(vt(s,"op")){case"pause":return{kind:"paused",reason:vt(s,"reason")??"user"};case"resume":return{kind:"active"};case"completed":return{kind:"completed"};case"blocked":return{kind:"blocked"};default:return}}function Zo(s,t){const e=s.indexOf(`
|
|
214
|
+
${t}
|
|
215
|
+
`);if(e===-1)return;const n=s.lastIndexOf(`
|
|
216
|
+
|
|
217
|
+
`);if(!(n===-1||n<e))return Ys(s.slice(e+t.length+2,n))}function Ys(s){return s.replaceAll(""",'"').replaceAll(">",">").replaceAll("<","<").replaceAll("&","&")}function Xs(s){if(!s.startsWith(ks))return;const t=s.slice(ks.length),e=t.indexOf(">");return e===-1?void 0:t.slice(0,e)}function vt(s,t){const e=Xs(s);if(e===void 0)return;let n=0;for(;;){const o=e.indexOf('="',n);if(o===-1)return;let i=0;for(let h=o-1;h>=0;h--)if(!/[A-Za-z0-9_]/.test(e[h])){i=h+1;break}const r=o+2,l=e.indexOf('"',r);if(l===-1)return;if(e.slice(i,o)===t)return Ys(e.slice(r,l));n=l+1}}function ei(s){const t=s.trim();if(t==="")return{form:"show"};const e=t.search(/\s/),n=e===-1?t:t.slice(0,e),o=e===-1?"":t.slice(e).trim();switch(n){case"pause":case"resume":case"clear":if(o==="")return{form:n};break;case"set":case"edit":return o===""?void 0:{form:n,objective:o}}return{form:"objective",objective:t}}function ti(s){switch(s.form){case"show":case"pause":case"resume":case"clear":return;default:return s.objective}}function si(s,t){switch(s.form){case"show":return;case"objective":return t!==void 0&&(t.status.kind==="active"||t.status.kind==="paused")?"edit":"set";default:return s.form}}class ni{constructor(){de(this,"rows",[]);de(this,"cursor",0);de(this,"lastTurnEnd");de(this,"model");de(this,"answers",new Map);de(this,"thoughts",new Map);de(this,"requestStarts",new Map);de(this,"tools",new Map);de(this,"lines",new Map);de(this,"asks",[]);de(this,"held",new Map);de(this,"goalFold",new Yo)}get goal(){return this.goalFold.goal()}queued(){return[...this.held.values()]}waiting(){return this.asks}apply(t){if(t.sequence<=this.cursor)return!1;this.cursor=t.sequence,this.goalFold.apply(t);const e=t.content;switch(e.kind){case"input":e.user!==void 0&&this.held.set(t.id,{id:t.id,text:e.text??"",user:e.user}),e.text!==void 0&&this.push({kind:"user",key:`user-${t.sequence}`,text:e.text,at:t.createAt,sequence:t.sequence,cut:Math.max(0,t.sequence-1)});break;case"input-applied":case"input-deleted":this.held.delete(e.inputId);break;case"source-input":{const n=oi(e.text,e.mode);n!==void 0&&this.push({...n,key:`notice-${t.sequence}`});break}case"branch-create":{const n=e.at??t.sequence,o=this.rows.find(r=>r.kind==="user"&&r.cut===n),i=(o==null?void 0:o.kind)==="user"?ii(o.text):void 0;this.lines.set(e.branchId,this.push({kind:"line",key:`line-${t.sequence}`,branchId:e.branchId,purpose:Zs(e.prompt),...i===void 0?{}:{before:i}}));break}case"branch-create-failed":{const n=this.lines.get(e.branchId);n!==void 0&&this.update(n,{failed:!0});break}case"branch-end":{const n=e.ancestor;this.push({kind:"line-ended",key:`line-ended-${t.sequence}`,issuer:n!==void 0?"ancestor":e.source.kind==="tool"?"itself":"operation",...n===void 0?{}:{ancestor:n}});break}case"model-start":this.requestStarts.set(e.requestId,t.createAt);break;case"thinking":{const n=this.openThinking(e.requestId);_s(n,e.delta);const o=this.requestStarts.get(e.requestId);this.update(n.index,{text:St(n),...o===void 0?{}:{elapsedMs:Math.max(0,t.createAt-o)}});break}case"text":{this.closeThinking(e.requestId);const n=this.openAnswer(e.requestId);_s(n,e.delta),this.update(n.index,{text:St(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-call":for(const n of e.asks)this.asks.push({requestId:e.requestId,callId:n.callId,questions:n.questions});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);this.asks=this.asks.filter(n=>n.requestId!==e.requestId||!e.results.some(o=>o.callId===n.callId));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":this.lastTurnEnd=t.sequence;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:St(n)})}if(t.text!==""){const n=this.openAnswer(e);n.progress={text:t.text,offset:t.textOffset},this.update(n.index,{text:St(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 oi(s,t){if(s.startsWith("<dim-branch-message")){const e=wt(s,"from");return e===void 0?void 0:{kind:"source-message",from:e,steer:t==="steer",final:wt(s,"final")!==void 0,body:ai(ri(li(s,"</dim-branch-message>")))}}if(s.startsWith("<dim-branch-idle")){const e=wt(s,"branch");return e===void 0?void 0:{kind:"source-idle",branch:e,status:wt(s,"status")??"idle"}}if(s.startsWith("<dim-branch-ended")){const e=wt(s,"branch");return e===void 0?void 0:{kind:"source-ended",branch:e}}}function Zs(s){var t;return((t=s.split(`
|
|
218
|
+
`)[0])==null?void 0:t.trim())??""}function ii(s){const t=Zs(s),e=[...t];return e.length<=40?t:`${e.slice(0,40).join("")}…`}function ai(s){return s.split(/\s+/u).filter(Boolean).join(" ")}function ri(s){return s.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function wt(s,t){const e=`${t}="`,n=s.indexOf(e);if(n<0)return;const o=n+e.length,i=s.indexOf('"',o);return i<0?void 0:s.slice(o,i)}function li(s,t){const e=s.indexOf(`
|
|
219
|
+
`),n=e<0?"":s.slice(e+1),o=n.indexOf(t);return o<0?n:n.slice(0,o)}function _s(s,t){s.written+=t,s.writtenChars+=[...t].length}function St(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 ci={kind:"ended-itself"},di={kind:"ended-by-operation"};class ui{constructor(){de(this,"nodes",new Map);de(this,"messages",new Map);de(this,"running",new Set);de(this,"nextOrder",0)}apply(t,e){var o;const n=e.content;switch(n.kind){case"input":this.addMessage(t,e.id,e.sequence);break;case"input-deleted":(o=this.messages.get(t))==null||o.delete(n.inputId);break;case"branch-create":{if(this.nodes.has(n.branchId))return;this.nodes.set(n.branchId,{id:n.branchId,parentId:t,purpose:pi(n.prompt),at:n.at??e.sequence,order:this.nextOrder++,failed:!1,ended:void 0});break}case"branch-create-failed":{const i=this.nodes.get(n.branchId)??{id:n.branchId,parentId:t,purpose:"",at:e.sequence,order:this.nextOrder++,failed:!1,ended:void 0};i.failed=!0,this.nodes.set(i.id,i);break}case"branch-ended":{const i=this.nodes.get(n.branchId);i!==void 0&&(i.ended=hi(n.source,n.ancestor));break}}}setRunning(t,e){e?this.running.add(t):this.running.delete(t)}has(t){return this.nodes.has(t)}views(){const t=[{id:"main",parentId:null,purpose:"",state:{kind:"main"},cut:null,depth:0}],e=new Map;for(const i of this.nodes.values()){const r=e.get(i.parentId)??[];r.push(i),e.set(i.parentId,r)}for(const i of e.values())i.sort((r,l)=>r.at-l.at||r.order-l.order);const n=new Set,o=(i,r)=>{for(const l of e.get(i)??[])n.has(l.id)||(n.add(l.id),t.push({id:l.id,parentId:l.parentId,purpose:l.purpose,state:this.stateOf(l),cut:{sequence:l.at,messages:this.cutMessages(l)},depth:r}),o(l.id,r+1))};o("main",1);for(const i of this.nodes.values())n.has(i.id)||(n.add(i.id),t.push({id:i.id,parentId:i.parentId,purpose:i.purpose,state:this.stateOf(i),cut:{sequence:i.at,messages:this.cutMessages(i)},depth:1}),o(i.id,2));return t}addMessage(t,e,n){const o=this.messages.get(t)??new Map;o.set(e,n),this.messages.set(t,o)}stateOf(t){return t.failed?{kind:"creation-failed"}:t.ended!==void 0?t.ended:this.running.has(t.id)?{kind:"working"}:{kind:"waiting"}}cutMessages(t){const e=this.nodes.get(t.parentId);return(e===void 0?0:this.cutMessages(e))+this.messagesThrough(t.parentId,t.at)}messagesThrough(t,e){var o;let n=0;for(const i of((o=this.messages.get(t))==null?void 0:o.values())??[])i<=e&&n++;return n}}function pi(s){var t;return((t=s.split(`
|
|
220
|
+
`)[0])==null?void 0:t.trim())??""}function hi(s,t){return t!==void 0?{kind:"ended-with",ancestor:t}:s.kind==="tool"?ci:di}function Y(s){if(s===null||typeof s!="object"||Array.isArray(s))throw new qe("Invalid settings reply: expected object");return s}function V(s){if(typeof s!="string")throw new qe("Invalid settings reply: expected string");return s}function _e(s){if(typeof s!="boolean")throw new qe("Invalid settings reply: expected boolean");return s}function Je(s){if(typeof s!="number"||!Number.isSafeInteger(s)||s<0)throw new qe("Invalid settings reply: expected nonnegative integer");return s}function me(s,t){if(!Array.isArray(s))throw new qe("Invalid settings reply: expected array");return s.map(t)}function ge(s){return s==null?void 0:V(s)}function tt(s,t){const e=V(s);if(!t.includes(e))throw new qe("Invalid settings reply: unknown option");return e}function xh(s){const t=Y(s);return t.selection===null?void 0:mi(t.selection)}function mi(s){const t=Y(s);return{providerId:V(t.provider_id),modelId:V(t.model_id),version:Je(t.version)}}function Sh(s){const t=Y(s),e=Y(t.policy),n=tt(e.mode,["agent","inherit","fixed"]);if(n!=="fixed")return{revision:V(t.revision),policy:{mode:n}};const o=Y(e.model);return{revision:V(t.revision),policy:{mode:n,model:{providerId:V(o.providerId),modelId:V(o.modelId)}}}}function Ch(s){const t=Y(s);return{revision:V(t.revision),executablePath:ge(t.executablePath),configError:ge(t.configError),shells:me(t.shells,e=>{const n=Y(e);return{executablePath:V(n.executablePath),name:V(n.name)}})}}function vi(s){const t=Y(s);return{revision:V(t.revision),commandRules:me(t.commandRules,e=>{const n=Y(e);return{command:V(n.command),match:tt(n.match,["exact","prefix"]),decision:tt(n.decision,["allow","deny"])}})}}function fi(s){return V(Y(s).revision)}function Mh(s){const t=Y(s);return{version:Je(t.version),entries:me(t.entries,e=>{const n=Y(e);return{id:V(n.id),name:V(n.name),description:V(n.description),filePath:V(n.filePath),allowedTools:me(n.allowedTools,V),enabled:_e(n.enabled),shadowedBy:ge(n.shadowedBy)}}),issues:me(t.issues,e=>{const n=Y(e);return{path:V(n.path),message:V(n.message)}})}}function en(s){const t=Y(s),e=ge(t.path);return e!==void 0?{path:e}:{git:V(t.git),ref:ge(t.ref),commit:V(t.commit)}}function Th(s){return"path"in s?s.path:`${s.git}${s.ref===void 0?"":` (${s.ref})`} @${s.commit.slice(0,8)}`}function Eh(s){const t=Y(s),e=n=>{const o=Y(n);return{path:V(o.path),name:V(o.name),by:V(o.by)}};return{source:en(t.source),skills:me(t.skills,n=>{const o=Y(n);return{path:V(o.path),name:V(o.name),description:V(o.description),revision:V(o.revision)}}),conflicts:me(t.conflicts,e),shadows:me(t.shadows,e),issues:me(t.issues,n=>{const o=Y(n);return{path:V(o.path),message:V(o.message)}})}}function Ht(s){const t=Y(s);return{id:V(t.id),source:en(t.source),revision:V(t.revision),skills:me(t.skills,e=>{const n=Y(e);return{path:V(n.path),id:V(n.id)}})}}function Ah(s){return me(Y(s).installations,Ht)}function Lh(s){const t=Y(s);return{installation:Ht(t.installation),previous:t.previous===void 0?void 0:Ht(t.previous),version:Je(t.version),issues:me(t.issues,e=>{const n=Y(e);return{path:V(n.path),message:V(n.message)}})}}function qh(s){return me(s,t=>{const e=Y(t);return{name:V(e.name),use:ge(e.use),off:_e(e.off),locked:_e(e.locked),status:ge(e.status),error:ge(e.error),candidates:me(e.candidates,n=>{const o=Y(n),i=o.source===void 0?void 0:Y(o.source);return{id:V(o.id),kinds:me(o.kinds,V),git:i===void 0?void 0:ge(i.git)}}),refused:e.refused===void 0?[]:me(e.refused,n=>{const o=Y(n);return{kind:V(o.kind),error:V(o.error)}})}})}function Oh(s){const t=Y(s);return{userRevision:V(t.userRevision),projectRevision:ge(t.projectRevision),servers:me(t.servers,e=>{const n=Y(e);return{id:V(n.id),source:tt(n.source,["user","project","plugin"]),enabled:_e(n.enabled),transport:V(n.transport),auth:n.auth===void 0?void 0:V(Y(n.auth).status)}}),errors:[t.userApplication,t.pluginApplication,t.projectApplication].flatMap(e=>{if(e===null)return[];const n=Y(e);return[ge(n.error),ge(n.cleanupError)].filter(o=>o!==void 0)})}}function tn(s){const t=Y(s),e=tt(t.type,["stdio","http","sse"]);if(e==="stdio")return{type:e,command:V(t.command),argsCount:Je(t.argsCount),cwd:ge(t.cwd),envNames:me(t.envNames,V)};const n=t.oauth===null?void 0:Y(t.oauth);return{type:e,endpoint:V(t.endpoint),headerNames:me(t.headerNames,V),authConfigured:_e(t.authConfigured),oauthConfigured:_e(t.oauthConfigured),oauth:n===void 0?void 0:{clientId:ge(n.clientId),callbackPort:n.callbackPort===null?void 0:Je(n.callbackPort),scopes:ge(n.scopes),metadataConfigured:_e(n.metadataConfigured)}}}function Rh(s){const t=Y(s);return{revision:ge(t.revision),enabled:_e(t.enabled),secretsInUserScope:t.secretsInUserScope===!0,configuration:tn(t.configuration)}}function sn(s){const t=Y(s);return{name:V(t.name),description:ge(t.description)}}function Ph(s){const t=Y(s);return{enabled:_e(t.enabled),configuration:tn(t.configuration),connections:me(t.connections,e=>{const n=Y(e),o=Y(n.state),i=tt(o.status,["disconnected","connecting","connected","failed","closed","auth_required"]);return{state:i,expired:i==="auth_required"?_e(o.expired):void 0,tools:n.tools===null?void 0:me(n.tools,sn)}})}}function zh(s){const t=Y(s);return{status:tt(t.status,["connected","authRequired","failed"]),latencyMs:Je(t.latencyMs),tools:t.tools===null?void 0:me(t.tools,sn),expired:t.expired===void 0?void 0:_e(t.expired),missingScopes:t.missingScopes===void 0?void 0:me(t.missingScopes,V),reason:ge(t.reason),message:ge(t.message)}}function Dh(s){const t=Y(s),e=V(t.authorizationUrl),n=new URL(e);if(!["https:","http:"].includes(n.protocol)||n.username||n.password)throw new qe("Invalid MCP authorization URL");return{attemptId:V(t.attemptId),authorizationUrl:e,redirectUri:V(t.redirectUri),expiresAt:Je(t.expiresAt)}}function Fh(s){const t=Y(s);return{sessions:Us(t.sessions),nextCursor:ge(t.nextCursor)}}function jh(s){const t=Y(s);return{sessions:Je(t.sessions),connections:Je(t.connections),serverVersion:V(t.serverVersion)}}function Wh(s){const t=Y(s);return{revision:V(t.revision),enabled:_e(Y(t.document).enabled)}}function Nh(s){const t=Y(s),e=Y(t.document);return{revision:V(t.revision),sandbox:_e(e.sandbox),network:_e(e.network)}}function Bh(s){const t=Y(s);return _e(t.available)?{available:!0}:{available:!1,reason:V(t.reason)}}function es(s){const t=Y(s);return{dimension:V(t.dimension),detail:V(t.detail)}}function Is(s){const t=Y(s),e=t.reason===null||t.reason===void 0?void 0:es(t.reason);return{providerId:V(t.providerId),modelId:V(t.modelId),available:_e(t.available),...e===void 0?{}:{reason:e}}}function gi(s){const t=Y(s),e=ge(t.key),n=t.effective===null||t.effective===void 0?void 0:Y(t.effective);return{operation:V(t.operation),...e===void 0?{}:{key:e},available:_e(t.available),reasons:me(t.reasons,es),...t.default===null||t.default===void 0?{}:{default:Is(t.default)},...n===void 0?{}:{effective:{providerId:V(n.providerId),modelId:V(n.modelId),source:tt(n.source,["default","automatic"])}},options:me(t.options,Is)}}function Vh(s){const t=Y(s);return{revision:V(t.revision),categories:me(t.categories,e=>{const n=Y(e);return{category:V(n.category),available:_e(n.available),reasons:me(n.reasons,es),operations:me(n.operations,gi)}})}}const Re=ut("sessions",()=>{const s=A([]),t=A(!1),e=A("");let n;const o=C(()=>new Map(s.value.map(f=>[f.sessionId,f]))),i=C(()=>{const f=new Map;for(const v of s.value){const b=f.get(v.cwd);b===void 0?f.set(v.cwd,[v]):b.push(v)}return[...f].map(([v,b])=>(b.sort((T,$)=>$.updatedAt-T.updatedAt),{cwd:v,name:Rt(v),sessions:b,updatedAt:b[0].updatedAt})).sort((v,b)=>b.updatedAt-v.updatedAt)});function r(){return n??(n=Ee().client.call("session.summaries",{},Us).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 l(f,v){const b={cwd:f};v!==void 0&&(b.model={provider:v.providerId,modelId:v.modelId});const T=await Ee().client.call("session.create",b,fo);return r(),T.sessionId}function h(f,v){const b=o.value.get(f);b!==void 0&&b.running!==v&&(b.running=v)}function w(f){s.value=s.value.filter(v=>v.sessionId!==f)}return{summaries:s,loaded:t,error:e,byId:o,workspaces:i,refresh:r,create:l,setRunning:h,forget:w}});function Rt(s){return s.replace(/[\\/]+$/,"").split(/[\\/]/).at(-1)||s}const bi=1100;function dt(s){return s.slice(0,8)}function Ct(s,t){switch(t.kind){case"main":return s("lines.state.main");case"working":return s("lines.state.working");case"waiting":return s("lines.state.waiting");case"ended-itself":return s("lines.state.endedItself");case"ended-by-operation":return s("lines.state.endedByOperation");case"ended-with":return s("lines.state.endedWith",{id:t.ancestor});case"creation-failed":return s("lines.state.creationFailed")}}function ts(s){if(s.kind==="working")return"primary";if(s.kind==="creation-failed")return"danger";if(s.kind==="ended-with")return"warning"}function Qe(s,t,e){const n=(t==null?void 0:t.purpose.trim())??"";return n===""?dt(e):n}function yi(s,t){const e=!t.detailOpen||!t.detailExpanded&&t.shellWidth>=bi,n=t.detailOpen?t.activeLine:void 0,o=e&&s.some(r=>r.branchId===oe),i=n!==void 0&&s.some(r=>r.branchId===n);if(o&&i)return t.detailFocused?n:oe;if(i)return n;if(o)return oe}function wi(s,t={}){if(t.keyboard===!1||t.pending||s.defaultPrevented||t.dialogOpen)return;const e=s.target;if(!(e!==null&&typeof e=="object"&&(e.tagName==="INPUT"||e.tagName==="TEXTAREA"||e.isContentEditable===!0))){if(s.key==="Enter"||s.key==="y"||s.key==="Y")return"allow";if(s.key==="Escape"||s.key==="n"||s.key==="N")return"deny"}}const ki="modulepreload",_i=function(s){return"/"+s},$s={},Se=function(t,e,n){let o=Promise.resolve();if(e&&e.length>0){let r=function(w){return Promise.all(w.map(f=>Promise.resolve(f).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),h=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=r(e.map(w=>{if(w=_i(w),w in $s)return;$s[w]=!0;const f=w.endsWith(".css"),v=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${w}"]${v}`))return;const b=document.createElement("link");if(b.rel=f?"stylesheet":ki,f||(b.as="script"),b.crossOrigin="",b.href=w,h&&b.setAttribute("nonce",h),document.head.appendChild(b),f)return new Promise((T,$)=>{b.addEventListener("load",T),b.addEventListener("error",()=>$(new Error(`Unable to preload CSS for ${w}`)))})}))}function i(r){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=r,window.dispatchEvent(l),!l.defaultPrevented)throw r}return o.then(r=>{for(const l of r||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})},Ii={"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.cancel":"Cancel","common.close":"Close","common.loading":"Loading…","common.search":"Search","common.skipToContent":"Skip to content","composer.category.model":"Model","composer.category.session":"Session","composer.branchUnavailable":"Branch creation is not available here","composer.command.branch":"Open a line here","composer.command.compact":"Compact the context","composer.command.fork":"Fork at the last finished turn","composer.command.usage":"Show the context window usage","composer.command.lines":"Show session lines","command.basisEstimated":"estimated","command.basisProvider":"counted by the provider","command.compactSkipped":"Compaction skipped","command.compacted":"Context compacted","command.failed":"Command failed","command.effortChoices":"Reasoning effort choices: {choices}","command.effortSet":"Reasoning effort configuration {outcome}: {value}","command.effortUnavailable":"This model does not advertise reasoning effort choices.","command.effortUnknown":"Reasoning effort is not advertised by this model.","command.effortUsage":"Usage: /effort [VALUE]","composer.command.effort":"Show or set the reasoning effort","queue.notHeld":"That message was already adopted by the run.","queue.remove":"Remove","queue.steer":"Steer","queue.title":"Queued messages","command.usage":"Context: {input} / {window} tokens ({percent}%), {basis} · output up to {output} · compacts at {threshold}","command.usageTitle":"Context usage","fork.confirm":"Fork this session at its last finished turn? The new session copies main up to that point.","fork.confirmLabel":"Fork","composer.command.goal":"Show or change the goal","goal.action.clear":"cleared","goal.action.edit":"edited","goal.action.pause":"paused","goal.action.resume":"resumed","goal.action.set":"set","goal.evaluator":"evaluator judge","goal.line":"Goal on main · {status}","goal.none":"No goal on main.","goal.sent":"Goal {action} on main","goal.status.active":"active","goal.status.blocked":"blocked","goal.status.completed":"completed","goal.status.none":"no status","goal.status.paused":"paused ({reason})","goal.usage":"Usage: /goal [objective | set objective | edit objective | pause | resume | clear]","composer.command.models":"Choose a model","composer.command.new":"New session","composer.commandKeys":"↑↓ select · Enter confirm · Esc close","composer.command.permissions":"Show or change the session permissions","composer.permission.label":"Permissions","composer.permission.fileAccess":"File access","composer.permission.file.read-only":"Read only","composer.permission.file.workspace-read-write":"Workspace read/write","composer.permission.file.unrestricted":"Unrestricted","composer.permission.fileDescription.read-only":"Deny file writes, including granted paths.","composer.permission.fileDescription.workspace-read-write":"Write within the workspace; other paths need consent.","composer.permission.fileDescription.unrestricted":"No workspace path limit. Tool approval still applies.","composer.permission.toolApproval":"Tool approval","composer.permission.tool.ask":"Ask","composer.permission.tool.bypass":"Bypass","composer.permission.toolDescription.ask":"Ask for each call unless a tool or command allow answers it. Explicit denies still win.","composer.permission.toolDescription.bypass":"Skip tool questions, not file checks or explicit denies.","composer.permission.legacy":"Legacy tool policy","composer.permission.legacy.read-only":"Legacy read-only: allow read/session risks; deny process, network and other risks, subject to explicit tool and command rules. Not explicit Ask.","composer.permission.legacy.workspace-write":"Legacy workspace-write: allow read/session risks and workspace writes; ask for other risks, subject to explicit tool and command rules. Not explicit Ask.","composer.permission.unrestrictedConfirm":"Remove the workspace path limit? Tool approval and process isolation stay unchanged.","composer.permission.bypassConfirm":"Skip tool questions? File checks, explicit denies and process isolation still apply.","composer.permission.allowedTools":"Allowed tools","composer.permission.disallowedTools":"Denied tools","composer.permission.independent":"These choices do not change process isolation. File access is a tool gate, not an OS sandbox.","composer.permission.processIsolation":"Process isolation settings","permission.conflict":"The permissions changed elsewhere. The current setting is shown.","timeline.rail":"Messages","composer.files":"Files","composer.mentionKeys":"↑↓ select · Enter insert · Esc close","composer.imageAttachment":"Attached image","composer.imageLimit":"A message takes up to 20 images.","question.selectMany":"Choose one or more","composer.imageReadFailed":"This image could not be read.","composer.onlyImages":"Only images can be attached here yet.","composer.pastedText":"Pasted text · {lines} lines","composer.pasteTooLarge":"This paste is larger than 10 MB.","composer.removeAttachment":"Remove attachment","composer.commands":"Commands","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","lines.afterMessage":"after message {count}","lines.atEnd":"at the end of the line","lines.beforeMessage":"before “{message}”","lines.closePanel":"Close lines panel","lines.closeTab":"Close line tab","lines.collapse":"Restore panel width","lines.create":"Create line","lines.empty":"This line has no messages yet.","lines.emptyHint":"Branch from a message to work in parallel.","lines.emptyTitle":"No lines yet","lines.end":"End","lines.endDescription":"The line stops and becomes read-only. This cannot be undone.","lines.endLine":"End line {name}","lines.endTitle":"End line “{name}”?","lines.expand":"Expand panel","lines.from":"from {name}","lines.lineAria":"Line {name}","lines.loadFailed":"Could not load this line.","lines.main":"main","lines.mainHint":"the session itself","lines.newChild":"New child line","lines.newLine":"New line","lines.newLineFrom":"From {name}","lines.newLineTitle":"New line","lines.noFinishedTurn":"No finished turn to cut at yet","lines.open":"Open lines","lines.openLine":"Open line {name}","lines.panelAria":"Session lines","lines.placeholder":"Message this line…","lines.promptLabel":"Opening message","lines.promptPlaceholder":"What should this line do?","lines.promptRequired":"Write the line's opening message.","lines.readOnly":"This line is read-only.","lines.resize":"Resize lines panel","lines.retry":"Retry","lines.state.creationFailed":"creation failed","lines.state.endedByOperation":"ended by an operation","lines.state.endedItself":"ended itself","lines.state.endedWith":"ended with {id}","lines.state.main":"the session itself","lines.state.waiting":"waiting","lines.state.working":"working","lines.title":"Lines","message.branch":"Branch from here","message.collapse":"Collapse message","message.copy":"Copy entire message","message.expand":"Show full message","message.quote":"Quote in the composer","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.allowAlways":"Always allow","prompt.allowSession":"Allow for this session","question.awaitingAnswer":"Awaiting answer","question.decline":"Decline","question.failed":"Failed to send the answer","question.notPending":"This question is no longer waiting for an answer. Send again once the run continues.","question.other":"Other answer","question.otherPlaceholder":"Type your own answer","question.sent":"Answer sent","question.submit":"Send answers","question.title":"Dim has a question","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.beforeMessage":"before “{message}”","timeline.copied":"Copied","timeline.copy":"Copy","timeline.final":"final","timeline.fromLine":"◂ from {id}","timeline.lineEnded":"◂ {id} ended","timeline.lineEndedByOperation":"This line ended (an operation)","timeline.lineEndedItself":"This line ended (itself)","timeline.lineEndedWith":"This line ended (with {id})","timeline.lineWaiting":"◂ {id} is waiting ({status})","timeline.noticeStopped":"Stopped","timeline.scrollToBottom":"Scroll to bottom","timeline.steer":"(steer)","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"},$i=()=>Se(()=>import("./zh-CN-DtOnK_oD.js"),[]),ft=xn({legacy:!1,locale:"en",fallbackLocale:"en",messages:{en:Ii}});function xi(s){return s.toLowerCase().startsWith("zh")?"zh-CN":"en"}async function nn(s){const t=xi(s);t==="zh-CN"&&!ft.global.availableLocales.includes(t)&&ft.global.setLocaleMessage(t,(await $i()).default),ft.global.locale.value=t}function Si(s,t){return ft.global.t(s,{})}const xs="dim-web.appearance.v1",on=ut("appearance",()=>{const s=A("system"),t=A(14),e=A(""),n=A("");try{const l=JSON.parse(localStorage.getItem(xs)??"null");if(l!==null&&typeof l=="object"&&!Array.isArray(l)){const h=l;(h.theme==="light"||h.theme==="dark"||h.theme==="system")&&(s.value=h.theme),typeof h.fontSize=="number"&&[12,13,14,15,16,18].includes(h.fontSize)&&(t.value=h.fontSize),(h.language==="en"||h.language==="zh-CN")&&(e.value=h.language)}}catch{n.value="Browser appearance preferences could not be read."}const o=matchMedia("(prefers-color-scheme: dark)");function i(){document.documentElement.classList.toggle("dark",s.value==="dark"||s.value==="system"&&o.matches),document.documentElement.style.setProperty("--ui-font-size",String(t.value))}i(),o.addEventListener("change",i),ye([s,t,e],()=>{i(),n.value="";try{localStorage.setItem(xs,JSON.stringify({theme:s.value,fontSize:t.value,language:e.value}))}catch{n.value="Browser storage is unavailable. Appearance changes will not survive a reload."}},{flush:"sync"});async function r(l){try{await nn(l||navigator.language),e.value=l}catch{n.value="The selected language could not be loaded."}}return{theme:s,fontSize:t,language:e,selectLanguage:r,error:n}}),an="dim-web.ui.v1",rn=320,ln=720;function Ci(){const s={sidebarCollapsed:!1,collapsedWorkspaces:[],lastSessionId:void 0,detailOpen:!1,detailWidth:420};try{const t=JSON.parse(localStorage.getItem(an)??"null");if(t===null||typeof t!="object")return s;const e=t,n=typeof e.detailWidth=="number"&&Number.isFinite(e.detailWidth)?Math.min(ln,Math.max(rn,e.detailWidth)):s.detailWidth;return{sidebarCollapsed:e.sidebarCollapsed===!0,collapsedWorkspaces:Array.isArray(e.collapsedWorkspaces)?e.collapsedWorkspaces.filter(o=>typeof o=="string"):[],lastSessionId:typeof e.lastSessionId=="string"?e.lastSessionId:void 0,detailOpen:e.detailOpen===!0,detailWidth:n}}catch{return s}}const ze=ut("ui",()=>{const s=Ci(),t=A(s.sidebarCollapsed),e=A(s.collapsedWorkspaces),n=A(s.lastSessionId),o=A(!1),i=A(typeof window<"u"&&window.innerWidth>0?window.innerWidth:1200),r=C(()=>i.value<720?"compact":i.value<960?"regular":"wide"),l=A(s.detailOpen),h=A(s.detailWidth),w=A(!1),f=A(!1),v=A({}),b=A({}),T=A(),$=A();ye([t,e,n,l,h],()=>{try{localStorage.setItem(an,JSON.stringify({sidebarCollapsed:t.value,collapsedWorkspaces:e.value,lastSessionId:n.value,detailOpen:l.value,detailWidth:h.value}))}catch{}},{deep:!0}),on();function y(B){i.value=B,r.value!=="compact"&&(o.value=!1)}function _(B){return!e.value.includes(B)}function I(B){e.value=_(B)?[...e.value,B]:e.value.filter(re=>re!==B)}function O(B){h.value=Math.min(ln,Math.max(rn,Math.round(B)))}function D(B){l.value=!0,f.value=!0,b.value={...b.value,[B]:void 0}}function F(B){l.value&&b.value[B]===void 0?(l.value=!1,f.value=!1):D(B)}function q(B,re){const W=v.value[B]??[];W.includes(re)||(v.value={...v.value,[B]:[...W,re]}),b.value={...b.value,[B]:re},l.value=!0,f.value=!0}function z(B,re){if(!(v.value[B]??[]).includes(re)){q(B,re);return}b.value={...b.value,[B]:re},l.value=!0,f.value=!0}function x(B,re){const W=(v.value[B]??[]).filter(te=>te!==re);v.value={...v.value,[B]:W},b.value[B]===re&&(b.value={...b.value,[B]:W.at(-1)})}function R(){l.value=!1,w.value=!1,f.value=!1}function j(B,re,W){return yi(W,{detailOpen:l.value,detailExpanded:w.value,shellWidth:i.value,activeLine:b.value[B],detailFocused:f.value})===re}function P(B){T.value=B}function G(){T.value=void 0}function X(B){$.value=B}function ne(){$.value=void 0}function H(B){var re,W;v.value={...v.value,[B]:[]},b.value={...b.value,[B]:void 0},((re=T.value)==null?void 0:re.sessionId)===B&&(T.value=void 0),((W=$.value)==null?void 0:W.sessionId)===B&&($.value=void 0),l.value&&(l.value=!1),f.value=!1}return{sidebarCollapsed:t,lastSessionId:n,drawerOpen:o,shellWidth:i,shellMode:r,setShellWidth:y,isWorkspaceExpanded:_,toggleWorkspace:I,detailOpen:l,detailWidth:h,detailExpanded:w,detailFocused:f,lineTabs:v,activeLineTab:b,newLine:T,endingLine:$,setDetailWidth:O,openLines:D,toggleLines:F,openLine:q,activateLine:z,closeLineTab:x,closeDetail:R,approvalKeyboard:j,requestNewLine:P,closeNewLine:G,requestEndLine:X,closeEndLine:ne,resetSessionTabs:H}}),Mi=256,Ti=6e4,Ei=16;function Ss(){return{projection:new ni,syncing:!1,done:!1,error:"",queued:[]}}function Ai(){return{running:!1,stopping:!1}}const Pe=ut("chat",()=>{const s=us({}),t=new Map;let e;function n(){return Ee().client}function o(g){if(t.has(g))return;const k=Re().byId.get(g),p=us({sessionId:g,status:"loading",error:"",rows:[],running:(k==null?void 0:k.running)??!1,stopping:!1,sessionRunning:(k==null?void 0:k.running)??!1,approvals:[],questions:[],methods:[],permission:void 0,goal:void 0,queued:[],model:k==null?void 0:k.model,lines:[],branches:{},lastTurnEnd:void 0}),S={view:p,main:Ss(),branches:new Map,lines:new ui,states:new Map,syncing:!1,queued:[],historyQueue:[],historyRunning:!1,publishTimer:void 0};t.set(g,S),s[g]=p,r(S)}function i(){for(const g of t.values())g.view.status!=="closed"&&r(g)}async function r(g){if(g.syncing)return;const{view:k}=g;g.syncing=!0,g.queued=[],k.approvals=[],g.main.syncing=!0,g.main.done=!1,g.main.error="",g.main.queued=[];for(const[p,S]of g.branches)S.syncing=!0,S.done=!1,S.error="",S.queued=[],g.historyQueue.includes(p)||g.historyQueue.push(p);try{await n().call("session.attach",{sessionId:k.sessionId},Xe),k.methods=await B(k.sessionId);const p=await v(g,oe);if(p!=="ok"){p==="failed"&&k.status!=="closed"&&(k.status="failed",k.error=g.main.error);return}const S=g.queued;g.queued=[],g.syncing=!1;for(const U of S)l(U);k.status!=="closed"&&(k.permission=await Te(k.sessionId)),k.status!=="closed"&&(k.status="ready",k.error=""),O(g),k.status!=="closed"&&T(g)}catch(p){p instanceof Ze&&p.appError==="session_closed"?k.status="closed":p instanceof _t||(k.status="failed",k.error=p instanceof Error?p.message:String(p))}finally{g.syncing=!1,g.main.syncing=!1,g.queued=[],O(g)}}function l(g){const k=g.method==="session.model.progress"?g.progress.sessionId:g.method==="approval.request"?g.request.sessionId:g.sessionId,p=t.get(k);if(p!==void 0){if(p.syncing){p.queued.push(g);return}h(p,g)}}function h(g,k){const p=g.view;switch(k.method){case"session.event":{const S=k.branchId,U=f(g,S);U.syncing?(g.lines.apply(S,k.event),U.queued.push(k.event)):w(g,S,k.event);break}case"session.model.progress":{const S=k.progress.branchId,U=f(g,S);if(U.syncing)break;U.projection.progress(k.progress),I(g);break}case"session.state":{k.branchId===oe&&p.running&&!k.running&&D(),g.states.set(k.branchId,{running:k.running,stopping:k.stopping}),g.lines.setRunning(k.branchId,k.running),k.branchId!==oe&&f(g,k.branchId);const S=_(g);p.running=y(g,oe).running,p.stopping=y(g,oe).stopping,p.sessionRunning=S,Re().setRunning(p.sessionId,S),I(g);break}case"approval.request":p.approvals.some(S=>S.requestId===k.request.requestId&&S.branchId===k.request.branchId)||(p.approvals=[...p.approvals,k.request]);break;case"approval.resolved":case"approval.cancelled":p.approvals.some(S=>S.branchId===k.branchId&&S.requestId===k.requestId)&&F(p,k.branchId,k.requestId);break;case"memberApprovalEnded":{const S=p.approvals.filter(U=>U.branchId===k.branchId&&U.call.name==="member_approval_allow"&&U.call.input.approvalId===k.approvalId);for(const U of S)F(p,U.branchId,U.requestId),G(p.sessionId,U,"deny").catch(()=>{});break}case"session.closed":p.status="closed",p.running=!1,p.stopping=!1,p.sessionRunning=!1,p.approvals=[],p.questions=[],Re().forget(p.sessionId),ze().resetSessionTabs(p.sessionId);break}}function w(g,k,p){g.lines.apply(k,p),f(g,k).projection.apply(p)&&(p.content.kind==="branch-create"&&f(g,p.content.branchId),k===oe&&p.content.kind==="permission-changed"&&(g.view.permission=p.content.policy),I(g))}function f(g,k){if(k===oe)return g.main;let p=g.branches.get(k);return p===void 0&&(p=Ss(),p.syncing=!0,g.branches.set(k,p),g.historyQueue.includes(k)||g.historyQueue.push(k),g.syncing||T(g),I(g)),p}async function v(g,k){const p=k===oe?g.main:g.branches.get(k);if(p===void 0)return"failed";p.syncing=!0,p.error="",p.done=!1;let S=p.projection.cursor,U;for(let Z=0;;Z++)try{for(;;){const le=await n().call("session.history",{sessionId:g.view.sessionId,branchId:k,after:S,limit:Mi,...U===void 0?{}:{through:U}},bo,Ti);if(U!==void 0&&le.through!==U||le.nextAfter<S||le.nextAfter>le.through||!le.done&&le.nextAfter===S)throw new qe("Invalid history page cursor");U=le.through;for(const ot of le.events)g.lines.apply(k,ot),p.projection.apply(ot),ot.content.kind==="branch-create"&&f(g,ot.content.branchId);if(S=le.nextAfter,le.done)break}const ie=p.queued;p.queued=[];for(const le of ie)w(g,k,le);return p.done=!0,p.syncing=!1,I(g),"ok"}catch(ie){if(k!==oe&&Z<10&&b(ie)){await new Promise(le=>setTimeout(le,100));continue}return p.syncing=!1,ie instanceof _t?(p.done=!1,p.error="",I(g),"lost"):(p.done=!0,p.error=ie instanceof Error?ie.message:String(ie),ie instanceof Ze&&ie.appError==="session_closed"&&(g.view.status="closed"),I(g),"failed")}}function b(g){return g instanceof Ze&&(g.appError==="branch_missing"||g.appError==="unknown_branch"||g.message.startsWith("unknown branch"))}async function T(g){if(!(g.historyRunning||g.syncing)){g.historyRunning=!0;try{for(;g.historyQueue.length>0;){const k=g.historyQueue.shift();k===oe||!g.branches.has(k)||await v(g,k)}}finally{g.historyRunning=!1,O(g)}}}function $(g,k){const p=t.get(g);if(p===void 0||k===oe)return;const S=p.branches.get(k);S!==void 0&&(S.error="",S.done=!1,S.syncing=!0,p.historyQueue.includes(k)||p.historyQueue.push(k),O(p),T(p))}function y(g,k){return g.states.get(k)??Ai()}function _(g){if(y(g,oe).running)return!0;for(const k of g.branches.keys())if(y(g,k).running)return!0;return!1}function I(g){g.publishTimer??(g.publishTimer=setTimeout(()=>O(g),Ei))}function O(g){var U;clearTimeout(g.publishTimer),g.publishTimer=void 0;const k=g.view,p=y(g,oe);k.rows=g.main.projection.rows.slice(),k.lastTurnEnd=g.main.projection.lastTurnEnd,k.running=p.running,k.stopping=p.stopping,k.sessionRunning=_(g),k.model=g.main.projection.model??((U=Re().byId.get(k.sessionId))==null?void 0:U.model),k.lines=g.lines.views(),k.goal=g.main.projection.goal,k.queued=g.main.projection.queued(),k.questions=[...g.main.projection.waiting().map(Z=>({branchId:oe,...Z})),...[...g.branches].flatMap(([Z,ie])=>ie.projection.waiting().map(le=>({branchId:Z,...le})))];const S={};for(const[Z,ie]of g.branches){const le=y(g,Z);S[Z]={rows:ie.projection.rows.slice(),running:le.running,stopping:le.stopping,status:ie.error!==""?"failed":ie.done?"ready":"loading",error:ie.error,lastTurnEnd:ie.projection.lastTurnEnd}}k.branches=S}function D(){clearTimeout(e),e=setTimeout(()=>void Re().refresh(),500)}function F(g,k,p){g.approvals=g.approvals.filter(S=>S.branchId!==k||S.requestId!==p)}function q(g,k){const p=t.get(g);p!==void 0&&(k!==oe&&!p.lines.has(k)||(f(p,k),O(p)))}async function z(g,k,p,S={images:[],pastes:[]}){let U=p;for(const ie of S.pastes){const le=await n().call("attachment.put",{sessionId:g,text:ie},Io);U=`${U}${U===""?"":`
|
|
221
|
+
`}[Pasted text: ${le} (${ie.split(`
|
|
222
|
+
`).length} lines)]`}const Z={sessionId:g,branchId:k,submissionId:crypto.randomUUID(),mode:"queue"};S.images.length===0?Z.text=U:Z.user={content:[...U===""?[]:[{type:"text",text:U}],...S.images]},await n().call("session.submit",Z,Xe)}async function x(g,k){await n().call("session.stop",{sessionId:g,branchId:k,reason:"Stopped from the web workspace"},Xe)}async function R(g,k,p,S){return(await n().call("session.branch_create",{sessionId:g,parentBranchId:k,at:p,prompt:S},go)).branchId}async function j(g,k){await n().call("session.branch_end",{sessionId:g,branchId:k},Xe)}async function P(g,k){return n().call("session.collaboration.approval.get",{sessionId:g,branchId:k.branchId,requestId:k.requestId},Fo)}async function G(g,k,p){await n().call("approval.respond",{sessionId:g,branchId:k.branchId,requestId:k.requestId,decision:p},Xe);const S=s[g];S!==void 0&&F(S,k.branchId,k.requestId)}async function X(g,k){const p=Qs(k);if(p===void 0)throw new Error("This approval has no simple command to allow");const S=Go(p),U=await n().call("permission.rules",{},vi);U.commandRules.some(Z=>Qo(Z,S))||await n().call("permission.set_rules",{expectedRevision:U.revision,commandRules:[...U.commandRules,S]},fi),await G(g,k,"allow")}async function ne(g,k){const p=Js(k);if(p===void 0)throw new Error("This approval names no file to allow");await n().call("session.grants.add",{sessionId:g,...p},Xe),await G(g,k,"allow")}async function H(g,k,p){await n().call("session.question.respond",{sessionId:g,branchId:k.branchId,requestId:k.requestId,callId:k.callId,...p===void 0?{declined:!0}:{answers:p}},Xe)}async function B(g){return Ee().supports("session.methods")?n().call("session.methods",{sessionId:g},po).catch(()=>[]):[]}async function re(g){return n().call("session.context.compact",{sessionId:g,branchId:oe},ho)}async function W(g,k,p){await n().call(`session.goal.${k}`,{sessionId:g,branchId:oe,...p===void 0?{}:{objective:p}},Xe)}async function te(g){return n().call("session.context.usage",{sessionId:g,branchId:oe},mo)}async function Oe(g,k){return n().call("session.fork",{sessionId:g,at:k},vo)}async function be(g,k){return n().call("session.files.search",{sessionId:g,query:k,limit:20},_o)}async function De(g,k,p){return n().call("session.input.withdraw",{sessionId:g,branchId:oe,inputId:k,...p===void 0?{}:{steer:p}},Ao)}async function Te(g){if(Ee().supports("session.permission.get"))return n().call("session.permission.get",{sessionId:g,branchId:oe},bs).then(k=>k.policy,()=>{})}async function We(g,k){const p=await n().call("session.permission.get",{sessionId:g,branchId:oe},bs),S=s[g];if(S!==void 0&&(S.permission=p.policy),p.policy[k.field]===k.value)return"unchanged";const U={...p.policy,[k.field]:k.value};try{await n().call("session.permission.update",{sessionId:g,branchId:oe,expectedVersion:p.version,policy:U},ko)}catch(Z){if(Z instanceof Ze&&Z.appError==="permission_conflict")return S!==void 0&&(S.permission=await Te(g)),"conflict";throw Z}return S!==void 0&&(S.permission=U),"updated"}async function ht(g,k){return n().call("session.model.update",{sessionId:g,branchId:oe,modelPreferences:{reasoningEffort:k}},$o)}async function Fe(g,k){const p=await n().call("session.model.update",{sessionId:g,branchId:oe,providerId:k.providerId,modelId:k.modelId},yo),S=t.get(g);S!==void 0&&(S.main.projection.model=p.model,O(S))}return{views:s,open:o,resync:i,receive:l,ensureLine:q,retryLine:$,submit:z,stop:x,createLine:R,endLine:j,respond:G,allowAlways:X,allowForSession:ne,answerQuestion:H,compact:re,usage:te,fork:Oe,writeGoal:W,setEffort:ht,setPermission:We,withdrawInput:De,searchFiles:be,memberApproval:P,setModel:Fe}}),Li=4e3,gt=ut("toast",()=>{const s=A([]),t=new Map;let e=0;function n(l){clearTimeout(t.get(l)),t.delete(l),s.value=s.value.filter(h=>h.id!==l)}function o(l){clearTimeout(t.get(l)),t.set(l,setTimeout(()=>n(l),Li))}function i(l){clearTimeout(t.get(l)),t.delete(l)}function r(l){const h=++e,w=[...s.value,{...l,id:h}];for(const f of w.slice(0,-3))i(f.id);s.value=w.slice(-3),o(h)}return{toasts:s,push:r,dismiss:n,pause:i,resume:o}}),Ee=ut("connection",()=>{const s=A("connecting"),t=Gt(),e=A(!1),n=new Vo({phase(i){s.value=i},ready(i,r){t.value=i,e.value=!0,Re().refresh(),r&&Pe().resync()},notification(i){Pe().receive(i)},invalid(i){console.error(i),gt().push({tone:"danger",title:Si("connection.protocolError"),description:i.message})}});function o(i){var r;return((r=t.value)==null?void 0:r.features.includes(i))??!1}return{phase:s,hello:t,everConnected:e,client:n,supports:o}}),qi=["data-state"],Oi=ve({__name:"ConnectionBadge",setup(s){const t=Ee(),{t:e}=pe(),n=C(()=>({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(),u("div",{class:"connection-badge","aria-live":"polite","data-state":a(t).phase},[a(t).phase==="connected"?(c(),se(a(ao),{key:0,size:14,"aria-hidden":"true"})):(c(),se(a(io),{key:1,size:14,"aria-hidden":"true"})),d("span",null,[d("strong",null,m(n.value),1),d("small",null,m(a(e)("connection.host")),1)])],8,qi))}}),Ri=1440*60*1e3;function Cs(s){const t=new Date(s);return t.setHours(0,0,0,0),t.getTime()}function Pi(s,t,e=new Date){const n=new Intl.DateTimeFormat(t,{hour:"2-digit",minute:"2-digit",hour12:!1}).format(s);return Cs(e)-Cs(s)<7*Ri?`${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 zi(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 Di(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 Fi={class:"workspace-group"},ji=["aria-expanded","aria-label"],Wi={class:"workspace-disclosure","aria-hidden":"true"},Ni=["data-open"],Bi={class:"workspace-disclosure-icon"},Vi=["title"],Ui={key:0,class:"workspace-running","aria-hidden":"true"},Hi={key:0,class:"session-list"},Ki=["data-state"],Gi={key:0},jt=5,Qi=20,Ji=ve({__name:"SidebarWorkspaceGroup",props:{workspace:{},expanded:{type:Boolean},activeSessionId:{},nowMs:{}},emits:["toggle","navigate"],setup(s,{emit:t}){const e=s,n=t,{t:o}=pe(),i=A(jt),r=C(()=>e.workspace.sessions.slice(0,i.value)),l=C(()=>e.workspace.sessions.length>i.value),h=C(()=>!e.expanded&&e.workspace.sessions.some(f=>f.running));function w(){i.value=l.value?i.value+Qi:jt}return(f,v)=>{const b=st("tooltip");return c(),u("section",Fi,[d("div",{class:"workspace-row",onClick:v[3]||(v[3]=T=>n("toggle"))},[d("button",{class:"workspace-toggle",type:"button","aria-expanded":s.expanded,"aria-label":a(o)(s.expanded?"sidebar.collapseWorkspace":"sidebar.expandWorkspace",{name:s.workspace.name}),onClick:v[0]||(v[0]=ke(T=>n("toggle"),["stop"]))},[d("span",Wi,[d("span",{class:"workspace-disclosure-chevron","data-open":s.expanded?"true":void 0},[K(a(Tt),{size:14})],8,Ni),d("span",Bi,[s.expanded?(c(),se(a(Vn),{key:0,size:14})):(c(),se(a(Ut),{key:1,size:14}))])]),d("strong",{title:s.workspace.cwd},m(s.workspace.name),9,Vi)],8,ji),h.value?(c(),u("span",Ui,[K(a(qt),{size:14,class:"is-spinning"})])):L("",!0),d("div",{class:"workspace-row-actions",onClick:v[2]||(v[2]=ke(()=>{},["stop"]))},[$e((c(),se(a(at),{class:"ui-icon-button workspace-add","data-variant":"ghost","data-size":"sm",to:{name:"chat-new",query:{cwd:s.workspace.cwd}},"aria-label":a(o)("sidebar.newInWorkspace",{name:s.workspace.name}),onClick:v[1]||(v[1]=T=>n("navigate"))},{default:je(()=>[K(a(Jt),{"aria-hidden":"true"})]),_:1},8,["to","aria-label"])),[[b,a(o)("sidebar.newInWorkspace",{name:s.workspace.name})]])])]),s.expanded?(c(),u("ul",Hi,[(c(!0),u(ee,null,ue(r.value,T=>(c(),u("li",{key:T.sessionId},[K(a(at),{class:"session-open",to:{name:"chat-session",params:{sessionId:T.sessionId}},"data-open":T.sessionId===s.activeSessionId?"true":void 0,"aria-current":T.sessionId===s.activeSessionId?"page":void 0,title:T.preview,onClick:v[4]||(v[4]=$=>n("navigate"))},{default:je(()=>[d("span",{class:"status-dot","data-state":T.running?"running":"idle","aria-hidden":"true"},null,8,Ki),d("strong",null,m(T.preview??a(o)("sidebar.untitled")),1),d("small",null,m(a(zi)(new Date(T.updatedAt),s.nowMs)),1)]),_:2},1032,["to","data-open","aria-current","title"])]))),128)),s.workspace.sessions.length>jt?(c(),u("li",Gi,[d("button",{class:"ui-button reveal-more","data-variant":"ghost","data-size":"sm",type:"button",onClick:w},[K(a(Tt),{"data-open":l.value?void 0:"true","aria-hidden":"true"},null,8,["data-open"]),fe(" "+m(a(o)(l.value?"sidebar.showMore":"sidebar.showLess")),1)])])):L("",!0)])):L("",!0)])}}}),Yi=xe(Ji,[["__scopeId","data-v-883a0b20"]]),Xi=["aria-label"],Zi={class:"brand-row"},ea={class:"brand-copy"},ta=["aria-label"],sa=["aria-label"],na={class:"sidebar-new-label"},oa={class:"ui-field-wrap sidebar-search"},ia=["placeholder","aria-label"],aa={class:"workspace-scroll app-scroll-viewport"},ra={class:"section-label"},la={key:0,class:"sidebar-empty",role:"alert"},ca={key:1,class:"sidebar-empty"},da={class:"sidebar-footer"},ua=ve({__name:"AppSidebar",emits:["navigate"],setup(s){const{t}=pe(),{t:e}=pe({messages:Xt}),n=At(),o=Re(),i=ze(),r=A(""),l=A(Date.now());let h;Ue(()=>{h=setInterval(()=>{l.value=Date.now()},6e4)}),pt(()=>clearInterval(h));const w=C(()=>typeof n.params.sessionId=="string"?n.params.sessionId:void 0),f=C(()=>{var $;return w.value===void 0||($=o.byId.get(w.value))==null?void 0:$.cwd}),v=C(()=>({name:"chat-new",...f.value===void 0?{}:{query:{cwd:f.value}}})),b=C(()=>r.value.trim().toLocaleLowerCase()),T=C(()=>o.workspaces.flatMap($=>{if(b.value==="")return[$];const _=$.name.toLocaleLowerCase().includes(b.value)||$.cwd.toLocaleLowerCase().includes(b.value)?$.sessions:$.sessions.filter(I=>{var O;return(O=I.preview)==null?void 0:O.toLocaleLowerCase().includes(b.value)});return _.length===0?[]:[{...$,sessions:_}]}));return($,y)=>(c(),u("aside",{class:"app-sidebar","aria-label":a(t)("a11y.workspaceSessionIndex")},[d("header",Zi,[K(Ot,{class:"brand-logo"}),d("strong",ea,m(a(t)("brand.product")),1),d("button",{class:"ui-icon-button sidebar-collapse","data-variant":"ghost","data-size":"sm",type:"button","aria-label":a(t)("sidebar.closeMenu"),onClick:y[0]||(y[0]=_=>a(i).sidebarCollapsed=!0)},[K(a(Jn),{"aria-hidden":"true"})],8,ta)]),d("nav",{class:"primary-actions","aria-label":a(t)("a11y.primaryNavigation")},[K(a(at),{class:"ui-button sidebar-new","data-variant":"secondary","data-size":"md",to:v.value,onClick:y[1]||(y[1]=_=>$.$emit("navigate"))},{default:je(()=>[K(a(Jt),{"aria-hidden":"true"}),d("span",na,m(a(t)("sidebar.newSession")),1)]),_:1},8,["to"])],8,sa),d("div",oa,[K(a(Yt),{"aria-hidden":"true"}),$e(d("input",{"onUpdate:modelValue":y[2]||(y[2]=_=>r.value=_),class:"ui-field","data-size":"md",type:"search",placeholder:a(t)("sidebar.searchPlaceholder"),"aria-label":a(t)("common.search")},null,8,ia),[[$t,r.value]])]),d("div",aa,[d("p",ra,m(a(t)("sidebar.workspaces")),1),a(o).error&&!a(o).loaded?(c(),u("p",la,m(a(o).error),1)):a(o).loaded&&T.value.length===0?(c(),u("p",ca,m(a(t)(b.value?"sidebar.noMatches":"sidebar.noWorkspaces")),1)):L("",!0),(c(!0),u(ee,null,ue(T.value,_=>(c(),se(Yi,{key:_.cwd,workspace:_,expanded:b.value!==""||a(i).isWorkspaceExpanded(_.cwd),"active-session-id":w.value,"now-ms":l.value,onToggle:I=>a(i).toggleWorkspace(_.cwd),onNavigate:y[3]||(y[3]=I=>$.$emit("navigate"))},null,8,["workspace","expanded","active-session-id","now-ms","onToggle"]))),128))]),d("footer",da,[K(a(at),{class:"ui-button","data-variant":"ghost","data-size":"md",to:"/settings",onClick:y[4]||(y[4]=_=>$.$emit("navigate"))},{default:je(()=>[K(a(eo),{"aria-hidden":"true"}),fe(m(a(e)("settings")),1)]),_:1}),K(Oi)])],8,Xi))}}),Ms=xe(ua,[["__scopeId","data-v-c6b17db1"]]),pa=["role","onMouseenter","onMouseleave","onFocusin","onFocusout"],ha=["data-tone"],ma={class:"ui-toast-title"},va={key:0,class:"ui-toast-description"},fa=["onClick"],ga=["aria-label","onClick"],ba=ve({__name:"ToastRegion",setup(s){const{t}=pe(),e=gt();function n(o){var i;e.dismiss(o.id),(i=o.action)==null||i.run()}return(o,i)=>(c(),se(Sn,{name:"ui-toast",tag:"div",class:"ui-toast-region","aria-live":"polite"},{default:je(()=>[(c(!0),u(ee,null,ue(a(e).toasts,r=>(c(),u("div",{key:r.id,class:"ui-toast",role:r.tone==="danger"?"alert":"status",onMouseenter:l=>a(e).pause(r.id),onMouseleave:l=>a(e).resume(r.id),onFocusin:l=>a(e).pause(r.id),onFocusout:l=>a(e).resume(r.id)},[d("span",{class:"ui-toast-icon","data-tone":r.tone},[r.tone==="danger"?(c(),se(a(lt),{key:0,"aria-hidden":"true"})):r.tone==="info"?(c(),se(a(Hn),{key:1,"aria-hidden":"true"})):(c(),se(a(rt),{key:2,"aria-hidden":"true"}))],8,ha),d("div",null,[d("p",ma,m(r.title),1),r.description?(c(),u("p",va,m(r.description),1)):L("",!0)]),r.action?(c(),u("button",{key:0,type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:l=>n(r)},m(r.action.label),9,fa)):(c(),u("button",{key:1,type:"button",class:"ui-icon-button","data-variant":"close","data-size":"xs","aria-label":a(t)("common.close"),onClick:l=>a(e).dismiss(r.id)},[K(a(lt),{"aria-hidden":"true"})],8,ga))],40,pa))),128))]),_:1}))}}),ya={key:0},wa={class:"ui-dialog-header"},ka={class:"ui-dialog-icon","data-tone":"danger"},_a={class:"ui-dialog-title"},Ia={class:"ui-dialog-description"},$a=["aria-label"],xa={key:0,class:"ui-banner","data-tone":"danger",role:"alert"},Sa={class:"ui-dialog-footer"},Ca=["disabled"],Ma=["disabled"],Ta=ve({__name:"EndLineDialog",setup(s){const{t}=pe(),e=Pe(),n=ze(),o=A(),i=A(""),r=A(!1),l=C(()=>n.endingLine);Ue(()=>{var f;return(f=o.value)==null?void 0:f.showModal()});function h(){var f;(f=o.value)==null||f.close()}async function w(){const f=l.value;if(!(f===void 0||r.value)){r.value=!0,i.value="";try{await e.endLine(f.sessionId,f.branchId),h()}catch(v){i.value=v instanceof Error?v.message:String(v)}finally{r.value=!1}}}return(f,v)=>(c(),u("dialog",{ref_key:"dialog",ref:o,class:"ui-dialog",onCancel:ke(h,["prevent"]),onClose:v[0]||(v[0]=b=>a(n).closeEndLine())},[l.value?(c(),u("div",ya,[d("header",wa,[d("span",ka,[K(a(nt),{size:16,"aria-hidden":"true"})]),d("div",null,[d("h2",_a,m(a(t)("lines.endTitle",{name:l.value.purpose})),1),d("p",Ia,m(a(t)("lines.endDescription")),1)]),d("button",{type:"button",class:"ui-icon-button ui-dialog-close","data-variant":"close","data-size":"sm","aria-label":a(t)("common.close"),onClick:h},[...v[1]||(v[1]=[d("span",{"aria-hidden":"true"},"×",-1)])],8,$a)]),i.value?(c(),u("p",xa,m(i.value),1)):L("",!0),d("footer",Sa,[d("button",{type:"button",class:"ui-button","data-variant":"ghost","data-size":"md",disabled:r.value,onClick:h},m(a(t)("common.cancel")),9,Ca),d("button",{type:"button",class:"ui-button","data-variant":"danger","data-size":"md",disabled:r.value,onClick:w},m(a(t)("lines.end")),9,Ma)])])):L("",!0)],544))}}),Ts={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 Ea(s){const t=s.trim().toLowerCase();return t.split(/(?:__|[./\s:-])+/).filter(Boolean).at(-1)??t}function ss(s,t){const e=s.trim().toLowerCase();if(e.startsWith("mcp__"))return{renderer:"generic",labelKey:"prompt.useTool"};const n=Ea(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":Ts[n]??"tool.grep"}}return["read","read_file","write","write_file","edit","edit_file","apply_patch"].includes(n)?{renderer:"file",labelKey:Ts[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 cn(s,t){if(t!==void 0)return t.split(`
|
|
223
|
+
`).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(`
|
|
224
|
+
`).map(o=>({sign:"-",text:o})),...n.split(`
|
|
225
|
+
`).map(o=>({sign:"+",text:o}))]}const Aa={class:"prompt-card","data-inline-interaction-prompt":""},La={class:"prompt-header"},qa={class:"prompt-icon","aria-hidden":"true"},Oa={class:"prompt-title"},Ra={class:"ui-badge","data-tone":"warning"},Pa={key:0,class:"prompt-subtitle"},za={key:1,class:"approval-panel"},Da={class:"approval-panel-header"},Fa={class:"approval-panel-body"},ja={key:1},Wa={key:2,class:"approval-command"},Na={key:0,class:"approval-muted"},Ba={key:3,class:"approval-panel"},Va={class:"approval-panel-header"},Ua={key:0,class:"approval-panel-body"},Ha={key:1,class:"approval-panel-body"},Ka={class:"approval-line-number"},Ga={key:4,class:"approval-panel"},Qa={class:"approval-panel-header"},Ja={class:"approval-panel-body"},Ya={key:0},Xa={key:1},Za={key:2},er={key:3,class:"approval-muted"},tr={key:5,class:"approval-panel"},sr={class:"approval-panel-header is-mono"},nr={class:"approval-panel-body"},or={key:6,class:"approval-panel"},ir={class:"approval-panel-body approval-muted"},ar={key:7,class:"prompt-error",role:"alert"},rr={class:"prompt-buttons"},lr=["disabled"],cr=["disabled"],dr=["disabled"],ur=["disabled"],pr=["disabled"],dn=ve({__name:"ApprovalPrompt",props:{sessionId:{},request:{},keyboard:{type:Boolean},rulesAvailable:{type:Boolean}},setup(s){const t=s,{t:e}=pe(),n=Pe(),o=A(!1),i=A(""),r=C(()=>t.request.call.name==="member_approval_allow"),l=C(()=>!r.value&&Js(t.request)!==void 0),h=C(()=>!r.value&&t.rulesAvailable===!0&&Qs(t.request)!==void 0),w=A(),f=A(!1),v=A(!0);async function b(){f.value=!0,i.value="";try{const G=await n.memberApproval(t.sessionId,t.request);return G.state==="ended"?(await n.respond(t.sessionId,t.request,"deny"),!1):(w.value=G.descriptor,!0)}catch(G){return w.value=void 0,v.value=!(G instanceof Ze&&G.code===-32601),i.value=G instanceof Error?G.message:"Cannot review member action",!1}finally{f.value=!1}}const T=C(()=>{var G;return((G=w.value)==null?void 0:G.call)??t.request.call}),$=C(()=>T.value.input),y=C(()=>ss(T.value.name,$.value)),_={command:no,search:Yt,file:Bn,web:Un,generic:ro};function I(G){const X=$.value[G];return typeof X=="string"&&X.trim()!==""?X:void 0}const O=C(()=>T.value.name.trim().toLowerCase()),D=C(()=>O.value==="edit"?cn($.value,void 0):[]),F=C(()=>O.value==="write"?I("content"):void 0),q=C(()=>Object.entries($.value).filter(([G])=>!["command","cwd","path","pattern","oldText","newText","content","query","url"].includes(G)).map(([G,X])=>({key:G,value:typeof X=="string"?X:JSON.stringify(X)})));async function z(G){if(!(o.value||G==="allow"&&r.value&&(f.value||w.value===void 0))){o.value=!0,i.value="";try{if(G==="allow"&&r.value&&!await b()){o.value=!1;return}G==="always"?await n.allowAlways(t.sessionId,t.request):G==="session"?await n.allowForSession(t.sessionId,t.request):await n.respond(t.sessionId,t.request,G)}catch(X){i.value=X instanceof Error&&X.message?X.message:e("prompt.permissionSubmitFailed"),o.value=!1}}}function x(G){const X=wi(G,{keyboard:t.keyboard,pending:o.value,dialogOpen:document.querySelector("dialog[open]")!==null});X!==void 0&&(G.preventDefault(),z(X))}let R=!1;function j(){R||t.keyboard===!1||(window.addEventListener("keydown",x),R=!0)}function P(){R&&(window.removeEventListener("keydown",x),R=!1)}return Ue(()=>{j(),r.value&&b()}),pt(P),ye(()=>t.keyboard,()=>t.keyboard===!1?P():j()),(G,X)=>(c(),u("article",Aa,[d("header",La,[d("span",qa,[(c(),se(Ns(_[y.value.renderer]),{size:12,"stroke-width":2.25}))]),d("h2",Oa,m(a(e)("prompt.actionRequest",{action:y.value.renderer==="generic"?s.request.call.name:a(e)(y.value.labelKey)})),1),d("span",Ra,m(a(e)("prompt.awaitingApproval")),1)]),s.request.reason?(c(),u("p",Pa,m(s.request.reason),1)):L("",!0),r.value?(c(),u("div",za,[d("div",Da,"Subagent tool approval · Leader branch: "+m(s.request.branchId),1),w.value?(c(),u(ee,{key:0},[d("p",null,"Member: "+m(w.value.member.agentId)+" · Session: "+m(w.value.member.sessionId)+" · Branch: "+m(w.value.member.branchId),1),d("p",null,m(w.value.call.name)+": "+m(w.value.reason),1),d("pre",Fa,m(JSON.stringify(w.value.call.input,null,2)),1)],64)):(c(),u("p",ja,m(f.value?"Loading member action...":"Cannot review member action"),1))])):y.value.renderer==="command"?(c(),u("div",Wa,[d("div",null,[X[5]||(X[5]=d("span",{class:"approval-muted"},"$",-1)),fe(" "+m(I("command")),1)]),I("cwd")?(c(),u("div",Na," cwd: "+m(I("cwd")),1)):L("",!0)])):y.value.renderer==="file"?(c(),u("div",Ba,[d("div",Va,m(I("path")??s.request.call.name),1),D.value.length?(c(),u("div",Ua,[(c(!0),u(ee,null,ue(D.value,(ne,H)=>(c(),u("div",{key:H,class:Ae(ne.sign==="-"?"approval-diff-del":"approval-diff-add")},m(ne.sign)+" "+m(ne.text),3))),128))])):F.value!==void 0?(c(),u("div",Ha,[(c(!0),u(ee,null,ue(F.value.split(`
|
|
226
|
+
`),(ne,H)=>(c(),u("div",{key:H,class:"approval-code-line"},[d("span",Ka,m(H+1),1),fe(m(ne),1)]))),128))])):L("",!0)])):y.value.renderer==="search"||y.value.renderer==="web"?(c(),u("div",Ga,[d("div",Qa,m(a(e)("prompt.input")),1),d("div",Ja,[I("pattern")?(c(),u("div",Ya,"pattern: "+m(I("pattern")),1)):L("",!0),I("query")?(c(),u("div",Xa,"query: "+m(I("query")),1)):L("",!0),I("url")?(c(),u("div",Za,"url: "+m(I("url")),1)):L("",!0),I("path")?(c(),u("div",er,"path: "+m(I("path")),1)):L("",!0)])])):(c(),u("div",tr,[d("div",sr,m(s.request.call.name),1),d("pre",nr,m(JSON.stringify($.value,null,2)),1)])),!r.value&&y.value.renderer!=="generic"&&q.value.length?(c(),u("div",or,[d("div",ir,[(c(!0),u(ee,null,ue(q.value,ne=>(c(),u("div",{key:ne.key},m(ne.key)+": "+m(ne.value),1))),128))])])):L("",!0),i.value?(c(),u("p",ar,m(i.value),1)):L("",!0),d("div",rr,[d("button",{type:"button",class:"ui-button","data-size":"md","data-variant":"ghost",disabled:o.value,onClick:X[0]||(X[0]=ne=>z("deny"))},m(a(e)("prompt.reject")),9,lr),r.value&&i.value&&v.value?(c(),u("button",{key:0,type:"button",class:"ui-button",disabled:f.value,onClick:X[1]||(X[1]=ne=>b())},"Retry",8,cr)):L("",!0),l.value?(c(),u("button",{key:1,type:"button",class:"ui-button","data-size":"md","data-variant":"secondary",disabled:o.value,onClick:X[2]||(X[2]=ne=>z("session"))},m(a(e)("prompt.allowSession")),9,dr)):L("",!0),h.value?(c(),u("button",{key:2,type:"button",class:"ui-button","data-size":"md","data-variant":"secondary",disabled:o.value,onClick:X[3]||(X[3]=ne=>z("always"))},m(a(e)("prompt.allowAlways")),9,ur)):L("",!0),d("button",{type:"button",class:"ui-button","data-size":"md","data-variant":"primary",disabled:o.value||r.value&&(f.value||!w.value),onClick:X[4]||(X[4]=ne=>z("allow"))},m(a(e)("prompt.allowOnce")),9,pr)])]))}}),hr=/[\s,;:!?,。!?、()[\]{}<>]/,un=/[\p{L}\p{N}_./~\\:-]/u;function mr(s,t){const e=s.slice(0,t);for(let n=e.length-1;n>=0;n--){const o=e[n];if(o==="@"){const i=n===0?void 0:e[n-1];return i!==void 0&&!hr.test(i)?void 0:{start:n,query:e.slice(n+1)}}if(!un.test(o))return}}function vr(s,t){const e=s.replace(/[[\]\\]/g,n=>`\\${n}`);return/[\s()<>]/.test(t)?`[${e}](<${t.replaceAll("<","%3C").replaceAll(">","%3E")}>)`:`[${e}](${t})`}function fr(s,t){const e=[];for(const i of t){let r=0;for(;;){const l=s.indexOf(i.label,r);if(l===-1)break;const h=l+i.label.length,w=s[h];(w===void 0||!un.test(w))&&e.push({start:l,end:h,link:vr(i.label,i.path)}),r=h}}e.sort((i,r)=>i.start-r.start||r.end-i.end);let n="",o=0;for(const i of e)i.start<o||(n+=s.slice(o,i.start)+i.link,o=i.end);return n+s.slice(o)}const Pt=ut("models",()=>{const s=A(),t=A("");let e;const n=C(()=>{const h=Ee();return h.supports("provider.list")&&h.supports("provider.catalog")});function o(){return e??(e=i().finally(()=>{e=void 0})),e}async function i(){const h=Ee(),w=h.client;t.value="";const v=(await Promise.allSettled([w.call("provider.list",{},xo).then($=>$.filter(y=>y.enabled)),h.supports("account.providers")?w.call("account.providers",{},So):[]])).flatMap($=>$.status==="rejected"?(t.value=$.reason instanceof Error?$.reason.message:String($.reason),[]):$.value),b=[...new Map(v.map($=>[$.providerId,$])).values()],T=await Promise.allSettled(b.map($=>w.call("provider.catalog",{providerId:$.providerId},Mo)));s.value=b.flatMap(($,y)=>{const _=T[y];if(_.status==="rejected")return t.value=_.reason instanceof Error?_.reason.message:String(_.reason),[];const I=_.value;if(I===void 0)return[];const O=new Set(I.disabledModelIds),D=I.models.filter(F=>F.unavailableReason===void 0&&!O.has(F.id));return D.length===0?[]:[{providerId:$.providerId,name:$.displayName,models:D}]})}async function r(h){if(Ee().supports("provider.selection"))return Ee().client.call("provider.selection",{cwd:h},To).catch(()=>{})}function l(h){var f,v;const w=(f=s.value)==null?void 0:f.find(b=>b.providerId===h.providerId);return((v=w==null?void 0:w.models.find(b=>b.id===h.modelId))==null?void 0:v.name)??h.modelId}return{providers:s,error:t,available:n,load:o,defaultFor:r,nameOf:l}}),gr={key:0,class:"ui-button model-trigger","data-variant":"ghost","data-size":"sm","aria-disabled":"true"},br={class:"model-trigger-label"},yr={class:"ui-button model-trigger","data-variant":"ghost","data-size":"sm"},wr={key:0,class:"provider-badge","aria-hidden":"true"},kr={class:"model-trigger-label"},_r={class:"composer-popover-content is-end ui-popover model-content","data-width":"xl"},Ir={class:"ui-menu-search model-search"},$r=["placeholder","aria-label"],xr={key:0,class:"menu-empty"},Sr={key:1,class:"menu-empty"},Cr={key:2,class:"model-panes"},Mr={key:0,class:"provider-pane"},Tr=["aria-current","onClick"],Er={class:"provider-badge","aria-hidden":"true"},Ar=["aria-label"],Lr={key:0,class:"menu-empty"},qr=["aria-selected","data-highlighted","title","onMouseenter","onClick"],Or={class:"model-check"},Rr={key:0,class:"provider-badge","aria-hidden":"true"},Pr={class:"model-name"},zr=ve({__name:"ComposerModelMenu",props:{model:{},selectable:{type:Boolean},disabled:{type:Boolean}},emits:["select"],setup(s,{expose:t,emit:e}){const n=s,o=e,{t:i}=pe(),r=Pt(),l=A(),h=A(),w=A(""),f=A(),v=A(0),b=C(()=>r.providers??[]),T=C(()=>{var x,R,j;return((x=b.value.find(P=>P.providerId===f.value))==null?void 0:x.providerId)??((R=b.value.find(P=>{var G;return P.providerId===((G=n.model)==null?void 0:G.providerId)}))==null?void 0:R.providerId)??((j=b.value[0])==null?void 0:j.providerId)}),$=C(()=>b.value.flatMap(x=>x.models.map(R=>({providerId:x.providerId,providerName:x.name,modelId:R.id,name:R.name})))),y=C(()=>w.value.trim()!==""),_=C(()=>{if(!y.value)return $.value.filter(R=>R.providerId===T.value);const x=w.value.trim().toLocaleLowerCase();return $.value.filter(R=>[R.name,R.modelId,R.providerName].some(j=>j.toLocaleLowerCase().includes(x)))}),I=C(()=>n.model===void 0?i("composer.notConfigured"):r.nameOf(n.model));Ue(()=>{n.selectable&&r.available&&r.providers===void 0&&r.load()});function O(x){var R;return x.providerId===((R=n.model)==null?void 0:R.providerId)&&x.modelId===n.model.modelId}function D(x){return x.trim().charAt(0).toLocaleUpperCase()}async function F(){var x,R,j,P;((x=l.value)==null?void 0:x.open)===!0&&(r.providers===void 0&&await r.load(),w.value="",f.value=((R=n.model)==null?void 0:R.providerId)??((j=b.value[0])==null?void 0:j.providerId),v.value=Math.max(0,_.value.findIndex(O)),await Be(),matchMedia("(pointer: coarse)").matches||(P=h.value)==null||P.focus())}function q(x){l.value&&(l.value.open=!1),O(x)||o("select",{providerId:x.providerId,modelId:x.modelId})}function z(x){var R,j;if(!(x.isComposing||x.keyCode===229)){if(x.key==="Escape"){x.preventDefault(),l.value&&(l.value.open=!1),(j=(R=l.value)==null?void 0:R.querySelector("summary"))==null||j.focus();return}if(x.key==="ArrowDown")x.preventDefault(),v.value=Math.min(_.value.length-1,v.value+1);else if(x.key==="ArrowUp")x.preventDefault(),v.value=Math.max(0,v.value-1);else if(x.key==="Enter"){x.preventDefault();const P=_.value[v.value];P!==void 0&&q(P)}}}return t({open:()=>{n.selectable&&r.available&&!n.disabled&&l.value&&(l.value.open=!0)}}),(x,R)=>{const j=st("tooltip");return!s.selectable||!a(r).available?(c(),u("span",gr,[d("span",br,m(I.value),1)])):(c(),u("details",{key:1,ref_key:"details",ref:l,class:Ae(["composer-popover model-menu",{"is-disabled":s.disabled}]),onToggle:F},[$e((c(),u("summary",yr,[s.model?(c(),u("span",wr,m(D(s.model.providerId)),1)):L("",!0),d("span",kr,m(I.value),1)])),[[j,s.model?`${I.value} · ${s.model.providerId}`:void 0]]),d("div",_r,[d("label",Ir,[K(a(Yt),{"aria-hidden":"true"}),$e(d("input",{ref_key:"searchInput",ref:h,"onUpdate:modelValue":R[0]||(R[0]=P=>w.value=P),type:"text",placeholder:a(i)("composer.searchModels"),"aria-label":a(i)("composer.searchModels"),onKeydown:z,onInput:R[1]||(R[1]=P=>v.value=0)},null,40,$r),[[$t,w.value]])]),a(r).providers===void 0&&!a(r).error?(c(),u("p",xr,[K(a(qt),{class:"is-spinning","aria-hidden":"true"}),fe(m(a(i)("composer.modelLoading")),1)])):a(r).error?(c(),u("p",Sr,[d("button",{type:"button",class:"ui-button","data-variant":"danger-ghost","data-size":"sm",onClick:R[2]||(R[2]=P=>a(r).load())},m(a(i)("composer.modelLoadRetry")),1)])):L("",!0),a(r).providers!==void 0&&(!a(r).error||b.value.length>0)?(c(),u("div",Cr,[y.value?L("",!0):(c(),u("div",Mr,[(c(!0),u(ee,null,ue(b.value,P=>(c(),u("button",{key:P.providerId,type:"button",class:"ui-menu-item","aria-current":T.value===P.providerId,onClick:G=>{f.value=P.providerId,v.value=0}},[d("span",Er,m(D(P.name)),1),d("span",null,m(P.name),1)],8,Tr))),128))])),d("div",{class:"model-pane",role:"listbox","aria-label":a(i)("composer.searchModels")},[_.value.length===0?(c(),u("p",Lr,m(a(i)("composer.noModels")),1)):L("",!0),(c(!0),u(ee,null,ue(_.value,(P,G)=>(c(),u("button",{key:`${P.providerId}:${P.modelId}`,type:"button",role:"option",class:"ui-menu-item","aria-selected":O(P),"data-highlighted":G===v.value?"":void 0,title:`${P.name} · ${P.providerName}`,onMouseenter:X=>v.value=G,onClick:X=>q(P)},[d("span",Or,[O(P)?(c(),se(a(rt),{key:0,"aria-hidden":"true"})):L("",!0)]),y.value?(c(),u("span",Rr,m(D(P.providerName)),1)):L("",!0),d("span",Pr,m(P.name),1)],40,qr))),128))],8,Ar)])):L("",!0)])],34))}}}),Dr=xe(zr,[["__scopeId","data-v-65d27c07"]]),Fr=["aria-labelledby"],jr={class:"ui-dialog-header"},Wr={class:"ui-dialog-icon","data-tone":"warning"},Nr=["id"],Br={class:"ui-dialog-footer"},pn=ve({__name:"ConfirmDialog",setup(s,{expose:t}){const{t:e}=pe({messages:Xt}),n=Vt(),o=A(),i=A(""),r=A("");let l;function h(f,v={}){return l==null||l(!1),i.value=f,r.value=v.confirmLabel??e("confirm"),new Promise(b=>{var T;l=b,(T=o.value)==null||T.showModal()})}function w(f){var b;const v=l;l=void 0,(b=o.value)==null||b.close(),v==null||v(f)}return pt(()=>l==null?void 0:l(!1)),t({open:h}),(f,v)=>(c(),u("dialog",{ref_key:"dialog",ref:o,class:"ui-dialog","data-size":"md","aria-labelledby":a(n),onCancel:v[2]||(v[2]=ke(b=>w(!1),["prevent"])),onClose:v[3]||(v[3]=b=>w(!1))},[d("header",jr,[d("span",Wr,[K(a(oo),{"aria-hidden":"true"})]),d("h2",{id:a(n),class:"ui-dialog-title"},m(i.value),9,Nr)]),d("footer",Br,[d("button",{class:"ui-button","data-variant":"secondary",type:"button",autofocus:"",onClick:v[0]||(v[0]=b=>w(!1))},m(a(e)("cancel")),1),d("button",{class:"ui-button","data-variant":"danger",type:"button",onClick:v[1]||(v[1]=b=>w(!0))},m(r.value),1)])],40,Fr))}}),Vr=["aria-label"],Ur={class:"permission-trigger-label"},Hr={class:"composer-popover-content ui-popover permission-content","data-width":"lg"},Kr=["disabled"],Gr=["aria-pressed","onClick"],Qr={class:"permission-option-text"},Jr=["disabled"],Yr={key:0,class:"permission-note"},Xr=["aria-pressed","onClick"],Zr={class:"permission-option-text"},el={key:0,class:"permission-note"},tl={key:1,class:"permission-note"},sl={class:"permission-note"},nl=ve({__name:"ComposerPermissionMenu",props:{policy:{}},emits:["select"],setup(s,{expose:t,emit:e}){const n=s,o=e,{t:i}=pe(),r=A(),l=A(),h=["read-only","workspace-read-write","unrestricted"],w=["ask","bypass"],f=C(()=>{const y=n.policy;if(y!==void 0)return y.fileAccess??{"read-only":"read-only","workspace-write":"workspace-read-write","full-access":"unrestricted"}[y.preset]}),v=C(()=>{var y,_;return((y=n.policy)==null?void 0:y.toolApproval)??(((_=n.policy)==null?void 0:_.preset)==="full-access"?"bypass":void 0)}),b=C(()=>v.value===void 0?i("composer.permission.legacy"):i(`composer.permission.tool.${v.value}`));async function T(y){var O;if(n.policy===void 0)return;const _=y.field==="fileAccess"&&y.value==="unrestricted"&&f.value!=="unrestricted",I=y.field==="toolApproval"&&y.value==="bypass"&&v.value!=="bypass";if(_||I){const D=_?"composer.permission.unrestrictedConfirm":"composer.permission.bypassConfirm";if(!await((O=l.value)==null?void 0:O.open(i(D))))return}o("select",y)}function $(){r.value&&(r.value.open=!0)}return t({open:$}),(y,_)=>{var I,O;return c(),u("details",{ref_key:"details",ref:r,class:"composer-popover permission-menu"},[d("summary",{class:"ui-button permission-trigger","data-variant":"ghost","data-size":"sm","aria-label":a(i)("composer.permission.label")},[K(a(to),{size:14,"aria-hidden":"true"}),d("span",Ur,m(s.policy&&f.value?`${a(i)(`composer.permission.file.${f.value}`)} · ${b.value}`:a(i)("composer.permission.label")),1)],8,Vr),d("div",Hr,[d("fieldset",{class:"permission-group",disabled:!s.policy},[d("legend",null,m(a(i)("composer.permission.fileAccess")),1),(c(),u(ee,null,ue(h,D=>d("button",{key:D,type:"button",class:"ui-menu-item permission-option","aria-pressed":D===f.value,onClick:F=>T({field:"fileAccess",value:D})},[d("span",Qr,[d("span",null,m(a(i)(`composer.permission.file.${D}`)),1),d("small",null,m(a(i)(`composer.permission.fileDescription.${D}`)),1)]),D===f.value?(c(),se(a(rt),{key:0,size:14,"aria-hidden":"true"})):L("",!0)],8,Gr)),64))],8,Kr),d("fieldset",{class:"permission-group",disabled:!s.policy},[d("legend",null,m(a(i)("composer.permission.toolApproval")),1),s.policy&&v.value===void 0?(c(),u("p",Yr,m(a(i)(`composer.permission.legacy.${s.policy.preset}`)),1)):L("",!0),(c(),u(ee,null,ue(w,D=>d("button",{key:D,type:"button",class:"ui-menu-item permission-option","aria-pressed":D===v.value,onClick:F=>T({field:"toolApproval",value:D})},[d("span",Zr,[d("span",null,m(a(i)(`composer.permission.tool.${D}`)),1),d("small",null,m(a(i)(`composer.permission.toolDescription.${D}`)),1)]),D===v.value?(c(),se(a(rt),{key:0,size:14,"aria-hidden":"true"})):L("",!0)],8,Xr)),64))],8,Jr),(I=s.policy)!=null&&I.allowedTools.length?(c(),u("p",el,m(a(i)("composer.permission.allowedTools"))+": "+m(s.policy.allowedTools.join(", ")),1)):L("",!0),(O=s.policy)!=null&&O.disallowedTools.length?(c(),u("p",tl,m(a(i)("composer.permission.disallowedTools"))+": "+m(s.policy.disallowedTools.join(", ")),1)):L("",!0),d("p",sl,m(a(i)("composer.permission.independent")),1),K(a(at),{class:"ui-menu-item",to:{name:"settings-permissions"}},{default:je(()=>[fe(m(a(i)("composer.permission.processIsolation")),1)]),_:1})]),K(pn,{ref_key:"confirm",ref:l},null,512)],512)}}}),ol=xe(nl,[["__scopeId","data-v-89927143"]]);function il(s,t){let e=t.replaceAll(`\r
|
|
227
|
+
`,`
|
|
228
|
+
`);if(e.endsWith(`
|
|
229
|
+
`)&&(e=e.slice(0,-1)),e==="")return s;const n=e.split(`
|
|
230
|
+
`).map(i=>i===""?`>
|
|
231
|
+
`:`> ${i}
|
|
232
|
+
`).join(""),o=s===""||s.endsWith(`
|
|
233
|
+
|
|
234
|
+
`)?"":s.endsWith(`
|
|
235
|
+
`)?`
|
|
236
|
+
`:`
|
|
237
|
+
|
|
238
|
+
`;return`${s}${o}${n}
|
|
239
|
+
`}const al=["data-variant","aria-label"],rl={key:0,class:"inline-error",role:"alert"},ll={key:0,class:"draft-attachments"},cl=["src","alt"],dl=["aria-label","onClick"],ul=["aria-label","onClick"],pl=["id","aria-label"],hl=["id","aria-selected","data-highlighted","onMouseenter","onClick"],ml={class:"command-category"},vl={class:"command-name"},fl={key:0,class:"command-argument"},gl={key:1,class:"command-argument"},bl={class:"command-description"},yl={class:"command-keys"},wl=["id","aria-label"],kl=["aria-selected","data-highlighted","onMouseenter","onClick"],_l={class:"command-name"},Il={class:"command-keys"},$l=["placeholder","aria-label","aria-controls","aria-expanded","aria-activedescendant"],xl={class:"composer-toolbar"},Sl={class:"composer-tool-group"},Cl={class:"composer-run-group"},Ml=["data-variant","aria-label","disabled"],Tl={key:1,class:"composer-statusbar"},El={class:"composer-status-start"},Al=16*1024,Ll=10*1024*1024,ql=20,Ol=ve({__name:"ComposerPanel",props:{running:{type:Boolean},stopping:{type:Boolean},model:{},modelSelectable:{type:Boolean},send:{},attachments:{type:Boolean,default:!0},storesPastes:{type:Boolean},searchFiles:{},permission:{},stop:{},selectModel:{},variant:{},placeholder:{},createBranch:{},openLines:{},sessionCommands:{}},setup(s,{expose:t}){const e=s,{t:n}=pe(),o=At(),i=Lt(),r=Pt(),l=Re(),h=A(),w=A(),f=A(),v=Vt(),b=A(""),T=A(!1),$=A(!1),y=A(""),_=A(!1),I=A(!1),O=A(!1),D=A([]),F=A(),q=A(),z=A([]),x=A(0);let R=0,j;const P=C(()=>F.value===void 0?void 0:`${F.value.start}:${F.value.query}`),G=C(()=>I.value&&e.searchFiles!==void 0&&F.value!==void 0&&P.value!==q.value),X=C(()=>G.value&&z.value.length>0),ne=Vt(),H=A(0),B=A([]),re=A([]);let W=0;const te=C(()=>{var M,N,he,Q,ae;return[{category:"model",name:"models",available:e.modelSelectable&&r.available&&!$.value},{category:"session",name:"branch",available:e.createBranch!==void 0},{category:"session",name:"compact",available:((M=e.sessionCommands)==null?void 0:M.compact)!==void 0},{category:"session",name:"usage",available:((N=e.sessionCommands)==null?void 0:N.usage)!==void 0},{category:"session",name:"fork",available:((he=e.sessionCommands)==null?void 0:he.fork)!==void 0},{category:"session",name:"goal",available:((Q=e.sessionCommands)==null?void 0:Q.goal)!==void 0},{category:"model",name:"effort",available:((ae=e.sessionCommands)==null?void 0:ae.effort)!==void 0},{category:"model",name:"permissions",available:e.permission!==void 0&&e.variant!=="panel"},{category:"session",name:"lines",available:e.openLines!==void 0},{category:"session",name:"new",available:!0}].filter(Ie=>Ie.available)}),Oe=C(()=>/^\/[a-z]*$/i.test(b.value)?b.value.slice(1).toLowerCase():void 0),be=C(()=>{const M=Oe.value;return M===void 0?[]:te.value.filter(N=>N.name.startsWith(M))}),De=C(()=>!_.value&&!O.value&&be.value.length>0),Te=C(()=>I.value&&De.value);ye(b,()=>{b.value.startsWith("/")||(O.value=!1)},{flush:"sync"}),ye(be,()=>{H.value=0},{flush:"sync"});const We=C(()=>e.running&&e.stop!==void 0&&b.value.trim()===""&&B.value.length===0&&re.value.length===0),ht=C(()=>(b.value.trim()!==""||B.value.length>0||re.value.length>0)&&!T.value);function Fe(){const M=h.value;M!==void 0&&(M.style.height="auto",M.style.height=`${Math.min(M.scrollHeight,300)}px`)}function g(M){return new Promise((N,he)=>{const Q=new FileReader;Q.onload=()=>{const ae=String(Q.result);N({url:ae,block:{type:"image",source:{type:"base64",mediaType:M.type,data:ae.slice(ae.indexOf(",")+1)}}})},Q.onerror=()=>he(Q.error??new Error(n("composer.imageReadFailed"))),Q.readAsDataURL(M)})}async function k(M){for(const N of M)try{const he=await g(N);if(B.value.length>=ql){y.value=n("composer.imageLimit");return}B.value=[...B.value,{id:++W,...he}]}catch{y.value=n("composer.imageReadFailed")}}function p(M){if(new TextEncoder().encode(M).length>Ll){y.value=n("composer.pasteTooLarge");return}re.value=[...re.value,{id:++W,text:M}]}function S(M){var Q,ae;if(!e.attachments)return;const N=[...((Q=M.clipboardData)==null?void 0:Q.files)??[]].filter(Ie=>Ie.type.startsWith("image/"));if(N.length>0){M.preventDefault(),k(N);return}const he=((ae=M.clipboardData)==null?void 0:ae.getData("text/plain"))??"";e.storesPastes&&new TextEncoder().encode(he).length>Al&&(M.preventDefault(),p(he))}function U(M){var Q;if(M.preventDefault(),!e.attachments)return;const N=[...((Q=M.dataTransfer)==null?void 0:Q.files)??[]],he=N.filter(ae=>ae.type.startsWith("image/"));he.length<N.length&&(y.value=n("composer.onlyImages")),k(he)}function Z(M){B.value=B.value.filter(N=>N.id!==M)}function ie(M){re.value=re.value.filter(N=>N.id!==M)}function le(){const M=h.value;F.value=M===void 0||e.searchFiles===void 0?void 0:mr(M.value,M.selectionStart)}ye(()=>{var M;return(M=F.value)==null?void 0:M.query},M=>{clearTimeout(j),x.value=0;const N=e.searchFiles;if(M===void 0||N===void 0){z.value=[];return}const he=++R;j=setTimeout(()=>{N(M).then(Q=>{he===R&&(z.value=Q)},Q=>{he===R&&(z.value=[],y.value=Q instanceof Error?Q.message:String(Q))})},80)});function ot(M){const N=h.value,he=F.value;if(N===void 0||he===void 0)return;const Q=N.selectionStart,ae=`@${M.relativePath}${M.dir?"/":""}`,Ie=M.dir?"":" ";b.value=`${b.value.slice(0,he.start)}${ae}${Ie}${b.value.slice(Q)}`,M.dir||(D.value=[...D.value,{label:`@${M.relativePath}`,path:M.absolutePath}]);const Ne=he.start+ae.length+Ie.length;Be(()=>{N.setSelectionRange(Ne,Ne),Fe(),le()})}async function rs(){var Ne,it,bt,He,ls;if(!ht.value||_.value)return;if(De.value){const Ke=be.value[H.value];Ke!==void 0&&await zt(Ke.name);return}const M=b.value,N=!O.value&&/^\/branch(?:\s+([\s\S]*))?$/i.exec(M);if(N&&!((Ne=N[1])!=null&&Ne.trim())){await zt("branch");return}const he=(it=e.sessionCommands)==null?void 0:it.goal,Q=!O.value&&he!==void 0?/^\/goal(?:\s+([\s\S]*))?$/i.exec(M):null;if(he&&Q){b.value="",await Be(),Fe(),await he(((bt=Q[1])==null?void 0:bt.trim())??"");return}const ae=(He=e.sessionCommands)==null?void 0:He.effort,Ie=!O.value&&ae!==void 0?/^\/effort(?:\s+([\s\S]*))?$/i.exec(M):null;if(ae&&Ie){b.value="",await Be(),Fe(),await ae(((ls=Ie[1])==null?void 0:ls.trim())??"");return}T.value=!0,y.value="";try{if(N){if(!e.createBranch)throw new Error(n("composer.branchUnavailable"));await e.createBranch(N[1].trim())}else{const Ke=D.value,cs=B.value,ds=re.value;await e.send(fr(M,Ke),{images:cs.map(Ge=>Ge.block),pastes:ds.map(Ge=>Ge.text)}),D.value=D.value.filter(Ge=>!Ke.includes(Ge)),B.value=B.value.filter(Ge=>!cs.includes(Ge)),re.value=re.value.filter(Ge=>!ds.includes(Ge))}b.value===M&&(b.value=""),await Be(),Fe()}catch(Ke){y.value=Ke instanceof Error?Ke.message:String(Ke)}finally{T.value=!1}}async function yn(){var M;y.value="";try{await((M=e.stop)==null?void 0:M.call(e))}catch(N){y.value=N instanceof Error?N.message:String(N)}}async function wn(M){$.value=!0,y.value="";try{await e.selectModel(M)}catch(N){y.value=N instanceof Error?N.message:String(N)}finally{$.value=!1}}async function zt(M){var he,Q,ae,Ie,Ne,it,bt;if(_.value)return;y.value="";const N=M==="branch"||M==="goal"||M==="effort";if(b.value=N?`/${M} `:"",await Be(),Fe(),N)(he=h.value)==null||he.focus();else if(M==="models")(Q=w.value)==null||Q.open();else if(M==="lines")(ae=e.openLines)==null||ae.call(e);else if(M==="new")try{const He=typeof o.params.sessionId=="string"?(Ie=l.byId.get(o.params.sessionId))==null?void 0:Ie.cwd:void 0;await i.push({name:"chat-new",...He===void 0?{}:{query:{cwd:He}}})}catch(He){y.value=He instanceof Error?He.message:String(He)}else M==="permissions"?(Ne=f.value)==null||Ne.open():(M==="compact"||M==="usage"||M==="fork")&&await((bt=(it=e.sessionCommands)==null?void 0:it[M])==null?void 0:bt.call(it))}function kn(M){if(!(M.isComposing||_.value||M.keyCode===229)){if(G.value&&z.value.length>0){if(M.key==="ArrowDown"||M.key==="ArrowUp"){M.preventDefault(),x.value=(x.value+(M.key==="ArrowDown"?1:-1)+z.value.length)%z.value.length;return}if(M.key==="Enter"&&!M.shiftKey&&!M.altKey||M.key==="Tab"){M.preventDefault(),ot(z.value[x.value]);return}}if(G.value&&M.key==="Escape"){M.preventDefault(),M.stopPropagation(),q.value=P.value;return}if(M.key==="Escape"&&b.value.startsWith("/")&&!O.value){M.preventDefault(),M.stopPropagation(),O.value=!0;return}if(Te.value&&(M.key==="ArrowDown"||M.key==="ArrowUp")){M.preventDefault(),H.value=(H.value+(M.key==="ArrowDown"?1:-1)+be.value.length)%be.value.length;return}M.key==="Enter"&&!M.shiftKey&&!M.altKey&&(M.preventDefault(),rs())}}async function _n(M){b.value=il(b.value,M),await Be(),Fe();const N=h.value;N==null||N.focus(),N==null||N.setSelectionRange(b.value.length,b.value.length)}return Ue(()=>{var M;return(M=h.value)==null?void 0:M.focus()}),t({focus:()=>{var M;return(M=h.value)==null?void 0:M.focus()},quote:_n}),(M,N)=>{const he=st("tooltip");return c(),u("section",{class:"composer-panel","data-variant":s.variant??"main","aria-label":a(n)("chat.composer")},[y.value?(c(),u("p",rl,m(y.value),1)):L("",!0),d("div",{class:"composer-surface",onClick:N[9]||(N[9]=ke(Q=>{var ae;return(ae=h.value)==null?void 0:ae.focus()},["self"])),onDragover:N[10]||(N[10]=ke(()=>{},["prevent"])),onDrop:U},[B.value.length>0||re.value.length>0?(c(),u("div",ll,[(c(!0),u(ee,null,ue(B.value,Q=>(c(),u("span",{key:Q.id,class:"draft-chip"},[d("img",{src:Q.url,alt:a(n)("composer.imageAttachment"),class:"draft-thumb"},null,8,cl),d("button",{type:"button",class:"ui-icon-button","data-variant":"ghost","data-size":"xs","aria-label":a(n)("composer.removeAttachment"),onClick:ae=>Z(Q.id)},[K(a(lt),{"aria-hidden":"true"})],8,dl)]))),128)),(c(!0),u(ee,null,ue(re.value,Q=>(c(),u("span",{key:Q.id,class:"draft-chip"},[d("span",null,m(a(n)("composer.pastedText",{lines:Q.text.split(`
|
|
240
|
+
`).length})),1),d("button",{type:"button",class:"ui-icon-button","data-variant":"ghost","data-size":"xs","aria-label":a(n)("composer.removeAttachment"),onClick:ae=>ie(Q.id)},[K(a(lt),{"aria-hidden":"true"})],8,ul)]))),128))])):L("",!0),Te.value?(c(),u("div",{key:1,id:a(v),class:"command-menu ui-popover",role:"listbox","aria-label":a(n)("composer.commands")},[(c(!0),u(ee,null,ue(be.value,(Q,ae)=>{var Ie;return c(),u("button",{id:`${a(v)}-${ae}`,key:Q.name,type:"button",role:"option",class:"ui-menu-item command-item","aria-selected":ae===H.value,"data-highlighted":ae===H.value?"":void 0,onMousedown:N[0]||(N[0]=ke(()=>{},["prevent"])),onMouseenter:Ne=>H.value=ae,onClick:ke(Ne=>zt(Q.name),["stop"])},[d("span",ml,m(ae===0||((Ie=be.value[ae-1])==null?void 0:Ie.category)!==Q.category?a(n)(`composer.category.${Q.category}`):""),1),d("span",vl,[fe("/"+m(Q.name),1),Q.name==="branch"?(c(),u("span",fl," <prompt>")):Q.name==="goal"||Q.name==="effort"?(c(),u("span",gl," [args]")):L("",!0)]),d("span",bl,m(a(n)(`composer.command.${Q.name}`)),1)],40,hl)}),128)),d("p",yl,m(a(n)("composer.commandKeys")),1)],8,pl)):L("",!0),X.value?(c(),u("div",{key:2,id:a(ne),class:"command-menu ui-popover",role:"listbox","aria-label":a(n)("composer.files")},[(c(!0),u(ee,null,ue(z.value,(Q,ae)=>(c(),u("button",{key:Q.absolutePath,type:"button",role:"option",class:"ui-menu-item command-item","aria-selected":ae===x.value,"data-highlighted":ae===x.value?"":void 0,onMousedown:N[1]||(N[1]=ke(()=>{},["prevent"])),onMouseenter:Ie=>x.value=ae,onClick:ke(Ie=>ot(Q),["stop"])},[d("span",_l,[fe(m(Q.relativePath),1),Q.dir?(c(),u(ee,{key:0},[fe("/")],64)):L("",!0)])],40,kl))),128)),d("p",Il,m(a(n)("composer.mentionKeys")),1)],8,wl)):L("",!0),$e(d("textarea",{ref_key:"field",ref:h,"onUpdate:modelValue":N[2]||(N[2]=Q=>b.value=Q),class:"composer-input",rows:"2",placeholder:s.placeholder??a(n)("composer.sendMessage"),"aria-label":s.placeholder??a(n)("composer.sendMessage"),"aria-controls":Te.value?a(v):X.value?a(ne):void 0,"aria-expanded":Te.value||X.value,"aria-activedescendant":Te.value?`${a(v)}-${H.value}`:void 0,onInput:N[3]||(N[3]=Q=>{Fe(),le()}),onKeydown:kn,onKeyup:le,onClick:le,onPaste:S,onFocus:N[4]||(N[4]=Q=>I.value=!0),onBlur:N[5]||(N[5]=Q=>I.value=!1),onCompositionstart:N[6]||(N[6]=Q=>_.value=!0),onCompositionend:N[7]||(N[7]=Q=>_.value=!1)},null,40,$l),[[$t,b.value]]),d("footer",xl,[d("div",Sl,[s.permission&&s.variant!=="panel"?(c(),se(ol,{key:0,ref_key:"permissionMenu",ref:f,policy:s.permission.policy,onSelect:s.permission.select},null,8,["policy","onSelect"])):L("",!0)]),d("div",Cl,[s.variant!=="panel"?(c(),se(Dr,{key:0,ref_key:"modelMenu",ref:w,model:s.model,selectable:s.modelSelectable,disabled:$.value,onSelect:wn},null,8,["model","selectable","disabled"])):L("",!0),$e((c(),u("button",{class:"ui-icon-button","data-variant":We.value?"contrast":"primary","data-size":"sm",type:"button","aria-label":We.value?a(n)("composer.stopResponse"):a(n)("composer.send"),disabled:We.value?s.stopping:!ht.value,onClick:N[8]||(N[8]=ke(Q=>We.value?yn():rs(),["stop"]))},[We.value?(c(),se(a(so),{key:0,fill:"currentColor","aria-hidden":"true"})):(c(),se(a(jn),{key:1,"stroke-width":2.25,"aria-hidden":"true"}))],8,Ml)),[[he,We.value?a(n)("composer.stopResponse"):a(n)("composer.send")]])])])],32),M.$slots.status?(c(),u("div",Tl,[d("div",El,[Cn(M.$slots,"status",{},void 0,!0)])])):L("",!0)],8,al)}}}),ns=xe(Ol,[["__scopeId","data-v-f6948dba"]]),Rl={class:"prompt-card","data-inline-interaction-prompt":""},Pl={class:"prompt-header"},zl={class:"prompt-icon","aria-hidden":"true"},Dl={class:"prompt-title"},Fl={class:"ui-badge","data-tone":"warning"},jl=["disabled"],Wl={key:0,class:"question-header"},Nl={key:1,class:"question-hint"},Bl=["type","name","checked","onChange"],Vl={class:"question-option-text"},Ul={key:0,class:"question-option-description"},Hl=["value","placeholder","aria-label","onInput"],Kl={key:0,class:"prompt-error",role:"alert"},Gl={class:"prompt-buttons"},Ql=["disabled"],Jl=["disabled"],Yl=ve({__name:"QuestionPrompt",props:{sessionId:{},question:{}},setup(s){const t=s,{t:e}=pe(),n=Pe(),o=A(!1),i=A(!1),r=A(""),l=ps({}),h=ps({}),w=_=>`question-${t.question.callId}-${_.id}`;function f(_){const I=(h[_.id]??"").trim();return _.allowCustom&&I!==""?I:void 0}const v=C(()=>t.question.questions.every(_=>{var I;return(((I=l[_.id])==null?void 0:I.length)??0)>0||f(_)!==void 0}));function b(_,I){const O=l[_.id]??[];_.multiSelect?l[_.id]=O.includes(I)?O.filter(D=>D!==I):[...O,I]:(l[_.id]=[I],h[_.id]="")}function T(_,I){h[_.id]=I,!_.multiSelect&&I.trim()!==""&&(l[_.id]=[])}function $(){return t.question.questions.map(_=>{const I=f(_);return{questionId:_.id,selected:l[_.id]??[],...I===void 0?{}:{custom:I}}})}async function y(_){if(!(o.value||i.value||!_&&!v.value)){o.value=!0,r.value="";try{await n.answerQuestion(t.sessionId,t.question,_?void 0:$()),i.value=!0}catch(I){r.value=I instanceof Ze&&I.appError==="question_not_pending"?e("question.notPending"):I instanceof Error&&I.message?I.message:e("question.failed")}finally{o.value=!1}}}return(_,I)=>(c(),u("article",Rl,[d("header",Pl,[d("span",zl,[K(a(Wn),{size:12,"stroke-width":2.25})]),d("h2",Dl,m(a(e)("question.title")),1),d("span",Fl,m(i.value?a(e)("question.sent"):a(e)("question.awaitingAnswer")),1)]),d("form",{class:"question-list",onSubmit:I[0]||(I[0]=ke(O=>y(!1),["prevent"]))},[(c(!0),u(ee,null,ue(t.question.questions,O=>(c(),u("fieldset",{key:O.id,class:"question-item",disabled:o.value||i.value},[d("legend",null,[O.header?(c(),u("span",Wl,m(O.header),1)):L("",!0),fe(" "+m(O.question)+" ",1),O.multiSelect?(c(),u("small",Nl,m(a(e)("question.selectMany")),1)):L("",!0)]),(c(!0),u(ee,null,ue(O.options,D=>(c(),u("label",{key:D.label,class:"question-option"},[d("input",{type:O.multiSelect?"checkbox":"radio",name:w(O),checked:(l[O.id]??[]).includes(D.label),onChange:F=>b(O,D.label)},null,40,Bl),d("span",Vl,[d("span",null,m(D.label),1),D.description?(c(),u("small",Ul,m(D.description),1)):L("",!0)])]))),128)),O.allowCustom?(c(),u("input",{key:0,class:"ui-field question-other","data-size":"md",type:"text",value:h[O.id]??"",placeholder:a(e)("question.otherPlaceholder"),"aria-label":a(e)("question.other"),onInput:D=>T(O,D.target.value)},null,40,Hl)):L("",!0)],8,jl))),128))],32),r.value?(c(),u("p",Kl,m(r.value),1)):L("",!0),d("div",Gl,[d("button",{type:"button",class:"ui-button","data-size":"md","data-variant":"ghost",disabled:o.value||i.value,onClick:I[1]||(I[1]=O=>y(!0))},m(a(e)("question.decline")),9,Ql),d("button",{type:"button",class:"ui-button","data-size":"md","data-variant":"primary",disabled:o.value||i.value||!v.value,onClick:I[2]||(I[2]=O=>y(!1))},m(a(e)("question.submit")),9,Jl)])]))}}),hn=xe(Yl,[["__scopeId","data-v-eae42e35"]]);function mt(s,t,e){let n=e.initialDeps??[],o,i=!0;function r(){var l,h,w;let f;e.key&&((l=e.debug)!=null&&l.call(e))&&(f=Date.now());const v=s();if(!(v.length!==n.length||v.some(($,y)=>n[y]!==$)))return o;n=v;let T;if(e.key&&((h=e.debug)!=null&&h.call(e))&&(T=Date.now()),o=t(...v),e.key&&((w=e.debug)!=null&&w.call(e))){const $=Math.round((Date.now()-f)*100)/100,y=Math.round((Date.now()-T)*100)/100,_=y/16,I=(O,D)=>{for(O=String(O);O.length<D;)O=" "+O;return O};console.info(`%c⏱ ${I(y,5)} /${I($,5)} ms`,`
|
|
241
|
+
font-size: .6rem;
|
|
242
|
+
font-weight: bold;
|
|
243
|
+
color: hsl(${Math.max(0,Math.min(120-120*_,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 r.updateDeps=l=>{n=l},r}function Es(s,t){if(s===void 0)throw new Error("Unexpected undefined");return s}const Xl=(s,t)=>Math.abs(s-t)<1.01,Zl=(s,t,e)=>{let n;return function(...o){s.clearTimeout(n),n=s.setTimeout(()=>t.apply(this,o),e)}},As=s=>{const{offsetWidth:t,offsetHeight:e}=s;return{width:t,height:e}},ec=s=>s,tc=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},sc=(s,t)=>{const e=s.scrollElement;if(!e)return;const n=s.targetWindow;if(!n)return;const o=r=>{const{width:l,height:h}=r;t({width:Math.round(l),height:Math.round(h)})};if(o(As(e)),!n.ResizeObserver)return()=>{};const i=new n.ResizeObserver(r=>{const l=()=>{const h=r[0];if(h!=null&&h.borderBoxSize){const w=h.borderBoxSize[0];if(w){o({width:w.inlineSize,height:w.blockSize});return}}o(As(e))};s.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(e,{box:"border-box"}),()=>{i.unobserve(e)}},Ls={passive:!0},qs=typeof window>"u"?!0:"onscrollend"in window,nc=(s,t)=>{const e=s.scrollElement;if(!e)return;const n=s.targetWindow;if(!n)return;let o=0;const i=s.options.useScrollendEvent&&qs?()=>{}:Zl(n,()=>{t(o,!1)},s.options.isScrollingResetDelay),r=f=>()=>{const{horizontal:v,isRtl:b}=s.options;o=v?e.scrollLeft*(b&&-1||1):e.scrollTop,i(),t(o,f)},l=r(!0),h=r(!1);e.addEventListener("scroll",l,Ls);const w=s.options.useScrollendEvent&&qs;return w&&e.addEventListener("scrollend",h,Ls),()=>{e.removeEventListener("scroll",l),w&&e.removeEventListener("scrollend",h)}},oc=(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"]},ic=(s,{adjustments:t=0,behavior:e},n)=>{var o,i;const r=s+t;(i=(o=n.scrollElement)==null?void 0:o.scrollTo)==null||i.call(o,{[n.options.horizontal?"left":"top"]:r,behavior:e})};class ac{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 r=()=>{const l=i.target,h=this.indexFromElement(l);if(!l.isConnected){this.observer.unobserve(l),this.elementsCache.delete(this.options.getItemKey(h));return}this.shouldMeasureDuringScroll(h)&&this.resizeItem(h,this.options.measureElement(l,i,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()})}));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:ec,rangeExtractor:tc,onChange:()=>{},measureElement:oc,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=mt(()=>(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 r=n-1;r>=0;r--){const l=e[r];if(o.has(l.lane))continue;const h=i.get(l.lane);if(h==null||l.end>h.end?i.set(l.lane,l):l.end<h.end&&o.set(l.lane,!0),o.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((r,l)=>r.end===l.end?r.index-l.index:r.end-l.end)[0]:void 0},this.getMeasurementOptions=mt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes],(e,n,o,i,r,l)=>(this.prevLanes!==void 0&&this.prevLanes!==l&&(this.lanesChangedFlag=!0),this.prevLanes=l,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:l}),{key:!1}),this.getMeasurements=mt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:n,scrollMargin:o,getItemKey:i,enabled:r,lanes:l},h)=>{if(!r)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(const b of this.laneAssignments.keys())b>=e&&this.laneAssignments.delete(b);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(b=>{this.itemSizeCache.set(b.key,b.size)}));const w=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,w),v=new Array(l).fill(void 0);for(let b=0;b<w;b++){const T=f[b];T&&(v[T.lane]=b)}for(let b=w;b<e;b++){const T=i(b),$=this.laneAssignments.get(b);let y,_;if($!==void 0&&this.options.lanes>1){y=$;const F=v[y],q=F!==void 0?f[F]:void 0;_=q?q.end+this.options.gap:n+o}else{const F=this.options.lanes===1?f[b-1]:this.getFurthestMeasurement(f,b);_=F?F.end+this.options.gap:n+o,y=F?F.lane:b%this.options.lanes,this.options.lanes>1&&this.laneAssignments.set(b,y)}const I=h.get(T),O=typeof I=="number"?I:this.options.estimateSize(b),D=_+O;f[b]={index:b,start:_,size:O,end:D,key:T,lane:y},v[y]=b}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=mt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,n,o,i)=>this.range=e.length>0&&n>0?rc({measurements:e,outerSize:n,scrollOffset:o,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=mt(()=>{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,r)=>i===null||r===null?[]:e({startIndex:i,endIndex:r,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)),r=Math.max(0,o-i),l=Math.min(this.options.count-1,o+i);return e>=r&&e<=l}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((r,l)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(l))});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 r=this.itemSizeCache.get(i.key)??i.size,l=n-r;l!==0&&(((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(i,l,this):i.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(i.index),this.itemSizeCache=new Map(this.itemSizeCache.set(i.key,n)),this.notify(!1))},this.getVirtualItems=mt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,n)=>{const o=[];for(let i=0,r=e.length;i<r;i++){const l=e[i],h=n[l];o.push(h)}return o},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{const n=this.getMeasurements();if(n.length!==0)return Es(n[mn(0,n.length-1,o=>Es(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(),r=this.getScrollOffset();n==="auto"&&(n=e>=r+i?"end":"start"),n==="center"?e+=(o-i)/2:n==="end"&&(e-=i);const l=this.getMaxScrollOffset();return Math.max(Math.min(l,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(),r=this.measurementsCache[e];if(!r)return;if(n==="auto")if(r.end>=i+o-this.options.scrollPaddingEnd)n="end";else if(r.start<=i+this.options.scrollPaddingStart)n="start";else return[i,n];if(n==="end"&&e===this.options.count-1)return[this.getMaxScrollOffset(),n];const l=n==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,n,r.size),n]},this.scrollToOffset=(e,{align:n="start",behavior:o="auto"}={})=>{const i=this.getOffsetForAlignment(e,n),r=this.now();this.scrollState={index:null,align:n,behavior:o,startedAt:r,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[r,l]=i,h=this.now();this.scrollState={index:e,align:l,behavior:o,startedAt:h,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{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 r=n.length-1;for(;r>=0&&i.some(l=>l===null);){const l=n[r];i[l.lane]===null&&(i[l.lane]=l.end),r--}o=Math.max(...i.filter(l=>l!==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,r=o!==this.scrollState.lastTargetOffset;if(!r&&Xl(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=i){this.scrollState=null;return}}else this.scrollState.stableFrames=0,r&&(this.scrollState.lastTargetOffset=o,this.scrollState.behavior="auto",this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}));this.scheduleScrollReconcile()}}const mn=(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 rc({measurements:s,outerSize:t,scrollOffset:e,lanes:n}){const o=s.length-1,i=h=>s[h].start;if(s.length<=n)return{startIndex:0,endIndex:o};let r=mn(0,o,i,e),l=r;if(n===1)for(;l<o&&s[l].end<e+t;)l++;else if(n>1){const h=Array(n).fill(0);for(;l<o&&h.some(f=>f<e+t);){const f=s[l];h[f.lane]=f.end,l++}const w=Array(n).fill(e+t);for(;r>=0&&w.some(f=>f>=e);){const f=s[r];w[f.lane]=f.start,r--}r=Math.max(0,r-r%n),l=Math.min(o,l+(n-1-l%n))}return{startIndex:r,endIndex:l}}function lc(s){const t=new ac(a(s)),e=Gt(t),n=t._didMount();return ye(()=>a(s).getScrollElement(),o=>{o&&t._willUpdate()},{immediate:!0}),ye(()=>a(s),o=>{t.setOptions({...o,onChange:(i,r)=>{var l;hs(e),(l=o.onChange)==null||l.call(o,i,r)}}),t._willUpdate(),hs(e)},{immediate:!0}),Mn(n),e}function cc(s){return lc(C(()=>({observeElementRect:sc,observeElementOffset:nc,scrollToFn:ic,...a(s)})))}async function os(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")}let dc;function vn(){return dc??(dc=Se(async()=>{const{default:s}=await import("./index-B4STIxMF.js").then(t=>t.a4);return{default:s}},__vite__mapDeps([0,1])).then(({default:s})=>s))}const uc=/^[a-z][a-z\d+.-]*:/i;function Os(s){try{return decodeURIComponent(s)}catch{return s}}function pc(s){if(!(s===""||s.startsWith("#"))){if(s.startsWith("file:"))return Os(s.replace(/^file:(\/\/)?/,""));if(!uc.test(s))return Os(s.split(/[?#]/)[0]??s)}}const hc={key:1,class:"chat-markdown chat-markdown--pending"};let Wt;const mc=ve({__name:"ChatMarkdown",props:{content:{},final:{type:Boolean},messageId:{}},setup(s){const{t}=pe(),e=gt(),n={fontSize:13,lineHeight:20},o=Gt(Wt),i=A(!1);let r;function l(){i.value=document.documentElement.dataset.theme==="dark"||document.documentElement.classList.contains("dark")}Ue(async()=>{l(),r=new MutationObserver(l),r.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),Wt??(Wt=await vn()),o.value=Wt}),pt(()=>r==null?void 0:r.disconnect());async function h(w){const f=w.target instanceof Element?w.target.closest("a[href]"):null,v=f===null?void 0:pc(f.getAttribute("href")??"");if(v!==void 0){w.preventDefault();try{await os(v),e.push({tone:"success",title:t("chat.pathCopied"),description:v})}catch{e.push({tone:"danger",title:t("chat.copyFailed")})}}}return(w,f)=>o.value?(c(),se(Ns(o.value),{key:0,class:Ae(["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:h},null,8,["class","content","final","index-key","is-dark"])):(c(),u("div",hc,m(s.content),1))}}),vc={class:"user-message","data-role":"user"},fc={class:"sr-only"},gc={class:"user-bubble"},bc=["aria-expanded"],yc={class:"user-actions"},wc={class:"user-sent-time timestamp"},kc=["aria-label"],_c=["aria-label"],Ic=["aria-label"],$c=ve({__name:"TimelineUserMessage",props:{text:{},at:{},quotable:{type:Boolean},branchable:{type:Boolean}},emits:["quote","branch"],setup(s,{emit:t}){const e=s,n=t,{t:o,locale:i}=pe(),r=A(),l=A(!1),h=A(!1),w=A(!1);let f;const v=C(()=>Pi(new Date(e.at),i.value));Ue(async()=>{var T;await Be(),l.value=(((T=r.value)==null?void 0:T.scrollHeight)??0)>300}),pt(()=>clearTimeout(f));async function b(){await os(e.text),w.value=!0,clearTimeout(f),f=setTimeout(()=>{w.value=!1},1500)}return(T,$)=>{const y=st("tooltip");return c(),u("article",vc,[d("strong",fc,m(a(o)("chat.you")),1),d("div",gc,[d("div",{ref_key:"content",ref:r,class:Ae(["user-bubble-content",{"is-clipped":l.value&&!h.value}])},m(s.text),3),l.value?(c(),u("button",{key:0,type:"button",class:"ui-button user-bubble-expand","data-variant":"ghost","data-size":"xs","aria-expanded":h.value,onClick:$[0]||($[0]=_=>h.value=!h.value)},[K(a(Qt),{"aria-hidden":"true",class:Ae({"is-expanded":h.value})},null,8,["class"]),d("span",null,m(h.value?a(o)("message.collapse"):a(o)("message.expand")),1)],8,bc)):L("",!0)]),d("div",yc,[d("span",wc,m(v.value),1),$e((c(),u("button",{class:"ui-icon-button","data-variant":"ghost","data-size":"sm",type:"button","aria-label":a(o)("message.copy"),onClick:b},[w.value?(c(),se(a(rt),{key:0,class:"is-copied","aria-hidden":"true"})):(c(),se(a(Bs),{key:1,"aria-hidden":"true"}))],8,kc)),[[y,a(o)("message.copy")]]),s.branchable?$e((c(),u("button",{key:0,class:"ui-icon-button","data-variant":"ghost","data-size":"sm",type:"button","aria-label":a(o)("message.branch"),onClick:$[1]||($[1]=_=>n("branch",s.text))},[K(a(nt),{"aria-hidden":"true"})],8,_c)),[[y,a(o)("message.branch")]]):L("",!0),s.quotable?$e((c(),u("button",{key:1,class:"ui-icon-button","data-variant":"ghost","data-size":"sm",type:"button","aria-label":a(o)("message.quote"),onClick:$[2]||($[2]=_=>n("quote",s.text))},[K(a(Xn),{"aria-hidden":"true"})],8,Ic)),[[y,a(o)("message.quote")]]):L("",!0)])])}}}),xc=xe($c,[["__scopeId","data-v-475c8d1d"]]),Sc={class:"timeline-work-item"},Cc=["aria-expanded"],Mc=["title"],Tc={key:0},Ec={key:1,class:"timeline-work-item-summary"},Ac={class:"timeline-work-stat","data-tone":"success"},Lc={key:0,class:"timeline-work-stat","data-tone":"danger"},qc={key:0,class:"timeline-work-item-details"},Oc={key:0,class:"timeline-thinking-quote"},Rc={key:1,class:"tool-panel"},Pc={class:"tool-panel-label"},zc=["title"],Dc=["onClick"],Fc={key:0,class:"tool-panel-code"},jc={class:"is-strong"},Wc={key:0,class:"is-faint"},Nc={key:1,class:"tool-panel-code"},Bc={class:"is-strong"},Vc={key:0,class:"is-faint"},Uc={key:2,class:"tool-panel-diff"},Hc=["data-sign"],Kc={class:"tool-panel-sign","aria-hidden":"true"},Gc={key:3,class:"tool-panel-lines"},Qc={class:"tool-panel-line-number","aria-hidden":"true"},Jc={class:"tool-panel-line"},Rs=2e4,Yc=ve({__name:"TimelineWorkItem",props:{item:{},expanded:{type:Boolean}},emits:["toggle"],setup(s,{emit:t}){const e=s,n=t,{t:o}=pe(),i=C(()=>e.item.kind==="tool"?e.item:void 0),r=C(()=>i.value===void 0?void 0:ss(i.value.name,i.value.input)),l=C(()=>{const x=r.value;return x===void 0||i.value===void 0?"":x.renderer==="generic"?i.value.name:o(x.labelKey)}),h=C(()=>e.item.kind!=="thinking"?"":e.item.running?o("work.thinking"):o("work.thoughtFor",{duration:e.item.durationMs===void 0?"…":Di(e.item.durationMs)})),w=C(()=>e.item.kind==="thinking"?e.item.content.trim():"");function f(x){return x.length<=Rs?x:`${x.slice(0,Rs)}…`}function v(x){var j;const R=(j=i.value)==null?void 0:j.input[x];return typeof R=="string"&&R!==""?R:void 0}const b=C(()=>{var x,R;return f((((R=(x=i.value)==null?void 0:x.result)==null?void 0:R.text)??"").replace(/\s+$/u,""))}),T=C(()=>{var x;return((x=i.value)==null?void 0:x.status)==="error"}),$=C(()=>{var x;return((x=i.value)==null?void 0:x.name.trim().toLowerCase())??""}),y=C(()=>{var x,R,j;return $.value==="edit"?cn(((x=i.value)==null?void 0:x.input)??{},(j=(R=i.value)==null?void 0:R.result)==null?void 0:j.diff):[]}),_=C(()=>$.value==="write"?f(v("content")??""):""),I=C(()=>{if(y.value.length>0)return{added:y.value.filter(x=>x.sign==="+").length,removed:y.value.filter(x=>x.sign==="-").length};if(_.value!=="")return{added:_.value.split(`
|
|
244
|
+
`).length,removed:0}}),O=C(()=>{const x=i.value;if(x===void 0||r.value===void 0)return[];const R=b.value?[{id:"output",label:o("detail.output"),copy:b.value,body:"pre"}]:[];switch(r.value.renderer){case"command":{const j=v("command");return[...j===void 0?[]:[{id:"input",label:o("prompt.input"),copy:j,body:"command"}],...R]}case"search":{const j=v("pattern")??v("path");return[...j===void 0?[]:[{id:"input",label:o("prompt.input"),copy:j,body:"search"}],...R]}case"file":{const j=v("path")??x.name;return y.value.length>0?[{id:"file",label:j,copy:y.value.map(P=>`${P.sign}${P.text}`).join(`
|
|
245
|
+
`),body:"diff"},...T.value?R:[]]:_.value!==""?[{id:"file",label:j,copy:_.value,body:"lines"},...T.value?R:[]]:T.value?R:[]}default:{const j=Object.keys(x.input).length===0?"":f(JSON.stringify(x.input,null,2));return[...j?[{id:"input",label:o("prompt.input"),copy:j,body:"pre"}]:[],...R]}}}),D=C(()=>e.item.kind==="thinking"?w.value!=="":O.value.length>0),F=A();let q;pt(()=>clearTimeout(q));async function z(x){await os(x.copy),F.value=x.id,clearTimeout(q),q=setTimeout(()=>{F.value=void 0},1500)}return(x,R)=>(c(),u("div",Sc,[d("button",{type:"button",class:Ae(["timeline-work-item-toggle",{"is-running":s.item.kind==="thinking"?s.item.running:s.item.status==="running","is-error":T.value,"is-static":!D.value}]),"aria-expanded":D.value?s.expanded:void 0,onClick:R[0]||(R[0]=j=>D.value&&n("toggle"))},[K(a(Tt),{size:14,"aria-hidden":"true",class:Ae({"is-expanded":s.expanded&&D.value})},null,8,["class"]),i.value?(c(),u("span",{key:0,class:"timeline-work-item-summary",title:[l.value,i.value.primary].filter(Boolean).join(" ")},[d("span",null,m(l.value),1),i.value.primary?(c(),u("small",Tc,m(i.value.primary),1)):L("",!0)],8,Mc)):(c(),u("span",Ec,[d("span",null,m(h.value),1)])),I.value?(c(),u(ee,{key:2},[d("span",Ac,"+"+m(I.value.added),1),I.value.removed?(c(),u("span",Lc,"−"+m(I.value.removed),1)):L("",!0)],64)):L("",!0)],10,Cc),s.expanded&&D.value?(c(),u("div",qc,[s.item.kind==="thinking"?(c(),u("div",Oc,m(w.value),1)):(c(),u("div",Rc,[(c(!0),u(ee,null,ue(O.value,j=>(c(),u(ee,{key:j.id},[d("div",Pc,[d("span",{title:j.label},m(j.label),9,zc),d("button",{type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:P=>z(j)},[F.value===j.id?(c(),se(a(rt),{key:0,"aria-hidden":"true"})):(c(),se(a(Bs),{key:1,"aria-hidden":"true"})),fe(m(a(o)(F.value===j.id?"timeline.copied":"timeline.copy")),1)],8,Dc)]),j.body==="command"?(c(),u("div",Fc,[d("div",jc,[R[1]||(R[1]=d("span",{class:"is-muted"},"$",-1)),fe(" "+m(j.copy),1)]),v("cwd")?(c(),u("div",Wc," cwd: "+m(v("cwd")),1)):L("",!0)])):j.body==="search"?(c(),u("div",Nc,[d("div",Bc,m(j.copy),1),v("pattern")&&v("path")?(c(),u("div",Vc," path: "+m(v("path")),1)):L("",!0)])):j.body==="diff"?(c(),u("div",Uc,[(c(!0),u(ee,null,ue(y.value,(P,G)=>(c(),u("div",{key:G,class:"tool-panel-diff-line","data-sign":P.sign},[d("span",Kc,m(P.sign),1),fe(m(P.text),1)],8,Hc))),128))])):j.body==="lines"?(c(),u("div",Gc,[(c(!0),u(ee,null,ue(_.value.split(`
|
|
246
|
+
`),(P,G)=>(c(),u(ee,{key:G},[d("span",Qc,m(G+1),1),d("span",Jc,m(P),1)],64))),128))])):(c(),u("pre",{key:4,class:Ae(["tool-panel-pre",{"is-error":T.value&&j.id==="output"}])},m(j.copy),3))],64))),128))]))])):L("",!0)]))}}),Ps=xe(Yc,[["__scopeId","data-v-e3447865"]]),Xc={class:"timeline-work-row"},Zc=["aria-expanded"],ed={key:0,class:"timeline-work-group-content"},td=ve({__name:"TimelineWorkRow",props:{items:{},expanded:{type:Boolean},expandedItemIds:{}},emits:["toggle","toggleItem"],setup(s,{emit:t}){const e=s,n=t,{t:o}=pe(),i={read:"work.read",edit:"work.edit",command:"work.command",search:"work.search",web_search:"work.webSearch",web_fetch:"work.webFetch",unknown:"work.unknown"},r=Object.keys(i),l=C(()=>{let w="",f;const v=e.items.filter(T=>T.kind==="thinking").length;v>0&&(w=o("work.thinkingSteps",{count:v},v),f="thinking");const b=new Map;for(const T of e.items)T.kind==="tool"&&b.set(T.category,(b.get(T.category)??0)+1);for(const T of r){const $=b.get(T);$!==void 0&&(f!==void 0&&(w+=o(f==="thinking"?"work.separator":"work.actionSeparator")),w+=o(i[T],{count:$},$),f=T)}return w}),h=C(()=>e.items.some(w=>w.kind==="thinking"?w.running:w.status==="running"));return(w,f)=>(c(),u("div",Xc,[s.items.length>1?(c(),u(ee,{key:0},[d("button",{type:"button",class:Ae(["timeline-work-group-toggle",{"is-running":h.value}]),"aria-expanded":s.expanded,onClick:f[0]||(f[0]=v=>n("toggle"))},[K(a(Tt),{size:14,"aria-hidden":"true",class:Ae({"is-expanded":s.expanded})},null,8,["class"]),d("span",null,m(l.value),1)],10,Zc),s.expanded?(c(),u("div",ed,[(c(!0),u(ee,null,ue(s.items,v=>(c(),se(Ps,{key:v.id,item:v,expanded:s.expandedItemIds[v.id]===!0,onToggle:b=>n("toggleItem",v.id)},null,8,["item","expanded","onToggle"]))),128))])):L("",!0)],64)):s.items[0]?(c(),se(Ps,{key:1,item:s.items[0],expanded:s.expandedItemIds[s.items[0].id]===!0,onToggle:f[1]||(f[1]=v=>n("toggleItem",s.items[0].id))},null,8,["item","expanded"])):L("",!0)]))}});function sd(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 r=nd(i.name,i.input),l=od(r,i.input);e.push({id:i.key,kind:"tool",name:i.name,category:r,...l===void 0?{}:{primary:l},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 nd(s,t){const{renderer:e,labelKey:n}=ss(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 od(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 id=3,ad=180;function zs(s){return s.replace(/\s+/g," ").trim().slice(0,ad)}function rd(s){const t=[];return s.forEach((e,n)=>{if(e.kind!=="row")return;const o=e.row;if(o.kind==="user"){t.push({key:e.key,index:n,prompt:zs(o.text)});return}const i=t.at(-1);o.kind==="assistant"&&i!==void 0&&i.reply===void 0&&o.text.trim()!==""&&(i.reply=zs(o.text))}),t}const ld=["data-variant"],cd={key:0,class:"timeline-empty"},dd=["data-index"],ud={key:2,class:"timeline-row","data-role":"assistant"},pd={class:"sr-only"},hd=["disabled","aria-label","onClick"],md={class:"timeline-line-name"},vd={key:0,class:"timeline-line-failed"},fd={key:1,class:"timeline-line-cut"},gd={key:4,class:"timeline-notice"},bd={key:5,class:"timeline-line-notice"},yd={class:"timeline-line-from"},wd={key:6,class:"timeline-line-notice"},kd={key:7,class:"timeline-line-notice"},_d={key:8,class:"notice-row error-row",role:"alert"},Id={key:9,class:"timeline-notice"},$d={key:1,class:"processing-row",role:"status"},xd=["aria-label"],Sd=["aria-label","onClick"],Cd={class:"timeline-marker-card"},Md={class:"timeline-marker-prompt"},Td={key:0,class:"timeline-marker-reply"},Ed=["aria-label"],Ad=96,Ld=420,qd=ve({__name:"TimelineView",props:{rows:{},running:{type:Boolean},quotable:{type:Boolean},branchable:{type:Boolean},empty:{},variant:{}},emits:["quote","branch","openLine"],setup(s,{emit:t}){const e=s,n=t,{t:o}=pe(),i=A(),r=A(),l=A(!0),h=A({}),w=A({}),f=C(()=>sd(e.rows));function v(P){return P.slice(0,8)}function b(P,G){P.kind==="user"&&n("branch",G,P.cut)}const T=cc(C(()=>({count:f.value.length,getScrollElement:()=>i.value??null,estimateSize:()=>72,overscan:6,getItemKey:P=>f.value[P].key})));T.value.shouldAdjustScrollPositionOnItemSizeChange=(P,G,X)=>{var B;const ne=i.value;return ne===void 0||r.value===void 0?!1:(X.getTotalSize(),(((B=X.measurementsCache[P.index])==null?void 0:B.start)??P.start)<ne.scrollTop-r.value.offsetTop)};const $=C(()=>T.value.getVirtualItems()),y=C(()=>T.value.getTotalSize()),_=C(()=>rd(f.value)),I=C(()=>e.variant!=="panel"&&_.value.length>=id),O=C(()=>Math.min(12,(Ld-12)/Math.max(1,_.value.length-1))),D=A();let F;function q(P){l.value=!1,T.value.scrollToIndex(P,{align:"center",behavior:"smooth"}),D.value=P,clearTimeout(F),F=setTimeout(()=>{D.value=void 0},1600)}function z(P){P instanceof Element&&T.value.measureElement(P)}function x(){const P=i.value;P!==void 0&&(l.value=P.scrollHeight-P.scrollTop-P.clientHeight<=Ad)}async function R(){await Be();const P=i.value;P!==void 0&&(P.scrollTop=P.scrollHeight)}function j(){l.value=!0,R()}return ye([()=>f.value.length,y,()=>e.rows.at(-1),()=>e.running],()=>{l.value&&R()}),Ue(()=>void R()),(P,G)=>{const X=st("tooltip");return c(),u("div",{class:"timeline-shell","data-variant":s.variant??"main"},[d("div",{ref_key:"viewport",ref:i,class:"timeline app-scroll-viewport",onScrollPassive:x},[f.value.length===0&&!s.running?(c(),u("p",cd,m(s.empty??a(o)("chat.emptyTimeline")),1)):L("",!0),d("div",{ref_key:"list",ref:r,class:"virtual-timeline",style:kt({height:`${y.value}px`,position:"relative"})},[(c(!0),u(ee,null,ue($.value,ne=>(c(),u("div",{key:String(ne.key),ref_for:!0,ref:z,class:Ae(["virtual-timeline-row",{"is-jump-target":ne.index===D.value}]),"data-index":ne.index,style:kt({position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${ne.start}px)`})},[(c(!0),u(ee,null,ue([f.value[ne.index]],H=>(c(),u(ee,{key:H.key},[H.kind==="work"?(c(),se(td,{key:0,items:H.items,expanded:h.value[H.key]===!0,"expanded-item-ids":w.value,onToggle:B=>h.value[H.key]=!h.value[H.key],onToggleItem:G[0]||(G[0]=B=>w.value[B]=!w.value[B])},null,8,["items","expanded","expanded-item-ids","onToggle"])):H.row.kind==="user"?(c(),se(xc,{key:1,text:H.row.text,at:H.row.at,quotable:s.quotable,branchable:s.branchable===!0,onBranch:B=>b(H.row,B),onQuote:G[1]||(G[1]=B=>n("quote",B))},null,8,["text","at","quotable","branchable","onBranch"])):H.row.kind==="assistant"?(c(),u("article",ud,[d("strong",pd,m(a(o)("chat.assistant")),1),K(mc,{content:H.row.text,final:!H.row.streaming,"message-id":H.row.key},null,8,["content","final","message-id"])])):H.row.kind==="line"?(c(),u("button",{key:3,type:"button",class:"timeline-line-marker",disabled:H.row.failed===!0,"aria-label":a(o)("lines.openLine",{name:H.row.purpose||v(H.row.branchId)}),onClick:B=>H.row.failed!==!0&&n("openLine",H.row.branchId)},[K(a(nt),{size:14,"aria-hidden":"true"}),d("span",md,m(H.row.purpose||v(H.row.branchId)),1),d("code",null,m(v(H.row.branchId)),1),H.row.failed?(c(),u("span",vd,m(a(o)("lines.state.creationFailed")),1)):H.row.before?(c(),u("span",fd,m(a(o)("timeline.beforeMessage",{message:H.row.before})),1)):L("",!0)],8,hd)):H.row.kind==="line-ended"?(c(),u("p",gd,m(H.row.issuer==="itself"?a(o)("timeline.lineEndedItself"):H.row.issuer==="operation"?a(o)("timeline.lineEndedByOperation"):a(o)("timeline.lineEndedWith",{id:H.row.ancestor??""})),1)):H.row.kind==="source-message"?(c(),u("p",bd,[d("span",yd,[fe(m(a(o)("timeline.fromLine",{id:H.row.from})),1),H.row.steer?(c(),u(ee,{key:0},[fe(m(a(o)("timeline.steer")),1)],64)):L("",!0),H.row.final?(c(),u(ee,{key:1},[fe(", "+m(a(o)("timeline.final")),1)],64)):L("",!0)]),d("span",null,m(H.row.body),1)])):H.row.kind==="source-idle"?(c(),u("p",wd,m(a(o)("timeline.lineWaiting",{id:H.row.branch,status:H.row.status})),1)):H.row.kind==="source-ended"?(c(),u("p",kd,m(a(o)("timeline.lineEnded",{id:H.row.branch})),1)):H.row.kind==="error"?(c(),u("div",_d,[d("span",null,m(H.row.text),1)])):(c(),u("p",Id,m(a(o)("timeline.noticeStopped")),1))],64))),128))],14,dd))),128))],4),s.running?(c(),u("div",$d,[K(a(qt),{size:14,class:"is-spinning","aria-hidden":"true"}),d("span",null,m(a(o)("work.processing")),1)])):L("",!0)],544),I.value?(c(),u("nav",{key:0,class:"timeline-rail","aria-label":a(o)("timeline.rail")},[(c(!0),u(ee,null,ue(_.value,(ne,H)=>(c(),u("button",{key:ne.key,type:"button",class:"timeline-marker",style:kt({top:`${H*O.value}px`}),"aria-label":ne.prompt,onClick:B=>q(ne.index)},[d("span",Cd,[d("span",Md,m(ne.prompt),1),ne.reply?(c(),u("span",Td,m(ne.reply),1)):L("",!0)])],12,Sd))),128))],8,xd)):L("",!0),K(Tn,{name:"jump-latest"},{default:je(()=>[l.value?L("",!0):$e((c(),u("button",{key:0,class:"ui-icon-button jump-latest","data-variant":"secondary","data-size":"md",type:"button","aria-label":a(o)("timeline.scrollToBottom"),onClick:j},[K(a(Qt),{"aria-hidden":"true"})],8,Ed)),[[X,a(o)("timeline.scrollToBottom")]])]),_:1})],8,ld)}}}),fn=xe(qd,[["__scopeId","data-v-87cca147"]]),Od=["aria-label"],Rd={class:"line-crumb"},Pd={class:"line-crumb-main"},zd=["data-tone"],Dd={class:"line-crumb-meta"},Fd={key:0},jd={key:1},Wd={key:0,class:"line-loading",role:"status"},Nd={key:1,class:"line-loading line-error",role:"alert"},Bd={key:0,class:"line-approval"},Vd={key:1,class:"line-approval question-prompts"},Ud={class:"line-status"},Hd={key:3,class:"line-readonly"},Kd=ve({__name:"LineConversation",props:{sessionId:{},branchId:{}},setup(s){const t=s,{t:e}=pe(),n=Pe(),o=Ee(),i=ze(),r=A(),l=C(()=>n.views[t.sessionId]),h=C(()=>{var W;return(W=l.value)==null?void 0:W.branches[t.branchId]}),w=C(()=>{var W;return(W=l.value)==null?void 0:W.lines.find(te=>te.id===t.branchId)}),f=C(()=>{var W;return(W=l.value)==null?void 0:W.approvals.find(te=>te.branchId===t.branchId)}),v=C(()=>{var W;return i.approvalKeyboard(t.sessionId,t.branchId,((W=l.value)==null?void 0:W.approvals)??[])}),b=C(()=>{var W;return((W=l.value)==null?void 0:W.questions.filter(te=>te.branchId===t.branchId))??[]}),T=C(()=>o.supports("permission.rules")&&o.supports("permission.set_rules")),$=C(()=>{var W;return(W=l.value)!=null&&W.methods.includes("session.files.search")?te=>n.searchFiles(t.sessionId,te):void 0}),y=C(()=>{var W;return w.value===void 0?((W=h.value)==null?void 0:W.status)!=="failed":w.value.state.kind==="working"||w.value.state.kind==="waiting"}),_=C(()=>Qe(e,w.value,t.branchId)),I=C(()=>{var W,te;return((W=w.value)==null?void 0:W.state)??((te=h.value)!=null&&te.running?{kind:"working"}:{kind:"waiting"})}),O=C(()=>{var Oe,be;const W=(Oe=w.value)==null?void 0:Oe.parentId;if(W==null)return"";if(W===oe)return e("lines.main");const te=(be=l.value)==null?void 0:be.lines.find(De=>De.id===W);return te===void 0?dt(W):Qe(e,te,W)}),D=C(()=>{var W,te;return((W=w.value)==null?void 0:W.cut)===null||((te=w.value)==null?void 0:te.cut)===void 0?"":e("lines.afterMessage",{count:w.value.cut.messages})}),F=C(()=>{var W;return((W=h.value)==null?void 0:W.rows)??[]}),q=C(()=>{var W;return((W=h.value)==null?void 0:W.running)??!1}),z=C(()=>{var W;return((W=h.value)==null?void 0:W.stopping)??!1});ye(()=>[t.sessionId,t.branchId],()=>n.ensureLine(t.sessionId,t.branchId),{immediate:!0});function x(W,te){return n.submit(t.sessionId,t.branchId,W,te)}function R(W){var te;(te=r.value)==null||te.quote(W)}function j(){return n.stop(t.sessionId,t.branchId)}function P(W,te){i.requestNewLine({sessionId:t.sessionId,parentBranchId:t.branchId,at:te,text:W})}function G(W){n.ensureLine(t.sessionId,W),i.openLine(t.sessionId,W)}function X(){i.requestEndLine({sessionId:t.sessionId,branchId:t.branchId,purpose:_.value})}function ne(){var te;const W=(te=h.value)==null?void 0:te.lastTurnEnd;W!==void 0&&i.requestNewLine({sessionId:t.sessionId,parentBranchId:t.branchId,at:W,text:""})}async function H(W){var be;const te=(be=h.value)==null?void 0:be.lastTurnEnd;if(te===void 0)throw new Error(e("lines.noFinishedTurn"));const Oe=await n.createLine(t.sessionId,t.branchId,te,W);i.openLine(t.sessionId,Oe)}function B(){n.retryLine(t.sessionId,t.branchId)}function re(){}return(W,te)=>{var Oe,be,De;return c(),u("section",{class:"line-conversation","aria-label":a(e)("lines.lineAria",{name:_.value})},[d("header",Rd,[d("div",Pd,[K(a(nt),{size:14,"aria-hidden":"true"}),d("strong",null,m(_.value),1),d("code",null,m(a(dt)(s.branchId)),1),d("span",{class:"line-state","data-tone":a(ts)(I.value)},m(a(Ct)(a(e),I.value)),9,zd)]),d("div",Dd,[O.value?(c(),u("span",Fd,[fe(m(a(e)("lines.from",{name:O.value})),1),D.value?(c(),u(ee,{key:0},[fe(" · "+m(D.value),1)],64)):L("",!0)])):(c(),u("span",jd,m(a(e)("lines.main")),1)),y.value&&((Oe=h.value)==null?void 0:Oe.lastTurnEnd)!==void 0?(c(),u("button",{key:2,type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:ne},m(a(e)("lines.newChild")),1)):L("",!0),y.value&&((be=w.value)==null?void 0:be.id)!=="main"?(c(),u("button",{key:3,type:"button",class:"ui-button","data-variant":"ghost","data-size":"xs",onClick:X},m(a(e)("lines.end")),1)):L("",!0)])]),!l.value||!h.value||h.value.status==="loading"?(c(),u("div",Wd,[K(a(qt),{size:16,class:"is-spinning","aria-hidden":"true"}),d("span",null,m(a(e)("common.loading")),1)])):h.value.status==="failed"?(c(),u("div",Nd,[d("p",null,m(h.value.error||a(e)("lines.loadFailed")),1),d("button",{type:"button",class:"ui-button","data-variant":"secondary","data-size":"sm",onClick:B},[K(a(Zn),{"aria-hidden":"true"}),fe(m(a(e)("lines.retry")),1)])])):(c(),u(ee,{key:2},[K(fn,{rows:F.value,running:q.value,quotable:y.value&&!f.value&&b.value.length===0,branchable:y.value&&!f.value&&b.value.length===0,empty:a(e)("lines.empty"),variant:"panel",onBranch:P,onOpenLine:G,onQuote:R},null,8,["rows","running","quotable","branchable","empty"]),f.value?(c(),u("div",Bd,[(c(),se(dn,{key:JSON.stringify([f.value.branchId,f.value.requestId]),"session-id":s.sessionId,request:f.value,keyboard:v.value,"rules-available":T.value},null,8,["session-id","request","keyboard","rules-available"]))])):b.value.length?(c(),u("div",Vd,[(c(!0),u(ee,null,ue(b.value,Te=>(c(),se(hn,{key:JSON.stringify([Te.branchId,Te.requestId,Te.callId]),"session-id":s.sessionId,question:Te},null,8,["session-id","question"]))),128))])):y.value?(c(),se(ns,{key:2,ref_key:"composer",ref:r,running:q.value,stopping:z.value,model:l.value.model,send:x,"stores-pastes":((De=l.value)==null?void 0:De.methods.includes("attachment.put"))===!0,"search-files":$.value,stop:j,"model-selectable":!1,"select-model":re,placeholder:a(e)("lines.placeholder"),"create-branch":a(o).supports("session.branch_create")?H:void 0,"open-lines":()=>a(i).openLines(s.sessionId),variant:"panel"},{status:je(()=>[d("span",Ud,"⑂ "+m(a(Ct)(a(e),I.value)),1)]),_:1},8,["running","stopping","model","stores-pastes","search-files","placeholder","create-branch","open-lines"])):(c(),u("div",Hd,[d("span",null,"⑂ "+m(a(Ct)(a(e),I.value)),1),d("span",null,m(a(e)("lines.readOnly")),1)]))],64))],8,Od)}}}),Gd=xe(Kd,[["__scopeId","data-v-3c2b2d7d"]]),Qd={class:"lines-tree"},Jd={key:0,class:"lines-empty"},Yd={class:"lines-empty-icon","aria-hidden":"true"},Xd=["aria-label"],Zd=["data-depth","data-active"],eu=["data-tone"],tu={class:"lines-name"},su={class:"lines-meta"},nu=["aria-label","disabled","onClick"],ou=["data-tone"],iu={class:"lines-name"},au={class:"lines-meta"},ru={key:0},lu={class:"lines-id"},cu={key:1},du=["aria-label","onClick"],uu=ve({__name:"LinesTree",props:{sessionId:{}},setup(s){const t=s,{t:e}=pe(),n=Pe(),o=ze(),i=C(()=>n.views[t.sessionId]),r=C(()=>{var y;return((y=i.value)==null?void 0:y.lines)??[]}),l=C(()=>r.value.some(y=>y.id!=="main"));function h(y){y.id==="main"||y.state.kind==="creation-failed"||(n.ensureLine(t.sessionId,y.id),o.openLine(t.sessionId,y.id))}function w(y){return y.id!=="main"&&(y.state.kind==="working"||y.state.kind==="waiting")}function f(y){var _;return((_=i.value)==null?void 0:_.approvals.some(I=>I.branchId===y.id))===!0}function v(y){return f(y)?"warning":ts(y.state)}function b(y){o.requestEndLine({sessionId:t.sessionId,branchId:y.id,purpose:Qe(e,y,y.id)})}function T(y){return y.cut===null?"":e("lines.afterMessage",{count:y.cut.messages})}function $(y){if(y.parentId===null)return"";const _=r.value.find(I=>I.id===y.parentId);return _===void 0?dt(y.parentId):Qe(e,_,y.parentId)}return(y,_)=>(c(),u("div",Qd,[l.value?(c(),u("ol",{key:1,class:"lines-list","aria-label":a(e)("lines.title")},[(c(!0),u(ee,null,ue(r.value,I=>(c(),u("li",{key:I.id,class:"lines-row","data-depth":I.depth,"data-active":I.id!=="main"&&a(o).activeLineTab[s.sessionId]===I.id},[I.id==="main"?(c(),u(ee,{key:0},[d("span",{class:"lines-state","data-tone":v(I),"aria-hidden":"true"},null,8,eu),d("span",tu,m(a(e)("lines.main")),1),d("span",su,m(a(e)("lines.mainHint")),1)],64)):(c(),u(ee,{key:1},[d("button",{type:"button",class:"lines-open","aria-label":a(e)("lines.openLine",{name:a(Qe)(a(e),I,I.id)}),disabled:I.state.kind==="creation-failed",onClick:O=>h(I)},[d("span",{class:"lines-state","data-tone":v(I),"aria-hidden":"true"},null,8,ou),d("span",iu,m(a(Qe)(a(e),I,I.id)),1),d("span",au,[I.cut!==null?(c(),u("span",ru,m(T(I))+" · ",1)):L("",!0),d("span",lu,m(a(dt)(I.id)),1),I.parentId!=="main"?(c(),u("span",cu," · "+m(a(e)("lines.from",{name:$(I)})),1)):L("",!0),d("span",null," · "+m(a(Ct)(a(e),I.state)),1)])],8,nu),w(I)?(c(),u("button",{key:0,type:"button",class:"ui-button lines-end","data-variant":"ghost","data-size":"xs","aria-label":a(e)("lines.endLine",{name:a(Qe)(a(e),I,I.id)}),onClick:O=>b(I)},m(a(e)("lines.end")),9,du)):L("",!0)],64))],8,Zd))),128))],8,Xd)):(c(),u("div",Jd,[d("span",Yd,[K(a(nt),{size:28})]),d("strong",null,m(a(e)("lines.emptyTitle")),1),d("p",null,m(a(e)("lines.emptyHint")),1)]))]))}}),pu=xe(uu,[["__scopeId","data-v-20db3419"]]),hu=["aria-label"],mu={class:"lines-tabs"},vu=["aria-label"],fu=["aria-selected"],gu={class:"lines-tab-title"},bu={key:0,class:"ui-badge","data-size":"sm"},yu=["aria-selected","onClick"],wu={class:"lines-tab-title"},ku={class:"lines-tab-id"},_u=["data-tone"],Iu=["aria-label","onClick"],$u={class:"lines-tab-actions"},xu=["aria-label"],Su=["aria-label"],Cu=["aria-label"],Mu={class:"lines-body"},Tu={key:0,class:"lines-loading",role:"status"},Eu=ve({__name:"LinesPanel",props:{sessionId:{}},setup(s){const t=s,{t:e}=pe(),n=Pe(),o=ze(),i=gt(),r=C(()=>n.views[t.sessionId]),l=C(()=>o.lineTabs[t.sessionId]??[]),h=C(()=>o.activeLineTab[t.sessionId]),w=C(()=>{var F;return((F=r.value)==null?void 0:F.lines.filter(q=>q.id!==oe).length)??0});function f(F){var q;return(q=r.value)==null?void 0:q.lines.find(z=>z.id===F)}function v(F){return Qe(e,f(F),F)}function b(F){var z;if(((z=r.value)==null?void 0:z.approvals.some(x=>x.branchId===F))===!0)return"warning";const q=f(F);return q===void 0?void 0:ts(q.state)}function T(F){var z,x;const q=(z=r.value)==null?void 0:z.branches[F];return(q==null?void 0:q.running)===!0||((x=r.value)==null?void 0:x.approvals.some(R=>R.branchId===F))===!0}function $(F){var z;const q=(z=f(F))==null?void 0:z.state.kind;return T(F)||q==="ended-itself"||q==="ended-by-operation"||q==="ended-with"||q==="creation-failed"}function y(){o.openLines(t.sessionId)}function _(F){n.ensureLine(t.sessionId,F),o.activateLine(t.sessionId,F)}function I(F){o.closeLineTab(t.sessionId,F)}function O(){var q;const F=(q=r.value)==null?void 0:q.lastTurnEnd;if(F===void 0){i.push({tone:"info",title:e("lines.noFinishedTurn")});return}o.requestNewLine({sessionId:t.sessionId,parentBranchId:oe,at:F,text:""})}function D(F){if(F.key!=="ArrowLeft"&&F.key!=="ArrowRight")return;const q=[void 0,...l.value],z=q.findIndex(R=>R===h.value),x=q[(z+(F.key==="ArrowRight"?1:-1)+q.length)%q.length];F.preventDefault(),x===void 0?y():_(x)}return(F,q)=>{const z=st("tooltip");return c(),u("div",{class:"lines-panel",role:"region","aria-label":a(e)("lines.panelAria")},[d("header",mu,[d("div",{class:"lines-tablist",role:"tablist","aria-label":a(e)("lines.title"),onKeydown:D},[d("button",{type:"button",class:Ae(["lines-tab",{"is-active":h.value===void 0}]),role:"tab","aria-selected":h.value===void 0,onClick:y},[K(a(Kn),{size:14,"aria-hidden":"true"}),d("span",gu,m(a(e)("lines.title")),1),w.value>0?(c(),u("span",bu,m(w.value),1)):L("",!0)],10,fu),(c(!0),u(ee,null,ue(l.value,x=>(c(),u("div",{key:x,class:Ae(["lines-tab-wrap",{"is-active":h.value===x}])},[d("button",{type:"button",class:"lines-tab",role:"tab","aria-selected":h.value===x,onClick:R=>_(x)},[K(a(nt),{size:14,"aria-hidden":"true",class:Ae({"is-running":T(x)})},null,8,["class"]),d("span",wu,m(v(x)),1),d("span",ku,m(a(dt)(x)),1),$(x)?(c(),u("span",{key:0,class:"lines-tab-dot","data-tone":b(x),"aria-hidden":"true"},null,8,_u)):L("",!0)],8,yu),d("button",{type:"button",class:"lines-tab-close","aria-label":a(e)("lines.closeTab"),onClick:ke(R=>I(x),["stop"])},[K(a(lt),{size:12,"aria-hidden":"true"})],8,Iu)],2))),128))],40,vu),d("div",$u,[$e((c(),u("button",{type:"button",class:"ui-icon-button","data-variant":"ghost","data-size":"sm","aria-label":a(e)("lines.newLine"),onClick:O},[K(a(Jt),{"aria-hidden":"true"})],8,xu)),[[z,a(e)("lines.newLine")]]),$e((c(),u("button",{type:"button",class:"ui-icon-button","data-variant":"ghost","data-size":"sm","aria-label":a(o).detailExpanded?a(e)("lines.collapse"):a(e)("lines.expand"),onClick:q[0]||(q[0]=x=>a(o).detailExpanded=!a(o).detailExpanded)},[a(o).detailExpanded?(c(),se(a(Qn),{key:0,"aria-hidden":"true"})):(c(),se(a(Gn),{key:1,"aria-hidden":"true"}))],8,Su)),[[z,a(o).detailExpanded?a(e)("lines.collapse"):a(e)("lines.expand")]]),$e((c(),u("button",{type:"button",class:"ui-icon-button","data-variant":"ghost","data-size":"sm","aria-label":a(e)("lines.closePanel"),onClick:q[1]||(q[1]=(...x)=>a(o).closeDetail&&a(o).closeDetail(...x))},[K(a(lt),{"aria-hidden":"true"})],8,Cu)),[[z,a(e)("lines.closePanel")]])])]),d("div",Mu,[!r.value||r.value.status==="loading"?(c(),u("div",Tu,m(a(e)("common.loading")),1)):h.value===void 0?(c(),se(pu,{key:1,"session-id":s.sessionId},null,8,["session-id"])):(c(),se(Gd,{key:h.value,"session-id":s.sessionId,"branch-id":h.value},null,8,["session-id","branch-id"]))])],8,hu)}}}),Au=xe(Eu,[["__scopeId","data-v-0d1de807"]]),Lu={class:"ui-dialog-header"},qu={class:"ui-dialog-icon","data-tone":"primary"},Ou={class:"ui-dialog-title"},Ru={class:"ui-dialog-description"},Pu={class:"new-line-cut"},zu=["aria-label"],Du={class:"new-line-label",for:"new-line-prompt"},Fu=["placeholder"],ju={key:0,class:"ui-banner","data-tone":"danger",role:"alert"},Wu={class:"ui-dialog-footer"},Nu=["disabled"],Bu=["disabled"],Vu=ve({__name:"NewLineDialog",setup(s){const{t}=pe(),e=Pe(),n=ze(),o=A(),i=A(""),r=A(""),l=A(!1),h=C(()=>n.newLine),w=C(()=>{var _;const $=h.value;if($===void 0)return"";if($.parentBranchId===oe)return t("lines.main");const y=(_=e.views[$.sessionId])==null?void 0:_.lines.find(I=>I.id===$.parentBranchId);return y===void 0?dt($.parentBranchId):Qe(t,y,$.parentBranchId)}),f=C(()=>{var _;const $=h.value;if($===void 0)return"";const y=$.before??((_=$.text.split(`
|
|
247
|
+
`)[0])==null?void 0:_.trim())??"";return y===""?t("lines.atEnd"):t("lines.beforeMessage",{message:y})});function v(){var $;i.value=(($=h.value)==null?void 0:$.text)??"",r.value="",l.value=!1}ye(h,v,{immediate:!0}),Ue(()=>{var $;return($=o.value)==null?void 0:$.showModal()});function b(){var $;($=o.value)==null||$.close()}async function T(){const $=h.value;if($===void 0||l.value)return;const y=i.value.trim();if(y===""){r.value=t("lines.promptRequired");return}l.value=!0,r.value="";try{const _=await e.createLine($.sessionId,$.parentBranchId,$.at,y);n.openLine($.sessionId,_),b()}catch(_){r.value=_ instanceof Error?_.message:String(_)}finally{l.value=!1}}return($,y)=>(c(),u("dialog",{ref_key:"dialog",ref:o,class:"ui-dialog","data-size":"md",onCancel:ke(b,["prevent"]),onClose:y[1]||(y[1]=_=>a(n).closeNewLine())},[h.value?(c(),u("form",{key:0,onSubmit:ke(T,["prevent"])},[d("header",Lu,[d("span",qu,[K(a(nt),{size:16,"aria-hidden":"true"})]),d("div",null,[d("h2",Ou,m(a(t)("lines.newLineTitle")),1),d("p",Ru,[fe(m(a(t)("lines.newLineFrom",{name:w.value})),1),y[2]||(y[2]=d("br",null,null,-1)),d("span",Pu,m(f.value),1)])]),d("button",{type:"button",class:"ui-icon-button ui-dialog-close","data-variant":"close","data-size":"sm","aria-label":a(t)("common.close"),onClick:b},[...y[3]||(y[3]=[d("span",{"aria-hidden":"true"},"×",-1)])],8,zu)]),d("label",Du,m(a(t)("lines.promptLabel")),1),$e(d("textarea",{id:"new-line-prompt","onUpdate:modelValue":y[0]||(y[0]=_=>i.value=_),class:"ui-field new-line-input",rows:"4",placeholder:a(t)("lines.promptPlaceholder"),autofocus:""},null,8,Fu),[[$t,i.value]]),r.value?(c(),u("p",ju,m(r.value),1)):L("",!0),d("footer",Wu,[d("button",{type:"button",class:"ui-button","data-variant":"ghost","data-size":"md",disabled:l.value,onClick:b},m(a(t)("common.cancel")),9,Nu),d("button",{type:"submit",class:"ui-button","data-variant":"primary","data-size":"md",disabled:l.value||i.value.trim()===""},m(l.value?a(t)("common.loading"):a(t)("lines.create")),9,Bu)])],32)):L("",!0)],544))}}),Uu=xe(Vu,[["__scopeId","data-v-dd14ac7e"]]),Hu=["data-mode","data-sidebar-collapsed","data-chat-route","data-settings-route"],Ku={key:0,class:"compact-header"},Gu=["aria-label"],Qu={class:"compact-title"},Ju={class:"sr-only"},Yu=["aria-label"],Xu=["data-has-detail","data-detail-expanded"],Zu=["aria-label"],ep=["aria-label"],tp={key:1,class:"main-header"},sp={key:2,class:"reconnect-banner",role:"status"},np=["aria-label","aria-valuenow"],op=["aria-label"],Ds="details.session-menu[open], details.composer-popover[open]",ip=ve({__name:"AppShell",setup(s){const t=At(),{t:e}=pe(),{t:n}=pe({messages:Xt}),o=Ee(),i=Re(),r=ze(),l=A(),h=A();let w;const f=C(()=>t.path==="/settings"||t.path.startsWith("/settings/")),v=C(()=>t.name==="chat-new"||t.name==="chat-session"),b=C(()=>typeof t.params.sessionId=="string"?t.params.sessionId:void 0),T=C(()=>r.detailOpen&&t.name==="chat-session"&&b.value!==void 0),$=C(()=>{if(f.value)return n("settings");if(t.name==="chat-session"&&typeof t.params.sessionId=="string"){const q=i.byId.get(t.params.sessionId);return(q==null?void 0:q.preview)??(q===void 0?e("route.session"):Rt(q.cwd))}return t.name==="not-found"?e("route.notFound"):e("route.newSession")});ye($,q=>{document.title=`${q} — Dim`},{immediate:!0}),ye(()=>r.drawerOpen,async q=>{await Be();const z=h.value;z!==void 0&&(q&&!z.open?z.showModal():!q&&z.open&&z.close())});function y(q){const z=q.target instanceof Node?q.target:void 0;for(const x of document.querySelectorAll(Ds))(z===void 0||!x.contains(z))&&(x.open=!1)}function _(q){if(q.key==="Escape"){for(const x of document.querySelectorAll(Ds))x.open=!1;return}(navigator.userAgent.includes("Mac")?q.metaKey:q.ctrlKey)&&!q.altKey&&!q.shiftKey&&q.key.toLowerCase()==="b"&&(q.preventDefault(),r.shellMode==="compact"?r.drawerOpen=!r.drawerOpen:r.sidebarCollapsed=!r.sidebarCollapsed)}function I(){o.phase==="connected"&&i.refresh()}Ue(()=>{l.value!==void 0&&(w=new ResizeObserver(([q])=>{q!==void 0&&r.setShellWidth(q.contentRect.width)}),w.observe(l.value)),window.addEventListener("keydown",_),window.addEventListener("focus",I),document.addEventListener("pointerdown",y,!0)}),pt(()=>{w==null||w.disconnect(),window.removeEventListener("keydown",_),window.removeEventListener("focus",I),document.removeEventListener("pointerdown",y,!0)});function O(q){q.target===h.value&&(r.drawerOpen=!1)}function D(q){if(r.shellMode==="compact")return;const z=q.clientX,x=r.detailWidth,R=P=>{r.setDetailWidth(x+z-P.clientX)},j=()=>{window.removeEventListener("pointermove",R),window.removeEventListener("pointerup",j)};window.addEventListener("pointermove",R),window.addEventListener("pointerup",j,{once:!0})}function F(q){r.setDetailWidth(r.detailWidth+q)}return(q,z)=>{var R;const x=st("tooltip");return c(),u("div",{ref_key:"root",ref:l,class:"app-shell","data-mode":a(r).shellMode,"data-sidebar-collapsed":a(r).sidebarCollapsed,"data-chat-route":v.value,"data-settings-route":f.value,style:{"--sidebar-width":"280px"}},[K(ba),a(r).shellMode==="compact"&&!f.value?(c(),u("header",Ku,[d("button",{class:"ui-icon-button","data-variant":"ghost","data-size":"md",type:"button","aria-label":a(e)("sidebar.openMenu"),onClick:z[0]||(z[0]=j=>a(r).drawerOpen=!0)},[K(a(Vs),{"aria-hidden":"true"})],8,Gu),d("span",Qu,m($.value),1)])):L("",!0),a(r).shellMode==="compact"?(c(),u("dialog",{key:1,ref_key:"drawer",ref:h,class:"drawer-content",onClick:O,onClose:z[3]||(z[3]=j=>a(r).drawerOpen=!1)},[d("h2",Ju,m(a(e)("sidebar.workspaces")),1),d("button",{autofocus:"",class:"ui-icon-button drawer-close","data-variant":"ghost","data-size":"md",type:"button","aria-label":a(e)("sidebar.closeMenu"),onClick:z[1]||(z[1]=j=>a(r).drawerOpen=!1)},[K(a(lt),{"aria-hidden":"true"})],8,Yu),K(Ms,{onNavigate:z[2]||(z[2]=j=>a(r).drawerOpen=!1)})],544)):L("",!0),a(r).shellMode!=="compact"&&!a(r).sidebarCollapsed&&!f.value?(c(),se(Ms,{key:2,class:"inline-sidebar"})):L("",!0),d("div",{class:"content-region","data-has-detail":T.value,"data-detail-expanded":a(r).detailExpanded,style:kt({"--detail-width":`${a(r).detailWidth}px`})},[d("main",{id:"main",class:"main-region","aria-label":a(e)("a11y.mainContent"),onPointerdown:z[5]||(z[5]=j=>a(r).detailFocused=!1),onFocusin:z[6]||(z[6]=j=>a(r).detailFocused=!1)},[a(r).sidebarCollapsed&&a(r).shellMode!=="compact"&&!f.value?$e((c(),u("button",{key:0,class:"ui-icon-button sidebar-reopen","data-variant":"ghost","data-size":"md",type:"button","aria-label":a(e)("sidebar.openMenu"),onClick:z[4]||(z[4]=j=>a(r).sidebarCollapsed=!1)},[K(a(Yn),{"aria-hidden":"true"})],8,ep)),[[x,a(e)("sidebar.openMenu")]]):L("",!0),f.value?L("",!0):(c(),u("header",tp,[d("div",null,[d("p",null,"Dim "+m((R=a(o).hello)==null?void 0:R.serverVersion),1),d("strong",null,m($.value),1)])])),a(o).phase==="reconnecting"?(c(),u("p",sp,m(a(e)("page.reconnecting")),1)):L("",!0),(c(),se(a(En),{key:f.value?"settings":a(t).fullPath}))],40,Zu),T.value?(c(),u("div",{key:0,class:"detail-resizer",role:"separator","aria-orientation":"vertical","aria-label":a(e)("lines.resize"),"aria-valuenow":a(r).detailWidth,"aria-valuemin":320,"aria-valuemax":720,tabindex:"0",onPointerdown:ke(D,["prevent"]),onKeydown:[z[7]||(z[7]=ms(ke(j=>F(-16),["prevent"]),["left"])),z[8]||(z[8]=ms(ke(j=>F(16),["prevent"]),["right"]))]},null,40,np)):L("",!0),T.value&&b.value?(c(),u("aside",{key:1,class:"detail-region","data-active":"true","aria-label":a(e)("lines.panelAria"),onPointerdown:z[9]||(z[9]=j=>a(r).detailFocused=!0),onFocusin:z[10]||(z[10]=j=>a(r).detailFocused=!0)},[K(Au,{"session-id":b.value},null,8,["session-id"])],40,op)):L("",!0)],12,Xu),a(r).newLine?(c(),se(Uu,{key:3})):L("",!0),a(r).endingLine?(c(),se(Ta,{key:4})):L("",!0)],8,Hu)}}}),ap={class:"skip-link",href:"#main"},rp={key:1,id:"main",class:"boot-page",tabindex:"-1","aria-busy":"true"},lp={class:"sr-only"},cp={key:2,id:"main",class:"auth-page",tabindex:"-1"},dp={class:"eyebrow"},up={key:0},pp={key:1},hp=ve({__name:"AppRoot",setup(s){const{t}=pe(),e=Ee(),n=C(()=>e.everConnected&&e.phase!=="unauthenticated"&&e.phase!=="version-mismatch"),o=C(()=>e.phase==="unauthenticated"?t("auth.expiredTitle"):e.phase==="version-mismatch"?t("auth.versionTitle"):t("auth.connectingTitle"));return ye([n,o],([i,r])=>{i||(document.title=`${r} — Dim`)},{immediate:!0}),(i,r)=>(c(),u(ee,null,[d("a",ap,m(a(t)("common.skipToContent")),1),n.value?(c(),se(ip,{key:0})):a(e).phase==="connecting"||a(e).phase==="reconnecting"?(c(),u("main",rp,[K(Ot,{animated:"",class:"boot-mark"}),d("h1",lp,m(o.value),1)])):(c(),u("main",cp,[r[1]||(r[1]=d("span",{class:"auth-signal","aria-hidden":"true"},null,-1)),d("p",dp,m(a(t)("brand.webHost")),1),d("h1",null,m(o.value),1),a(e).phase==="unauthenticated"?(c(),u("p",up,[fe(m(a(t)("auth.expiredBefore")),1),r[0]||(r[0]=d("code",null,"dimcode web",-1)),fe(m(a(t)("auth.expiredAfter")),1)])):(c(),u("p",pp,m(a(t)("auth.versionDescription")),1))]))],64))}}),mp=400,vp=300,Fs=6,Nt=8,is="ui-tooltip";let Le,Ve,It,gn=0,Kt=null,as=!1;function fp(){return Le!==void 0||(Le=document.createElement("div"),Le.id=is,Le.className="ui-tooltip",Le.setAttribute("role","tooltip"),Le.popover="manual",Object.assign(Le.style,{position:"fixed",inset:"auto",margin:"0",border:"0",overflow:"visible"}),document.body.append(Le)),Le}function Et(s){clearTimeout(It);const t=s._tooltip;if(!t||!s.isConnected)return;const e=fp();e.textContent=t,e.matches(":popover-open")||e.showPopover(),Ve=s,s.getAttribute("aria-label")!==t&&s.setAttribute("aria-describedby",is),gp(s,e)}function gp(s,t){const e=s.getBoundingClientRect(),n=t.getBoundingClientRect(),o=e.top-Fs-n.height,i=o>=Nt?o:e.bottom+Fs,r=e.left+e.width/2-n.width/2,l=Math.min(Math.max(r,Nt),window.innerWidth-Nt-n.width);t.style.left=`${Math.round(l)}px`,t.style.top=`${Math.round(i)}px`}function Ye(){clearTimeout(It),It=void 0,Ve!==void 0&&(Ve.getAttribute("aria-describedby")===is&&Ve.removeAttribute("aria-describedby"),Ve=void 0,Le!=null&&Le.matches(":popover-open")&&Le.hidePopover())}function bp(s){const t=s.currentTarget;clearTimeout(It),!as&&(performance.now()<gn?Et(t):It=setTimeout(()=>Et(t),mp))}function yp(){Ve!==void 0&&(gn=performance.now()+vp),Ye()}function wp(s){const t=s.currentTarget;if(t===Kt){Kt=null;return}t.matches(":focus-visible")&&Et(t)}function kp(s){as=s.pointerType==="touch",Ve!==void 0&&!(s.target instanceof Node&&Ve.contains(s.target))&&Ye()}function _p(){Kt=document.activeElement,Ye()}function Ip(s){s.key==="Escape"&&Ye()}const js=[["mouseenter",bp],["mouseleave",yp],["focus",wp],["blur",Ye],["pointerdown",Ye],["keydown",Ip]];let Ws=!1;function $p(){Ws||(Ws=!0,window.addEventListener("scroll",Ye,{capture:!0,passive:!0}),window.addEventListener("blur",_p),document.addEventListener("pointermove",kp,{passive:!0}),document.addEventListener("pointerdown",s=>{as=s.pointerType==="touch"},{capture:!0,passive:!0}))}const xp={mounted(s,t){s._tooltip=t.value;for(const[e,n]of js)s.addEventListener(e,n);$p()},updated(s,t){s._tooltip=t.value,Ve===s&&(t.value?Et(s):Ye())},beforeUnmount(s){Ve===s&&Ye();for(const[t,e]of js)s.removeEventListener(t,e)}},Sp=["aria-label"],Cp={class:"queued-title"},Mp={class:"queued-list"},Tp={class:"queued-index"},Ep={class:"queued-text"},Ap=["disabled","onClick"],Lp=["disabled","onClick"],qp=ve({__name:"QueuedInputs",props:{sessionId:{},items:{}},setup(s){const t=s,{t:e}=pe(),n=Pe(),o=gt(),i=A(!1);async function r(l,h){if(!i.value){i.value=!0;try{(await n.withdrawInput(t.sessionId,l.id,h?l.user:void 0)).status==="notHeld"&&o.push({tone:"info",title:e("queue.notHeld")})}catch(w){o.push({tone:"danger",title:e("command.failed"),description:w instanceof Error?w.message:String(w)})}finally{i.value=!1}}}return(l,h)=>(c(),u("section",{class:"queued-inputs","aria-label":a(e)("queue.title")},[d("h2",Cp,m(a(e)("queue.title")),1),d("ol",Mp,[(c(!0),u(ee,null,ue(s.items,(w,f)=>(c(),u("li",{key:w.id,class:"queued-item"},[d("span",Tp,m(f+1),1),d("span",Ep,m(w.text),1),f===0?(c(),u("button",{key:0,type:"button",class:"ui-button","data-size":"sm","data-variant":"secondary",disabled:i.value,onClick:v=>r(w,!0)},m(a(e)("queue.steer")),9,Ap)):L("",!0),d("button",{type:"button",class:"ui-button","data-size":"sm","data-variant":"ghost",disabled:i.value,onClick:v=>r(w,!1)},m(a(e)("queue.remove")),9,Lp)]))),128))])],8,Sp))}}),Op=xe(qp,[["__scopeId","data-v-9a107f59"]]),Rp={key:0,class:"removed-state route-page"},Pp={"data-route-heading":"",tabindex:"-1"},zp={key:1,class:"removed-state route-page"},Dp={"data-route-heading":"",tabindex:"-1"},Fp={role:"alert"},jp={key:2,class:"chat-loading","aria-busy":"true"},Wp={class:"sr-only"},Np={key:3,class:"chat-page"},Bp={class:"chat-page-top"},Vp={class:"session-header"},Up=["aria-label"],Hp={class:"session-heading"},Kp=["title"],Gp=["title"],Qp=["aria-label"],Jp=["data-tone"],Yp={key:2,class:"ui-badge session-running","data-tone":"primary"},Xp={key:0,class:"composer-panel"},Zp={key:1,class:"composer-panel"},eh={key:2,class:"composer-panel question-prompts"},th=ve({__name:"ChatPage",props:{sessionId:{}},setup(s){const t=s,{t:e}=pe(),n=Pt(),o=Pe(),i=Ee(),r=Re(),l=ze(),h=gt(),w=Lt(),f=A();ye(()=>t.sessionId,p=>o.open(p),{immediate:!0});const v=C(()=>o.views[t.sessionId]),b=C(()=>r.byId.get(t.sessionId)),T=C(()=>{var p;return((p=b.value)==null?void 0:p.preview)??e("sidebar.untitled")}),$=C(()=>{var p;return(p=v.value)==null?void 0:p.approvals.find(S=>S.branchId===oe)}),y=C(()=>{var p;return((p=v.value)==null?void 0:p.questions.filter(S=>S.branchId===oe))??[]}),_=C(()=>i.supports("permission.rules")&&i.supports("permission.set_rules")),I=C(()=>{var p;return((p=v.value)==null?void 0:p.methods.includes("attachment.put"))===!0}),O=C(()=>{var p;return(p=v.value)!=null&&p.methods.includes("session.files.search")?S=>o.searchFiles(t.sessionId,S):void 0}),D=C(()=>{const p=v.value;if(!((p==null?void 0:p.status)!=="ready"||!p.methods.includes("session.permission.get")||!p.methods.includes("session.permission.update")))return{policy:p.permission,select:g}}),F=C(()=>{var p;return l.approvalKeyboard(t.sessionId,oe,((p=v.value)==null?void 0:p.approvals)??[])}),q=A(),z=C(()=>{var p;return((p=v.value)==null?void 0:p.lines.filter(S=>S.id!==oe).length)??0}),x=C(()=>{var S,U;const p=((S=v.value)==null?void 0:S.approvals)??[];return((U=v.value)==null?void 0:U.lines.some(Z=>Z.id!==oe&&(Z.state.kind==="working"||p.some(ie=>ie.branchId===Z.id))))??!1}),R=C(()=>{var p;return i.supports("session.branch_end")&&((p=v.value)==null?void 0:p.status)==="ready"}),j=C(()=>{var p;return i.supports("session.branch_create")&&((p=v.value)==null?void 0:p.status)==="ready"}),P=C(()=>{var U,Z,ie;const p=(U=v.value)==null?void 0:U.model;if(p===void 0)return;const S=(ie=(Z=n.providers)==null?void 0:Z.find(le=>le.providerId===p.providerId))==null?void 0:ie.models.find(le=>le.id===p.modelId);return S==null?void 0:S.reasoningEfforts});ye(()=>{var p;return(p=v.value)==null?void 0:p.status},p=>{p==="ready"&&n.load()},{immediate:!0});const G=C(()=>{const p=v.value;if((p==null?void 0:p.status)==="ready")return{compact:p.methods.includes("session.context.compact")?Oe:void 0,usage:p.methods.includes("session.context.usage")?De:void 0,fork:i.supports("session.fork")&&p.lastTurnEnd!==void 0?k:void 0,goal:p.methods.includes("session.goal.set")?ht:void 0,effort:P.value!==void 0&&P.value.length>0?Fe:void 0}});function X(p,S){return o.submit(t.sessionId,oe,p,S)}function ne(){return o.stop(t.sessionId,oe)}function H(p){return o.setModel(t.sessionId,p)}function B(p){o.ensureLine(t.sessionId,p),l.openLine(t.sessionId,p)}function re(p,S){l.requestNewLine({sessionId:t.sessionId,parentBranchId:oe,at:S,text:p})}async function W(p){var Z;const S=(Z=v.value)==null?void 0:Z.lastTurnEnd;if(S===void 0)throw new Error(e("lines.noFinishedTurn"));const U=await o.createLine(t.sessionId,oe,S,p);l.openLine(t.sessionId,U)}function te(p){h.push({tone:"danger",title:e("command.failed"),description:p instanceof Error?p.message:String(p)})}async function Oe(){try{const p=await o.compact(t.sessionId);p.status==="completed"?h.push({tone:"success",title:e("command.compacted")}):h.push({tone:"info",title:e("command.compactSkipped"),description:p.reason})}catch(p){te(p)}}function be(p){const S=Math.round(p.estimatedInputTokens),U=Math.round(p.contextWindow);return e("command.usage",{input:S.toLocaleString(),window:U.toLocaleString(),percent:U>0?Math.floor(S*100/U):0,basis:p.baselineSource==="provider_baseline"?e("command.basisProvider"):e("command.basisEstimated"),output:Math.round(p.outputTokens).toLocaleString(),threshold:Math.round(p.thresholdTokens).toLocaleString()})}async function De(){try{h.push({tone:"info",title:e("command.usageTitle"),description:be(await o.usage(t.sessionId))})}catch(p){te(p)}}function Te(p){switch(p.kind){case"active":return e("goal.status.active");case"paused":return e("goal.status.paused",{reason:p.reason.replaceAll("_"," ")});case"completed":return e("goal.status.completed");case"blocked":return e("goal.status.blocked");case"none":return e("goal.status.none")}}function We(p){if(p===void 0){h.push({tone:"info",title:e("goal.none")});return}h.push({tone:"info",title:`${e("goal.line",{status:Te(p.status)})}${p.evaluator?` · ${e("goal.evaluator")}`:""}`,description:p.objective})}async function ht(p){var ie;const S=ei(p);if(S===void 0){h.push({tone:"info",title:e("goal.usage")});return}const U=(ie=v.value)==null?void 0:ie.goal,Z=si(S,U);if(Z===void 0){We(U);return}try{await o.writeGoal(t.sessionId,Z,ti(S)),h.push({tone:"success",title:e("goal.sent",{action:e(`goal.action.${Z}`)})})}catch(le){te(le)}}async function Fe(p){const S=P.value,U=p.trim();if(S===void 0){h.push({tone:"info",title:e("command.effortUnavailable")});return}if(U===""){h.push({tone:"info",title:e("command.effortChoices",{choices:S.join(", ")})});return}if(/\s/.test(U)){h.push({tone:"info",title:e("command.effortUsage")});return}if(!S.includes(U)){h.push({tone:"danger",title:e("command.effortUnknown")});return}try{const Z=await o.setEffort(t.sessionId,U);h.push({tone:"success",title:e("command.effortSet",{outcome:Z,value:U})})}catch(Z){te(Z)}}async function g(p){try{await o.setPermission(t.sessionId,p)==="conflict"&&h.push({tone:"info",title:e("permission.conflict")})}catch(S){te(S)}}async function k(){var S,U;const p=(S=v.value)==null?void 0:S.lastTurnEnd;if(p!==void 0&&await((U=f.value)==null?void 0:U.open(e("fork.confirm"),{confirmLabel:e("fork.confirmLabel")})))try{const Z=await o.fork(t.sessionId,p);r.refresh(),await w.push({name:"chat-session",params:{sessionId:Z}})}catch(Z){te(Z)}}return(p,S)=>{var U,Z;return((U=v.value)==null?void 0:U.status)==="closed"?(c(),u("section",Rp,[d("h1",Pp,m(a(e)("chat.removedTitle")),1),d("p",null,m(a(e)("chat.removedDescription")),1),K(a(at),{to:"/chat/new"},{default:je(()=>[fe(m(a(e)("sidebar.newSession")),1)]),_:1})])):((Z=v.value)==null?void 0:Z.status)==="failed"?(c(),u("section",zp,[d("h1",Dp,m(T.value),1),d("p",Fp,m(v.value.error),1)])):!v.value||v.value.status==="loading"?(c(),u("section",jp,[d("h1",Wp,m(a(e)("route.session")),1),K(Ot,{animated:"",class:"boot-mark"}),d("p",null,m(a(e)("common.loading")),1)])):(c(),u("section",Np,[K(pn,{ref_key:"forkConfirm",ref:f},null,512),d("div",Bp,[d("header",Vp,[a(l).shellMode==="compact"?(c(),u("button",{key:0,class:"ui-icon-button session-nav","data-variant":"ghost","data-size":"md",type:"button","aria-label":a(e)("sidebar.openMenu"),onClick:S[0]||(S[0]=ie=>a(l).drawerOpen=!0)},[K(a(Vs),{"aria-hidden":"true"})],8,Up)):L("",!0),d("div",Hp,[b.value?(c(),u(ee,{key:0},[d("span",{class:"workspace-crumb",title:b.value.cwd},m(a(Rt)(b.value.cwd)),9,Kp),S[3]||(S[3]=d("span",{class:"workspace-crumb-separator","aria-hidden":"true"},"/",-1))],64)):L("",!0),d("h1",{"data-route-heading":"",tabindex:"-1",title:T.value},m(T.value),9,Gp)]),a(i).supports("session.branch_end")?(c(),u("button",{key:1,class:"ui-button session-lines","data-variant":"ghost","data-size":"sm",type:"button","aria-label":a(e)("lines.open"),onClick:S[1]||(S[1]=ie=>a(l).toggleLines(s.sessionId))},[K(a(nt),{"aria-hidden":"true"}),d("span",null,m(a(e)("lines.title")),1),z.value>0?(c(),u("span",{key:0,class:"ui-badge","data-size":"sm","data-tone":x.value?"warning":void 0},m(z.value),9,Jp)):L("",!0)],8,Qp)):L("",!0),v.value.sessionRunning?(c(),u("span",Yp,[S[4]||(S[4]=d("span",{class:"status-dot","data-state":"running","aria-hidden":"true"},null,-1)),fe(m(a(e)(v.value.stopping?"status.stopping":"status.running")),1)])):L("",!0)])]),K(fn,{rows:v.value.rows,running:v.value.running,quotable:!$.value&&y.value.length===0,branchable:R.value&&!$.value&&y.value.length===0,onBranch:re,onOpenLine:B,onQuote:S[2]||(S[2]=ie=>{var le;return(le=q.value)==null?void 0:le.quote(ie)})},null,8,["rows","running","quotable","branchable"]),v.value.running&&v.value.queued.length?(c(),u("div",Xp,[K(Op,{"session-id":s.sessionId,items:v.value.queued},null,8,["session-id","items"])])):L("",!0),$.value?(c(),u("div",Zp,[(c(),se(dn,{key:JSON.stringify([$.value.branchId,$.value.requestId]),"session-id":s.sessionId,request:$.value,keyboard:F.value,"rules-available":_.value},null,8,["session-id","request","keyboard","rules-available"]))])):y.value.length?(c(),u("div",eh,[(c(!0),u(ee,null,ue(y.value,ie=>(c(),se(hn,{key:JSON.stringify([ie.branchId,ie.requestId,ie.callId]),"session-id":s.sessionId,question:ie},null,8,["session-id","question"]))),128))])):(c(),se(ns,{key:3,ref_key:"composer",ref:q,running:v.value.running,stopping:v.value.stopping,model:v.value.model,send:X,"stores-pastes":I.value,"search-files":O.value,permission:D.value,stop:ne,"model-selectable":a(i).supports("session.model.update"),"select-model":H,"create-branch":j.value?W:void 0,"open-lines":R.value?()=>a(l).openLines(s.sessionId):void 0,"session-commands":G.value},null,8,["running","stopping","model","stores-pastes","search-files","permission","model-selectable","create-branch","open-lines","session-commands"]))]))}}}),sh=xe(th,[["__scopeId","data-v-8d82edb3"]]),nh={class:"new-session-page"},oh={class:"new-session-hero"},ih={"data-route-heading":"",tabindex:"-1"},ah={class:"ui-button","data-variant":"ghost","data-size":"xs","data-trailing":""},rh={class:"workspace-trigger-label"},lh={class:"composer-popover-content workspace-menu-content ui-popover","data-width":"lg"},ch=["placeholder","aria-label"],dh=["disabled"],uh={key:0,class:"ui-menu-separator"},ph=["aria-label"],hh=["aria-selected","onClick"],mh={class:"ui-menu-desc workspace-path"},vh=ve({__name:"NewSessionPage",setup(s){const{t}=pe(),e=At(),n=Lt(),o=Re(),i=Pe(),r=Pt(),l=A(),h=A(typeof e.query.cwd=="string"?e.query.cwd:""),w=A("");ye(()=>o.workspaces,_=>{h.value===""&&_[0]!==void 0&&(h.value=_[0].cwd)},{immediate:!0});const f=A(),v=A();ye(h,async _=>{if(v.value=void 0,_==="")return;const I=await r.defaultFor(_);h.value===_&&(v.value=I)},{immediate:!0});const b=C(()=>f.value??v.value);function T(_){h.value=_,l.value&&(l.value.open=!1)}function $(){const _=w.value.trim();_!==""&&(T(_),w.value="")}async function y(_){if(h.value==="")throw new Error(t("newThread.workspaceRequired"));const I=await o.create(h.value,f.value);i.open(I),await i.submit(I,oe,_),await n.push({name:"chat-session",params:{sessionId:I}})}return(_,I)=>{const O=st("tooltip");return c(),u("section",nh,[d("div",oh,[K(Ot,{class:"new-session-mark"}),d("h1",ih,m(a(t)("newThread.title")),1)]),K(ns,{class:"is-new-thread",running:!1,model:b.value,"model-selectable":!0,send:y,attachments:!1,"select-model":D=>{f.value=D}},{status:je(()=>[d("details",{ref_key:"menu",ref:l,class:"composer-popover workspace-menu"},[$e((c(),u("summary",ah,[K(a(Ut),{"aria-hidden":"true"}),d("span",rh,m(h.value?a(Rt)(h.value):a(t)("newThread.selectWorkspace")),1),K(a(Qt),{class:"workspace-chevron","aria-hidden":"true"})])),[[O,h.value||void 0]]),d("div",lh,[d("form",{class:"workspace-path-form",onSubmit:ke($,["prevent"])},[$e(d("input",{"onUpdate:modelValue":I[0]||(I[0]=D=>w.value=D),class:"ui-field","data-size":"sm",type:"text",spellcheck:"false",autocapitalize:"off",placeholder:a(t)("newThread.pathPlaceholder"),"aria-label":a(t)("newThread.pathLabel")},null,8,ch),[[$t,w.value]]),d("button",{type:"submit",class:"ui-button","data-variant":"secondary","data-size":"sm",disabled:w.value.trim()===""},m(a(t)("newThread.usePath")),9,dh)],32),a(o).workspaces.length?(c(),u("hr",uh)):L("",!0),d("div",{class:"workspace-list",role:"listbox","aria-label":a(t)("sidebar.workspaces")},[(c(!0),u(ee,null,ue(a(o).workspaces,D=>(c(),u("button",{key:D.cwd,type:"button",role:"option",class:"ui-menu-item","data-two-line":"","aria-selected":D.cwd===h.value,onClick:F=>T(D.cwd)},[K(a(Ut),{"aria-hidden":"true"}),d("span",null,[fe(m(D.name),1),d("span",mh,m(D.cwd),1)]),D.cwd===h.value?(c(),se(a(rt),{key:0,class:"ui-menu-check","aria-hidden":"true"})):L("",!0)],8,hh))),128))],8,ph)])],512)]),_:1},8,["model","select-model"])])}}}),fh=xe(vh,[["__scopeId","data-v-7f82e7e9"]]),gh={class:"chat-loading","aria-busy":"true"},bh=ve({__name:"RootRedirect",setup(s){const{t}=pe(),e=Lt(),n=Re(),o=ze();return ye(()=>n.loaded||n.error!=="",i=>{if(!i)return;const r=o.lastSessionId;e.replace(r!==void 0&&n.byId.has(r)?{name:"chat-session",params:{sessionId:r}}:{name:"chat-new"})},{immediate:!0}),(i,r)=>(c(),u("section",gh,[d("p",null,m(a(t)("common.loading")),1)]))}}),yh={class:"route-page app-scroll-viewport"},wh={"data-route-heading":"",tabindex:"-1"},kh={class:"page-description"},_h=ve({__name:"NotFoundView",setup(s){const{t}=pe();return(e,n)=>(c(),u("section",yh,[K(a(Nn),{size:20,class:"state-icon","aria-hidden":"true"}),d("h1",wh,m(a(t)("route.notFound")),1),d("p",kh,m(a(t)("page.notFoundDescription")),1),K(a(at),{to:"/chat/new"},{default:je(()=>[fe(m(a(t)("sidebar.newSession")),1)]),_:1})]))}}),bn=An({history:Ln(),routes:[{path:"/",name:"root",component:bh},{path:"/chat/new",name:"chat-new",component:fh},{path:"/chat/:sessionId",name:"chat-session",component:sh,props:!0},{path:"/settings",component:()=>Se(()=>import("./SettingsPage-DmhRtj9e.js"),__vite__mapDeps([2,1,3,4])),children:[{path:"",name:"settings-index",component:{render:()=>null}},{path:"account",name:"settings-account",component:()=>Se(()=>import("./AccountSettings-CuNxjb5M.js"),__vite__mapDeps([5,1,6,7,3,8]))},{path:"appearance",name:"settings-appearance",component:()=>Se(()=>import("./AppearanceSettings-BImLkd19.js"),__vite__mapDeps([9,6,1,10]))},{path:"agent",name:"settings-agent",component:()=>Se(()=>import("./AgentSettings-B1kyVC9H.js"),__vite__mapDeps([11,1,6,12,3]))},{path:"providers",name:"settings-providers",component:()=>Se(()=>import("./ProviderSettings-A8WG9V7m.js"),__vite__mapDeps([13,1,7,3,4,14]))},{path:"providers/new",name:"settings-provider-new",component:()=>Se(()=>import("./ProviderSettings-A8WG9V7m.js"),__vite__mapDeps([13,1,7,3,4,14]))},{path:"providers/:providerId",name:"settings-provider-detail",component:()=>Se(()=>import("./ProviderSettings-A8WG9V7m.js"),__vite__mapDeps([13,1,7,3,4,14]))},{path:"modality",name:"settings-modality",component:()=>Se(()=>import("./ModalitySettings-BpFvRd--.js"),__vite__mapDeps([15,1,6,12,3]))},{path:"mcp/:serverId?",name:"settings-mcp",component:()=>Se(()=>import("./McpSettings-y4Wzg8CT.js"),__vite__mapDeps([16,1,6,12,3,17]))},{path:"plugins/:pluginId?",name:"settings-plugins",component:()=>Se(()=>import("./PluginSettings-BF6eSPEd.js"),__vite__mapDeps([18,1,6,12,3,19]))},{path:"skills/:skillId?",name:"settings-skills",component:()=>Se(()=>import("./SkillSettings-CZ98gDWn.js"),__vite__mapDeps([20,1,6,12,3,21]))},{path:"permissions/:page?",name:"settings-permissions",component:()=>Se(()=>import("./PermissionsSettings-DQV3cdej.js"),__vite__mapDeps([22,1,6,12,3,23]))},{path:"archived",name:"settings-archived",component:()=>Se(()=>import("./ArchivedSettings-C6UPMqfk.js"),__vite__mapDeps([24,1,6,12,3,25]))},{path:"diagnostics",name:"settings-diagnostics",component:()=>Se(()=>import("./DiagnosticsSettings-YSRtq2dI.js"),__vite__mapDeps([26,1,6,12,3,27]))}]},{path:"/:pathMatch(.*)*",name:"not-found",component:_h}]});bn.afterEach(s=>{s.name==="chat-session"&&typeof s.params.sessionId=="string"&&(ze().lastSessionId=s.params.sessionId)});ye(ft.global.locale,s=>{document.documentElement.lang=s},{immediate:!0});const Mt=qn();ze(Mt);Promise.all([Ho(),nn(on(Mt).language||navigator.language)]).then(()=>{Ee(Mt).client.start(),On(hp).use(Mt).use(ft).use(bn).directive("tooltip",xp).mount("#app"),setTimeout(()=>void vn(),0)});export{Nh as A,Ot as B,Bh as C,Re as D,Fh as E,jh as F,Wh as G,Bs as H,Jt as I,Tt as J,on as K,ze as L,qe as P,Ze as R,Yt as S,ro as W,lt as X,Se as _,Pt as a,Sh as b,ce as c,Ch as d,mi as e,fi as f,Vh as g,pn as h,Xe as i,os as j,xe as k,Ph as l,zh as m,Dh as n,Oh as o,Rh as p,qh as q,xh as r,Xt as s,Th as t,Ee as u,Lh as v,Ah as w,Mh as x,Eh as y,vi as z};
|