meshy-node 0.3.7 → 0.3.8
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/README.md +1 -1
- package/dashboard/assets/DashboardPage-BGDwH7LG.js +119 -0
- package/dashboard/assets/{DashboardShared-CGZZTe4C.js → DashboardShared-C3sx-Aj3.js} +4 -4
- package/dashboard/assets/{DiffTab-DoG4Hq6_.js → DiffTab-DF380dMh.js} +3 -3
- package/dashboard/assets/{FilesTab-BX-UYwna.js → FilesTab-DZ2CIfBe.js} +1 -1
- package/dashboard/assets/{PreviewTab-DnhQ_cTw.js → PreviewTab-DGzp5vs_.js} +2 -2
- package/dashboard/assets/SharedConversationPage-6Y6HiGBv.js +7 -0
- package/dashboard/assets/{file-CFaB5QBp.js → file-CkjhxpTi.js} +1 -1
- package/dashboard/assets/{folder-DhIVX8_W.js → folder-DcAuKKJN.js} +1 -1
- package/dashboard/assets/index-DfiptIs_.css +1 -0
- package/dashboard/assets/{index-Bb1MuUmE.js → index-U21aiFFx.js} +56 -51
- package/dashboard/assets/{input-CgtqVNV3.js → input-BA2z1FFh.js} +1 -1
- package/dashboard/index.html +2 -2
- package/main.cjs +569 -309
- package/package.json +1 -1
- package/runtime-metadata.json +5 -5
- package/dashboard/assets/DashboardPage-DqRPTnH6.js +0 -119
- package/dashboard/assets/SharedConversationPage--7Zq1FFl.js +0 -12
- package/dashboard/assets/index-CmW82hgD.css +0 -1
package/package.json
CHANGED
package/runtime-metadata.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "meshy-node",
|
|
3
|
-
"packageVersion": "0.3.
|
|
3
|
+
"packageVersion": "0.3.8",
|
|
4
4
|
"packages": {
|
|
5
5
|
"workspace": {
|
|
6
6
|
"name": "meshy",
|
|
7
|
-
"version": "0.3.
|
|
7
|
+
"version": "0.3.8"
|
|
8
8
|
},
|
|
9
9
|
"node": {
|
|
10
10
|
"name": "meshy-node",
|
|
11
|
-
"version": "0.3.
|
|
11
|
+
"version": "0.3.8"
|
|
12
12
|
},
|
|
13
13
|
"core": {
|
|
14
14
|
"name": "@meshy/core",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"url": "https://github.com/ai-microsoft/meshy",
|
|
28
|
-
"branch": "
|
|
29
|
-
"commit": "
|
|
28
|
+
"branch": "supportTerminal",
|
|
29
|
+
"commit": "373ec48"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-BX-UYwna.js","assets/index-Bb1MuUmE.js","assets/index-CmW82hgD.css","assets/folder-DhIVX8_W.js","assets/file-CFaB5QBp.js","assets/PreviewTab-DnhQ_cTw.js","assets/input-CgtqVNV3.js","assets/DiffTab-DoG4Hq6_.js","assets/DashboardShared-CGZZTe4C.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as pe,r as s,j as e,a as $a,b as A,d as Ba,e as Oa,D as ws,f as za,g as Cs,B as Le,h as Ua,i as L,X as Ve,k as Va,l as Ka,C as He,m as qa,n as Ha,F as Wa,S as he,o as Ze,p as Ga,q as Ja,t as ce,s as ye,u as we,v as De,w as Ce,x as Ot,y as st,T as zt,z as Ss,A as Ya,E as Xa,G as _s,H as Es,I as We,J as Ts,K as Ds,L as Ms,P as Qa,M as As,N as ze,O as Za,Q as Ue,R as kt,U as yt,V as wt,W as Ct,Y as St,Z as _t,_ as Et,$ as Tt,a0 as Ut,a1 as er,a2 as tr,a3 as sr,a4 as Ls,a5 as Ps,a6 as Rs,a7 as ar,a8 as ct,a9 as rr,aa as Vt,ab as nr,ac as Fs,ad as ls,ae as or,af as lr,ag as ir,ah as dr,ai as cr,aj as ur,ak as xr,al as mr,am as hr,an as pr,ao as is,ap as fr,aq as gr,ar as br,as as vr,at as Is,au as jr,av as Nr,aw as kr,ax as yr,ay as wr,az as Cr,aA as Sr,aB as _r,aC as Er,aD as Tr,aE as Dr,aF as Mr,aG as Ar,aH as Lr,aI as Pr,aJ as Rr,aK as Fr,aL as Ir,aM as $r,aN as Br,aO as Or}from"./index-Bb1MuUmE.js";import{r as ds,e as zr,b as $s,t as Bs,L as ve,C as cs,a as Ur,T as jt,D as qe,I as Re,M as Dt,c as Os,m as zs,d as Us,f as Vr,g as us,h as Kr,i as qr,j as Nt,k as Hr,n as Wr,l as Gr}from"./DashboardShared-CGZZTe4C.js";import{I as $e}from"./input-CgtqVNV3.js";import{F as Jr,C as et}from"./folder-DhIVX8_W.js";/**
|
|
3
|
-
* @license lucide-react v1.7.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 Yr=[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]],Xr=pe("archive",Yr);/**
|
|
8
|
-
* @license lucide-react v1.7.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 Qr=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Zr=pe("arrow-up",Qr);/**
|
|
13
|
-
* @license lucide-react v1.7.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 en=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],tn=pe("flag",en);/**
|
|
18
|
-
* @license lucide-react v1.7.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 sn=[["path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",key:"sc7q7i"}]],an=pe("funnel",sn);/**
|
|
23
|
-
* @license lucide-react v1.7.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 rn=[["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"}]],xs=pe("git-branch",rn);/**
|
|
28
|
-
* @license lucide-react v1.7.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 nn=[["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"}]],on=pe("globe",nn);/**
|
|
33
|
-
* @license lucide-react v1.7.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
|
-
*/const ln=[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Mt=pe("history",ln);/**
|
|
38
|
-
* @license lucide-react v1.7.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 dn=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],At=pe("image-plus",dn);/**
|
|
43
|
-
* @license lucide-react v1.7.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 cn=[["path",{d:"M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z",key:"1pdavp"}],["path",{d:"M20.054 15.987H3.946",key:"14rxg9"}]],un=pe("laptop",cn);/**
|
|
48
|
-
* @license lucide-react v1.7.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 xn=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],Kt=pe("link-2",xn);/**
|
|
53
|
-
* @license lucide-react v1.7.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 mn=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M12 8v6",key:"1ib9pf"}],["path",{d:"M9 11h6",key:"1fldmi"}]],qt=pe("message-square-plus",mn);/**
|
|
58
|
-
* @license lucide-react v1.7.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 hn=[["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"}]],Vs=pe("panel-left-close",hn);/**
|
|
63
|
-
* @license lucide-react v1.7.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 pn=[["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"}]],fn=pe("panel-left-open",pn);/**
|
|
68
|
-
* @license lucide-react v1.7.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 gn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]],Ht=pe("panel-right-close",gn);/**
|
|
73
|
-
* @license lucide-react v1.7.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 bn=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]],Ks=pe("panel-right-open",bn);/**
|
|
78
|
-
* @license lucide-react v1.7.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 vn=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],at=pe("pencil",vn);/**
|
|
83
|
-
* @license lucide-react v1.7.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 jn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Nn=pe("plus",jn);/**
|
|
88
|
-
* @license lucide-react v1.7.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 kn=[["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"}]],yn=pe("rotate-ccw",kn);/**
|
|
93
|
-
* @license lucide-react v1.7.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 wn=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Lt=pe("search",wn);/**
|
|
98
|
-
* @license lucide-react v1.7.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 Cn=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],qs=pe("send",Cn);/**
|
|
103
|
-
* @license lucide-react v1.7.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 Sn=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],_n=pe("share-2",Sn);/**
|
|
108
|
-
* @license lucide-react v1.7.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 En=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],Tn=pe("sliders-horizontal",En);/**
|
|
113
|
-
* @license lucide-react v1.7.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 Dn=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Mn=pe("trash-2",Dn),An=new Set(["assigned","running"]);function Ln(t,a){return t.reduce((n,r)=>r.assignedTo===a&&An.has(r.status)?n+1:n,0)}function Je(t){return(t==null?void 0:t.toLowerCase())==="devtunnel"}function Pn(t){return t?Je(t)?"DevTunnel":t.charAt(0).toUpperCase()+t.slice(1):"Direct"}function Wt(t,a){return Je(a??t.transportType)||!!t.devtunnelEndpoint}function Hs(t,a){return!Je(a??t.transportType)}function Ws(t,a){const n=a??t.transportType;return Je(n)?"DevTunnel":t.devtunnelEndpoint?"Direct + DevTunnel":Pn(n)}function ms(t,a){return!t&&!a}function Rn({routeTaskId:t,creatingTask:a,internalSelectedTaskId:n,sortedTaskIds:r}){return t||(a?null:n??r[0]??null)}function Fn(t,a){return[a,...t.filter(n=>n.id!==a.id)]}function In(t,a){const n=a.taskId,r=a.updates;return typeof n!="string"||!r||typeof r!="object"?t:t.map(d=>d.id===n?{...d,...r}:d)}const $n=new Set(["completed","failed","cancelled","archived"]);function Bn(t,a){const n=new Set(a);return new Set(Array.from(t).filter(r=>n.has(r)))}function On(t,a){const n=new Set(a);if(n.size===0)return!1;const r=t.filter(d=>n.has(d.id));return r.length===n.size&&r.every(d=>$n.has(d.status))}function zn(t,a){var r;const n=new Set(a);return((r=t.find(d=>!n.has(d.id)))==null?void 0:r.id)??null}var Un=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Vn=Un.reduce((t,a)=>{const n=$a(`Primitive.${a}`),r=s.forwardRef((d,o)=>{const{asChild:c,...g}=d,f=c?n:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(f,{...g,ref:o})});return r.displayName=`Primitive.${a}`,{...t,[a]:r}},{}),Kn="Label",Gs=s.forwardRef((t,a)=>e.jsx(Vn.label,{...t,ref:a,onMouseDown:n=>{var d;n.target.closest("button, input, select, textarea")||((d=t.onMouseDown)==null||d.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Gs.displayName=Kn;var Js=Gs;const qn=Ba("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),_e=s.forwardRef(({className:t,...a},n)=>e.jsx(Js,{ref:n,className:A(qn(),t),...a}));_e.displayName=Js.displayName;function Hn({onAdded:t}){const[a,n]=s.useState(""),[r,d]=s.useState(!1),[o,c]=s.useState(null),g=s.useCallback(async f=>{if(f.preventDefault(),!!a.trim()){d(!0),c(null);try{await Oa({leaderEndpoint:a.trim(),transport:"devtunnel"}),t()}catch(v){c(v instanceof Error?v.message:"Failed to join node")}finally{d(!1)}}},[a,t]);return e.jsx(ws,{className:"overflow-hidden border-border/60 bg-transparent p-0 shadow-none sm:max-w-xl",children:e.jsxs("div",{className:"overflow-hidden rounded-[28px] border border-border/60 bg-background/95 p-0 shadow-[0_40px_120px_-60px_rgba(0,0,0,0.88)] backdrop-blur-xl",children:[e.jsx("div",{className:"border-b border-border/60 px-6 py-5",children:e.jsxs(za,{className:"space-y-2 text-left",children:[e.jsx(Cs,{className:"text-2xl tracking-tight",children:"Join node"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Verify the remote leader's DevTunnel endpoint, sync this node's tasks to that leader, and join the cluster as a follower."})]})}),e.jsxs("form",{onSubmit:g,className:"space-y-4 px-6 py-5",children:[o&&e.jsx("div",{className:"rounded-[20px] border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:o}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(_e,{htmlFor:"leader-endpoint",children:"Leader endpoint"}),e.jsx(Le,{variant:"outline",className:"rounded-[11px] border-border/70 bg-background/60 text-[10px] uppercase tracking-[0.16em]",children:"DevTunnel only"})]}),e.jsx($e,{id:"leader-endpoint",type:"url",value:a,onChange:f=>n(f.target.value),placeholder:"https://your-leader.devtunnels.ms",className:"h-11 rounded-[18px] border-border/70 bg-background/70"})]}),e.jsx("div",{className:"rounded-[20px] border border-border/60 bg-background/45 px-4 py-3 text-sm text-muted-foreground",children:"This does not switch the local node transport or auto-enable a local DevTunnel. Leaving later will detach this node from the remote leader and make it leader of its own cluster again."}),e.jsx(Ua,{className:"border-t border-border/60 pt-4",children:e.jsx(L,{type:"submit",disabled:!a.trim()||r,className:"rounded-[16px]",children:r?"Joining...":"Join node"})})]})]})})}function Ys(){const[t,a]=s.useState([]),[n,r]=s.useState(null),d=s.useRef(null),o=s.useCallback(()=>{var j;(j=d.current)==null||j.click()},[]),c=s.useCallback(async j=>{const l=Array.from(j.target.files??[]);if(l.length!==0)try{const h=await ds(l);a(x=>[...x,...h]),r(null)}catch(h){r(h instanceof Error?h.message:"Failed to attach image")}finally{j.target.value=""}},[]),g=s.useCallback(async j=>{const l=zr(j.clipboardData);if(l.length!==0){j.preventDefault();try{const h=await ds(l);a(x=>[...x,...h]),r(null)}catch(h){r(h instanceof Error?h.message:"Failed to attach image")}}},[]),f=s.useCallback(j=>{a(l=>l.filter((h,x)=>x!==j))},[]),v=s.useCallback(()=>{a([]),r(null)},[]);return{images:t,error:n,fileInputRef:d,pickImages:o,handleFileChange:c,handlePaste:g,removeImage:f,clearImages:v}}function Wn({onSend:t,disabled:a,disabledReason:n="Chat is waiting on the agent.",placeholder:r="Send a follow-up message...",contextItems:d=[],running:o=!1,onStop:c}){const[g,f]=s.useState(""),v=s.useRef(null),{images:j,error:l,fileInputRef:h,pickImages:x,handleFileChange:y,handlePaste:C,removeImage:S,clearImages:k}=Ys(),N=s.useCallback(()=>{v.current&&(v.current.style.height="auto")},[]),W=s.useCallback(()=>{const M=$s(g,j);M.length===0||a||(t(M),f(""),k(),N())},[g,j,a,t,k,N]),B=s.useCallback(M=>{M.key==="Enter"&&!M.shiftKey&&(M.preventDefault(),W())},[W]),D=s.useCallback(()=>{v.current&&(v.current.style.height="auto",v.current.style.height=`${Math.min(v.current.scrollHeight,220)}px`)},[]),X=!a&&!o&&(g.trim().length>0||j.length>0),R=o&&!!c,O=o?c?"Task is running — click to stop":"Task is running...":a?n:"Enter sends, Shift+Enter adds a line";return e.jsxs("div",{className:"animate-composer-settle border-t border-border/45 bg-background/42 px-2 py-2 backdrop-blur-xl sm:px-4 sm:py-3",children:[d.length>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-1.5 px-2 pb-2.5",children:d.map(M=>e.jsxs("div",{className:"inline-flex max-w-full items-center gap-1.5 rounded-[13px] border border-border/60 bg-muted/40 px-2 py-1 text-[11px] shadow-sm",children:[e.jsx("span",{className:"shrink-0 text-[9px] font-medium uppercase tracking-[0.12em] text-muted-foreground/80",children:M.label}),e.jsx("span",{className:`truncate text-foreground/90 ${M.mono?"font-mono text-[11px]":""}`,children:M.value})]},`${M.label}:${M.value}`))}),e.jsxs("div",{className:"overflow-hidden rounded-[26px] border border-border/65 bg-card/88 shadow-[0_30px_92px_-62px_rgba(15,23,42,0.55)] backdrop-blur-xl sm:rounded-[30px] dark:shadow-[0_30px_92px_-62px_rgba(0,0,0,0.95)]",children:[e.jsx("input",{ref:h,type:"file",accept:"image/*",multiple:!0,onChange:y,className:"hidden"}),j.length>0&&e.jsx("div",{className:"px-2 pt-3 sm:px-6 sm:pt-6",children:e.jsx("div",{className:"flex flex-wrap gap-3",children:j.map((M,z)=>e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:Bs(M),alt:M.filename??`attachment ${z+1}`,className:"h-24 w-24 rounded-[22px] border border-border/70 object-cover"}),e.jsx("button",{type:"button",onClick:()=>S(z),className:"absolute -top-2 -right-2 flex h-7 w-7 items-center justify-center rounded-[12px] border border-border/70 bg-background text-muted-foreground shadow-sm transition-all hover:-translate-y-px hover:text-foreground","aria-label":`Remove ${M.filename??`image ${z+1}`}`,children:e.jsx(Ve,{className:"h-3.5 w-3.5"})})]},`${M.filename??"image"}-${z}`))})}),e.jsxs("div",{className:"flex items-end gap-1.5 px-2 pt-3 pb-3 sm:px-6 sm:pt-4 sm:pb-4",children:[e.jsx("textarea",{ref:v,value:g,onChange:M=>f(M.target.value),onKeyDown:B,onPaste:C,onInput:D,placeholder:r,disabled:a,rows:1,className:"min-h-[2.5rem] flex-1 resize-none bg-transparent px-0 py-1 text-[11px] leading-7 text-foreground placeholder:text-muted-foreground/70 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"}),e.jsxs(L,{type:"button",variant:"ghost",onClick:x,disabled:a,className:"mb-0.5 h-8 shrink-0 gap-1.5 rounded-[14px] px-2.5 text-[11px] text-muted-foreground hover:text-foreground sm:px-2.5",title:"Attach images",children:[e.jsx(At,{className:"h-4 w-4 sm:h-3.5 sm:w-3.5"}),e.jsx("span",{className:"hidden sm:inline",children:"Images"})]}),e.jsx("span",{title:O,children:e.jsx(L,{onClick:o?c:W,disabled:o?!R:!X,size:"icon","aria-label":o?"Stop running task":"Send message",className:"mb-0.5 h-8 w-10 shrink-0 rounded-[14px] bg-primary/90 text-primary-foreground shadow-[0_12px_30px_-18px_hsl(var(--primary)/0.95)] hover:bg-primary",children:o?e.jsx(ve,{className:"h-4 w-4 animate-spin"}):e.jsx(qs,{className:"h-4 w-4"})})})]}),l&&e.jsx("div",{className:"border-t border-destructive/20 bg-destructive/10 px-2 py-2 text-[11px] text-destructive sm:px-6 sm:py-3",children:l})]})]})}function Gn(t,a,n){return t!=="auto"?a.find(r=>r.id===t)??null:n.length===1?n[0]??null:null}function Jn(t){return t.trim()||"."}function Yn(t){return new Promise(a=>window.setTimeout(a,t))}function Xn(t){return!!t&&typeof t=="object"&&typeof t.createdBranch=="string"&&typeof t.currentBranch<"u"}async function Qn(t){let a=t;for(let n=0;n<60;n++){if(a.status==="succeeded"){if(Xn(a.result))return a.result;throw new Error("Branch creation completed without branch details")}if(a.status==="failed")throw new Error(a.error||"Branch creation failed");await Yn(1e3),a=await qa(a.id)}throw new Error("Timed out waiting for branch creation")}function hs({value:t,onChange:a,project:n,assignTo:r,nodes:d,assignableNodes:o,layout:c="default",chipClassName:g,chipActiveClassName:f,chipInactiveClassName:v,labelClassName:j,triggerClassName:l}){const[h,x]=s.useState(!1),[y,C]=s.useState(null),[S,k]=s.useState(""),[N,W]=s.useState(!1),[B,D]=s.useState(!1),[X,R]=s.useState(!1),[O,M]=s.useState(null),[z,ue]=s.useState(""),[T,J]=s.useState(""),[U,P]=s.useState(""),[le,Y]=s.useState(!1),V=s.useRef(null),ee=s.useRef(0),ie=s.useMemo(()=>Gn(r,d,o),[r,d,o]),I=ie==null?void 0:ie.id,ne=s.useMemo(()=>Jn(n),[n]),se=s.useMemo(()=>I?`${I}
|
|
118
|
-
${ne}`:"",[I,ne]),te=s.useCallback(async(m=0,E=!1)=>{const $=ee.current+1,Se=se;if(ee.current=$,!I){C(null),k("");return}M(null),E||k(""),E?D(!0):W(!0);try{const p=await Va(I,{path:ne,limit:20,offset:m,allowAbsolute:!0});if($!==ee.current)return;k(Se),C(xe=>E&&xe?{...p,branches:[...xe.branches,...p.branches]}:p)}catch(p){if($!==ee.current)return;M(p instanceof Error?p.message:"Failed to load branch info"),E||(C(null),k(""))}finally{$===ee.current&&(W(!1),D(!1))}},[I,se,ne]);s.useEffect(()=>{if(!I){ee.current+=1,C(null),k(""),M(null);return}te()},[I,ne,te]),s.useEffect(()=>{const m=t.trim(),E=S===se?y:null,$=E!=null&&E.available&&E.currentBranch?E.currentBranch:"";m!==$&&a($)},[y,se,S,a,t]),s.useEffect(()=>{if(!h)return;const m=$=>{V.current&&(V.current.contains($.target)||x(!1))},E=$=>{$.key==="Escape"&&x(!1)};return document.addEventListener("mousedown",m),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",E)}},[h]),s.useEffect(()=>{h&&(J(""),P(""),Y(!1))},[h,I,ne]);const oe=s.useCallback(async()=>{if(!I)return;const m=z.trim(),E=le?U.trim():T.trim();if(!(!m||!E)){R(!0),M(null);try{const $=await Ka(I,{path:ne,branchName:m,startPoint:E,limit:20,offset:0,allowAbsolute:!0}),Se=await Qn($);k(se),C(Se),a(Se.currentBranch??Se.createdBranch),ue(""),J(""),P(""),Y(!1),x(!1)}catch($){M($ instanceof Error?$.message:"Failed to create branch")}finally{R(!1)}}},[I,se,ne,le,U,z,a,T]),u=S===se?y:null,G=s.useCallback(()=>{u!=null&&u.hasMore&&te(u.branches.length,!0)},[u,te]),F=t.trim()||(u==null?void 0:u.currentBranch)||(u&&!u.available?"No git repo":"Branch"),je=le?U.trim():T.trim(),re=!!(u!=null&&u.available&&z.trim()&&je&&!X),ke=c==="composer"?e.jsxs(L,{type:"button",variant:"ghost",onClick:()=>x(m=>!m),title:F,"aria-label":`Branch: ${F}`,className:A(g,l,"min-w-0 max-w-full",t.trim()?f:v),children:[N&&!u?e.jsx(ve,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}):e.jsx(xs,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:A("min-w-0 truncate",j),children:F})]}):e.jsxs(L,{type:"button",variant:"outline",onClick:()=>x(m=>!m),className:"h-11 w-full justify-between rounded-2xl border-border/70 bg-background/70 px-4",title:F,children:[e.jsx("span",{className:A("truncate",t.trim()?"font-mono text-foreground":"text-muted-foreground"),children:F}),e.jsx("span",{className:"ml-3 shrink-0 text-xs text-muted-foreground",children:ie?ie.name:"Manual"})]});return e.jsxs("div",{className:A("relative inline-block",c==="composer"?"min-w-0 shrink-0":"w-full"),ref:V,children:[c==="default"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Branch"}),ke]}):ke,h&&e.jsxs("div",{className:A("absolute z-50 mt-2 w-[240px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 shadow-lg backdrop-blur",c==="composer"?"left-0":"left-0 right-0 w-auto min-w-[240px]"),children:[e.jsxs("div",{className:"flex items-center gap-2 border-b border-border/60 px-3 py-2",children:[e.jsx(xs,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-foreground",title:u!=null&&u.repoRoot?`${u.currentBranch??F} · ${u.repoRoot}`:(u==null?void 0:u.currentBranch)??F,children:(u==null?void 0:u.currentBranch)??F}),N?e.jsx(ve,{className:"h-3 w-3 shrink-0 animate-spin text-muted-foreground"}):null]}),ie?N&&!u?e.jsxs("div",{className:"flex items-center justify-center px-3 py-4 text-[11px] text-muted-foreground",children:[e.jsx(ve,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Loading..."]}):u&&!u.available?e.jsx("div",{className:"px-3 py-4 text-center text-[11px] text-muted-foreground",children:"Not a git repository."}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"space-y-2 px-3 py-2.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx($e,{value:z,onChange:m=>ue(m.target.value),placeholder:"New branch name",className:"h-8 flex-1 rounded-md border-border/60 bg-background/70 font-mono text-[11px]"}),e.jsx(L,{type:"button",size:"sm",onClick:()=>void oe(),disabled:!re,title:re?"Create branch":"Enter a name and pick a base","aria-label":"Create branch",className:"h-8 w-8 shrink-0 rounded-md p-0",children:X?e.jsx(ve,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Nn,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Base from"}),!le&&e.jsxs("button",{type:"button",onClick:()=>Y(!0),className:"flex items-center gap-1 rounded px-1 py-0.5 text-[10px] text-muted-foreground hover:bg-background/60 hover:text-foreground",children:[e.jsx(at,{className:"h-2.5 w-2.5"}),"Manual"]})]}),le?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx($e,{value:U,onChange:m=>P(m.target.value),placeholder:"upstream/release/1.0",className:"h-8 flex-1 rounded-md border-border/60 bg-background/70 font-mono text-[11px]"}),e.jsx("button",{type:"button",onClick:()=>{Y(!1),P("")},className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-background/60 hover:text-foreground",title:"Cancel manual input","aria-label":"Cancel manual input",children:e.jsx(Ve,{className:"h-3.5 w-3.5"})})]}):u!=null&&u.branches.length?e.jsxs("div",{className:"max-h-44 overflow-y-auto rounded-md border border-border/40 bg-background/40",children:[u.branches.map(m=>{const E=T===m.ref,$=m.branch==="main"||m.branch==="master";return e.jsxs("button",{type:"button",onClick:()=>J(m.ref),className:A("flex w-full items-center gap-2 border-b border-border/20 px-2.5 py-1.5 text-left text-[11px] last:border-b-0 hover:bg-background/60",E&&"bg-background/70"),title:m.ref,children:[e.jsx("span",{className:A("shrink-0 text-[10px]",$?"text-amber-500 dark:text-amber-400":"text-muted-foreground/60"),"aria-hidden":!0,children:$?"★":"·"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-foreground",children:m.ref}),E?e.jsx(He,{className:"h-3 w-3 shrink-0 text-primary"}):null]},m.ref)}),u.hasMore&&e.jsxs("button",{type:"button",onClick:G,disabled:B,className:"flex w-full items-center justify-center gap-1 border-t border-border/20 py-1 text-[10px] text-muted-foreground hover:bg-background/60 hover:text-foreground disabled:opacity-50",children:[B?e.jsx(ve,{className:"h-3 w-3 animate-spin"}):e.jsx(Mt,{className:"h-3 w-3"}),"Load more"]})]}):e.jsx("div",{className:"rounded-md border border-dashed border-border/40 px-2.5 py-2 text-[11px] text-muted-foreground",children:"No remote branches found."})]})]})}):e.jsx("div",{className:"px-3 py-4 text-center text-[11px] text-muted-foreground",children:"Select a specific node first."}),O&&e.jsx("div",{className:"border-t border-destructive/20 bg-destructive/10 px-3 py-1.5 text-[11px] text-destructive",children:O})]})]})}const Zn=20,eo=3,Pt="meshy-working-dir-recents-by-node";function to(t){return t.startsWith("/")||t.startsWith("\\\\")||/^[A-Za-z]:[\\/]/.test(t)}function so(t){const a=t.trim();return a||"."}function Rt(t){const a=[],n=new Set;for(const r of t){const d=r.trim();if(!(!d||n.has(d))&&(n.add(d),a.push(d),a.length===eo))break}return a}function ao(t,a){const n=a.trim();return Rt(n?[n,...t]:t)}function Xs(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const a={};for(const[n,r]of Object.entries(t)){if(!n||!Array.isArray(r))continue;const d=r.filter(c=>typeof c=="string"),o=Rt(d);o.length>0&&(a[n]=o)}return a}function ro(t,a,n){if(!a)return t;const r=t[a]??[],d=ao(r,n);if(d.length===0){if(!(a in t))return t;const{[a]:o,...c}=t;return c}return{...t,[a]:d}}function no(t,a){var n;return a?((n=t[a])==null?void 0:n[0])??"":""}function oo(t){if(!t||typeof window>"u")return"";try{const a=window.localStorage.getItem(Pt);return a?no(Xs(JSON.parse(a)),t):""}catch{return""}}function lo(t,a,n){return t!=="auto"?a.find(r=>r.id===t)??null:n.length===1?n[0]??null:null}function io(t,a){const n=a.trim();return n?to(n)||!t?n:`${t.replace(/[/\\]+$/,"")}/${n}`:""}function co(t,a){return t?t.isAbsolute?t.currentPath:t.currentPath==="."||t.currentPath===""?t.rootPath||(a==null?void 0:a.workDir)||"Node root":t.currentPath:(a==null?void 0:a.workDir)??"Node root"}function Ft({value:t,onChange:a,assignTo:n,nodes:r,assignableNodes:d,layout:o="default",chipClassName:c,chipActiveClassName:g,chipInactiveClassName:f,labelClassName:v,triggerClassName:j}){const[l,h]=s.useState(!1),[x,y]=s.useState(null),[C,S]=s.useState(!1),[k,N]=s.useState(!1),[W,B]=s.useState(null),[D,X]=s.useState(""),[R,O]=s.useState(!1),[M,z]=s.useState({}),ue=s.useRef(null),T=s.useMemo(()=>lo(n,r,d),[n,r,d]),J=T==null?void 0:T.id,U=s.useMemo(()=>J?M[J]??[]:[],[M,J]),P=s.useMemo(()=>t.trim()?io(T==null?void 0:T.workDir,t):"Use node default",[t,T==null?void 0:T.workDir]);s.useEffect(()=>{if(!(typeof window>"u"))try{const u=window.localStorage.getItem(Pt);if(!u)return;const G=JSON.parse(u);z(Xs(G))}catch{}},[]);const le=s.useCallback(u=>{J&&z(G=>{const F=ro(G,J,u);if(F===G)return G;if(typeof window<"u")try{window.localStorage.setItem(Pt,JSON.stringify(F))}catch{}return F})},[J]),Y=s.useCallback((u,G=!0)=>{const F=u.trim();a(F),G&&F&&le(F),h(!1)},[a,le]),V=s.useCallback(async(u,G=0,F=!1)=>{if(J){B(null),F?N(!0):S(!0);try{const je=await Ha(J,{path:u,limit:Zn,offset:G,directoriesOnly:!0,allowAbsolute:!0});y(re=>F&&re?{...je,entries:[...re.entries,...je.entries]}:je)}catch(je){B(je instanceof Error?je.message:"Failed to browse directories"),F||y(null)}finally{S(!1),N(!1)}}},[J]),ee=s.useRef(t);ee.current=t;const ie=s.useRef(V);ie.current=V,s.useEffect(()=>{if(!l)return;const u=ee.current;X(u),O(!1),y(null),B(null),J&&ie.current(so(u))},[l,J]),s.useEffect(()=>{if(!l)return;const u=F=>{ue.current&&(ue.current.contains(F.target)||h(!1))},G=F=>{F.key==="Escape"&&h(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",G),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",G)}},[l]);const I=s.useCallback(u=>{V(u)},[V]),ne=s.useCallback(()=>{x&&V(x.currentPath,x.entries.length,!0)},[x,V]),se=o==="composer"?e.jsxs(L,{type:"button",variant:"ghost",onClick:()=>h(u=>!u),title:P,"aria-label":`Working directory: ${P}`,className:A(c,j,"min-w-0 max-w-full",t.trim()?g:f),children:[e.jsx(Wa,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:A("min-w-0 truncate",v),children:P})]}):e.jsxs(L,{type:"button",variant:"outline",onClick:()=>h(u=>!u),className:"h-11 w-full justify-between rounded-2xl border-border/70 bg-background/70 px-4",title:P,children:[e.jsx("span",{className:A("truncate",t.trim()?"font-mono text-foreground":"text-muted-foreground"),children:P}),e.jsx("span",{className:"ml-3 shrink-0 text-xs text-muted-foreground",children:T?T.name:"Manual"})]}),te=co(x,T),oe=!!(x!=null&&x.parentPath);return e.jsxs("div",{className:A("relative inline-block",o==="composer"?"min-w-0 max-w-[60%] shrink":"w-full"),ref:ue,children:[o==="default"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Working directory"}),se]}):se,l&&e.jsxs("div",{className:A("absolute z-50 mt-2 w-[240px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 shadow-lg backdrop-blur",o==="composer"?"left-0":"left-0 right-0 w-auto min-w-[240px]"),children:[U.length>0&&e.jsxs("div",{className:"border-b border-border/60 px-3 py-2",children:[e.jsxs("div",{className:"mb-1 flex items-center gap-1 text-[10px] text-muted-foreground",children:[e.jsx(Mt,{className:"h-2.5 w-2.5"}),"Recent"]}),e.jsx("div",{className:"flex flex-col",children:U.map(u=>e.jsx("button",{type:"button",onClick:()=>Y(u),className:"truncate rounded px-1.5 py-0.5 text-left font-mono text-[11px] text-foreground hover:bg-background/60",title:u,children:u},u))})]}),e.jsxs("div",{className:"flex items-center gap-1.5 border-b border-border/60 px-2.5 py-1.5",children:[e.jsx("button",{type:"button",onClick:()=>(x==null?void 0:x.parentPath)&&I(x.parentPath),disabled:!oe||C,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-border/60 text-muted-foreground transition-colors hover:bg-background/60 hover:text-foreground disabled:opacity-40",title:"Parent directory",children:e.jsx(Zr,{className:"h-3 w-3"})}),e.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",title:te,children:te}),x&&e.jsx("button",{type:"button",onClick:()=>Y(x.isAbsolute?x.currentPath:x.currentPath==="."?"":x.currentPath),className:"shrink-0 rounded px-1.5 py-0.5 text-[10px] font-medium text-foreground hover:bg-background/60",title:"Use this folder",children:"Use"})]}),e.jsxs("div",{className:"max-h-56 overflow-y-auto",children:[T?C?e.jsxs("div",{className:"flex items-center justify-center px-3 py-4 text-[11px] text-muted-foreground",children:[e.jsx(ve,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Loading..."]}):x&&x.entries.length>0?e.jsxs(e.Fragment,{children:[x.entries.map(u=>e.jsxs("div",{className:"group flex items-stretch border-b border-border/30 last:border-b-0",children:[e.jsxs("button",{type:"button",onClick:()=>Y(u.path),className:"flex min-w-0 flex-1 items-center gap-2 px-2.5 py-1.5 text-left hover:bg-background/55",title:`Use ${u.path}`,children:[e.jsx(Jr,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate text-[11px] text-foreground",children:u.name})]}),e.jsx("button",{type:"button",onClick:()=>I(u.path),className:"flex w-9 shrink-0 items-center justify-center border-l border-border/30 text-muted-foreground hover:bg-background/70 hover:text-foreground",title:"Open subfolder","aria-label":`Open ${u.name}`,children:e.jsx(et,{className:"h-3.5 w-3.5"})})]},u.path)),x.hasMore&&e.jsxs("button",{type:"button",onClick:ne,disabled:k,className:"flex w-full items-center justify-center gap-1 border-t border-border/40 py-1 text-[10px] text-muted-foreground hover:bg-background/60 hover:text-foreground disabled:opacity-50",children:[k?e.jsx(ve,{className:"h-3 w-3 animate-spin"}):e.jsx(Mt,{className:"h-3 w-3"}),"Load more"]})]}):e.jsx("div",{className:"px-3 py-4 text-center text-[11px] text-muted-foreground",children:W??"No subfolders."}):e.jsx("div",{className:"px-3 py-4 text-center text-[11px] text-muted-foreground",children:"Select a node to browse."}),W&&x&&x.entries.length>0&&e.jsx("div",{className:"border-t border-border/60 px-3 py-1.5 text-[11px] text-destructive",children:W})]}),e.jsx("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background/40 px-2.5 py-1.5",children:R?e.jsxs(e.Fragment,{children:[e.jsx($e,{value:D,onChange:u=>X(u.target.value),onKeyDown:u=>{u.key==="Enter"&&D.trim()?(u.preventDefault(),Y(D)):u.key==="Escape"&&(u.preventDefault(),O(!1),X(t))},autoFocus:!0,placeholder:"Path (relative or absolute)",className:"h-7 flex-1 rounded-md border-border/60 bg-background/70 font-mono text-[11px]"}),e.jsx("button",{type:"button",onClick:()=>Y(D),disabled:!D.trim(),className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-foreground hover:bg-background/60 disabled:opacity-40",title:"Apply","aria-label":"Apply manual path",children:e.jsx(He,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>{O(!1),X(t)},className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-background/60 hover:text-foreground",title:"Cancel","aria-label":"Cancel manual path",children:e.jsx(Ve,{className:"h-3.5 w-3.5"})})]}):e.jsxs("button",{type:"button",onClick:()=>{X(t),O(!0)},className:"flex h-7 flex-1 items-center justify-between rounded-md px-1.5 text-[11px] text-muted-foreground hover:bg-background/60 hover:text-foreground",title:"Enter a manual path",children:[e.jsx("span",{children:"Manual input"}),e.jsx(at,{className:"h-3 w-3"})]})})]})]})}function Qs(t,a={}){const n=t.filter(r=>r.status==="online");return a.currentNodeRole!=="follower"||!a.leaderNodeId?n:n.filter(r=>r.id!==a.leaderNodeId)}function Gt({isCurrent:t}){return t?e.jsx(un,{className:"h-3.5 w-3.5 shrink-0 text-emerald-500 dark:text-emerald-400","aria-label":"current node"}):e.jsx(on,{className:"h-3.5 w-3.5 shrink-0 text-sky-500 dark:text-sky-400","aria-label":"remote follower node"})}function It(t,a){return t.map(n=>{const r=!!a&&n.id===a;return e.jsx(he,{value:n.id,children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(Gt,{isCurrent:r}),e.jsx("span",{className:"truncate",children:n.name}),e.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:r?"current":"remote"})]})},n.id)})}function uo(t){var r;const a=t.sessionId.trim(),n=t.cwd.trim();return!a||!n||!t.assignTo?null:{title:t.title.trim()||((r=t.defaultTitle)==null?void 0:r.trim())||void 0,agent:t.agent,sessionId:a,cwd:n,assignTo:t.assignTo,priority:t.priority,mode:t.mode??Ze}}function xo(){return zt.map(t=>e.jsx(he,{value:t.value,children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{children:t.label}),t.description&&e.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:t.description})]})},t.value))}function mo(t){if(!t)return"unknown time";const a=Date.parse(t);return Number.isNaN(a)?t:new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(a)}function ho({nodes:t,currentNodeRole:a,currentNodeId:n,leaderNodeId:r,onCreated:d,onCancel:o,className:c,footerClassName:g,submitLabel:f="Load session",cancelLabel:v="Cancel",autoFocus:j=!1}){const l=s.useMemo(()=>Qs(t,{currentNodeRole:a,leaderNodeId:r}),[t,a,r]),h=s.useMemo(()=>{var m;return n&&l.some(E=>E.id===n)?n:((m=l[0])==null?void 0:m.id)??""},[l,n]),[x,y]=s.useState(""),[C,S]=s.useState("codex"),[k,N]=s.useState(""),[W,B]=s.useState(""),[D,X]=s.useState(""),[R,O]=s.useState(h),[M,z]=s.useState("normal"),[ue,T]=s.useState(Ze),[J,U]=s.useState(!1),[P,le]=s.useState([]),[Y,V]=s.useState(!1),[ee,ie]=s.useState(null),I=s.useMemo(()=>P.find(m=>m.sessionId===k)??null,[P,k]);s.useEffect(()=>{R&&l.some(m=>m.id===R)||O(h)},[R,l,h]),s.useEffect(()=>{N(""),B(""),X("")},[C,R]),s.useEffect(()=>{let m=!1;return R?(V(!0),ie(null),Ga(R,{agent:C,limit:50}).then(E=>{m||le(E.sessions)}).catch(E=>{m||(le([]),ie(E instanceof Error?E.message:"Failed to load native sessions"))}).finally(()=>{m||V(!1)}),()=>{m=!0}):(le([]),ie(null),V(!1),()=>{m=!0})},[C,R]),s.useEffect(()=>{I&&(B(I.sessionId),X(I.cwd))},[I]);const ne=s.useCallback(async m=>{m.preventDefault();const E=uo({title:x,defaultTitle:I==null?void 0:I.summary,agent:C,sessionId:W,cwd:D,assignTo:R,priority:M,mode:ue});if(E){U(!0);try{const $=await Ja(E);d($)}catch($){ce.error($ instanceof Error?$.message:"Failed to load native session")}finally{U(!1)}}},[x,I,C,W,D,R,M,ue,d]),se=!!(W.trim()&&D.trim()&&R),[te,oe]=s.useState(!1),[u,G]=s.useState(""),F=l.find(m=>m.id===R)??null,je=!!(n&&(F==null?void 0:F.id)===n),re=s.useMemo(()=>{const m=u.trim().toLowerCase();return m?P.filter(E=>E.summary.toLowerCase().includes(m)||E.sessionId.toLowerCase().includes(m)||E.cwd.toLowerCase().includes(m)):P},[P,u]),ke="h-9 w-auto gap-1.5 rounded-[15px] border-border/60 bg-background/60 px-3 text-xs shadow-none transition-colors hover:bg-background/80";return e.jsxs("form",{onSubmit:ne,className:A("space-y-4",c),children:[e.jsxs("div",{className:"rounded-[26px] border border-border/60 bg-background/54 shadow-[0_24px_86px_-48px_rgba(15,23,42,0.55)] backdrop-blur-xl dark:shadow-[0_24px_86px_-48px_rgba(0,0,0,0.9)]",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border/50 px-4 py-3",children:[e.jsxs(ye,{value:R,onValueChange:O,children:[e.jsx(we,{className:A(ke),"aria-label":"Node",children:F?e.jsxs(e.Fragment,{children:[e.jsx(Gt,{isCurrent:je}),e.jsx("span",{className:"max-w-[10rem] truncate",children:F.name})]}):e.jsx(De,{placeholder:"Node"})}),e.jsx(Ce,{children:It(l,n)})]}),e.jsxs(ye,{value:C,onValueChange:m=>S(m),children:[e.jsxs(we,{className:A(ke),"aria-label":"Agent",children:[e.jsx(Ot,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{children:C})]}),e.jsxs(Ce,{children:[e.jsx(he,{value:"codex",children:"codex"}),e.jsx(he,{value:"claudecode",children:"claudecode"})]})]}),e.jsxs("div",{className:"relative ml-auto min-w-0 flex-1 sm:max-w-56",children:[e.jsx(Lt,{className:"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx($e,{value:u,onChange:m=>G(m.target.value),placeholder:"Filter sessions",className:"h-9 rounded-[15px] border-border/60 bg-background/60 pl-9 text-xs shadow-none"})]})]}),e.jsxs("div",{className:"px-3 py-3",children:[e.jsx("div",{className:"flex items-center justify-between px-1 pb-2",children:e.jsx(_e,{className:"text-[10px] font-medium uppercase tracking-[0.2em] text-muted-foreground",children:Y?"Loading...":`${re.length} session${re.length===1?"":"s"}`})}),e.jsxs("div",{className:"relative h-88 overflow-hidden rounded-[20px]",children:[Y&&e.jsx("div",{className:"absolute inset-x-0 top-0 z-10 h-0.5 overflow-hidden bg-primary/10",children:e.jsx("div",{className:"h-full w-1/3 animate-indeterminate-bar bg-primary/70"})}),e.jsxs("div",{className:"h-full space-y-1.5 overflow-y-auto pr-1 pt-1",children:[!R&&e.jsx("div",{className:"rounded-[18px] border border-dashed border-border/60 bg-background/35 px-4 py-6 text-center text-xs text-muted-foreground",children:"Pick a node to load its recent sessions."}),R&&!Y&&re.length===0&&e.jsx("div",{className:"rounded-[18px] border border-dashed border-border/60 bg-background/35 px-4 py-6 text-center text-xs text-muted-foreground",children:P.length===0?"No recent sessions on this node. Use Manual session ID under More options.":"No sessions match your filter."}),re.map(m=>{const E=m.sessionId===k;return e.jsxs("button",{type:"button",onClick:()=>N(m.sessionId),className:A("flex w-full flex-col gap-1 rounded-[18px] border px-3 py-2.5 text-left transition-all duration-200 hover:-translate-y-px",E?"border-primary/45 bg-primary/9 shadow-[0_18px_60px_-44px_hsl(var(--primary)/0.95)]":"border-border/55 bg-background/40 hover:border-border hover:bg-background/65"),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:A("h-2 w-2 shrink-0 rounded-full",E?"bg-primary":"bg-border")}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:m.summary}),e.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.16em] text-muted-foreground",children:mo(m.updatedAt)})]}),e.jsxs("div",{className:"flex items-center gap-2 pl-4 text-[10px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:m.sessionId.slice(0,12)}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-border"}),e.jsx("span",{className:"truncate font-mono",children:m.cwd})]})]},m.sessionId)})]})]}),ee&&e.jsx("p",{className:"px-1 pt-2 text-[11px] text-destructive",children:ee})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",onClick:()=>oe(m=>!m),className:"flex w-full items-center gap-2 text-[11px] font-medium uppercase tracking-[0.2em] text-muted-foreground transition-colors hover:text-foreground","aria-expanded":te,children:[e.jsx("span",{className:"h-px flex-1 bg-border/60","aria-hidden":!0}),e.jsx("span",{className:"shrink-0",children:te?"Less options":"More options"}),e.jsx(st,{className:A("h-3.5 w-3.5 shrink-0 transition-transform",te&&"rotate-180")}),e.jsx("span",{className:"h-px flex-1 bg-border/60","aria-hidden":!0})]}),te&&e.jsxs("div",{className:"space-y-4 rounded-[22px] border border-border/60 bg-background/35 p-4",children:[e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_e,{htmlFor:"native-session-id",className:"text-xs font-medium text-muted-foreground",children:"Session ID"}),e.jsx($e,{id:"native-session-id",type:"text",value:W,onChange:m=>{N(""),B(m.target.value)},placeholder:"ses_... or thread_...",autoFocus:j,className:"h-10 rounded-[16px] border-border/70 bg-background/70 font-mono text-xs"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_e,{htmlFor:"native-session-title",className:"text-xs font-medium text-muted-foreground",children:"Task title"}),e.jsx($e,{id:"native-session-title",type:"text",value:x,onChange:m=>y(m.target.value),placeholder:"Optional",className:"h-10 rounded-[16px] border-border/70 bg-background/70 text-sm"})]})]}),e.jsx(Ft,{value:D,onChange:m=>{N(""),X(m)},assignTo:R,nodes:t,assignableNodes:l}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_e,{className:"text-xs font-medium text-muted-foreground",children:"Mode"}),e.jsxs(ye,{value:ue,onValueChange:m=>T(m),children:[e.jsx(we,{className:"h-10 rounded-[16px] border-border/70 bg-background/70 text-sm",children:e.jsx(De,{placeholder:"Select mode"})}),e.jsx(Ce,{children:xo()})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_e,{className:"text-xs font-medium text-muted-foreground",children:"Priority"}),e.jsxs(ye,{value:M,onValueChange:z,children:[e.jsx(we,{className:"h-10 rounded-[16px] border-border/70 bg-background/70 text-sm",children:e.jsx(De,{placeholder:"Select priority"})}),e.jsxs(Ce,{children:[e.jsx(he,{value:"low",children:"Low"}),e.jsx(he,{value:"normal",children:"Normal"}),e.jsx(he,{value:"high",children:"High"}),e.jsx(he,{value:"critical",children:"Critical"})]})]})]})]})]})]}),e.jsxs("div",{className:A("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",g),children:[o&&e.jsx(L,{type:"button",variant:"ghost",onClick:o,className:"rounded-[16px]",children:v}),e.jsx(L,{type:"submit",disabled:!se||J,className:"rounded-[16px] px-5",children:J?e.jsxs(e.Fragment,{children:[e.jsx(ve,{className:"h-4 w-4 animate-spin"})," Loading..."]}):f})]})]})}function ps(){return Ss.map(t=>e.jsx(he,{value:t.value,disabled:t.disabled,children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{children:t.label}),t.description&&e.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:t.description})]})},t.value))}function fs(){return zt.map(t=>e.jsx(he,{value:t.value,children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx("span",{children:t.label}),t.description&&e.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:t.description})]})},t.value))}function po(t){var a;return((a=Ss.find(n=>n.value===t))==null?void 0:a.label)??t}function fo(t){var a;return((a=zt.find(n=>n.value===t))==null?void 0:a.label)??t}function Zs(t,a,n=!1){const r=t.trim();if(r)return r;const d=a.trim().split(`
|
|
119
|
-
`).map(o=>o.trim()).find(Boolean);return d?d.length>72?`${d.slice(0,69).trimEnd()}...`:d:n?"Image task":""}function go(t){var c;const a=t.title.trim(),n=Zs(t.title,t.description,t.images.length>0),r=t.description.trim()||n,d=t.mode??Ze,o=$s(t.description,t.images);return!n||!r||!t.agent?null:{title:n,description:r,agent:t.agent,project:t.project.trim()||null,branch:((c=t.branch)==null?void 0:c.trim())||null,payload:{initialMessage:o,mode:d,titleSource:a?"manual":"derived"},priority:t.priority,assignTo:t.assignTo==="auto"?void 0:t.assignTo}}function bo({nodes:t,currentNodeRole:a,currentNodeId:n,leaderNodeId:r,onCreated:d,onCancel:o,className:c,footerClassName:g,submitLabel:f="Create chat",cancelLabel:v="Cancel",autoFocus:j=!1,layout:l="default"}){const[h,x]=s.useState(""),[y,C]=s.useState(""),[S,k]=s.useState("claudecode"),[N,W]=s.useState(Ze),[B,D]=s.useState(""),[X,R]=s.useState(""),[O,M]=s.useState("normal"),z=s.useMemo(()=>Qs(t,{currentNodeRole:a,leaderNodeId:r}),[t,a,r]),ue=s.useMemo(()=>{var w;return n&&z.some(Z=>Z.id===n)?n:((w=z[0])==null?void 0:w.id)??""},[z,n]),[T,J]=s.useState(ue),[U,P]=s.useState(!1),[le,Y]=s.useState(!1),{images:V,error:ee,fileInputRef:ie,pickImages:I,handleFileChange:ne,handlePaste:se,removeImage:te}=Ys(),oe=s.useMemo(()=>z.find(w=>w.id===T)??null,[T,z]),u=!!(n&&(oe==null?void 0:oe.id)===n),G=po(S),F=fo(N);s.useEffect(()=>{T&&z.some(w=>w.id===T)||J(ue)},[T,z,ue]),s.useEffect(()=>{D(oo(T)),R("")},[T]),s.useEffect(()=>{R("")},[B]);const je=s.useCallback(async w=>{w.preventDefault();const Z=go({title:h,description:y,agent:S,project:B,branch:X,priority:O,assignTo:T,mode:N,images:V});if(Z){P(!0);try{const be=await Xa(Z);d(be)}catch(be){ce.error(be instanceof Error?be.message:"Failed to create task")}finally{P(!1)}}},[h,y,S,B,X,O,T,N,V,d]),re=Zs(h,y,V.length>0),ke=!!(re&&S&&T&&(y.trim()||V.length>0)),m=s.useCallback(w=>{var Z;w.nativeEvent.isComposing||w.key==="Enter"&&(w.ctrlKey||w.metaKey)&&ke&&!U&&(w.preventDefault(),(Z=w.currentTarget.form)==null||Z.requestSubmit())},[ke,U]),E=V.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3",children:V.map((w,Z)=>e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:Bs(w),alt:w.filename??`attachment ${Z+1}`,className:"h-24 w-24 rounded-2xl border border-border/70 object-cover"}),e.jsx("button",{type:"button",onClick:()=>te(Z),className:"absolute -top-2 -right-2 flex h-6 w-6 items-center justify-center rounded-[10px] border border-border/70 bg-background text-muted-foreground shadow-sm transition-all hover:-translate-y-px hover:text-foreground","aria-label":`Remove ${w.filename??`image ${Z+1}`}`,children:e.jsx(Ve,{className:"h-3.5 w-3.5"})})]},`${w.filename??"image"}-${Z}`))}),$=e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Assign to"}),e.jsxs(ye,{value:T,onValueChange:J,children:[e.jsx(we,{className:"h-11 rounded-[18px] border-border/70 bg-background/70",children:e.jsx(De,{placeholder:"Select node"})}),e.jsx(Ce,{children:It(z,n)})]})]}),Se=e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Agent"}),e.jsxs(ye,{value:S,onValueChange:k,children:[e.jsx(we,{className:"h-11 rounded-[18px] border-border/70 bg-background/70",children:e.jsx(De,{placeholder:"Select agent"})}),e.jsx(Ce,{children:ps()})]})]}),p=e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Mode"}),e.jsxs(ye,{value:N,onValueChange:w=>W(w),children:[e.jsx(we,{className:"h-11 rounded-[18px] border-border/70 bg-background/70",children:e.jsx(De,{placeholder:"Select mode"})}),e.jsx(Ce,{children:fs()})]})]}),xe=e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Priority"}),e.jsxs(ye,{value:O,onValueChange:M,children:[e.jsx(we,{className:"h-11 rounded-[18px] border-border/70 bg-background/70",children:e.jsx(De,{placeholder:"Select priority"})}),e.jsxs(Ce,{children:[e.jsx(he,{value:"low",children:"Low"}),e.jsx(he,{value:"normal",children:"Normal"}),e.jsx(he,{value:"high",children:"High"}),e.jsx(he,{value:"critical",children:"Critical"})]})]})]}),Q=e.jsx(Ft,{value:B,onChange:D,assignTo:T,nodes:t,assignableNodes:z}),ge=e.jsx(hs,{value:X,onChange:R,project:B,assignTo:T,nodes:t,assignableNodes:z});return l==="composer"?e.jsxs("form",{onSubmit:je,className:A("space-y-4",c),children:[e.jsx("input",{ref:ie,type:"file",accept:"image/*",multiple:!0,onChange:ne,className:"hidden"}),(()=>{const w="chat-composer__chip h-9 w-auto gap-1.5 rounded-[15px] px-3.5 text-xs shadow-none transition-colors",Z="border-transparent bg-transparent text-muted-foreground hover:bg-background/40 hover:text-foreground",be="border-border/70 bg-background/55 text-foreground",me=S==="claudecode",Fe=N===Ze;return e.jsxs("div",{className:"chat-composer space-y-2",children:[e.jsxs("div",{className:"rounded-[26px] border border-border/60 bg-background/54 shadow-[0_24px_86px_-48px_rgba(15,23,42,0.55)] backdrop-blur-xl dark:shadow-[0_24px_86px_-48px_rgba(0,0,0,0.9)]",children:[e.jsxs("div",{className:"chat-composer__header flex min-w-0 items-center justify-between gap-3 px-4 pt-3",children:[e.jsxs(ye,{value:T,onValueChange:J,children:[e.jsx(we,{className:A(w,be,"chat-composer__node-trigger border-transparent bg-transparent hover:bg-background/40"),title:`Assigned node: ${(oe==null?void 0:oe.name)??"unassigned"}`,"aria-label":`Assigned node: ${(oe==null?void 0:oe.name)??"unassigned"}`,children:oe?e.jsxs(e.Fragment,{children:[e.jsx(Gt,{isCurrent:u}),e.jsx("span",{className:"min-w-0 truncate",children:oe.name}),e.jsx("span",{className:"chat-composer__header-meta shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:u?"current":"remote"})]}):e.jsx(De,{placeholder:"Select node"})}),e.jsx(Ce,{children:It(z,n)})]}),le?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx($e,{id:"task-title-composer",type:"text",value:h,onChange:Ne=>x(Ne.target.value),onKeyDown:Ne=>{(Ne.key==="Enter"||Ne.key==="Escape")&&(Ne.preventDefault(),Y(!1))},autoFocus:!0,placeholder:"Chat title",className:"h-8 w-48 min-w-0 rounded-[13px] border-border/70 bg-background/55 px-3 text-xs shadow-none"}),e.jsx(L,{type:"button",variant:"ghost",size:"icon",onClick:()=>Y(!1),"aria-label":"Save title",className:"h-8 w-8 shrink-0 rounded-[12px] text-muted-foreground hover:text-foreground",children:e.jsx(He,{className:"h-3.5 w-3.5"})})]}):e.jsxs("button",{type:"button",onClick:()=>Y(!0),className:"chat-composer__title-button flex min-w-0 items-center gap-1.5 rounded-[13px] px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-background/55 hover:text-foreground",title:re||"Title","aria-label":re?`Edit title: ${re}`:"Edit title",children:[e.jsx("span",{className:"chat-composer__title-text max-w-[220px] truncate",children:re||"Title"}),e.jsx(at,{className:"h-3 w-3 shrink-0"})]})]}),e.jsx("textarea",{id:"task-description",value:y,onChange:Ne=>C(Ne.target.value),onKeyDown:m,onPaste:se,placeholder:"Ask anything...",rows:4,autoFocus:j,"aria-label":"Opening prompt",className:"min-h-[140px] w-full resize-none rounded-[24px] bg-transparent px-5 pt-2 pb-2 text-[15px] leading-7 text-foreground ring-offset-background placeholder:text-muted-foreground/70 focus-visible:outline-none"}),e.jsxs("div",{className:"chat-composer__rail flex flex-nowrap items-center gap-2 px-3 pb-3",children:[e.jsx(L,{type:"button",variant:"ghost",size:"icon",onClick:I,"aria-label":"Add images",className:"h-9 w-9 shrink-0 rounded-[14px] text-muted-foreground hover:text-foreground",children:e.jsx(At,{className:"h-4 w-4"})}),e.jsx("span",{className:"mx-0.5 h-5 w-px bg-border/60","aria-hidden":!0}),e.jsxs(ye,{value:S,onValueChange:k,children:[e.jsxs(we,{className:A(w,"chat-composer__icon-trigger",me?Z:be),title:`Agent: ${G}`,"aria-label":`Agent: ${G}`,children:[e.jsx(Ot,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"chat-composer__footer-label truncate",children:G})]}),e.jsx(Ce,{children:ps()})]}),e.jsxs(ye,{value:N,onValueChange:Ne=>W(Ne),children:[e.jsxs(we,{className:A(w,"chat-composer__icon-trigger",Fe?Z:be),title:`Mode: ${F}`,"aria-label":`Mode: ${F}`,children:[e.jsx(Tn,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"chat-composer__footer-label truncate",children:F})]}),e.jsx(Ce,{children:fs()})]}),e.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[e.jsxs(ye,{value:O,onValueChange:M,children:[e.jsx(we,{"aria-label":`Priority: ${O}`,title:`Priority: ${O}`,className:A("h-9 w-9 justify-center gap-0 rounded-[14px] p-0 text-xs shadow-none [&>svg:last-child]:hidden",O==="normal"?"border-transparent bg-transparent text-muted-foreground hover:bg-background/40":"border-border/70 bg-background/55",O==="critical"&&"text-destructive",O==="high"&&"text-amber-600 dark:text-amber-400",O==="low"&&"text-muted-foreground"),children:e.jsx(tn,{className:A("h-4 w-4",O==="critical"&&"fill-destructive/20")})}),e.jsxs(Ce,{children:[e.jsx(he,{value:"low",children:"Low"}),e.jsx(he,{value:"normal",children:"Normal"}),e.jsx(he,{value:"high",children:"High"}),e.jsx(he,{value:"critical",children:"Critical"})]})]}),o&&e.jsxs(L,{type:"button",variant:"ghost",size:"sm",onClick:o,"aria-label":v,className:"chat-composer__cancel h-9 rounded-[14px] px-4 text-xs text-muted-foreground",children:[e.jsx(Ve,{className:"chat-composer__cancel-icon h-4 w-4 shrink-0"}),e.jsx("span",{className:"chat-composer__footer-label",children:v})]}),e.jsxs(L,{type:"submit",size:"icon",disabled:!ke||U,className:"h-10 w-10 rounded-[16px] shadow-[0_8px_30px_-8px_hsl(var(--primary)/0.6)]",children:[U?e.jsx(ve,{className:"h-4 w-4 animate-spin"}):e.jsx(qs,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:U?"Creating chat":f})]})]})]})]}),e.jsx("div",{className:"chat-composer__location flex flex-wrap items-center gap-2 px-1",children:(()=>{const Ne="border-border/40 bg-muted/40 text-foreground/80 hover:bg-muted/60 hover:text-foreground";return e.jsxs(e.Fragment,{children:[e.jsx(Ft,{value:B,onChange:D,assignTo:T,nodes:t,assignableNodes:z,layout:"composer",chipClassName:w,chipActiveClassName:Ne,chipInactiveClassName:Ne,triggerClassName:"chat-composer__icon-trigger",labelClassName:"chat-composer__location-label"}),e.jsx(hs,{value:X,onChange:R,project:B,assignTo:T,nodes:t,assignableNodes:z,layout:"composer",chipClassName:w,chipActiveClassName:Ne,chipInactiveClassName:Ne,triggerClassName:"chat-composer__icon-trigger",labelClassName:"chat-composer__location-label"})]})})()})]})})(),(E||ee)&&e.jsxs("div",{className:"space-y-3 rounded-[20px] border border-border/60 bg-background/45 p-4",children:[E,ee&&e.jsx("div",{className:"text-xs text-destructive",children:ee}),!ee&&e.jsx("div",{className:"text-xs text-muted-foreground",children:"Ctrl/Cmd+Enter starts the chat. Enter adds a new line. Paste screenshots directly into the prompt box or use the Images button."})]})]}):e.jsxs("form",{onSubmit:je,className:A("space-y-5",c),children:[e.jsx("input",{ref:ie,type:"file",accept:"image/*",multiple:!0,onChange:ne,className:"hidden"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{htmlFor:"task-description",className:"text-sm font-medium",children:"Opening prompt"}),e.jsx("textarea",{id:"task-description",value:y,onChange:w=>C(w.target.value),onKeyDown:m,onPaste:se,placeholder:"Describe what the agent should do. This becomes the first message in the chat.",rows:6,autoFocus:j,className:"flex min-h-[144px] w-full resize-none rounded-[22px] border border-border/70 bg-background/70 px-4 py-3 text-sm leading-6 ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsxs(L,{type:"button",variant:"outline",onClick:I,className:"rounded-[16px]",children:[e.jsx(At,{className:"h-4 w-4"}),"Add images"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Ctrl/Cmd+Enter starts the chat. Enter adds a new line. Upload or paste screenshots and reference images with the opening prompt."})]}),E,ee&&e.jsx("p",{className:"text-xs text-destructive",children:ee})]}),e.jsxs("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1fr)_220px_220px]",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{htmlFor:"task-title",className:"text-sm font-medium",children:"Chat title"}),e.jsx($e,{id:"task-title",type:"text",value:h,onChange:w=>x(w.target.value),placeholder:"Optional. Leave blank to derive it from the prompt.",className:"h-11 rounded-[18px] border-border/70 bg-background/70"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:re?`Will appear as: ${re}`:"A title will be generated from the first line of the prompt."})]}),Se,p]}),Q,ge,e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[xe,$]}),e.jsxs("div",{className:A("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",g),children:[o&&e.jsx(L,{type:"button",variant:"ghost",onClick:o,className:"rounded-[16px]",children:v}),e.jsx(L,{type:"submit",disabled:!ke||U,className:"rounded-[16px] px-5",children:U?"Creating...":f})]})]})}function vo({nodes:t,currentNodeRole:a,currentNodeId:n,leaderNodeId:r,onCreated:d,onCancel:o,defaultMode:c="chat",mode:g,onModeChange:f,layout:v="default",className:j,footerClassName:l,autoFocus:h=!1}){const[x,y]=s.useState(c),C=g!==void 0,S=C?g:x,k=N=>{C||y(N),f==null||f(N)};return e.jsxs("div",{className:A("space-y-4",j),children:[!C&&e.jsxs("div",{className:"flex items-center gap-2 rounded-[20px] border border-border/60 bg-background/45 p-1",children:[e.jsxs(L,{type:"button",variant:S==="chat"?"default":"ghost",onClick:()=>k("chat"),className:"flex-1 rounded-[16px]",children:[e.jsx(Ya,{className:"h-4 w-4"}),"New chat"]}),e.jsxs(L,{type:"button",variant:S==="native"?"default":"ghost",onClick:()=>k("native"),className:"flex-1 rounded-[16px]",children:[e.jsx(Kt,{className:"h-4 w-4"}),"Load session"]})]}),S==="chat"?e.jsx(bo,{nodes:t,currentNodeRole:a,currentNodeId:n,leaderNodeId:r,onCreated:d,onCancel:o,footerClassName:l,submitLabel:v==="composer"?"Start chat":"Create chat",cancelLabel:"Cancel",autoFocus:h,layout:v}):e.jsx(ho,{nodes:t,currentNodeRole:a,currentNodeId:n,leaderNodeId:r,onCreated:d,onCancel:o,footerClassName:l,autoFocus:h})]})}const Ge="72f988bf-86f1-41af-91ab-2d7cd011db47",ea=`${Ge} (MSIT)`;function jo({open:t,onOpenChange:a,onShare:n,onStopShare:r,sharing:d,stopping:o=!1,shareResult:c}){return e.jsx(_s,{open:t,onOpenChange:a,children:e.jsxs(ws,{className:"max-w-md rounded-[22px] p-5",children:[e.jsx(Cs,{className:"sr-only",children:"Share conversation"}),e.jsx(No,{onOpenChange:a,onShare:n,onStopShare:r,sharing:d,stopping:o,shareResult:c})]})})}function No({onOpenChange:t,onShare:a,onStopShare:n,sharing:r,stopping:d=!1,shareResult:o}){const[c,g]=s.useState((o==null?void 0:o.tenant)??Ge),[f,v]=s.useState((o==null?void 0:o.scope)??"chat"),j=(o==null?void 0:o.url)??null,l=r||d;return s.useEffect(()=>{g((o==null?void 0:o.tenant)??Ge),v((o==null?void 0:o.scope)??"chat")},[o==null?void 0:o.shareId,o==null?void 0:o.tenant,o==null?void 0:o.scope]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("h2",{className:"text-base font-semibold leading-none tracking-tight",children:"Share conversation"}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:"Create a tenant-gated link for this task."})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(ko,{value:c,onChange:g,disabled:l}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-foreground",children:"Access"}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(gs,{active:f==="chat",title:"Chat only",description:"Conversation transcript and opening prompt.",onClick:()=>v("chat")}),e.jsx(gs,{active:f==="filesPreview",title:"Chat, files and preview",description:"Transcript plus task output files and HTML preview.",onClick:()=>v("filesPreview")})]})]}),j&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-foreground",children:"Shared link"}),e.jsxs("div",{className:"flex items-center gap-2 rounded-[16px] border border-border/70 bg-muted/30 px-3 py-2",children:[e.jsx("input",{readOnly:!0,value:j,className:"min-w-0 flex-1 bg-transparent font-mono text-xs text-foreground outline-none","aria-label":"Shared link"}),e.jsx(L,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 rounded-[12px] text-muted-foreground",onClick:()=>void We(j,"Shared link copied"),"aria-label":"Copy shared link",title:"Copy shared link",children:e.jsx(Es,{className:"h-3.5 w-3.5"})})]})]})]}),e.jsxs("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[e.jsx(L,{variant:"outline",onClick:()=>t(!1),disabled:l,className:"h-8 text-xs",children:o?"Done":"Cancel"}),o&&n&&e.jsxs(L,{variant:"outline",onClick:()=>void n(),disabled:l,className:"h-8 border-destructive/30 text-xs text-destructive hover:bg-destructive/10 hover:text-destructive",children:[d&&e.jsx(ve,{className:"h-3.5 w-3.5 animate-spin"}),"Stop share"]}),e.jsxs(L,{onClick:()=>void a({tenant:c,scope:f}),disabled:l,className:"h-8 text-xs",children:[r&&e.jsx(ve,{className:"h-3.5 w-3.5 animate-spin"}),o?"Update link":"Share link"]})]})]})}function ko({value:t,onChange:a,disabled:n}){const[r,d]=s.useState(!1),[o,c]=s.useState(!1),[g,f]=s.useState(t),v=s.useRef(null);s.useEffect(()=>{f(t)},[t]),s.useEffect(()=>{if(!r)return;const l=x=>{var C;const y=x.target;y instanceof Node&&((C=v.current)!=null&&C.contains(y)||(d(!1),c(!1)))},h=x=>{x.key==="Escape"&&(d(!1),c(!1))};return document.addEventListener("mousedown",l),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",h)}},[r]);const j=l=>{const h=l.trim();h&&(a(h),f(h),c(!1),d(!1))};return e.jsxs("div",{className:"space-y-2 text-xs",ref:v,children:[e.jsx("div",{className:"font-medium text-foreground",children:"Tenant"}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{type:"button",onClick:()=>!n&&d(l=>!l),disabled:n,className:"flex h-9 w-full items-center justify-between gap-2 rounded-[15px] border border-border/70 bg-background/70 px-3 text-left text-xs text-foreground shadow-sm outline-none transition-colors hover:bg-background disabled:opacity-50",children:[e.jsx("span",{className:"min-w-0 truncate font-mono",children:yo(t)}),e.jsx(st,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})]}),r&&e.jsxs("div",{className:"absolute left-0 right-0 z-50 mt-2 overflow-hidden rounded-[18px] border border-border/60 bg-background/95 text-xs shadow-lg backdrop-blur",children:[e.jsxs("button",{type:"button",onClick:()=>j(Ge),className:"flex w-full items-center justify-between gap-2 px-3 py-2 text-left hover:bg-background/60",children:[e.jsx("span",{className:"min-w-0 truncate font-mono text-[11px]",children:ea}),t===Ge&&e.jsx(He,{className:"h-3.5 w-3.5 shrink-0 text-primary"})]}),e.jsx("div",{className:"border-t border-border/60 bg-background/40 px-2.5 py-1.5",children:o?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("input",{value:g,onChange:l=>f(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),j(g))},autoFocus:!0,placeholder:"Tenant ID",className:"h-7 min-w-0 flex-1 rounded-[11px] border border-border/60 bg-background/70 px-2 font-mono text-[11px] outline-none focus:ring-2 focus:ring-ring"}),e.jsx("button",{type:"button",onClick:()=>j(g),className:"flex h-7 w-7 items-center justify-center rounded-[11px] hover:bg-background/60",children:e.jsx(He,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>{f(t),c(!1)},className:"flex h-7 w-7 items-center justify-center rounded-[11px] text-muted-foreground hover:bg-background/60 hover:text-foreground",children:e.jsx(Ve,{className:"h-3.5 w-3.5"})})]}):e.jsxs("button",{type:"button",onClick:()=>c(!0),className:"flex h-7 w-full items-center justify-between rounded-[11px] px-1.5 text-[11px] text-muted-foreground hover:bg-background/60 hover:text-foreground",children:[e.jsx("span",{children:"Manual tenant ID"}),e.jsx(at,{className:"h-3 w-3"})]})})]})]})]})}function yo(t){return t===Ge?ea:t}function gs({active:t,title:a,description:n,onClick:r}){return e.jsxs("button",{type:"button",onClick:r,className:t?"rounded-[15px] border border-primary/45 bg-primary/10 px-3 py-2 text-left shadow-sm":"rounded-[15px] border border-border/70 bg-background px-3 py-2 text-left shadow-sm hover:bg-muted/50",children:[e.jsx("div",{className:"text-xs font-medium text-foreground",children:a}),e.jsx("div",{className:"mt-1 text-[11px] leading-4 text-muted-foreground",children:n})]})}const wo=s.lazy(async()=>({default:(await Ut(()=>import("./FilesTab-BX-UYwna.js"),__vite__mapDeps([0,1,2,3,4]))).FilesTab})),Co=s.lazy(async()=>({default:(await Ut(()=>import("./PreviewTab-DnhQ_cTw.js"),__vite__mapDeps([5,1,2,6]))).PreviewTab})),So=s.lazy(async()=>({default:(await Ut(()=>import("./DiffTab-DoG4Hq6_.js"),__vite__mapDeps([7,1,2,3,4,8,6]))).DiffTab}));function _o({onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:n,operationsOpen:r,onToggleOperations:d,cluster:o,sseConnected:c,activeTab:g,setActiveTab:f,creatingTask:v,createMode:j,activeTask:l,assignedNode:h,taskLoading:x,taskError:y,displayEvents:C,initialPromptAlreadyInLogs:S,initialPrompt:k,supportsFollowUp:N,taskUnavailable:W,chatDisabled:B,chatDisabledReason:D,questionBypassEnabled:X,isRunning:R,isStarting:O,hasPendingFollowUp:M,canCancel:z,canRetry:ue,onRetry:T,onCancel:J,onShareTask:U,onStopShareTask:P,onStartCreateTask:le,onCancelCreateTask:Y,onCreateTask:V,onSendMessage:ee,onQuestionBypassChange:ie,onSubmitQuestionResponse:I,messagesEndRef:ne}){const[se,te]=s.useState(!1),[oe,u]=s.useState(!1),[G,F]=s.useState(!1),[je,re]=s.useState(!1),[ke,m]=s.useState(!1),[E,$]=s.useState({}),[Se,p]=s.useState(new Set),[xe,Q]=s.useState(new Set),ge=s.useRef(0),w=s.useRef(!1),Z=s.useCallback(Te=>{const q=Te.currentTarget,Me=ge.current;if(ge.current=q.scrollTop,w.current)return;if(q.scrollHeight-q.scrollTop-q.clientHeight<30){te(!1),w.current=!0,setTimeout(()=>{w.current=!1},300);return}q.scrollTop<Me&&Me-q.scrollTop>10&&te(!0),q.scrollTop<=0&&te(!0)},[]),be=(l==null?void 0:l.effectiveProjectPath)??(l==null?void 0:l.project)??"default workspace",me=l?(h==null?void 0:h.name)??Ts(l.assignedTo,o==null?void 0:o.nodes,l.assignedNodeName):"unassigned",Fe=l!=null&&l.assignedTo?e.jsxs(e.Fragment,{children:["Connecting session on node ",e.jsx("span",{className:"font-medium text-foreground",children:me}),"..."]}):"Connecting session to an available node...",Ne=l?[{label:"Working dir",value:be,mono:!0},...l.branch?[{label:"Branch",value:l.branch,mono:!0}]:[],{label:"Agent",value:l.agent,mono:!0},{label:"Node",value:me}]:[],Ye=!!(k&&!S),rt=Ye||C.length>0,Xe=R&&rt,Qe=(O||M||R)&&!Xe,Ie=(l==null?void 0:l.conversationKind)==="nativeSession",Oe=l&&!Se.has(l.id)?E[l.id]??l.activeShare??null:null;return v?e.jsx(Eo,{onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:n,operationsOpen:r,onToggleOperations:d,cluster:o,sseConnected:c,defaultMode:j,onCancel:Y,onCreated:V}):!l&&x?e.jsxs("div",{className:"dashboard-panel animate-panel-settle flex h-full min-h-0 flex-col overflow-hidden rounded-[28px]",children:[e.jsx("div",{className:"shrink-0 border-b border-border/55 bg-card/28 px-3 py-3 sm:px-5",children:e.jsx($t,{onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:n,operationsOpen:r,onToggleOperations:d,cluster:o,sseConnected:c})}),e.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-y-auto px-6 py-10 sm:px-8",children:e.jsxs("div",{className:"space-y-4 text-center",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-[22px] border border-primary/20 bg-primary/10 text-primary shadow-sm",children:e.jsx(ve,{className:"h-7 w-7 animate-spin"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:"Loading conversation"}),e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-[11px] text-muted-foreground",children:[e.jsx(ve,{className:"h-4 w-4 animate-spin"}),"Fetching the selected chat thread..."]})]})]})})]}):l?e.jsxs(Ds,{value:g,onValueChange:f,className:"dashboard-panel animate-panel-settle flex h-full min-h-0 flex-col overflow-hidden rounded-[28px]",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/55 bg-card/28 px-3 py-3 sm:px-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(ta,{desktopTasksOpen:a,mobileTasksPanelOpen:n,onToggleTasks:t}),e.jsx("h2",{className:"min-w-0 truncate text-sm font-semibold tracking-tight text-foreground sm:text-lg",title:l.title,children:l.title}),Ie&&e.jsx(Le,{variant:"outline",className:"shrink-0 rounded-[11px] border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",children:"Native session"}),e.jsx(Ms,{status:l.status}),e.jsx(Qa,{priority:l.priority}),e.jsx(L,{variant:"outline",size:"icon",onClick:d,title:r?"Hide cluster":"Show cluster","aria-label":r?"Hide cluster":"Show cluster",className:"ml-auto h-7 w-7 shrink-0 rounded-[12px] border-border/70 bg-background/68",children:r?e.jsx(Ht,{className:"h-4 w-4"}):e.jsx(Ks,{className:"h-4 w-4"})})]}),y&&e.jsx("div",{className:"mt-2 w-fit rounded-[12px] border border-destructive/25 bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:y}),e.jsxs("div",{className:"mt-2 flex items-center gap-1.5",children:[e.jsxs(As,{className:"h-auto max-w-full overflow-x-auto rounded-[16px] bg-muted/70 p-0.5",children:[e.jsx(ze,{value:"transcript",className:"rounded-[12px] px-2 py-0.5 text-[11px] sm:px-2.5",children:"Transcript"}),e.jsx(ze,{value:"files",className:"rounded-[12px] px-2 py-0.5 text-[11px] sm:px-2.5",children:"Files"}),e.jsx(ze,{value:"preview",className:"rounded-[12px] px-2 py-0.5 text-[11px] sm:px-2.5",children:"Preview"}),e.jsx(ze,{value:"diff",className:"rounded-[12px] px-2 py-0.5 text-[11px] sm:px-2.5",children:"Diff"})]}),R&&e.jsx(Le,{variant:"outline",className:"hidden rounded-[11px] border-amber-500/30 bg-amber-500/10 text-amber-700 sm:inline-flex dark:text-amber-300",children:"Working"}),W&&e.jsx(Le,{variant:"outline",className:"hidden rounded-[11px] border-destructive/25 bg-destructive/10 text-destructive sm:inline-flex",children:"Unavailable"}),e.jsxs("div",{className:"ml-auto flex items-center gap-2 text-[10px] text-muted-foreground",children:[e.jsxs("span",{className:"hidden sm:inline",children:["updated ",Za(l.updatedAt)]}),e.jsx("span",{className:"font-mono",children:l.id.slice(0,8)}),ue&&e.jsxs(L,{variant:"outline",size:"sm",onClick:T,className:"h-7 shrink-0 rounded-[12px] px-2 text-[11px]",children:[e.jsx(yn,{className:"h-3.5 w-3.5"}),"Retry"]}),e.jsxs(L,{type:"button",variant:"outline",size:"sm",disabled:W,title:W?"Unavailable tasks cannot be shared.":"Share conversation",className:"h-7 shrink-0 rounded-[12px] border-primary/30 bg-primary/10 px-2 text-[11px] text-primary hover:bg-primary/15 hover:text-primary disabled:border-border/60 disabled:bg-muted/40 disabled:text-muted-foreground",onClick:()=>F(!0),children:[e.jsx(_n,{className:"h-3.5 w-3.5"}),"Share"]})]})]})]}),e.jsx(Ue,{value:"transcript",className:"mt-0 min-h-0 flex-1",children:e.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[e.jsx("div",{className:"min-h-0 flex-1 touch-pan-y overflow-x-hidden overflow-y-auto overscroll-x-none bg-gradient-to-b from-background/15 via-transparent to-background/35 px-3 py-5 sm:px-5",onScroll:Z,children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-5",children:[Ye&&k&&e.jsx(cs,{event:k,questionBypassEnabled:X,onQuestionBypassChange:ie,onSubmitQuestionResponse:I,questionResponseDisabled:!N||B}),C.map((Te,q)=>e.jsx(cs,{event:Te,questionBypassEnabled:X,onQuestionBypassChange:ie,onSubmitQuestionResponse:I,questionResponseDisabled:!N||B},Ur("transcript",Te,q))),!rt&&!Qe&&e.jsxs("div",{className:"rounded-[28px] border border-dashed border-border/70 bg-background/35 px-5 py-8 text-center",children:[e.jsx("div",{className:"text-[11px] font-medium text-foreground",children:"Transcript is warming up"}),e.jsx("div",{className:"mt-2 text-[11px] leading-6 text-muted-foreground",children:x?"Fetching task output...":Ie?"This native session is attached. Transcript starts after the next message you send from Meshy.":"The opening prompt has been stored, but the agent has not emitted conversation output yet."})]}),(!N&&l.result||l.error)&&e.jsxs("div",{className:"space-y-3",children:[!N&&l.result&&e.jsxs("div",{className:"rounded-[26px] border border-border/70 bg-card/80 px-3 py-3",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Stored result"}),e.jsx("pre",{className:"mt-3 overflow-x-auto whitespace-pre-wrap text-[11px] leading-5 text-muted-foreground",children:JSON.stringify(l.result,null,2)})]}),l.error&&!xe.has(l.id)&&e.jsxs("div",{className:"rounded-[26px] border border-destructive/20 bg-destructive/10 px-3 py-3 text-destructive",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em]",children:"Stored error"}),e.jsx("button",{onClick:()=>Q(Te=>new Set(Te).add(l.id)),className:"rounded p-0.5 hover:bg-destructive/20","aria-label":"Dismiss error",children:e.jsx(Ve,{className:"h-3.5 w-3.5"})})]}),e.jsx("pre",{className:"mt-3 overflow-x-auto whitespace-pre-wrap text-[11px] leading-5",children:l.error})]})]}),Qe&&e.jsx(bs,{children:Fe}),Xe&&e.jsx(bs,{children:"The agent is still working on this conversation."}),e.jsx("div",{ref:ne})]})}),N?se?e.jsx(L,{size:"icon",onClick:()=>te(!1),className:"absolute bottom-4 right-4 z-10 h-12 w-12 rounded-[18px] shadow-lg",children:e.jsx(at,{className:"h-4 w-4"})}):e.jsx("div",{className:"shrink-0",children:e.jsx("div",{className:"mx-auto w-full max-w-[72rem]",children:e.jsx(Wn,{onSend:ee,disabled:B,disabledReason:D,contextItems:Ne,placeholder:B?D:"Continue the conversation...",running:R||M,onStop:z?()=>u(!0):void 0})})}):e.jsx("div",{className:"shrink-0 border-t border-border/60 px-3 py-3 text-[11px] text-muted-foreground sm:px-5",children:"This task does not expose follow-up chat messages. Use Files, Preview, or Diff to inspect the result."})]})}),e.jsx(Ue,{value:"files",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(jt,{label:"Loading files..."}),children:e.jsx(wo,{taskId:l.id})})}),e.jsx(Ue,{value:"preview",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(jt,{label:"Loading preview..."}),children:e.jsx(Co,{taskId:l.id})})}),e.jsx(Ue,{value:"diff",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(jt,{label:"Loading diff..."}),children:e.jsx(So,{taskId:l.id})})}),e.jsx(kt,{open:oe,onOpenChange:u,children:e.jsxs(yt,{children:[e.jsxs(wt,{children:[e.jsx(Ct,{children:"Stop this task?"}),e.jsx(St,{children:"The task will stop and move to a cancelled state."})]}),e.jsxs(_t,{children:[e.jsx(Et,{children:"Keep running"}),e.jsx(Tt,{onClick:J,children:"Stop task"})]})]})}),e.jsx(jo,{open:G,onOpenChange:F,sharing:je,stopping:ke,shareResult:Oe,onShare:async Te=>{if(!l)return null;re(!0);try{const q=await U(Te);return q!=null&&q.url&&($(Me=>({...Me,[l.id]:q})),p(Me=>{const Ae=new Set(Me);return Ae.delete(l.id),Ae})),q}finally{re(!1)}},onStopShare:async()=>{if(!l)return!1;m(!0);try{const Te=await P();return Te!==!1&&($(q=>{const Me={...q};return delete Me[l.id],Me}),p(q=>new Set(q).add(l.id))),Te}finally{m(!1)}}})]}):e.jsxs("div",{className:"dashboard-panel animate-panel-settle flex h-full min-h-0 flex-col overflow-hidden rounded-[28px]",children:[e.jsx("div",{className:"shrink-0 border-b border-border/55 bg-card/28 px-3 py-3 sm:px-5",children:e.jsx($t,{onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:n,operationsOpen:r,onToggleOperations:d,cluster:o,sseConnected:c})}),e.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-y-auto px-6 py-10 sm:px-8",children:e.jsxs("div",{className:"w-full max-w-2xl text-center",children:[e.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-[22px] border border-primary/20 bg-primary/10 text-primary shadow-sm",children:e.jsx(Ot,{className:"h-7 w-7"})}),e.jsx("h2",{className:"mt-5 text-xl font-semibold tracking-tight text-foreground sm:text-3xl",children:"No chat selected"}),e.jsx("p",{className:"mx-auto mt-3 max-w-xl text-[11px] leading-6 text-muted-foreground",children:"Open a task from the left sidebar to continue the conversation, or start a new task or load a native session."}),e.jsxs(L,{onClick:le,className:"mt-6 rounded-[18px] px-5",children:[e.jsx(qt,{className:"h-4 w-4"}),"Start or load chat"]}),y&&e.jsx("div",{className:"mx-auto mt-4 max-w-lg rounded-[20px] border border-destructive/20 bg-destructive/10 px-3 py-2 text-[11px] text-destructive",children:y})]})})]})}function bs({children:t}){return e.jsxs("div",{className:"flex items-center gap-1.5 rounded-[18px] border border-border/60 bg-background/55 px-3 py-2 text-[11px] text-muted-foreground shadow-sm",children:[e.jsx(ve,{className:"h-4 w-4 shrink-0 animate-spin"}),e.jsx("div",{className:"min-w-0 leading-5",children:t})]})}function Eo({onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:n,operationsOpen:r,onToggleOperations:d,cluster:o,sseConnected:c,defaultMode:g,onCancel:f,onCreated:v}){var x,y,C;const[j,l]=s.useState(g??"chat");s.useEffect(()=>{g&&l(g)},[g]);const h=e.jsx("div",{className:"flex items-center gap-1 rounded-[18px] border border-border/60 bg-background/65 p-0.5 text-[11px] font-medium shadow-sm",children:[{value:"chat",label:"New chat",icon:qt},{value:"native",label:"Load session",icon:Kt}].map(S=>{const k=S.icon,N=S.value===j;return e.jsxs("button",{type:"button",onClick:()=>l(S.value),"aria-pressed":N,className:A("flex items-center gap-1.5 rounded-[14px] px-2 py-1 transition-all duration-200",N?"bg-primary text-primary-foreground shadow-[0_8px_24px_-12px_hsl(var(--primary)/0.7)]":"text-muted-foreground hover:bg-background/80 hover:text-foreground"),children:[e.jsx(k,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:S.label})]},S.value)})});return e.jsxs("div",{className:"dashboard-panel animate-panel-settle flex h-full min-h-0 flex-col overflow-hidden rounded-[28px]",children:[e.jsx("div",{className:"shrink-0 border-b border-border/55 bg-card/28 px-3 py-3 sm:px-5",children:e.jsx($t,{onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:n,operationsOpen:r,onToggleOperations:d,cluster:o,sseConnected:c,centerSlot:h})}),e.jsx("div",{className:"flex min-h-0 flex-1 flex-col items-center justify-center overflow-y-auto px-6 py-10 sm:px-8",children:e.jsx("div",{className:"w-full max-w-2xl",children:e.jsx(vo,{nodes:(o==null?void 0:o.nodes)??[],currentNodeRole:(x=o==null?void 0:o.self)==null?void 0:x.role,currentNodeId:((y=o==null?void 0:o.self)==null?void 0:y.id)??null,leaderNodeId:((C=o==null?void 0:o.leader)==null?void 0:C.id)??null,mode:j,onModeChange:l,onCreated:v,onCancel:f,autoFocus:!0,layout:"composer"})})})]})}function $t({onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:n,operationsOpen:r,onToggleOperations:d,centerSlot:o}){return e.jsxs("div",{className:"relative flex w-full items-center justify-between gap-1.5",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-1.5",children:e.jsx(ta,{desktopTasksOpen:a,mobileTasksPanelOpen:n,onToggleTasks:t})}),o&&e.jsx("div",{className:"pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:e.jsx("div",{className:"pointer-events-auto",children:o})}),e.jsx(L,{variant:"outline",size:"icon",onClick:d,title:r?"Hide cluster":"Show cluster","aria-label":r?"Hide cluster":"Show cluster",className:"h-7 w-7 shrink-0 rounded-[12px] border-border/70 bg-background/68",children:r?e.jsx(Ht,{className:"h-4 w-4"}):e.jsx(Ks,{className:"h-4 w-4"})})]})}function ta({desktopTasksOpen:t,mobileTasksPanelOpen:a,onToggleTasks:n}){var d,o;const r=(o=(d=globalThis.window)==null?void 0:d.matchMedia("(min-width: 1024px)"))!=null&&o.matches?t:a;return e.jsx(L,{variant:"outline",size:"icon",onClick:n,title:r?"Hide tasks":"Show tasks","aria-label":r?"Hide tasks":"Show tasks",className:"h-7 w-7 shrink-0 rounded-[12px] border-border/70 bg-background/68",children:r?e.jsx(Vs,{className:"h-4 w-4"}):e.jsx(fn,{className:"h-4 w-4"})})}function vs({cluster:t,systemInfo:a,nodeNameById:n,nodeBlockingTaskCounts:r,eventTypeFilter:d,onEventTypeFilterChange:o,eventTypeOptions:c,filteredEvents:g,sseConnected:f,clusterLoading:v,clusterError:j,promotePending:l,onPromote:h,onAddNode:x,leavePending:y,onLeaveCluster:C,onToggleNodeDevTunnel:S,devTunnelNodeId:k,onClose:N}){var T,J,U;const W=((T=t==null?void 0:t.self)==null?void 0:T.role)==="leader",B=((J=t==null?void 0:t.self)==null?void 0:J.role)==="follower"&&!(t!=null&&t.leader),D=(t==null?void 0:t.self)??null,R=er((t==null?void 0:t.nodes)??[],D==null?void 0:D.id).filter(P=>P.id!==(D==null?void 0:D.id)),O=t!=null&&t.leader?t.nodes.find(P=>{var le;return P.id===((le=t.leader)==null?void 0:le.id)})??null:null,M=t!=null&&t.leader?t.leader.dashboardOrigin??(O==null?void 0:O.dashboardOrigin)??(a&&t.leader.id===(a.nodeId??a.id)?a.dashboardOrigin:void 0)??t.leader.endpoint:null,z=(D==null?void 0:D.role)==="leader"&&R.length===0,ue=(D==null?void 0:D.role)==="follower";return e.jsx("aside",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle flex h-full min-h-0 flex-col overflow-hidden rounded-[28px]",children:e.jsxs(Ds,{defaultValue:"overview",className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/55 bg-card/24 px-3 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-semibold tracking-tight",children:"Operations"}),e.jsx("p",{className:"mt-0.5 text-[10px] text-muted-foreground",children:"Node, cluster, and live events."})]}),e.jsx(L,{variant:"ghost",size:"icon",onClick:N,className:"h-7 w-7 rounded-[12px]",children:e.jsx(Ht,{className:"h-4 w-4"})})]}),e.jsxs(As,{className:"mt-2 grid h-auto w-full grid-cols-3 rounded-[16px] bg-muted/70 p-0.5",children:[e.jsx(ze,{value:"overview",className:"rounded-[12px] px-2 py-0.5 text-[11px]",children:"Overview"}),e.jsx(ze,{value:"nodes",className:"rounded-[12px] px-2 py-0.5 text-[11px]",children:"Nodes"}),e.jsx(ze,{value:"events",className:"rounded-[12px] px-2 py-0.5 text-[11px]",children:"Live events"})]})]}),e.jsx(Ue,{value:"overview",className:"mt-0 min-h-0 flex-1",children:e.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto px-3 py-3",children:e.jsxs("div",{className:"space-y-4",children:[D&&e.jsx(js,{node:D,systemInfo:a,blockingTaskCount:r.get(D.id)??0,devTunnelNodeId:k,onToggleNodeDevTunnel:S,showActions:!1,defaultExpanded:!1}),e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-1.5",children:[e.jsx("div",{className:"text-[11px] font-medium text-foreground",children:"Cluster snapshot"}),e.jsx(Le,{variant:"outline",className:"rounded-[11px] border-border/70 bg-background/60",children:f?"Connected":"Reconnecting"})]}),v&&!t?e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] text-muted-foreground",children:[e.jsx(ve,{className:"h-4 w-4 animate-spin"}),"Loading cluster state..."]}):j&&!t?e.jsx("div",{className:"rounded-[18px] border border-destructive/20 bg-destructive/10 px-2.5 py-2 text-[11px] text-destructive",children:j}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx(qe,{label:"Term",value:String((t==null?void 0:t.term)??0)}),e.jsx(qe,{label:"Nodes",value:String((t==null?void 0:t.nodes.length)??0)}),e.jsx(qe,{label:"Pending",value:String((t==null?void 0:t.taskSummary.pending)??0)}),e.jsx(qe,{label:"Running",value:String((t==null?void 0:t.taskSummary.running)??0)}),e.jsx(qe,{label:"Completed",value:String((t==null?void 0:t.taskSummary.completed)??0)}),e.jsx(qe,{label:"Failed",value:String((t==null?void 0:t.taskSummary.failed)??0)})]}),e.jsxs("div",{className:"space-y-2 rounded-[18px] border border-border/60 bg-background/52 px-2.5 py-2.5 shadow-sm",children:[e.jsx(Re,{label:"Leader",value:((U=t==null?void 0:t.leader)==null?void 0:U.name)??"None"}),e.jsx(Re,{label:"Leader URL",value:M??"Unavailable",mono:!0,action:M?e.jsx(tt,{label:"Copy leader URL",onClick:()=>void We(M,"Leader URL copied")}):void 0}),e.jsx(Re,{label:"Feed",value:f?"Receiving live updates":"Reconnecting to event stream"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:B&&e.jsxs(L,{variant:"outline",size:"sm",onClick:h,disabled:l,className:"h-7 rounded-[12px] px-2.5 text-[11px]",children:[l&&e.jsx(ve,{className:"h-3.5 w-3.5 animate-spin"}),"Promote self"]})})]})]})]})})}),e.jsx(Ue,{value:"nodes",className:"mt-0 min-h-0 flex-1",children:e.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto px-3 py-3",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-1.5",children:[e.jsx("div",{className:"text-[11px] font-medium text-foreground",children:"This node"}),z?e.jsx(L,{variant:"outline",size:"sm",onClick:x,className:"h-7 rounded-[12px] px-2.5 text-[11px]",children:"Join node"}):ue?e.jsxs(L,{variant:"outline",size:"sm",onClick:C,disabled:y,className:"h-7 rounded-[12px] px-2.5 text-[11px]",children:[y&&e.jsx(ve,{className:"h-3.5 w-3.5 animate-spin"}),"Leave cluster"]}):null]}),D&&e.jsx(js,{node:D,systemInfo:a,blockingTaskCount:r.get(D.id)??0,devTunnelNodeId:k,onToggleNodeDevTunnel:S,showActions:!0,defaultExpanded:!0})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{className:"text-[11px] font-medium text-foreground",children:["Peer nodes (",R.length,")"]}),R.length>0?e.jsx("div",{className:"space-y-2",children:R.map(P=>e.jsx(To,{node:P,isLeader:!!W,blockingTaskCount:r.get(P.id)??0,devTunnelNodeId:k,onToggleNodeDevTunnel:S},P.id))}):e.jsx("div",{className:"rounded-[20px] border border-dashed border-border/70 bg-background/35 px-3 py-3 text-[11px] text-muted-foreground",children:"No peer nodes are connected yet."})]})]})})}),e.jsx(Ue,{value:"events",className:"mt-0 min-h-0 flex-1",children:e.jsxs("div",{className:"flex h-full min-h-0 flex-col px-3 py-3",children:[e.jsxs("div",{className:"mb-3 space-y-2",children:[e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-1.5 text-[11px] font-medium text-foreground",children:[e.jsx(tr,{className:A("h-4 w-4",f?"text-emerald-500":"text-destructive")}),"Live events"]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs(ye,{value:d,onValueChange:o,children:[e.jsx(we,{className:"h-7 min-w-[11rem] flex-1 rounded-[13px] border-border/70 bg-background/60 text-[11px] sm:max-w-[15rem]",children:e.jsx(De,{placeholder:"Event type"})}),e.jsx(Ce,{children:c.map(P=>e.jsx(he,{value:P,className:"text-[11px]",children:P==="all"?"All event types":P},P))})]}),e.jsx(Le,{variant:"outline",className:"rounded-[11px] border-border/70 bg-background/60",children:f?"Connected":"Reconnecting"})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx(sr,{events:g,maxHeight:"100%",emptyTitle:d==="all"?"No live events yet":"No matching events",emptyDescription:d==="all"?"Cluster activity appears here as it happens.":`No "${d}" events are in the current stream.`,nodeNameById:n})})]})})]})})}function js({node:t,systemInfo:a,blockingTaskCount:n,devTunnelNodeId:r,onToggleNodeDevTunnel:d,showActions:o=!0,defaultExpanded:c=!1}){const[g,f]=s.useState(c),v=(a==null?void 0:a.dashboardOrigin)??t.dashboardOrigin,j=t.devtunnelEndpoint??t.endpoint,l=v??t.endpoint,h=(a==null?void 0:a.workDir)??t.workDir,x=Ws(t,a==null?void 0:a.transportType),y=Wt(t,a==null?void 0:a.transportType),C=y&&Je((a==null?void 0:a.transportType)??t.transportType)?!0:Hs(t,a==null?void 0:a.transportType),S=n>0;return e.jsxs("section",{className:"rounded-[22px] border border-primary/20 bg-primary/8 shadow-[0_24px_80px_-60px_hsl(var(--primary)/0.9)]",children:[e.jsxs("button",{type:"button",onClick:()=>f(k=>!k),className:"w-full px-3 py-2 text-left",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[g?e.jsx(st,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.jsx(et,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx(Ls,{status:t.status}),e.jsx("span",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:"Current node"}),e.jsx("a",{href:l,target:"_blank",rel:"noreferrer",onClick:k=>k.stopPropagation(),className:"ml-auto shrink-0 text-muted-foreground transition-colors hover:text-primary",title:"Open Dashboard",children:e.jsx(Ps,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-1.5 pl-6",children:[e.jsx("span",{className:"text-[11px] font-semibold tracking-tight text-foreground",children:t.name}),e.jsx(Rs,{role:t.role}),e.jsx(Le,{variant:"outline",className:"rounded-[11px] border-primary/30 bg-background/60 text-[10px] capitalize",children:t.status})]})]}),g&&e.jsxs("div",{className:"space-y-3 border-t border-primary/15 px-3 pb-3 pt-2.5",children:[e.jsxs("div",{className:"space-y-2 rounded-[16px] border border-primary/20 bg-background/72 px-2 py-2 shadow-sm",children:[e.jsx(Re,{label:"Node ID",value:t.id,mono:!0}),v&&e.jsx(Re,{label:"Dashboard",value:v,mono:!0,action:e.jsx(tt,{label:"Copy dashboard URL",onClick:()=>void We(v,"Dashboard URL copied")})}),e.jsx(Re,{label:"Node URL",value:j,mono:!0,action:e.jsx(tt,{label:"Copy node URL",onClick:()=>void We(j,"Node URL copied")})}),h&&e.jsx(Re,{label:"Workspace",value:h,mono:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-1.5",children:[e.jsx(Dt,{label:"Transport",value:x}),a&&e.jsx(Dt,{label:"Uptime",value:ar(a.uptime),mono:!0})]}),e.jsx(Os,{capabilities:t.capabilities,action:o&&C?e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>d(t),disabled:r===t.id||S,className:"h-7 rounded-[12px] px-2.5 text-[11px]",title:S?"Finish assigned or running tasks before changing remote access":void 0,children:[r===t.id&&e.jsx(ve,{className:"h-3.5 w-3.5 animate-spin"}),y?"Disable Remote Access":"Enable Remote Access"]}):void 0}),o&&C&&S&&e.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[n," active task",n===1?"":"s"," on this node."]})]})]})}function To({node:t,isLeader:a,blockingTaskCount:n,devTunnelNodeId:r,onToggleNodeDevTunnel:d}){const[o,c]=s.useState(!1),g=t.dashboardOrigin,f=t.devtunnelEndpoint??t.endpoint,v=g??t.endpoint,j=Ws(t),l=Wt(t),h=Hs(t),x=n>0;return e.jsxs("div",{className:"rounded-[18px] border border-border/60 bg-background/50 shadow-sm",children:[e.jsxs("button",{type:"button",onClick:()=>c(y=>!y),className:"w-full px-3 py-2 text-left",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[o?e.jsx(st,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}):e.jsx(et,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx(Ls,{status:t.status}),e.jsx("span",{className:"text-[10px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:"Peer node"}),e.jsx("a",{href:v,target:"_blank",rel:"noreferrer",onClick:y=>y.stopPropagation(),className:"ml-auto shrink-0 text-muted-foreground transition-colors hover:text-primary",title:"Open Dashboard",children:e.jsx(Ps,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"mt-1 flex items-center gap-1.5 pl-5",children:[e.jsx("span",{className:"text-[11px] font-semibold text-foreground",children:t.name}),e.jsx(Rs,{role:t.role}),e.jsx(Le,{variant:"outline",className:"rounded-[11px] border-border/70 bg-background/60 text-[10px] capitalize",children:t.status})]})]}),o&&e.jsxs("div",{className:"space-y-3 border-t border-border/50 px-3 pb-3 pt-2.5",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(Re,{label:"Node ID",value:t.id,mono:!0}),g&&e.jsx(Re,{label:"Dashboard",value:g,mono:!0,action:e.jsx(tt,{label:"Copy dashboard URL",onClick:()=>void We(g,"Dashboard URL copied")})}),e.jsx(Re,{label:"Node URL",value:f,mono:!0,action:e.jsx(tt,{label:"Copy node URL",onClick:()=>void We(f,"Node URL copied")})}),t.workDir&&e.jsx(Re,{label:"Workspace",value:t.workDir,mono:!0}),e.jsx(Dt,{label:"Transport",value:j})]}),e.jsx(Os,{capabilities:t.capabilities,action:a&&h?e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>d(t),disabled:r===t.id||x,className:"h-7 rounded-[12px] px-2.5 text-[11px]",title:x?"Finish assigned or running tasks before changing remote access":void 0,children:[r===t.id&&e.jsx(ve,{className:"h-3.5 w-3.5 animate-spin"}),l?"Disable Remote Access":"Enable Remote Access"]}):void 0}),a&&h&&x&&e.jsxs("div",{className:"text-[11px] text-muted-foreground",children:[n," active task",n===1?"":"s"," on this node."]})]})]})}function tt({label:t,onClick:a}){return e.jsx(L,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 rounded-[12px] text-muted-foreground",onClick:a,"aria-label":t,title:t,children:e.jsx(Es,{className:"h-3.5 w-3.5"})})}function Do(t,a,n,r){var c;if(!t)return{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Select a task to continue the conversation."};const d=((c=a==null?void 0:a.self)==null?void 0:c.role)==="follower";return t.assignedTo!==null&&t.assignedNodeAvailable===!1?{taskUnavailable:!0,chatDisabled:!0,chatDisabledReason:`${t.assignedNodeName??"Assigned node"} is unavailable. Leave the cluster on that node or re-run the task elsewhere.`}:d?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Follower nodes are read-only. Use the leader dashboard to manage chat, or leave the cluster first."}:n||r?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Waiting for the current turn to finish..."}:ct.has(t.status)||t.status==="archived"?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:ct.has(t.status)?"Task has not started yet...":"Archived tasks are read-only."}:{taskUnavailable:!1,chatDisabled:!1,chatDisabledReason:"Continue the conversation..."}}var ut="Checkbox",[Mo]=ir(ut),[Ao,Jt]=Mo(ut);function Lo(t){const{__scopeCheckbox:a,checked:n,children:r,defaultChecked:d,disabled:o,form:c,name:g,onCheckedChange:f,required:v,value:j="on",internal_do_not_use_render:l}=t,[h,x]=nr({prop:n,defaultProp:d??!1,onChange:f,caller:ut}),[y,C]=s.useState(null),[S,k]=s.useState(null),N=s.useRef(!1),W=y?!!c||!!y.closest("form"):!0,B={checked:h,disabled:o,setChecked:x,control:y,setControl:C,name:g,form:c,value:j,hasConsumerStoppedPropagationRef:N,required:v,defaultChecked:Be(d)?!1:d,isFormControl:W,bubbleInput:S,setBubbleInput:k};return e.jsx(Ao,{scope:a,...B,children:Po(l)?l(B):r})}var sa="CheckboxTrigger",aa=s.forwardRef(({__scopeCheckbox:t,onKeyDown:a,onClick:n,...r},d)=>{const{control:o,value:c,disabled:g,checked:f,required:v,setControl:j,setChecked:l,hasConsumerStoppedPropagationRef:h,isFormControl:x,bubbleInput:y}=Jt(sa,t),C=Fs(d,j),S=s.useRef(f);return s.useEffect(()=>{const k=o==null?void 0:o.form;if(k){const N=()=>l(S.current);return k.addEventListener("reset",N),()=>k.removeEventListener("reset",N)}},[o,l]),e.jsx(Vt.button,{type:"button",role:"checkbox","aria-checked":Be(f)?"mixed":f,"aria-required":v,"data-state":ia(f),"data-disabled":g?"":void 0,disabled:g,value:c,...r,ref:C,onKeyDown:ls(a,k=>{k.key==="Enter"&&k.preventDefault()}),onClick:ls(n,k=>{l(N=>Be(N)?!0:!N),y&&x&&(h.current=k.isPropagationStopped(),h.current||k.stopPropagation())})})});aa.displayName=sa;var Yt=s.forwardRef((t,a)=>{const{__scopeCheckbox:n,name:r,checked:d,defaultChecked:o,required:c,disabled:g,value:f,onCheckedChange:v,form:j,...l}=t;return e.jsx(Lo,{__scopeCheckbox:n,checked:d,defaultChecked:o,disabled:g,required:c,onCheckedChange:v,name:r,form:j,value:f,internal_do_not_use_render:({isFormControl:h})=>e.jsxs(e.Fragment,{children:[e.jsx(aa,{...l,ref:a,__scopeCheckbox:n}),h&&e.jsx(la,{__scopeCheckbox:n})]})})});Yt.displayName=ut;var ra="CheckboxIndicator",na=s.forwardRef((t,a)=>{const{__scopeCheckbox:n,forceMount:r,...d}=t,o=Jt(ra,n);return e.jsx(rr,{present:r||Be(o.checked)||o.checked===!0,children:e.jsx(Vt.span,{"data-state":ia(o.checked),"data-disabled":o.disabled?"":void 0,...d,ref:a,style:{pointerEvents:"none",...t.style}})})});na.displayName=ra;var oa="CheckboxBubbleInput",la=s.forwardRef(({__scopeCheckbox:t,...a},n)=>{const{control:r,hasConsumerStoppedPropagationRef:d,checked:o,defaultChecked:c,required:g,disabled:f,name:v,value:j,form:l,bubbleInput:h,setBubbleInput:x}=Jt(oa,t),y=Fs(n,x),C=or(o),S=lr(r);s.useEffect(()=>{const N=h;if(!N)return;const W=window.HTMLInputElement.prototype,D=Object.getOwnPropertyDescriptor(W,"checked").set,X=!d.current;if(C!==o&&D){const R=new Event("click",{bubbles:X});N.indeterminate=Be(o),D.call(N,Be(o)?!1:o),N.dispatchEvent(R)}},[h,C,o,d]);const k=s.useRef(Be(o)?!1:o);return e.jsx(Vt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??k.current,required:g,disabled:f,name:v,value:j,form:l,...a,tabIndex:-1,ref:y,style:{...a.style,...S,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});la.displayName=oa;function Po(t){return typeof t=="function"}function Be(t){return t==="indeterminate"}function ia(t){return Be(t)?"indeterminate":t?"checked":"unchecked"}const Bt=s.forwardRef(({className:t,...a},n)=>e.jsx(Yt,{ref:n,className:A("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...a,children:e.jsx(na,{className:A("flex items-center justify-center text-current"),children:e.jsx(He,{className:"h-3.5 w-3.5"})})}));Bt.displayName=Yt.displayName;function Ns({toolbarTasks:t,activeTaskId:a,tasksLoading:n,tasksError:r,isLeader:d,scope:o,agentFilter:c,nodeFilter:g,taskKindFilter:f,agentOptions:v,nodeOptions:j,nodeNameById:l,leaderNodeId:h,searchQuery:x,selectedTaskIds:y,allVisibleTasksSelected:C,someVisibleTasksSelected:S,canBatchArchive:k,onSearchChange:N,onScopeChange:W,onAgentFilterChange:B,onNodeFilterChange:D,onTaskKindFilterChange:X,onToggleTaskSelected:R,onToggleAllVisibleTasks:O,onBatchArchive:M,onBatchDelete:z,onCreateTask:ue,onSelectTask:T,onClose:J}){const[U,P]=s.useState(!!x),[le,Y]=s.useState(!1),[V,ee]=s.useState(!1),ie=s.useRef(null),I=s.useRef(null),ne=s.useRef(null),se=y.size,te=o!=="active"||g!=="all"||c!=="all"||f!=="all",oe=x.trim().length>0,[u,G]=s.useState(new Set),[F,je]=s.useState(new Set),re=s.useMemo(()=>dr(t,l,h),[t,l,h]),ke=re.length===1,m=!ke||te||oe,E=ke&&(te||oe),$=s.useCallback(p=>{G(xe=>{const Q=new Set(xe);return Q.has(p)?Q.delete(p):Q.add(p),Q})},[]),Se=s.useCallback(p=>{je(xe=>{const Q=new Set(xe);return Q.has(p)?Q.delete(p):Q.add(p),Q})},[]);return s.useEffect(()=>{x&&P(!0)},[x]),s.useEffect(()=>{var p;U&&((p=ie.current)==null||p.focus())},[U]),s.useEffect(()=>{if(!U)return;const p=Q=>{var w;const ge=Q.target;ge instanceof Node&&((w=I.current)!=null&&w.contains(ge)||P(!1))},xe=Q=>{Q.key==="Escape"&&P(!1)};return document.addEventListener("mousedown",p),document.addEventListener("keydown",xe),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",xe)}},[U]),s.useEffect(()=>{if(!V)return;const p=Q=>{var w;const ge=Q.target;ge instanceof Node&&((w=ne.current)!=null&&w.contains(ge)||ee(!1))},xe=Q=>{Q.key==="Escape"&&ee(!1)};return document.addEventListener("mousedown",p),document.addEventListener("keydown",xe),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",xe)}},[V]),e.jsxs("aside",{className:"dashboard-panel dashboard-panel-muted animate-panel-settle flex h-full min-h-0 flex-col overflow-hidden rounded-[28px]",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/55 bg-card/24 px-3 py-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-1.5",children:[e.jsx("div",{className:"text-lg font-semibold tracking-tight text-foreground",children:"Tasks"}),e.jsx(L,{variant:"ghost",size:"icon",onClick:J,className:"rounded-[12px]",children:e.jsx(Vs,{className:"h-4 w-4"})})]}),e.jsxs("div",{ref:I,className:"mt-4 flex items-center gap-1.5",children:[e.jsxs("div",{ref:ne,className:A("relative flex items-stretch transition-[flex] duration-200",U?"flex-[2]":"flex-1"),children:[e.jsxs(L,{onClick:()=>{ee(!1),ue("chat")},className:"h-11 flex-1 justify-start rounded-l-[18px] rounded-r-none px-3 text-left shadow-[0_18px_48px_-30px_hsl(var(--primary)/0.95)]",children:[e.jsx(qt,{className:"h-4 w-4"}),"New chat"]}),e.jsx(L,{onClick:()=>ee(p=>!p),"aria-label":"More chat options","aria-haspopup":"menu","aria-expanded":V,className:"h-11 w-9 rounded-l-none rounded-r-[18px] border-l border-primary-foreground/20 px-0 shadow-[0_18px_48px_-30px_hsl(var(--primary)/0.95)]",children:e.jsx(st,{className:A("h-3.5 w-3.5 transition-transform",V&&"rotate-180")})}),V&&e.jsx("div",{role:"menu",className:"absolute left-0 right-0 top-full z-20 mt-2 overflow-hidden rounded-[18px] border border-border/60 bg-popover/96 p-1 shadow-[0_20px_60px_-30px_rgba(0,0,0,0.45)] backdrop-blur-xl",children:e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ee(!1),ue("native")},className:"flex w-full items-center gap-1.5 rounded-[13px] px-2 py-2 text-left text-[11px] font-medium text-foreground transition-colors hover:bg-muted/80",children:[e.jsx(Kt,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),e.jsx("span",{className:"flex-1 truncate whitespace-nowrap",children:"Load session"}),e.jsx("span",{className:"shrink-0 text-[9px] uppercase tracking-[0.18em] text-muted-foreground",children:"native"})]})})]}),U?e.jsxs("div",{className:"flex min-w-0 flex-[3] items-center gap-1.5",children:[e.jsxs("div",{className:"relative min-w-0 flex-1",children:[e.jsx(Lt,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx($e,{ref:ie,value:x,onChange:p=>N(p.target.value),placeholder:"Search tasks",className:"h-11 rounded-[18px] border-border/70 bg-background/68 pl-11 text-[11px]"})]}),e.jsx(L,{variant:"outline",size:"icon",onClick:()=>P(!1),className:"rounded-[14px] border-border/70 bg-background/68",children:e.jsx(cr,{className:"h-4 w-4"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(L,{variant:"outline",onClick:()=>P(!0),className:A("rounded-[14px] border-border/70 bg-background/68 px-3 text-[11px]",x&&"border-primary/40 bg-primary/8 text-primary"),children:[e.jsx(Lt,{className:"h-4 w-4"}),"Search"]}),e.jsx(L,{variant:le||te?"secondary":"outline",size:"icon",onClick:()=>Y(p=>!p),className:A("shrink-0 rounded-[14px] border-border/70 bg-background/68",te&&"border-primary/40 bg-primary/8 text-primary"),title:"Filters",children:e.jsx(an,{className:"h-4 w-4"})})]})]}),(le||te)&&e.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-1.5 sm:grid-cols-2",children:[e.jsxs(ye,{value:o,onValueChange:p=>W(p),children:[e.jsx(we,{className:"h-7 rounded-[13px] border-border/70 bg-background/60 text-[12px]",children:e.jsx(De,{})}),e.jsx(Ce,{children:ur.map(p=>e.jsx(he,{value:p.value,className:"text-[12px]",children:p.label},p.value))})]}),e.jsxs(ye,{value:g,onValueChange:D,children:[e.jsx(we,{className:"h-7 rounded-[13px] border-border/70 bg-background/60 text-[12px]",children:e.jsx(De,{placeholder:"Node"})}),e.jsx(Ce,{children:j.map(p=>e.jsx(he,{value:p.value,className:"text-[12px]",children:p.label},p.value))})]}),e.jsxs(ye,{value:c,onValueChange:B,children:[e.jsx(we,{className:"h-7 rounded-[13px] border-border/70 bg-background/60 text-[12px]",children:e.jsx(De,{placeholder:"Agent"})}),e.jsx(Ce,{children:v.map(p=>e.jsx(he,{value:p,className:"text-[12px]",children:p==="all"?"All agents":p},p))})]}),e.jsxs(ye,{value:f,onValueChange:p=>X(p),children:[e.jsx(we,{className:"h-7 rounded-[13px] border-border/70 bg-background/60 text-[12px]",children:e.jsx(De,{placeholder:"Type"})}),e.jsx(Ce,{children:xr.map(p=>e.jsx(he,{value:p.value,className:"text-[12px]",children:p.label},p.value))})]})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2",children:re.length>0?e.jsxs("div",{className:"space-y-1",children:[d&&e.jsxs("div",{className:"mb-1 flex items-center justify-between px-1 py-1",children:[e.jsxs("label",{className:"flex items-center gap-1.5 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[e.jsx(Bt,{checked:S&&!C?"indeterminate":C,onCheckedChange:p=>O(p===!0),"aria-label":"Select all visible tasks"}),e.jsx("span",{children:"Select all"})]}),se>0&&e.jsx(L,{variant:"ghost",size:"sm",onClick:()=>O(!1),className:"h-7 rounded-[12px] px-2 text-[11px]",children:"Clear"})]}),re.map(p=>{const xe=p.nodeId??"__unassigned__",Q=m&&!E&&u.has(xe);return e.jsxs("div",{className:"space-y-1",children:[m&&e.jsxs("button",{type:"button",onClick:()=>$(xe),"aria-expanded":!Q,className:"flex w-full items-center gap-1.5 rounded-[15px] bg-gradient-to-r from-primary/8 to-muted/20 px-2 py-1.5 text-left text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground transition-all duration-150 hover:from-primary/12 hover:to-muted/30 hover:text-foreground active:scale-[0.99] active:from-primary/15",children:[e.jsx(et,{className:A("h-3.5 w-3.5 shrink-0 transition-transform duration-200",!Q&&"rotate-90")}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:p.nodeName}),e.jsxs("span",{className:"ml-auto flex shrink-0 items-center gap-1.5",children:[p.nodeId===h&&e.jsx(Le,{variant:"outline",className:"rounded-[9px] border-primary/25 bg-primary/8 px-1.5 py-0 text-[9px] font-semibold leading-4 text-primary shadow-none",children:"leader"}),e.jsx("span",{className:"tabular-nums text-muted-foreground/60",children:p.dirs.reduce((ge,w)=>ge+w.tasks.length,0)})]})]}),e.jsx("div",{className:A("grid transition-[grid-template-rows] duration-300 ease-in-out",Q?"grid-rows-[0fr]":"grid-rows-[1fr]"),children:e.jsx("div",{className:"overflow-hidden",children:p.dirs.map(ge=>{const w=`${xe}::${ge.path}`,Z=F.has(w),be=mr(ge.path);return e.jsxs("div",{className:A("space-y-0.5 rounded-xl",m&&"pl-3"),children:[e.jsxs("button",{type:"button",onClick:()=>Se(w),"aria-expanded":!Z,title:ge.path,className:"flex w-full items-center gap-1.5 rounded-[12px] bg-muted/15 px-2 py-1 text-left text-[10px] font-medium text-muted-foreground/70 transition-all duration-150 hover:bg-muted/30 hover:text-foreground active:scale-[0.98] active:bg-muted/40",children:[e.jsx(et,{className:A("h-3 w-3 shrink-0 transition-transform duration-200",!Z&&"rotate-90")}),e.jsx("span",{className:"truncate font-mono",children:be}),e.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-muted-foreground/40",children:ge.tasks.length})]}),e.jsx("div",{className:A("grid transition-[grid-template-rows] duration-300 ease-in-out",Z?"grid-rows-[0fr]":"grid-rows-[1fr]"),children:e.jsx("div",{className:A("overflow-hidden",m?"pl-2":"pl-0"),children:e.jsx("div",{className:"space-y-1.5 border-l border-border/35 py-1 pl-2.5 ml-1.5",children:ge.tasks.map(me=>e.jsxs("div",{className:A("flex items-center gap-1.5 rounded-[18px] border px-2.5 py-1.5 transition-all duration-200","hover:-translate-y-px",me.id===a?"border-primary/45 bg-primary/9 shadow-[0_24px_80px_-54px_hsl(var(--primary)/0.95)]":"border-border/58 bg-background/46 hover:border-border hover:bg-background/70 hover:shadow-[0_10px_28px_-18px_rgba(0,0,0,0.35)]"),children:[d&&e.jsx("div",{className:"flex shrink-0",onClick:Fe=>Fe.stopPropagation(),children:e.jsx(Bt,{checked:y.has(me.id),onCheckedChange:Fe=>R(me.id,Fe===!0),"aria-label":`Select ${me.title}`})}),e.jsxs("button",{type:"button",onClick:()=>T(me.id),className:"min-w-0 flex-1 text-left",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:A("h-1.5 w-1.5 shrink-0 rounded-full",hr(me.status),(me.status==="running"||me.status==="assigned")&&"animate-soft-status-pulse")}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-[11px] font-medium text-foreground",children:me.title}),e.jsx("span",{className:"ml-1 shrink-0 tabular-nums text-[10px] text-muted-foreground/55",children:pr(me.updatedAt)})]}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-1 pl-3",children:[e.jsx(Ms,{status:me.status}),e.jsx("span",{className:"font-mono text-[10px] text-muted-foreground/60",children:me.agent}),me.conversationKind==="nativeSession"&&e.jsx(Le,{variant:"outline",className:"border-sky-500/25 bg-sky-500/10 text-[10px] text-sky-700 dark:text-sky-300",children:"native"}),me.activeShare&&e.jsx(Le,{variant:"outline",className:"border-primary/25 bg-primary/10 text-[10px] text-primary",children:"shared"}),me.assignedNodeAvailable===!1&&e.jsx(Le,{variant:"outline",className:"border-destructive/25 bg-destructive/10 text-[10px] text-destructive",children:"unavailable"})]})]})]},me.id))})})})]},w)})})})]},xe)})]}):n?e.jsx("div",{className:"space-y-2 px-1",children:[1,2,3].map(p=>e.jsx("div",{className:"rounded-[24px] border border-border/40 bg-background/30 px-3 py-3",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"mt-1 h-2.5 w-2.5 shrink-0 animate-pulse rounded-full bg-muted-foreground/20"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx("div",{className:"h-2.5 animate-pulse rounded-full bg-muted-foreground/15",style:{width:`${60+p*12}%`,animationDelay:`${p*120}ms`}}),e.jsx("div",{className:"h-2 w-24 animate-pulse rounded-full bg-muted-foreground/10",style:{animationDelay:`${p*120+60}ms`}})]})]})},p))}):e.jsx("div",{className:"rounded-[24px] border border-dashed border-border/70 bg-background/35 px-3 py-5 text-[11px] text-muted-foreground",children:r||"No tasks match this view."})}),d&&se>0?e.jsxs("div",{className:"shrink-0 border-t border-border/60 px-3 py-3",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Batch actions"}),e.jsxs("div",{className:"mt-2 text-[11px] font-semibold text-foreground",children:[se," task",se!==1?"s":""," selected"]}),!k&&e.jsx("div",{className:"mt-2 text-[11px] text-muted-foreground",children:"Only completed, failed, cancelled, or archived tasks can be archived."}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-1.5",children:[e.jsxs(kt,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",disabled:!k,className:"rounded-[14px]",children:[e.jsx(Xr,{className:"h-3.5 w-3.5"}),"Archive"]})}),e.jsxs(yt,{children:[e.jsxs(wt,{children:[e.jsxs(Ct,{children:["Archive ",se," task",se!==1?"s":"","?"]}),e.jsx(St,{children:"Archived tasks stay hidden from the default task view and can be reopened from the archived scope."})]}),e.jsxs(_t,{children:[e.jsx(Et,{children:"Cancel"}),e.jsx(Tt,{onClick:M,disabled:!k,children:"Archive"})]})]})]}),e.jsxs(kt,{children:[e.jsx(is,{asChild:!0,children:e.jsxs(L,{variant:"destructive",size:"sm",className:"rounded-[14px]",children:[e.jsx(Mn,{className:"h-3.5 w-3.5"}),"Delete"]})}),e.jsxs(yt,{children:[e.jsxs(wt,{children:[e.jsxs(Ct,{children:["Delete ",se," task",se!==1?"s":"","?"]}),e.jsx(St,{children:"This removes the selected tasks and their saved logs."})]}),e.jsxs(_t,{children:[e.jsx(Et,{children:"Cancel"}),e.jsx(Tt,{onClick:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}):null]})}async function Ro(t,a){var n,r;try{const d=await fr(t,a);if((r=(n=globalThis.navigator)==null?void 0:n.clipboard)!=null&&r.writeText)try{await globalThis.navigator.clipboard.writeText(d.url),ce.success("Shared link copied")}catch{ce.success("Shared link created")}else ce.success("Shared link created");return d}catch(d){ce.error(d instanceof Error?d.message:"Failed to create shared link");return}}async function Fo(t){try{return await gr(t),ce.success("Shared link stopped"),!0}catch(a){return ce.error(a instanceof Error?a.message:"Failed to stop shared link"),!1}}function Io(t,a,n){const r=s.useCallback(()=>{a(),n()},[a,n]),d=s.useCallback(async c=>{if(!t)return;const g=await Ro(t.id,c);return g&&r(),g},[t,r]),o=s.useCallback(async()=>{if(!t)return!1;const c=await Fo(t.id);return c&&r(),c},[t,r]);return{handleShareTask:d,handleStopShareTask:o}}function ks(t,a,n){const r=s.useRef(a);r.current=a,s.useEffect(()=>{let c=0,g=0;const f=l=>{const h=l.touches[0];h&&(c=h.clientX,g=h.clientY)},v=l=>{var C,S,k,N;const h=l.changedTouches[0];if(!h)return;const x=h.clientX-c;Math.abs(h.clientY-g)>100||Math.abs(x)<50||(x>0?(S=(C=r.current).onSwipeRight)==null||S.call(C):(N=(k=r.current).onSwipeLeft)==null||N.call(k))},j=(t==null?void 0:t.current)??document;return j.addEventListener("touchstart",f,{passive:!0}),j.addEventListener("touchend",v,{passive:!0}),()=>{j.removeEventListener("touchstart",f),j.removeEventListener("touchend",v)}},[t,n==null?void 0:n.threshold,n==null?void 0:n.maxVertical])}const $o="(min-width: 1024px)",Bo="(min-width: 1800px)";function ys(t){var a,n,r;return((r=(n=(a=globalThis.window)==null?void 0:a.matchMedia)==null?void 0:n.call(a,t))==null?void 0:r.matches)??!1}function Oo(){const[t,a]=s.useState(!0),[n,r]=s.useState(!1),[d,o]=s.useState(()=>ys(Bo)),c=s.useRef(null),g=s.useRef(null);ks(c,{onSwipeLeft:()=>r(!1)}),ks(g,{onSwipeRight:()=>o(!1)});const f=s.useCallback(()=>{if(ys($o)){a(v=>!v);return}r(v=>!v)},[]);return{desktopTasksOpen:t,mobileTasksPanelOpen:n,mobileTasksPanelRef:c,operationsOpen:d,operationsPanelRef:g,setMobileTasksPanelOpen:r,setOperationsOpen:o,toggleTasksPanel:f}}function zo({isLeader:t,selfId:a,subscribe:n}){const[r,d]=s.useState([]),[o,c]=s.useState(!0),[g,f]=s.useState(null),v=s.useCallback(async()=>{try{const j=await br({assignedTo:!t&&a?a:void 0,limit:100});d(j),f(null)}catch(j){f(j instanceof Error?j.message:"Failed to load tasks")}finally{c(!1)}},[t,a]);return vr(v,1e4),s.useEffect(()=>{v()},[v]),s.useEffect(()=>n("task",v),[n,v]),{fetchTasks:v,setTasks:d,tasks:r,tasksError:g,tasksLoading:o}}function Uo(t,a){return a.data.nodeId===t.self.id||a.data.name===t.self.name||a.data.endpoint===t.self.endpoint}function Vo({cluster:t,subscribe:a}){s.useEffect(()=>{var n;if(((n=t==null?void 0:t.self)==null?void 0:n.role)==="leader")return a("node",r=>{const d=String(r.data.name??r.data.nodeId??"node"),o=Uo(t,r);r.type==="node.joined"&&!o&&ce.success(`${d} joined the cluster`),r.type==="node.left"&&!o&&ce.message(`${d} left the cluster`)})},[t,a])}const Ko=[0,300,1e3,2e3];function qo({task:t,getActiveTaskId:a,setLogs:n,setPendingMessages:r}){t.conversationKind==="nativeSession"&&(async()=>{for(const d of Ko){if(d>0&&await new Promise(o=>setTimeout(o,d)),a()!==t.id)return;try{const o=await Is(t.id);if(a()!==t.id||(n(c=>zs(c,o.logs)),r(c=>Us(c,o.logs)),o.total>0))return}catch{}}})()}function Ho(){var ts,ss,as,rs;const{id:t}=jr(),a=Nr(),n=kr(),{cluster:r,systemInfo:d,events:o,sseConnected:c,subscribe:g,refresh:f,loading:v,error:j}=yr(),l=s.useMemo(()=>wr(a.state),[a.state]),[h,x]=s.useState(null),[y,C]=s.useState("active"),[S,k]=s.useState("all"),[N,W]=s.useState("all"),[B,D]=s.useState("all"),[X,R]=s.useState(""),O=s.useDeferredValue(X),{desktopTasksOpen:M,mobileTasksPanelOpen:z,mobileTasksPanelRef:ue,operationsOpen:T,operationsPanelRef:J,setMobileTasksPanelOpen:U,setOperationsOpen:P,toggleTasksPanel:le}=Oo(),[Y,V]=s.useState(()=>!!(l!=null&&l.draftNewTask)),[ee,ie]=s.useState(()=>(l==null?void 0:l.createMode)??"chat"),[I,ne]=s.useState(()=>l!=null&&l.draftNewTask?{route:l.returnRoute??"/",taskId:l.returnTaskId??null}:null),[se,te]=s.useState(!1),[oe,u]=s.useState("transcript"),[G,F]=s.useState("all"),[je,re]=s.useState(!1),[ke,m]=s.useState(null),[E,$]=s.useState([]),[Se,p]=s.useState([]),[xe,Q]=s.useState(!1),[ge,w]=s.useState(null),[Z,be]=s.useState(new Set),[me,Fe]=s.useState(!1),[Ne,Ye]=s.useState(!1),[rt,Xe]=s.useState(null),Qe=s.useRef(null),Ie=s.useRef(null),Oe=((ts=r==null?void 0:r.self)==null?void 0:ts.role)==="leader",Te=(ss=r==null?void 0:r.self)==null?void 0:ss.id;Vo({cluster:r,subscribe:g});const{fetchTasks:q,setTasks:Me,tasks:Ae,tasksError:da,tasksLoading:xt}=zo({isLeader:Oe,selfId:Te,subscribe:g}),fe=s.useMemo(()=>[...Ae].sort((i,b)=>b.updatedAt-i.updatedAt),[Ae]),ca=s.useMemo(()=>{const i=new Map;for(const b of(r==null?void 0:r.nodes)??[]){const _=Ln(fe,b.id);_>0&&i.set(b.id,_)}return i},[r==null?void 0:r.nodes,fe]),Pe=s.useMemo(()=>fe.filter(i=>!Cr(i,y)||S!=="all"&&i.agent!==S||!Sr(i,B)||N==="unassigned"&&i.assignedTo||N!=="all"&&N!=="unassigned"&&_r(i.assignedTo,r==null?void 0:r.nodes,i.assignedNodeName)!==N?!1:O.trim()?Er(i,O):!0),[fe,y,S,B,N,O]);s.useEffect(()=>{be(i=>{const b=Bn(i,Pe.map(_=>_.id));return b.size===i.size?i:b})},[Pe]),s.useEffect(()=>{Oe||be(new Set)},[Oe]);const ua=s.useMemo(()=>["all",...Array.from(new Set(fe.map(i=>i.agent))).sort()],[fe]),xa=s.useMemo(()=>{const b=Array.from(new Set(fe.map(_=>_.assignedTo).filter(_=>!!_))).map(_=>{const de=fe.find(H=>H.assignedTo===_);return(r==null?void 0:r.nodes.find(H=>H.id===_))??{id:_,name:Ts(_,r==null?void 0:r.nodes,de==null?void 0:de.assignedNodeName)}}).sort((_,de)=>_.name.localeCompare(de.name));return[{value:"all",label:"All nodes"},{value:"unassigned",label:"Unassigned"},...b.map(_=>({value:_.name.toLowerCase(),label:_.name}))]},[fe,r==null?void 0:r.nodes]),Xt=s.useMemo(()=>{const i=new Map;for(const b of(r==null?void 0:r.nodes)??[])i.set(b.id,b.name);for(const b of fe)b.assignedTo&&b.assignedNodeName&&!i.has(b.assignedTo)&&i.set(b.assignedTo,b.assignedNodeName);return i},[r==null?void 0:r.nodes,fe]),mt=s.useMemo(()=>["all",...Array.from(new Set(o.map(i=>i.type))).sort()],[o]),ma=s.useMemo(()=>G==="all"?o:o.filter(i=>i.type===G),[o,G]),ha=Pe.length>0&&Pe.every(i=>Z.has(i.id)),pa=Pe.some(i=>Z.has(i.id)),fa=On(Pe,Z);s.useEffect(()=>{l!=null&&l.draftNewTask&&(V(!0),ne({route:l.returnRoute??"/",taskId:l.returnTaskId??null}))},[l]),s.useEffect(()=>{G!=="all"&&!mt.includes(G)&&F("all")},[G,mt]),s.useEffect(()=>{ms(t,Y)&&!h&&fe[0]&&x(fe[0].id)},[t,Y,h,fe]),s.useEffect(()=>{var i;ms(t,Y)&&(h&&Ae.some(b=>b.id===h)||x(((i=fe[0])==null?void 0:i.id)??null))},[t,Y,h,fe,Ae]);const ae=Rn({routeTaskId:t,creatingTask:Y,internalSelectedTaskId:h,sortedTaskIds:fe.map(i=>i.id)}),Ke=s.useMemo(()=>Ae.find(i=>i.id===ae)??null,[Ae,ae]);s.useEffect(()=>{Ie.current=ae??null},[ae]);const nt=s.useCallback(()=>{m(null),$([]),p([]),w(null)},[]),Ee=s.useCallback(async()=>{const i=ae;if(i)try{const b=await Tr(i);if(Ie.current!==i)return;m(b),w(null)}catch(b){if(Ie.current!==i)return;m(null),$([]),p([]),w(b instanceof Error?b.message:"Failed to load task")}finally{Ie.current===i&&Q(!1)}},[ae]),ot=s.useCallback(async()=>{const i=ae;if(i)try{const b=await Is(i);if(Ie.current!==i)return;$(_=>zs(_,b.logs)),p(_=>Us(_,b.logs))}catch{}},[ae]);s.useEffect(()=>{if(!ae){m(null),$([]),p([]),w(null),Q(!1);return}u("transcript"),m(Ke),$([]),p([]),w(null),Q(!0),Ee(),ot()},[ae,ot,Ee]),s.useEffect(()=>{var b;if(!ae||Y||xt||Ae.some(_=>_.id===ae))return;const i=((b=fe[0])==null?void 0:b.id)??null;x(i),nt(),s.startTransition(()=>{n(i?`/tasks/${i}`:"/",{state:null})})},[ae,nt,Y,n,fe,Ae,xt]),s.useEffect(()=>{Ke&&m(i=>!i||i.id!==Ke.id?i:{...i,...Ke})},[Ke]),s.useEffect(()=>g("task.updated",i=>{Me(b=>In(b,i.data))}),[g]),s.useEffect(()=>{if(ae)return g("task",i=>{const b=i.data.taskId;if(!(typeof b!="string"||b!==ae)){if(i.type==="task.output"){const _=i.data.event;if(_){$(H=>Vr(H,_));const de=us(_);de&&p(H=>Kr(H,de))}}i.type==="task.updated"&&Ee(),i.type==="task.status"&&(Ee(),ot())}})},[g,ae,Ee,ot]),s.useEffect(()=>{var i;oe==="transcript"&&((i=Qe.current)==null||i.scrollIntoView({behavior:"smooth"}))},[E,Se,oe]);const K=ke??Ke,ga=K!=null&&K.assignedTo?(r==null?void 0:r.nodes.find(i=>i.id===K.assignedTo))??null:null,ht=Se.length>0,ba=K?Dr.has(K.agent):!1,pt=(K==null?void 0:K.status)==="running",va=K?ct.has(K.status):!1,ja=K?ct.has(K.status)||Mr.has(K.status):!1,Na=!!(K&&Oe&&K.status==="failed"),ft=s.useMemo(()=>Do(K,r,ht,!!pt),[K,r,ht,pt]),gt=s.useMemo(()=>qr([...E,...Se.map(i=>Nt(i.content,i.timestamp))]),[E,Se]),lt=s.useMemo(()=>{if(!K||K.conversationKind==="nativeSession")return null;const i=Hr(K);if(i.length>0)return Nt(i,new Date(K.createdAt).toISOString());if(gt.length>0)return null;const b=Wr(K.description||K.title);return b.length>0?Nt(b,new Date(K.createdAt).toISOString()):null},[K,gt]),bt=s.useMemo(()=>lt?us(lt):null,[lt]),ka=s.useMemo(()=>bt?Gr(E,bt):!1,[E,bt]),vt=s.useCallback((i="chat")=>{const b={route:t?`/tasks/${t}`:"/",taskId:ae};ne(b),ie(i),V(!0),s.startTransition(()=>{n("/",{state:{draftNewTask:!0,returnRoute:b.route,returnTaskId:b.taskId,createMode:i}})})},[t,ae,n]),ya=s.useCallback(()=>{var b;const i=(I==null?void 0:I.taskId)??((b=fe[0])==null?void 0:b.id)??null;V(!1),ne(null),x(i),s.startTransition(()=>{n((I==null?void 0:I.route)??"/",{state:null})})},[I,fe,n]),Qt=s.useCallback(i=>{V(!1),ne(null),x(i),s.startTransition(()=>{n(`/tasks/${i}`,{state:null})})},[n]),wa=s.useCallback(i=>{Ie.current=i.id,V(!1),ne(null),Me(b=>Fn(b,i)),m(i),$([]),p([]),w(null),Q(!1),u("transcript"),x(i.id),qo({task:i,getActiveTaskId:()=>Ie.current,setLogs:$,setPendingMessages:p}),q(),s.startTransition(()=>{n(`/tasks/${i.id}`,{state:null})})},[q,n]),it=s.useCallback(async i=>{if(!ae)return!1;const b=`local-${Date.now()}-${Math.random().toString(16).slice(2)}`;p(_=>[..._,{id:b,content:i,timestamp:new Date().toISOString()}]);try{return await Ar(ae,i),Ee(),!0}catch(_){return p(de=>de.filter(H=>H.id!==b)),ce.error(_ instanceof Error?_.message:"Failed to send message"),!1}},[ae,Ee]),Ca=s.useCallback(i=>{it(i)},[it]),Sa=s.useCallback(i=>it(i),[it]),_a=s.useCallback(async()=>{if(K)try{await Lr(K.id),Ee(),q()}catch(i){ce.error(i instanceof Error?i.message:"Failed to cancel task")}},[K,Ee,q]),{handleShareTask:Ea,handleStopShareTask:Ta}=Io(K,Ee,q),Da=s.useCallback(async()=>{if(K)try{await Pr(K.id),Ee(),q()}catch(i){ce.error(i instanceof Error?i.message:"Failed to retry task")}},[K,Ee,q]),dt=s.useCallback((i,b=!1)=>{const _=zn(Pe,i);return x(_),(b||!_)&&nt(),s.startTransition(()=>{n(_?`/tasks/${_}`:"/",{state:null})}),_},[nt,Pe,n]),Ma=s.useCallback((i,b)=>{be(_=>{const de=new Set(_);return b?de.add(i):de.delete(i),de})},[]),Aa=s.useCallback(i=>{if(!i){be(new Set);return}be(new Set(Pe.map(b=>b.id)))},[Pe]),La=s.useCallback(async()=>{const i=Array.from(Z);if(i.length!==0)try{const{results:b}=await Rr(i),_=b.filter(H=>!H.ok),de=b.filter(H=>H.ok).map(H=>H.id);ae&&de.includes(ae)&&dt(de),_.length>0?ce.error(`Failed to archive ${_.length} task(s): ${_.map(H=>H.error??H.id).join(", ")}`):ce.success(`Archived ${de.length} task(s)`),be(new Set(_.map(H=>H.id))),q()}catch(b){ce.error(b instanceof Error?b.message:"Failed to archive tasks")}},[ae,q,dt,Z]),Pa=s.useCallback(async()=>{const i=Array.from(Z);if(i.length!==0)try{const{results:b}=await Fr(i),_=b.filter(H=>!H.ok),de=b.filter(H=>H.ok).map(H=>H.id);ae&&de.includes(ae)&&dt(de,!0),_.length>0?ce.error(`Failed to delete ${_.length} task(s): ${_.map(H=>H.error??H.id).join(", ")}`):ce.success(`Deleted ${de.length} task(s)`),be(new Set(_.map(H=>H.id))),q()}catch(b){ce.error(b instanceof Error?b.message:"Failed to delete tasks")}},[ae,q,dt,Z]),Ra=s.useCallback(async()=>{Fe(!0);try{await Ir(),f()}catch(i){ce.error(i instanceof Error?i.message:"Failed to promote node")}finally{Fe(!1)}},[f]),Fa=s.useCallback(async()=>{Ye(!0);try{await $r(),ce.success("This node left the remote cluster and is leading itself again."),q(),Ee(),f()}catch(i){ce.error(i instanceof Error?i.message:"Failed to leave cluster")}finally{Ye(!1)}},[Ee,q,f]),Ia=s.useCallback(async i=>{var ns;const b=!Wt(i),_=i.id===((ns=r==null?void 0:r.self)==null?void 0:ns.id),de=_?(d==null?void 0:d.transportType)??i.transportType:i.transportType,H=_&&!b&&Je(de);Xe(i.id);try{H?await Br("direct"):await Or(i.id,b),ce.success(b?`Enabled remote access on ${i.name}`:`Disabled remote access on ${i.name}`),f()}catch(os){ce.error(os instanceof Error?os.message:"Failed to update remote access")}finally{Xe(null)}},[(as=r==null?void 0:r.self)==null?void 0:as.id,f,d==null?void 0:d.transportType]),Zt={toolbarTasks:Pe,activeTaskId:ae,tasksLoading:xt,tasksError:da,isLeader:Oe,scope:y,agentFilter:S,nodeFilter:N,taskKindFilter:B,agentOptions:ua,nodeOptions:xa,nodeNameById:Xt,leaderNodeId:((rs=r==null?void 0:r.leader)==null?void 0:rs.id)??null,searchQuery:X,selectedTaskIds:Z,allVisibleTasksSelected:ha,someVisibleTasksSelected:pa,canBatchArchive:fa,onSearchChange:R,onScopeChange:C,onAgentFilterChange:k,onNodeFilterChange:W,onTaskKindFilterChange:D,onToggleTaskSelected:Ma,onToggleAllVisibleTasks:Aa,onBatchArchive:La,onBatchDelete:Pa,onCreateTask:vt,onSelectTask:Qt,onClose:le},es={cluster:r,systemInfo:d,nodeNameById:Xt,nodeBlockingTaskCounts:ca,eventTypeFilter:G,onEventTypeFilterChange:F,eventTypeOptions:mt,filteredEvents:ma,sseConnected:c,clusterLoading:v,clusterError:j,promotePending:me,onPromote:Ra,onAddNode:()=>te(!0),leavePending:Ne,onLeaveCluster:Fa,onToggleNodeDevTunnel:Ia,devTunnelNodeId:rt,onClose:()=>P(!1)};return e.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden pb-2",children:[e.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[e.jsx("div",{className:A("hidden lg:block lg:shrink-0 lg:transition-all lg:duration-300",M?"lg:mr-3 lg:w-[24rem]":"lg:w-0 lg:overflow-hidden"),children:M&&e.jsx(Ns,{...Zt})}),e.jsx("section",{className:"min-h-0 min-w-0 flex-1",children:e.jsx(_o,{onToggleTasks:le,desktopTasksOpen:M,mobileTasksPanelOpen:z,operationsOpen:T,onToggleOperations:()=>P(i=>!i),cluster:r,sseConnected:c,activeTab:oe,setActiveTab:u,creatingTask:Y,createMode:ee,activeTask:K,assignedNode:ga,taskLoading:xe,taskError:ge,displayEvents:gt,initialPromptAlreadyInLogs:ka,initialPrompt:lt,supportsFollowUp:ba,taskUnavailable:ft.taskUnavailable,chatDisabled:ft.chatDisabled,chatDisabledReason:ft.chatDisabledReason,questionBypassEnabled:je,isRunning:!!pt,isStarting:va,hasPendingFollowUp:ht,canCancel:!!ja,canRetry:!!Na,onRetry:Da,onCancel:_a,onShareTask:Ea,onStopShareTask:Ta,onStartCreateTask:vt,onCancelCreateTask:ya,onCreateTask:wa,onSendMessage:Ca,onQuestionBypassChange:re,onSubmitQuestionResponse:Sa,messagesEndRef:Qe})}),e.jsx("div",{className:A("hidden xl:block xl:shrink-0 xl:transition-all xl:duration-300",T?"xl:ml-3 xl:w-[26rem]":"xl:w-0 xl:overflow-hidden"),children:T&&e.jsx(vs,{...es})})]}),T&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button","aria-label":"Close operations panel",onClick:()=>P(!1),className:"fixed inset-0 z-30 bg-black/45 backdrop-blur-sm xl:hidden"}),e.jsx("div",{ref:J,className:"fixed inset-y-0 right-0 z-40 w-full p-2 sm:max-w-sm sm:p-3 xl:hidden",children:e.jsx(vs,{...es})})]}),z&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button","aria-label":"Close task list",onClick:()=>U(!1),className:"fixed inset-0 z-30 bg-black/45 backdrop-blur-sm lg:hidden"}),e.jsx("div",{ref:ue,className:"fixed inset-y-0 left-0 z-40 w-full p-2 sm:max-w-sm sm:p-3 lg:hidden",children:e.jsx(Ns,{...Zt,onCreateTask:i=>{U(!1),vt(i)},onSelectTask:i=>{U(!1),Qt(i)},onClose:()=>U(!1)})})]}),e.jsx(_s,{open:se,onOpenChange:te,children:e.jsx(Hn,{onAdded:()=>{te(!1),f()}})})]})}const Xo=Object.freeze(Object.defineProperty({__proto__:null,DashboardPage:Ho},Symbol.toStringTag,{value:"Module"}));export{Xo as D,xs as G};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-BX-UYwna.js","assets/index-Bb1MuUmE.js","assets/index-CmW82hgD.css","assets/folder-DhIVX8_W.js","assets/file-CFaB5QBp.js","assets/PreviewTab-DnhQ_cTw.js","assets/input-CgtqVNV3.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as j,au as k,r as s,j as e,L as S,P as T,O as C,aP as P,aQ as M,aR as w,aS as _,aT as L,a0 as y,aU as E}from"./index-Bb1MuUmE.js";import{n as O,j as A,i as I,L as R,C as F,T as v,m as z}from"./DashboardShared-CGZZTe4C.js";/**
|
|
3
|
-
* @license lucide-react v1.7.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 D=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]],V=j("message-square-text",D);/**
|
|
8
|
-
* @license lucide-react v1.7.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 q=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],B=j("terminal",q),U=s.lazy(async()=>({default:(await y(()=>import("./FilesTab-BX-UYwna.js"),__vite__mapDeps([0,1,2,3,4]))).FilesTab})),G=s.lazy(async()=>({default:(await y(()=>import("./PreviewTab-DnhQ_cTw.js"),__vite__mapDeps([5,1,2,6]))).PreviewTab})),H={getOutput:w,getOutputTree:M,getOutputContent:P},W={getOutput:w,createPreviewSession:(t,r)=>E(t,typeof r=="string"?r:r==null?void 0:r.path)};function K(){const{shareId:t}=k(),[r,n]=s.useState(null),[c,a]=s.useState([]),[x,u]=s.useState(!0),[p,d]=s.useState(null),o=s.useRef(null);return s.useEffect(()=>{if(!t){n(null),a([]),d("Shared conversation not found"),u(!1);return}let l=!1;o.current=t,u(!0),d(null);const m=async h=>{try{const[f,b]=await Promise.all([_(t),L(t)]);if(l||o.current!==t)return;n(f),a(N=>h?b.logs:z(N,b.logs)),d(null)}catch(f){if(l||o.current!==t)return;h&&(n(null),a([]),d(f instanceof Error?f.message:"Failed to load shared conversation"))}finally{!l&&o.current===t&&h&&u(!1)}};m(!0);const i=window.setInterval(()=>{m(!1)},2500);return()=>{l=!0,window.clearInterval(i)}},[t]),e.jsx($,{conversation:r,logs:c,loading:x,error:p})}function $({conversation:t,logs:r,loading:n,error:c}){const[a,x]=s.useState("transcript"),[u,p]=s.useState(!1),d=s.useMemo(()=>{if(!t)return null;const i=O(t.payload.initialMessage);return i.length>0?A(i,new Date(t.createdAt).toISOString()):null},[t]),o=s.useMemo(()=>I([...d?[d]:[],...r]),[d,r]),l=(t==null?void 0:t.scope)==="filesPreview",m=e.jsx("section",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain scroll-pb-16 px-4 py-5 sm:px-6",children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-5 pb-16",children:[n&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border/60 bg-background/60 px-4 py-3 text-sm text-muted-foreground",children:[e.jsx(R,{className:"h-4 w-4 animate-spin"}),"Loading shared conversation..."]}),!n&&c&&e.jsxs("div",{className:"rounded-lg border border-destructive/20 bg-destructive/10 px-5 py-8 text-center text-destructive",children:[e.jsx("div",{className:"text-base font-semibold",children:"Shared conversation unavailable"}),e.jsx("div",{className:"mt-2 text-sm",children:c})]}),!n&&!c&&o.length===0&&e.jsxs("div",{className:"rounded-lg border border-dashed border-border/70 bg-background/35 px-5 py-8 text-center",children:[e.jsx(V,{className:"mx-auto h-6 w-6 text-muted-foreground"}),e.jsx("div",{className:"mt-3 text-sm font-medium text-foreground",children:"No transcript output yet"})]}),!n&&!c&&o.map((i,h)=>e.jsx(F,{event:i,questionResponseDisabled:!0},`shared-${h}`))]})});return e.jsxs("div",{className:"relative flex h-full min-h-0 overflow-hidden bg-background text-foreground",children:[e.jsxs("aside",{className:"hidden w-64 shrink-0 flex-col border-r border-border/60 bg-muted/20 px-4 py-5 lg:flex xl:w-72",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background shadow-sm",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.24em] text-muted-foreground",children:"Shared view"})]})]}),e.jsx("div",{className:"mt-7 text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Shared conversation"}),t&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsx("h1",{className:"max-h-28 overflow-hidden break-words text-base font-semibold leading-5 text-foreground [overflow-wrap:anywhere]",title:t.title,children:t.title}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(S,{status:t.status}),e.jsx(T,{priority:t.priority})]}),e.jsxs("div",{className:"space-y-1 text-xs text-muted-foreground",children:[e.jsxs("div",{children:["updated ",C(t.updatedAt)]}),e.jsx("div",{className:"font-mono",children:t.id.slice(0,8)})]})]}),e.jsxs("div",{className:"mt-auto space-y-2 pt-6",children:[u&&e.jsx("div",{className:"rounded-xl border border-border/70 bg-background/80 p-3 font-mono text-[11px] text-foreground shadow-sm",children:"npx -y meshy-node@latest start"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{href:"https://github.com/ai-microsoft/meshy",target:"_blank",rel:"noreferrer","aria-label":"Open Meshy on GitHub",className:"inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/70 bg-background/70 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(Q,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",onClick:()=>p(i=>!i),"aria-expanded":u,className:"inline-flex h-9 items-center gap-2 rounded-full border border-border/70 bg-background/70 px-3 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(B,{className:"h-4 w-4"}),"Try it"]})]})]})]}),e.jsxs("main",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsxs("header",{className:"shrink-0 border-b border-border/60 bg-background/85 px-4 py-3 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-border/70 bg-foreground text-xs font-semibold tracking-[0.24em] text-background lg:hidden",children:"M"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.28em] text-muted-foreground",children:"Meshy Workspace"}),e.jsx("div",{className:"truncate text-base font-semibold text-foreground",children:(t==null?void 0:t.title)??"Shared conversation"})]})]}),l&&e.jsxs("div",{className:"mt-3 inline-flex h-auto rounded-full bg-muted/70 p-1 text-muted-foreground",children:[e.jsx("button",{type:"button",onClick:()=>x("transcript"),className:g(a==="transcript"),children:"Transcript"}),e.jsx("button",{type:"button",onClick:()=>x("files"),className:g(a==="files"),children:"Files"}),e.jsx("button",{type:"button",onClick:()=>x("preview"),className:g(a==="preview"),children:"Preview"})]})]}),l&&t?e.jsxs(e.Fragment,{children:[a==="transcript"&&m,a==="files"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading files..."}),children:e.jsx(U,{taskId:t.shareId,api:H})})}),a==="preview"&&e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:e.jsx(s.Suspense,{fallback:e.jsx(v,{label:"Loading preview..."}),children:e.jsx(G,{taskId:t.shareId,api:W,allowPortPreview:!1})})})]}):m]})]})}function g(t){return t?"inline-flex items-center justify-center whitespace-nowrap rounded-full bg-background px-3 py-1.5 text-sm font-medium text-foreground shadow-sm":"inline-flex items-center justify-center whitespace-nowrap rounded-full px-3 py-1.5 text-sm font-medium transition-colors hover:text-foreground"}function Q({className:t}){return e.jsx("svg",{className:t,viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:e.jsx("path",{d:"M12 2C6.48 2 2 6.58 2 12.23c0 4.51 2.87 8.34 6.84 9.7.5.1.68-.22.68-.49 0-.24-.01-.88-.01-1.73-2.78.62-3.37-1.37-3.37-1.37-.45-1.18-1.11-1.49-1.11-1.49-.91-.64.07-.63.07-.63 1 .07 1.53 1.06 1.53 1.06.89 1.56 2.34 1.11 2.91.85.09-.66.35-1.11.63-1.37-2.22-.26-4.55-1.14-4.55-5.05 0-1.12.39-2.03 1.03-2.75-.1-.26-.45-1.31.1-2.71 0 0 .84-.27 2.75 1.05A9.3 9.3 0 0 1 12 6.96c.85 0 1.71.12 2.51.34 1.91-1.32 2.75-1.05 2.75-1.05.55 1.4.2 2.45.1 2.71.64.72 1.03 1.63 1.03 2.75 0 3.92-2.34 4.79-4.57 5.05.36.32.68.94.68 1.9 0 1.37-.01 2.47-.01 2.81 0 .27.18.59.69.49A10.05 10.05 0 0 0 22 12.23C22 6.58 17.52 2 12 2Z"})})}export{K as SharedConversationPage,$ as SharedConversationView};
|