meshy-node 0.2.8 → 0.3.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # meshy-node
2
2
 
3
- Version: 0.2.8
3
+ Version: 0.3.2
4
4
 
5
5
  This package contains the built Meshy standalone node runtime only.
6
6
  It intentionally excludes repository source files and TypeScript sources.
@@ -0,0 +1,130 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-CSpNGxJl.js","assets/index-CSVyG8lh.js","assets/index-CnhngBZ-.css","assets/folder-D2R8g5cx.js","assets/file-DCzQQ4U3.js","assets/PreviewTab-CEFgpX6R.js","assets/DiffTab-BLGTdyp_.js","assets/DashboardShared-BSmoDCJG.js"])))=>i.map(i=>d[i]);
2
+ import{c as he,r as s,j as e,a as _,b as ir,d as dr,e as cr,D as Es,f as ur,g as Ds,B as Te,h as xr,i as M,X as Ve,R as mr,T as hr,k as Ts,P as pr,u as kt,W as fr,C as gr,l as Rt,m as br,n as vr,o as As,O as jr,p as Nr,q as Ms,s as Ps,t as kr,v as yr,w as Ge,x as wr,F as Cr,S as be,y as Sr,z as _r,A as me,E as we,G as Ce,H as De,I as Se,J as Ht,K as Ie,L as Er,M as Ls,N as Rs,Q as $s,U as Dr,V as Tr,Y as Fs,Z as ze,_ as Ue,$ as Wt,a0 as Ar,a1 as Os,a2 as Is,a3 as Bs,a4 as Mr,a5 as Gt,a6 as Pr,a7 as Lr,a8 as Rr,a9 as $r,aa as Fr,ab as Or,ac as zs,ad as Ir,ae as Br,af as zr,ag as Ur,ah as Vr,ai as qr,aj as Kr,ak as Hr,al as Wr,am as Gr,an as Jr,ao as Yr,ap as Xr,aq as Qr,ar as Zr,as as en}from"./index-CSVyG8lh.js";import{r as xs,e as tn,b as Us,t as Vs,L as Ne,D as st,T as Jt,a as qs,C as Yt,c as qe,d as Ks,f as sn,g as ms,h as an,i as Mt,s as rn,j as He,I as Me,M as $t,k as nn,l as Hs,W as ht,m as on,n as ln,o as dn,p as cn,q as un,u as Ws,v as Gs,w as xn,x as mn,y as hn,z as pn,A as fn,B as hs,E as gn,F as bn,R as vn,G as jn,H as Pt,J as Nn,K as kn,N as yn}from"./DashboardShared-BSmoDCJG.js";import{F as wn,C as at}from"./folder-D2R8g5cx.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 Cn=[["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"}]],Sn=he("archive",Cn);/**
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 _n=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],En=he("arrow-up",_n);/**
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 Dn=[["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=he("flag",Dn);/**
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 An=[["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"}]],Mn=he("funnel",An);/**
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 Pn=[["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"}]],ps=he("git-branch",Pn);/**
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 Ln=[["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"}]],Rn=he("globe",Ln);/**
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 $n=[["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"}]],Ft=he("history",$n);/**
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 Fn=[["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"}]],Ot=he("image-plus",Fn);/**
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 On=[["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"}]],In=he("laptop",On);/**
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 Bn=[["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"}]],Xt=he("link-2",Bn);/**
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 zn=[["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=he("message-square-plus",zn);/**
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 Un=[["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"}]],Js=he("panel-left-close",Un);/**
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 Vn=[["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"}]],qn=he("panel-left-open",Vn);/**
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 Kn=[["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"}]],Ys=he("panel-right-close",Kn);/**
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 Hn=[["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"}]],Wn=he("panel-right-open",Hn);/**
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 Gn=[["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"}]],nt=he("pencil",Gn);/**
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"}]],Yn=he("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 Xn=[["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"}]],Qn=he("rotate-ccw",Xn);/**
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 Zn=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],It=he("search",Zn);/**
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 eo=[["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"}]],Xs=he("send",eo);/**
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 to=[["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"}]],so=he("share-2",to);/**
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 ao=[["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"}]],ro=he("sliders-horizontal",ao);/**
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 no=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],oo=he("sparkles",no);/**
118
+ * @license lucide-react v1.7.0 - ISC
119
+ *
120
+ * This source code is licensed under the ISC license.
121
+ * See the LICENSE file in the root directory of this source tree.
122
+ */const lo=[["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"}]],io=he("trash-2",lo),co=new Set(["assigned","running"]);function uo(t,a){return t.reduce((r,n)=>n.assignedTo===a&&co.has(n.status)?r+1:r,0)}function Ye(t){return(t==null?void 0:t.toLowerCase())==="devtunnel"}function xo(t){return t?Ye(t)?"DevTunnel":t.charAt(0).toUpperCase()+t.slice(1):"Direct"}function Zt(t,a){return Ye(a??t.transportType)||!!t.devtunnelEndpoint}function Qs(t,a){return!Ye(a??t.transportType)}function Zs(t,a){const r=a??t.transportType;return Ye(r)?"DevTunnel":t.devtunnelEndpoint?"Direct + DevTunnel":xo(r)}function fs(t,a){return!t&&!a}function mo({routeTaskId:t,creatingTask:a,internalSelectedTaskId:r,sortedTaskIds:n}){return t||(a?null:r??n[0]??null)}function ho(t,a){return[a,...t.filter(r=>r.id!==a.id)]}function po(t,a){const r=a.taskId,n=a.updates;return typeof r!="string"||!n||typeof n!="object"?t:t.map(i=>i.id===r?{...i,...n}:i)}const fo=new Set(["completed","failed","cancelled","archived"]);function go(t,a){const r=new Set(a);return new Set(Array.from(t).filter(n=>r.has(n)))}function bo(t,a){const r=new Set(a);if(r.size===0)return!1;const n=t.filter(i=>r.has(i.id));return n.length===r.size&&n.every(i=>fo.has(i.status))}function vo(t,a){var n;const r=new Set(a);return((n=t.find(i=>!r.has(i.id)))==null?void 0:n.id)??null}const Pe=s.forwardRef(({className:t,type:a,...r},n)=>e.jsx("input",{type:a,className:_("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...r}));Pe.displayName="Input";var jo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],No=jo.reduce((t,a)=>{const r=ir(`Primitive.${a}`),n=s.forwardRef((i,o)=>{const{asChild:c,...f}=i,g=c?r:a;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),e.jsx(g,{...f,ref:o})});return n.displayName=`Primitive.${a}`,{...t,[a]:n}},{}),ko="Label",ea=s.forwardRef((t,a)=>e.jsx(No.label,{...t,ref:a,onMouseDown:r=>{var i;r.target.closest("button, input, select, textarea")||((i=t.onMouseDown)==null||i.call(t,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));ea.displayName=ko;var ta=ea;const yo=dr("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),_e=s.forwardRef(({className:t,...a},r)=>e.jsx(ta,{ref:r,className:_(yo(),t),...a}));_e.displayName=ta.displayName;function wo({onAdded:t}){const[a,r]=s.useState(""),[n,i]=s.useState(!1),[o,c]=s.useState(null),f=s.useCallback(async g=>{if(g.preventDefault(),!!a.trim()){i(!0),c(null);try{await cr({leaderEndpoint:a.trim(),transport:"devtunnel"}),t()}catch(v){c(v instanceof Error?v.message:"Failed to join node")}finally{i(!1)}}},[a,t]);return e.jsx(Es,{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(ur,{className:"space-y-2 text-left",children:[e.jsx(Ds,{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:f,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(Te,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 text-[10px] uppercase tracking-[0.16em]",children:"DevTunnel only"})]}),e.jsx(Pe,{id:"leader-endpoint",type:"url",value:a,onChange:g=>r(g.target.value),placeholder:"https://your-leader.devtunnels.ms",className:"h-11 rounded-2xl 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(xr,{className:"border-t border-border/60 pt-4",children:e.jsx(M,{type:"submit",disabled:!a.trim()||n,className:"rounded-2xl",children:n?"Joining...":"Join node"})})]})]})})}function sa(){const[t,a]=s.useState([]),[r,n]=s.useState(null),i=s.useRef(null),o=s.useCallback(()=>{var j;(j=i.current)==null||j.click()},[]),c=s.useCallback(async j=>{const l=Array.from(j.target.files??[]);if(l.length!==0)try{const m=await xs(l);a(h=>[...h,...m]),n(null)}catch(m){n(m instanceof Error?m.message:"Failed to attach image")}finally{j.target.value=""}},[]),f=s.useCallback(async j=>{const l=tn(j.clipboardData);if(l.length!==0){j.preventDefault();try{const m=await xs(l);a(h=>[...h,...m]),n(null)}catch(m){n(m instanceof Error?m.message:"Failed to attach image")}}},[]),g=s.useCallback(j=>{a(l=>l.filter((m,h)=>h!==j))},[]),v=s.useCallback(()=>{a([]),n(null)},[]);return{images:t,error:r,fileInputRef:i,pickImages:o,handleFileChange:c,handlePaste:f,removeImage:g,clearImages:v}}function Co({onSend:t,disabled:a,disabledReason:r="Chat is waiting on the agent.",placeholder:n="Send a follow-up message...",contextItems:i=[],running:o=!1,onStop:c}){const[f,g]=s.useState(""),v=s.useRef(null),{images:j,error:l,fileInputRef:m,pickImages:h,handleFileChange:w,handlePaste:C,removeImage:D,clearImages:y}=sa(),N=s.useCallback(()=>{v.current&&(v.current.style.height="auto")},[]),O=s.useCallback(()=>{const L=Us(f,j);L.length===0||a||(t(L),g(""),y(),N())},[f,j,a,t,y,N]),z=s.useCallback(L=>{L.key==="Enter"&&!L.shiftKey&&(L.preventDefault(),O())},[O]),T=s.useCallback(()=>{v.current&&(v.current.style.height="auto",v.current.style.height=`${Math.min(v.current.scrollHeight,220)}px`)},[]),H=!a&&!o&&(f.trim().length>0||j.length>0),F=o&&!!c,I=o?c?"Task is running — click to stop":"Task is running...":a?r:"Enter sends, Shift+Enter adds a line";return e.jsxs("div",{className:"border-t border-border/60 bg-background/55 px-2 py-1.5 backdrop-blur-xl sm:px-4 sm:py-2",children:[i.length>0&&e.jsx("div",{className:"flex flex-wrap items-center gap-2 px-3 pb-2.5",children:i.map(L=>e.jsxs("div",{className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-border/60 bg-muted/40 px-3 py-1 text-xs",children:[e.jsx("span",{className:"shrink-0 text-[9px] font-medium uppercase tracking-[0.12em] text-muted-foreground/80",children:L.label}),e.jsx("span",{className:`truncate text-foreground/90 ${L.mono?"font-mono text-[11px]":""}`,children:L.value})]},`${L.label}:${L.value}`))}),e.jsxs("div",{className:"overflow-hidden rounded-3xl border border-border/65 bg-card/85 shadow-[0_28px_90px_-62px_rgba(0,0,0,var(--panel-shadow-alpha))] sm:rounded-[40px]",children:[e.jsx("input",{ref:m,type:"file",accept:"image/*",multiple:!0,onChange:w,className:"hidden"}),j.length>0&&e.jsx("div",{className:"px-3 pt-3 sm:px-6 sm:pt-6",children:e.jsx("div",{className:"flex flex-wrap gap-3",children:j.map((L,B)=>e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:Vs(L),alt:L.filename??`attachment ${B+1}`,className:"h-24 w-24 rounded-[22px] border border-border/70 object-cover"}),e.jsx("button",{type:"button",onClick:()=>D(B),className:"absolute -top-2 -right-2 flex h-7 w-7 items-center justify-center rounded-full border border-border/70 bg-background text-muted-foreground transition-colors hover:text-foreground","aria-label":`Remove ${L.filename??`image ${B+1}`}`,children:e.jsx(Ve,{className:"h-3.5 w-3.5"})})]},`${L.filename??"image"}-${B}`))})}),e.jsxs("div",{className:"flex items-end gap-2 px-3 pt-3 pb-3 sm:px-6 sm:pt-4 sm:pb-4",children:[e.jsx("textarea",{ref:v,value:f,onChange:L=>g(L.target.value),onKeyDown:z,onPaste:C,onInput:T,placeholder:n,disabled:a,rows:1,className:"min-h-[2.5rem] flex-1 resize-none bg-transparent px-0 py-1 text-sm leading-7 text-foreground placeholder:text-muted-foreground/70 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"}),e.jsxs(M,{type:"button",variant:"ghost",onClick:h,disabled:a,className:"mb-0.5 h-9 shrink-0 gap-1.5 rounded-full px-2 text-xs text-muted-foreground hover:text-foreground sm:px-3",title:"Attach images",children:[e.jsx(Ot,{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:I,children:e.jsx(M,{onClick:o?c:O,disabled:o?!F:!H,size:"icon","aria-label":o?"Stop running task":"Send message",className:"mb-0.5 h-9 w-9 shrink-0 rounded-full bg-primary/85 text-primary-foreground shadow-sm hover:bg-primary",children:o?e.jsx(Ne,{className:"h-4 w-4 animate-spin"}):e.jsx(Xs,{className:"h-4 w-4"})})})]}),l&&e.jsx("div",{className:"border-t border-destructive/20 bg-destructive/10 px-3 py-2 text-xs text-destructive sm:px-6 sm:py-3",children:l})]})]})}var aa="AlertDialog",[So]=Ms(aa,[Ts]),Oe=Ts(),ra=t=>{const{__scopeAlertDialog:a,...r}=t,n=Oe(a);return e.jsx(mr,{...n,...r,modal:!0})};ra.displayName=aa;var _o="AlertDialogTrigger",na=s.forwardRef((t,a)=>{const{__scopeAlertDialog:r,...n}=t,i=Oe(r);return e.jsx(hr,{...i,...n,ref:a})});na.displayName=_o;var Eo="AlertDialogPortal",oa=t=>{const{__scopeAlertDialog:a,...r}=t,n=Oe(a);return e.jsx(pr,{...n,...r})};oa.displayName=Eo;var Do="AlertDialogOverlay",la=s.forwardRef((t,a)=>{const{__scopeAlertDialog:r,...n}=t,i=Oe(r);return e.jsx(jr,{...i,...n,ref:a})});la.displayName=Do;var We="AlertDialogContent",[To,Ao]=So(We),Mo=Nr("AlertDialogContent"),ia=s.forwardRef((t,a)=>{const{__scopeAlertDialog:r,children:n,...i}=t,o=Oe(r),c=s.useRef(null),f=kt(a,c),g=s.useRef(null);return e.jsx(fr,{contentName:We,titleName:da,docsSlug:"alert-dialog",children:e.jsx(To,{scope:r,cancelRef:g,children:e.jsxs(gr,{role:"alertdialog",...o,...i,ref:f,onOpenAutoFocus:Rt(i.onOpenAutoFocus,v=>{var j;v.preventDefault(),(j=g.current)==null||j.focus({preventScroll:!0})}),onPointerDownOutside:v=>v.preventDefault(),onInteractOutside:v=>v.preventDefault(),children:[e.jsx(Mo,{children:n}),e.jsx(Lo,{contentRef:c})]})})})});ia.displayName=We;var da="AlertDialogTitle",ca=s.forwardRef((t,a)=>{const{__scopeAlertDialog:r,...n}=t,i=Oe(r);return e.jsx(br,{...i,...n,ref:a})});ca.displayName=da;var ua="AlertDialogDescription",xa=s.forwardRef((t,a)=>{const{__scopeAlertDialog:r,...n}=t,i=Oe(r);return e.jsx(vr,{...i,...n,ref:a})});xa.displayName=ua;var Po="AlertDialogAction",ma=s.forwardRef((t,a)=>{const{__scopeAlertDialog:r,...n}=t,i=Oe(r);return e.jsx(As,{...i,...n,ref:a})});ma.displayName=Po;var ha="AlertDialogCancel",pa=s.forwardRef((t,a)=>{const{__scopeAlertDialog:r,...n}=t,{cancelRef:i}=Ao(ha,r),o=Oe(r),c=kt(a,i);return e.jsx(As,{...o,...n,ref:c})});pa.displayName=ha;var Lo=({contentRef:t})=>{const a=`\`${We}\` requires a description for the component to be accessible for screen reader users.
123
+
124
+ You can add a description to the \`${We}\` by passing a \`${ua}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
125
+
126
+ Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${We}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
127
+
128
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return s.useEffect(()=>{var n;document.getElementById((n=t.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(a)},[a,t]),null},Ro=ra,$o=na,Fo=oa,fa=la,ga=ia,ba=ma,va=pa,ja=ca,Na=xa;const Bt=Ro,gs=$o,Oo=Fo,ka=s.forwardRef(({className:t,...a},r)=>e.jsx(fa,{className:_("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...a,ref:r}));ka.displayName=fa.displayName;const pt=s.forwardRef(({className:t,...a},r)=>e.jsxs(Oo,{children:[e.jsx(ka,{}),e.jsx(ga,{ref:r,className:_("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a})]}));pt.displayName=ga.displayName;const ft=({className:t,...a})=>e.jsx("div",{className:_("flex flex-col space-y-2 text-center sm:text-left",t),...a});ft.displayName="AlertDialogHeader";const gt=({className:t,...a})=>e.jsx("div",{className:_("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a});gt.displayName="AlertDialogFooter";const bt=s.forwardRef(({className:t,...a},r)=>e.jsx(ja,{ref:r,className:_("text-lg font-semibold",t),...a}));bt.displayName=ja.displayName;const vt=s.forwardRef(({className:t,...a},r)=>e.jsx(Na,{ref:r,className:_("text-sm text-muted-foreground",t),...a}));vt.displayName=Na.displayName;const jt=s.forwardRef(({className:t,...a},r)=>e.jsx(ba,{ref:r,className:_(Ps(),t),...a}));jt.displayName=ba.displayName;const Nt=s.forwardRef(({className:t,...a},r)=>e.jsx(va,{ref:r,className:_(Ps({variant:"outline"}),"mt-2 sm:mt-0",t),...a}));Nt.displayName=va.displayName;function Io(t,a,r){return t!=="auto"?a.find(n=>n.id===t)??null:r.length===1?r[0]??null:null}function Bo(t){return t.trim()||"."}function bs({value:t,onChange:a,project:r,assignTo:n,nodes:i,assignableNodes:o,layout:c="default",chipClassName:f,chipActiveClassName:g,chipInactiveClassName:v,labelClassName:j,triggerClassName:l}){const[m,h]=s.useState(!1),[w,C]=s.useState(null),[D,y]=s.useState(""),[N,O]=s.useState(!1),[z,T]=s.useState(!1),[H,F]=s.useState(!1),[I,L]=s.useState(null),[B,X]=s.useState(""),[E,U]=s.useState(""),[Q,R]=s.useState(""),[ae,le]=s.useState(!1),W=s.useRef(null),Z=s.useRef(0),G=s.useMemo(()=>Io(n,i,o),[n,i,o]),P=G==null?void 0:G.id,ne=s.useMemo(()=>Bo(r),[r]),fe=s.useMemo(()=>P?`${P}
129
+ ${ne}`:"",[P,ne]),ve=s.useCallback(async(p=0,x=!1)=>{const A=Z.current+1,Y=fe;if(Z.current=A,!P){C(null),y("");return}L(null),x||y(""),x?T(!0):O(!0);try{const q=await kr(P,{path:ne,limit:20,offset:p,allowAbsolute:!0});if(A!==Z.current)return;y(Y),C(ce=>x&&ce?{...q,branches:[...ce.branches,...q.branches]}:q)}catch(q){if(A!==Z.current)return;L(q instanceof Error?q.message:"Failed to load branch info"),x||(C(null),y(""))}finally{A===Z.current&&(O(!1),T(!1))}},[P,fe,ne]);s.useEffect(()=>{if(!P){Z.current+=1,C(null),y(""),L(null);return}ve()},[P,ne,ve]),s.useEffect(()=>{const p=t.trim(),x=D===fe?w:null,A=x!=null&&x.available&&x.currentBranch?x.currentBranch:"";p!==A&&a(A)},[w,fe,D,a,t]),s.useEffect(()=>{if(!m)return;const p=A=>{W.current&&(W.current.contains(A.target)||h(!1))},x=A=>{A.key==="Escape"&&h(!1)};return document.addEventListener("mousedown",p),document.addEventListener("keydown",x),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",x)}},[m]),s.useEffect(()=>{m&&(U(""),R(""),le(!1))},[m,P,ne]);const J=s.useCallback(async()=>{if(!P)return;const p=B.trim(),x=ae?Q.trim():E.trim();if(!(!p||!x)){F(!0),L(null);try{const A=await yr(P,{path:ne,branchName:p,startPoint:x,limit:20,offset:0,allowAbsolute:!0});y(fe),C(A),a(A.currentBranch??A.createdBranch),X(""),U(""),R(""),le(!1),h(!1)}catch(A){L(A instanceof Error?A.message:"Failed to create branch")}finally{F(!1)}}},[P,fe,ne,ae,Q,B,a,E]),u=D===fe?w:null,ee=s.useCallback(()=>{u!=null&&u.hasMore&&ve(u.branches.length,!0)},[u,ve]),$=t.trim()||(u==null?void 0:u.currentBranch)||(u&&!u.available?"No git repo":"Branch"),de=ae?Q.trim():E.trim(),re=!!(u!=null&&u.available&&B.trim()&&de&&!H),ge=c==="composer"?e.jsxs(M,{type:"button",variant:"ghost",onClick:()=>h(p=>!p),title:$,"aria-label":`Branch: ${$}`,className:_(f,l,"min-w-0 max-w-full",t.trim()?g:v),children:[N&&!u?e.jsx(Ne,{className:"h-3.5 w-3.5 shrink-0 animate-spin"}):e.jsx(ps,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:_("min-w-0 truncate",j),children:$})]}):e.jsxs(M,{type:"button",variant:"outline",onClick:()=>h(p=>!p),className:"h-11 w-full justify-between rounded-2xl border-border/70 bg-background/70 px-4",title:$,children:[e.jsx("span",{className:_("truncate",t.trim()?"font-mono text-foreground":"text-muted-foreground"),children:$}),e.jsx("span",{className:"ml-3 shrink-0 text-xs text-muted-foreground",children:G?G.name:"Manual"})]});return e.jsxs("div",{className:_("relative inline-block",c==="composer"?"min-w-0 shrink-0":"w-full"),ref:W,children:[c==="default"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Branch"}),ge]}):ge,m&&e.jsxs("div",{className:_("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(ps,{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??$} · ${u.repoRoot}`:(u==null?void 0:u.currentBranch)??$,children:(u==null?void 0:u.currentBranch)??$}),N?e.jsx(Ne,{className:"h-3 w-3 shrink-0 animate-spin text-muted-foreground"}):null]}),G?N&&!u?e.jsxs("div",{className:"flex items-center justify-center px-3 py-4 text-[11px] text-muted-foreground",children:[e.jsx(Ne,{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(Pe,{value:B,onChange:p=>X(p.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(M,{type:"button",size:"sm",onClick:()=>void J(),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:H?e.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}):e.jsx(Yn,{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"}),!ae&&e.jsxs("button",{type:"button",onClick:()=>le(!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(nt,{className:"h-2.5 w-2.5"}),"Manual"]})]}),ae?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Pe,{value:Q,onChange:p=>R(p.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:()=>{le(!1),R("")},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(p=>{const x=E===p.ref,A=p.branch==="main"||p.branch==="master";return e.jsxs("button",{type:"button",onClick:()=>U(p.ref),className:_("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",x&&"bg-background/70"),title:p.ref,children:[e.jsx("span",{className:_("shrink-0 text-[10px]",A?"text-amber-500 dark:text-amber-400":"text-muted-foreground/60"),"aria-hidden":!0,children:A?"★":"·"}),e.jsx("span",{className:"min-w-0 flex-1 truncate font-mono text-foreground",children:p.ref}),x?e.jsx(Ge,{className:"h-3 w-3 shrink-0 text-primary"}):null]},p.ref)}),u.hasMore&&e.jsxs("button",{type:"button",onClick:ee,disabled:z,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:[z?e.jsx(Ne,{className:"h-3 w-3 animate-spin"}):e.jsx(Ft,{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."}),I&&e.jsx("div",{className:"border-t border-destructive/20 bg-destructive/10 px-3 py-1.5 text-[11px] text-destructive",children:I})]})]})}const zo=20,Uo=3,zt="meshy-working-dir-recents-by-node";function Vo(t){return t.startsWith("/")||t.startsWith("\\\\")||/^[A-Za-z]:[\\/]/.test(t)}function qo(t){const a=t.trim();return a||"."}function Ut(t){const a=[],r=new Set;for(const n of t){const i=n.trim();if(!(!i||r.has(i))&&(r.add(i),a.push(i),a.length===Uo))break}return a}function Ko(t,a){const r=a.trim();return Ut(r?[r,...t]:t)}function ya(t){if(!t||typeof t!="object"||Array.isArray(t))return{};const a={};for(const[r,n]of Object.entries(t)){if(!r||!Array.isArray(n))continue;const i=n.filter(c=>typeof c=="string"),o=Ut(i);o.length>0&&(a[r]=o)}return a}function Ho(t,a,r){if(!a)return t;const n=t[a]??[],i=Ko(n,r);if(i.length===0){if(!(a in t))return t;const{[a]:o,...c}=t;return c}return{...t,[a]:i}}function Wo(t,a){var r;return a?((r=t[a])==null?void 0:r[0])??"":""}function Go(t){if(!t||typeof window>"u")return"";try{const a=window.localStorage.getItem(zt);return a?Wo(ya(JSON.parse(a)),t):""}catch{return""}}function Jo(t,a,r){return t!=="auto"?a.find(n=>n.id===t)??null:r.length===1?r[0]??null:null}function Yo(t,a){const r=a.trim();return r?Vo(r)||!t?r:`${t.replace(/[/\\]+$/,"")}/${r}`:""}function Xo(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 Vt({value:t,onChange:a,assignTo:r,nodes:n,assignableNodes:i,layout:o="default",chipClassName:c,chipActiveClassName:f,chipInactiveClassName:g,labelClassName:v,triggerClassName:j}){const[l,m]=s.useState(!1),[h,w]=s.useState(null),[C,D]=s.useState(!1),[y,N]=s.useState(!1),[O,z]=s.useState(null),[T,H]=s.useState(""),[F,I]=s.useState(!1),[L,B]=s.useState({}),X=s.useRef(null),E=s.useMemo(()=>Jo(r,n,i),[r,n,i]),U=E==null?void 0:E.id,Q=s.useMemo(()=>U?L[U]??[]:[],[L,U]),R=s.useMemo(()=>t.trim()?Yo(E==null?void 0:E.workDir,t):"Use node default",[t,E==null?void 0:E.workDir]);s.useEffect(()=>{if(!(typeof window>"u"))try{const u=window.localStorage.getItem(zt);if(!u)return;const ee=JSON.parse(u);B(ya(ee))}catch{}},[]);const ae=s.useCallback(u=>{U&&B(ee=>{const $=Ho(ee,U,u);if($===ee)return ee;if(typeof window<"u")try{window.localStorage.setItem(zt,JSON.stringify($))}catch{}return $})},[U]),le=s.useCallback((u,ee=!0)=>{const $=u.trim();a($),ee&&$&&ae($),m(!1)},[a,ae]),W=s.useCallback(async(u,ee=0,$=!1)=>{if(U){z(null),$?N(!0):D(!0);try{const de=await wr(U,{path:u,limit:zo,offset:ee,directoriesOnly:!0,allowAbsolute:!0});w(re=>$&&re?{...de,entries:[...re.entries,...de.entries]}:de)}catch(de){z(de instanceof Error?de.message:"Failed to browse directories"),$||w(null)}finally{D(!1),N(!1)}}},[U]),Z=s.useRef(t);Z.current=t;const G=s.useRef(W);G.current=W,s.useEffect(()=>{if(!l)return;const u=Z.current;H(u),I(!1),w(null),z(null),U&&G.current(qo(u))},[l,U]),s.useEffect(()=>{if(!l)return;const u=$=>{X.current&&(X.current.contains($.target)||m(!1))},ee=$=>{$.key==="Escape"&&m(!1)};return document.addEventListener("mousedown",u),document.addEventListener("keydown",ee),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",ee)}},[l]);const P=s.useCallback(u=>{W(u)},[W]),ne=s.useCallback(()=>{h&&W(h.currentPath,h.entries.length,!0)},[h,W]),fe=o==="composer"?e.jsxs(M,{type:"button",variant:"ghost",onClick:()=>m(u=>!u),title:R,"aria-label":`Working directory: ${R}`,className:_(c,j,"min-w-0 max-w-full",t.trim()?f:g),children:[e.jsx(Cr,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:_("min-w-0 truncate",v),children:R})]}):e.jsxs(M,{type:"button",variant:"outline",onClick:()=>m(u=>!u),className:"h-11 w-full justify-between rounded-2xl border-border/70 bg-background/70 px-4",title:R,children:[e.jsx("span",{className:_("truncate",t.trim()?"font-mono text-foreground":"text-muted-foreground"),children:R}),e.jsx("span",{className:"ml-3 shrink-0 text-xs text-muted-foreground",children:E?E.name:"Manual"})]}),ve=Xo(h,E),J=!!(h!=null&&h.parentPath);return e.jsxs("div",{className:_("relative inline-block",o==="composer"?"min-w-0 max-w-[60%] shrink":"w-full"),ref:X,children:[o==="default"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Working directory"}),fe]}):fe,l&&e.jsxs("div",{className:_("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:[Q.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(Ft,{className:"h-2.5 w-2.5"}),"Recent"]}),e.jsx("div",{className:"flex flex-col",children:Q.map(u=>e.jsx("button",{type:"button",onClick:()=>le(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:()=>(h==null?void 0:h.parentPath)&&P(h.parentPath),disabled:!J||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(En,{className:"h-3 w-3"})}),e.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",title:ve,children:ve}),h&&e.jsx("button",{type:"button",onClick:()=>le(h.isAbsolute?h.currentPath:h.currentPath==="."?"":h.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:[E?C?e.jsxs("div",{className:"flex items-center justify-center px-3 py-4 text-[11px] text-muted-foreground",children:[e.jsx(Ne,{className:"mr-1.5 h-3 w-3 animate-spin"}),"Loading..."]}):h&&h.entries.length>0?e.jsxs(e.Fragment,{children:[h.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:()=>le(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(wn,{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:()=>P(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(at,{className:"h-3.5 w-3.5"})})]},u.path)),h.hasMore&&e.jsxs("button",{type:"button",onClick:ne,disabled:y,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:[y?e.jsx(Ne,{className:"h-3 w-3 animate-spin"}):e.jsx(Ft,{className:"h-3 w-3"}),"Load more"]})]}):e.jsx("div",{className:"px-3 py-4 text-center text-[11px] text-muted-foreground",children:O??"No subfolders."}):e.jsx("div",{className:"px-3 py-4 text-center text-[11px] text-muted-foreground",children:"Select a node to browse."}),O&&h&&h.entries.length>0&&e.jsx("div",{className:"border-t border-border/60 px-3 py-1.5 text-[11px] text-destructive",children:O})]}),e.jsx("div",{className:"flex items-center gap-1 border-t border-border/60 bg-background/40 px-2.5 py-1.5",children:F?e.jsxs(e.Fragment,{children:[e.jsx(Pe,{value:T,onChange:u=>H(u.target.value),onKeyDown:u=>{u.key==="Enter"&&T.trim()?(u.preventDefault(),le(T)):u.key==="Escape"&&(u.preventDefault(),I(!1),H(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:()=>le(T),disabled:!T.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(Ge,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>{I(!1),H(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:()=>{H(t),I(!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(nt,{className:"h-3 w-3"})]})})]})]})}function wa(t,a={}){const r=t.filter(n=>n.status==="online");return a.currentNodeRole!=="follower"||!a.leaderNodeId?r:r.filter(n=>n.id!==a.leaderNodeId)}function es({isCurrent:t}){return t?e.jsx(In,{className:"h-3.5 w-3.5 shrink-0 text-emerald-500 dark:text-emerald-400","aria-label":"current node"}):e.jsx(Rn,{className:"h-3.5 w-3.5 shrink-0 text-sky-500 dark:text-sky-400","aria-label":"remote follower node"})}function qt(t,a){return t.map(r=>{const n=!!a&&r.id===a;return e.jsx(be,{value:r.id,children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(es,{isCurrent:n}),e.jsx("span",{className:"truncate",children:r.name}),e.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:n?"current":"remote"})]})},r.id)})}function Qo(t){var n;const a=t.sessionId.trim(),r=t.cwd.trim();return!a||!r||!t.assignTo?null:{title:t.title.trim()||((n=t.defaultTitle)==null?void 0:n.trim())||void 0,agent:t.agent,sessionId:a,cwd:r,assignTo:t.assignTo,priority:t.priority,mode:t.mode??st}}function Zo(){return Jt.map(t=>e.jsx(be,{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 el(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 tl({nodes:t,currentNodeRole:a,currentNodeId:r,leaderNodeId:n,onCreated:i,onCancel:o,className:c,footerClassName:f,submitLabel:g="Load session",cancelLabel:v="Cancel",autoFocus:j=!1}){const l=s.useMemo(()=>wa(t,{currentNodeRole:a,leaderNodeId:n}),[t,a,n]),m=s.useMemo(()=>{var p;return r&&l.some(x=>x.id===r)?r:((p=l[0])==null?void 0:p.id)??""},[l,r]),[h,w]=s.useState(""),[C,D]=s.useState("codex"),[y,N]=s.useState(""),[O,z]=s.useState(""),[T,H]=s.useState(""),[F,I]=s.useState(m),[L,B]=s.useState("normal"),[X,E]=s.useState(st),[U,Q]=s.useState(!1),[R,ae]=s.useState([]),[le,W]=s.useState(!1),[Z,G]=s.useState(null),P=s.useMemo(()=>R.find(p=>p.sessionId===y)??null,[R,y]);s.useEffect(()=>{F&&l.some(p=>p.id===F)||I(m)},[F,l,m]),s.useEffect(()=>{N(""),z(""),H("")},[C,F]),s.useEffect(()=>{let p=!1;return F?(W(!0),G(null),Sr(F,{agent:C,limit:50}).then(x=>{p||ae(x.sessions)}).catch(x=>{p||(ae([]),G(x instanceof Error?x.message:"Failed to load native sessions"))}).finally(()=>{p||W(!1)}),()=>{p=!0}):(ae([]),G(null),W(!1),()=>{p=!0})},[C,F]),s.useEffect(()=>{P&&(z(P.sessionId),H(P.cwd))},[P]);const ne=s.useCallback(async p=>{p.preventDefault();const x=Qo({title:h,defaultTitle:P==null?void 0:P.summary,agent:C,sessionId:O,cwd:T,assignTo:F,priority:L,mode:X});if(x){Q(!0);try{const A=await _r(x);i(A)}catch(A){me.error(A instanceof Error?A.message:"Failed to load native session")}finally{Q(!1)}}},[h,P,C,O,T,F,L,X,i]),fe=!!(O.trim()&&T.trim()&&F),[ve,J]=s.useState(!1),[u,ee]=s.useState(""),$=l.find(p=>p.id===F)??null,de=!!(r&&($==null?void 0:$.id)===r),re=s.useMemo(()=>{const p=u.trim().toLowerCase();return p?R.filter(x=>x.summary.toLowerCase().includes(p)||x.sessionId.toLowerCase().includes(p)||x.cwd.toLowerCase().includes(p)):R},[R,u]),ge="h-9 w-auto gap-1.5 rounded-full 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:_("space-y-4",c),children:[e.jsxs("div",{className:"rounded-[24px] border border-border/60 bg-background/45 shadow-[0_20px_80px_-40px_rgba(0,0,0,0.6)]",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2 border-b border-border/50 px-4 py-3",children:[e.jsxs(we,{value:F,onValueChange:I,children:[e.jsx(Ce,{className:_(ge),"aria-label":"Node",children:$?e.jsxs(e.Fragment,{children:[e.jsx(es,{isCurrent:de}),e.jsx("span",{className:"max-w-[10rem] truncate",children:$.name})]}):e.jsx(De,{placeholder:"Node"})}),e.jsx(Se,{children:qt(l,r)})]}),e.jsxs(we,{value:C,onValueChange:p=>D(p),children:[e.jsxs(Ce,{className:_(ge),"aria-label":"Agent",children:[e.jsx(Ht,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{children:C})]}),e.jsxs(Se,{children:[e.jsx(be,{value:"codex",children:"codex"}),e.jsx(be,{value:"claudecode",children:"claudecode"})]})]}),e.jsxs("div",{className:"relative ml-auto min-w-0 flex-1 sm:max-w-56",children:[e.jsx(It,{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(Pe,{value:u,onChange:p=>ee(p.target.value),placeholder:"Filter sessions",className:"h-9 rounded-full 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:le?"Loading...":`${re.length} session${re.length===1?"":"s"}`})}),e.jsxs("div",{className:"relative h-88 overflow-hidden rounded-2xl",children:[le&&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:[!F&&e.jsx("div",{className:"rounded-2xl 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."}),F&&!le&&re.length===0&&e.jsx("div",{className:"rounded-2xl border border-dashed border-border/60 bg-background/35 px-4 py-6 text-center text-xs text-muted-foreground",children:R.length===0?"No recent sessions on this node. Use Manual session ID under More options.":"No sessions match your filter."}),re.map(p=>{const x=p.sessionId===y;return e.jsxs("button",{type:"button",onClick:()=>N(p.sessionId),className:_("flex w-full flex-col gap-1 rounded-2xl border px-3 py-2.5 text-left transition-colors",x?"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:_("h-2 w-2 shrink-0 rounded-full",x?"bg-primary":"bg-border")}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:p.summary}),e.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-[0.16em] text-muted-foreground",children:el(p.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:p.sessionId.slice(0,12)}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-border"}),e.jsx("span",{className:"truncate font-mono",children:p.cwd})]})]},p.sessionId)})]})]}),Z&&e.jsx("p",{className:"px-1 pt-2 text-[11px] text-destructive",children:Z})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",onClick:()=>J(p=>!p),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":ve,children:[e.jsx("span",{className:"h-px flex-1 bg-border/60","aria-hidden":!0}),e.jsx("span",{className:"shrink-0",children:ve?"Less options":"More options"}),e.jsx(Ie,{className:_("h-3.5 w-3.5 shrink-0 transition-transform",ve&&"rotate-180")}),e.jsx("span",{className:"h-px flex-1 bg-border/60","aria-hidden":!0})]}),ve&&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(Pe,{id:"native-session-id",type:"text",value:O,onChange:p=>{N(""),z(p.target.value)},placeholder:"ses_... or thread_...",autoFocus:j,className:"h-10 rounded-full 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(Pe,{id:"native-session-title",type:"text",value:h,onChange:p=>w(p.target.value),placeholder:"Optional",className:"h-10 rounded-full border-border/70 bg-background/70 text-sm"})]})]}),e.jsx(Vt,{value:T,onChange:p=>{N(""),H(p)},assignTo:F,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(we,{value:X,onValueChange:p=>E(p),children:[e.jsx(Ce,{className:"h-10 rounded-full border-border/70 bg-background/70 text-sm",children:e.jsx(De,{placeholder:"Select mode"})}),e.jsx(Se,{children:Zo()})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(_e,{className:"text-xs font-medium text-muted-foreground",children:"Priority"}),e.jsxs(we,{value:L,onValueChange:B,children:[e.jsx(Ce,{className:"h-10 rounded-full border-border/70 bg-background/70 text-sm",children:e.jsx(De,{placeholder:"Select priority"})}),e.jsxs(Se,{children:[e.jsx(be,{value:"low",children:"Low"}),e.jsx(be,{value:"normal",children:"Normal"}),e.jsx(be,{value:"high",children:"High"}),e.jsx(be,{value:"critical",children:"Critical"})]})]})]})]})]})]}),e.jsxs("div",{className:_("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",f),children:[o&&e.jsx(M,{type:"button",variant:"ghost",onClick:o,className:"rounded-full",children:v}),e.jsx(M,{type:"submit",disabled:!fe||U,className:"rounded-full px-5",children:U?e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading..."]}):g})]})]})}function vs(){return qs.map(t=>e.jsx(be,{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 js(){return Jt.map(t=>e.jsx(be,{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 sl(t){var a;return((a=qs.find(r=>r.value===t))==null?void 0:a.label)??t}function al(t){var a;return((a=Jt.find(r=>r.value===t))==null?void 0:a.label)??t}function Ca(t,a,r=!1){const n=t.trim();if(n)return n;const i=a.trim().split(`
130
+ `).map(o=>o.trim()).find(Boolean);return i?i.length>72?`${i.slice(0,69).trimEnd()}...`:i:r?"Image task":""}function rl(t){var c;const a=t.title.trim(),r=Ca(t.title,t.description,t.images.length>0),n=t.description.trim()||r,i=t.mode??st,o=Us(t.description,t.images);return!r||!n||!t.agent?null:{title:r,description:n,agent:t.agent,project:t.project.trim()||null,branch:((c=t.branch)==null?void 0:c.trim())||null,payload:{initialMessage:o,mode:i,titleSource:a?"manual":"derived"},priority:t.priority,assignTo:t.assignTo==="auto"?void 0:t.assignTo}}function nl({nodes:t,currentNodeRole:a,currentNodeId:r,leaderNodeId:n,onCreated:i,onCancel:o,className:c,footerClassName:f,submitLabel:g="Create chat",cancelLabel:v="Cancel",autoFocus:j=!1,layout:l="default"}){const[m,h]=s.useState(""),[w,C]=s.useState(""),[D,y]=s.useState("claudecode"),[N,O]=s.useState(st),[z,T]=s.useState(""),[H,F]=s.useState(""),[I,L]=s.useState("normal"),B=s.useMemo(()=>wa(t,{currentNodeRole:a,leaderNodeId:n}),[t,a,n]),X=s.useMemo(()=>{var k;return r&&B.some(ue=>ue.id===r)?r:((k=B[0])==null?void 0:k.id)??""},[B,r]),[E,U]=s.useState(X),[Q,R]=s.useState(!1),[ae,le]=s.useState(!1),{images:W,error:Z,fileInputRef:G,pickImages:P,handleFileChange:ne,handlePaste:fe,removeImage:ve}=sa(),J=s.useMemo(()=>B.find(k=>k.id===E)??null,[E,B]),u=!!(r&&(J==null?void 0:J.id)===r),ee=sl(D),$=al(N);s.useEffect(()=>{E&&B.some(k=>k.id===E)||U(X)},[E,B,X]),s.useEffect(()=>{T(Go(E)),F("")},[E]),s.useEffect(()=>{F("")},[z]);const de=s.useCallback(async k=>{k.preventDefault();const ue=rl({title:m,description:w,agent:D,project:z,branch:H,priority:I,assignTo:E,mode:N,images:W});if(ue){R(!0);try{const ye=await Er(ue);i(ye)}catch(ye){me.error(ye instanceof Error?ye.message:"Failed to create task")}finally{R(!1)}}},[m,w,D,z,H,I,E,N,W,i]),re=Ca(m,w,W.length>0),ge=!!(re&&D&&E&&(w.trim()||W.length>0)),p=s.useCallback(k=>{var ue;k.nativeEvent.isComposing||k.key==="Enter"&&(k.ctrlKey||k.metaKey)&&ge&&!Q&&(k.preventDefault(),(ue=k.currentTarget.form)==null||ue.requestSubmit())},[ge,Q]),x=W.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3",children:W.map((k,ue)=>e.jsxs("div",{className:"relative",children:[e.jsx("img",{src:Vs(k),alt:k.filename??`attachment ${ue+1}`,className:"h-24 w-24 rounded-2xl border border-border/70 object-cover"}),e.jsx("button",{type:"button",onClick:()=>ve(ue),className:"absolute -top-2 -right-2 flex h-6 w-6 items-center justify-center rounded-full border border-border/70 bg-background text-muted-foreground transition-colors hover:text-foreground","aria-label":`Remove ${k.filename??`image ${ue+1}`}`,children:e.jsx(Ve,{className:"h-3.5 w-3.5"})})]},`${k.filename??"image"}-${ue}`))}),A=e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Assign to"}),e.jsxs(we,{value:E,onValueChange:U,children:[e.jsx(Ce,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:e.jsx(De,{placeholder:"Select node"})}),e.jsx(Se,{children:qt(B,r)})]})]}),Y=e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Agent"}),e.jsxs(we,{value:D,onValueChange:y,children:[e.jsx(Ce,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:e.jsx(De,{placeholder:"Select agent"})}),e.jsx(Se,{children:vs()})]})]}),q=e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Mode"}),e.jsxs(we,{value:N,onValueChange:k=>O(k),children:[e.jsx(Ce,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:e.jsx(De,{placeholder:"Select mode"})}),e.jsx(Se,{children:js()})]})]}),ce=e.jsxs("div",{className:"space-y-2",children:[e.jsx(_e,{className:"text-sm font-medium",children:"Priority"}),e.jsxs(we,{value:I,onValueChange:L,children:[e.jsx(Ce,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:e.jsx(De,{placeholder:"Select priority"})}),e.jsxs(Se,{children:[e.jsx(be,{value:"low",children:"Low"}),e.jsx(be,{value:"normal",children:"Normal"}),e.jsx(be,{value:"high",children:"High"}),e.jsx(be,{value:"critical",children:"Critical"})]})]})]}),ke=e.jsx(Vt,{value:z,onChange:T,assignTo:E,nodes:t,assignableNodes:B}),Le=e.jsx(bs,{value:H,onChange:F,project:z,assignTo:E,nodes:t,assignableNodes:B});return l==="composer"?e.jsxs("form",{onSubmit:de,className:_("space-y-4",c),children:[e.jsx("input",{ref:G,type:"file",accept:"image/*",multiple:!0,onChange:ne,className:"hidden"}),(()=>{const k="chat-composer__chip h-9 w-auto gap-1.5 rounded-full px-3.5 text-xs shadow-none transition-colors",ue="border-transparent bg-transparent text-muted-foreground hover:bg-background/40 hover:text-foreground",ye="border-border/70 bg-background/55 text-foreground",Xe=D==="claudecode",Re=N===st;return e.jsxs("div",{className:"chat-composer space-y-2",children:[e.jsxs("div",{className:"rounded-[24px] border border-border/60 bg-background/45 shadow-[0_20px_80px_-40px_rgba(0,0,0,0.6)]",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(we,{value:E,onValueChange:U,children:[e.jsx(Ce,{className:_(k,ye,"chat-composer__node-trigger border-transparent bg-transparent hover:bg-background/40"),title:`Assigned node: ${(J==null?void 0:J.name)??"unassigned"}`,"aria-label":`Assigned node: ${(J==null?void 0:J.name)??"unassigned"}`,children:J?e.jsxs(e.Fragment,{children:[e.jsx(es,{isCurrent:u}),e.jsx("span",{className:"min-w-0 truncate",children:J.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(Se,{children:qt(B,r)})]}),ae?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Pe,{id:"task-title-composer",type:"text",value:m,onChange:oe=>h(oe.target.value),onKeyDown:oe=>{(oe.key==="Enter"||oe.key==="Escape")&&(oe.preventDefault(),le(!1))},autoFocus:!0,placeholder:"Chat title",className:"h-8 w-48 min-w-0 rounded-full border-border/70 bg-background/55 px-3 text-xs shadow-none"}),e.jsx(M,{type:"button",variant:"ghost",size:"icon",onClick:()=>le(!1),"aria-label":"Save title",className:"h-8 w-8 shrink-0 rounded-full text-muted-foreground hover:text-foreground",children:e.jsx(Ge,{className:"h-3.5 w-3.5"})})]}):e.jsxs("button",{type:"button",onClick:()=>le(!0),className:"chat-composer__title-button flex min-w-0 items-center gap-1.5 rounded-full 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(nt,{className:"h-3 w-3 shrink-0"})]})]}),e.jsx("textarea",{id:"task-description",value:w,onChange:oe=>C(oe.target.value),onKeyDown:p,onPaste:fe,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(M,{type:"button",variant:"ghost",size:"icon",onClick:P,"aria-label":"Add images",className:"h-9 w-9 shrink-0 rounded-full text-muted-foreground hover:text-foreground",children:e.jsx(Ot,{className:"h-4 w-4"})}),e.jsx("span",{className:"mx-0.5 h-5 w-px bg-border/60","aria-hidden":!0}),e.jsxs(we,{value:D,onValueChange:y,children:[e.jsxs(Ce,{className:_(k,"chat-composer__icon-trigger",Xe?ue:ye),title:`Agent: ${ee}`,"aria-label":`Agent: ${ee}`,children:[e.jsx(Ht,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"chat-composer__footer-label truncate",children:ee})]}),e.jsx(Se,{children:vs()})]}),e.jsxs(we,{value:N,onValueChange:oe=>O(oe),children:[e.jsxs(Ce,{className:_(k,"chat-composer__icon-trigger",Re?ue:ye),title:`Mode: ${$}`,"aria-label":`Mode: ${$}`,children:[e.jsx(ro,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"chat-composer__footer-label truncate",children:$})]}),e.jsx(Se,{children:js()})]}),e.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[e.jsxs(we,{value:I,onValueChange:L,children:[e.jsx(Ce,{"aria-label":`Priority: ${I}`,title:`Priority: ${I}`,className:_("h-9 w-9 justify-center gap-0 rounded-full p-0 text-xs shadow-none [&>svg:last-child]:hidden",I==="normal"?"border-transparent bg-transparent text-muted-foreground hover:bg-background/40":"border-border/70 bg-background/55",I==="critical"&&"text-destructive",I==="high"&&"text-amber-600 dark:text-amber-400",I==="low"&&"text-muted-foreground"),children:e.jsx(Tn,{className:_("h-4 w-4",I==="critical"&&"fill-destructive/20")})}),e.jsxs(Se,{children:[e.jsx(be,{value:"low",children:"Low"}),e.jsx(be,{value:"normal",children:"Normal"}),e.jsx(be,{value:"high",children:"High"}),e.jsx(be,{value:"critical",children:"Critical"})]})]}),o&&e.jsxs(M,{type:"button",variant:"ghost",size:"sm",onClick:o,"aria-label":v,className:"chat-composer__cancel h-9 rounded-full 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(M,{type:"submit",size:"icon",disabled:!ge||Q,className:"h-10 w-10 rounded-full shadow-[0_8px_30px_-8px_hsl(var(--primary)/0.6)]",children:[Q?e.jsx(Ne,{className:"h-4 w-4 animate-spin"}):e.jsx(Xs,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:Q?"Creating chat":g})]})]})]})]}),e.jsx("div",{className:"chat-composer__location flex flex-wrap items-center gap-2 px-1",children:(()=>{const oe="border-border/40 bg-muted/40 text-foreground/80 hover:bg-muted/60 hover:text-foreground";return e.jsxs(e.Fragment,{children:[e.jsx(Vt,{value:z,onChange:T,assignTo:E,nodes:t,assignableNodes:B,layout:"composer",chipClassName:k,chipActiveClassName:oe,chipInactiveClassName:oe,triggerClassName:"chat-composer__icon-trigger",labelClassName:"chat-composer__location-label"}),e.jsx(bs,{value:H,onChange:F,project:z,assignTo:E,nodes:t,assignableNodes:B,layout:"composer",chipClassName:k,chipActiveClassName:oe,chipInactiveClassName:oe,triggerClassName:"chat-composer__icon-trigger",labelClassName:"chat-composer__location-label"})]})})()})]})})(),(x||Z)&&e.jsxs("div",{className:"space-y-3 rounded-[20px] border border-border/60 bg-background/45 p-4",children:[x,Z&&e.jsx("div",{className:"text-xs text-destructive",children:Z}),!Z&&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:de,className:_("space-y-5",c),children:[e.jsx("input",{ref:G,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:w,onChange:k=>C(k.target.value),onKeyDown:p,onPaste:fe,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(M,{type:"button",variant:"outline",onClick:P,className:"rounded-2xl",children:[e.jsx(Ot,{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."})]}),x,Z&&e.jsx("p",{className:"text-xs text-destructive",children:Z})]}),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(Pe,{id:"task-title",type:"text",value:m,onChange:k=>h(k.target.value),placeholder:"Optional. Leave blank to derive it from the prompt.",className:"h-11 rounded-2xl 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."})]}),Y,q]}),ke,Le,e.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[ce,A]}),e.jsxs("div",{className:_("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",f),children:[o&&e.jsx(M,{type:"button",variant:"ghost",onClick:o,className:"rounded-2xl",children:v}),e.jsx(M,{type:"submit",disabled:!ge||Q,className:"rounded-2xl px-5",children:Q?"Creating...":g})]})]})}function ol({nodes:t,currentNodeRole:a,currentNodeId:r,leaderNodeId:n,onCreated:i,onCancel:o,defaultMode:c="chat",mode:f,onModeChange:g,layout:v="default",className:j,footerClassName:l,autoFocus:m=!1}){const[h,w]=s.useState(c),C=f!==void 0,D=C?f:h,y=N=>{C||w(N),g==null||g(N)};return e.jsxs("div",{className:_("space-y-4",j),children:[!C&&e.jsxs("div",{className:"flex items-center gap-2 rounded-full border border-border/60 bg-background/45 p-1",children:[e.jsxs(M,{type:"button",variant:D==="chat"?"default":"ghost",onClick:()=>y("chat"),className:"flex-1 rounded-full",children:[e.jsx(oo,{className:"h-4 w-4"}),"New chat"]}),e.jsxs(M,{type:"button",variant:D==="native"?"default":"ghost",onClick:()=>y("native"),className:"flex-1 rounded-full",children:[e.jsx(Xt,{className:"h-4 w-4"}),"Load session"]})]}),D==="chat"?e.jsx(nl,{nodes:t,currentNodeRole:a,currentNodeId:r,leaderNodeId:n,onCreated:i,onCancel:o,footerClassName:l,submitLabel:v==="composer"?"Start chat":"Create chat",cancelLabel:"Cancel",autoFocus:m,layout:v}):e.jsx(tl,{nodes:t,currentNodeRole:a,currentNodeId:r,leaderNodeId:n,onCreated:i,onCancel:o,footerClassName:l,autoFocus:m})]})}const Je="72f988bf-86f1-41af-91ab-2d7cd011db47",Sa=`${Je} (MSIT)`;function ll({open:t,onOpenChange:a,onShare:r,onStopShare:n,sharing:i,stopping:o=!1,shareResult:c}){return e.jsx(Ls,{open:t,onOpenChange:a,children:e.jsxs(Es,{className:"max-w-md rounded-lg p-5",children:[e.jsx(Ds,{className:"sr-only",children:"Share conversation"}),e.jsx(il,{onOpenChange:a,onShare:r,onStopShare:n,sharing:i,stopping:o,shareResult:c})]})})}function il({onOpenChange:t,onShare:a,onStopShare:r,sharing:n,stopping:i=!1,shareResult:o}){const[c,f]=s.useState((o==null?void 0:o.tenant)??Je),[g,v]=s.useState((o==null?void 0:o.scope)??"chat"),j=(o==null?void 0:o.url)??null,l=n||i;return s.useEffect(()=>{f((o==null?void 0:o.tenant)??Je),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(dl,{value:c,onChange:f,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(Ns,{active:g==="chat",title:"Chat only",description:"Conversation transcript and opening prompt.",onClick:()=>v("chat")}),e.jsx(Ns,{active:g==="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-md 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(M,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 rounded-full text-muted-foreground",onClick:()=>void qe(j,"Shared link copied"),"aria-label":"Copy shared link",title:"Copy shared link",children:e.jsx(Yt,{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(M,{variant:"outline",onClick:()=>t(!1),disabled:l,className:"h-8 text-xs",children:o?"Done":"Cancel"}),o&&r&&e.jsxs(M,{variant:"outline",onClick:()=>void r(),disabled:l,className:"h-8 border-destructive/30 text-xs text-destructive hover:bg-destructive/10 hover:text-destructive",children:[i&&e.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}),"Stop share"]}),e.jsxs(M,{onClick:()=>void a({tenant:c,scope:g}),disabled:l,className:"h-8 text-xs",children:[n&&e.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}),o?"Update link":"Share link"]})]})]})}function dl({value:t,onChange:a,disabled:r}){const[n,i]=s.useState(!1),[o,c]=s.useState(!1),[f,g]=s.useState(t),v=s.useRef(null);s.useEffect(()=>{g(t)},[t]),s.useEffect(()=>{if(!n)return;const l=h=>{var C;const w=h.target;w instanceof Node&&((C=v.current)!=null&&C.contains(w)||(i(!1),c(!1)))},m=h=>{h.key==="Escape"&&(i(!1),c(!1))};return document.addEventListener("mousedown",l),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",m)}},[n]);const j=l=>{const m=l.trim();m&&(a(m),g(m),c(!1),i(!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:()=>!r&&i(l=>!l),disabled:r,className:"flex h-9 w-full items-center justify-between gap-2 rounded-xl 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:cl(t)}),e.jsx(Ie,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"})]}),n&&e.jsxs("div",{className:"absolute left-0 right-0 z-50 mt-2 overflow-hidden rounded-2xl border border-border/60 bg-background/95 text-xs shadow-lg backdrop-blur",children:[e.jsxs("button",{type:"button",onClick:()=>j(Je),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:Sa}),t===Je&&e.jsx(Ge,{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:f,onChange:l=>g(l.target.value),onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),j(f))},autoFocus:!0,placeholder:"Tenant ID",className:"h-7 min-w-0 flex-1 rounded-md 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(f),className:"flex h-7 w-7 items-center justify-center rounded-md hover:bg-background/60",children:e.jsx(Ge,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",onClick:()=>{g(t),c(!1)},className:"flex h-7 w-7 items-center justify-center rounded-md 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-md 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(nt,{className:"h-3 w-3"})]})})]})]})]})}function cl(t){return t===Je?Sa:t}function Ns({active:t,title:a,description:r,onClick:n}){return e.jsxs("button",{type:"button",onClick:n,className:t?"rounded-md border border-primary/45 bg-primary/10 px-3 py-2 text-left":"rounded-md border border-border/70 bg-background px-3 py-2 text-left 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:r})]})}const ul=s.lazy(async()=>({default:(await Wt(()=>import("./FilesTab-CSpNGxJl.js"),__vite__mapDeps([0,1,2,3,4]))).FilesTab})),xl=s.lazy(async()=>({default:(await Wt(()=>import("./PreviewTab-CEFgpX6R.js"),__vite__mapDeps([5,1,2]))).PreviewTab})),ml=s.lazy(async()=>({default:(await Wt(()=>import("./DiffTab-BLGTdyp_.js"),__vite__mapDeps([6,1,2,4,3,7]))).DiffTab}));function hl({onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:r,operationsOpen:n,onToggleOperations:i,cluster:o,sseConnected:c,activeTab:f,setActiveTab:g,creatingTask:v,createMode:j,activeTask:l,assignedNode:m,taskLoading:h,taskError:w,displayEvents:C,initialPromptAlreadyInLogs:D,initialPrompt:y,supportsFollowUp:N,taskUnavailable:O,chatDisabled:z,chatDisabledReason:T,questionBypassEnabled:H,isRunning:F,isStarting:I,hasPendingFollowUp:L,canCancel:B,canRetry:X,onRetry:E,onCancel:U,onShareTask:Q,onStopShareTask:R,onStartCreateTask:ae,onCancelCreateTask:le,onCreateTask:W,onSendMessage:Z,onQuestionBypassChange:G,onSubmitQuestionResponse:P,messagesEndRef:ne}){const[fe,ve]=s.useState(!1),[J,u]=s.useState(!1),[ee,$]=s.useState(!1),[de,re]=s.useState(!1),[ge,p]=s.useState(!1),[x,A]=s.useState(!1),[Y,q]=s.useState({}),[ce,ke]=s.useState(new Set),[Le,k]=s.useState(new Set),ue=s.useRef(0),ye=s.useRef(!1),Xe=s.useCallback(je=>{const pe=je.currentTarget,te=ue.current;if(ue.current=pe.scrollTop,ye.current)return;if(pe.scrollHeight-pe.scrollTop-pe.clientHeight<30){u(!1),ye.current=!0,setTimeout(()=>{ye.current=!1},300);return}pe.scrollTop<te&&te-pe.scrollTop>10&&u(!0),pe.scrollTop<=0&&u(!0)},[]),Re=(l==null?void 0:l.effectiveProjectPath)??(l==null?void 0:l.project)??"default workspace",oe=l?(m==null?void 0:m.name)??Ks(l.assignedTo,o==null?void 0:o.nodes,l.assignedNodeName):"unassigned",$e=l!=null&&l.assignedTo?e.jsxs(e.Fragment,{children:["Connecting session on node ",e.jsx("span",{className:"font-medium text-foreground",children:oe}),"..."]}):"Connecting session to an available node...",wt=l?[{label:"Working dir",value:Re,mono:!0},...l.branch?[{label:"Branch",value:l.branch,mono:!0}]:[],{label:"Agent",value:l.agent,mono:!0},{label:"Node",value:oe}]:[],Qe=l!=null&&l.description&&l.description!==l.title?l.description:null,ot=!!(y&&!D),Ze=ot||C.length>0,lt=F&&Ze,et=(I||L||F)&&!lt,tt=(l==null?void 0:l.conversationKind)==="nativeSession",Fe=l&&!ce.has(l.id)?Y[l.id]??l.activeShare??null:null;return v?e.jsx(pl,{onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:r,operationsOpen:n,onToggleOperations:i,cluster:o,sseConnected:c,defaultMode:j,onCancel:le,onCreated:W}):!l&&h?e.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-2xl sm:rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[e.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:e.jsx(mt,{onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:r,operationsOpen:n,onToggleOperations:i,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-full border border-primary/20 bg-primary/10 text-primary",children:e.jsx(Ne,{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-3 text-sm text-muted-foreground",children:[e.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Fetching the selected chat thread..."]})]})]})})]}):l?e.jsxs(Rs,{value:f,onValueChange:g,className:"flex h-full min-h-0 flex-col overflow-hidden rounded-2xl sm:rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5 sm:px-5",children:[e.jsx("div",{className:"flex items-center gap-3",children:e.jsx(mt,{onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:r,operationsOpen:n,onToggleOperations:i,cluster:o,sseConnected:c})}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("h2",{className:"min-w-0 truncate text-base font-semibold tracking-tight text-foreground sm:text-lg",title:l.title,children:l.title}),tt&&e.jsx(Te,{variant:"outline",className:"rounded-full border-sky-500/30 bg-sky-500/10 text-sky-700 dark:text-sky-300",children:"Native session"}),e.jsx($s,{status:l.status}),e.jsx(Dr,{priority:l.priority}),e.jsxs(M,{type:"button",variant:"outline",size:"sm",disabled:O,title:O?"Unavailable tasks cannot be shared.":"Share conversation",className:"ml-auto h-8 shrink-0 rounded-full border-primary/30 bg-primary/10 px-3 text-xs text-primary hover:bg-primary/15 hover:text-primary disabled:border-border/60 disabled:bg-muted/40 disabled:text-muted-foreground",onClick:()=>re(!0),children:[e.jsx(so,{className:"h-3.5 w-3.5"}),"Share"]}),e.jsx(M,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 rounded-full text-muted-foreground",onClick:()=>ve(je=>!je),children:fe?e.jsx(Tr,{className:"h-3.5 w-3.5"}):e.jsx(Ie,{className:"h-3.5 w-3.5"})})]}),fe&&e.jsxs("div",{className:"mt-2 space-y-2",children:[Qe&&e.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:Qe}),w&&e.jsx("div",{className:"w-fit rounded-full border border-destructive/25 bg-destructive/10 px-3 py-1 text-xs text-destructive",children:w}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex flex-col text-xs text-muted-foreground",children:[e.jsxs("span",{children:["updated ",sn(l.updatedAt)]}),e.jsx("span",{className:"font-mono",children:l.id.slice(0,8)})]}),e.jsx("div",{className:"flex items-center gap-2",children:X&&e.jsxs(M,{variant:"outline",size:"sm",onClick:E,className:"shrink-0 rounded-full",children:[e.jsx(Qn,{className:"h-3.5 w-3.5"}),"Retry"]})})]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[e.jsxs(Fs,{className:"h-auto max-w-full overflow-x-auto rounded-full bg-muted/70 p-1",children:[e.jsx(ze,{value:"transcript",className:"rounded-full px-2.5 sm:px-4",children:"Transcript"}),e.jsx(ze,{value:"files",className:"rounded-full px-2.5 sm:px-4",children:"Files"}),e.jsx(ze,{value:"preview",className:"rounded-full px-2.5 sm:px-4",children:"Preview"}),e.jsx(ze,{value:"diff",className:"rounded-full px-2.5 sm:px-4",children:"Diff"})]}),F&&e.jsx(Te,{variant:"outline",className:"hidden rounded-full border-amber-500/30 bg-amber-500/10 text-amber-700 sm:inline-flex dark:text-amber-300",children:"Working"}),O&&e.jsx(Te,{variant:"outline",className:"hidden rounded-full border-destructive/25 bg-destructive/10 text-destructive sm:inline-flex",children:"Unavailable"})]})]}),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 overflow-y-auto px-4 py-5 sm:px-5",onScroll:Xe,children:e.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-5",children:[ot&&y&&e.jsx(ms,{event:y,questionBypassEnabled:H,onQuestionBypassChange:G,onSubmitQuestionResponse:P,questionResponseDisabled:!N||z}),C.map((je,pe)=>e.jsx(ms,{event:je,questionBypassEnabled:H,onQuestionBypassChange:G,onSubmitQuestionResponse:P,questionResponseDisabled:!N||z},an("transcript",je,pe))),!Ze&&!et&&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-sm font-medium text-foreground",children:"Transcript is warming up"}),e.jsx("div",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:h?"Fetching task output...":tt?"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-4 py-4",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-xs leading-5 text-muted-foreground",children:JSON.stringify(l.result,null,2)})]}),l.error&&!Le.has(l.id)&&e.jsxs("div",{className:"rounded-[26px] border border-destructive/20 bg-destructive/10 px-4 py-4 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:()=>k(je=>new Set(je).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-xs leading-5",children:l.error})]})]}),et&&e.jsx(ks,{children:$e}),lt&&e.jsx(ks,{children:"The agent is still working on this conversation."}),e.jsx("div",{ref:ne})]})}),N?J?e.jsx(M,{size:"icon",onClick:()=>u(!1),className:"absolute bottom-4 right-4 z-10 h-12 w-12 rounded-full shadow-lg",children:e.jsx(nt,{className:"h-5 w-5"})}):e.jsx("div",{className:"shrink-0",children:e.jsx("div",{className:"mx-auto w-full max-w-[72rem]",children:e.jsx(Co,{onSend:Z,disabled:z,disabledReason:T,contextItems:wt,placeholder:z?T:"Continue the conversation...",running:F||L,onStop:B?()=>$(!0):void 0})})}):e.jsx("div",{className:"shrink-0 border-t border-border/60 px-4 py-4 text-sm 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(Mt,{label:"Loading files..."}),children:e.jsx(ul,{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(Mt,{label:"Loading preview..."}),children:e.jsx(xl,{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(Mt,{label:"Loading diff..."}),children:e.jsx(ml,{taskId:l.id})})}),e.jsx(Bt,{open:ee,onOpenChange:$,children:e.jsxs(pt,{children:[e.jsxs(ft,{children:[e.jsx(bt,{children:"Stop this task?"}),e.jsx(vt,{children:"The task will stop and move to a cancelled state."})]}),e.jsxs(gt,{children:[e.jsx(Nt,{children:"Keep running"}),e.jsx(jt,{onClick:U,children:"Stop task"})]})]})}),e.jsx(ll,{open:de,onOpenChange:re,sharing:ge,stopping:x,shareResult:Fe,onShare:async je=>{if(!l)return null;p(!0);try{const pe=await Q(je);return pe!=null&&pe.url&&(q(te=>({...te,[l.id]:pe})),ke(te=>{const ie=new Set(te);return ie.delete(l.id),ie})),pe}finally{p(!1)}},onStopShare:async()=>{if(!l)return!1;A(!0);try{const je=await R();return je!==!1&&(q(pe=>{const te={...pe};return delete te[l.id],te}),ke(pe=>new Set(pe).add(l.id))),je}finally{A(!1)}}})]}):e.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-2xl sm:rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[e.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:e.jsx(mt,{onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:r,operationsOpen:n,onToggleOperations:i,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-full border border-primary/20 bg-primary/10 text-primary",children:e.jsx(Ht,{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-sm 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(M,{onClick:ae,className:"mt-6 rounded-full px-5",children:[e.jsx(Qt,{className:"h-4 w-4"}),"Start or load chat"]}),w&&e.jsx("div",{className:"mx-auto mt-4 max-w-lg rounded-[20px] border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:w})]})})]})}function ks({children:t}){return e.jsxs("div",{className:"flex items-center gap-3 rounded-[24px] border border-border/60 bg-background/45 px-4 py-3 text-sm text-muted-foreground",children:[e.jsx(Ne,{className:"h-4 w-4 shrink-0 animate-spin"}),e.jsx("div",{className:"min-w-0 leading-5",children:t})]})}function pl({onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:r,operationsOpen:n,onToggleOperations:i,cluster:o,sseConnected:c,defaultMode:f,onCancel:g,onCreated:v}){var h,w,C;const[j,l]=s.useState(f??"chat");s.useEffect(()=>{f&&l(f)},[f]);const m=e.jsx("div",{className:"flex items-center gap-1 rounded-full border border-border/60 bg-background/55 p-0.5 text-xs font-medium",children:[{value:"chat",label:"New chat",icon:Qt},{value:"native",label:"Load session",icon:Xt}].map(D=>{const y=D.icon,N=D.value===j;return e.jsxs("button",{type:"button",onClick:()=>l(D.value),"aria-pressed":N,className:_("flex items-center gap-1.5 rounded-full px-3 py-1 transition-colors",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(y,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:D.label})]},D.value)})});return e.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-2xl sm:rounded-[32px] border border-border/60 bg-background/78 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[e.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:e.jsx(mt,{onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:r,operationsOpen:n,onToggleOperations:i,cluster:o,sseConnected:c,centerSlot:m})}),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(ol,{nodes:(o==null?void 0:o.nodes)??[],currentNodeRole:(h=o==null?void 0:o.self)==null?void 0:h.role,currentNodeId:((w=o==null?void 0:o.self)==null?void 0:w.id)??null,leaderNodeId:((C=o==null?void 0:o.leader)==null?void 0:C.id)??null,mode:j,onModeChange:l,onCreated:v,onCancel:g,autoFocus:!0,layout:"composer"})})})]})}function mt({onToggleTasks:t,desktopTasksOpen:a,mobileTasksPanelOpen:r,operationsOpen:n,onToggleOperations:i,centerSlot:o}){return e.jsxs("div",{className:"relative flex w-full items-center justify-between gap-3",children:[e.jsx("div",{className:"flex min-w-0 items-center gap-2",children:e.jsx(fl,{desktopTasksOpen:a,mobileTasksPanelOpen:r,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.jsxs(M,{variant:"outline",onClick:i,className:"shrink-0 rounded-full border-border/70 bg-background/60 px-3 sm:px-4",children:[n?e.jsx(Ys,{className:"h-4 w-4"}):e.jsx(Wn,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:n?"Hide cluster":"Show cluster"})]})]})}function fl({desktopTasksOpen:t,mobileTasksPanelOpen:a,onToggleTasks:r}){var i,o;const n=(o=(i=globalThis.window)==null?void 0:i.matchMedia("(min-width: 1024px)"))!=null&&o.matches?t:a;return e.jsxs(M,{variant:"outline",onClick:r,className:"rounded-full border-border/70 bg-background/60 px-3 sm:px-4",children:[n?e.jsx(Js,{className:"h-4 w-4"}):e.jsx(qn,{className:"h-4 w-4"}),e.jsx("span",{className:"hidden sm:inline",children:n?"Hide tasks":"Show tasks"})]})}const gl={node:"border-teal-500/30 bg-teal-500/10 text-teal-700 dark:text-teal-300",task:"border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",election:"border-indigo-500/30 bg-indigo-500/10 text-indigo-700 dark:text-indigo-300",cluster:"border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300"};function bl(t){return t.split(".")[0]??"unknown"}function vl(t){return new Date(t).toLocaleTimeString("en-US",{hour12:!1})}function Lt(t,a){return(a==null?void 0:a.get(t))??t}function jl(t,a){const r=t.data;switch(t.type){case"node.joined":return`${r.name} joined the cluster`;case"node.left":return`${Lt(r.nodeId,a)} left (${r.reason})`;case"node.status":return`${Lt(r.nodeId,a)} is now ${r.status}`;case"task.created":return`"${r.title}" created`;case"task.assigned":return`task assigned to ${Lt(r.nodeId,a)}`;case"task.status":return`task ${r.taskId.slice(0,8)} -> ${r.status}`;case"election.started":return`candidate ${r.candidateId.slice(0,8)} term ${r.term}`;case"election.complete":return`leader elected, term ${r.term}`;case"cluster.state":return`${r.nodeCount} nodes, term ${r.term}`;default:return JSON.stringify(r)}}function Nl(t){return JSON.stringify(t,null,2)}function kl({events:t,maxHeight:a="400px",emptyTitle:r="No live events yet",emptyDescription:n="Cluster activity appears here as it happens.",nodeNameById:i}){return t.length===0?e.jsx("div",{className:"flex h-28 items-center justify-center rounded-[20px] border border-dashed border-border/70 bg-background/40 text-center",children:e.jsxs("div",{children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:r}),e.jsx("div",{className:"mt-1 text-xs text-muted-foreground/70",children:n})]})}):e.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:a},children:e.jsx("div",{className:"space-y-2",children:t.map(o=>{const c=bl(o.type);return e.jsx("div",{className:"rounded-[20px] border border-border/60 bg-background/45 px-4 py-3 transition-colors hover:border-border hover:bg-background/65",children:e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:vl(o.timestamp)}),e.jsx(Te,{variant:"outline",className:_("w-fit text-[10px] font-medium uppercase tracking-[0.16em]",gl[c]),children:o.type})]}),e.jsx(M,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 rounded-full text-muted-foreground",onClick:()=>void qe(Nl(o),"Event copied"),"aria-label":`Copy ${o.type} event`,title:"Copy event",children:e.jsx(Yt,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"text-sm leading-6 text-foreground/85",children:jl(o,i)})]})},o.id)})})})}function ys({cluster:t,systemInfo:a,nodeNameById:r,nodeBlockingTaskCounts:n,eventTypeFilter:i,onEventTypeFilterChange:o,eventTypeOptions:c,filteredEvents:f,sseConnected:g,clusterLoading:v,clusterError:j,promotePending:l,onPromote:m,onAddNode:h,leavePending:w,onLeaveCluster:C,onToggleNodeDevTunnel:D,devTunnelNodeId:y,onClose:N}){var B,X,E,U,Q;const O=((B=t==null?void 0:t.self)==null?void 0:B.role)==="leader",z=((X=t==null?void 0:t.self)==null?void 0:X.role)==="follower"&&!(t!=null&&t.leader),T=(t==null?void 0:t.self)??null,F=rn((t==null?void 0:t.nodes)??[],T==null?void 0:T.id).filter(R=>R.id!==(T==null?void 0:T.id)),I=(T==null?void 0:T.role)==="leader"&&F.length===0,L=(T==null?void 0:T.role)==="follower";return e.jsx("aside",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-[32px] border border-border/60 bg-background/84 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:e.jsxs(Rs,{defaultValue:"overview",className:"flex h-full min-h-0 flex-col",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-lg font-semibold tracking-tight",children:"Operations"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Node, cluster, and live events."})]}),e.jsx(M,{variant:"ghost",size:"icon",onClick:N,className:"rounded-full",children:e.jsx(Ys,{className:"h-4 w-4"})})]}),e.jsxs(Fs,{className:"mt-4 grid h-auto w-full grid-cols-3 rounded-full bg-muted/70 p-1",children:[e.jsx(ze,{value:"overview",className:"rounded-full px-3 text-xs",children:"Overview"}),e.jsx(ze,{value:"nodes",className:"rounded-full px-3 text-xs",children:"Nodes"}),e.jsx(ze,{value:"events",className:"rounded-full px-3 text-xs",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-4 py-5",children:e.jsxs("div",{className:"space-y-7",children:[T&&e.jsx(ws,{node:T,systemInfo:a,blockingTaskCount:n.get(T.id)??0,devTunnelNodeId:y,onToggleNodeDevTunnel:D,showActions:!1,defaultExpanded:!1}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"Cluster snapshot"}),e.jsx(Te,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:g?"Connected":"Reconnecting"})]}),v&&!t?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Loading cluster state..."]}):j&&!t?e.jsx("div",{className:"rounded-[22px] border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:j}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(He,{label:"Term",value:String((t==null?void 0:t.term)??0)}),e.jsx(He,{label:"Nodes",value:String((t==null?void 0:t.nodes.length)??0)}),e.jsx(He,{label:"Pending",value:String((t==null?void 0:t.taskSummary.pending)??0)}),e.jsx(He,{label:"Running",value:String((t==null?void 0:t.taskSummary.running)??0)}),e.jsx(He,{label:"Completed",value:String((t==null?void 0:t.taskSummary.completed)??0)}),e.jsx(He,{label:"Failed",value:String((t==null?void 0:t.taskSummary.failed)??0)})]}),e.jsxs("div",{className:"space-y-3 rounded-[24px] border border-border/60 bg-background/45 px-4 py-4",children:[e.jsx(Me,{label:"Leader",value:((E=t==null?void 0:t.leader)==null?void 0:E.name)??"None"}),e.jsx(Me,{label:"Leader URL",value:((U=t==null?void 0:t.leader)==null?void 0:U.endpoint)??"Unavailable",mono:!0,action:(Q=t==null?void 0:t.leader)!=null&&Q.endpoint?e.jsx(rt,{label:"Copy leader URL",onClick:()=>{var R;return void qe(((R=t.leader)==null?void 0:R.endpoint)??"","Leader URL copied")}}):void 0}),e.jsx(Me,{label:"Feed",value:g?"Receiving live updates":"Reconnecting to event stream"})]}),e.jsx("div",{className:"flex flex-wrap gap-2",children:z&&e.jsxs(M,{variant:"outline",size:"sm",onClick:m,disabled:l,className:"rounded-full",children:[l&&e.jsx(Ne,{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-4 py-5",children:e.jsxs("div",{className:"space-y-7",children:[e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"This node"}),I?e.jsx(M,{variant:"outline",size:"sm",onClick:h,className:"rounded-full",children:"Join node"}):L?e.jsxs(M,{variant:"outline",size:"sm",onClick:C,disabled:w,className:"rounded-full",children:[w&&e.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}),"Leave cluster"]}):null]}),T&&e.jsx(ws,{node:T,systemInfo:a,blockingTaskCount:n.get(T.id)??0,devTunnelNodeId:y,onToggleNodeDevTunnel:D,showActions:!0,defaultExpanded:!0})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"text-sm font-medium text-foreground",children:["Peer nodes (",F.length,")"]}),F.length>0?e.jsx("div",{className:"space-y-3",children:F.map(R=>e.jsx(yl,{node:R,isLeader:!!O,blockingTaskCount:n.get(R.id)??0,devTunnelNodeId:y,onToggleNodeDevTunnel:D},R.id))}):e.jsx("div",{className:"rounded-[24px] border border-dashed border-border/70 bg-background/35 px-4 py-5 text-sm 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-4 py-5",children:[e.jsxs("div",{className:"mb-4 space-y-3",children:[e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[e.jsx(Ar,{className:_("h-4 w-4",g?"text-emerald-500":"text-destructive")}),"Live events"]})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs(we,{value:i,onValueChange:o,children:[e.jsx(Ce,{className:"h-9 min-w-[11rem] flex-1 rounded-full border-border/70 bg-background/55 text-[12px] sm:max-w-[15rem]",children:e.jsx(De,{placeholder:"Event type"})}),e.jsx(Se,{children:c.map(R=>e.jsx(be,{value:R,className:"text-[12px]",children:R==="all"?"All event types":R},R))})]}),e.jsx(Te,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:g?"Connected":"Reconnecting"})]})]}),e.jsx("div",{className:"min-h-0 flex-1",children:e.jsx(kl,{events:f,maxHeight:"100%",emptyTitle:i==="all"?"No live events yet":"No matching events",emptyDescription:i==="all"?"Cluster activity appears here as it happens.":`No "${i}" events are in the current stream.`,nodeNameById:r})})]})})]})})}function ws({node:t,systemInfo:a,blockingTaskCount:r,devTunnelNodeId:n,onToggleNodeDevTunnel:i,showActions:o=!0,defaultExpanded:c=!1}){const[f,g]=s.useState(c),v=(a==null?void 0:a.dashboardOrigin)??t.dashboardOrigin,j=t.devtunnelEndpoint??t.endpoint,l=v??t.endpoint,m=(a==null?void 0:a.workDir)??t.workDir,h=Zs(t,a==null?void 0:a.transportType),w=Zt(t,a==null?void 0:a.transportType),C=w&&Ye((a==null?void 0:a.transportType)??t.transportType)?!0:Qs(t,a==null?void 0:a.transportType),D=r>0;return e.jsxs("section",{className:"rounded-[28px] border border-primary/20 bg-primary/8 shadow-[0_24px_80px_-60px_hsl(var(--primary)/0.9)]",children:[e.jsxs("button",{type:"button",onClick:()=>g(y=>!y),className:"w-full px-4 py-3.5 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[f?e.jsx(Ie,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.jsx(at,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx(Os,{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:y=>y.stopPropagation(),className:"ml-auto shrink-0 text-muted-foreground transition-colors hover:text-primary",title:"Open Dashboard",children:e.jsx(Is,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 pl-6",children:[e.jsx("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:t.name}),e.jsx(Bs,{role:t.role}),e.jsx(Te,{variant:"outline",className:"rounded-full border-primary/30 bg-background/60 text-[10px] capitalize",children:t.status})]})]}),f&&e.jsxs("div",{className:"space-y-4 border-t border-primary/15 px-4 pb-4 pt-3",children:[e.jsxs("div",{className:"space-y-3 rounded-[20px] border border-primary/20 bg-background/72 px-3.5 py-3.5",children:[e.jsx(Me,{label:"Node ID",value:t.id,mono:!0}),v&&e.jsx(Me,{label:"Dashboard",value:v,mono:!0,action:e.jsx(rt,{label:"Copy dashboard URL",onClick:()=>void qe(v,"Dashboard URL copied")})}),e.jsx(Me,{label:"Node URL",value:j,mono:!0,action:e.jsx(rt,{label:"Copy node URL",onClick:()=>void qe(j,"Node URL copied")})}),m&&e.jsx(Me,{label:"Workspace",value:m,mono:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx($t,{label:"Transport",value:h}),a&&e.jsx($t,{label:"Uptime",value:nn(a.uptime),mono:!0})]}),e.jsx(Hs,{capabilities:t.capabilities,action:o&&C?e.jsxs(M,{variant:"outline",size:"sm",onClick:()=>i(t),disabled:n===t.id||D,className:"rounded-full",title:D?"Finish assigned or running tasks before changing remote access":void 0,children:[n===t.id&&e.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}),w?"Disable Remote Access":"Enable Remote Access"]}):void 0}),o&&C&&D&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[r," active task",r===1?"":"s"," on this node."]})]})]})}function yl({node:t,isLeader:a,blockingTaskCount:r,devTunnelNodeId:n,onToggleNodeDevTunnel:i}){const[o,c]=s.useState(!1),f=t.dashboardOrigin,g=t.devtunnelEndpoint??t.endpoint,v=f??t.endpoint,j=Zs(t),l=Zt(t),m=Qs(t),h=r>0;return e.jsxs("div",{className:"rounded-[24px] border border-border/60 bg-background/45",children:[e.jsxs("button",{type:"button",onClick:()=>c(w=>!w),className:"w-full px-4 py-3 text-left",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[o?e.jsx(Ie,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.jsx(at,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx(Os,{status:t.status}),e.jsx("span",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:"Peer node"}),e.jsx("a",{href:v,target:"_blank",rel:"noreferrer",onClick:w=>w.stopPropagation(),className:"ml-auto shrink-0 text-muted-foreground transition-colors hover:text-primary",title:"Open Dashboard",children:e.jsx(Is,{className:"h-3.5 w-3.5"})})]}),e.jsxs("div",{className:"mt-1.5 flex items-center gap-2 pl-6",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:t.name}),e.jsx(Bs,{role:t.role}),e.jsx(Te,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 text-[10px] capitalize",children:t.status})]})]}),o&&e.jsxs("div",{className:"space-y-4 border-t border-border/50 px-4 pb-4 pt-3",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx(Me,{label:"Node ID",value:t.id,mono:!0}),f&&e.jsx(Me,{label:"Dashboard",value:f,mono:!0,action:e.jsx(rt,{label:"Copy dashboard URL",onClick:()=>void qe(f,"Dashboard URL copied")})}),e.jsx(Me,{label:"Node URL",value:g,mono:!0,action:e.jsx(rt,{label:"Copy node URL",onClick:()=>void qe(g,"Node URL copied")})}),t.workDir&&e.jsx(Me,{label:"Workspace",value:t.workDir,mono:!0}),e.jsx($t,{label:"Transport",value:j})]}),e.jsx(Hs,{capabilities:t.capabilities,action:a&&m?e.jsxs(M,{variant:"outline",size:"sm",onClick:()=>i(t),disabled:n===t.id||h,className:"rounded-full",title:h?"Finish assigned or running tasks before changing remote access":void 0,children:[n===t.id&&e.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}),l?"Disable Remote Access":"Enable Remote Access"]}):void 0}),a&&m&&h&&e.jsxs("div",{className:"text-xs text-muted-foreground",children:[r," active task",r===1?"":"s"," on this node."]})]})]})}function rt({label:t,onClick:a}){return e.jsx(M,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 rounded-full text-muted-foreground",onClick:a,"aria-label":t,title:t,children:e.jsx(Yt,{className:"h-3.5 w-3.5"})})}function wl(t,a,r,n){var c;if(!t)return{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Select a task to continue the conversation."};const i=((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.`}:i?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Follower nodes are read-only. Use the leader dashboard to manage chat, or leave the cluster first."}:r||n?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Waiting for the current turn to finish..."}:ht.has(t.status)||t.status==="archived"?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:ht.has(t.status)?"Task has not started yet...":"Archived tasks are read-only."}:{taskUnavailable:!1,chatDisabled:!1,chatDisabledReason:"Continue the conversation..."}}var yt="Checkbox",[Cl]=Ms(yt),[Sl,ts]=Cl(yt);function _l(t){const{__scopeCheckbox:a,checked:r,children:n,defaultChecked:i,disabled:o,form:c,name:f,onCheckedChange:g,required:v,value:j="on",internal_do_not_use_render:l}=t,[m,h]=Pr({prop:r,defaultProp:i??!1,onChange:g,caller:yt}),[w,C]=s.useState(null),[D,y]=s.useState(null),N=s.useRef(!1),O=w?!!c||!!w.closest("form"):!0,z={checked:m,disabled:o,setChecked:h,control:w,setControl:C,name:f,form:c,value:j,hasConsumerStoppedPropagationRef:N,required:v,defaultChecked:Be(i)?!1:i,isFormControl:O,bubbleInput:D,setBubbleInput:y};return e.jsx(Sl,{scope:a,...z,children:El(l)?l(z):n})}var _a="CheckboxTrigger",Ea=s.forwardRef(({__scopeCheckbox:t,onKeyDown:a,onClick:r,...n},i)=>{const{control:o,value:c,disabled:f,checked:g,required:v,setControl:j,setChecked:l,hasConsumerStoppedPropagationRef:m,isFormControl:h,bubbleInput:w}=ts(_a,t),C=kt(i,j),D=s.useRef(g);return s.useEffect(()=>{const y=o==null?void 0:o.form;if(y){const N=()=>l(D.current);return y.addEventListener("reset",N),()=>y.removeEventListener("reset",N)}},[o,l]),e.jsx(Gt.button,{type:"button",role:"checkbox","aria-checked":Be(g)?"mixed":g,"aria-required":v,"data-state":Pa(g),"data-disabled":f?"":void 0,disabled:f,value:c,...n,ref:C,onKeyDown:Rt(a,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:Rt(r,y=>{l(N=>Be(N)?!0:!N),w&&h&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});Ea.displayName=_a;var ss=s.forwardRef((t,a)=>{const{__scopeCheckbox:r,name:n,checked:i,defaultChecked:o,required:c,disabled:f,value:g,onCheckedChange:v,form:j,...l}=t;return e.jsx(_l,{__scopeCheckbox:r,checked:i,defaultChecked:o,disabled:f,required:c,onCheckedChange:v,name:n,form:j,value:g,internal_do_not_use_render:({isFormControl:m})=>e.jsxs(e.Fragment,{children:[e.jsx(Ea,{...l,ref:a,__scopeCheckbox:r}),m&&e.jsx(Ma,{__scopeCheckbox:r})]})})});ss.displayName=yt;var Da="CheckboxIndicator",Ta=s.forwardRef((t,a)=>{const{__scopeCheckbox:r,forceMount:n,...i}=t,o=ts(Da,r);return e.jsx(Mr,{present:n||Be(o.checked)||o.checked===!0,children:e.jsx(Gt.span,{"data-state":Pa(o.checked),"data-disabled":o.disabled?"":void 0,...i,ref:a,style:{pointerEvents:"none",...t.style}})})});Ta.displayName=Da;var Aa="CheckboxBubbleInput",Ma=s.forwardRef(({__scopeCheckbox:t,...a},r)=>{const{control:n,hasConsumerStoppedPropagationRef:i,checked:o,defaultChecked:c,required:f,disabled:g,name:v,value:j,form:l,bubbleInput:m,setBubbleInput:h}=ts(Aa,t),w=kt(r,h),C=Lr(o),D=Rr(n);s.useEffect(()=>{const N=m;if(!N)return;const O=window.HTMLInputElement.prototype,T=Object.getOwnPropertyDescriptor(O,"checked").set,H=!i.current;if(C!==o&&T){const F=new Event("click",{bubbles:H});N.indeterminate=Be(o),T.call(N,Be(o)?!1:o),N.dispatchEvent(F)}},[m,C,o,i]);const y=s.useRef(Be(o)?!1:o);return e.jsx(Gt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:c??y.current,required:f,disabled:g,name:v,value:j,form:l,...a,tabIndex:-1,ref:w,style:{...a.style,...D,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Ma.displayName=Aa;function El(t){return typeof t=="function"}function Be(t){return t==="indeterminate"}function Pa(t){return Be(t)?"indeterminate":t?"checked":"unchecked"}const Kt=s.forwardRef(({className:t,...a},r)=>e.jsx(ss,{ref:r,className:_("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(Ta,{className:_("flex items-center justify-center text-current"),children:e.jsx(Ge,{className:"h-3.5 w-3.5"})})}));Kt.displayName=ss.displayName;function Cs({toolbarTasks:t,activeTaskId:a,tasksLoading:r,tasksError:n,isLeader:i,scope:o,agentFilter:c,nodeFilter:f,agentOptions:g,nodeOptions:v,nodeNameById:j,searchQuery:l,selectedTaskIds:m,allVisibleTasksSelected:h,someVisibleTasksSelected:w,canBatchArchive:C,onSearchChange:D,onScopeChange:y,onAgentFilterChange:N,onNodeFilterChange:O,onToggleTaskSelected:z,onToggleAllVisibleTasks:T,onBatchArchive:H,onBatchDelete:F,onCreateTask:I,onSelectTask:L,onClose:B}){const[X,E]=s.useState(!!l),[U,Q]=s.useState(!1),[R,ae]=s.useState(!1),le=s.useRef(null),W=s.useRef(null),Z=s.useRef(null),G=m.size,P=o!=="active"||f!=="all"||c!=="all",ne=l.trim().length>0,[fe,ve]=s.useState(new Set),[J,u]=s.useState(new Set),ee=s.useMemo(()=>on(t,j),[t,j]),$=ee.length===1,de=!$||P||ne,re=$&&(P||ne),ge=s.useCallback(x=>{ve(A=>{const Y=new Set(A);return Y.has(x)?Y.delete(x):Y.add(x),Y})},[]),p=s.useCallback(x=>{u(A=>{const Y=new Set(A);return Y.has(x)?Y.delete(x):Y.add(x),Y})},[]);return s.useEffect(()=>{l&&E(!0)},[l]),s.useEffect(()=>{var x;X&&((x=le.current)==null||x.focus())},[X]),s.useEffect(()=>{if(!X)return;const x=Y=>{var ce;const q=Y.target;q instanceof Node&&((ce=W.current)!=null&&ce.contains(q)||E(!1))},A=Y=>{Y.key==="Escape"&&E(!1)};return document.addEventListener("mousedown",x),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",A)}},[X]),s.useEffect(()=>{if(!R)return;const x=Y=>{var ce;const q=Y.target;q instanceof Node&&((ce=Z.current)!=null&&ce.contains(q)||ae(!1))},A=Y=>{Y.key==="Escape"&&ae(!1)};return document.addEventListener("mousedown",x),document.addEventListener("keydown",A),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",A)}},[R]),e.jsxs("aside",{className:"flex h-full min-h-0 flex-col overflow-hidden rounded-[32px] border border-border/60 bg-background/80 shadow-[0_30px_120px_-60px_rgba(0,0,0,var(--panel-shadow-alpha))] backdrop-blur-xl",children:[e.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-lg font-semibold tracking-tight text-foreground",children:"Tasks"}),e.jsx(M,{variant:"ghost",size:"icon",onClick:B,className:"rounded-full",children:e.jsx(Js,{className:"h-4 w-4"})})]}),e.jsxs("div",{ref:W,className:"mt-4 flex items-center gap-2",children:[e.jsxs("div",{ref:Z,className:_("relative flex items-stretch transition-[flex] duration-200",X?"flex-[2]":"flex-1"),children:[e.jsxs(M,{onClick:()=>{ae(!1),I("chat")},className:"flex-1 justify-start rounded-l-[22px] rounded-r-none px-4 py-6 text-left shadow-[0_24px_60px_-32px_hsl(var(--primary)/0.95)]",children:[e.jsx(Qt,{className:"h-4 w-4"}),"New chat"]}),e.jsx(M,{onClick:()=>ae(x=>!x),"aria-label":"More chat options","aria-haspopup":"menu","aria-expanded":R,className:"w-9 rounded-l-none rounded-r-[22px] border-l border-primary-foreground/20 px-0 py-6 shadow-[0_24px_60px_-32px_hsl(var(--primary)/0.95)]",children:e.jsx(Ie,{className:_("h-3.5 w-3.5 transition-transform",R&&"rotate-180")})}),R&&e.jsx("div",{role:"menu",className:"absolute left-0 right-0 top-full z-20 mt-2 overflow-hidden rounded-2xl border border-border/60 bg-popover p-1 shadow-[0_20px_60px_-30px_rgba(0,0,0,0.6)]",children:e.jsxs("button",{type:"button",role:"menuitem",onClick:()=>{ae(!1),I("native")},className:"flex w-full items-center gap-2 rounded-xl px-3 py-2 text-left text-xs font-medium text-foreground transition-colors hover:bg-muted",children:[e.jsx(Xt,{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"})]})})]}),X?e.jsxs("div",{className:"flex min-w-0 flex-[3] items-center gap-2",children:[e.jsxs("div",{className:"relative min-w-0 flex-1",children:[e.jsx(It,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Pe,{ref:le,value:l,onChange:x=>D(x.target.value),placeholder:"Search tasks",className:"h-11 rounded-full border-border/70 bg-background/60 pl-11 text-sm"})]}),e.jsx(M,{variant:"outline",size:"icon",onClick:()=>E(!1),className:"rounded-full border-border/70 bg-background/60",children:e.jsx($r,{className:"h-4 w-4"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs(M,{variant:"outline",onClick:()=>E(!0),className:_("rounded-full border-border/70 bg-background/60 px-4 text-sm",l&&"border-primary/40 bg-primary/8 text-primary"),children:[e.jsx(It,{className:"h-4 w-4"}),"Search"]}),e.jsx(M,{variant:U||P?"secondary":"outline",size:"icon",onClick:()=>Q(x=>!x),className:_("shrink-0 rounded-full border-border/70 bg-background/60",P&&"border-primary/40 bg-primary/8 text-primary"),title:"Filters",children:e.jsx(Mn,{className:"h-4 w-4"})})]})]}),(U||P)&&e.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-3",children:[e.jsxs(we,{value:o,onValueChange:x=>y(x),children:[e.jsx(Ce,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:e.jsx(De,{})}),e.jsx(Se,{children:ln.map(x=>e.jsx(be,{value:x.value,className:"text-[12px]",children:x.label},x.value))})]}),e.jsxs(we,{value:f,onValueChange:O,children:[e.jsx(Ce,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:e.jsx(De,{placeholder:"Node"})}),e.jsx(Se,{children:v.map(x=>e.jsx(be,{value:x.value,className:"text-[12px]",children:x.label},x.value))})]}),e.jsxs(we,{value:c,onValueChange:N,children:[e.jsx(Ce,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:e.jsx(De,{placeholder:"Agent"})}),e.jsx(Se,{children:g.map(x=>e.jsx(be,{value:x,className:"text-[12px]",children:x==="all"?"All agents":x},x))})]})]})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:ee.length>0?e.jsxs("div",{className:"space-y-1",children:[i&&e.jsxs("div",{className:"mb-1 flex items-center justify-between px-1 py-1",children:[e.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[e.jsx(Kt,{checked:w&&!h?"indeterminate":h,onCheckedChange:x=>T(x===!0),"aria-label":"Select all visible tasks"}),e.jsx("span",{children:"Select all"})]}),G>0&&e.jsx(M,{variant:"ghost",size:"sm",onClick:()=>T(!1),className:"h-7 rounded-full px-3 text-xs",children:"Clear"})]}),ee.map(x=>{const A=x.nodeId??"__unassigned__",Y=de&&!re&&fe.has(A);return e.jsxs("div",{className:"space-y-1",children:[de&&e.jsxs("button",{type:"button",onClick:()=>ge(A),"aria-expanded":!Y,className:"flex w-full items-center gap-1.5 rounded-xl px-2 py-1.5 text-left text-[11px] font-semibold uppercase tracking-[0.16em] text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground",children:[Y?e.jsx(at,{className:"h-3.5 w-3.5 shrink-0"}):e.jsx(Ie,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"truncate",children:x.nodeName}),e.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-muted-foreground/60",children:x.dirs.reduce((q,ce)=>q+ce.tasks.length,0)})]}),!Y&&x.dirs.map(q=>{const ce=`${A}::${q.path}`,ke=J.has(ce),Le=dn(q.path);return e.jsxs("div",{className:_("space-y-1",de&&"pl-3"),children:[e.jsxs("button",{type:"button",onClick:()=>p(ce),"aria-expanded":!ke,title:q.path,className:"flex w-full items-center gap-1.5 rounded-xl px-2 py-1 text-left text-[11px] font-medium text-muted-foreground/80 transition-colors hover:bg-muted/40 hover:text-foreground",children:[ke?e.jsx(at,{className:"h-3 w-3 shrink-0"}):e.jsx(Ie,{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate font-mono",children:Le}),e.jsx("span",{className:"ml-auto shrink-0 tabular-nums text-muted-foreground/50",children:q.tasks.length})]}),!ke&&e.jsx("div",{className:_("space-y-2",de?"pl-2":"pl-0"),children:q.tasks.map(k=>e.jsxs("div",{className:_("flex items-start gap-3 rounded-[24px] border px-3 py-3 transition-all",k.id===a?"border-primary/45 bg-primary/9 shadow-[0_24px_80px_-54px_hsl(var(--primary)/0.95)]":"border-border/60 bg-background/40 hover:border-border hover:bg-background/60"),children:[i&&e.jsx("div",{className:"flex shrink-0 pt-1",onClick:ue=>ue.stopPropagation(),children:e.jsx(Kt,{checked:m.has(k.id),onCheckedChange:ue=>z(k.id,ue===!0),"aria-label":`Select ${k.title}`})}),e.jsx("button",{type:"button",onClick:()=>L(k.id),className:"min-w-0 flex-1 text-left",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:_("mt-1 h-2.5 w-2.5 shrink-0 rounded-full",cn(k.status))}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:k.title}),e.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:k.agent}),e.jsx("span",{className:"h-1 w-1 rounded-full bg-border"}),e.jsx("span",{children:un(k.updatedAt)})]}),e.jsxs("div",{className:"mt-3 flex items-center gap-2 text-[11px] text-muted-foreground",children:[e.jsx($s,{status:k.status}),k.conversationKind==="nativeSession"&&e.jsx(Te,{variant:"outline",className:"border-sky-500/25 bg-sky-500/10 text-[10px] text-sky-700 dark:text-sky-300",children:"native"}),k.activeShare&&e.jsx(Te,{variant:"outline",className:"border-primary/25 bg-primary/10 text-[10px] text-primary",children:"shared"}),k.assignedNodeAvailable===!1&&e.jsx(Te,{variant:"outline",className:"border-destructive/25 bg-destructive/10 text-[10px] text-destructive",children:"unavailable"})]})]})]})})]},k.id))})]},ce)})]},A)})]}):e.jsx("div",{className:"rounded-[24px] border border-dashed border-border/70 bg-background/35 px-4 py-5 text-sm text-muted-foreground",children:r?"Loading tasks...":n||"No tasks match this view."})}),i&&G>0?e.jsxs("div",{className:"shrink-0 border-t border-border/60 px-4 py-4",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-sm font-semibold text-foreground",children:[G," task",G!==1?"s":""," selected"]}),!C&&e.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Only completed, failed, cancelled, or archived tasks can be archived."}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(Bt,{children:[e.jsx(gs,{asChild:!0,children:e.jsxs(M,{variant:"outline",size:"sm",disabled:!C,className:"rounded-full",children:[e.jsx(Sn,{className:"h-3.5 w-3.5"}),"Archive"]})}),e.jsxs(pt,{children:[e.jsxs(ft,{children:[e.jsxs(bt,{children:["Archive ",G," task",G!==1?"s":"","?"]}),e.jsx(vt,{children:"Archived tasks stay hidden from the default task view and can be reopened from the archived scope."})]}),e.jsxs(gt,{children:[e.jsx(Nt,{children:"Cancel"}),e.jsx(jt,{onClick:H,disabled:!C,children:"Archive"})]})]})]}),e.jsxs(Bt,{children:[e.jsx(gs,{asChild:!0,children:e.jsxs(M,{variant:"destructive",size:"sm",className:"rounded-full",children:[e.jsx(io,{className:"h-3.5 w-3.5"}),"Delete"]})}),e.jsxs(pt,{children:[e.jsxs(ft,{children:[e.jsxs(bt,{children:["Delete ",G," task",G!==1?"s":"","?"]}),e.jsx(vt,{children:"This removes the selected tasks and their saved logs."})]}),e.jsxs(gt,{children:[e.jsx(Nt,{children:"Cancel"}),e.jsx(jt,{onClick:F,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}):null]})}async function Dl(t,a){var r,n;try{const i=await Fr(t,a);if((n=(r=globalThis.navigator)==null?void 0:r.clipboard)!=null&&n.writeText)try{await globalThis.navigator.clipboard.writeText(i.url),me.success("Shared link copied")}catch{me.success("Shared link created")}else me.success("Shared link created");return i}catch(i){me.error(i instanceof Error?i.message:"Failed to create shared link");return}}async function Tl(t){try{return await Or(t),me.success("Shared link stopped"),!0}catch(a){return me.error(a instanceof Error?a.message:"Failed to stop shared link"),!1}}function Al(t,a,r){const n=s.useCallback(()=>{a(),r()},[a,r]),i=s.useCallback(async c=>{if(!t)return;const f=await Dl(t.id,c);return f&&n(),f},[t,n]),o=s.useCallback(async()=>{if(!t)return!1;const c=await Tl(t.id);return c&&n(),c},[t,n]);return{handleShareTask:i,handleStopShareTask:o}}function Ss(t,a,r){const n=s.useRef(a);n.current=a,s.useEffect(()=>{let c=0,f=0;const g=l=>{const m=l.touches[0];m&&(c=m.clientX,f=m.clientY)},v=l=>{var C,D,y,N;const m=l.changedTouches[0];if(!m)return;const h=m.clientX-c;Math.abs(m.clientY-f)>100||Math.abs(h)<50||(h>0?(D=(C=n.current).onSwipeRight)==null||D.call(C):(N=(y=n.current).onSwipeLeft)==null||N.call(y))},j=(t==null?void 0:t.current)??document;return j.addEventListener("touchstart",g,{passive:!0}),j.addEventListener("touchend",v,{passive:!0}),()=>{j.removeEventListener("touchstart",g),j.removeEventListener("touchend",v)}},[t,r==null?void 0:r.threshold,r==null?void 0:r.maxVertical])}const Ml="(min-width: 1024px)",Pl="(min-width: 1280px)";function _s(t){var a,r,n;return((n=(r=(a=globalThis.window)==null?void 0:a.matchMedia)==null?void 0:r.call(a,t))==null?void 0:n.matches)??!1}function Ll(){const[t,a]=s.useState(!0),[r,n]=s.useState(!1),[i,o]=s.useState(()=>_s(Pl)),c=s.useRef(null),f=s.useRef(null);Ss(c,{onSwipeLeft:()=>n(!1)}),Ss(f,{onSwipeRight:()=>o(!1)});const g=s.useCallback(()=>{if(_s(Ml)){a(v=>!v);return}n(v=>!v)},[]);return{desktopTasksOpen:t,mobileTasksPanelOpen:r,mobileTasksPanelRef:c,operationsOpen:i,operationsPanelRef:f,setMobileTasksPanelOpen:n,setOperationsOpen:o,toggleTasksPanel:g}}function Rl(t,a){return a.data.nodeId===t.self.id||a.data.name===t.self.name||a.data.endpoint===t.self.endpoint}function $l({cluster:t,subscribe:a}){s.useEffect(()=>{var r;if(((r=t==null?void 0:t.self)==null?void 0:r.role)==="leader")return a("node",n=>{const i=String(n.data.name??n.data.nodeId??"node"),o=Rl(t,n);n.type==="node.joined"&&!o&&me.success(`${i} joined the cluster`),n.type==="node.left"&&!o&&me.message(`${i} left the cluster`)})},[t,a])}const Fl=[0,300,1e3,2e3];function Ol({task:t,getActiveTaskId:a,setLogs:r,setPendingMessages:n}){t.conversationKind==="nativeSession"&&(async()=>{for(const i of Fl){if(i>0&&await new Promise(o=>setTimeout(o,i)),a()!==t.id)return;try{const o=await zs(t.id);if(a()!==t.id||(r(c=>Ws(c,o.logs)),n(c=>Gs(c,o.logs)),o.total>0))return}catch{}}})()}function Il(){var ls,is,ds;const{id:t}=Ir(),a=Br(),r=zr(),{cluster:n,systemInfo:i,events:o,sseConnected:c,subscribe:f,refresh:g,loading:v,error:j}=Ur(),l=s.useMemo(()=>xn(a.state),[a.state]),[m,h]=s.useState([]),[w,C]=s.useState(!0),[D,y]=s.useState(null),[N,O]=s.useState(null),[z,T]=s.useState("active"),[H,F]=s.useState("all"),[I,L]=s.useState("all"),[B,X]=s.useState(""),E=s.useDeferredValue(B),{desktopTasksOpen:U,mobileTasksPanelOpen:Q,mobileTasksPanelRef:R,operationsOpen:ae,operationsPanelRef:le,setMobileTasksPanelOpen:W,setOperationsOpen:Z,toggleTasksPanel:G}=Ll(),[P,ne]=s.useState(()=>!!(l!=null&&l.draftNewTask)),[fe,ve]=s.useState(()=>(l==null?void 0:l.createMode)??"chat"),[J,u]=s.useState(()=>l!=null&&l.draftNewTask?{route:l.returnRoute??"/",taskId:l.returnTaskId??null}:null),[ee,$]=s.useState(!1),[de,re]=s.useState("transcript"),[ge,p]=s.useState("all"),[x,A]=s.useState(!1),[Y,q]=s.useState(null),[ce,ke]=s.useState([]),[Le,k]=s.useState([]),[ue,ye]=s.useState(!1),[Xe,Re]=s.useState(null),[oe,$e]=s.useState(new Set),[wt,Qe]=s.useState(!1),[ot,Ze]=s.useState(!1),[lt,et]=s.useState(null),tt=s.useRef(null),Fe=s.useRef(null),je=((ls=n==null?void 0:n.self)==null?void 0:ls.role)==="leader",pe=(is=n==null?void 0:n.self)==null?void 0:is.id;$l({cluster:n,subscribe:f});const te=s.useCallback(async()=>{try{const d=await Vr({assignedTo:!je&&pe?pe:void 0,limit:100});h(d),y(null)}catch(d){y(d instanceof Error?d.message:"Failed to load tasks")}finally{C(!1)}},[je,pe]);qr(te,1e4),s.useEffect(()=>{te()},[te]),s.useEffect(()=>f("task",te),[f,te]);const ie=s.useMemo(()=>[...m].sort((d,b)=>b.updatedAt-d.updatedAt),[m]),La=s.useMemo(()=>{const d=new Map;for(const b of(n==null?void 0:n.nodes)??[]){const S=uo(ie,b.id);S>0&&d.set(b.id,S)}return d},[n==null?void 0:n.nodes,ie]),Ae=s.useMemo(()=>ie.filter(d=>!mn(d,z)||H!=="all"&&d.agent!==H||I==="unassigned"&&d.assignedTo||I!=="all"&&I!=="unassigned"&&hn(d.assignedTo,n==null?void 0:n.nodes,d.assignedNodeName)!==I?!1:E.trim()?pn(d,E):!0),[ie,z,H,I,E]);s.useEffect(()=>{$e(d=>{const b=go(d,Ae.map(S=>S.id));return b.size===d.size?d:b})},[Ae]),s.useEffect(()=>{je||$e(new Set)},[je]);const Ra=s.useMemo(()=>["all",...Array.from(new Set(ie.map(d=>d.agent))).sort()],[ie]),$a=s.useMemo(()=>{const b=Array.from(new Set(ie.map(S=>S.assignedTo).filter(S=>!!S))).map(S=>{const xe=ie.find(K=>K.assignedTo===S);return(n==null?void 0:n.nodes.find(K=>K.id===S))??{id:S,name:Ks(S,n==null?void 0:n.nodes,xe==null?void 0:xe.assignedNodeName)}}).sort((S,xe)=>S.name.localeCompare(xe.name));return[{value:"all",label:"All nodes"},{value:"unassigned",label:"Unassigned"},...b.map(S=>({value:S.name.toLowerCase(),label:S.name}))]},[ie,n==null?void 0:n.nodes]),as=s.useMemo(()=>{const d=new Map;for(const b of(n==null?void 0:n.nodes)??[])d.set(b.id,b.name);for(const b of ie)b.assignedTo&&b.assignedNodeName&&!d.has(b.assignedTo)&&d.set(b.assignedTo,b.assignedNodeName);return d},[n==null?void 0:n.nodes,ie]),Ct=s.useMemo(()=>["all",...Array.from(new Set(o.map(d=>d.type))).sort()],[o]),Fa=s.useMemo(()=>ge==="all"?o:o.filter(d=>d.type===ge),[o,ge]),Oa=Ae.length>0&&Ae.every(d=>oe.has(d.id)),Ia=Ae.some(d=>oe.has(d.id)),Ba=bo(Ae,oe);s.useEffect(()=>{l!=null&&l.draftNewTask&&(ne(!0),u({route:l.returnRoute??"/",taskId:l.returnTaskId??null}))},[l]),s.useEffect(()=>{ge!=="all"&&!Ct.includes(ge)&&p("all")},[ge,Ct]),s.useEffect(()=>{fs(t,P)&&!N&&ie[0]&&O(ie[0].id)},[t,P,N,ie]),s.useEffect(()=>{var d;fs(t,P)&&(N&&m.some(b=>b.id===N)||O(((d=ie[0])==null?void 0:d.id)??null))},[t,P,N,ie,m]);const se=mo({routeTaskId:t,creatingTask:P,internalSelectedTaskId:N,sortedTaskIds:ie.map(d=>d.id)}),Ke=s.useMemo(()=>m.find(d=>d.id===se)??null,[m,se]);s.useEffect(()=>{Fe.current=se??null},[se]);const it=s.useCallback(()=>{q(null),ke([]),k([]),Re(null)},[]),Ee=s.useCallback(async()=>{const d=se;if(d)try{const b=await Kr(d);if(Fe.current!==d)return;q(b),Re(null)}catch(b){if(Fe.current!==d)return;q(null),ke([]),k([]),Re(b instanceof Error?b.message:"Failed to load task")}finally{Fe.current===d&&ye(!1)}},[se]),dt=s.useCallback(async()=>{const d=se;if(d)try{const b=await zs(d);if(Fe.current!==d)return;ke(S=>Ws(S,b.logs)),k(S=>Gs(S,b.logs))}catch{}},[se]);s.useEffect(()=>{if(!se){q(null),ke([]),k([]),Re(null),ye(!1);return}re("transcript"),q(Ke),ke([]),k([]),Re(null),ye(!0),Ee(),dt()},[se,dt,Ee]),s.useEffect(()=>{var b;if(!se||P||w||m.some(S=>S.id===se))return;const d=((b=ie[0])==null?void 0:b.id)??null;O(d),it(),s.startTransition(()=>{r(d?`/tasks/${d}`:"/",{state:null})})},[se,it,P,r,ie,m,w]),s.useEffect(()=>{Ke&&q(d=>!d||d.id!==Ke.id?d:{...d,...Ke})},[Ke]),s.useEffect(()=>f("task.updated",d=>{h(b=>po(b,d.data))}),[f]),s.useEffect(()=>{if(se)return f("task",d=>{const b=d.data.taskId;if(!(typeof b!="string"||b!==se)){if(d.type==="task.output"){const S=d.data.event;if(S){ke(K=>fn(K,S));const xe=hs(S);xe&&k(K=>gn(K,xe))}}d.type==="task.updated"&&Ee(),d.type==="task.status"&&(Ee(),dt())}})},[f,se,Ee,dt]),s.useEffect(()=>{var d;de==="transcript"&&((d=tt.current)==null||d.scrollIntoView({behavior:"smooth"}))},[ce,Le,de]);const V=Y??Ke,za=V!=null&&V.assignedTo?(n==null?void 0:n.nodes.find(d=>d.id===V.assignedTo))??null:null,St=Le.length>0,Ua=V?bn.has(V.agent):!1,_t=(V==null?void 0:V.status)==="running",Va=V?ht.has(V.status):!1,qa=V?ht.has(V.status)||vn.has(V.status):!1,Ka=!!(V&&je&&V.status==="failed"),Et=s.useMemo(()=>wl(V,n,St,!!_t),[V,n,St,_t]),Dt=s.useMemo(()=>jn([...ce,...Le.map(d=>Pt(d.content,d.timestamp))]),[ce,Le]),ct=s.useMemo(()=>{if(!V||V.conversationKind==="nativeSession")return null;const d=Nn(V);if(d.length>0)return Pt(d,new Date(V.createdAt).toISOString());if(Dt.length>0)return null;const b=kn(V.description||V.title);return b.length>0?Pt(b,new Date(V.createdAt).toISOString()):null},[V,Dt]),Tt=s.useMemo(()=>ct?hs(ct):null,[ct]),Ha=s.useMemo(()=>Tt?yn(ce,Tt):!1,[ce,Tt]),At=s.useCallback((d="chat")=>{const b={route:t?`/tasks/${t}`:"/",taskId:se};u(b),ve(d),ne(!0),s.startTransition(()=>{r("/",{state:{draftNewTask:!0,returnRoute:b.route,returnTaskId:b.taskId,createMode:d}})})},[t,se,r]),Wa=s.useCallback(()=>{var b;const d=(J==null?void 0:J.taskId)??((b=ie[0])==null?void 0:b.id)??null;ne(!1),u(null),O(d),s.startTransition(()=>{r((J==null?void 0:J.route)??"/",{state:null})})},[J,ie,r]),rs=s.useCallback(d=>{ne(!1),u(null),O(d),s.startTransition(()=>{r(`/tasks/${d}`,{state:null})})},[r]),Ga=s.useCallback(d=>{Fe.current=d.id,ne(!1),u(null),h(b=>ho(b,d)),q(d),ke([]),k([]),Re(null),ye(!1),re("transcript"),O(d.id),Ol({task:d,getActiveTaskId:()=>Fe.current,setLogs:ke,setPendingMessages:k}),te(),s.startTransition(()=>{r(`/tasks/${d.id}`,{state:null})})},[te,r]),ut=s.useCallback(async d=>{if(!se)return!1;const b=`local-${Date.now()}-${Math.random().toString(16).slice(2)}`;k(S=>[...S,{id:b,content:d,timestamp:new Date().toISOString()}]);try{return await Hr(se,d),Ee(),!0}catch(S){return k(xe=>xe.filter(K=>K.id!==b)),me.error(S instanceof Error?S.message:"Failed to send message"),!1}},[se,Ee]),Ja=s.useCallback(d=>{ut(d)},[ut]),Ya=s.useCallback(d=>ut(d),[ut]),Xa=s.useCallback(async()=>{if(V)try{await Wr(V.id),Ee(),te()}catch(d){me.error(d instanceof Error?d.message:"Failed to cancel task")}},[V,Ee,te]),{handleShareTask:Qa,handleStopShareTask:Za}=Al(V,Ee,te),er=s.useCallback(async()=>{if(V)try{await Gr(V.id),Ee(),te()}catch(d){me.error(d instanceof Error?d.message:"Failed to retry task")}},[V,Ee,te]),xt=s.useCallback((d,b=!1)=>{const S=vo(Ae,d);return O(S),(b||!S)&&it(),s.startTransition(()=>{r(S?`/tasks/${S}`:"/",{state:null})}),S},[it,Ae,r]),tr=s.useCallback((d,b)=>{$e(S=>{const xe=new Set(S);return b?xe.add(d):xe.delete(d),xe})},[]),sr=s.useCallback(d=>{if(!d){$e(new Set);return}$e(new Set(Ae.map(b=>b.id)))},[Ae]),ar=s.useCallback(async()=>{const d=Array.from(oe);if(d.length!==0)try{const{results:b}=await Jr(d),S=b.filter(K=>!K.ok),xe=b.filter(K=>K.ok).map(K=>K.id);se&&xe.includes(se)&&xt(xe),S.length>0?me.error(`Failed to archive ${S.length} task(s): ${S.map(K=>K.error??K.id).join(", ")}`):me.success(`Archived ${xe.length} task(s)`),$e(new Set(S.map(K=>K.id))),te()}catch(b){me.error(b instanceof Error?b.message:"Failed to archive tasks")}},[se,te,xt,oe]),rr=s.useCallback(async()=>{const d=Array.from(oe);if(d.length!==0)try{const{results:b}=await Yr(d),S=b.filter(K=>!K.ok),xe=b.filter(K=>K.ok).map(K=>K.id);se&&xe.includes(se)&&xt(xe,!0),S.length>0?me.error(`Failed to delete ${S.length} task(s): ${S.map(K=>K.error??K.id).join(", ")}`):me.success(`Deleted ${xe.length} task(s)`),$e(new Set(S.map(K=>K.id))),te()}catch(b){me.error(b instanceof Error?b.message:"Failed to delete tasks")}},[se,te,xt,oe]),nr=s.useCallback(async()=>{Qe(!0);try{await Xr(),g()}catch(d){me.error(d instanceof Error?d.message:"Failed to promote node")}finally{Qe(!1)}},[g]),or=s.useCallback(async()=>{Ze(!0);try{await Qr(),me.success("This node left the remote cluster and is leading itself again."),te(),Ee(),g()}catch(d){me.error(d instanceof Error?d.message:"Failed to leave cluster")}finally{Ze(!1)}},[Ee,te,g]),lr=s.useCallback(async d=>{var cs;const b=!Zt(d),S=d.id===((cs=n==null?void 0:n.self)==null?void 0:cs.id),xe=S?(i==null?void 0:i.transportType)??d.transportType:d.transportType,K=S&&!b&&Ye(xe);et(d.id);try{K?await Zr("direct"):await en(d.id,b),me.success(b?`Enabled remote access on ${d.name}`:`Disabled remote access on ${d.name}`),g()}catch(us){me.error(us instanceof Error?us.message:"Failed to update remote access")}finally{et(null)}},[(ds=n==null?void 0:n.self)==null?void 0:ds.id,g,i==null?void 0:i.transportType]),ns={toolbarTasks:Ae,activeTaskId:se,tasksLoading:w,tasksError:D,isLeader:je,scope:z,agentFilter:H,nodeFilter:I,agentOptions:Ra,nodeOptions:$a,nodeNameById:as,searchQuery:B,selectedTaskIds:oe,allVisibleTasksSelected:Oa,someVisibleTasksSelected:Ia,canBatchArchive:Ba,onSearchChange:X,onScopeChange:T,onAgentFilterChange:F,onNodeFilterChange:L,onToggleTaskSelected:tr,onToggleAllVisibleTasks:sr,onBatchArchive:ar,onBatchDelete:rr,onCreateTask:At,onSelectTask:rs,onClose:G},os={cluster:n,systemInfo:i,nodeNameById:as,nodeBlockingTaskCounts:La,eventTypeFilter:ge,onEventTypeFilterChange:p,eventTypeOptions:Ct,filteredEvents:Fa,sseConnected:c,clusterLoading:v,clusterError:j,promotePending:wt,onPromote:nr,onAddNode:()=>$(!0),leavePending:ot,onLeaveCluster:or,onToggleNodeDevTunnel:lr,devTunnelNodeId:lt,onClose:()=>Z(!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:_("hidden lg:block lg:shrink-0 lg:transition-all lg:duration-300",U?"lg:mr-3 lg:w-[24rem]":"lg:w-0 lg:overflow-hidden"),children:U&&e.jsx(Cs,{...ns})}),e.jsx("section",{className:"min-h-0 min-w-0 flex-1",children:e.jsx(hl,{onToggleTasks:G,desktopTasksOpen:U,mobileTasksPanelOpen:Q,operationsOpen:ae,onToggleOperations:()=>Z(d=>!d),cluster:n,sseConnected:c,activeTab:de,setActiveTab:re,creatingTask:P,createMode:fe,activeTask:V,assignedNode:za,taskLoading:ue,taskError:Xe,displayEvents:Dt,initialPromptAlreadyInLogs:Ha,initialPrompt:ct,supportsFollowUp:Ua,taskUnavailable:Et.taskUnavailable,chatDisabled:Et.chatDisabled,chatDisabledReason:Et.chatDisabledReason,questionBypassEnabled:x,isRunning:!!_t,isStarting:Va,hasPendingFollowUp:St,canCancel:!!qa,canRetry:!!Ka,onRetry:er,onCancel:Xa,onShareTask:Qa,onStopShareTask:Za,onStartCreateTask:At,onCancelCreateTask:Wa,onCreateTask:Ga,onSendMessage:Ja,onQuestionBypassChange:A,onSubmitQuestionResponse:Ya,messagesEndRef:tt})}),e.jsx("div",{className:_("hidden xl:block xl:shrink-0 xl:transition-all xl:duration-300",ae?"xl:ml-3 xl:w-[26rem]":"xl:w-0 xl:overflow-hidden"),children:ae&&e.jsx(ys,{...os})})]}),ae&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button","aria-label":"Close operations panel",onClick:()=>Z(!1),className:"fixed inset-0 z-30 bg-black/45 backdrop-blur-sm xl:hidden"}),e.jsx("div",{ref:le,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(ys,{...os})})]}),Q&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button","aria-label":"Close task list",onClick:()=>W(!1),className:"fixed inset-0 z-30 bg-black/45 backdrop-blur-sm lg:hidden"}),e.jsx("div",{ref:R,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(Cs,{...ns,onCreateTask:d=>{W(!1),At(d)},onSelectTask:d=>{W(!1),rs(d)},onClose:()=>W(!1)})})]}),e.jsx(Ls,{open:ee,onOpenChange:$,children:e.jsx(wo,{onAdded:()=>{$(!1),g()}})})]})}const Vl=Object.freeze(Object.defineProperty({__proto__:null,DashboardPage:Il},Symbol.toStringTag,{value:"Module"}));export{Vl as D,ps as G};