meshy-node 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dashboard/assets/DashboardPage-D2XvqhxV.js +256 -0
- package/dashboard/assets/{DiffTab-CPP_KlNw.js → DiffTab-CZv-9g4j.js} +1 -1
- package/dashboard/assets/{FilesTab-Bhu_DR2i.js → FilesTab-CAn0AzU2.js} +1 -1
- package/dashboard/assets/{PreviewTab-HFeFMit9.js → PreviewTab-DJioFwMU.js} +1 -1
- package/dashboard/assets/{file-Oxijj5Ue.js → file-CqISuc6k.js} +1 -1
- package/dashboard/assets/index-B6ZKt9Yk.css +1 -0
- package/dashboard/assets/{index-srY9WA9N.js → index-Bjql1aOh.js} +1 -1
- package/dashboard/index.html +2 -2
- package/package.json +1 -1
- package/dashboard/assets/DashboardPage-0solrVTC.js +0 -251
- package/dashboard/assets/index-CnADF-Qd.css +0 -1
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/FilesTab-CAn0AzU2.js","assets/index-Bjql1aOh.js","assets/index-B6ZKt9Yk.css","assets/file-CqISuc6k.js","assets/PreviewTab-DJioFwMU.js","assets/DiffTab-CZv-9g4j.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{c as Y,r as i,j as r,R as yo,a as lc,b as An,u as ie,d as cc,e as U,f as dc,g as uc,h as fc,B as Ce,i as q,k as it,l as wo,m as mc,n as pc,t as he,T as No,P as hc,_ as Ir,o as xc,N as jo,p as ko,q as gc,s as vc,v as bc,w as yc,x as wc,y as Nc,z as jc,A as kc,C as Sc,D as Cc,E as Ec,F as Ac,G as Tc,H as Rc,I as _c,J as Pc,K as Dc,L as Mc}from"./index-Bjql1aOh.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 Oc=[["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"}]],Ic=Y("archive",Oc);/**
|
|
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 Lc=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],$c=Y("arrow-up",Lc);/**
|
|
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 Fc=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],Lr=Y("bot",Fc);/**
|
|
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 Bc=[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]],Uc=Y("brain",Bc);/**
|
|
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 Vc=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],He=Y("check",Vc);/**
|
|
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 Wc=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Rt=Y("chevron-down",Wc);/**
|
|
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 zc=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],$r=Y("chevron-right",zc);/**
|
|
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 Hc=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Fr=Y("chevron-up",Hc);/**
|
|
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 Kc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],qc=Y("circle-question-mark",Kc);/**
|
|
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 Gc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Yc=Y("circle-x",Gc);/**
|
|
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 Xc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Jc=Y("circle",Xc);/**
|
|
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 Zc=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Tn=Y("copy",Zc);/**
|
|
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 Qc=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],So=Y("external-link",Qc);/**
|
|
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 ed=[["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"}]],td=Y("flag",ed);/**
|
|
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 nd=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],rd=Y("folder-tree",nd);/**
|
|
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 sd=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],od=Y("folder",sd);/**
|
|
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 ad=[["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"}]],id=Y("funnel",ad);/**
|
|
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 ld=[["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"}]],cd=Y("globe",ld);/**
|
|
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 dd=[["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"}]],ud=Y("history",dd);/**
|
|
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 fd=[["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"}]],hr=Y("image-plus",fd);/**
|
|
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 md=[["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"}]],pd=Y("laptop",md);/**
|
|
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 hd=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],xd=Y("list-checks",hd);/**
|
|
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 gd=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],we=Y("loader-circle",gd);/**
|
|
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 vd=[["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"}]],Co=Y("message-square-plus",vd);/**
|
|
123
|
+
* @license lucide-react v1.7.0 - ISC
|
|
124
|
+
*
|
|
125
|
+
* This source code is licensed under the ISC license.
|
|
126
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
+
*/const bd=[["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"}]],Eo=Y("panel-left-close",bd);/**
|
|
128
|
+
* @license lucide-react v1.7.0 - ISC
|
|
129
|
+
*
|
|
130
|
+
* This source code is licensed under the ISC license.
|
|
131
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
+
*/const yd=[["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"}]],wd=Y("panel-left-open",yd);/**
|
|
133
|
+
* @license lucide-react v1.7.0 - ISC
|
|
134
|
+
*
|
|
135
|
+
* This source code is licensed under the ISC license.
|
|
136
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
+
*/const Nd=[["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"}]],Ao=Y("panel-right-close",Nd);/**
|
|
138
|
+
* @license lucide-react v1.7.0 - ISC
|
|
139
|
+
*
|
|
140
|
+
* This source code is licensed under the ISC license.
|
|
141
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
142
|
+
*/const jd=[["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"}]],kd=Y("panel-right-open",jd);/**
|
|
143
|
+
* @license lucide-react v1.7.0 - ISC
|
|
144
|
+
*
|
|
145
|
+
* This source code is licensed under the ISC license.
|
|
146
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
+
*/const Sd=[["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"}]],Br=Y("pencil",Sd);/**
|
|
148
|
+
* @license lucide-react v1.7.0 - ISC
|
|
149
|
+
*
|
|
150
|
+
* This source code is licensed under the ISC license.
|
|
151
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
152
|
+
*/const Cd=[["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"}]],Ed=Y("rotate-ccw",Cd);/**
|
|
153
|
+
* @license lucide-react v1.7.0 - ISC
|
|
154
|
+
*
|
|
155
|
+
* This source code is licensed under the ISC license.
|
|
156
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
157
|
+
*/const Ad=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ps=Y("search",Ad);/**
|
|
158
|
+
* @license lucide-react v1.7.0 - ISC
|
|
159
|
+
*
|
|
160
|
+
* This source code is licensed under the ISC license.
|
|
161
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
+
*/const Td=[["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"}]],To=Y("send",Td);/**
|
|
163
|
+
* @license lucide-react v1.7.0 - ISC
|
|
164
|
+
*
|
|
165
|
+
* This source code is licensed under the ISC license.
|
|
166
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
+
*/const Rd=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],_d=Y("shield-alert",Rd);/**
|
|
168
|
+
* @license lucide-react v1.7.0 - ISC
|
|
169
|
+
*
|
|
170
|
+
* This source code is licensed under the ISC license.
|
|
171
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
+
*/const Pd=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Dd=Y("shield-check",Pd);/**
|
|
173
|
+
* @license lucide-react v1.7.0 - ISC
|
|
174
|
+
*
|
|
175
|
+
* This source code is licensed under the ISC license.
|
|
176
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
177
|
+
*/const Md=[["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"}]],Od=Y("sliders-horizontal",Md);/**
|
|
178
|
+
* @license lucide-react v1.7.0 - ISC
|
|
179
|
+
*
|
|
180
|
+
* This source code is licensed under the ISC license.
|
|
181
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
182
|
+
*/const Id=[["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"}]],Ld=Y("trash-2",Id);/**
|
|
183
|
+
* @license lucide-react v1.7.0 - ISC
|
|
184
|
+
*
|
|
185
|
+
* This source code is licensed under the ISC license.
|
|
186
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
187
|
+
*/const $d=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Fd=Y("user",$d);/**
|
|
188
|
+
* @license lucide-react v1.7.0 - ISC
|
|
189
|
+
*
|
|
190
|
+
* This source code is licensed under the ISC license.
|
|
191
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
192
|
+
*/const Bd=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Ro=Y("wrench",Bd);/**
|
|
193
|
+
* @license lucide-react v1.7.0 - ISC
|
|
194
|
+
*
|
|
195
|
+
* This source code is licensed under the ISC license.
|
|
196
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
197
|
+
*/const Ud=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],St=Y("x",Ud),Vd=new Set(["assigned","running"]);function Wd(e,t){return e.reduce((n,s)=>s.assignedTo===t&&Vd.has(s.status)?n+1:n,0)}function _t(e){return(e==null?void 0:e.toLowerCase())==="devtunnel"}function zd(e){return e?_t(e)?"DevTunnel":e.charAt(0).toUpperCase()+e.slice(1):"Direct"}function Ur(e,t){return _t(t??e.transportType)||!!e.devtunnelEndpoint}function _o(e,t){return!_t(t??e.transportType)}function Po(e,t){const n=t??e.transportType;return _t(n)?"DevTunnel":e.devtunnelEndpoint?"Direct + DevTunnel":zd(n)}function Ds(e,t){return!e&&!t}function Hd({routeTaskId:e,creatingTask:t,internalSelectedTaskId:n,sortedTaskIds:s}){return e||(t?null:n??s[0]??null)}function Kd(e,t){return[t,...e.filter(n=>n.id!==t.id)]}const qd=new Set(["completed","failed","cancelled","archived"]);function Gd(e,t){const n=new Set(t);return new Set(Array.from(e).filter(s=>n.has(s)))}function Yd(e,t){const n=new Set(t);if(n.size===0)return!1;const s=e.filter(o=>n.has(o.id));return s.length===n.size&&s.every(o=>qd.has(o.status))}function Xd(e,t){var s;const n=new Set(t);return((s=e.find(o=>!n.has(o.id)))==null?void 0:s.id)??null}function fn(e){return typeof e=="object"&&e!==null}function Jd(e){if(!fn(e))return null;if(e.type==="text"&&typeof e.text=="string"){const t=e.text.trim();return t?{type:"text",text:t}:null}if(e.type==="image"&&typeof e.mediaType=="string"&&typeof e.data=="string"){const t=e.mediaType.trim(),n=e.data;return!t||!n?null:{type:"image",mediaType:t,data:n,...typeof e.filename=="string"&&e.filename.trim()?{filename:e.filename.trim()}:{}}}if(e.type==="tool_result"&&typeof e.toolUseId=="string"&&typeof e.content=="string"){const t=e.toolUseId.trim(),n=e.content.trim();return!t||!n?null:{type:"tool_result",toolUseId:t,content:n,...typeof e.isError=="boolean"?{isError:e.isError}:{}}}return null}function Zd(e){if(!fn(e))return null;if(e.type==="text"&&typeof e.text=="string"){const s=e.text.trim();return s?{type:"text",text:s}:null}if(e.type!=="image"||!fn(e.source)){if(e.type==="tool_result"&&typeof e.tool_use_id=="string"&&typeof e.content=="string"){const s=e.tool_use_id.trim(),o=e.content.trim();return!s||!o?null:{type:"tool_result",toolUseId:s,content:o,...typeof e.is_error=="boolean"?{isError:e.is_error}:{}}}return null}const t=typeof e.source.media_type=="string"?e.source.media_type.trim():"",n=typeof e.source.data=="string"?e.source.data:"";return!t||!n?null:{type:"image",mediaType:t,data:n}}function Ft(e){if(typeof e=="string"){const t=e.trim();return t?[{type:"text",text:t}]:[]}return Array.isArray(e)?e.map(t=>Jd(t)??Zd(t)).filter(t=>t!==null):[]}function Do(e,t){const n=e.trim();return[...n?[{type:"text",text:n}]:[],...t]}function Qd(e){return{role:"user",content:e.map(t=>t.type==="text"?{type:"text",text:t.text}:t.type==="tool_result"?{type:"tool_result",tool_use_id:t.toolUseId,content:t.content,...typeof t.isError=="boolean"?{is_error:t.isError}:{}}:{type:"image",source:{type:"base64",media_type:t.mediaType,data:t.data}})}}function Zn(e,t=new Date().toISOString()){return{type:"user",message:Qd(e),timestamp:t}}function qt(e){if(e.type!=="user"||e.isSynthetic===!0)return null;if(typeof e.message=="string"){const t=Ft(e.message);return t.length>0?t:null}if(fn(e.message)&&Array.isArray(e.message.content)){const t=Ft(e.message.content);return t.length>0?t:null}if(Array.isArray(e.content)){const t=Ft(e.content);return t.length>0?t:null}return null}function eu(e){return Ft(e.payload.initialMessage)}function Ut(e){return e.map(t=>{if(t.type==="text")return`t:${t.text}`;if(t.type==="tool_result")return`r:${t.toolUseId}:${t.isError===!0?"1":"0"}:${t.content}`;const n=t.data.slice(0,32),s=t.data.slice(-32);return`i:${t.mediaType}:${t.data.length}:${n}:${s}`}).join("|")}function tu(e){return e.map(t=>t.type==="text"?t.text:t.type==="tool_result"?t.content:"").filter(Boolean).join(`
|
|
198
|
+
`)}function Vr(e){return`data:${e.mediaType};base64,${e.data}`}function nu(e){var o,a;if(!e)return[];const t=[],n=e.items;if(n)for(const l of Array.from(n)){if((l==null?void 0:l.kind)!=="file"||!((o=l.type)!=null&&o.startsWith("image/")))continue;const c=(a=l.getAsFile)==null?void 0:a.call(l);c&&c.type.startsWith("image/")&&t.push(c)}if(t.length>0)return t;const s=e.files;return s?Array.from(s).filter(l=>l.type.startsWith("image/")):[]}function ru(e){return new Promise((t,n)=>{const s=new FileReader;s.onload=()=>{if(typeof s.result!="string"){n(new Error(`Failed to read ${e.name}`));return}t(s.result)},s.onerror=()=>n(s.error??new Error(`Failed to read ${e.name}`)),s.readAsDataURL(e)})}async function Ms(e){return Promise.all(Array.from(e).map(async t=>{if(!t.type.startsWith("image/"))throw new Error(`${t.name} is not an image`);const n=await ru(t),s=n.indexOf(",");if(s===-1)throw new Error(`Failed to parse ${t.name}`);return{type:"image",mediaType:t.type||"image/png",data:n.slice(s+1),filename:t.name}}))}function Gt(e){return typeof e=="object"&&e!==null}function su(e){return Gt(e)&&typeof e.name=="string"&&e.name.toLowerCase()==="askuserquestion"}function ou(e){return!Gt(e)||typeof e.label!="string"||!e.label.trim()?null:{label:e.label.trim(),description:typeof e.description=="string"?e.description.trim():""}}function au(e){if(!Gt(e)||typeof e.question!="string"||!e.question.trim())return null;const t=Array.isArray(e.options)?e.options.map(ou).filter(n=>n!==null):[];return t.length===0?null:{header:typeof e.header=="string"&&e.header.trim()?e.header.trim():void 0,question:e.question.trim(),multiSelect:e.multiSelect===!0,options:t}}function xr(e){if(!Gt(e)||!Array.isArray(e.questions))return null;const t=e.questions.map(au).filter(n=>n!==null);return t.length===0?null:{questions:t}}function Pt(e){return JSON.stringify({questions:e.questions})}function Rn(e){const t=xr(e);if(t)return t;if(su(e)){const n=Gt(e.input)?e.input:void 0,s=xr(n);return s?{...s,...typeof e.id=="string"&&e.id.trim()?{toolUseId:e.id.trim()}:{}}:null}return null}function iu(e){var o;const t=e.trim();if(!t)return[];const n=[t],s=t.matchAll(/```(?:json)?\s*([\s\S]*?)```/gi);for(const a of s){const l=(o=a[1])==null?void 0:o.trim();l&&n.push(l)}return n}function _n(e){for(const t of iu(e))try{const n=JSON.parse(t),s=xr(n);if(s)return s}catch{}return null}function lu(e){return e.questions.map(t=>t.options.length>0?[0]:[])}function cu(e,t){return e.questions.every((n,s)=>(t[s]??[]).length>0)}function du(e,t){const s=e.questions.map((o,a)=>{const l=[...new Set(t[a]??[])].sort((c,d)=>c-d).filter(c=>o.options[c]!==void 0);return{header:o.header??null,question:o.question,multiSelect:o.multiSelect,selectedOptions:l.map(c=>o.options[c]).filter(c=>c!==void 0)}}).map(o=>{const a=o.header??o.question,l=o.selectedOptions.map(c=>c.label).join(o.multiSelect?", ":"");return`${a}: ${l}`}).join(`
|
|
199
|
+
`);return e.toolUseId?[{type:"tool_result",toolUseId:e.toolUseId,content:s,isError:!1}]:[{type:"text",text:s}]}function Vt(e){return typeof e=="object"&&e!==null}function uu(e){if(!e)return;const t=["file_path","path","command"].map(n=>e[n]).find(n=>typeof n=="string"&&n.trim().length>0);return t==null?void 0:t.trim()}function fu(e){const t=e.toLowerCase();return t.includes(" permission to write ")?"Write":t.includes(" permission to edit ")?"Edit":t.includes(" permission to run ")||t.includes(" permission to execute ")?"Bash":"Action"}function gr(e){const t=e.trim();if(!t.startsWith("Awaiting your permission to "))return null;const n=t.match(/`([^`]+)`/);return{requests:[{toolName:fu(t),target:n==null?void 0:n[1],summary:t}]}}function mu(e){if(!Array.isArray(e.permission_denials))return null;const t=[];for(const n of e.permission_denials){if(!Vt(n)||typeof n.tool_name!="string")continue;const s=Vt(n.tool_input)?n.tool_input:void 0,o=uu(s),a=typeof e.result=="string"&&e.result.trim().length>0?e.result.trim():`Awaiting your permission to use ${n.tool_name}${o?` on \`${o}\``:""}.`;t.push({toolName:n.tool_name,...typeof n.tool_use_id=="string"?{toolUseId:n.tool_use_id}:{},...o?{target:o}:{},summary:a})}return t.length>0?{requests:t}:null}function Os(e){if(!Array.isArray(e))return null;for(const t of e){if(!Vt(t)||t.type!=="text"||typeof t.text!="string")continue;const n=gr(t.text);if(n)return n}return null}function Wr(e){if(!Vt(e))return null;const t=mu(e);if(t)return t;if(typeof e.result=="string"){const s=gr(e.result);if(s)return s}if(typeof e.message=="string"){const s=gr(e.message);if(s)return s}if(Vt(e.message)){const s=Wr(e.message);if(s)return s;const o=Os(e.message.content);if(o)return o}const n=Os(e.content);return n||null}function pu(e){return JSON.stringify(e.requests.map(t=>({toolName:t.toolName,target:t.target??null,summary:t.summary})))}function hu(e,t){return e.requests.map(n=>{const s=n.target?` for \`${n.target}\``:"",o=t==="approve"?`Approved. Proceed with the requested ${n.toolName} action${s}.`:`Denied. Do not proceed with the requested ${n.toolName} action${s}. Ask for another approach if needed.`;return n.toolUseId?{type:"tool_result",toolUseId:n.toolUseId,content:o,isError:t==="deny"}:t==="approve"?{type:"text",text:o}:{type:"text",text:o}})}function Mo(e){return qt(e)!==null}function mn(e){if(e.type==="user"){const t=qt(e),n=typeof e.timestamp=="string"?e.timestamp:"";if(t)return`user:${n}:${Ut(t)}`}return JSON.stringify(e)}function vr(e){const t=Rn(e);return t?`question:${Pt(t)}`:null}function xu(e){const t=Wr(e);return t?`permission:${pu(t)}`:null}function Is(e){if(!Array.isArray(e))return null;const t=new Set;for(const n of e){const s=vr(n);if(s){t.add(s);continue}if(typeof n=="object"&&n!==null&&n.type==="text"&&typeof n.text=="string"){const o=_n(n.text);o&&t.add(Pt(o))}}return t.size===0?null:Array.from(t).sort().join("|")}function gu(e){const t=vr(e);if(t)return t;if(typeof e.message=="string"){const n=_n(e.message);return n?Pt(n):null}if(typeof e.message=="object"&&e.message!==null){const n=vr(e.message);return n||Is(e.message.content)}return Is(e.content)}function vu(e){return xu(e)}function bu(e,t,n){const s=typeof t.timestamp=="string"?t.timestamp:"";return`${e}-${s}-${n}`}function yu(e,t){const n=t.map(o=>({...o})),s=new Set(n.map(mn));for(const o of e){const a=mn(o);s.has(a)||(n.push(o),s.add(a))}return n}function wu(e,t){const n=mn(t);return e.some(s=>mn(s)===n)?e:[...e,{...t}]}function Nu(e,t){const n=new Map;for(const s of t){const o=qt(s);if(!o)continue;const a=Ut(o);n.set(a,(n.get(a)??0)+1)}return e.filter(s=>{const o=Ut(s.content),a=n.get(o)??0;return a<=0?!0:(n.set(o,a-1),!1)})}function ju(e,t){const n=Ut(t),s=e.findIndex(o=>Ut(o.content)===n);return s===-1?e:e.filter((o,a)=>a!==s)}function ku(e){return e.some(Mo)}function Su(e){const t=[];let n=null;for(const s of e){if(Mo(s)){n=null,t.push(s);continue}const o=vu(s)??gu(s);o&&o===n||(t.push(s),o&&(n=o))}return t}function J(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Cu(e,t){const n=i.createContext(t),s=a=>{const{children:l,...c}=a,d=i.useMemo(()=>c,Object.values(c));return r.jsx(n.Provider,{value:d,children:l})};s.displayName=e+"Provider";function o(a){const l=i.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[s,o]}function rt(e,t=[]){let n=[];function s(a,l){const c=i.createContext(l),d=n.length;n=[...n,l];const f=m=>{var b;const{scope:h,children:x,...g}=m,p=((b=h==null?void 0:h[e])==null?void 0:b[d])||c,v=i.useMemo(()=>g,Object.values(g));return r.jsx(p.Provider,{value:v,children:x})};f.displayName=a+"Provider";function u(m,h){var p;const x=((p=h==null?void 0:h[e])==null?void 0:p[d])||c,g=i.useContext(x);if(g)return g;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[f,u]}const o=()=>{const a=n.map(l=>i.createContext(l));return function(c){const d=(c==null?void 0:c[e])||a;return i.useMemo(()=>({[`__scope${e}`]:{...c,[e]:d}}),[c,d])}};return o.scopeName=e,[s,Eu(o,...t)]}function Eu(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const l=s.reduce((c,{useScope:d,scopeName:f})=>{const m=d(a)[`__scope${f}`];return{...c,...m}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}var ye=globalThis!=null&&globalThis.document?i.useLayoutEffect:()=>{},Au=yo[" useId ".trim().toString()]||(()=>{}),Tu=0;function Ze(e){const[t,n]=i.useState(Au());return ye(()=>{n(s=>s??String(Tu++))},[e]),e||(t?`radix-${t}`:"")}var Ru=yo[" useInsertionEffect ".trim().toString()]||ye;function Ct({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[o,a,l]=_u({defaultProp:t,onChange:n}),c=e!==void 0,d=c?e:o;{const u=i.useRef(e!==void 0);i.useEffect(()=>{const m=u.current;m!==c&&console.warn(`${s} is changing from ${m?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=c},[c,s])}const f=i.useCallback(u=>{var m;if(c){const h=Pu(u)?u(e):u;h!==e&&((m=l.current)==null||m.call(l,h))}else a(u)},[c,e,a,l]);return[d,f]}function _u({defaultProp:e,onChange:t}){const[n,s]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return Ru(()=>{a.current=t},[t]),i.useEffect(()=>{var l;o.current!==n&&((l=a.current)==null||l.call(a,n),o.current=n)},[n,o]),[n,s,a]}function Pu(e){return typeof e=="function"}function Wt(e){const t=Du(e),n=i.forwardRef((s,o)=>{const{children:a,...l}=s,c=i.Children.toArray(a),d=c.find(Ou);if(d){const f=d.props.children,u=c.map(m=>m===d?i.Children.count(f)>1?i.Children.only(null):i.isValidElement(f)?f.props.children:null:m);return r.jsx(t,{...l,ref:o,children:i.isValidElement(f)?i.cloneElement(f,void 0,u):null})}return r.jsx(t,{...l,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function Du(e){const t=i.forwardRef((n,s)=>{const{children:o,...a}=n;if(i.isValidElement(o)){const l=Lu(o),c=Iu(a,o.props);return o.type!==i.Fragment&&(c.ref=s?lc(s,l):l),i.cloneElement(o,c)}return i.Children.count(o)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Oo=Symbol("radix.slottable");function Mu(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=Oo,t}function Ou(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Oo}function Iu(e,t){const n={...t};for(const s in t){const o=e[s],a=t[s];/^on[A-Z]/.test(s)?o&&a?n[s]=(...c)=>{const d=a(...c);return o(...c),d}:o&&(n[s]=o):s==="style"?n[s]={...o,...a}:s==="className"&&(n[s]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function Lu(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $u=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Z=$u.reduce((e,t)=>{const n=Wt(`Primitive.${t}`),s=i.forwardRef((o,a)=>{const{asChild:l,...c}=o,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(d,{...c,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Fu(e,t){e&&An.flushSync(()=>e.dispatchEvent(t))}function et(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function Bu(e,t=globalThis==null?void 0:globalThis.document){const n=et(e);i.useEffect(()=>{const s=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var Uu="DismissableLayer",br="dismissableLayer.update",Vu="dismissableLayer.pointerDownOutside",Wu="dismissableLayer.focusOutside",Ls,Io=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zr=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:l,onDismiss:c,...d}=e,f=i.useContext(Io),[u,m]=i.useState(null),h=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=i.useState({}),g=ie(t,k=>m(k)),p=Array.from(f.layers),[v]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),b=p.indexOf(v),y=u?p.indexOf(u):-1,w=f.layersWithOutsidePointerEventsDisabled.size>0,j=y>=b,S=Ku(k=>{const A=k.target,R=[...f.branches].some(D=>D.contains(A));!j||R||(o==null||o(k),l==null||l(k),k.defaultPrevented||c==null||c())},h),C=qu(k=>{const A=k.target;[...f.branches].some(D=>D.contains(A))||(a==null||a(k),l==null||l(k),k.defaultPrevented||c==null||c())},h);return Bu(k=>{y===f.layers.size-1&&(s==null||s(k),!k.defaultPrevented&&c&&(k.preventDefault(),c()))},h),i.useEffect(()=>{if(u)return n&&(f.layersWithOutsidePointerEventsDisabled.size===0&&(Ls=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(u)),f.layers.add(u),$s(),()=>{n&&f.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Ls)}},[u,h,n,f]),i.useEffect(()=>()=>{u&&(f.layers.delete(u),f.layersWithOutsidePointerEventsDisabled.delete(u),$s())},[u,f]),i.useEffect(()=>{const k=()=>x({});return document.addEventListener(br,k),()=>document.removeEventListener(br,k)},[]),r.jsx(Z.div,{...d,ref:g,style:{pointerEvents:w?j?"auto":"none":void 0,...e.style},onFocusCapture:J(e.onFocusCapture,C.onFocusCapture),onBlurCapture:J(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:J(e.onPointerDownCapture,S.onPointerDownCapture)})});zr.displayName=Uu;var zu="DismissableLayerBranch",Hu=i.forwardRef((e,t)=>{const n=i.useContext(Io),s=i.useRef(null),o=ie(t,s);return i.useEffect(()=>{const a=s.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),r.jsx(Z.div,{...e,ref:o})});Hu.displayName=zu;function Ku(e,t=globalThis==null?void 0:globalThis.document){const n=et(e),s=i.useRef(!1),o=i.useRef(()=>{});return i.useEffect(()=>{const a=c=>{if(c.target&&!s.current){let d=function(){Lo(Vu,n,f,{discrete:!0})};const f={originalEvent:c};c.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);s.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function qu(e,t=globalThis==null?void 0:globalThis.document){const n=et(e),s=i.useRef(!1);return i.useEffect(()=>{const o=a=>{a.target&&!s.current&&Lo(Wu,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function $s(){const e=new CustomEvent(br);document.dispatchEvent(e)}function Lo(e,t,n,{discrete:s}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),s?Fu(o,a):o.dispatchEvent(a)}var Qn="focusScope.autoFocusOnMount",er="focusScope.autoFocusOnUnmount",Fs={bubbles:!1,cancelable:!0},Gu="FocusScope",Hr=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...l}=e,[c,d]=i.useState(null),f=et(o),u=et(a),m=i.useRef(null),h=ie(t,p=>d(p)),x=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(s){let p=function(w){if(x.paused||!c)return;const j=w.target;c.contains(j)?m.current=j:Ye(m.current,{select:!0})},v=function(w){if(x.paused||!c)return;const j=w.relatedTarget;j!==null&&(c.contains(j)||Ye(m.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&Ye(c)};document.addEventListener("focusin",p),document.addEventListener("focusout",v);const y=new MutationObserver(b);return c&&y.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",v),y.disconnect()}}},[s,c,x.paused]),i.useEffect(()=>{if(c){Us.add(x);const p=document.activeElement;if(!c.contains(p)){const b=new CustomEvent(Qn,Fs);c.addEventListener(Qn,f),c.dispatchEvent(b),b.defaultPrevented||(Yu(ef($o(c)),{select:!0}),document.activeElement===p&&Ye(c))}return()=>{c.removeEventListener(Qn,f),setTimeout(()=>{const b=new CustomEvent(er,Fs);c.addEventListener(er,u),c.dispatchEvent(b),b.defaultPrevented||Ye(p??document.body,{select:!0}),c.removeEventListener(er,u),Us.remove(x)},0)}}},[c,f,u,x]);const g=i.useCallback(p=>{if(!n&&!s||x.paused)return;const v=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,b=document.activeElement;if(v&&b){const y=p.currentTarget,[w,j]=Xu(y);w&&j?!p.shiftKey&&b===j?(p.preventDefault(),n&&Ye(w,{select:!0})):p.shiftKey&&b===w&&(p.preventDefault(),n&&Ye(j,{select:!0})):b===y&&p.preventDefault()}},[n,s,x.paused]);return r.jsx(Z.div,{tabIndex:-1,...l,ref:h,onKeyDown:g})});Hr.displayName=Gu;function Yu(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(Ye(s,{select:t}),document.activeElement!==n)return}function Xu(e){const t=$o(e),n=Bs(t,e),s=Bs(t.reverse(),e);return[n,s]}function $o(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const o=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||o?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Bs(e,t){for(const n of e)if(!Ju(n,{upTo:t}))return n}function Ju(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Zu(e){return e instanceof HTMLInputElement&&"select"in e}function Ye(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Zu(e)&&t&&e.select()}}var Us=Qu();function Qu(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Vs(e,t),e.unshift(t)},remove(t){var n;e=Vs(e,t),(n=e[0])==null||n.resume()}}}function Vs(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function ef(e){return e.filter(t=>t.tagName!=="A")}var tf="Portal",Kr=i.forwardRef((e,t)=>{var c;const{container:n,...s}=e,[o,a]=i.useState(!1);ye(()=>a(!0),[]);const l=n||o&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return l?cc.createPortal(r.jsx(Z.div,{...s,ref:t}),l):null});Kr.displayName=tf;function nf(e,t){return i.useReducer((n,s)=>t[n][s]??n,e)}var Dt=e=>{const{present:t,children:n}=e,s=rf(t),o=typeof n=="function"?n({present:s.isPresent}):i.Children.only(n),a=ie(s.ref,sf(o));return typeof n=="function"||s.isPresent?i.cloneElement(o,{ref:a}):null};Dt.displayName="Presence";function rf(e){const[t,n]=i.useState(),s=i.useRef(null),o=i.useRef(e),a=i.useRef("none"),l=e?"mounted":"unmounted",[c,d]=nf(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const f=tn(s.current);a.current=c==="mounted"?f:"none"},[c]),ye(()=>{const f=s.current,u=o.current;if(u!==e){const h=a.current,x=tn(f);e?d("MOUNT"):x==="none"||(f==null?void 0:f.display)==="none"?d("UNMOUNT"):d(u&&h!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),ye(()=>{if(t){let f;const u=t.ownerDocument.defaultView??window,m=x=>{const p=tn(s.current).includes(CSS.escape(x.animationName));if(x.target===t&&p&&(d("ANIMATION_END"),!o.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",f=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},h=x=>{x.target===t&&(a.current=tn(s.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{u.clearTimeout(f),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:i.useCallback(f=>{s.current=f?getComputedStyle(f):null,n(f)},[])}}function tn(e){return(e==null?void 0:e.animationName)||"none"}function sf(e){var s,o;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var tr=0;function Fo(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ws()),document.body.insertAdjacentElement("beforeend",e[1]??Ws()),tr++,()=>{tr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),tr--}},[])}function Ws(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Le=function(){return Le=Object.assign||function(t){for(var n,s=1,o=arguments.length;s<o;s++){n=arguments[s];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},Le.apply(this,arguments)};function Bo(e,t){var n={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,s=Object.getOwnPropertySymbols(e);o<s.length;o++)t.indexOf(s[o])<0&&Object.prototype.propertyIsEnumerable.call(e,s[o])&&(n[s[o]]=e[s[o]]);return n}function of(e,t,n){if(n||arguments.length===2)for(var s=0,o=t.length,a;s<o;s++)(a||!(s in t))&&(a||(a=Array.prototype.slice.call(t,0,s)),a[s]=t[s]);return e.concat(a||Array.prototype.slice.call(t))}var ln="right-scroll-bar-position",cn="width-before-scroll-bar",af="with-scroll-bars-hidden",lf="--removed-body-scroll-bar-size";function nr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function cf(e,t){var n=i.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(s){var o=n.value;o!==s&&(n.value=s,n.callback(s,o))}}}})[0];return n.callback=t,n.facade}var df=typeof window<"u"?i.useLayoutEffect:i.useEffect,zs=new WeakMap;function uf(e,t){var n=cf(null,function(s){return e.forEach(function(o){return nr(o,s)})});return df(function(){var s=zs.get(n);if(s){var o=new Set(s),a=new Set(e),l=n.current;o.forEach(function(c){a.has(c)||nr(c,null)}),a.forEach(function(c){o.has(c)||nr(c,l)})}zs.set(n,e)},[e]),n}function ff(e){return e}function mf(e,t){t===void 0&&(t=ff);var n=[],s=!1,o={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var l=t(a,s);return n.push(l),function(){n=n.filter(function(c){return c!==l})}},assignSyncMedium:function(a){for(s=!0;n.length;){var l=n;n=[],l.forEach(a)}n={push:function(c){return a(c)},filter:function(){return n}}},assignMedium:function(a){s=!0;var l=[];if(n.length){var c=n;n=[],c.forEach(a),l=n}var d=function(){var u=l;l=[],u.forEach(a)},f=function(){return Promise.resolve().then(d)};f(),n={push:function(u){l.push(u),f()},filter:function(u){return l=l.filter(u),n}}}};return o}function pf(e){e===void 0&&(e={});var t=mf(null);return t.options=Le({async:!0,ssr:!1},e),t}var Uo=function(e){var t=e.sideCar,n=Bo(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return i.createElement(s,Le({},n))};Uo.isSideCarExport=!0;function hf(e,t){return e.useMedium(t),Uo}var Vo=pf(),rr=function(){},Pn=i.forwardRef(function(e,t){var n=i.useRef(null),s=i.useState({onScrollCapture:rr,onWheelCapture:rr,onTouchMoveCapture:rr}),o=s[0],a=s[1],l=e.forwardProps,c=e.children,d=e.className,f=e.removeScrollBar,u=e.enabled,m=e.shards,h=e.sideCar,x=e.noRelative,g=e.noIsolation,p=e.inert,v=e.allowPinchZoom,b=e.as,y=b===void 0?"div":b,w=e.gapMode,j=Bo(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=h,C=uf([n,t]),k=Le(Le({},j),o);return i.createElement(i.Fragment,null,u&&i.createElement(S,{sideCar:Vo,removeScrollBar:f,shards:m,noRelative:x,noIsolation:g,inert:p,setCallbacks:a,allowPinchZoom:!!v,lockRef:n,gapMode:w}),l?i.cloneElement(i.Children.only(c),Le(Le({},k),{ref:C})):i.createElement(y,Le({},k,{className:d,ref:C}),c))});Pn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Pn.classNames={fullWidth:cn,zeroRight:ln};var xf=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function gf(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=xf();return t&&e.setAttribute("nonce",t),e}function vf(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function bf(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var yf=function(){var e=0,t=null;return{add:function(n){e==0&&(t=gf())&&(vf(t,n),bf(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},wf=function(){var e=yf();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Wo=function(){var e=wf(),t=function(n){var s=n.styles,o=n.dynamic;return e(s,o),null};return t},Nf={left:0,top:0,right:0,gap:0},sr=function(e){return parseInt(e||"",10)||0},jf=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[sr(n),sr(s),sr(o)]},kf=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Nf;var t=jf(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},Sf=Wo(),wt="data-scroll-locked",Cf=function(e,t,n,s){var o=e.left,a=e.top,l=e.right,c=e.gap;return n===void 0&&(n="margin"),`
|
|
200
|
+
.`.concat(af,` {
|
|
201
|
+
overflow: hidden `).concat(s,`;
|
|
202
|
+
padding-right: `).concat(c,"px ").concat(s,`;
|
|
203
|
+
}
|
|
204
|
+
body[`).concat(wt,`] {
|
|
205
|
+
overflow: hidden `).concat(s,`;
|
|
206
|
+
overscroll-behavior: contain;
|
|
207
|
+
`).concat([t&&"position: relative ".concat(s,";"),n==="margin"&&`
|
|
208
|
+
padding-left: `.concat(o,`px;
|
|
209
|
+
padding-top: `).concat(a,`px;
|
|
210
|
+
padding-right: `).concat(l,`px;
|
|
211
|
+
margin-left:0;
|
|
212
|
+
margin-top:0;
|
|
213
|
+
margin-right: `).concat(c,"px ").concat(s,`;
|
|
214
|
+
`),n==="padding"&&"padding-right: ".concat(c,"px ").concat(s,";")].filter(Boolean).join(""),`
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.`).concat(ln,` {
|
|
218
|
+
right: `).concat(c,"px ").concat(s,`;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.`).concat(cn,` {
|
|
222
|
+
margin-right: `).concat(c,"px ").concat(s,`;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
.`).concat(ln," .").concat(ln,` {
|
|
226
|
+
right: 0 `).concat(s,`;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.`).concat(cn," .").concat(cn,` {
|
|
230
|
+
margin-right: 0 `).concat(s,`;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
body[`).concat(wt,`] {
|
|
234
|
+
`).concat(lf,": ").concat(c,`px;
|
|
235
|
+
}
|
|
236
|
+
`)},Hs=function(){var e=parseInt(document.body.getAttribute(wt)||"0",10);return isFinite(e)?e:0},Ef=function(){i.useEffect(function(){return document.body.setAttribute(wt,(Hs()+1).toString()),function(){var e=Hs()-1;e<=0?document.body.removeAttribute(wt):document.body.setAttribute(wt,e.toString())}},[])},Af=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,o=s===void 0?"margin":s;Ef();var a=i.useMemo(function(){return kf(o)},[o]);return i.createElement(Sf,{styles:Cf(a,!t,o,n?"":"!important")})},yr=!1;if(typeof window<"u")try{var nn=Object.defineProperty({},"passive",{get:function(){return yr=!0,!0}});window.addEventListener("test",nn,nn),window.removeEventListener("test",nn,nn)}catch{yr=!1}var gt=yr?{passive:!1}:!1,Tf=function(e){return e.tagName==="TEXTAREA"},zo=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Tf(e)&&n[t]==="visible")},Rf=function(e){return zo(e,"overflowY")},_f=function(e){return zo(e,"overflowX")},Ks=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var o=Ho(e,s);if(o){var a=Ko(e,s),l=a[1],c=a[2];if(l>c)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},Pf=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},Df=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},Ho=function(e,t){return e==="v"?Rf(t):_f(t)},Ko=function(e,t){return e==="v"?Pf(t):Df(t)},Mf=function(e,t){return e==="h"&&t==="rtl"?-1:1},Of=function(e,t,n,s,o){var a=Mf(e,window.getComputedStyle(t).direction),l=a*s,c=n.target,d=t.contains(c),f=!1,u=l>0,m=0,h=0;do{if(!c)break;var x=Ko(e,c),g=x[0],p=x[1],v=x[2],b=p-v-a*g;(g||b)&&Ho(e,c)&&(m+=b,h+=g);var y=c.parentNode;c=y&&y.nodeType===Node.DOCUMENT_FRAGMENT_NODE?y.host:y}while(!d&&c!==document.body||d&&(t.contains(c)||t===c));return(u&&Math.abs(m)<1||!u&&Math.abs(h)<1)&&(f=!0),f},rn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},qs=function(e){return[e.deltaX,e.deltaY]},Gs=function(e){return e&&"current"in e?e.current:e},If=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Lf=function(e){return`
|
|
237
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
238
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
239
|
+
`)},$f=0,vt=[];function Ff(e){var t=i.useRef([]),n=i.useRef([0,0]),s=i.useRef(),o=i.useState($f++)[0],a=i.useState(Wo)[0],l=i.useRef(e);i.useEffect(function(){l.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=of([e.lockRef.current],(e.shards||[]).map(Gs),!0).filter(Boolean);return p.forEach(function(v){return v.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var c=i.useCallback(function(p,v){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!l.current.allowPinchZoom;var b=rn(p),y=n.current,w="deltaX"in p?p.deltaX:y[0]-b[0],j="deltaY"in p?p.deltaY:y[1]-b[1],S,C=p.target,k=Math.abs(w)>Math.abs(j)?"h":"v";if("touches"in p&&k==="h"&&C.type==="range")return!1;var A=window.getSelection(),R=A&&A.anchorNode,D=R?R===C||R.contains(C):!1;if(D)return!1;var $=Ks(k,C);if(!$)return!0;if($?S=k:(S=k==="v"?"h":"v",$=Ks(k,C)),!$)return!1;if(!s.current&&"changedTouches"in p&&(w||j)&&(s.current=S),!S)return!0;var _=s.current||S;return Of(_,v,p,_==="h"?w:j)},[]),d=i.useCallback(function(p){var v=p;if(!(!vt.length||vt[vt.length-1]!==a)){var b="deltaY"in v?qs(v):rn(v),y=t.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&If(S.delta,b)})[0];if(y&&y.should){v.cancelable&&v.preventDefault();return}if(!y){var w=(l.current.shards||[]).map(Gs).filter(Boolean).filter(function(S){return S.contains(v.target)}),j=w.length>0?c(v,w[0]):!l.current.noIsolation;j&&v.cancelable&&v.preventDefault()}}},[]),f=i.useCallback(function(p,v,b,y){var w={name:p,delta:v,target:b,should:y,shadowParent:Bf(b)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(j){return j!==w})},1)},[]),u=i.useCallback(function(p){n.current=rn(p),s.current=void 0},[]),m=i.useCallback(function(p){f(p.type,qs(p),p.target,c(p,e.lockRef.current))},[]),h=i.useCallback(function(p){f(p.type,rn(p),p.target,c(p,e.lockRef.current))},[]);i.useEffect(function(){return vt.push(a),e.setCallbacks({onScrollCapture:m,onWheelCapture:m,onTouchMoveCapture:h}),document.addEventListener("wheel",d,gt),document.addEventListener("touchmove",d,gt),document.addEventListener("touchstart",u,gt),function(){vt=vt.filter(function(p){return p!==a}),document.removeEventListener("wheel",d,gt),document.removeEventListener("touchmove",d,gt),document.removeEventListener("touchstart",u,gt)}},[]);var x=e.removeScrollBar,g=e.inert;return i.createElement(i.Fragment,null,g?i.createElement(a,{styles:Lf(o)}):null,x?i.createElement(Af,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Bf(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Uf=hf(Vo,Ff);var qr=i.forwardRef(function(e,t){return i.createElement(Pn,Le({},e,{ref:t,sideCar:Uf}))});qr.classNames=Pn.classNames;var Vf=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},bt=new WeakMap,sn=new WeakMap,on={},or=0,qo=function(e){return e&&(e.host||qo(e.parentNode))},Wf=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=qo(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},zf=function(e,t,n,s){var o=Wf(t,Array.isArray(e)?e:[e]);on[n]||(on[n]=new WeakMap);var a=on[n],l=[],c=new Set,d=new Set(o),f=function(m){!m||c.has(m)||(c.add(m),f(m.parentNode))};o.forEach(f);var u=function(m){!m||d.has(m)||Array.prototype.forEach.call(m.children,function(h){if(c.has(h))u(h);else try{var x=h.getAttribute(s),g=x!==null&&x!=="false",p=(bt.get(h)||0)+1,v=(a.get(h)||0)+1;bt.set(h,p),a.set(h,v),l.push(h),p===1&&g&&sn.set(h,!0),v===1&&h.setAttribute(n,"true"),g||h.setAttribute(s,"true")}catch(b){console.error("aria-hidden: cannot operate on ",h,b)}})};return u(t),c.clear(),or++,function(){l.forEach(function(m){var h=bt.get(m)-1,x=a.get(m)-1;bt.set(m,h),a.set(m,x),h||(sn.has(m)||m.removeAttribute(s),sn.delete(m)),x||m.removeAttribute(n)}),or--,or||(bt=new WeakMap,bt=new WeakMap,sn=new WeakMap,on={})}},Go=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),o=Vf(e);return o?(s.push.apply(s,Array.from(o.querySelectorAll("[aria-live], script"))),zf(s,o,n,"aria-hidden")):function(){return null}},Dn="Dialog",[Yo,Xo]=rt(Dn),[Hf,Ie]=Yo(Dn),Jo=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:o,onOpenChange:a,modal:l=!0}=e,c=i.useRef(null),d=i.useRef(null),[f,u]=Ct({prop:s,defaultProp:o??!1,onChange:a,caller:Dn});return r.jsx(Hf,{scope:t,triggerRef:c,contentRef:d,contentId:Ze(),titleId:Ze(),descriptionId:Ze(),open:f,onOpenChange:u,onOpenToggle:i.useCallback(()=>u(m=>!m),[u]),modal:l,children:n})};Jo.displayName=Dn;var Zo="DialogTrigger",Qo=i.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ie(Zo,n),a=ie(t,o.triggerRef);return r.jsx(Z.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":Xr(o.open),...s,ref:a,onClick:J(e.onClick,o.onOpenToggle)})});Qo.displayName=Zo;var Gr="DialogPortal",[Kf,ea]=Yo(Gr,{forceMount:void 0}),ta=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:o}=e,a=Ie(Gr,t);return r.jsx(Kf,{scope:t,forceMount:n,children:i.Children.map(s,l=>r.jsx(Dt,{present:n||a.open,children:r.jsx(Kr,{asChild:!0,container:o,children:l})}))})};ta.displayName=Gr;var pn="DialogOverlay",na=i.forwardRef((e,t)=>{const n=ea(pn,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,a=Ie(pn,e.__scopeDialog);return a.modal?r.jsx(Dt,{present:s||a.open,children:r.jsx(Gf,{...o,ref:t})}):null});na.displayName=pn;var qf=Wt("DialogOverlay.RemoveScroll"),Gf=i.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ie(pn,n);return r.jsx(qr,{as:qf,allowPinchZoom:!0,shards:[o.contentRef],children:r.jsx(Z.div,{"data-state":Xr(o.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ct="DialogContent",ra=i.forwardRef((e,t)=>{const n=ea(ct,e.__scopeDialog),{forceMount:s=n.forceMount,...o}=e,a=Ie(ct,e.__scopeDialog);return r.jsx(Dt,{present:s||a.open,children:a.modal?r.jsx(Yf,{...o,ref:t}):r.jsx(Xf,{...o,ref:t})})});ra.displayName=ct;var Yf=i.forwardRef((e,t)=>{const n=Ie(ct,e.__scopeDialog),s=i.useRef(null),o=ie(t,n.contentRef,s);return i.useEffect(()=>{const a=s.current;if(a)return Go(a)},[]),r.jsx(sa,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:J(e.onCloseAutoFocus,a=>{var l;a.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:J(e.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0;(l.button===2||c)&&a.preventDefault()}),onFocusOutside:J(e.onFocusOutside,a=>a.preventDefault())})}),Xf=i.forwardRef((e,t)=>{const n=Ie(ct,e.__scopeDialog),s=i.useRef(!1),o=i.useRef(!1);return r.jsx(sa,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var l,c;(l=e.onCloseAutoFocus)==null||l.call(e,a),a.defaultPrevented||(s.current||(c=n.triggerRef.current)==null||c.focus(),a.preventDefault()),s.current=!1,o.current=!1},onInteractOutside:a=>{var d,f;(d=e.onInteractOutside)==null||d.call(e,a),a.defaultPrevented||(s.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const l=a.target;((f=n.triggerRef.current)==null?void 0:f.contains(l))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),sa=i.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,...l}=e,c=Ie(ct,n),d=i.useRef(null),f=ie(t,d);return Fo(),r.jsxs(r.Fragment,{children:[r.jsx(Hr,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:o,onUnmountAutoFocus:a,children:r.jsx(zr,{role:"dialog",id:c.contentId,"aria-describedby":c.descriptionId,"aria-labelledby":c.titleId,"data-state":Xr(c.open),...l,ref:f,onDismiss:()=>c.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(Zf,{titleId:c.titleId}),r.jsx(em,{contentRef:d,descriptionId:c.descriptionId})]})]})}),Yr="DialogTitle",oa=i.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ie(Yr,n);return r.jsx(Z.h2,{id:o.titleId,...s,ref:t})});oa.displayName=Yr;var aa="DialogDescription",ia=i.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ie(aa,n);return r.jsx(Z.p,{id:o.descriptionId,...s,ref:t})});ia.displayName=aa;var la="DialogClose",ca=i.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,o=Ie(la,n);return r.jsx(Z.button,{type:"button",...s,ref:t,onClick:J(e.onClick,()=>o.onOpenChange(!1))})});ca.displayName=la;function Xr(e){return e?"open":"closed"}var da="DialogTitleWarning",[Jf,ua]=Cu(da,{contentName:ct,titleName:Yr,docsSlug:"dialog"}),Zf=({titleId:e})=>{const t=ua(da),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
240
|
+
|
|
241
|
+
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
242
|
+
|
|
243
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Qf="DialogDescriptionWarning",em=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ua(Qf).contentName}}.`;return i.useEffect(()=>{var a;const o=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},fa=Jo,tm=Qo,ma=ta,Jr=na,Zr=ra,Qr=oa,es=ia,Mn=ca;const nm=fa,rm=ma,Gx=Mn,pa=i.forwardRef(({className:e,...t},n)=>r.jsx(Jr,{ref:n,className:U("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",e),...t}));pa.displayName=Jr.displayName;const ha=i.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(rm,{children:[r.jsx(pa,{}),r.jsxs(Zr,{ref:s,className:U("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",e),...n,children:[t,r.jsxs(Mn,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[r.jsx(St,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));ha.displayName=Zr.displayName;const xa=({className:e,...t})=>r.jsx("div",{className:U("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});xa.displayName="DialogHeader";const ga=({className:e,...t})=>r.jsx("div",{className:U("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ga.displayName="DialogFooter";const va=i.forwardRef(({className:e,...t},n)=>r.jsx(Qr,{ref:n,className:U("text-lg font-semibold leading-none tracking-tight",e),...t}));va.displayName=Qr.displayName;const sm=i.forwardRef(({className:e,...t},n)=>r.jsx(es,{ref:n,className:U("text-sm text-muted-foreground",e),...t}));sm.displayName=es.displayName;const Et=i.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:U("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",e),ref:s,...n}));Et.displayName="Input";var om=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],am=om.reduce((e,t)=>{const n=dc(`Primitive.${t}`),s=i.forwardRef((o,a)=>{const{asChild:l,...c}=o,d=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(d,{...c,ref:a})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{}),im="Label",ba=i.forwardRef((e,t)=>r.jsx(am.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));ba.displayName=im;var ya=ba;const lm=uc("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Ue=i.forwardRef(({className:e,...t},n)=>r.jsx(ya,{ref:n,className:U(lm(),e),...t}));Ue.displayName=ya.displayName;function cm({onAdded:e}){const[t,n]=i.useState(""),[s,o]=i.useState(!1),[a,l]=i.useState(null),c=i.useCallback(async d=>{if(d.preventDefault(),!!t.trim()){o(!0),l(null);try{await fc({leaderEndpoint:t.trim(),transport:"devtunnel"}),e()}catch(f){l(f instanceof Error?f.message:"Failed to join node")}finally{o(!1)}}},[t,e]);return r.jsx(ha,{className:"overflow-hidden border-border/60 bg-transparent p-0 shadow-none sm:max-w-xl",children:r.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:[r.jsx("div",{className:"border-b border-border/60 px-6 py-5",children:r.jsxs(xa,{className:"space-y-2 text-left",children:[r.jsx(va,{className:"text-2xl tracking-tight",children:"Join node"}),r.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."})]})}),r.jsxs("form",{onSubmit:c,className:"space-y-4 px-6 py-5",children:[a&&r.jsx("div",{className:"rounded-[20px] border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:a}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Ue,{htmlFor:"leader-endpoint",children:"Leader endpoint"}),r.jsx(Ce,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 text-[10px] uppercase tracking-[0.16em]",children:"DevTunnel only"})]}),r.jsx(Et,{id:"leader-endpoint",type:"url",value:t,onChange:d=>n(d.target.value),placeholder:"https://your-leader.devtunnels.ms",className:"h-11 rounded-2xl border-border/70 bg-background/70"})]}),r.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."}),r.jsx(ga,{className:"border-t border-border/60 pt-4",children:r.jsx(q,{type:"submit",disabled:!t.trim()||s,className:"rounded-2xl",children:s?"Joining...":"Join node"})})]})]})})}function wa(){const[e,t]=i.useState([]),[n,s]=i.useState(null),o=i.useRef(null),a=i.useCallback(()=>{var u;(u=o.current)==null||u.click()},[]),l=i.useCallback(async u=>{const m=Array.from(u.target.files??[]);if(m.length!==0)try{const h=await Ms(m);t(x=>[...x,...h]),s(null)}catch(h){s(h instanceof Error?h.message:"Failed to attach image")}finally{u.target.value=""}},[]),c=i.useCallback(async u=>{const m=nu(u.clipboardData);if(m.length!==0){u.preventDefault();try{const h=await Ms(m);t(x=>[...x,...h]),s(null)}catch(h){s(h instanceof Error?h.message:"Failed to attach image")}}},[]),d=i.useCallback(u=>{t(m=>m.filter((h,x)=>x!==u))},[]),f=i.useCallback(()=>{t([]),s(null)},[]);return{images:e,error:n,fileInputRef:o,pickImages:a,handleFileChange:l,handlePaste:c,removeImage:d,clearImages:f}}function dm({onSend:e,disabled:t,disabledReason:n="Chat is waiting on the agent.",placeholder:s="Send a follow-up message...",contextItems:o=[],running:a=!1,onStop:l}){const[c,d]=i.useState(""),f=i.useRef(null),{images:u,error:m,fileInputRef:h,pickImages:x,handleFileChange:g,handlePaste:p,removeImage:v,clearImages:b}=wa(),y=i.useCallback(()=>{f.current&&(f.current.style.height="auto")},[]),w=i.useCallback(()=>{const R=Do(c,u);R.length===0||t||(e(R),d(""),b(),y())},[c,u,t,e,b,y]),j=i.useCallback(R=>{R.key==="Enter"&&!R.shiftKey&&(R.preventDefault(),w())},[w]),S=i.useCallback(()=>{f.current&&(f.current.style.height="auto",f.current.style.height=`${Math.min(f.current.scrollHeight,220)}px`)},[]),C=!t&&!a&&(c.trim().length>0||u.length>0),k=a&&!!l,A=a?l?"Task is running — click to stop":"Task is running...":t?n:"Enter sends, Shift+Enter adds a line";return r.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:[o.length>0&&r.jsx("div",{className:"flex flex-wrap items-center gap-2 px-3 pb-2.5",children:o.map(R=>r.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:[r.jsx("span",{className:"shrink-0 text-[9px] font-medium uppercase tracking-[0.12em] text-muted-foreground/80",children:R.label}),r.jsx("span",{className:`truncate text-foreground/90 ${R.mono?"font-mono text-[11px]":""}`,children:R.value})]},`${R.label}:${R.value}`))}),r.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:[r.jsx("input",{ref:h,type:"file",accept:"image/*",multiple:!0,onChange:g,className:"hidden"}),u.length>0&&r.jsx("div",{className:"px-3 pt-3 sm:px-6 sm:pt-6",children:r.jsx("div",{className:"flex flex-wrap gap-3",children:u.map((R,D)=>r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:Vr(R),alt:R.filename??`attachment ${D+1}`,className:"h-24 w-24 rounded-[22px] border border-border/70 object-cover"}),r.jsx("button",{type:"button",onClick:()=>v(D),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 ${R.filename??`image ${D+1}`}`,children:r.jsx(St,{className:"h-3.5 w-3.5"})})]},`${R.filename??"image"}-${D}`))})}),r.jsxs("div",{className:"flex items-end gap-2 px-3 pt-3 pb-3 sm:px-6 sm:pt-4 sm:pb-4",children:[r.jsx("textarea",{ref:f,value:c,onChange:R=>d(R.target.value),onKeyDown:j,onPaste:p,onInput:S,placeholder:s,disabled:t,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"}),r.jsxs(q,{type:"button",variant:"ghost",onClick:x,disabled:t,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:[r.jsx(hr,{className:"h-4 w-4 sm:h-3.5 sm:w-3.5"}),r.jsx("span",{className:"hidden sm:inline",children:"Images"})]}),r.jsx("span",{title:A,children:r.jsx(q,{onClick:a?l:w,disabled:a?!k:!C,size:"icon","aria-label":a?"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:a?r.jsx(we,{className:"h-4 w-4 animate-spin"}):r.jsx(To,{className:"h-4 w-4"})})})]}),m&&r.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:m})]})]})}function zt({payload:e,disabled:t=!1,bypassEnabled:n=!1,onBypassChange:s,onSubmit:o}){const[a,l]=i.useState(()=>n?lu(e):e.questions.map(()=>[])),[c,d]=i.useState(!1),[f,u]=i.useState(!1);i.useEffect(()=>{n&&l(g=>g.map((p,v)=>{var b;return p.length>0?p:(b=e.questions[v])!=null&&b.options.length?[0]:[]}))},[n,e]);const m=cu(e,a)&&!t&&!c&&!f&&!!o,h=(g,p)=>{t||f||c||l(v=>v.map((b,y)=>{if(y!==g)return b;const w=e.questions[y];return w?w.multiSelect?b.includes(p)?b.filter(j=>j!==p):[...b,p].sort((j,S)=>j-S):[p]:b}))},x=async()=>{if(!m||!o)return;d(!0);const g=await o(du(e,a));d(!1),g&&u(!0)};return r.jsxs("div",{className:"rounded-[24px] border border-primary/20 bg-primary/5 p-4 shadow-[0_24px_80px_-60px_hsl(var(--primary)/0.9)]",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-primary/20 bg-primary/10 text-primary",children:r.jsx(qc,{className:"h-4 w-4"})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-primary/80",children:"Ask User Question"}),r.jsx("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:"Select the answer you want to send back to the agent."})]})]}),r.jsxs(q,{type:"button",variant:n?"secondary":"outline",size:"sm",onClick:()=>s==null?void 0:s(!n),className:"rounded-full",children:[r.jsx(Dd,{className:"h-4 w-4"}),n?"Bypass on":"Bypass future questions"]})]}),r.jsx("div",{className:"mt-4 space-y-4",children:e.questions.map((g,p)=>{const v=a[p]??[];return r.jsxs("div",{className:"space-y-3 rounded-[20px] border border-border/60 bg-background/75 p-4",children:[r.jsxs("div",{children:[g.header&&r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.24em] text-muted-foreground",children:g.header}),r.jsx("div",{className:"mt-1 text-sm font-medium leading-6 text-foreground",children:g.question}),r.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:g.multiSelect?"Select one or more options.":"Select one option."})]}),r.jsx("div",{className:"space-y-2",children:g.options.map((b,y)=>{const w=v.includes(y);return r.jsxs("button",{type:"button",onClick:()=>h(p,y),disabled:t||c||f,"aria-pressed":w,className:U("flex w-full items-start gap-3 rounded-[18px] border px-4 py-3 text-left transition-colors",w?"border-primary/50 bg-primary/10 text-foreground":"border-border/60 bg-background/80 text-foreground hover:border-primary/30 hover:bg-primary/5"),children:[r.jsx("span",{className:U("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border",w?"border-primary bg-primary text-primary-foreground":"border-border/70 bg-background text-transparent"),children:r.jsx(He,{className:"h-3.5 w-3.5"})}),r.jsxs("span",{className:"min-w-0",children:[r.jsx("span",{className:"block text-sm font-medium leading-5",children:b.label}),b.description&&r.jsx("span",{className:"mt-1 block text-xs leading-5 text-muted-foreground",children:b.description})]})]},`${b.label}-${y}`)})})]},`${g.header??"question"}-${p}`)})}),r.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3",children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:n?"Bypass is enabled. New question cards will default to the first option.":"Enable bypass if you want future question cards to preselect the first option."}),r.jsx(q,{type:"button",onClick:()=>void x(),disabled:!m,className:"rounded-full px-5",children:f?"Sent":c?"Sending...":e.questions.length>1?"Send answers":"Send answer"})]})]})}function um({payload:e,disabled:t=!1,onSubmit:n}){const[s,o]=i.useState(null),[a,l]=i.useState(!1),c=!t&&!a&&!!n,d=async f=>{if(!c||!n)return;o(f);const u=await n(hu(e,f));o(null),u&&l(!0)};return r.jsxs("div",{className:"rounded-[24px] border border-amber-500/25 bg-amber-500/5 p-4 shadow-[0_24px_80px_-60px_rgba(245,158,11,0.8)]",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full border border-amber-500/25 bg-amber-500/10 text-amber-600 dark:text-amber-400",children:r.jsx(_d,{className:"h-4 w-4"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.22em] text-amber-700/80 dark:text-amber-300/80",children:"Permission Request"}),r.jsx("div",{className:"mt-1 space-y-3",children:e.requests.map((f,u)=>r.jsxs("div",{className:"rounded-[18px] border border-border/60 bg-background/75 px-4 py-3",children:[r.jsx("div",{className:"text-sm font-medium leading-6 text-foreground",children:f.summary}),(f.toolName||f.target)&&r.jsxs("div",{className:"mt-2 flex flex-wrap gap-2 text-[11px] uppercase tracking-[0.18em] text-muted-foreground",children:[r.jsx("span",{children:f.toolName}),f.target&&r.jsx("span",{className:"font-mono normal-case tracking-normal",children:f.target})]})]},`${f.toolUseId??f.toolName}-${u}`))})]})]}),r.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-end gap-2",children:[r.jsxs(q,{type:"button",variant:"outline",onClick:()=>void d("deny"),disabled:!c||s!==null,className:"rounded-full",children:[r.jsx(St,{className:"h-4 w-4"}),a?"Sent":s==="deny"?"Sending...":"Deny"]}),r.jsxs(q,{type:"button",onClick:()=>void d("approve"),disabled:!c||s!==null,className:"rounded-full",children:[r.jsx(He,{className:"h-4 w-4"}),a?"Sent":s==="approve"?"Sending...":"Approve"]})]})]})}function Ys({event:e,questionBypassEnabled:t=!1,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o=!1}){const a=e.type,l=Wr(e),c=Rn(e);if(l)return r.jsx(Bt,{children:r.jsx(um,{payload:l,onSubmit:s,disabled:o})});if(c)return r.jsx(Bt,{children:r.jsx(zt,{payload:c,bypassEnabled:t,onBypassChange:n,onSubmit:s,disabled:o})});if(a==="user"){const d=fm(e),f=d.filter(m=>m.type==="tool_result");if(f.length>0&&d.every(m=>m.type==="tool_result"))return r.jsx(Bt,{children:f.map((m,h)=>r.jsx(ja,{block:m,questionBypassEnabled:t,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o},h))});const u=qt(e);return u?r.jsx(xm,{content:u}):null}return a==="assistant"?r.jsx(gm,{event:e,questionBypassEnabled:t,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o}):null}function fm(e){const t=e.message,n=t==null?void 0:t.content;if(Array.isArray(n))return n.filter(o=>typeof o=="object"&&o!==null);const s=e.content;return Array.isArray(s)?s.filter(o=>typeof o=="object"&&o!==null):[]}function ar(e){var n;const t=e.replace(/\r\n/g,`
|
|
244
|
+
`).split(`
|
|
245
|
+
`);for(;t.length>0&&((n=t[0])==null?void 0:n.trim())==="";)t.shift();return t.join(`
|
|
246
|
+
`)}function Na({text:e,className:t=""}){const[n,s]=i.useState(!1);if(!e)return null;const o=async a=>{a.stopPropagation();try{await navigator.clipboard.writeText(e),s(!0),setTimeout(()=>s(!1),1500)}catch{}};return r.jsx("button",{type:"button",onClick:o,"aria-label":n?"Copied":"Copy message",className:`flex h-6 w-6 items-center justify-center rounded-full border border-border/60 bg-background/80 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 ${t}`,children:n?r.jsx(He,{className:"h-3 w-3 text-emerald-500"}):r.jsx(Tn,{className:"h-3 w-3"})})}async function mm(e){let n=await(await fetch(e)).blob();n.type!=="image/png"&&(n=await pm(n)),await navigator.clipboard.write([new ClipboardItem({[n.type]:n})])}async function pm(e){const t=await createImageBitmap(e),n=document.createElement("canvas");n.width=t.width,n.height=t.height;const s=n.getContext("2d");if(!s)throw new Error("canvas 2d context unavailable");return s.drawImage(t,0,0),await new Promise((o,a)=>{n.toBlob(l=>l?o(l):a(new Error("toBlob failed")),"image/png")})}function hm({dataUrl:e,className:t=""}){const[n,s]=i.useState(!1),o=async a=>{a.stopPropagation();try{await mm(e),s(!0),setTimeout(()=>s(!1),1500)}catch(l){console.error("copy image failed",l)}};return r.jsx("button",{type:"button",onClick:o,"aria-label":n?"Copied":"Copy image",className:`flex h-6 w-6 items-center justify-center rounded-full border border-border/60 bg-background/80 text-muted-foreground opacity-0 shadow-sm backdrop-blur transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100 ${t}`,children:n?r.jsx(He,{className:"h-3 w-3 text-emerald-500"}):r.jsx(Tn,{className:"h-3 w-3"})})}function xm({content:e}){const t=tu(e),n=e.filter(s=>s.type==="image");return r.jsx("div",{className:"animate-message-rise flex justify-end",children:r.jsxs("div",{className:"group relative flex max-w-[88%] items-start gap-3",children:[r.jsx(Na,{text:t,className:"absolute -left-8 top-2"}),r.jsxs("div",{className:"space-y-1 rounded-[26px] rounded-tr-md border border-primary/25 bg-primary px-4 py-3 text-[13px] leading-5 text-primary-foreground shadow-[0_20px_70px_-42px_hsl(var(--primary)/0.95)]",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.28em] text-primary-foreground/75",children:"You"}),t&&r.jsx("div",{className:"whitespace-pre-wrap",children:t}),n.length>0&&r.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:n.map((s,o)=>{const a=Vr(s);return r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:a,alt:s.filename??`attachment ${o+1}`,className:"max-h-72 w-full rounded-2xl border border-primary-foreground/15 object-cover"}),r.jsx(hm,{dataUrl:a,className:"absolute right-2 top-2"})]},`${s.filename??"image"}-${o}`)})})]}),r.jsx("div",{className:"mt-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-primary/20 bg-primary/10 text-primary",children:r.jsx(Fd,{className:"h-4 w-4"})})]})})}function Bt({children:e}){return r.jsx("div",{className:"animate-message-rise flex justify-start",children:r.jsxs("div",{className:"flex max-w-[92%] items-start gap-3",children:[r.jsx("div",{className:"mt-1 flex h-9 w-9 shrink-0 items-center justify-center rounded-full border border-border/70 bg-muted/70 text-muted-foreground",children:r.jsx(Lr,{className:"h-4 w-4"})}),r.jsxs("div",{className:"min-w-0 space-y-3",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.28em] text-muted-foreground",children:"Agent"}),e]})]})})}function gm({event:e,questionBypassEnabled:t,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o}){const a=e.message;if(!a)return null;const l=Rn(a);if(l)return r.jsx(Bt,{children:r.jsx(zt,{payload:l,bypassEnabled:t,onBypassChange:n,onSubmit:s,disabled:o})});const c=a.content;if(!c||!Array.isArray(c))return null;const d=new Set,f=c.filter(g=>g.type==="text").map(g=>({...g,text:ar(String(g.text??"")),questionPayload:_n(ar(String(g.text??"")))})).filter(g=>g.text.length>0||g.questionPayload),u=c.filter(g=>g.type==="thinking").map(g=>ar(String(g.thinking??""))).filter(Boolean).join(`
|
|
247
|
+
|
|
248
|
+
`),m=c.filter(g=>g.type==="tool_use"),h=c.filter(g=>g.type==="tool_result");return f.length>0||u.length>0||m.length>0||h.length>0?r.jsxs(Bt,{children:[u.length>0&&r.jsx(wm,{text:u}),f.map((g,p)=>{if(g.questionPayload){const v=Pt(g.questionPayload);return d.has(v)?null:(d.add(v),r.jsx(zt,{payload:g.questionPayload,bypassEnabled:t,onBypassChange:n,onSubmit:s,disabled:o},p))}return r.jsxs("div",{className:"group relative rounded-[26px] rounded-tl-md border border-border/70 bg-card/80 px-4 py-3 text-[13px] leading-5 text-foreground shadow-[0_20px_70px_-58px_rgba(0,0,0,0.9)] backdrop-blur-sm",children:[r.jsx(Na,{text:g.text,className:"absolute right-2 top-2"}),r.jsx("div",{className:"whitespace-pre-wrap",children:g.text})]},p)}),m.map((g,p)=>r.jsx(Nm,{block:g,renderedQuestionSignatures:d,questionBypassEnabled:t,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o},p)),h.map((g,p)=>r.jsx(ja,{block:g,renderedQuestionSignatures:d,questionBypassEnabled:t,onQuestionBypassChange:n,onSubmitQuestionResponse:s,questionResponseDisabled:o},p))]}):null}function vm(e){return e.replace(/\s+/g," ").trim()}function Nt(e,t=132){const n=vm(e);return n?n.length>t?`${n.slice(0,t-3)}...`:n:""}function wr(e,t=84){if(typeof e=="string")return Nt(e,t);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e)){const n=e.slice(0,3).map(s=>wr(s,28)).filter(Boolean).join(", ");return Nt(n||JSON.stringify(e),t)}if(typeof e=="object"&&e!==null){const n=Object.entries(e).slice(0,3).map(([s,o])=>`${s}: ${wr(o,32)}`).join(" · ");return Nt(n||JSON.stringify(e),t)}return""}function bm(e){if(!e)return"No input";const t=Object.entries(e).slice(0,4).map(([n,s])=>`${n}: ${wr(s,40)}`).filter(n=>n.trim().length>0).join(" · ");return Nt(t||JSON.stringify(e),156)||"No input"}function ym({expanded:e}){return r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-border/60 bg-background/70 px-2 py-1 text-[10px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[e?"Less":"More",e?r.jsx(Fr,{className:"h-3 w-3"}):r.jsx(Rt,{className:"h-3 w-3"})]})}function ts({title:e,preview:t,icon:n,children:s,accentClassName:o,previewClassName:a="font-mono text-[11px] text-muted-foreground/90"}){const[l,c]=i.useState(!1);return r.jsxs("div",{className:`overflow-hidden rounded-[22px] border border-border/60 ${o}`,children:[r.jsxs("button",{type:"button",onClick:()=>c(d=>!d),className:"flex w-full items-start gap-3 px-4 py-3 text-left transition-colors hover:bg-background/30",children:[r.jsx("div",{className:"mt-0.5 flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border/60 bg-background/70 text-muted-foreground",children:n}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"flex flex-wrap items-center gap-2",children:r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-muted-foreground",children:e})}),r.jsx("div",{className:`mt-1 whitespace-pre-wrap break-words text-[12px] leading-5 ${a}`,children:t})]}),r.jsx(ym,{expanded:l})]}),l&&r.jsx("div",{className:"border-t border-border/60 px-4 py-3",children:s})]})}function wm({text:e}){const t=Nt(e,156);return r.jsx(ts,{title:"Thinking",preview:t,icon:r.jsx(Uc,{className:"h-3.5 w-3.5"}),accentClassName:"bg-muted/35",previewClassName:"text-[12px] leading-5 text-muted-foreground/90",children:r.jsx("div",{className:"whitespace-pre-wrap text-[13px] leading-5 text-muted-foreground/90",children:e})})}function Nm({block:e,renderedQuestionSignatures:t,questionBypassEnabled:n,onQuestionBypassChange:s,onSubmitQuestionResponse:o,questionResponseDisabled:a}){const l=String(e.name??"tool"),c=e.input,d=Rn(e);if(d){const u=Pt(d);return t!=null&&t.has(u)?null:(t==null||t.add(u),r.jsx(zt,{payload:d,bypassEnabled:n,onBypassChange:s,onSubmit:o,disabled:a}))}const f=bm(c);if(l==="TodoWrite"){const u=jm(c==null?void 0:c.todos);if(u.length>0)return r.jsx(km,{todos:u})}return r.jsx(ts,{title:`Tool: ${l}`,preview:f,icon:r.jsx(Ro,{className:"h-3.5 w-3.5"}),accentClassName:"bg-muted/25",children:r.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:JSON.stringify(c??{},null,2)})})}function ja({block:e,renderedQuestionSignatures:t,questionBypassEnabled:n,onQuestionBypassChange:s,onSubmitQuestionResponse:o,questionResponseDisabled:a}){const l=e.content,c=typeof l=="string"?l:Array.isArray(l)?l.map(u=>String(u.text??"")).join(`
|
|
249
|
+
`):"";if(!c)return null;const d=_n(c);if(d){const u=Pt(d);return t!=null&&t.has(u)?null:(t==null||t.add(u),r.jsx(zt,{payload:d,bypassEnabled:n,onBypassChange:s,onSubmit:o,disabled:a}))}const f=Nt(c,156);return r.jsx(ts,{title:"Result",preview:f,icon:r.jsx(Ro,{className:"h-3.5 w-3.5"}),accentClassName:"bg-background/65",children:r.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:c})})}function jm(e){return Array.isArray(e)?e.map(t=>{if(typeof t!="object"||t===null)return null;const n=t,s=typeof n.content=="string"?n.content:"";if(!s)return null;const o=typeof n.activeForm=="string"?n.activeForm:s,a=typeof n.status=="string"?n.status:"pending";return{content:s,activeForm:o,status:a==="completed"||a==="in_progress"?a:"pending"}}).filter(t=>t!==null):[]}function km({todos:e}){const t=e.filter(o=>o.status==="completed").length,n=e.length,s=e.find(o=>o.status==="in_progress");return r.jsxs("div",{className:"overflow-hidden rounded-[22px] border border-border/60 bg-muted/20",children:[r.jsxs("div",{className:"flex items-center gap-3 border-b border-border/50 px-4 py-3",children:[r.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border/60 bg-background/70 text-muted-foreground",children:r.jsx(xd,{className:"h-3.5 w-3.5"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-[0.22em] text-muted-foreground",children:"Todos"}),r.jsx("div",{className:"mt-0.5 truncate text-[12px] leading-5 text-muted-foreground/90",children:s?s.activeForm:n===0?"No items":t===n?"All complete":"Up next"})]}),r.jsxs("div",{className:"shrink-0 rounded-full border border-border/60 bg-background/70 px-2 py-0.5 font-mono text-[10px] tracking-wide text-muted-foreground",children:[t,"/",n]})]}),r.jsx("ul",{className:"divide-y divide-border/40",children:e.map((o,a)=>r.jsxs("li",{className:"flex items-start gap-3 px-4 py-2.5",children:[r.jsx(Sm,{status:o.status}),r.jsx("span",{className:o.status==="completed"?"text-[13px] leading-5 text-muted-foreground line-through decoration-muted-foreground/60":o.status==="in_progress"?"text-[13px] font-medium leading-5 text-foreground":"text-[13px] leading-5 text-foreground/85",children:o.status==="in_progress"?o.activeForm:o.content})]},`${a}-${o.content}`))})]})}function Sm({status:e}){return e==="completed"?r.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-emerald-500/15 text-emerald-500 dark:text-emerald-400",children:r.jsx(He,{className:"h-3 w-3"})}):e==="in_progress"?r.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center text-primary",children:r.jsx(we,{className:"h-3.5 w-3.5 animate-spin"})}):r.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground/60",children:r.jsx(Jc,{className:"h-3 w-3"})})}function ka(e){const t=e+"CollectionProvider",[n,s]=rt(t),[o,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=p=>{const{scope:v,children:b}=p,y=it.useRef(null),w=it.useRef(new Map).current;return r.jsx(o,{scope:v,itemMap:w,collectionRef:y,children:b})};l.displayName=t;const c=e+"CollectionSlot",d=Wt(c),f=it.forwardRef((p,v)=>{const{scope:b,children:y}=p,w=a(c,b),j=ie(v,w.collectionRef);return r.jsx(d,{ref:j,children:y})});f.displayName=c;const u=e+"CollectionItemSlot",m="data-radix-collection-item",h=Wt(u),x=it.forwardRef((p,v)=>{const{scope:b,children:y,...w}=p,j=it.useRef(null),S=ie(v,j),C=a(u,b);return it.useEffect(()=>(C.itemMap.set(j,{ref:j,...w}),()=>void C.itemMap.delete(j))),r.jsx(h,{[m]:"",ref:S,children:y})});x.displayName=u;function g(p){const v=a(e+"CollectionConsumer",p);return it.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${m}]`));return Array.from(v.itemMap.values()).sort((C,k)=>w.indexOf(C.ref.current)-w.indexOf(k.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:l,Slot:f,ItemSlot:x},g,s]}var Cm=i.createContext(void 0);function ns(e){const t=i.useContext(Cm);return e||t||"ltr"}var ir="rovingFocusGroup.onEntryFocus",Em={bubbles:!1,cancelable:!0},Yt="RovingFocusGroup",[Nr,Sa,Am]=ka(Yt),[Tm,Ca]=rt(Yt,[Am]),[Rm,_m]=Tm(Yt),Ea=i.forwardRef((e,t)=>r.jsx(Nr.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Nr.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(Pm,{...e,ref:t})})}));Ea.displayName=Yt;var Pm=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:o=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:u=!1,...m}=e,h=i.useRef(null),x=ie(t,h),g=ns(a),[p,v]=Ct({prop:l,defaultProp:c??null,onChange:d,caller:Yt}),[b,y]=i.useState(!1),w=et(f),j=Sa(n),S=i.useRef(!1),[C,k]=i.useState(0);return i.useEffect(()=>{const A=h.current;if(A)return A.addEventListener(ir,w),()=>A.removeEventListener(ir,w)},[w]),r.jsx(Rm,{scope:n,orientation:s,dir:g,loop:o,currentTabStopId:p,onItemFocus:i.useCallback(A=>v(A),[v]),onItemShiftTab:i.useCallback(()=>y(!0),[]),onFocusableItemAdd:i.useCallback(()=>k(A=>A+1),[]),onFocusableItemRemove:i.useCallback(()=>k(A=>A-1),[]),children:r.jsx(Z.div,{tabIndex:b||C===0?-1:0,"data-orientation":s,...m,ref:x,style:{outline:"none",...e.style},onMouseDown:J(e.onMouseDown,()=>{S.current=!0}),onFocus:J(e.onFocus,A=>{const R=!S.current;if(A.target===A.currentTarget&&R&&!b){const D=new CustomEvent(ir,Em);if(A.currentTarget.dispatchEvent(D),!D.defaultPrevented){const $=j().filter(O=>O.focusable),_=$.find(O=>O.active),F=$.find(O=>O.id===p),z=[_,F,...$].filter(Boolean).map(O=>O.ref.current);Ra(z,u)}}S.current=!1}),onBlur:J(e.onBlur,()=>y(!1))})})}),Aa="RovingFocusGroupItem",Ta=i.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:o=!1,tabStopId:a,children:l,...c}=e,d=Ze(),f=a||d,u=_m(Aa,n),m=u.currentTabStopId===f,h=Sa(n),{onFocusableItemAdd:x,onFocusableItemRemove:g,currentTabStopId:p}=u;return i.useEffect(()=>{if(s)return x(),()=>g()},[s,x,g]),r.jsx(Nr.ItemSlot,{scope:n,id:f,focusable:s,active:o,children:r.jsx(Z.span,{tabIndex:m?0:-1,"data-orientation":u.orientation,...c,ref:t,onMouseDown:J(e.onMouseDown,v=>{s?u.onItemFocus(f):v.preventDefault()}),onFocus:J(e.onFocus,()=>u.onItemFocus(f)),onKeyDown:J(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=Om(v,u.orientation,u.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=h().filter(j=>j.focusable).map(j=>j.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const j=w.indexOf(v.currentTarget);w=u.loop?Im(w,j+1):w.slice(j+1)}setTimeout(()=>Ra(w))}}),children:typeof l=="function"?l({isCurrentTabStop:m,hasTabStop:p!=null}):l})})});Ta.displayName=Aa;var Dm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Mm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Om(e,t,n){const s=Mm(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return Dm[s]}function Ra(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function Im(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Lm=Ea,$m=Ta,On="Tabs",[Fm]=rt(On,[Ca]),_a=Ca(),[Bm,rs]=Fm(On),Pa=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:o,defaultValue:a,orientation:l="horizontal",dir:c,activationMode:d="automatic",...f}=e,u=ns(c),[m,h]=Ct({prop:s,onChange:o,defaultProp:a??"",caller:On});return r.jsx(Bm,{scope:n,baseId:Ze(),value:m,onValueChange:h,orientation:l,dir:u,activationMode:d,children:r.jsx(Z.div,{dir:u,"data-orientation":l,...f,ref:t})})});Pa.displayName=On;var Da="TabsList",Ma=i.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...o}=e,a=rs(Da,n),l=_a(n);return r.jsx(Lm,{asChild:!0,...l,orientation:a.orientation,dir:a.dir,loop:s,children:r.jsx(Z.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:t})})});Ma.displayName=Da;var Oa="TabsTrigger",Ia=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:o=!1,...a}=e,l=rs(Oa,n),c=_a(n),d=Fa(l.baseId,s),f=Ba(l.baseId,s),u=s===l.value;return r.jsx($m,{asChild:!0,...c,focusable:!o,active:u,children:r.jsx(Z.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":f,"data-state":u?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:d,...a,ref:t,onMouseDown:J(e.onMouseDown,m=>{!o&&m.button===0&&m.ctrlKey===!1?l.onValueChange(s):m.preventDefault()}),onKeyDown:J(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&l.onValueChange(s)}),onFocus:J(e.onFocus,()=>{const m=l.activationMode!=="manual";!u&&!o&&m&&l.onValueChange(s)})})})});Ia.displayName=Oa;var La="TabsContent",$a=i.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:o,children:a,...l}=e,c=rs(La,n),d=Fa(c.baseId,s),f=Ba(c.baseId,s),u=s===c.value,m=i.useRef(u);return i.useEffect(()=>{const h=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(h)},[]),r.jsx(Dt,{present:o||u,children:({present:h})=>r.jsx(Z.div,{"data-state":u?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!h,id:f,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:h&&a})})});$a.displayName=La;function Fa(e,t){return`${e}-trigger-${t}`}function Ba(e,t){return`${e}-content-${t}`}var Um=Pa,Ua=Ma,Va=Ia,Wa=$a;const za=Um,ss=i.forwardRef(({className:e,...t},n)=>r.jsx(Ua,{ref:n,className:U("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));ss.displayName=Ua.displayName;const Xe=i.forwardRef(({className:e,...t},n)=>r.jsx(Va,{ref:n,className:U("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));Xe.displayName=Va.displayName;const Je=i.forwardRef(({className:e,...t},n)=>r.jsx(Wa,{ref:n,className:U("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Je.displayName=Wa.displayName;var Ha="AlertDialog",[Vm]=rt(Ha,[Xo]),Ke=Xo(),Ka=e=>{const{__scopeAlertDialog:t,...n}=e,s=Ke(t);return r.jsx(fa,{...s,...n,modal:!0})};Ka.displayName=Ha;var Wm="AlertDialogTrigger",qa=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ke(n);return r.jsx(tm,{...o,...s,ref:t})});qa.displayName=Wm;var zm="AlertDialogPortal",Ga=e=>{const{__scopeAlertDialog:t,...n}=e,s=Ke(t);return r.jsx(ma,{...s,...n})};Ga.displayName=zm;var Hm="AlertDialogOverlay",Ya=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ke(n);return r.jsx(Jr,{...o,...s,ref:t})});Ya.displayName=Hm;var jt="AlertDialogContent",[Km,qm]=Vm(jt),Gm=Mu("AlertDialogContent"),Xa=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...o}=e,a=Ke(n),l=i.useRef(null),c=ie(t,l),d=i.useRef(null);return r.jsx(Jf,{contentName:jt,titleName:Ja,docsSlug:"alert-dialog",children:r.jsx(Km,{scope:n,cancelRef:d,children:r.jsxs(Zr,{role:"alertdialog",...a,...o,ref:c,onOpenAutoFocus:J(o.onOpenAutoFocus,f=>{var u;f.preventDefault(),(u=d.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:f=>f.preventDefault(),onInteractOutside:f=>f.preventDefault(),children:[r.jsx(Gm,{children:s}),r.jsx(Xm,{contentRef:l})]})})})});Xa.displayName=jt;var Ja="AlertDialogTitle",Za=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ke(n);return r.jsx(Qr,{...o,...s,ref:t})});Za.displayName=Ja;var Qa="AlertDialogDescription",ei=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ke(n);return r.jsx(es,{...o,...s,ref:t})});ei.displayName=Qa;var Ym="AlertDialogAction",ti=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,o=Ke(n);return r.jsx(Mn,{...o,...s,ref:t})});ti.displayName=Ym;var ni="AlertDialogCancel",ri=i.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:o}=qm(ni,n),a=Ke(n),l=ie(t,o);return r.jsx(Mn,{...a,...s,ref:l})});ri.displayName=ni;var Xm=({contentRef:e})=>{const t=`\`${jt}\` requires a description for the component to be accessible for screen reader users.
|
|
250
|
+
|
|
251
|
+
You can add a description to the \`${jt}\` by passing a \`${Qa}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
252
|
+
|
|
253
|
+
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 \`${jt}\`. 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.
|
|
254
|
+
|
|
255
|
+
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return i.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Jm=Ka,Zm=qa,Qm=Ga,si=Ya,oi=Xa,ai=ti,ii=ri,li=Za,ci=ei;const jr=Jm,Xs=Zm,ep=Qm,di=i.forwardRef(({className:e,...t},n)=>r.jsx(si,{className:U("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",e),...t,ref:n}));di.displayName=si.displayName;const hn=i.forwardRef(({className:e,...t},n)=>r.jsxs(ep,{children:[r.jsx(di,{}),r.jsx(oi,{ref:n,className:U("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",e),...t})]}));hn.displayName=oi.displayName;const xn=({className:e,...t})=>r.jsx("div",{className:U("flex flex-col space-y-2 text-center sm:text-left",e),...t});xn.displayName="AlertDialogHeader";const gn=({className:e,...t})=>r.jsx("div",{className:U("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});gn.displayName="AlertDialogFooter";const vn=i.forwardRef(({className:e,...t},n)=>r.jsx(li,{ref:n,className:U("text-lg font-semibold",e),...t}));vn.displayName=li.displayName;const bn=i.forwardRef(({className:e,...t},n)=>r.jsx(ci,{ref:n,className:U("text-sm text-muted-foreground",e),...t}));bn.displayName=ci.displayName;const yn=i.forwardRef(({className:e,...t},n)=>r.jsx(ai,{ref:n,className:U(wo(),e),...t}));yn.displayName=ai.displayName;const wn=i.forwardRef(({className:e,...t},n)=>r.jsx(ii,{ref:n,className:U(wo({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));wn.displayName=ii.displayName;function Js(e,[t,n]){return Math.min(n,Math.max(t,e))}const tp=["top","right","bottom","left"],tt=Math.min,Se=Math.max,Nn=Math.round,an=Math.floor,Fe=e=>({x:e,y:e}),np={left:"right",right:"left",bottom:"top",top:"bottom"};function kr(e,t,n){return Se(e,tt(t,n))}function We(e,t){return typeof e=="function"?e(t):e}function ze(e){return e.split("-")[0]}function Mt(e){return e.split("-")[1]}function os(e){return e==="x"?"y":"x"}function as(e){return e==="y"?"height":"width"}function $e(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function is(e){return os($e(e))}function rp(e,t,n){n===void 0&&(n=!1);const s=Mt(e),o=is(e),a=as(o);let l=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=jn(l)),[l,jn(l)]}function sp(e){const t=jn(e);return[Sr(e),t,Sr(t)]}function Sr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Zs=["left","right"],Qs=["right","left"],op=["top","bottom"],ap=["bottom","top"];function ip(e,t,n){switch(e){case"top":case"bottom":return n?t?Qs:Zs:t?Zs:Qs;case"left":case"right":return t?op:ap;default:return[]}}function lp(e,t,n,s){const o=Mt(e);let a=ip(ze(e),n==="start",s);return o&&(a=a.map(l=>l+"-"+o),t&&(a=a.concat(a.map(Sr)))),a}function jn(e){const t=ze(e);return np[t]+e.slice(t.length)}function cp(e){return{top:0,right:0,bottom:0,left:0,...e}}function ui(e){return typeof e!="number"?cp(e):{top:e,right:e,bottom:e,left:e}}function kn(e){const{x:t,y:n,width:s,height:o}=e;return{width:s,height:o,top:n,left:t,right:t+s,bottom:n+o,x:t,y:n}}function eo(e,t,n){let{reference:s,floating:o}=e;const a=$e(t),l=is(t),c=as(l),d=ze(t),f=a==="y",u=s.x+s.width/2-o.width/2,m=s.y+s.height/2-o.height/2,h=s[c]/2-o[c]/2;let x;switch(d){case"top":x={x:u,y:s.y-o.height};break;case"bottom":x={x:u,y:s.y+s.height};break;case"right":x={x:s.x+s.width,y:m};break;case"left":x={x:s.x-o.width,y:m};break;default:x={x:s.x,y:s.y}}switch(Mt(t)){case"start":x[l]-=h*(n&&f?-1:1);break;case"end":x[l]+=h*(n&&f?-1:1);break}return x}async function dp(e,t){var n;t===void 0&&(t={});const{x:s,y:o,platform:a,rects:l,elements:c,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:u="viewport",elementContext:m="floating",altBoundary:h=!1,padding:x=0}=We(t,e),g=ui(x),v=c[h?m==="floating"?"reference":"floating":m],b=kn(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(v)))==null||n?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(c.floating)),boundary:f,rootBoundary:u,strategy:d})),y=m==="floating"?{x:s,y:o,width:l.floating.width,height:l.floating.height}:l.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c.floating)),j=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},S=kn(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:y,offsetParent:w,strategy:d}):y);return{top:(b.top-S.top+g.top)/j.y,bottom:(S.bottom-b.bottom+g.bottom)/j.y,left:(b.left-S.left+g.left)/j.x,right:(S.right-b.right+g.right)/j.x}}const up=50,fp=async(e,t,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:a=[],platform:l}=n,c=l.detectOverflow?l:{...l,detectOverflow:dp},d=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:m}=eo(f,s,d),h=s,x=0;const g={};for(let p=0;p<a.length;p++){const v=a[p];if(!v)continue;const{name:b,fn:y}=v,{x:w,y:j,data:S,reset:C}=await y({x:u,y:m,initialPlacement:s,placement:h,strategy:o,middlewareData:g,rects:f,platform:c,elements:{reference:e,floating:t}});u=w??u,m=j??m,g[b]={...g[b],...S},C&&x<up&&(x++,typeof C=="object"&&(C.placement&&(h=C.placement),C.rects&&(f=C.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:u,y:m}=eo(f,h,d)),p=-1)}return{x:u,y:m,placement:h,strategy:o,middlewareData:g}},mp=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:o,rects:a,platform:l,elements:c,middlewareData:d}=t,{element:f,padding:u=0}=We(e,t)||{};if(f==null)return{};const m=ui(u),h={x:n,y:s},x=is(o),g=as(x),p=await l.getDimensions(f),v=x==="y",b=v?"top":"left",y=v?"bottom":"right",w=v?"clientHeight":"clientWidth",j=a.reference[g]+a.reference[x]-h[x]-a.floating[g],S=h[x]-a.reference[x],C=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let k=C?C[w]:0;(!k||!await(l.isElement==null?void 0:l.isElement(C)))&&(k=c.floating[w]||a.floating[g]);const A=j/2-S/2,R=k/2-p[g]/2-1,D=tt(m[b],R),$=tt(m[y],R),_=D,F=k-p[g]-$,W=k/2-p[g]/2+A,z=kr(_,W,F),O=!d.arrow&&Mt(o)!=null&&W!==z&&a.reference[g]/2-(W<_?D:$)-p[g]/2<0,T=O?W<_?W-_:W-F:0;return{[x]:h[x]+T,data:{[x]:z,centerOffset:W-z-T,...O&&{alignmentOffset:T}},reset:O}}}),pp=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:o,middlewareData:a,rects:l,initialPlacement:c,platform:d,elements:f}=t,{mainAxis:u=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...v}=We(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const b=ze(o),y=$e(c),w=ze(c)===c,j=await(d.isRTL==null?void 0:d.isRTL(f.floating)),S=h||(w||!p?[jn(c)]:sp(c)),C=g!=="none";!h&&C&&S.push(...lp(c,p,g,j));const k=[c,...S],A=await d.detectOverflow(t,v),R=[];let D=((s=a.flip)==null?void 0:s.overflows)||[];if(u&&R.push(A[b]),m){const W=rp(o,l,j);R.push(A[W[0]],A[W[1]])}if(D=[...D,{placement:o,overflows:R}],!R.every(W=>W<=0)){var $,_;const W=((($=a.flip)==null?void 0:$.index)||0)+1,z=k[W];if(z&&(!(m==="alignment"?y!==$e(z):!1)||D.every(I=>$e(I.placement)===y?I.overflows[0]>0:!0)))return{data:{index:W,overflows:D},reset:{placement:z}};let O=(_=D.filter(T=>T.overflows[0]<=0).sort((T,I)=>T.overflows[1]-I.overflows[1])[0])==null?void 0:_.placement;if(!O)switch(x){case"bestFit":{var F;const T=(F=D.filter(I=>{if(C){const E=$e(I.placement);return E===y||E==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(E=>E>0).reduce((E,ee)=>E+ee,0)]).sort((I,E)=>I[1]-E[1])[0])==null?void 0:F[0];T&&(O=T);break}case"initialPlacement":O=c;break}if(o!==O)return{reset:{placement:O}}}return{}}}};function to(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function no(e){return tp.some(t=>e[t]>=0)}const hp=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:s}=t,{strategy:o="referenceHidden",...a}=We(e,t);switch(o){case"referenceHidden":{const l=await s.detectOverflow(t,{...a,elementContext:"reference"}),c=to(l,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:no(c)}}}case"escaped":{const l=await s.detectOverflow(t,{...a,altBoundary:!0}),c=to(l,n.floating);return{data:{escapedOffsets:c,escaped:no(c)}}}default:return{}}}}},fi=new Set(["left","top"]);async function xp(e,t){const{placement:n,platform:s,elements:o}=e,a=await(s.isRTL==null?void 0:s.isRTL(o.floating)),l=ze(n),c=Mt(n),d=$e(n)==="y",f=fi.has(l)?-1:1,u=a&&d?-1:1,m=We(t,e);let{mainAxis:h,crossAxis:x,alignmentAxis:g}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return c&&typeof g=="number"&&(x=c==="end"?g*-1:g),d?{x:x*u,y:h*f}:{x:h*f,y:x*u}}const gp=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:o,y:a,placement:l,middlewareData:c}=t,d=await xp(t,e);return l===((n=c.offset)==null?void 0:n.placement)&&(s=c.arrow)!=null&&s.alignmentOffset?{}:{x:o+d.x,y:a+d.y,data:{...d,placement:l}}}}},vp=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:o,platform:a}=t,{mainAxis:l=!0,crossAxis:c=!1,limiter:d={fn:b=>{let{x:y,y:w}=b;return{x:y,y:w}}},...f}=We(e,t),u={x:n,y:s},m=await a.detectOverflow(t,f),h=$e(ze(o)),x=os(h);let g=u[x],p=u[h];if(l){const b=x==="y"?"top":"left",y=x==="y"?"bottom":"right",w=g+m[b],j=g-m[y];g=kr(w,g,j)}if(c){const b=h==="y"?"top":"left",y=h==="y"?"bottom":"right",w=p+m[b],j=p-m[y];p=kr(w,p,j)}const v=d.fn({...t,[x]:g,[h]:p});return{...v,data:{x:v.x-n,y:v.y-s,enabled:{[x]:l,[h]:c}}}}}},bp=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:o,rects:a,middlewareData:l}=t,{offset:c=0,mainAxis:d=!0,crossAxis:f=!0}=We(e,t),u={x:n,y:s},m=$e(o),h=os(m);let x=u[h],g=u[m];const p=We(c,t),v=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(d){const w=h==="y"?"height":"width",j=a.reference[h]-a.floating[w]+v.mainAxis,S=a.reference[h]+a.reference[w]-v.mainAxis;x<j?x=j:x>S&&(x=S)}if(f){var b,y;const w=h==="y"?"width":"height",j=fi.has(ze(o)),S=a.reference[m]-a.floating[w]+(j&&((b=l.offset)==null?void 0:b[m])||0)+(j?0:v.crossAxis),C=a.reference[m]+a.reference[w]+(j?0:((y=l.offset)==null?void 0:y[m])||0)-(j?v.crossAxis:0);g<S?g=S:g>C&&(g=C)}return{[h]:x,[m]:g}}}},yp=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:o,rects:a,platform:l,elements:c}=t,{apply:d=()=>{},...f}=We(e,t),u=await l.detectOverflow(t,f),m=ze(o),h=Mt(o),x=$e(o)==="y",{width:g,height:p}=a.floating;let v,b;m==="top"||m==="bottom"?(v=m,b=h===(await(l.isRTL==null?void 0:l.isRTL(c.floating))?"start":"end")?"left":"right"):(b=m,v=h==="end"?"top":"bottom");const y=p-u.top-u.bottom,w=g-u.left-u.right,j=tt(p-u[v],y),S=tt(g-u[b],w),C=!t.middlewareData.shift;let k=j,A=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=w),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(k=y),C&&!h){const D=Se(u.left,0),$=Se(u.right,0),_=Se(u.top,0),F=Se(u.bottom,0);x?A=g-2*(D!==0||$!==0?D+$:Se(u.left,u.right)):k=p-2*(_!==0||F!==0?_+F:Se(u.top,u.bottom))}await d({...t,availableWidth:A,availableHeight:k});const R=await l.getDimensions(c.floating);return g!==R.width||p!==R.height?{reset:{rects:!0}}:{}}}};function In(){return typeof window<"u"}function Ot(e){return mi(e)?(e.nodeName||"").toLowerCase():"#document"}function Ee(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Be(e){var t;return(t=(mi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mi(e){return In()?e instanceof Node||e instanceof Ee(e).Node:!1}function Me(e){return In()?e instanceof Element||e instanceof Ee(e).Element:!1}function qe(e){return In()?e instanceof HTMLElement||e instanceof Ee(e).HTMLElement:!1}function ro(e){return!In()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ee(e).ShadowRoot}function Xt(e){const{overflow:t,overflowX:n,overflowY:s,display:o}=Oe(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&o!=="inline"&&o!=="contents"}function wp(e){return/^(table|td|th)$/.test(Ot(e))}function Ln(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Np=/transform|translate|scale|rotate|perspective|filter/,jp=/paint|layout|strict|content/,lt=e=>!!e&&e!=="none";let lr;function ls(e){const t=Me(e)?Oe(e):e;return lt(t.transform)||lt(t.translate)||lt(t.scale)||lt(t.rotate)||lt(t.perspective)||!cs()&&(lt(t.backdropFilter)||lt(t.filter))||Np.test(t.willChange||"")||jp.test(t.contain||"")}function kp(e){let t=nt(e);for(;qe(t)&&!At(t);){if(ls(t))return t;if(Ln(t))return null;t=nt(t)}return null}function cs(){return lr==null&&(lr=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),lr}function At(e){return/^(html|body|#document)$/.test(Ot(e))}function Oe(e){return Ee(e).getComputedStyle(e)}function $n(e){return Me(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function nt(e){if(Ot(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ro(e)&&e.host||Be(e);return ro(t)?t.host:t}function pi(e){const t=nt(e);return At(t)?e.ownerDocument?e.ownerDocument.body:e.body:qe(t)&&Xt(t)?t:pi(t)}function Ht(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=pi(e),a=o===((s=e.ownerDocument)==null?void 0:s.body),l=Ee(o);if(a){const c=Cr(l);return t.concat(l,l.visualViewport||[],Xt(o)?o:[],c&&n?Ht(c):[])}else return t.concat(o,Ht(o,[],n))}function Cr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function hi(e){const t=Oe(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const o=qe(e),a=o?e.offsetWidth:n,l=o?e.offsetHeight:s,c=Nn(n)!==a||Nn(s)!==l;return c&&(n=a,s=l),{width:n,height:s,$:c}}function ds(e){return Me(e)?e:e.contextElement}function kt(e){const t=ds(e);if(!qe(t))return Fe(1);const n=t.getBoundingClientRect(),{width:s,height:o,$:a}=hi(t);let l=(a?Nn(n.width):n.width)/s,c=(a?Nn(n.height):n.height)/o;return(!l||!Number.isFinite(l))&&(l=1),(!c||!Number.isFinite(c))&&(c=1),{x:l,y:c}}const Sp=Fe(0);function xi(e){const t=Ee(e);return!cs()||!t.visualViewport?Sp:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Cp(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ee(e)?!1:t}function dt(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),a=ds(e);let l=Fe(1);t&&(s?Me(s)&&(l=kt(s)):l=kt(e));const c=Cp(a,n,s)?xi(a):Fe(0);let d=(o.left+c.x)/l.x,f=(o.top+c.y)/l.y,u=o.width/l.x,m=o.height/l.y;if(a){const h=Ee(a),x=s&&Me(s)?Ee(s):s;let g=h,p=Cr(g);for(;p&&s&&x!==g;){const v=kt(p),b=p.getBoundingClientRect(),y=Oe(p),w=b.left+(p.clientLeft+parseFloat(y.paddingLeft))*v.x,j=b.top+(p.clientTop+parseFloat(y.paddingTop))*v.y;d*=v.x,f*=v.y,u*=v.x,m*=v.y,d+=w,f+=j,g=Ee(p),p=Cr(g)}}return kn({width:u,height:m,x:d,y:f})}function Fn(e,t){const n=$n(e).scrollLeft;return t?t.left+n:dt(Be(e)).left+n}function gi(e,t){const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-Fn(e,n),o=n.top+t.scrollTop;return{x:s,y:o}}function Ep(e){let{elements:t,rect:n,offsetParent:s,strategy:o}=e;const a=o==="fixed",l=Be(s),c=t?Ln(t.floating):!1;if(s===l||c&&a)return n;let d={scrollLeft:0,scrollTop:0},f=Fe(1);const u=Fe(0),m=qe(s);if((m||!m&&!a)&&((Ot(s)!=="body"||Xt(l))&&(d=$n(s)),m)){const x=dt(s);f=kt(s),u.x=x.x+s.clientLeft,u.y=x.y+s.clientTop}const h=l&&!m&&!a?gi(l,d):Fe(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+u.x+h.x,y:n.y*f.y-d.scrollTop*f.y+u.y+h.y}}function Ap(e){return Array.from(e.getClientRects())}function Tp(e){const t=Be(e),n=$n(e),s=e.ownerDocument.body,o=Se(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),a=Se(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let l=-n.scrollLeft+Fn(e);const c=-n.scrollTop;return Oe(s).direction==="rtl"&&(l+=Se(t.clientWidth,s.clientWidth)-o),{width:o,height:a,x:l,y:c}}const so=25;function Rp(e,t){const n=Ee(e),s=Be(e),o=n.visualViewport;let a=s.clientWidth,l=s.clientHeight,c=0,d=0;if(o){a=o.width,l=o.height;const u=cs();(!u||u&&t==="fixed")&&(c=o.offsetLeft,d=o.offsetTop)}const f=Fn(s);if(f<=0){const u=s.ownerDocument,m=u.body,h=getComputedStyle(m),x=u.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,g=Math.abs(s.clientWidth-m.clientWidth-x);g<=so&&(a-=g)}else f<=so&&(a+=f);return{width:a,height:l,x:c,y:d}}function _p(e,t){const n=dt(e,!0,t==="fixed"),s=n.top+e.clientTop,o=n.left+e.clientLeft,a=qe(e)?kt(e):Fe(1),l=e.clientWidth*a.x,c=e.clientHeight*a.y,d=o*a.x,f=s*a.y;return{width:l,height:c,x:d,y:f}}function oo(e,t,n){let s;if(t==="viewport")s=Rp(e,n);else if(t==="document")s=Tp(Be(e));else if(Me(t))s=_p(t,n);else{const o=xi(e);s={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return kn(s)}function vi(e,t){const n=nt(e);return n===t||!Me(n)||At(n)?!1:Oe(n).position==="fixed"||vi(n,t)}function Pp(e,t){const n=t.get(e);if(n)return n;let s=Ht(e,[],!1).filter(c=>Me(c)&&Ot(c)!=="body"),o=null;const a=Oe(e).position==="fixed";let l=a?nt(e):e;for(;Me(l)&&!At(l);){const c=Oe(l),d=ls(l);!d&&c.position==="fixed"&&(o=null),(a?!d&&!o:!d&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||Xt(l)&&!d&&vi(e,l))?s=s.filter(u=>u!==l):o=c,l=nt(l)}return t.set(e,s),s}function Dp(e){let{element:t,boundary:n,rootBoundary:s,strategy:o}=e;const l=[...n==="clippingAncestors"?Ln(t)?[]:Pp(t,this._c):[].concat(n),s],c=oo(t,l[0],o);let d=c.top,f=c.right,u=c.bottom,m=c.left;for(let h=1;h<l.length;h++){const x=oo(t,l[h],o);d=Se(x.top,d),f=tt(x.right,f),u=tt(x.bottom,u),m=Se(x.left,m)}return{width:f-m,height:u-d,x:m,y:d}}function Mp(e){const{width:t,height:n}=hi(e);return{width:t,height:n}}function Op(e,t,n){const s=qe(t),o=Be(t),a=n==="fixed",l=dt(e,!0,a,t);let c={scrollLeft:0,scrollTop:0};const d=Fe(0);function f(){d.x=Fn(o)}if(s||!s&&!a)if((Ot(t)!=="body"||Xt(o))&&(c=$n(t)),s){const x=dt(t,!0,a,t);d.x=x.x+t.clientLeft,d.y=x.y+t.clientTop}else o&&f();a&&!s&&o&&f();const u=o&&!s&&!a?gi(o,c):Fe(0),m=l.left+c.scrollLeft-d.x-u.x,h=l.top+c.scrollTop-d.y-u.y;return{x:m,y:h,width:l.width,height:l.height}}function cr(e){return Oe(e).position==="static"}function ao(e,t){if(!qe(e)||Oe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Be(e)===n&&(n=n.ownerDocument.body),n}function bi(e,t){const n=Ee(e);if(Ln(e))return n;if(!qe(e)){let o=nt(e);for(;o&&!At(o);){if(Me(o)&&!cr(o))return o;o=nt(o)}return n}let s=ao(e,t);for(;s&&wp(s)&&cr(s);)s=ao(s,t);return s&&At(s)&&cr(s)&&!ls(s)?n:s||kp(e)||n}const Ip=async function(e){const t=this.getOffsetParent||bi,n=this.getDimensions,s=await n(e.floating);return{reference:Op(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Lp(e){return Oe(e).direction==="rtl"}const $p={convertOffsetParentRelativeRectToViewportRelativeRect:Ep,getDocumentElement:Be,getClippingRect:Dp,getOffsetParent:bi,getElementRects:Ip,getClientRects:Ap,getDimensions:Mp,getScale:kt,isElement:Me,isRTL:Lp};function yi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Fp(e,t){let n=null,s;const o=Be(e);function a(){var c;clearTimeout(s),(c=n)==null||c.disconnect(),n=null}function l(c,d){c===void 0&&(c=!1),d===void 0&&(d=1),a();const f=e.getBoundingClientRect(),{left:u,top:m,width:h,height:x}=f;if(c||t(),!h||!x)return;const g=an(m),p=an(o.clientWidth-(u+h)),v=an(o.clientHeight-(m+x)),b=an(u),w={rootMargin:-g+"px "+-p+"px "+-v+"px "+-b+"px",threshold:Se(0,tt(1,d))||1};let j=!0;function S(C){const k=C[0].intersectionRatio;if(k!==d){if(!j)return l();k?l(!1,k):s=setTimeout(()=>{l(!1,1e-7)},1e3)}k===1&&!yi(f,e.getBoundingClientRect())&&l(),j=!1}try{n=new IntersectionObserver(S,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,w)}n.observe(e)}return l(!0),a}function Bp(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:d=!1}=s,f=ds(e),u=o||a?[...f?Ht(f):[],...t?Ht(t):[]]:[];u.forEach(b=>{o&&b.addEventListener("scroll",n,{passive:!0}),a&&b.addEventListener("resize",n)});const m=f&&c?Fp(f,n):null;let h=-1,x=null;l&&(x=new ResizeObserver(b=>{let[y]=b;y&&y.target===f&&x&&t&&(x.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=x)==null||w.observe(t)})),n()}),f&&!d&&x.observe(f),t&&x.observe(t));let g,p=d?dt(e):null;d&&v();function v(){const b=dt(e);p&&!yi(p,b)&&n(),p=b,g=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(y=>{o&&y.removeEventListener("scroll",n),a&&y.removeEventListener("resize",n)}),m==null||m(),(b=x)==null||b.disconnect(),x=null,d&&cancelAnimationFrame(g)}}const Up=gp,Vp=vp,Wp=pp,zp=yp,Hp=hp,io=mp,Kp=bp,qp=(e,t,n)=>{const s=new Map,o={platform:$p,...n},a={...o.platform,_c:s};return fp(e,t,{...o,platform:a})};var Gp=typeof document<"u",Yp=function(){},dn=Gp?i.useLayoutEffect:Yp;function Sn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Sn(e[s],t[s]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,o[s]))return!1;for(s=n;s--!==0;){const a=o[s];if(!(a==="_owner"&&e.$$typeof)&&!Sn(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function wi(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function lo(e,t){const n=wi(e);return Math.round(t*n)/n}function dr(e){const t=i.useRef(e);return dn(()=>{t.current=e}),t}function Xp(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:a,floating:l}={},transform:c=!0,whileElementsMounted:d,open:f}=e,[u,m]=i.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[h,x]=i.useState(s);Sn(h,s)||x(s);const[g,p]=i.useState(null),[v,b]=i.useState(null),y=i.useCallback(I=>{I!==C.current&&(C.current=I,p(I))},[]),w=i.useCallback(I=>{I!==k.current&&(k.current=I,b(I))},[]),j=a||g,S=l||v,C=i.useRef(null),k=i.useRef(null),A=i.useRef(u),R=d!=null,D=dr(d),$=dr(o),_=dr(f),F=i.useCallback(()=>{if(!C.current||!k.current)return;const I={placement:t,strategy:n,middleware:h};$.current&&(I.platform=$.current),qp(C.current,k.current,I).then(E=>{const ee={...E,isPositioned:_.current!==!1};W.current&&!Sn(A.current,ee)&&(A.current=ee,An.flushSync(()=>{m(ee)}))})},[h,t,n,$,_]);dn(()=>{f===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,m(I=>({...I,isPositioned:!1})))},[f]);const W=i.useRef(!1);dn(()=>(W.current=!0,()=>{W.current=!1}),[]),dn(()=>{if(j&&(C.current=j),S&&(k.current=S),j&&S){if(D.current)return D.current(j,S,F);F()}},[j,S,F,D,R]);const z=i.useMemo(()=>({reference:C,floating:k,setReference:y,setFloating:w}),[y,w]),O=i.useMemo(()=>({reference:j,floating:S}),[j,S]),T=i.useMemo(()=>{const I={position:n,left:0,top:0};if(!O.floating)return I;const E=lo(O.floating,u.x),ee=lo(O.floating,u.y);return c?{...I,transform:"translate("+E+"px, "+ee+"px)",...wi(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:E,top:ee}},[n,c,O.floating,u.x,u.y]);return i.useMemo(()=>({...u,update:F,refs:z,elements:O,floatingStyles:T}),[u,F,z,O,T])}const Jp=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:o}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?io({element:s.current,padding:o}).fn(n):{}:s?io({element:s,padding:o}).fn(n):{}}}},Zp=(e,t)=>{const n=Up(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qp=(e,t)=>{const n=Vp(e);return{name:n.name,fn:n.fn,options:[e,t]}},eh=(e,t)=>({fn:Kp(e).fn,options:[e,t]}),th=(e,t)=>{const n=Wp(e);return{name:n.name,fn:n.fn,options:[e,t]}},nh=(e,t)=>{const n=zp(e);return{name:n.name,fn:n.fn,options:[e,t]}},rh=(e,t)=>{const n=Hp(e);return{name:n.name,fn:n.fn,options:[e,t]}},sh=(e,t)=>{const n=Jp(e);return{name:n.name,fn:n.fn,options:[e,t]}};var oh="Arrow",Ni=i.forwardRef((e,t)=>{const{children:n,width:s=10,height:o=5,...a}=e;return r.jsx(Z.svg,{...a,ref:t,width:s,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ni.displayName=oh;var ah=Ni;function ji(e){const[t,n]=i.useState(void 0);return ye(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let l,c;if("borderBoxSize"in a){const d=a.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,c=f.blockSize}else l=e.offsetWidth,c=e.offsetHeight;n({width:l,height:c})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var us="Popper",[ki,Si]=rt(us),[ih,Ci]=ki(us),Ei=e=>{const{__scopePopper:t,children:n}=e,[s,o]=i.useState(null);return r.jsx(ih,{scope:t,anchor:s,onAnchorChange:o,children:n})};Ei.displayName=us;var Ai="PopperAnchor",Ti=i.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...o}=e,a=Ci(Ai,n),l=i.useRef(null),c=ie(t,l),d=i.useRef(null);return i.useEffect(()=>{const f=d.current;d.current=(s==null?void 0:s.current)||l.current,f!==d.current&&a.onAnchorChange(d.current)}),s?null:r.jsx(Z.div,{...o,ref:c})});Ti.displayName=Ai;var fs="PopperContent",[lh,ch]=ki(fs),Ri=i.forwardRef((e,t)=>{var M,B,Q,K,X,G;const{__scopePopper:n,side:s="bottom",sideOffset:o=0,align:a="center",alignOffset:l=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:u=0,sticky:m="partial",hideWhenDetached:h=!1,updatePositionStrategy:x="optimized",onPlaced:g,...p}=e,v=Ci(fs,n),[b,y]=i.useState(null),w=ie(t,oe=>y(oe)),[j,S]=i.useState(null),C=ji(j),k=(C==null?void 0:C.width)??0,A=(C==null?void 0:C.height)??0,R=s+(a!=="center"?"-"+a:""),D=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},$=Array.isArray(f)?f:[f],_=$.length>0,F={padding:D,boundary:$.filter(uh),altBoundary:_},{refs:W,floatingStyles:z,placement:O,isPositioned:T,middlewareData:I}=Xp({strategy:"fixed",placement:R,whileElementsMounted:(...oe)=>Bp(...oe,{animationFrame:x==="always"}),elements:{reference:v.anchor},middleware:[Zp({mainAxis:o+A,alignmentAxis:l}),d&&Qp({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?eh():void 0,...F}),d&&th({...F}),nh({...F,apply:({elements:oe,rects:xe,availableWidth:ve,availableHeight:Ne})=>{const{width:H,height:fe}=xe.reference,de=oe.floating.style;de.setProperty("--radix-popper-available-width",`${ve}px`),de.setProperty("--radix-popper-available-height",`${Ne}px`),de.setProperty("--radix-popper-anchor-width",`${H}px`),de.setProperty("--radix-popper-anchor-height",`${fe}px`)}}),j&&sh({element:j,padding:c}),fh({arrowWidth:k,arrowHeight:A}),h&&rh({strategy:"referenceHidden",...F})]}),[E,ee]=Di(O),ce=et(g);ye(()=>{T&&(ce==null||ce())},[T,ce]);const ae=(M=I.arrow)==null?void 0:M.x,ne=(B=I.arrow)==null?void 0:B.y,le=((Q=I.arrow)==null?void 0:Q.centerOffset)!==0,[me,L]=i.useState();return ye(()=>{b&&L(window.getComputedStyle(b).zIndex)},[b]),r.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...z,transform:T?z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:me,"--radix-popper-transform-origin":[(K=I.transformOrigin)==null?void 0:K.x,(X=I.transformOrigin)==null?void 0:X.y].join(" "),...((G=I.hide)==null?void 0:G.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(lh,{scope:n,placedSide:E,onArrowChange:S,arrowX:ae,arrowY:ne,shouldHideArrow:le,children:r.jsx(Z.div,{"data-side":E,"data-align":ee,...p,ref:w,style:{...p.style,animation:T?void 0:"none"}})})})});Ri.displayName=fs;var _i="PopperArrow",dh={top:"bottom",right:"left",bottom:"top",left:"right"},Pi=i.forwardRef(function(t,n){const{__scopePopper:s,...o}=t,a=ch(_i,s),l=dh[a.placedSide];return r.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:r.jsx(ah,{...o,ref:n,style:{...o.style,display:"block"}})})});Pi.displayName=_i;function uh(e){return e!==null}var fh=e=>({name:"transformOrigin",options:e,fn(t){var v,b,y;const{placement:n,rects:s,middlewareData:o}=t,l=((v=o.arrow)==null?void 0:v.centerOffset)!==0,c=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[f,u]=Di(n),m={start:"0%",center:"50%",end:"100%"}[u],h=(((b=o.arrow)==null?void 0:b.x)??0)+c/2,x=(((y=o.arrow)==null?void 0:y.y)??0)+d/2;let g="",p="";return f==="bottom"?(g=l?m:`${h}px`,p=`${-d}px`):f==="top"?(g=l?m:`${h}px`,p=`${s.floating.height+d}px`):f==="right"?(g=`${-d}px`,p=l?m:`${x}px`):f==="left"&&(g=`${s.floating.width+d}px`,p=l?m:`${x}px`),{data:{x:g,y:p}}}});function Di(e){const[t,n="center"]=e.split("-");return[t,n]}var mh=Ei,ph=Ti,hh=Ri,xh=Pi;function Mi(e){const t=i.useRef({value:e,previous:e});return i.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Oi=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),gh="VisuallyHidden",vh=i.forwardRef((e,t)=>r.jsx(Z.span,{...e,ref:t,style:{...Oi,...e.style}}));vh.displayName=gh;var bh=[" ","Enter","ArrowUp","ArrowDown"],yh=[" ","Enter"],ut="Select",[Bn,Un,wh]=ka(ut),[It]=rt(ut,[wh,Si]),Vn=Si(),[Nh,st]=It(ut),[jh,kh]=It(ut),Ii=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:o,onOpenChange:a,value:l,defaultValue:c,onValueChange:d,dir:f,name:u,autoComplete:m,disabled:h,required:x,form:g}=e,p=Vn(t),[v,b]=i.useState(null),[y,w]=i.useState(null),[j,S]=i.useState(!1),C=ns(f),[k,A]=Ct({prop:s,defaultProp:o??!1,onChange:a,caller:ut}),[R,D]=Ct({prop:l,defaultProp:c,onChange:d,caller:ut}),$=i.useRef(null),_=v?g||!!v.closest("form"):!0,[F,W]=i.useState(new Set),z=Array.from(F).map(O=>O.props.value).join(";");return r.jsx(mh,{...p,children:r.jsxs(Nh,{required:x,scope:t,trigger:v,onTriggerChange:b,valueNode:y,onValueNodeChange:w,valueNodeHasChildren:j,onValueNodeHasChildrenChange:S,contentId:Ze(),value:R,onValueChange:D,open:k,onOpenChange:A,dir:C,triggerPointerDownPosRef:$,disabled:h,children:[r.jsx(Bn.Provider,{scope:t,children:r.jsx(jh,{scope:e.__scopeSelect,onNativeOptionAdd:i.useCallback(O=>{W(T=>new Set(T).add(O))},[]),onNativeOptionRemove:i.useCallback(O=>{W(T=>{const I=new Set(T);return I.delete(O),I})},[]),children:n})}),_?r.jsxs(al,{"aria-hidden":!0,required:x,tabIndex:-1,name:u,autoComplete:m,value:R,onChange:O=>D(O.target.value),disabled:h,form:g,children:[R===void 0?r.jsx("option",{value:""}):null,Array.from(F)]},z):null]})})};Ii.displayName=ut;var Li="SelectTrigger",$i=i.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...o}=e,a=Vn(n),l=st(Li,n),c=l.disabled||s,d=ie(t,l.onTriggerChange),f=Un(n),u=i.useRef("touch"),[m,h,x]=ll(p=>{const v=f().filter(w=>!w.disabled),b=v.find(w=>w.value===l.value),y=cl(v,p,b);y!==void 0&&l.onValueChange(y.value)}),g=p=>{c||(l.onOpenChange(!0),x()),p&&(l.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return r.jsx(ph,{asChild:!0,...a,children:r.jsx(Z.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":il(l.value)?"":void 0,...o,ref:d,onClick:J(o.onClick,p=>{p.currentTarget.focus(),u.current!=="mouse"&&g(p)}),onPointerDown:J(o.onPointerDown,p=>{u.current=p.pointerType;const v=p.target;v.hasPointerCapture(p.pointerId)&&v.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:J(o.onKeyDown,p=>{const v=m.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&h(p.key),!(v&&p.key===" ")&&bh.includes(p.key)&&(g(),p.preventDefault())})})})});$i.displayName=Li;var Fi="SelectValue",Bi=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,children:a,placeholder:l="",...c}=e,d=st(Fi,n),{onValueNodeHasChildrenChange:f}=d,u=a!==void 0,m=ie(t,d.onValueNodeChange);return ye(()=>{f(u)},[f,u]),r.jsx(Z.span,{...c,ref:m,style:{pointerEvents:"none"},children:il(d.value)?r.jsx(r.Fragment,{children:l}):a})});Bi.displayName=Fi;var Sh="SelectIcon",Ui=i.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...o}=e;return r.jsx(Z.span,{"aria-hidden":!0,...o,ref:t,children:s||"▼"})});Ui.displayName=Sh;var Ch="SelectPortal",Vi=e=>r.jsx(Kr,{asChild:!0,...e});Vi.displayName=Ch;var ft="SelectContent",Wi=i.forwardRef((e,t)=>{const n=st(ft,e.__scopeSelect),[s,o]=i.useState();if(ye(()=>{o(new DocumentFragment)},[]),!n.open){const a=s;return a?An.createPortal(r.jsx(zi,{scope:e.__scopeSelect,children:r.jsx(Bn.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),a):null}return r.jsx(Hi,{...e,ref:t})});Wi.displayName=ft;var Pe=10,[zi,ot]=It(ft),Eh="SelectContentImpl",Ah=Wt("SelectContent.RemoveScroll"),Hi=i.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:l,side:c,sideOffset:d,align:f,alignOffset:u,arrowPadding:m,collisionBoundary:h,collisionPadding:x,sticky:g,hideWhenDetached:p,avoidCollisions:v,...b}=e,y=st(ft,n),[w,j]=i.useState(null),[S,C]=i.useState(null),k=ie(t,M=>j(M)),[A,R]=i.useState(null),[D,$]=i.useState(null),_=Un(n),[F,W]=i.useState(!1),z=i.useRef(!1);i.useEffect(()=>{if(w)return Go(w)},[w]),Fo();const O=i.useCallback(M=>{const[B,...Q]=_().map(G=>G.ref.current),[K]=Q.slice(-1),X=document.activeElement;for(const G of M)if(G===X||(G==null||G.scrollIntoView({block:"nearest"}),G===B&&S&&(S.scrollTop=0),G===K&&S&&(S.scrollTop=S.scrollHeight),G==null||G.focus(),document.activeElement!==X))return},[_,S]),T=i.useCallback(()=>O([A,w]),[O,A,w]);i.useEffect(()=>{F&&T()},[F,T]);const{onOpenChange:I,triggerPointerDownPosRef:E}=y;i.useEffect(()=>{if(w){let M={x:0,y:0};const B=K=>{var X,G;M={x:Math.abs(Math.round(K.pageX)-(((X=E.current)==null?void 0:X.x)??0)),y:Math.abs(Math.round(K.pageY)-(((G=E.current)==null?void 0:G.y)??0))}},Q=K=>{M.x<=10&&M.y<=10?K.preventDefault():w.contains(K.target)||I(!1),document.removeEventListener("pointermove",B),E.current=null};return E.current!==null&&(document.addEventListener("pointermove",B),document.addEventListener("pointerup",Q,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",B),document.removeEventListener("pointerup",Q,{capture:!0})}}},[w,I,E]),i.useEffect(()=>{const M=()=>I(!1);return window.addEventListener("blur",M),window.addEventListener("resize",M),()=>{window.removeEventListener("blur",M),window.removeEventListener("resize",M)}},[I]);const[ee,ce]=ll(M=>{const B=_().filter(X=>!X.disabled),Q=B.find(X=>X.ref.current===document.activeElement),K=cl(B,M,Q);K&&setTimeout(()=>K.ref.current.focus())}),ae=i.useCallback((M,B,Q)=>{const K=!z.current&&!Q;(y.value!==void 0&&y.value===B||K)&&(R(M),K&&(z.current=!0))},[y.value]),ne=i.useCallback(()=>w==null?void 0:w.focus(),[w]),le=i.useCallback((M,B,Q)=>{const K=!z.current&&!Q;(y.value!==void 0&&y.value===B||K)&&$(M)},[y.value]),me=s==="popper"?Er:Ki,L=me===Er?{side:c,sideOffset:d,align:f,alignOffset:u,arrowPadding:m,collisionBoundary:h,collisionPadding:x,sticky:g,hideWhenDetached:p,avoidCollisions:v}:{};return r.jsx(zi,{scope:n,content:w,viewport:S,onViewportChange:C,itemRefCallback:ae,selectedItem:A,onItemLeave:ne,itemTextRefCallback:le,focusSelectedItem:T,selectedItemText:D,position:s,isPositioned:F,searchRef:ee,children:r.jsx(qr,{as:Ah,allowPinchZoom:!0,children:r.jsx(Hr,{asChild:!0,trapped:y.open,onMountAutoFocus:M=>{M.preventDefault()},onUnmountAutoFocus:J(o,M=>{var B;(B=y.trigger)==null||B.focus({preventScroll:!0}),M.preventDefault()}),children:r.jsx(zr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:M=>M.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:r.jsx(me,{role:"listbox",id:y.contentId,"data-state":y.open?"open":"closed",dir:y.dir,onContextMenu:M=>M.preventDefault(),...b,...L,onPlaced:()=>W(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:J(b.onKeyDown,M=>{const B=M.ctrlKey||M.altKey||M.metaKey;if(M.key==="Tab"&&M.preventDefault(),!B&&M.key.length===1&&ce(M.key),["ArrowUp","ArrowDown","Home","End"].includes(M.key)){let K=_().filter(X=>!X.disabled).map(X=>X.ref.current);if(["ArrowUp","End"].includes(M.key)&&(K=K.slice().reverse()),["ArrowUp","ArrowDown"].includes(M.key)){const X=M.target,G=K.indexOf(X);K=K.slice(G+1)}setTimeout(()=>O(K)),M.preventDefault()}})})})})})})});Hi.displayName=Eh;var Th="SelectItemAlignedPosition",Ki=i.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...o}=e,a=st(ft,n),l=ot(ft,n),[c,d]=i.useState(null),[f,u]=i.useState(null),m=ie(t,k=>u(k)),h=Un(n),x=i.useRef(!1),g=i.useRef(!0),{viewport:p,selectedItem:v,selectedItemText:b,focusSelectedItem:y}=l,w=i.useCallback(()=>{if(a.trigger&&a.valueNode&&c&&f&&p&&v&&b){const k=a.trigger.getBoundingClientRect(),A=f.getBoundingClientRect(),R=a.valueNode.getBoundingClientRect(),D=b.getBoundingClientRect();if(a.dir!=="rtl"){const X=D.left-A.left,G=R.left-X,oe=k.left-G,xe=k.width+oe,ve=Math.max(xe,A.width),Ne=window.innerWidth-Pe,H=Js(G,[Pe,Math.max(Pe,Ne-ve)]);c.style.minWidth=xe+"px",c.style.left=H+"px"}else{const X=A.right-D.right,G=window.innerWidth-R.right-X,oe=window.innerWidth-k.right-G,xe=k.width+oe,ve=Math.max(xe,A.width),Ne=window.innerWidth-Pe,H=Js(G,[Pe,Math.max(Pe,Ne-ve)]);c.style.minWidth=xe+"px",c.style.right=H+"px"}const $=h(),_=window.innerHeight-Pe*2,F=p.scrollHeight,W=window.getComputedStyle(f),z=parseInt(W.borderTopWidth,10),O=parseInt(W.paddingTop,10),T=parseInt(W.borderBottomWidth,10),I=parseInt(W.paddingBottom,10),E=z+O+F+I+T,ee=Math.min(v.offsetHeight*5,E),ce=window.getComputedStyle(p),ae=parseInt(ce.paddingTop,10),ne=parseInt(ce.paddingBottom,10),le=k.top+k.height/2-Pe,me=_-le,L=v.offsetHeight/2,M=v.offsetTop+L,B=z+O+M,Q=E-B;if(B<=le){const X=$.length>0&&v===$[$.length-1].ref.current;c.style.bottom="0px";const G=f.clientHeight-p.offsetTop-p.offsetHeight,oe=Math.max(me,L+(X?ne:0)+G+T),xe=B+oe;c.style.height=xe+"px"}else{const X=$.length>0&&v===$[0].ref.current;c.style.top="0px";const oe=Math.max(le,z+p.offsetTop+(X?ae:0)+L)+Q;c.style.height=oe+"px",p.scrollTop=B-le+p.offsetTop}c.style.margin=`${Pe}px 0`,c.style.minHeight=ee+"px",c.style.maxHeight=_+"px",s==null||s(),requestAnimationFrame(()=>x.current=!0)}},[h,a.trigger,a.valueNode,c,f,p,v,b,a.dir,s]);ye(()=>w(),[w]);const[j,S]=i.useState();ye(()=>{f&&S(window.getComputedStyle(f).zIndex)},[f]);const C=i.useCallback(k=>{k&&g.current===!0&&(w(),y==null||y(),g.current=!1)},[w,y]);return r.jsx(_h,{scope:n,contentWrapper:c,shouldExpandOnScrollRef:x,onScrollButtonChange:C,children:r.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:r.jsx(Z.div,{...o,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Ki.displayName=Th;var Rh="SelectPopperPosition",Er=i.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:o=Pe,...a}=e,l=Vn(n);return r.jsx(hh,{...l,...a,ref:t,align:s,collisionPadding:o,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Er.displayName=Rh;var[_h,ms]=It(ft,{}),Ar="SelectViewport",qi=i.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...o}=e,a=ot(Ar,n),l=ms(Ar,n),c=ie(t,a.onViewportChange),d=i.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(Bn.Slot,{scope:n,children:r.jsx(Z.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:J(o.onScroll,f=>{const u=f.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:h}=l;if(h!=null&&h.current&&m){const x=Math.abs(d.current-u.scrollTop);if(x>0){const g=window.innerHeight-Pe*2,p=parseFloat(m.style.minHeight),v=parseFloat(m.style.height),b=Math.max(p,v);if(b<g){const y=b+x,w=Math.min(g,y),j=y-w;m.style.height=w+"px",m.style.bottom==="0px"&&(u.scrollTop=j>0?j:0,m.style.justifyContent="flex-end")}}}d.current=u.scrollTop})})})]})});qi.displayName=Ar;var Gi="SelectGroup",[Ph,Dh]=It(Gi),Mh=i.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Ze();return r.jsx(Ph,{scope:n,id:o,children:r.jsx(Z.div,{role:"group","aria-labelledby":o,...s,ref:t})})});Mh.displayName=Gi;var Yi="SelectLabel",Xi=i.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Dh(Yi,n);return r.jsx(Z.div,{id:o.id,...s,ref:t})});Xi.displayName=Yi;var Cn="SelectItem",[Oh,Ji]=It(Cn),Zi=i.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:o=!1,textValue:a,...l}=e,c=st(Cn,n),d=ot(Cn,n),f=c.value===s,[u,m]=i.useState(a??""),[h,x]=i.useState(!1),g=ie(t,y=>{var w;return(w=d.itemRefCallback)==null?void 0:w.call(d,y,s,o)}),p=Ze(),v=i.useRef("touch"),b=()=>{o||(c.onValueChange(s),c.onOpenChange(!1))};if(s==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(Oh,{scope:n,value:s,disabled:o,textId:p,isSelected:f,onItemTextChange:i.useCallback(y=>{m(w=>w||((y==null?void 0:y.textContent)??"").trim())},[]),children:r.jsx(Bn.ItemSlot,{scope:n,value:s,disabled:o,textValue:u,children:r.jsx(Z.div,{role:"option","aria-labelledby":p,"data-highlighted":h?"":void 0,"aria-selected":f&&h,"data-state":f?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...l,ref:g,onFocus:J(l.onFocus,()=>x(!0)),onBlur:J(l.onBlur,()=>x(!1)),onClick:J(l.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:J(l.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:J(l.onPointerDown,y=>{v.current=y.pointerType}),onPointerMove:J(l.onPointerMove,y=>{var w;v.current=y.pointerType,o?(w=d.onItemLeave)==null||w.call(d):v.current==="mouse"&&y.currentTarget.focus({preventScroll:!0})}),onPointerLeave:J(l.onPointerLeave,y=>{var w;y.currentTarget===document.activeElement&&((w=d.onItemLeave)==null||w.call(d))}),onKeyDown:J(l.onKeyDown,y=>{var j;((j=d.searchRef)==null?void 0:j.current)!==""&&y.key===" "||(yh.includes(y.key)&&b(),y.key===" "&&y.preventDefault())})})})})});Zi.displayName=Cn;var $t="SelectItemText",Qi=i.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:o,...a}=e,l=st($t,n),c=ot($t,n),d=Ji($t,n),f=kh($t,n),[u,m]=i.useState(null),h=ie(t,b=>m(b),d.onItemTextChange,b=>{var y;return(y=c.itemTextRefCallback)==null?void 0:y.call(c,b,d.value,d.disabled)}),x=u==null?void 0:u.textContent,g=i.useMemo(()=>r.jsx("option",{value:d.value,disabled:d.disabled,children:x},d.value),[d.disabled,d.value,x]),{onNativeOptionAdd:p,onNativeOptionRemove:v}=f;return ye(()=>(p(g),()=>v(g)),[p,v,g]),r.jsxs(r.Fragment,{children:[r.jsx(Z.span,{id:d.textId,...a,ref:h}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?An.createPortal(a.children,l.valueNode):null]})});Qi.displayName=$t;var el="SelectItemIndicator",tl=i.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return Ji(el,n).isSelected?r.jsx(Z.span,{"aria-hidden":!0,...s,ref:t}):null});tl.displayName=el;var Tr="SelectScrollUpButton",nl=i.forwardRef((e,t)=>{const n=ot(Tr,e.__scopeSelect),s=ms(Tr,e.__scopeSelect),[o,a]=i.useState(!1),l=ie(t,s.onScrollButtonChange);return ye(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=d.scrollTop>0;a(f)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),o?r.jsx(sl,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null});nl.displayName=Tr;var Rr="SelectScrollDownButton",rl=i.forwardRef((e,t)=>{const n=ot(Rr,e.__scopeSelect),s=ms(Rr,e.__scopeSelect),[o,a]=i.useState(!1),l=ie(t,s.onScrollButtonChange);return ye(()=>{if(n.viewport&&n.isPositioned){let c=function(){const f=d.scrollHeight-d.clientHeight,u=Math.ceil(d.scrollTop)<f;a(u)};const d=n.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[n.viewport,n.isPositioned]),o?r.jsx(sl,{...e,ref:l,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=n;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null});rl.displayName=Rr;var sl=i.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...o}=e,a=ot("SelectScrollButton",n),l=i.useRef(null),c=Un(n),d=i.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return i.useEffect(()=>()=>d(),[d]),ye(()=>{var u;const f=c().find(m=>m.ref.current===document.activeElement);(u=f==null?void 0:f.ref.current)==null||u.scrollIntoView({block:"nearest"})},[c]),r.jsx(Z.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:J(o.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:J(o.onPointerMove,()=>{var f;(f=a.onItemLeave)==null||f.call(a),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:J(o.onPointerLeave,()=>{d()})})}),Ih="SelectSeparator",ol=i.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(Z.div,{"aria-hidden":!0,...s,ref:t})});ol.displayName=Ih;var _r="SelectArrow",Lh=i.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,o=Vn(n),a=st(_r,n),l=ot(_r,n);return a.open&&l.position==="popper"?r.jsx(xh,{...o,...s,ref:t}):null});Lh.displayName=_r;var $h="SelectBubbleInput",al=i.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const o=i.useRef(null),a=ie(s,o),l=Mi(t);return i.useEffect(()=>{const c=o.current;if(!c)return;const d=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==t&&u){const m=new Event("change",{bubbles:!0});u.call(c,t),c.dispatchEvent(m)}},[l,t]),r.jsx(Z.select,{...n,style:{...Oi,...n.style},ref:a,defaultValue:t})});al.displayName=$h;function il(e){return e===""||e===void 0}function ll(e){const t=et(e),n=i.useRef(""),s=i.useRef(0),o=i.useCallback(l=>{const c=n.current+l;t(c),(function d(f){n.current=f,window.clearTimeout(s.current),f!==""&&(s.current=window.setTimeout(()=>d(""),1e3))})(c)},[t]),a=i.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return i.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,o,a]}function cl(e,t,n){const o=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,a=n?e.indexOf(n):-1;let l=Fh(e,Math.max(a,0));o.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.textValue.toLowerCase().startsWith(o.toLowerCase()));return d!==n?d:void 0}function Fh(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Bh=Ii,dl=$i,Uh=Bi,Vh=Ui,Wh=Vi,ul=Wi,zh=qi,fl=Xi,ml=Zi,Hh=Qi,Kh=tl,pl=nl,hl=rl,xl=ol;const Te=Bh,Ve=Uh,je=i.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(dl,{ref:s,className:U("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,r.jsx(Vh,{asChild:!0,children:r.jsx(Rt,{className:"h-4 w-4 opacity-50"})})]}));je.displayName=dl.displayName;const gl=i.forwardRef(({className:e,...t},n)=>r.jsx(pl,{ref:n,className:U("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Fr,{className:"h-4 w-4"})}));gl.displayName=pl.displayName;const vl=i.forwardRef(({className:e,...t},n)=>r.jsx(hl,{ref:n,className:U("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Rt,{className:"h-4 w-4"})}));vl.displayName=hl.displayName;const ke=i.forwardRef(({className:e,children:t,position:n="popper",...s},o)=>r.jsx(Wh,{children:r.jsxs(ul,{ref:o,className:U("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...s,children:[r.jsx(gl,{}),r.jsx(zh,{className:U("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(vl,{})]})}));ke.displayName=ul.displayName;const qh=i.forwardRef(({className:e,...t},n)=>r.jsx(fl,{ref:n,className:U("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));qh.displayName=fl.displayName;const be=i.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(ml,{ref:s,className:U("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(Kh,{children:r.jsx(He,{className:"h-4 w-4"})})}),r.jsx(Hh,{children:t})]}));be.displayName=ml.displayName;const Gh=i.forwardRef(({className:e,...t},n)=>r.jsx(xl,{ref:n,className:U("-mx-1 my-1 h-px bg-muted",e),...t}));Gh.displayName=xl.displayName;const Pr="bypass",ps=[{value:"claudecode",label:"claudecode",supportsFollowUp:!0},{value:"codex",label:"codex",supportsFollowUp:!0},{value:"mars",label:"mars",disabled:!0,description:"coming soon"},{value:"eureka",label:"eureka",disabled:!0,description:"coming soon"}],bl=[{value:"bypass",label:"Bypass"},{value:"plan",label:"Plan"},{value:"edit",label:"Edit"},{value:"dangerous",label:"Dangerous"}],Yh=new Set(ps.filter(e=>e.supportsFollowUp).map(e=>e.value)),Xh=20,Jh=3,co="meshy-working-dir-recents-by-node";function Zh(e){return e.startsWith("/")||e.startsWith("\\\\")||/^[A-Za-z]:[\\/]/.test(e)}function Qh(e){const t=e.trim();return t||"."}function Dr(e){const t=[],n=new Set;for(const s of e){const o=s.trim();if(!(!o||n.has(o))&&(n.add(o),t.push(o),t.length===Jh))break}return t}function ex(e,t){const n=t.trim();return Dr(n?[n,...e]:e)}function tx(e){if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[n,s]of Object.entries(e)){if(!n||!Array.isArray(s))continue;const o=s.filter(l=>typeof l=="string"),a=Dr(o);a.length>0&&(t[n]=a)}return t}function nx(e,t,n){if(!t)return e;const s=e[t]??[],o=ex(s,n);if(o.length===0){if(!(t in e))return e;const{[t]:a,...l}=e;return l}return{...e,[t]:o}}function rx(e,t,n){return e!=="auto"?t.find(s=>s.id===e)??null:n.length===1?n[0]??null:null}function sx(e,t){const n=t.trim();return n?Zh(n)||!e?n:`${e.replace(/[/\\]+$/,"")}/${n}`:""}function ox(e,t){return e?e.isAbsolute?e.currentPath:e.currentPath==="."||e.currentPath===""?e.rootPath||(t==null?void 0:t.workDir)||"Node root":e.currentPath:(t==null?void 0:t.workDir)??"Node root"}function uo({value:e,onChange:t,assignTo:n,nodes:s,assignableNodes:o,layout:a="default",chipClassName:l,chipActiveClassName:c,chipInactiveClassName:d,labelClassName:f,triggerClassName:u}){const[m,h]=i.useState(!1),[x,g]=i.useState(null),[p,v]=i.useState(!1),[b,y]=i.useState(!1),[w,j]=i.useState(null),[S,C]=i.useState(""),[k,A]=i.useState(!1),[R,D]=i.useState({}),$=i.useRef(null),_=i.useMemo(()=>rx(n,s,o),[n,s,o]),F=_==null?void 0:_.id,W=i.useMemo(()=>F?R[F]??[]:[],[R,F]),z=i.useMemo(()=>e.trim()?sx(_==null?void 0:_.workDir,e):"Use node default",[e,_==null?void 0:_.workDir]);i.useEffect(()=>{if(!(typeof window>"u"))try{const L=window.localStorage.getItem(co);if(!L)return;const M=JSON.parse(L);D(tx(M))}catch{}},[]);const O=i.useCallback(L=>{F&&D(M=>{const B=nx(M,F,L);if(B===M)return M;if(typeof window<"u")try{window.localStorage.setItem(co,JSON.stringify(B))}catch{}return B})},[F]),T=i.useCallback((L,M=!0)=>{const B=L.trim();t(B),M&&B&&O(B),h(!1)},[t,O]),I=i.useCallback(async(L,M=0,B=!1)=>{if(F){j(null),B?y(!0):v(!0);try{const Q=await mc(F,{path:L,limit:Xh,offset:M,directoriesOnly:!0,allowAbsolute:!0});g(K=>B&&K?{...Q,entries:[...K.entries,...Q.entries]}:Q)}catch(Q){j(Q instanceof Error?Q.message:"Failed to browse directories"),B||g(null)}finally{v(!1),y(!1)}}},[F]),E=i.useRef(e);E.current=e;const ee=i.useRef(I);ee.current=I,i.useEffect(()=>{if(!m)return;const L=E.current;C(L),A(!1),g(null),j(null),F&&ee.current(Qh(L))},[m,F]),i.useEffect(()=>{if(!m)return;const L=B=>{$.current&&($.current.contains(B.target)||h(!1))},M=B=>{B.key==="Escape"&&h(!1)};return document.addEventListener("mousedown",L),document.addEventListener("keydown",M),()=>{document.removeEventListener("mousedown",L),document.removeEventListener("keydown",M)}},[m]);const ce=i.useCallback(L=>{I(L)},[I]),ae=i.useCallback(()=>{x&&I(x.currentPath,x.entries.length,!0)},[x,I]),ne=a==="composer"?r.jsxs(q,{type:"button",variant:"ghost",onClick:()=>h(L=>!L),title:z,"aria-label":`Working directory: ${z}`,className:U(l,u,"min-w-0 max-w-full",e.trim()?c:d),children:[r.jsx(rd,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:U("min-w-0 truncate",f),children:z})]}):r.jsxs(q,{type:"button",variant:"outline",onClick:()=>h(L=>!L),className:"h-11 w-full justify-between rounded-2xl border-border/70 bg-background/70 px-4",title:z,children:[r.jsx("span",{className:U("truncate",e.trim()?"font-mono text-foreground":"text-muted-foreground"),children:z}),r.jsx("span",{className:"ml-3 shrink-0 text-xs text-muted-foreground",children:_?_.name:"Manual"})]}),le=ox(x,_),me=!!(x!=null&&x.parentPath);return r.jsxs("div",{className:U("relative inline-block",a==="composer"?"min-w-0 flex-1":"w-full"),ref:$,children:[a==="default"?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Working directory"}),ne]}):ne,m&&r.jsxs("div",{className:U("absolute z-50 mt-2 w-[360px] overflow-hidden rounded-2xl border border-border/60 bg-background/95 shadow-lg backdrop-blur",a==="composer"?"left-0":"left-0 right-0 w-auto min-w-[320px]"),children:[W.length>0&&r.jsxs("div",{className:"border-b border-border/60 px-3 py-2.5",children:[r.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[r.jsx(ud,{className:"h-3 w-3"}),"Recent"]}),r.jsx("div",{className:"flex flex-col gap-1",children:W.map(L=>r.jsx("button",{type:"button",onClick:()=>T(L,!1),className:"truncate rounded-md px-2 py-1 text-left font-mono text-xs text-foreground hover:bg-background/60",title:L,children:L},L))})]}),r.jsxs("div",{className:"flex items-center gap-2 border-b border-border/60 px-3 py-2",children:[r.jsx("button",{type:"button",onClick:()=>(x==null?void 0:x.parentPath)&&ce(x.parentPath),disabled:!me||p,className:"flex h-7 w-7 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:r.jsx($c,{className:"h-3.5 w-3.5"})}),r.jsx("div",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",title:le,children:le}),x&&r.jsx("button",{type:"button",onClick:()=>T(x.isAbsolute?x.currentPath:x.currentPath==="."?"":x.currentPath),className:"shrink-0 rounded-md px-2 py-1 text-[11px] font-medium text-foreground hover:bg-background/60",title:"Use this folder",children:"Use"})]}),r.jsxs("div",{className:"max-h-72 overflow-y-auto",children:[_?p?r.jsxs("div",{className:"flex items-center justify-center px-3 py-6 text-xs text-muted-foreground",children:[r.jsx(we,{className:"mr-2 h-3.5 w-3.5 animate-spin"}),"Loading..."]}):x&&x.entries.length>0?r.jsxs(r.Fragment,{children:[x.entries.map(L=>r.jsxs("div",{className:"group flex items-stretch border-b border-border/40 last:border-b-0",children:[r.jsxs("button",{type:"button",onClick:()=>T(L.path),className:"flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-left hover:bg-background/55",title:`Use ${L.path}`,children:[r.jsx(od,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"truncate text-sm text-foreground",children:L.name})]}),r.jsx("button",{type:"button",onClick:()=>ce(L.path),className:"flex w-16 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 ${L.name}`,children:r.jsx($r,{className:"h-4 w-4"})})]},L.path)),x.hasMore&&r.jsx("div",{className:"border-t border-border/60 p-2",children:r.jsxs(q,{type:"button",variant:"outline",size:"sm",onClick:ae,disabled:b,className:"h-8 w-full rounded-md text-xs",children:[b?r.jsx(we,{className:"mr-1.5 h-3 w-3 animate-spin"}):null,"Load more"]})})]}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:w??"No subfolders."}):r.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"Select a specific node to browse folders."}),w&&x&&x.entries.length>0&&r.jsx("div",{className:"border-t border-border/60 px-3 py-2 text-xs text-destructive",children:w})]}),r.jsx("div",{className:"flex items-center gap-1.5 border-t border-border/60 bg-background/40 px-3 py-2",children:k?r.jsxs(r.Fragment,{children:[r.jsx(Et,{value:S,onChange:L=>C(L.target.value),onKeyDown:L=>{L.key==="Enter"&&S.trim()?(L.preventDefault(),T(S)):L.key==="Escape"&&(L.preventDefault(),A(!1),C(e))},autoFocus:!0,placeholder:"Path (relative or absolute)",className:"h-8 flex-1 rounded-md border-border/60 bg-background/70 font-mono text-xs"}),r.jsx("button",{type:"button",onClick:()=>T(S),disabled:!S.trim(),className:"flex h-8 w-8 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:r.jsx(He,{className:"h-4 w-4"})}),r.jsx("button",{type:"button",onClick:()=>{A(!1),C(e)},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","aria-label":"Cancel manual path",children:r.jsx(St,{className:"h-4 w-4"})})]}):r.jsxs("button",{type:"button",onClick:()=>{C(e),A(!0)},className:"flex h-8 flex-1 items-center justify-between rounded-md px-2 text-xs text-muted-foreground hover:bg-background/60 hover:text-foreground",title:"Enter a manual path",children:[r.jsx("span",{children:"Manual input"}),r.jsx(Br,{className:"h-3.5 w-3.5"})]})})]})]})}function ax(e,t={}){const n=e.filter(s=>s.status==="online");return t.currentNodeRole!=="follower"||!t.leaderNodeId?n:n.filter(s=>s.id!==t.leaderNodeId)}function fo(){return ps.map(e=>r.jsx(be,{value:e.value,disabled:e.disabled,children:r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{children:e.label}),e.description&&r.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:e.description})]})},e.value))}function mo(){return bl.map(e=>r.jsx(be,{value:e.value,children:r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{children:e.label}),e.description&&r.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:e.description})]})},e.value))}function yl({isCurrent:e}){return e?r.jsx(pd,{className:"h-3.5 w-3.5 shrink-0 text-emerald-500 dark:text-emerald-400","aria-label":"current node"}):r.jsx(cd,{className:"h-3.5 w-3.5 shrink-0 text-sky-500 dark:text-sky-400","aria-label":"remote follower node"})}function po(e,t){return e.map(n=>{const s=!!t&&n.id===t;return r.jsx(be,{value:n.id,children:r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx(yl,{isCurrent:s}),r.jsx("span",{className:"truncate",children:n.name}),r.jsx("span",{className:"text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:s?"current":"remote"})]})},n.id)})}function ix(e){var t;return((t=ps.find(n=>n.value===e))==null?void 0:t.label)??e}function lx(e){var t;return((t=bl.find(n=>n.value===e))==null?void 0:t.label)??e}function wl(e,t,n=!1){const s=e.trim();if(s)return s;const o=t.trim().split(`
|
|
256
|
+
`).map(a=>a.trim()).find(Boolean);return o?o.length>72?`${o.slice(0,69).trimEnd()}...`:o:n?"Image task":""}function cx(e){const t=wl(e.title,e.description,e.images.length>0),n=e.description.trim()||t,s=e.mode??Pr,o=Do(e.description,e.images);return!t||!n||!e.agent?null:{title:t,description:n,agent:e.agent,project:e.project.trim()||null,payload:{initialMessage:o,mode:s},priority:e.priority,assignTo:e.assignTo==="auto"?void 0:e.assignTo}}function dx({nodes:e,currentNodeRole:t,currentNodeId:n,leaderNodeId:s,onCreated:o,onCancel:a,className:l,footerClassName:c,submitLabel:d="Create chat",cancelLabel:f="Cancel",autoFocus:u=!1,layout:m="default"}){const[h,x]=i.useState(""),[g,p]=i.useState(""),[v,b]=i.useState("claudecode"),[y,w]=i.useState(Pr),[j,S]=i.useState(""),[C,k]=i.useState("normal"),A=i.useMemo(()=>ax(e,{currentNodeRole:t,leaderNodeId:s}),[e,t,s]),R=i.useMemo(()=>{var H;return n&&A.some(fe=>fe.id===n)?n:((H=A[0])==null?void 0:H.id)??""},[A,n]),[D,$]=i.useState(R),[_,F]=i.useState(!1),[W,z]=i.useState(!1),{images:O,error:T,fileInputRef:I,pickImages:E,handleFileChange:ee,handlePaste:ce,removeImage:ae}=wa(),ne=i.useMemo(()=>A.find(H=>H.id===D)??null,[D,A]),le=!!(n&&(ne==null?void 0:ne.id)===n),me=ix(v),L=lx(y);i.useEffect(()=>{D&&A.some(H=>H.id===D)||$(R)},[D,A,R]),i.useEffect(()=>{S("")},[D]);const M=i.useCallback(async H=>{H.preventDefault();const fe=cx({title:h,description:g,agent:v,project:j,priority:C,assignTo:D,mode:y,images:O});if(fe){F(!0);try{const de=await pc(fe);o(de)}catch(de){he.error(de instanceof Error?de.message:"Failed to create task")}finally{F(!1)}}},[h,g,v,j,C,D,y,O,o]),B=wl(h,g,O.length>0),Q=!!(B&&v&&D&&(g.trim()||O.length>0)),K=i.useCallback(H=>{var fe;H.nativeEvent.isComposing||H.key==="Enter"&&(H.ctrlKey||H.metaKey)&&Q&&!_&&(H.preventDefault(),(fe=H.currentTarget.form)==null||fe.requestSubmit())},[Q,_]),X=O.length>0&&r.jsx("div",{className:"flex flex-wrap gap-3",children:O.map((H,fe)=>r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:Vr(H),alt:H.filename??`attachment ${fe+1}`,className:"h-24 w-24 rounded-2xl border border-border/70 object-cover"}),r.jsx("button",{type:"button",onClick:()=>ae(fe),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 ${H.filename??`image ${fe+1}`}`,children:r.jsx(St,{className:"h-3.5 w-3.5"})})]},`${H.filename??"image"}-${fe}`))}),G=r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Assign to"}),r.jsxs(Te,{value:D,onValueChange:$,children:[r.jsx(je,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:r.jsx(Ve,{placeholder:"Select node"})}),r.jsx(ke,{children:po(A,n)})]})]}),oe=r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Agent"}),r.jsxs(Te,{value:v,onValueChange:b,children:[r.jsx(je,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:r.jsx(Ve,{placeholder:"Select agent"})}),r.jsx(ke,{children:fo()})]})]}),xe=r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Mode"}),r.jsxs(Te,{value:y,onValueChange:H=>w(H),children:[r.jsx(je,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:r.jsx(Ve,{placeholder:"Select mode"})}),r.jsx(ke,{children:mo()})]})]}),ve=r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{className:"text-sm font-medium",children:"Priority"}),r.jsxs(Te,{value:C,onValueChange:k,children:[r.jsx(je,{className:"h-11 rounded-2xl border-border/70 bg-background/70",children:r.jsx(Ve,{placeholder:"Select priority"})}),r.jsxs(ke,{children:[r.jsx(be,{value:"low",children:"Low"}),r.jsx(be,{value:"normal",children:"Normal"}),r.jsx(be,{value:"high",children:"High"}),r.jsx(be,{value:"critical",children:"Critical"})]})]})]}),Ne=r.jsx(uo,{value:j,onChange:S,assignTo:D,nodes:e,assignableNodes:A});return m==="composer"?r.jsxs("form",{onSubmit:M,className:U("space-y-4",l),children:[r.jsx("input",{ref:I,type:"file",accept:"image/*",multiple:!0,onChange:ee,className:"hidden"}),(()=>{const H="chat-composer__chip h-9 w-auto gap-1.5 rounded-full px-3.5 text-xs shadow-none transition-colors",fe="border-transparent bg-transparent text-muted-foreground hover:bg-background/40 hover:text-foreground",de="border-border/70 bg-background/55 text-foreground",zn=v==="claudecode",mt=y===Pr;return r.jsxs("div",{className:"chat-composer relative rounded-[24px] border border-border/60 bg-background/45 shadow-[0_20px_80px_-40px_rgba(0,0,0,0.6)]",children:[r.jsxs("div",{className:"chat-composer__header flex min-w-0 items-center justify-between gap-3 px-4 pt-3",children:[r.jsxs(Te,{value:D,onValueChange:$,children:[r.jsx(je,{className:U(H,de,"chat-composer__node-trigger border-transparent bg-transparent hover:bg-background/40"),title:`Assigned node: ${(ne==null?void 0:ne.name)??"unassigned"}`,"aria-label":`Assigned node: ${(ne==null?void 0:ne.name)??"unassigned"}`,children:ne?r.jsxs(r.Fragment,{children:[r.jsx(yl,{isCurrent:le}),r.jsx("span",{className:"min-w-0 truncate",children:ne.name}),r.jsx("span",{className:"chat-composer__header-meta shrink-0 text-[10px] uppercase tracking-[0.18em] text-muted-foreground",children:le?"current":"remote"})]}):r.jsx(Ve,{placeholder:"Select node"})}),r.jsx(ke,{children:po(A,n)})]}),W?r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(Et,{id:"task-title-composer",type:"text",value:h,onChange:Re=>x(Re.target.value),onKeyDown:Re=>{(Re.key==="Enter"||Re.key==="Escape")&&(Re.preventDefault(),z(!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"}),r.jsx(q,{type:"button",variant:"ghost",size:"icon",onClick:()=>z(!1),"aria-label":"Save title",className:"h-8 w-8 shrink-0 rounded-full text-muted-foreground hover:text-foreground",children:r.jsx(He,{className:"h-3.5 w-3.5"})})]}):r.jsxs("button",{type:"button",onClick:()=>z(!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:B||"Title","aria-label":B?`Edit title: ${B}`:"Edit title",children:[r.jsx("span",{className:"chat-composer__title-text max-w-[220px] truncate",children:B||"Title"}),r.jsx(Br,{className:"h-3 w-3 shrink-0"})]})]}),r.jsx("textarea",{id:"task-description",value:g,onChange:Re=>p(Re.target.value),onKeyDown:K,onPaste:ce,placeholder:"Ask anything...",rows:4,autoFocus:u,"aria-label":"Opening prompt",className:"min-h-[140px] w-full resize-none rounded-[24px] bg-transparent px-5 pt-2 pb-16 text-[15px] leading-7 text-foreground ring-offset-background placeholder:text-muted-foreground/70 focus-visible:outline-none"}),r.jsxs("div",{className:"chat-composer__rail absolute bottom-3 left-3 right-3 flex flex-nowrap items-center gap-2",children:[r.jsx(q,{type:"button",variant:"ghost",size:"icon",onClick:E,"aria-label":"Add images",className:"h-9 w-9 shrink-0 rounded-full text-muted-foreground hover:text-foreground",children:r.jsx(hr,{className:"h-4 w-4"})}),r.jsx("span",{className:"mx-0.5 h-5 w-px bg-border/60","aria-hidden":!0}),r.jsx(uo,{value:j,onChange:S,assignTo:D,nodes:e,assignableNodes:A,layout:"composer",chipClassName:H,chipActiveClassName:de,chipInactiveClassName:fe,triggerClassName:"chat-composer__icon-trigger",labelClassName:"chat-composer__footer-label"}),r.jsxs(Te,{value:v,onValueChange:b,children:[r.jsxs(je,{className:U(H,"chat-composer__icon-trigger",zn?fe:de),title:`Agent: ${me}`,"aria-label":`Agent: ${me}`,children:[r.jsx(Lr,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"chat-composer__footer-label truncate",children:me})]}),r.jsx(ke,{children:fo()})]}),r.jsxs(Te,{value:y,onValueChange:Re=>w(Re),children:[r.jsxs(je,{className:U(H,"chat-composer__icon-trigger",mt?fe:de),title:`Mode: ${L}`,"aria-label":`Mode: ${L}`,children:[r.jsx(Od,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"chat-composer__footer-label truncate",children:L})]}),r.jsx(ke,{children:mo()})]}),r.jsxs("div",{className:"ml-auto flex shrink-0 items-center gap-2",children:[r.jsxs(Te,{value:C,onValueChange:k,children:[r.jsx(je,{"aria-label":`Priority: ${C}`,title:`Priority: ${C}`,className:U("h-9 w-9 justify-center gap-0 rounded-full p-0 text-xs shadow-none [&>svg:last-child]:hidden",C==="normal"?"border-transparent bg-transparent text-muted-foreground hover:bg-background/40":"border-border/70 bg-background/55",C==="critical"&&"text-destructive",C==="high"&&"text-amber-600 dark:text-amber-400",C==="low"&&"text-muted-foreground"),children:r.jsx(td,{className:U("h-4 w-4",C==="critical"&&"fill-destructive/20")})}),r.jsxs(ke,{children:[r.jsx(be,{value:"low",children:"Low"}),r.jsx(be,{value:"normal",children:"Normal"}),r.jsx(be,{value:"high",children:"High"}),r.jsx(be,{value:"critical",children:"Critical"})]})]}),a&&r.jsxs(q,{type:"button",variant:"ghost",size:"sm",onClick:a,"aria-label":f,className:"chat-composer__cancel h-9 rounded-full px-4 text-xs text-muted-foreground",children:[r.jsx(St,{className:"chat-composer__cancel-icon h-4 w-4 shrink-0"}),r.jsx("span",{className:"chat-composer__footer-label",children:f})]}),r.jsxs(q,{type:"submit",size:"icon",disabled:!Q||_,className:"h-10 w-10 rounded-full shadow-[0_8px_30px_-8px_hsl(var(--primary)/0.6)]",children:[_?r.jsx(we,{className:"h-4 w-4 animate-spin"}):r.jsx(To,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:_?"Creating chat":d})]})]})]})]})})(),(X||T)&&r.jsxs("div",{className:"space-y-3 rounded-[20px] border border-border/60 bg-background/45 p-4",children:[X,T&&r.jsx("div",{className:"text-xs text-destructive",children:T}),!T&&r.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."})]})]}):r.jsxs("form",{onSubmit:M,className:U("space-y-5",l),children:[r.jsx("input",{ref:I,type:"file",accept:"image/*",multiple:!0,onChange:ee,className:"hidden"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"task-description",className:"text-sm font-medium",children:"Opening prompt"}),r.jsx("textarea",{id:"task-description",value:g,onChange:H=>p(H.target.value),onKeyDown:K,onPaste:ce,placeholder:"Describe what the agent should do. This becomes the first message in the chat.",rows:6,autoFocus:u,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"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsxs(q,{type:"button",variant:"outline",onClick:E,className:"rounded-2xl",children:[r.jsx(hr,{className:"h-4 w-4"}),"Add images"]}),r.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,T&&r.jsx("p",{className:"text-xs text-destructive",children:T})]}),r.jsxs("div",{className:"grid gap-5 lg:grid-cols-[minmax(0,1fr)_220px_220px]",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ue,{htmlFor:"task-title",className:"text-sm font-medium",children:"Chat title"}),r.jsx(Et,{id:"task-title",type:"text",value:h,onChange:H=>x(H.target.value),placeholder:"Optional. Leave blank to derive it from the prompt.",className:"h-11 rounded-2xl border-border/70 bg-background/70"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:B?`Will appear as: ${B}`:"A title will be generated from the first line of the prompt."})]}),oe,xe]}),Ne,r.jsxs("div",{className:"grid gap-5 md:grid-cols-2",children:[ve,G]}),r.jsxs("div",{className:U("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",c),children:[a&&r.jsx(q,{type:"button",variant:"ghost",onClick:a,className:"rounded-2xl",children:f}),r.jsx(q,{type:"submit",disabled:!Q||_,className:"rounded-2xl px-5",children:_?"Creating...":d})]})]})}const ux=[{value:"active",label:"Active"},{value:"running",label:"Running"},{value:"waiting",label:"Waiting"},{value:"closed",label:"Closed"},{value:"archived",label:"Archived"}],En=new Set(["pending","assigned"]),Nl=new Set(["running"]),fx=new Set(["completed","failed","cancelled"]);function mx(e,t){switch(t){case"running":return Nl.has(e.status);case"waiting":return En.has(e.status);case"closed":return fx.has(e.status);case"archived":return e.status==="archived";case"active":default:return e.status!=="archived"}}function px(e,t){const n=t.trim().toLowerCase();return n?[e.title,e.description,e.id,e.agent,e.assignedTo??"",e.assignedNodeName??"",e.project??"",e.effectiveProjectPath??""].some(s=>s.toLowerCase().includes(n)):!0}function hs(e,t,n){if(!e)return"unassigned";const s=t==null?void 0:t.find(o=>o.id===e);return(s==null?void 0:s.name)??n??e.slice(0,8)}function hx(e,t,n){return hs(e,t,n).toLowerCase()}function xx(e,t){return[...e].sort((n,s)=>n.id===t?-1:s.id===t?1:n.name.localeCompare(s.name))}function gx(e){if(!e||typeof e!="object")return null;const t=e;return{draftNewTask:t.draftNewTask===!0,returnRoute:typeof t.returnRoute=="string"?t.returnRoute:void 0,returnTaskId:typeof t.returnTaskId=="string"||t.returnTaskId===null?t.returnTaskId:void 0}}function vx(e){switch(e){case"running":return"bg-amber-500";case"completed":return"bg-emerald-500";case"failed":return"bg-destructive";case"cancelled":case"archived":return"bg-slate-400";case"assigned":return"bg-teal-500";case"pending":default:return"bg-muted-foreground"}}function bx(e){return e==="default workspace"?e:e.replace(/\\/g,"/").split("/").filter(Boolean).at(-1)??e}function yx(e){if(e==="default workspace")return"Uses the node default workspace";const t=e.replace(/\\/g,"/"),n=t.split("/").filter(Boolean);return n.length<=3?t:`.../${n.slice(-3).join("/")}`}function wx(e){const t=Date.now()-e;return t<6e4?"just now":t<36e5?`${Math.floor(t/6e4)}m`:t<864e5?`${Math.floor(t/36e5)}h`:`${Math.floor(t/864e5)}d`}function Nx(e){return new Date(e).toLocaleString()}function jx(e){const t=Math.floor(e/1e3),n=Math.floor(t/3600),s=Math.floor(t%3600/60),o=t%60;return`${String(n).padStart(2,"0")}:${String(s).padStart(2,"0")}:${String(o).padStart(2,"0")}`}async function Tt(e,t="Copied to clipboard"){var n,s,o;try{if((s=(n=globalThis.navigator)==null?void 0:n.clipboard)!=null&&s.writeText)return await globalThis.navigator.clipboard.writeText(e),he.success(t),!0;const a=globalThis.document,l=(o=a==null?void 0:a.execCommand)==null?void 0:o.bind(a);if(!(a!=null&&a.body)||typeof a.createElement!="function"||typeof l!="function")throw new Error("Clipboard access is unavailable");const c=a.createElement("textarea"),d=a.activeElement,f=d&&typeof d.focus=="function"?d:null;c.value=e,c.setAttribute("readonly","true"),c.style.position="fixed",c.style.opacity="0",c.style.pointerEvents="none",a.body.appendChild(c),c.select(),c.setSelectionRange(0,c.value.length);const u=l("copy");if(a.body.removeChild(c),f==null||f.focus(),!u)throw new Error("Clipboard access is unavailable");return he.success(t),!0}catch(a){return he.error(a instanceof Error?a.message:"Failed to copy"),!1}}function yt({label:e,value:t}){return r.jsxs("div",{className:"min-w-[7.25rem] flex-1 rounded-[20px] border border-border/60 bg-background/45 px-3 py-3",children:[r.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:e}),r.jsx("div",{className:"mt-1 text-lg font-semibold tracking-tight text-foreground",children:t})]})}function ur({label:e}){return r.jsx("div",{className:"flex h-64 items-center justify-center text-sm text-muted-foreground",children:e})}function De({label:e,value:t,mono:n,action:s}){return r.jsxs("div",{className:"grid grid-cols-[5.25rem,minmax(0,1fr)] items-start gap-3",children:[r.jsx("span",{className:"pt-0.5 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:e}),r.jsxs("div",{className:"flex min-w-0 items-start gap-2",children:[r.jsx("span",{className:U("min-w-0 flex-1 break-all text-sm text-foreground",n&&"font-mono text-[11px] leading-5"),children:t}),s]})]})}function Mr({label:e,value:t,mono:n}){return r.jsxs("div",{className:"rounded-[18px] border border-border/60 bg-background/60 px-3 py-3",children:[r.jsx("div",{className:"text-[10px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:e}),r.jsx("div",{className:U("mt-1 text-sm font-medium text-foreground",n&&"font-mono text-[11px]"),children:t})]})}function jl({capabilities:e,action:t}){return r.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[r.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Capabilities"}),r.jsx("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:e.length>0?e.map(n=>r.jsx(Ce,{variant:"secondary",className:"rounded-full",children:n},n)):r.jsx("span",{className:"text-sm text-muted-foreground",children:"None declared"})})]}),t&&r.jsx("div",{className:"shrink-0 self-start",children:t})]})}const kx=i.lazy(async()=>({default:(await Ir(()=>import("./FilesTab-CAn0AzU2.js"),__vite__mapDeps([0,1,2,3]))).FilesTab})),Sx=i.lazy(async()=>({default:(await Ir(()=>import("./PreviewTab-DJioFwMU.js"),__vite__mapDeps([4,1,2]))).PreviewTab})),Cx=i.lazy(async()=>({default:(await Ir(()=>import("./DiffTab-CZv-9g4j.js"),__vite__mapDeps([5,1,2,3]))).DiffTab}));function Ex({onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l,activeTab:c,setActiveTab:d,creatingTask:f,activeTask:u,assignedNode:m,taskLoading:h,taskError:x,displayEvents:g,hasUserMessageInLogs:p,initialPrompt:v,supportsFollowUp:b,taskUnavailable:y,chatDisabled:w,chatDisabledReason:j,questionBypassEnabled:S,isRunning:C,hasPendingFollowUp:k,canCancel:A,canRetry:R,onRetry:D,onCancel:$,onStartCreateTask:_,onCancelCreateTask:F,onCreateTask:W,onSendMessage:z,onQuestionBypassChange:O,onSubmitQuestionResponse:T,messagesEndRef:I}){const[E,ee]=i.useState(!1),[ce,ae]=i.useState(!1),[ne,le]=i.useState(!1),me=i.useRef(0),L=i.useRef(!1),M=i.useCallback(G=>{const oe=G.currentTarget,xe=me.current;if(me.current=oe.scrollTop,L.current)return;if(oe.scrollHeight-oe.scrollTop-oe.clientHeight<30){ae(!1),L.current=!0,setTimeout(()=>{L.current=!1},300);return}oe.scrollTop<xe&&xe-oe.scrollTop>10&&ae(!0),oe.scrollTop<=0&&ae(!0)},[]),B=(u==null?void 0:u.effectiveProjectPath)??(u==null?void 0:u.project)??"default workspace",Q=u?(m==null?void 0:m.name)??hs(u.assignedTo,a==null?void 0:a.nodes,u.assignedNodeName):"unassigned",K=u?[{label:"Working dir",value:B,mono:!0},{label:"Agent",value:u.agent,mono:!0},{label:"Node",value:Q}]:[],X=u!=null&&u.description&&u.description!==u.title?u.description:null;return f?r.jsx(Ax,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l,onCancel:F,onCreated:W}):!u&&h?r.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:[r.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:r.jsx(un,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),r.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-y-auto px-6 py-10 sm:px-8",children:r.jsxs("div",{className:"space-y-4 text-center",children:[r.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:r.jsx(we,{className:"h-7 w-7 animate-spin"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("h2",{className:"text-2xl font-semibold tracking-tight text-foreground",children:"Loading conversation"}),r.jsxs("div",{className:"flex items-center justify-center gap-3 text-sm text-muted-foreground",children:[r.jsx(we,{className:"h-4 w-4 animate-spin"}),"Fetching the selected chat thread..."]})]})]})})]}):u?r.jsxs(za,{value:c,onValueChange:d,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:[r.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-2.5 sm:px-5",children:[r.jsx("div",{className:"flex items-center gap-3",children:r.jsx(un,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),r.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[r.jsx("h2",{className:"min-w-0 truncate text-base font-semibold tracking-tight text-foreground sm:text-lg",title:u.title,children:u.title}),r.jsx(No,{status:u.status}),r.jsx(hc,{priority:u.priority}),r.jsx(q,{variant:"ghost",size:"icon",className:"ml-auto h-6 w-6 shrink-0 rounded-full text-muted-foreground",onClick:()=>ee(G=>!G),children:E?r.jsx(Fr,{className:"h-3.5 w-3.5"}):r.jsx(Rt,{className:"h-3.5 w-3.5"})})]}),E&&r.jsxs("div",{className:"mt-2 space-y-2",children:[X&&r.jsx("p",{className:"max-w-3xl text-sm leading-5 text-muted-foreground",children:X}),x&&r.jsx("div",{className:"w-fit rounded-full border border-destructive/25 bg-destructive/10 px-3 py-1 text-xs text-destructive",children:x}),r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex flex-col text-xs text-muted-foreground",children:[r.jsxs("span",{children:["updated ",Nx(u.updatedAt)]}),r.jsx("span",{className:"font-mono",children:u.id.slice(0,8)})]}),r.jsx("div",{className:"flex items-center gap-2",children:R&&r.jsxs(q,{variant:"outline",size:"sm",onClick:D,className:"shrink-0 rounded-full",children:[r.jsx(Ed,{className:"h-3.5 w-3.5"}),"Retry"]})})]})]}),r.jsxs("div",{className:"mt-2 flex items-center gap-3",children:[r.jsxs(ss,{className:"h-auto max-w-full overflow-x-auto rounded-full bg-muted/70 p-1",children:[r.jsx(Xe,{value:"transcript",className:"rounded-full px-2.5 sm:px-4",children:"Transcript"}),r.jsx(Xe,{value:"files",className:"rounded-full px-2.5 sm:px-4",children:"Files"}),r.jsx(Xe,{value:"preview",className:"rounded-full px-2.5 sm:px-4",children:"Preview"}),r.jsx(Xe,{value:"diff",className:"rounded-full px-2.5 sm:px-4",children:"Diff"})]}),C&&r.jsx(Ce,{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"}),k&&r.jsx(Ce,{variant:"outline",className:"hidden rounded-full border-primary/30 bg-primary/10 text-primary sm:inline-flex",children:"Queued"}),y&&r.jsx(Ce,{variant:"outline",className:"hidden rounded-full border-destructive/25 bg-destructive/10 text-destructive sm:inline-flex",children:"Unavailable"})]})]}),r.jsx(Je,{value:"transcript",className:"mt-0 min-h-0 flex-1",children:r.jsxs("div",{className:"relative flex h-full min-h-0 flex-col",children:[r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-5",onScroll:M,children:r.jsxs("div",{className:"mx-auto flex max-w-[72rem] flex-col gap-5",children:[v&&!p&&r.jsx(Ys,{event:v,questionBypassEnabled:S,onQuestionBypassChange:O,onSubmitQuestionResponse:T,questionResponseDisabled:!b||w}),g.map((G,oe)=>r.jsx(Ys,{event:G,questionBypassEnabled:S,onQuestionBypassChange:O,onSubmitQuestionResponse:T,questionResponseDisabled:!b||w},bu("transcript",G,oe))),g.length===0&&r.jsxs("div",{className:"rounded-[28px] border border-dashed border-border/70 bg-background/35 px-5 py-8 text-center",children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:"Transcript is warming up"}),r.jsx("div",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:h?"Fetching task output...":"The opening prompt has been stored, but the agent has not emitted conversation output yet."})]}),(!b&&u.result||u.error)&&r.jsxs("div",{className:"space-y-3",children:[!b&&u.result&&r.jsxs("div",{className:"rounded-[26px] border border-border/70 bg-card/80 px-4 py-4",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Stored result"}),r.jsx("pre",{className:"mt-3 overflow-x-auto whitespace-pre-wrap text-xs leading-5 text-muted-foreground",children:JSON.stringify(u.result,null,2)})]}),u.error&&r.jsxs("div",{className:"rounded-[26px] border border-destructive/20 bg-destructive/10 px-4 py-4 text-destructive",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em]",children:"Stored error"}),r.jsx("pre",{className:"mt-3 overflow-x-auto whitespace-pre-wrap text-xs leading-5",children:u.error})]})]}),(C||k)&&g.length>0&&r.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:[r.jsx(we,{className:"h-4 w-4 animate-spin"}),"The agent is still working on this conversation."]}),r.jsx("div",{ref:I})]})}),b?ce?r.jsx(q,{size:"icon",onClick:()=>ae(!1),className:"absolute bottom-4 right-4 z-10 h-12 w-12 rounded-full shadow-lg",children:r.jsx(Br,{className:"h-5 w-5"})}):r.jsx("div",{className:"shrink-0",children:r.jsx("div",{className:"mx-auto w-full max-w-[72rem]",children:r.jsx(dm,{onSend:z,disabled:w,disabledReason:j,contextItems:K,placeholder:w?j:"Continue the conversation...",running:C||k,onStop:A?()=>le(!0):void 0})})}):r.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."})]})}),r.jsx(Je,{value:"files",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:r.jsx(i.Suspense,{fallback:r.jsx(ur,{label:"Loading files..."}),children:r.jsx(kx,{taskId:u.id})})}),r.jsx(Je,{value:"preview",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:r.jsx(i.Suspense,{fallback:r.jsx(ur,{label:"Loading preview..."}),children:r.jsx(Sx,{taskId:u.id})})}),r.jsx(Je,{value:"diff",className:"mt-0 min-h-0 flex-1 overflow-hidden",children:r.jsx(i.Suspense,{fallback:r.jsx(ur,{label:"Loading diff..."}),children:r.jsx(Cx,{taskId:u.id})})}),r.jsx(jr,{open:ne,onOpenChange:le,children:r.jsxs(hn,{children:[r.jsxs(xn,{children:[r.jsx(vn,{children:"Stop this task?"}),r.jsx(bn,{children:"The task will stop and move to a cancelled state."})]}),r.jsxs(gn,{children:[r.jsx(wn,{children:"Keep running"}),r.jsx(yn,{onClick:$,children:"Stop task"})]})]})})]}):r.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:[r.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:r.jsx(un,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),r.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-y-auto px-6 py-10 sm:px-8",children:r.jsxs("div",{className:"w-full max-w-2xl text-center",children:[r.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:r.jsx(Lr,{className:"h-7 w-7"})}),r.jsx("h2",{className:"mt-5 text-xl font-semibold tracking-tight text-foreground sm:text-3xl",children:"No chat selected"}),r.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 to create a fresh chat thread."}),r.jsxs(q,{onClick:_,className:"mt-6 rounded-full px-5",children:[r.jsx(Co,{className:"h-4 w-4"}),"Start new chat"]}),x&&r.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:x})]})})]})}function Ax({onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l,onCancel:c,onCreated:d}){var f,u,m;return r.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:[r.jsx("div",{className:"shrink-0 border-b border-border/60 px-4 py-4 sm:px-5",children:r.jsx(un,{onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l})}),r.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:r.jsx("div",{className:"w-full max-w-2xl",children:r.jsx(dx,{nodes:(a==null?void 0:a.nodes)??[],currentNodeRole:(f=a==null?void 0:a.self)==null?void 0:f.role,currentNodeId:((u=a==null?void 0:a.self)==null?void 0:u.id)??null,leaderNodeId:((m=a==null?void 0:a.leader)==null?void 0:m.id)??null,onCreated:d,onCancel:c,submitLabel:"Start chat",autoFocus:!0,layout:"composer"})})})]})}function un({onToggleTasks:e,desktopTasksOpen:t,mobileTasksPanelOpen:n,operationsOpen:s,onToggleOperations:o,cluster:a,sseConnected:l}){var c;return r.jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[r.jsx(Tx,{desktopTasksOpen:t,mobileTasksPanelOpen:n,onToggleTasks:e}),r.jsx(Ce,{variant:"outline",className:"hidden rounded-full border-border/70 bg-background/60 sm:inline-flex",children:l?"Live":"Retrying"}),((c=a==null?void 0:a.leader)==null?void 0:c.name)&&r.jsxs(Ce,{variant:"outline",className:"hidden rounded-full border-border/70 bg-background/60 sm:inline-flex",children:["leader ",a.leader.name]})]}),r.jsxs(q,{variant:"outline",onClick:o,className:"shrink-0 rounded-full border-border/70 bg-background/60 px-3 sm:px-4",children:[s?r.jsx(Ao,{className:"h-4 w-4"}):r.jsx(kd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:s?"Hide cluster":"Show cluster"})]})]})}function Tx({desktopTasksOpen:e,mobileTasksPanelOpen:t,onToggleTasks:n}){var o,a;const s=(a=(o=globalThis.window)==null?void 0:o.matchMedia("(min-width: 1024px)"))!=null&&a.matches?e:t;return r.jsxs(q,{variant:"outline",onClick:n,className:"rounded-full border-border/70 bg-background/60 px-3 sm:px-4",children:[s?r.jsx(Eo,{className:"h-4 w-4"}):r.jsx(wd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:s?"Hide tasks":"Show tasks"})]})}const Rx={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 _x(e){return e.split(".")[0]??"unknown"}function Px(e){return new Date(e).toLocaleTimeString("en-US",{hour12:!1})}function fr(e,t){return(t==null?void 0:t.get(e))??e}function Dx(e,t){const n=e.data;switch(e.type){case"node.joined":return`${n.name} joined the cluster`;case"node.left":return`${fr(n.nodeId,t)} left (${n.reason})`;case"node.status":return`${fr(n.nodeId,t)} is now ${n.status}`;case"task.created":return`"${n.title}" created`;case"task.assigned":return`task assigned to ${fr(n.nodeId,t)}`;case"task.status":return`task ${n.taskId.slice(0,8)} -> ${n.status}`;case"election.started":return`candidate ${n.candidateId.slice(0,8)} term ${n.term}`;case"election.complete":return`leader elected, term ${n.term}`;case"cluster.state":return`${n.nodeCount} nodes, term ${n.term}`;default:return JSON.stringify(n)}}function Mx(e){return JSON.stringify(e,null,2)}function Ox({events:e,maxHeight:t="400px",emptyTitle:n="No live events yet",emptyDescription:s="Cluster activity appears here as it happens.",nodeNameById:o}){return e.length===0?r.jsx("div",{className:"flex h-28 items-center justify-center rounded-[20px] border border-dashed border-border/70 bg-background/40 text-center",children:r.jsxs("div",{children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:n}),r.jsx("div",{className:"mt-1 text-xs text-muted-foreground/70",children:s})]})}):r.jsx("div",{className:"overflow-y-auto pr-1",style:{maxHeight:t},children:r.jsx("div",{className:"space-y-2",children:e.map(a=>{const l=_x(a.type);return r.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:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"font-mono text-[11px] text-muted-foreground",children:Px(a.timestamp)}),r.jsx(Ce,{variant:"outline",className:U("w-fit text-[10px] font-medium uppercase tracking-[0.16em]",Rx[l]),children:a.type})]}),r.jsx(q,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 rounded-full text-muted-foreground",onClick:()=>void Tt(Mx(a),"Event copied"),"aria-label":`Copy ${a.type} event`,title:"Copy event",children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})]}),r.jsx("div",{className:"text-sm leading-6 text-foreground/85",children:Dx(a,o)})]})},a.id)})})})}function ho({cluster:e,systemInfo:t,nodeNameById:n,nodeBlockingTaskCounts:s,eventTypeFilter:o,onEventTypeFilterChange:a,eventTypeOptions:l,filteredEvents:c,sseConnected:d,clusterLoading:f,clusterError:u,electionPending:m,onTriggerElection:h,promotePending:x,onPromote:g,onAddNode:p,leavePending:v,onLeaveCluster:b,onToggleNodeDevTunnel:y,devTunnelNodeId:w,onClose:j}){var _,F,W,z,O;const S=((_=e==null?void 0:e.self)==null?void 0:_.role)==="leader",C=((F=e==null?void 0:e.self)==null?void 0:F.role)==="follower"&&!(e!=null&&e.leader),k=(e==null?void 0:e.self)??null,R=xx((e==null?void 0:e.nodes)??[],k==null?void 0:k.id).filter(T=>T.id!==(k==null?void 0:k.id)),D=(k==null?void 0:k.role)==="leader"&&R.length===0,$=(k==null?void 0:k.role)==="follower"&&!!(e!=null&&e.leader);return r.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:r.jsxs(za,{defaultValue:"overview",className:"flex h-full min-h-0 flex-col",children:[r.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-semibold tracking-tight",children:"Operations"}),r.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Node, cluster, and live events."})]}),r.jsx(q,{variant:"ghost",size:"icon",onClick:j,className:"rounded-full",children:r.jsx(Ao,{className:"h-4 w-4"})})]}),r.jsxs(ss,{className:"mt-4 grid h-auto w-full grid-cols-3 rounded-full bg-muted/70 p-1",children:[r.jsx(Xe,{value:"overview",className:"rounded-full px-3 text-xs",children:"Overview"}),r.jsx(Xe,{value:"nodes",className:"rounded-full px-3 text-xs",children:"Nodes"}),r.jsx(Xe,{value:"events",className:"rounded-full px-3 text-xs",children:"Live events"})]})]}),r.jsx(Je,{value:"overview",className:"mt-0 min-h-0 flex-1",children:r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto px-4 py-5",children:r.jsxs("div",{className:"space-y-7",children:[k&&r.jsx(xo,{node:k,systemInfo:t,blockingTaskCount:s.get(k.id)??0,devTunnelNodeId:w,onToggleNodeDevTunnel:y,showActions:!1,defaultExpanded:!1}),r.jsxs("section",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:"Cluster snapshot"}),r.jsx(Ce,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:d?"Connected":"Reconnecting"})]}),f&&!e?r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(we,{className:"h-4 w-4 animate-spin"}),"Loading cluster state..."]}):u&&!e?r.jsx("div",{className:"rounded-[22px] border border-destructive/20 bg-destructive/10 px-4 py-3 text-sm text-destructive",children:u}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(yt,{label:"Term",value:String((e==null?void 0:e.term)??0)}),r.jsx(yt,{label:"Nodes",value:String((e==null?void 0:e.nodes.length)??0)}),r.jsx(yt,{label:"Pending",value:String((e==null?void 0:e.taskSummary.pending)??0)}),r.jsx(yt,{label:"Running",value:String((e==null?void 0:e.taskSummary.running)??0)}),r.jsx(yt,{label:"Completed",value:String((e==null?void 0:e.taskSummary.completed)??0)}),r.jsx(yt,{label:"Failed",value:String((e==null?void 0:e.taskSummary.failed)??0)})]}),r.jsxs("div",{className:"space-y-3 rounded-[24px] border border-border/60 bg-background/45 px-4 py-4",children:[r.jsx(De,{label:"Leader",value:((W=e==null?void 0:e.leader)==null?void 0:W.name)??"None"}),r.jsx(De,{label:"Leader URL",value:((z=e==null?void 0:e.leader)==null?void 0:z.endpoint)??"Unavailable",mono:!0,action:(O=e==null?void 0:e.leader)!=null&&O.endpoint?r.jsx(Kt,{label:"Copy leader URL",onClick:()=>{var T;return void Tt(((T=e.leader)==null?void 0:T.endpoint)??"","Leader URL copied")}}):void 0}),r.jsx(De,{label:"Feed",value:d?"Receiving live updates":"Reconnecting to event stream"})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[S&&r.jsxs(q,{variant:"outline",size:"sm",onClick:h,disabled:m,className:"rounded-full",children:[m&&r.jsx(we,{className:"h-3.5 w-3.5 animate-spin"}),"Trigger election"]}),C&&r.jsxs(q,{variant:"outline",size:"sm",onClick:g,disabled:x,className:"rounded-full",children:[x&&r.jsx(we,{className:"h-3.5 w-3.5 animate-spin"}),"Promote self"]})]})]})]})]})})}),r.jsx(Je,{value:"nodes",className:"mt-0 min-h-0 flex-1",children:r.jsx("div",{className:"flex h-full min-h-0 flex-col overflow-y-auto px-4 py-5",children:r.jsxs("div",{className:"space-y-7",children:[r.jsxs("section",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-sm font-medium text-foreground",children:"This node"}),D?r.jsx(q,{variant:"outline",size:"sm",onClick:p,className:"rounded-full",children:"Join node"}):$?r.jsxs(q,{variant:"outline",size:"sm",onClick:b,disabled:v,className:"rounded-full",children:[v&&r.jsx(we,{className:"h-3.5 w-3.5 animate-spin"}),"Leave cluster"]}):null]}),k&&r.jsx(xo,{node:k,systemInfo:t,blockingTaskCount:s.get(k.id)??0,devTunnelNodeId:w,onToggleNodeDevTunnel:y,showActions:!0,defaultExpanded:!0})]}),r.jsxs("section",{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm font-medium text-foreground",children:["Peer nodes (",R.length,")"]}),R.length>0?r.jsx("div",{className:"space-y-3",children:R.map(T=>r.jsx(Ix,{node:T,isLeader:!!S,blockingTaskCount:s.get(T.id)??0,devTunnelNodeId:w,onToggleNodeDevTunnel:y},T.id))}):r.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."})]})]})})}),r.jsx(Je,{value:"events",className:"mt-0 min-h-0 flex-1",children:r.jsxs("div",{className:"flex h-full min-h-0 flex-col px-4 py-5",children:[r.jsxs("div",{className:"mb-4 space-y-3",children:[r.jsx("div",{children:r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[r.jsx(xc,{className:U("h-4 w-4",d?"text-emerald-500":"text-destructive")}),"Live events"]})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(Te,{value:o,onValueChange:a,children:[r.jsx(je,{className:"h-9 min-w-[11rem] flex-1 rounded-full border-border/70 bg-background/55 text-[12px] sm:max-w-[15rem]",children:r.jsx(Ve,{placeholder:"Event type"})}),r.jsx(ke,{children:l.map(T=>r.jsx(be,{value:T,className:"text-[12px]",children:T==="all"?"All event types":T},T))})]}),r.jsx(Ce,{variant:"outline",className:"rounded-full border-border/70 bg-background/60",children:d?"Connected":"Reconnecting"})]})]}),r.jsx("div",{className:"min-h-0 flex-1",children:r.jsx(Ox,{events:c,maxHeight:"100%",emptyTitle:o==="all"?"No live events yet":"No matching events",emptyDescription:o==="all"?"Cluster activity appears here as it happens.":`No "${o}" events are in the current stream.`,nodeNameById:n})})]})})]})})}function xo({node:e,systemInfo:t,blockingTaskCount:n,devTunnelNodeId:s,onToggleNodeDevTunnel:o,showActions:a=!0,defaultExpanded:l=!1}){const[c,d]=i.useState(l),f=(t==null?void 0:t.dashboardOrigin)??e.dashboardOrigin,u=e.devtunnelEndpoint??e.endpoint,m=f??e.endpoint,h=(t==null?void 0:t.workDir)??e.workDir,x=Po(e,t==null?void 0:t.transportType),g=Ur(e,t==null?void 0:t.transportType),p=g&&_t((t==null?void 0:t.transportType)??e.transportType)?!0:_o(e,t==null?void 0:t.transportType),v=n>0;return r.jsxs("section",{className:"rounded-[28px] border border-primary/20 bg-primary/8 shadow-[0_24px_80px_-60px_hsl(var(--primary)/0.9)]",children:[r.jsxs("button",{type:"button",onClick:()=>d(b=>!b),className:"w-full px-4 py-3.5 text-left",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[c?r.jsx(Rt,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):r.jsx($r,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),r.jsx(jo,{status:e.status}),r.jsx("span",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:"Current node"}),r.jsx("a",{href:m,target:"_blank",rel:"noreferrer",onClick:b=>b.stopPropagation(),className:"ml-auto shrink-0 text-muted-foreground transition-colors hover:text-primary",title:"Open Dashboard",children:r.jsx(So,{className:"h-3.5 w-3.5"})})]}),r.jsxs("div",{className:"mt-1.5 flex items-center gap-2 pl-6",children:[r.jsx("span",{className:"text-sm font-semibold tracking-tight text-foreground",children:e.name}),r.jsx(ko,{role:e.role}),r.jsx(Ce,{variant:"outline",className:"rounded-full border-primary/30 bg-background/60 text-[10px] capitalize",children:e.status})]})]}),c&&r.jsxs("div",{className:"space-y-4 border-t border-primary/15 px-4 pb-4 pt-3",children:[r.jsxs("div",{className:"space-y-3 rounded-[20px] border border-primary/20 bg-background/72 px-3.5 py-3.5",children:[r.jsx(De,{label:"Node ID",value:e.id,mono:!0}),f&&r.jsx(De,{label:"Dashboard",value:f,mono:!0,action:r.jsx(Kt,{label:"Copy dashboard URL",onClick:()=>void Tt(f,"Dashboard URL copied")})}),r.jsx(De,{label:"Node URL",value:u,mono:!0,action:r.jsx(Kt,{label:"Copy node URL",onClick:()=>void Tt(u,"Node URL copied")})}),h&&r.jsx(De,{label:"Workspace",value:h,mono:!0})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(Mr,{label:"Transport",value:x}),t&&r.jsx(Mr,{label:"Uptime",value:jx(t.uptime),mono:!0})]}),r.jsx(jl,{capabilities:e.capabilities,action:a&&p?r.jsxs(q,{variant:"outline",size:"sm",onClick:()=>o(e),disabled:s===e.id||v,className:"rounded-full",title:v?"Finish assigned or running tasks before changing remote access":void 0,children:[s===e.id&&r.jsx(we,{className:"h-3.5 w-3.5 animate-spin"}),g?"Disable Remote Access":"Enable Remote Access"]}):void 0}),a&&p&&v&&r.jsxs("div",{className:"text-xs text-muted-foreground",children:[n," active task",n===1?"":"s"," on this node."]})]})]})}function Ix({node:e,isLeader:t,blockingTaskCount:n,devTunnelNodeId:s,onToggleNodeDevTunnel:o}){const[a,l]=i.useState(!1),c=e.dashboardOrigin,d=e.devtunnelEndpoint??e.endpoint,f=c??e.endpoint,u=Po(e),m=Ur(e),h=_o(e),x=n>0;return r.jsxs("div",{className:"rounded-[24px] border border-border/60 bg-background/45",children:[r.jsxs("button",{type:"button",onClick:()=>l(g=>!g),className:"w-full px-4 py-3 text-left",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[a?r.jsx(Rt,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):r.jsx($r,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),r.jsx(jo,{status:e.status}),r.jsx("span",{className:"text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:"Peer node"}),r.jsx("a",{href:f,target:"_blank",rel:"noreferrer",onClick:g=>g.stopPropagation(),className:"ml-auto shrink-0 text-muted-foreground transition-colors hover:text-primary",title:"Open Dashboard",children:r.jsx(So,{className:"h-3.5 w-3.5"})})]}),r.jsxs("div",{className:"mt-1.5 flex items-center gap-2 pl-6",children:[r.jsx("span",{className:"text-sm font-semibold text-foreground",children:e.name}),r.jsx(ko,{role:e.role}),r.jsx(Ce,{variant:"outline",className:"rounded-full border-border/70 bg-background/60 text-[10px] capitalize",children:e.status})]})]}),a&&r.jsxs("div",{className:"space-y-4 border-t border-border/50 px-4 pb-4 pt-3",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(De,{label:"Node ID",value:e.id,mono:!0}),c&&r.jsx(De,{label:"Dashboard",value:c,mono:!0,action:r.jsx(Kt,{label:"Copy dashboard URL",onClick:()=>void Tt(c,"Dashboard URL copied")})}),r.jsx(De,{label:"Node URL",value:d,mono:!0,action:r.jsx(Kt,{label:"Copy node URL",onClick:()=>void Tt(d,"Node URL copied")})}),e.workDir&&r.jsx(De,{label:"Workspace",value:e.workDir,mono:!0}),r.jsx(Mr,{label:"Transport",value:u})]}),r.jsx(jl,{capabilities:e.capabilities,action:t&&h?r.jsxs(q,{variant:"outline",size:"sm",onClick:()=>o(e),disabled:s===e.id||x,className:"rounded-full",title:x?"Finish assigned or running tasks before changing remote access":void 0,children:[s===e.id&&r.jsx(we,{className:"h-3.5 w-3.5 animate-spin"}),m?"Disable Remote Access":"Enable Remote Access"]}):void 0}),t&&h&&x&&r.jsxs("div",{className:"text-xs text-muted-foreground",children:[n," active task",n===1?"":"s"," on this node."]})]})]})}function Kt({label:e,onClick:t}){return r.jsx(q,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 rounded-full text-muted-foreground",onClick:t,"aria-label":e,title:e,children:r.jsx(Tn,{className:"h-3.5 w-3.5"})})}function Lx(e,t,n,s){var l;if(!e)return{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Select a task to continue the conversation."};const o=((l=t==null?void 0:t.self)==null?void 0:l.role)==="follower";return e.assignedTo!==null&&e.assignedNodeAvailable===!1?{taskUnavailable:!0,chatDisabled:!0,chatDisabledReason:`${e.assignedNodeName??"Assigned node"} is unavailable. Leave the cluster on that node or re-run the task elsewhere.`}:o?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Follower nodes are read-only. Use the leader dashboard to manage chat, or leave the cluster first."}:n||s?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:"Waiting for the current turn to finish..."}:En.has(e.status)||e.status==="archived"?{taskUnavailable:!1,chatDisabled:!0,chatDisabledReason:En.has(e.status)?"Task has not started yet...":"Archived tasks are read-only."}:{taskUnavailable:!1,chatDisabled:!1,chatDisabledReason:"Continue the conversation..."}}var Wn="Checkbox",[$x]=rt(Wn),[Fx,xs]=$x(Wn);function Bx(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:o,disabled:a,form:l,name:c,onCheckedChange:d,required:f,value:u="on",internal_do_not_use_render:m}=e,[h,x]=Ct({prop:n,defaultProp:o??!1,onChange:d,caller:Wn}),[g,p]=i.useState(null),[v,b]=i.useState(null),y=i.useRef(!1),w=g?!!l||!!g.closest("form"):!0,j={checked:h,disabled:a,setChecked:x,control:g,setControl:p,name:c,form:l,value:u,hasConsumerStoppedPropagationRef:y,required:f,defaultChecked:Qe(o)?!1:o,isFormControl:w,bubbleInput:v,setBubbleInput:b};return r.jsx(Fx,{scope:t,...j,children:Ux(m)?m(j):s})}var kl="CheckboxTrigger",Sl=i.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},o)=>{const{control:a,value:l,disabled:c,checked:d,required:f,setControl:u,setChecked:m,hasConsumerStoppedPropagationRef:h,isFormControl:x,bubbleInput:g}=xs(kl,e),p=ie(o,u),v=i.useRef(d);return i.useEffect(()=>{const b=a==null?void 0:a.form;if(b){const y=()=>m(v.current);return b.addEventListener("reset",y),()=>b.removeEventListener("reset",y)}},[a,m]),r.jsx(Z.button,{type:"button",role:"checkbox","aria-checked":Qe(d)?"mixed":d,"aria-required":f,"data-state":Rl(d),"data-disabled":c?"":void 0,disabled:c,value:l,...s,ref:p,onKeyDown:J(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:J(n,b=>{m(y=>Qe(y)?!0:!y),g&&x&&(h.current=b.isPropagationStopped(),h.current||b.stopPropagation())})})});Sl.displayName=kl;var gs=i.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:o,defaultChecked:a,required:l,disabled:c,value:d,onCheckedChange:f,form:u,...m}=e;return r.jsx(Bx,{__scopeCheckbox:n,checked:o,defaultChecked:a,disabled:c,required:l,onCheckedChange:f,name:s,form:u,value:d,internal_do_not_use_render:({isFormControl:h})=>r.jsxs(r.Fragment,{children:[r.jsx(Sl,{...m,ref:t,__scopeCheckbox:n}),h&&r.jsx(Tl,{__scopeCheckbox:n})]})})});gs.displayName=Wn;var Cl="CheckboxIndicator",El=i.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...o}=e,a=xs(Cl,n);return r.jsx(Dt,{present:s||Qe(a.checked)||a.checked===!0,children:r.jsx(Z.span,{"data-state":Rl(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});El.displayName=Cl;var Al="CheckboxBubbleInput",Tl=i.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:o,checked:a,defaultChecked:l,required:c,disabled:d,name:f,value:u,form:m,bubbleInput:h,setBubbleInput:x}=xs(Al,e),g=ie(n,x),p=Mi(a),v=ji(s);i.useEffect(()=>{const y=h;if(!y)return;const w=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(w,"checked").set,C=!o.current;if(p!==a&&S){const k=new Event("click",{bubbles:C});y.indeterminate=Qe(a),S.call(y,Qe(a)?!1:a),y.dispatchEvent(k)}},[h,p,a,o]);const b=i.useRef(Qe(a)?!1:a);return r.jsx(Z.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??b.current,required:c,disabled:d,name:f,value:u,form:m,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Tl.displayName=Al;function Ux(e){return typeof e=="function"}function Qe(e){return e==="indeterminate"}function Rl(e){return Qe(e)?"indeterminate":e?"checked":"unchecked"}const Or=i.forwardRef(({className:e,...t},n)=>r.jsx(gs,{ref:n,className:U("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",e),...t,children:r.jsx(El,{className:U("flex items-center justify-center text-current"),children:r.jsx(He,{className:"h-3.5 w-3.5"})})}));Or.displayName=gs.displayName;function go({toolbarTasks:e,activeTaskId:t,tasksLoading:n,tasksError:s,isLeader:o,scope:a,agentFilter:l,nodeFilter:c,agentOptions:d,nodeOptions:f,nodeNameById:u,searchQuery:m,selectedTaskIds:h,allVisibleTasksSelected:x,someVisibleTasksSelected:g,canBatchArchive:p,onSearchChange:v,onScopeChange:b,onAgentFilterChange:y,onNodeFilterChange:w,onToggleTaskSelected:j,onToggleAllVisibleTasks:S,onBatchArchive:C,onBatchDelete:k,onCreateTask:A,onSelectTask:R,onClose:D}){const[$,_]=i.useState(!!m),[F,W]=i.useState(!1),z=i.useRef(null),O=i.useRef(null),T=h.size,I=a!=="active"||c!=="all"||l!=="all";return i.useEffect(()=>{m&&_(!0)},[m]),i.useEffect(()=>{var E;$&&((E=z.current)==null||E.focus())},[$]),i.useEffect(()=>{if(!$)return;const E=ce=>{var ne;const ae=ce.target;ae instanceof Node&&((ne=O.current)!=null&&ne.contains(ae)||_(!1))},ee=ce=>{ce.key==="Escape"&&_(!1)};return document.addEventListener("mousedown",E),document.addEventListener("keydown",ee),()=>{document.removeEventListener("mousedown",E),document.removeEventListener("keydown",ee)}},[$]),r.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:[r.jsxs("div",{className:"shrink-0 border-b border-border/60 px-4 py-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx("div",{className:"text-lg font-semibold tracking-tight text-foreground",children:"Tasks"}),r.jsx(q,{variant:"ghost",size:"icon",onClick:D,className:"rounded-full",children:r.jsx(Eo,{className:"h-4 w-4"})})]}),r.jsxs("div",{ref:O,className:"mt-4 flex items-center gap-2",children:[r.jsxs(q,{onClick:A,className:U("justify-start rounded-[22px] px-4 py-6 text-left shadow-[0_24px_60px_-32px_hsl(var(--primary)/0.95)] transition-[flex] duration-200",$?"flex-[2]":"flex-1"),children:[r.jsx(Co,{className:"h-4 w-4"}),"New chat"]}),$?r.jsxs("div",{className:"flex min-w-0 flex-[3] items-center gap-2",children:[r.jsxs("div",{className:"relative min-w-0 flex-1",children:[r.jsx(Ps,{className:"pointer-events-none absolute left-4 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(Et,{ref:z,value:m,onChange:E=>v(E.target.value),placeholder:"Search tasks",className:"h-11 rounded-full border-border/70 bg-background/60 pl-11 text-sm"})]}),r.jsx(q,{variant:"outline",size:"icon",onClick:()=>_(!1),className:"rounded-full border-border/70 bg-background/60",children:r.jsx(Yc,{className:"h-4 w-4"})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(q,{variant:"outline",onClick:()=>_(!0),className:U("rounded-full border-border/70 bg-background/60 px-4 text-sm",m&&"border-primary/40 bg-primary/8 text-primary"),children:[r.jsx(Ps,{className:"h-4 w-4"}),"Search"]}),r.jsx(q,{variant:F||I?"secondary":"outline",size:"icon",onClick:()=>W(E=>!E),className:U("shrink-0 rounded-full border-border/70 bg-background/60",I&&"border-primary/40 bg-primary/8 text-primary"),title:"Filters",children:r.jsx(id,{className:"h-4 w-4"})})]})]}),(F||I)&&r.jsxs("div",{className:"mt-2 grid grid-cols-1 gap-2 sm:grid-cols-3",children:[r.jsxs(Te,{value:a,onValueChange:E=>b(E),children:[r.jsx(je,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:r.jsx(Ve,{})}),r.jsx(ke,{children:ux.map(E=>r.jsx(be,{value:E.value,className:"text-[12px]",children:E.label},E.value))})]}),r.jsxs(Te,{value:c,onValueChange:w,children:[r.jsx(je,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:r.jsx(Ve,{placeholder:"Node"})}),r.jsx(ke,{children:f.map(E=>r.jsx(be,{value:E.value,className:"text-[12px]",children:E.label},E.value))})]}),r.jsxs(Te,{value:l,onValueChange:y,children:[r.jsx(je,{className:"h-9 rounded-full border-border/70 bg-background/55 text-[12px]",children:r.jsx(Ve,{placeholder:"Agent"})}),r.jsx(ke,{children:d.map(E=>r.jsx(be,{value:E,className:"text-[12px]",children:E==="all"?"All agents":E},E))})]})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-3",children:e.length>0?r.jsxs("div",{className:"space-y-2",children:[o&&r.jsxs("div",{className:"mb-1 flex items-center justify-between px-1 py-1",children:[r.jsxs("label",{className:"flex items-center gap-2 text-[11px] font-medium uppercase tracking-[0.18em] text-muted-foreground",children:[r.jsx(Or,{checked:g&&!x?"indeterminate":x,onCheckedChange:E=>S(E===!0),"aria-label":"Select all visible tasks"}),r.jsx("span",{children:"Select all"})]}),T>0&&r.jsx(q,{variant:"ghost",size:"sm",onClick:()=>S(!1),className:"h-7 rounded-full px-3 text-xs",children:"Clear"})]}),e.map(E=>r.jsxs("div",{className:U("flex items-start gap-3 rounded-[24px] border px-3 py-3 transition-all",E.id===t?"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:[o&&r.jsx("div",{className:"flex shrink-0 pt-1",onClick:ee=>ee.stopPropagation(),children:r.jsx(Or,{checked:h.has(E.id),onCheckedChange:ee=>j(E.id,ee===!0),"aria-label":`Select ${E.title}`})}),r.jsx("button",{type:"button",onClick:()=>R(E.id),className:"min-w-0 flex-1 text-left",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("span",{className:U("mt-1 h-2.5 w-2.5 shrink-0 rounded-full",vx(E.status))}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:E.title}),r.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-[11px] text-muted-foreground",children:[r.jsx("span",{className:"font-mono",children:E.agent}),r.jsx("span",{className:"h-1 w-1 rounded-full bg-border"}),r.jsx("span",{children:E.assignedTo?u.get(E.assignedTo)??E.assignedTo.slice(0,8):"unassigned"}),r.jsx("span",{className:"h-1 w-1 rounded-full bg-border"}),r.jsx("span",{children:wx(E.updatedAt)})]}),r.jsxs("div",{className:"mt-3 flex items-center gap-2 text-[11px] text-muted-foreground",children:[r.jsx(No,{status:E.status}),E.assignedNodeAvailable===!1&&r.jsx(Ce,{variant:"outline",className:"border-destructive/25 bg-destructive/10 text-[10px] text-destructive",children:"unavailable"}),r.jsx("span",{className:"truncate font-medium text-foreground/85",children:bx(E.effectiveProjectPath??E.project??"default workspace")})]}),r.jsx("div",{className:"mt-1 truncate font-mono text-[10px] text-muted-foreground/85",children:yx(E.effectiveProjectPath??E.project??"default workspace")})]})]})})]},E.id))]}):r.jsx("div",{className:"rounded-[24px] border border-dashed border-border/70 bg-background/35 px-4 py-5 text-sm text-muted-foreground",children:n?"Loading tasks...":s||"No tasks match this view."})}),o&&T>0?r.jsxs("div",{className:"shrink-0 border-t border-border/60 px-4 py-4",children:[r.jsx("div",{className:"text-[11px] font-medium uppercase tracking-[0.22em] text-muted-foreground",children:"Batch actions"}),r.jsxs("div",{className:"mt-2 text-sm font-semibold text-foreground",children:[T," task",T!==1?"s":""," selected"]}),!p&&r.jsx("div",{className:"mt-2 text-xs text-muted-foreground",children:"Only completed, failed, cancelled, or archived tasks can be archived."}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsxs(jr,{children:[r.jsx(Xs,{asChild:!0,children:r.jsxs(q,{variant:"outline",size:"sm",disabled:!p,className:"rounded-full",children:[r.jsx(Ic,{className:"h-3.5 w-3.5"}),"Archive"]})}),r.jsxs(hn,{children:[r.jsxs(xn,{children:[r.jsxs(vn,{children:["Archive ",T," task",T!==1?"s":"","?"]}),r.jsx(bn,{children:"Archived tasks stay hidden from the default task view and can be reopened from the archived scope."})]}),r.jsxs(gn,{children:[r.jsx(wn,{children:"Cancel"}),r.jsx(yn,{onClick:C,disabled:!p,children:"Archive"})]})]})]}),r.jsxs(jr,{children:[r.jsx(Xs,{asChild:!0,children:r.jsxs(q,{variant:"destructive",size:"sm",className:"rounded-full",children:[r.jsx(Ld,{className:"h-3.5 w-3.5"}),"Delete"]})}),r.jsxs(hn,{children:[r.jsxs(xn,{children:[r.jsxs(vn,{children:["Delete ",T," task",T!==1?"s":"","?"]}),r.jsx(bn,{children:"This removes the selected tasks and their saved logs."})]}),r.jsxs(gn,{children:[r.jsx(wn,{children:"Cancel"}),r.jsx(yn,{onClick:k,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}):null]})}function mr(e,t,n){const s=i.useRef(t);s.current=t,i.useEffect(()=>{let l=0,c=0;const d=m=>{const h=m.touches[0];h&&(l=h.clientX,c=h.clientY)},f=m=>{var p,v,b,y;const h=m.changedTouches[0];if(!h)return;const x=h.clientX-l;Math.abs(h.clientY-c)>100||Math.abs(x)<50||(x>0?(v=(p=s.current).onSwipeRight)==null||v.call(p):(y=(b=s.current).onSwipeLeft)==null||y.call(b))},u=(e==null?void 0:e.current)??document;return u.addEventListener("touchstart",d,{passive:!0}),u.addEventListener("touchend",f,{passive:!0}),()=>{u.removeEventListener("touchstart",d),u.removeEventListener("touchend",f)}},[e,n==null?void 0:n.threshold,n==null?void 0:n.maxVertical])}function vo(e,t,n=30){const s=i.useRef(t);s.current=t,i.useEffect(()=>{let l=0,c=0,d=!1;const f=m=>{const h=m.touches[0];h&&(l=h.clientX,c=h.clientY,e==="left"?d=h.clientX<=n:d=h.clientX>=window.innerWidth-n)},u=m=>{if(!d)return;const h=m.changedTouches[0];if(!h)return;const x=h.clientX-l;Math.abs(h.clientY-c)>100||Math.abs(x)<50||(e==="left"&&x>0||e==="right"&&x<0)&&s.current()};return document.addEventListener("touchstart",f,{passive:!0}),document.addEventListener("touchend",u,{passive:!0}),()=>{document.removeEventListener("touchstart",f),document.removeEventListener("touchend",u)}},[e,n])}const bo="(min-width: 1024px)",Vx="(min-width: 1280px)";function pr(e){var t,n,s;return((s=(n=(t=globalThis.window)==null?void 0:t.matchMedia)==null?void 0:n.call(t,e))==null?void 0:s.matches)??!1}function Wx(){const[e,t]=i.useState(!0),[n,s]=i.useState(!1),[o,a]=i.useState(()=>pr(Vx)),l=i.useRef(null),c=i.useRef(null),d=i.useRef(null),f=i.useCallback(()=>!pr(bo),[]);vo("left",()=>{f()&&s(!0)}),vo("right",()=>{f()&&a(!0)}),mr(l,{onSwipeLeft:()=>s(!1)}),mr(c,{onSwipeRight:()=>a(!1)}),mr(d,{onSwipeRight:()=>{f()&&!n&&s(!0)},onSwipeLeft:()=>{o||a(!0)}});const u=i.useCallback(()=>{if(pr(bo)){t(m=>!m);return}s(m=>!m)},[]);return{conversationRef:d,desktopTasksOpen:e,mobileTasksPanelOpen:n,mobileTasksPanelRef:l,operationsOpen:o,operationsPanelRef:c,setMobileTasksPanelOpen:s,setOperationsOpen:a,toggleTasksPanel:u}}function zx(e,t){return t.data.nodeId===e.self.id||t.data.name===e.self.name||t.data.endpoint===e.self.endpoint}function Hx({cluster:e,subscribe:t}){i.useEffect(()=>{var n;if(((n=e==null?void 0:e.self)==null?void 0:n.role)==="leader")return t("node",s=>{const o=String(s.data.name??s.data.nodeId??"node"),a=zx(e,s);s.type==="node.joined"&&!a&&he.success(`${o} joined the cluster`),s.type==="node.left"&&!a&&he.message(`${o} left the cluster`)})},[e,t])}function Kx(){var Es,As,Ts;const{id:e}=gc(),t=vc(),n=bc(),{cluster:s,systemInfo:o,events:a,sseConnected:l,subscribe:c,refresh:d,loading:f,error:u}=yc(),m=i.useMemo(()=>gx(t.state),[t.state]),[h,x]=i.useState([]),[g,p]=i.useState(!0),[v,b]=i.useState(null),[y,w]=i.useState(null),[j,S]=i.useState("active"),[C,k]=i.useState("all"),[A,R]=i.useState("all"),[D,$]=i.useState(""),_=i.useDeferredValue(D),{conversationRef:F,desktopTasksOpen:W,mobileTasksPanelOpen:z,mobileTasksPanelRef:O,operationsOpen:T,operationsPanelRef:I,setMobileTasksPanelOpen:E,setOperationsOpen:ee,toggleTasksPanel:ce}=Wx(),[ae,ne]=i.useState(()=>!!(m!=null&&m.draftNewTask)),[le,me]=i.useState(()=>m!=null&&m.draftNewTask?{route:m.returnRoute??"/",taskId:m.returnTaskId??null}:null),[L,M]=i.useState(!1),[B,Q]=i.useState("transcript"),[K,X]=i.useState("all"),[G,oe]=i.useState(!1),[xe,ve]=i.useState(null),[Ne,H]=i.useState([]),[fe,de]=i.useState([]),[zn,mt]=i.useState(!1),[Re,pt]=i.useState(null),[Ge,at]=i.useState(new Set),[_l,vs]=i.useState(!1),[Pl,bs]=i.useState(!1),[Dl,ys]=i.useState(!1),[Ml,ws]=i.useState(null),Ns=i.useRef(null),Lt=i.useRef(null),ht=((Es=s==null?void 0:s.self)==null?void 0:Es.role)==="leader",Hn=(As=s==null?void 0:s.self)==null?void 0:As.id;Hx({cluster:s,subscribe:c});const ge=i.useCallback(async()=>{try{const N=await wc({assignedTo:!ht&&Hn?Hn:void 0,limit:100});x(N),b(null)}catch(N){b(N instanceof Error?N.message:"Failed to load tasks")}finally{p(!1)}},[ht,Hn]);Nc(ge,1e4),i.useEffect(()=>{ge()},[ge]),i.useEffect(()=>c("task",ge),[c,ge]);const pe=i.useMemo(()=>[...h].sort((N,P)=>P.updatedAt-N.updatedAt),[h]),Ol=i.useMemo(()=>{const N=new Map;for(const P of(s==null?void 0:s.nodes)??[]){const V=Wd(pe,P.id);V>0&&N.set(P.id,V)}return N},[s==null?void 0:s.nodes,pe]),_e=i.useMemo(()=>pe.filter(N=>!mx(N,j)||C!=="all"&&N.agent!==C||A==="unassigned"&&N.assignedTo||A!=="all"&&A!=="unassigned"&&hx(N.assignedTo,s==null?void 0:s.nodes,N.assignedNodeName)!==A?!1:_.trim()?px(N,_):!0),[pe,j,C,A,_]);i.useEffect(()=>{at(N=>{const P=Gd(N,_e.map(V=>V.id));return P.size===N.size?N:P})},[_e]),i.useEffect(()=>{ht||at(new Set)},[ht]);const Il=i.useMemo(()=>["all",...Array.from(new Set(pe.map(N=>N.agent))).sort()],[pe]),Ll=i.useMemo(()=>{const P=Array.from(new Set(pe.map(V=>V.assignedTo).filter(V=>!!V))).map(V=>{const ue=pe.find(te=>te.assignedTo===V);return(s==null?void 0:s.nodes.find(te=>te.id===V))??{id:V,name:hs(V,s==null?void 0:s.nodes,ue==null?void 0:ue.assignedNodeName)}}).sort((V,ue)=>V.name.localeCompare(ue.name));return[{value:"all",label:"All nodes"},{value:"unassigned",label:"Unassigned"},...P.map(V=>({value:V.name.toLowerCase(),label:V.name}))]},[pe,s==null?void 0:s.nodes]),js=i.useMemo(()=>{const N=new Map;for(const P of(s==null?void 0:s.nodes)??[])N.set(P.id,P.name);for(const P of pe)P.assignedTo&&P.assignedNodeName&&!N.has(P.assignedTo)&&N.set(P.assignedTo,P.assignedNodeName);return N},[s==null?void 0:s.nodes,pe]),Kn=i.useMemo(()=>["all",...Array.from(new Set(a.map(N=>N.type))).sort()],[a]),$l=i.useMemo(()=>K==="all"?a:a.filter(N=>N.type===K),[a,K]),Fl=_e.length>0&&_e.every(N=>Ge.has(N.id)),Bl=_e.some(N=>Ge.has(N.id)),Ul=Yd(_e,Ge);i.useEffect(()=>{m!=null&&m.draftNewTask&&(ne(!0),me({route:m.returnRoute??"/",taskId:m.returnTaskId??null}))},[m]),i.useEffect(()=>{K!=="all"&&!Kn.includes(K)&&X("all")},[K,Kn]),i.useEffect(()=>{Ds(e,ae)&&!y&&pe[0]&&w(pe[0].id)},[e,ae,y,pe]),i.useEffect(()=>{var N;Ds(e,ae)&&(y&&h.some(P=>P.id===y)||w(((N=pe[0])==null?void 0:N.id)??null))},[e,ae,y,pe,h]);const se=Hd({routeTaskId:e,creatingTask:ae,internalSelectedTaskId:y,sortedTaskIds:pe.map(N=>N.id)}),xt=i.useMemo(()=>h.find(N=>N.id===se)??null,[h,se]);i.useEffect(()=>{Lt.current=se??null},[se]);const Jt=i.useCallback(()=>{ve(null),H([]),de([]),pt(null)},[]),Ae=i.useCallback(async()=>{const N=se;if(N)try{const P=await jc(N);if(Lt.current!==N)return;ve(P),pt(null)}catch(P){if(Lt.current!==N)return;ve(null),H([]),de([]),pt(P instanceof Error?P.message:"Failed to load task")}finally{Lt.current===N&&mt(!1)}},[se]),Zt=i.useCallback(async()=>{const N=se;if(N)try{const P=await kc(N);if(Lt.current!==N)return;H(V=>yu(V,P.logs)),de(V=>Nu(V,P.logs))}catch{}},[se]);i.useEffect(()=>{if(!se){ve(null),H([]),de([]),pt(null),mt(!1);return}Q("transcript"),ve(xt),H([]),de([]),pt(null),mt(!0),Ae(),Zt()},[se,Zt,Ae]),i.useEffect(()=>{var P;if(!se||ae||g||h.some(V=>V.id===se))return;const N=((P=pe[0])==null?void 0:P.id)??null;w(N),Jt(),i.startTransition(()=>{n(N?`/tasks/${N}`:"/",{state:null})})},[se,Jt,ae,n,pe,h,g]),i.useEffect(()=>{xt&&ve(N=>!N||N.id!==xt.id?N:{...N,...xt})},[xt]),i.useEffect(()=>{if(se)return c("task",N=>{const P=N.data.taskId;if(!(typeof P!="string"||P!==se)){if(N.type==="task.output"){const V=N.data.event;if(V){H(te=>wu(te,V));const ue=qt(V);ue&&de(te=>ju(te,ue))}}N.type==="task.status"&&(Ae(),Zt())}})},[c,se,Ae,Zt]),i.useEffect(()=>{var N;B==="transcript"&&((N=Ns.current)==null||N.scrollIntoView({behavior:"smooth"}))},[Ne,fe,B]);const re=xe??xt,Vl=re!=null&&re.assignedTo?(s==null?void 0:s.nodes.find(N=>N.id===re.assignedTo))??null:null,qn=fe.length>0,Wl=re?Yh.has(re.agent):!1,Gn=(re==null?void 0:re.status)==="running",zl=re?En.has(re.status)||Nl.has(re.status):!1,Hl=!!(re&&ht&&re.status==="failed"),Yn=i.useMemo(()=>Lx(re,s,qn,!!Gn),[re,s,qn,Gn]),Kl=i.useMemo(()=>ku(Ne),[Ne]),Xn=i.useMemo(()=>Su([...Ne,...fe.map(N=>Zn(N.content,N.timestamp))]),[Ne,fe]),ql=i.useMemo(()=>{if(!re)return null;const N=eu(re);if(N.length>0)return Zn(N,new Date(re.createdAt).toISOString());if(Xn.length>0)return null;const P=Ft(re.description||re.title);return P.length>0?Zn(P,new Date(re.createdAt).toISOString()):null},[re,Xn]),Jn=i.useCallback(()=>{const N={route:e?`/tasks/${e}`:"/",taskId:se};me(N),ne(!0),i.startTransition(()=>{n("/",{state:{draftNewTask:!0,returnRoute:N.route,returnTaskId:N.taskId}})})},[e,se,n]),Gl=i.useCallback(()=>{var P;const N=(le==null?void 0:le.taskId)??((P=pe[0])==null?void 0:P.id)??null;ne(!1),me(null),w(N),i.startTransition(()=>{n((le==null?void 0:le.route)??"/",{state:null})})},[le,pe,n]),ks=i.useCallback(N=>{ne(!1),me(null),w(N),i.startTransition(()=>{n(`/tasks/${N}`,{state:null})})},[n]),Yl=i.useCallback(N=>{ne(!1),me(null),x(P=>Kd(P,N)),ve(N),H([]),de([]),pt(null),mt(!1),Q("transcript"),w(N.id),ge(),i.startTransition(()=>{n(`/tasks/${N.id}`,{state:null})})},[ge,n]),Qt=i.useCallback(async N=>{if(!se)return!1;const P=`local-${Date.now()}-${Math.random().toString(16).slice(2)}`;de(V=>[...V,{id:P,content:N,timestamp:new Date().toISOString()}]);try{return await Sc(se,N),Ae(),!0}catch(V){return de(ue=>ue.filter(te=>te.id!==P)),he.error(V instanceof Error?V.message:"Failed to send message"),!1}},[se,Ae]),Xl=i.useCallback(N=>{Qt(N)},[Qt]),Jl=i.useCallback(N=>Qt(N),[Qt]),Zl=i.useCallback(async()=>{if(re)try{await Cc(re.id),Ae(),ge()}catch(N){he.error(N instanceof Error?N.message:"Failed to cancel task")}},[re,Ae,ge]),Ql=i.useCallback(async()=>{if(re)try{await Ec(re.id),Ae(),ge()}catch(N){he.error(N instanceof Error?N.message:"Failed to retry task")}},[re,Ae,ge]),en=i.useCallback((N,P=!1)=>{const V=Xd(_e,N);return w(V),(P||!V)&&Jt(),i.startTransition(()=>{n(V?`/tasks/${V}`:"/",{state:null})}),V},[Jt,_e,n]),ec=i.useCallback((N,P)=>{at(V=>{const ue=new Set(V);return P?ue.add(N):ue.delete(N),ue})},[]),tc=i.useCallback(N=>{if(!N){at(new Set);return}at(new Set(_e.map(P=>P.id)))},[_e]),nc=i.useCallback(async()=>{const N=Array.from(Ge);if(N.length!==0)try{const{results:P}=await Ac(N),V=P.filter(te=>!te.ok),ue=P.filter(te=>te.ok).map(te=>te.id);se&&ue.includes(se)&&en(ue),V.length>0?he.error(`Failed to archive ${V.length} task(s): ${V.map(te=>te.error??te.id).join(", ")}`):he.success(`Archived ${ue.length} task(s)`),at(new Set(V.map(te=>te.id))),ge()}catch(P){he.error(P instanceof Error?P.message:"Failed to archive tasks")}},[se,ge,en,Ge]),rc=i.useCallback(async()=>{const N=Array.from(Ge);if(N.length!==0)try{const{results:P}=await Tc(N),V=P.filter(te=>!te.ok),ue=P.filter(te=>te.ok).map(te=>te.id);se&&ue.includes(se)&&en(ue,!0),V.length>0?he.error(`Failed to delete ${V.length} task(s): ${V.map(te=>te.error??te.id).join(", ")}`):he.success(`Deleted ${ue.length} task(s)`),at(new Set(V.map(te=>te.id))),ge()}catch(P){he.error(P instanceof Error?P.message:"Failed to delete tasks")}},[se,ge,en,Ge]),sc=i.useCallback(async()=>{vs(!0);try{await Rc(),d()}catch(N){he.error(N instanceof Error?N.message:"Failed to trigger election")}finally{vs(!1)}},[d]),oc=i.useCallback(async()=>{bs(!0);try{await _c(),d()}catch(N){he.error(N instanceof Error?N.message:"Failed to promote node")}finally{bs(!1)}},[d]),ac=i.useCallback(async()=>{ys(!0);try{await Pc(),he.success("This node left the remote cluster and is leading itself again."),ge(),Ae(),d()}catch(N){he.error(N instanceof Error?N.message:"Failed to leave cluster")}finally{ys(!1)}},[Ae,ge,d]),ic=i.useCallback(async N=>{var Rs;const P=!Ur(N),V=N.id===((Rs=s==null?void 0:s.self)==null?void 0:Rs.id),ue=V?(o==null?void 0:o.transportType)??N.transportType:N.transportType,te=V&&!P&&_t(ue);ws(N.id);try{te?await Dc("direct"):await Mc(N.id,P),he.success(P?`Enabled remote access on ${N.name}`:`Disabled remote access on ${N.name}`),d()}catch(_s){he.error(_s instanceof Error?_s.message:"Failed to update remote access")}finally{ws(null)}},[(Ts=s==null?void 0:s.self)==null?void 0:Ts.id,d,o==null?void 0:o.transportType]),Ss={toolbarTasks:_e,activeTaskId:se,tasksLoading:g,tasksError:v,isLeader:ht,scope:j,agentFilter:C,nodeFilter:A,agentOptions:Il,nodeOptions:Ll,nodeNameById:js,searchQuery:D,selectedTaskIds:Ge,allVisibleTasksSelected:Fl,someVisibleTasksSelected:Bl,canBatchArchive:Ul,onSearchChange:$,onScopeChange:S,onAgentFilterChange:k,onNodeFilterChange:R,onToggleTaskSelected:ec,onToggleAllVisibleTasks:tc,onBatchArchive:nc,onBatchDelete:rc,onCreateTask:Jn,onSelectTask:ks,onClose:ce},Cs={cluster:s,systemInfo:o,nodeNameById:js,nodeBlockingTaskCounts:Ol,eventTypeFilter:K,onEventTypeFilterChange:X,eventTypeOptions:Kn,filteredEvents:$l,sseConnected:l,clusterLoading:f,clusterError:u,electionPending:_l,onTriggerElection:sc,promotePending:Pl,onPromote:oc,onAddNode:()=>M(!0),leavePending:Dl,onLeaveCluster:ac,onToggleNodeDevTunnel:ic,devTunnelNodeId:Ml,onClose:()=>ee(!1)};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col overflow-hidden pb-2",children:[r.jsxs("div",{className:"flex min-h-0 flex-1 overflow-hidden",children:[r.jsx("div",{className:U("hidden lg:block lg:shrink-0 lg:transition-all lg:duration-300",W?"lg:mr-3 lg:w-[24rem]":"lg:w-0 lg:overflow-hidden"),children:W&&r.jsx(go,{...Ss})}),r.jsx("section",{ref:F,className:"min-h-0 min-w-0 flex-1",children:r.jsx(Ex,{onToggleTasks:ce,desktopTasksOpen:W,mobileTasksPanelOpen:z,operationsOpen:T,onToggleOperations:()=>ee(N=>!N),cluster:s,sseConnected:l,activeTab:B,setActiveTab:Q,creatingTask:ae,activeTask:re,assignedNode:Vl,taskLoading:zn,taskError:Re,displayEvents:Xn,hasUserMessageInLogs:Kl,initialPrompt:ql,supportsFollowUp:Wl,taskUnavailable:Yn.taskUnavailable,chatDisabled:Yn.chatDisabled,chatDisabledReason:Yn.chatDisabledReason,questionBypassEnabled:G,isRunning:!!Gn,hasPendingFollowUp:qn,canCancel:!!zl,canRetry:!!Hl,onRetry:Ql,onCancel:Zl,onStartCreateTask:Jn,onCancelCreateTask:Gl,onCreateTask:Yl,onSendMessage:Xl,onQuestionBypassChange:oe,onSubmitQuestionResponse:Jl,messagesEndRef:Ns})}),r.jsx("div",{className:U("hidden xl:block xl:shrink-0 xl:transition-all xl:duration-300",T?"xl:ml-3 xl:w-[26rem]":"xl:w-0 xl:overflow-hidden"),children:T&&r.jsx(ho,{...Cs})})]}),T&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Close operations panel",onClick:()=>ee(!1),className:"fixed inset-0 z-30 bg-black/45 backdrop-blur-sm xl:hidden"}),r.jsx("div",{ref:I,className:"fixed inset-y-0 right-0 z-40 w-full p-2 sm:max-w-sm sm:p-3 xl:hidden",children:r.jsx(ho,{...Cs})})]}),z&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-label":"Close task list",onClick:()=>E(!1),className:"fixed inset-0 z-30 bg-black/45 backdrop-blur-sm lg:hidden"}),r.jsx("div",{ref:O,className:"fixed inset-y-0 left-0 z-40 w-full p-2 sm:max-w-sm sm:p-3 lg:hidden",children:r.jsx(go,{...Ss,onCreateTask:()=>{E(!1),Jn()},onSelectTask:N=>{E(!1),ks(N)},onClose:()=>E(!1)})})]}),r.jsx(nm,{open:L,onOpenChange:M,children:r.jsx(cm,{onAdded:()=>{M(!1),d()}})})]})}const Yx=Object.freeze(Object.defineProperty({__proto__:null,DashboardPage:Kx},Symbol.toStringTag,{value:"Module"}));export{$r as C,nm as D,So as E,od as F,ha as a,va as b,Gx as c,Rt as d,Yx as e};
|