@xenon-device-management/xenon 1.22.2 → 1.22.3
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/lib/package.json +1 -1
- package/lib/public/assets/{ApiKeyGate-Snh2iZH5.js → ApiKeyGate-bHtvfyNp.js} +1 -1
- package/lib/public/assets/{BugReportButton-Sk0KGufH.js → BugReportButton-DFK28wAC.js} +1 -1
- package/lib/public/assets/DeviceMosaicView-C4Yrz2PA.js +7 -0
- package/lib/public/assets/{EmptyState-CQun3BJE.js → EmptyState-aXHIYg04.js} +1 -1
- package/lib/public/assets/{FieldGroup-DmYZP2j7.js → FieldGroup-C_DwE2dP.js} +1 -1
- package/lib/public/assets/{Modal-C5W8lMJ6.js → Modal-BCbDzIzg.js} +1 -1
- package/lib/public/assets/{SegmentedControl-BIzlKyUd.js → SegmentedControl-BPjRPFXH.js} +1 -1
- package/lib/public/assets/{SettingCard-DAFqQw7S.js → SettingCard-BJ8-ywEG.js} +1 -1
- package/lib/public/assets/{Table-DRkkM4OR.js → Table-C7XQ4gI0.js} +1 -1
- package/lib/public/assets/{activity-B6x69oOy.js → activity-Bv16pTkN.js} +1 -1
- package/lib/public/assets/{ai-settings-CSZQis7F.js → ai-settings-BpXcUQm3.js} +1 -1
- package/lib/public/assets/{api-keys-4ddjSngL.js → api-keys-HzfbVxL2.js} +1 -1
- package/lib/public/assets/{apps-CePIfnu9.js → apps-CtyCtiVx.js} +1 -1
- package/lib/public/assets/{arrow-left-CaOe18yC.js → arrow-left-TEnyrpa4.js} +1 -1
- package/lib/public/assets/{arrow-right-FEQsqDvH.js → arrow-right-ILl07Dxb.js} +1 -1
- package/lib/public/assets/{arrow-up-right-Dnszb73S.js → arrow-up-right-BOGBb0NS.js} +1 -1
- package/lib/public/assets/{auth-shell-Vq1rYIVD.js → auth-shell-D3PWn3HG.js} +2 -2
- package/lib/public/assets/{builds-page-FfsUegKZ.js → builds-page-BsKfrrMf.js} +1 -1
- package/lib/public/assets/{button-DrqhMLZ0.js → button-Kv_nqg_I.js} +1 -1
- package/lib/public/assets/{calendar-BuRuUa7q.js → calendar-DnjXodK3.js} +1 -1
- package/lib/public/assets/{check-DYccNk73.js → check-DvGXlj1A.js} +1 -1
- package/lib/public/assets/chevron-left-CZDYD4H3.js +6 -0
- package/lib/public/assets/{chevron-right-C6ny35i3.js → chevron-right-CuPozn4T.js} +1 -1
- package/lib/public/assets/{circle-check-Cokzy9a2.js → circle-check-CBxV3geR.js} +1 -1
- package/lib/public/assets/{circle-x-BhUzyxKR.js → circle-x-X-nHBZnY.js} +1 -1
- package/lib/public/assets/{clock-BCG0drfS.js → clock-lLny_RuH.js} +1 -1
- package/lib/public/assets/{copy-BKOm9hko.js → copy-CYjhxjiV.js} +1 -1
- package/lib/public/assets/{device-explorer-CIjs3BXP.js → device-explorer-ClkV_k7q.js} +43 -63
- package/lib/public/assets/{download-R2k7Nd4P.js → download-2y5oRiK2.js} +1 -1
- package/lib/public/assets/{forgot-password-CiZcr-gB.js → forgot-password-BouiRKS-.js} +1 -1
- package/lib/public/assets/{funnel-SD4F5IdR.js → funnel-DozJGkC5.js} +1 -1
- package/lib/public/assets/{index-BHDlQcd6.js → index-4PUiCXoJ.js} +2 -2
- package/lib/public/assets/{index-C7S8Y7Fj.css → index-BYvkQIjW.css} +1 -1
- package/lib/public/assets/{input-Ilib6feD.js → input-Cg5C6lE3.js} +1 -1
- package/lib/public/assets/keycodes-paeodb9g.js +21 -0
- package/lib/public/assets/layers-CVD3KYnj.js +6 -0
- package/lib/public/assets/{lock-s9ZhGDFF.js → lock-DnyJ9riq.js} +1 -1
- package/lib/public/assets/{login-EkaxK7K5.js → login-BMa0mDmt.js} +1 -1
- package/lib/public/assets/{maintenance-settings-yYhZaU7n.js → maintenance-settings-EezUAUBC.js} +1 -1
- package/lib/public/assets/{mouse-pointer-2-C6yy1DTx.js → mouse-pointer-2-k4GDYFXz.js} +1 -1
- package/lib/public/assets/{network-B8fPwmW9.js → network-ULTYYDWq.js} +1 -1
- package/lib/public/assets/{overview-DrTe5eJi.js → overview-DM4y4MtE.js} +1 -1
- package/lib/public/assets/{page-header-DhD-Kua9.js → page-header-DgX21Ndv.js} +1 -1
- package/lib/public/assets/{plus-B75ovH3O.js → plus-DaUKFcvv.js} +1 -1
- package/lib/public/assets/{profile-page-C2p5rB3x.js → profile-page-dcPePTH5.js} +1 -1
- package/lib/public/assets/{reset-password-tCemYrqV.js → reset-password-Ct5IlHB3.js} +1 -1
- package/lib/public/assets/{runbook-page-Dq3wdSII.js → runbook-page-C5jLKOAy.js} +1 -1
- package/lib/public/assets/{select-Cfv-njLE.js → select-HMxRDgs7.js} +1 -1
- package/lib/public/assets/selector-detail-page-BhlyEw8l.js +1 -0
- package/lib/public/assets/{selector-health-BP45B44s.js → selector-health-DQlTiNJV.js} +1 -1
- package/lib/public/assets/{selector-health-page-D-8SdN_l.js → selector-health-page-Cd1Mm_DB.js} +1 -1
- package/lib/public/assets/{session-detail-page-Dm4tnoTT.js → session-detail-page-BU8Y3HnL.js} +3 -8
- package/lib/public/assets/{settings-ChfaAd8F.js → settings-k_Xaf5kj.js} +1 -1
- package/lib/public/assets/{status-pill-outline-CLa0C1Sg.js → status-pill-outline-C5m6HFzT.js} +1 -1
- package/lib/public/assets/{tablet-0sIFwy2Z.js → tablet-2ogUZZch.js} +1 -1
- package/lib/public/assets/{teams-BFhWbK5i.js → teams-C2AfSO30.js} +1 -1
- package/lib/public/assets/{trash-2-BcQxmJP-.js → trash-2-BDdM7yPO.js} +1 -1
- package/lib/public/assets/{upload-BucqEWub.js → upload-C1vqAOQK.js} +1 -1
- package/lib/public/assets/{use-password-reset-mode-XoxXVCzm.js → use-password-reset-mode-Cw6xu19K.js} +1 -1
- package/lib/public/assets/{users-DyB6E3FF.js → users-C5jlnASB.js} +1 -1
- package/lib/public/assets/{users-B7uveXL_.js → users-CsatJcoI.js} +1 -1
- package/lib/public/assets/video-off-CAdNNByI.js +6 -0
- package/lib/public/assets/{webhook-settings-qoHAETzC.js → webhook-settings-D9Yjj-J6.js} +1 -1
- package/lib/public/assets/{zap-CqGOjAjn.js → zap-CduRPXBS.js} +1 -1
- package/lib/public/index.html +2 -2
- package/package.json +1 -1
- package/lib/public/assets/DeviceMosaicView-O292tZkA.js +0 -2
- package/lib/public/assets/keycodes-bIEJfQzr.js +0 -1
- package/lib/public/assets/layers-CLuKN5Oy.js +0 -11
- package/lib/public/assets/selector-detail-page-8xf4CxH5.js +0 -1
|
@@ -1,209 +1,189 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as V,j as t,r as d,t as mn,R as Qn,v as ei,w as je,C as Os,U as ti,X as W,x as Zt,y as hn,u as ks,b as si,z as ni,A as et,S as Ot,B as fn,i as pn,f as is,p as ii,q as Ps,D as rs}from"./index-4PUiCXoJ.js";import{P as ri}from"./page-header-DgX21Ndv.js";import{B as tt}from"./button-Kv_nqg_I.js";import{S as Jt}from"./select-HMxRDgs7.js";import{P as Oe,B as oi}from"./BugReportButton-DFK28wAC.js";import{P as wt,u as Vt,a as vt,b as gn,c as As,d as ai,D as ci,e as zs,f as li,g as st,h as di,M as xn}from"./Modal-BCbDzIzg.js";import{F as Ut}from"./FieldGroup-C_DwE2dP.js";import{C as yn}from"./clock-lLny_RuH.js";import{P as ui}from"./plus-DaUKFcvv.js";import{A as mi}from"./activity-Bv16pTkN.js";import{p as vn}from"./labels-C21SA4JG.js";import{C as qe}from"./copy-CYjhxjiV.js";import{T as bn,U as hi}from"./upload-C1vqAOQK.js";import{f as fi}from"./time-B8FIgwPE.js";import{M as Fs,F as pi}from"./mouse-pointer-2-k4GDYFXz.js";import{L as gi}from"./layers-CVD3KYnj.js";import{Z as xs}from"./zap-CduRPXBS.js";import{C as Bt}from"./check-DvGXlj1A.js";import{C as wn}from"./chevron-right-CuPozn4T.js";import{S as jn,C as xi,H as yi,a as os,A as xt,I as as}from"./keycodes-paeodb9g.js";import{D as vi}from"./download-2y5oRiK2.js";import{T as Wt}from"./trash-2-BDdM7yPO.js";import{C as cs}from"./chevron-left-CZDYD4H3.js";import{L as bi}from"./lock-DnyJ9riq.js";import{S as wi}from"./SegmentedControl-BPjRPFXH.js";import"./utils-CDN07tui.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
5
5
|
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/const
|
|
6
|
+
*/const ji=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Ni=V("arrow-down",ji);/**
|
|
7
7
|
* @license lucide-react v0.555.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const
|
|
11
|
+
*/const Ci=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Si=V("arrow-up",Ci);/**
|
|
12
12
|
* @license lucide-react v0.555.0 - ISC
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the ISC license.
|
|
15
15
|
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/const
|
|
16
|
+
*/const ki=[["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 14v-4",key:"14a6bd"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],Ai=V("battery-low",ki);/**
|
|
17
17
|
* @license lucide-react v0.555.0 - ISC
|
|
18
18
|
*
|
|
19
19
|
* This source code is licensed under the ISC license.
|
|
20
20
|
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
-
*/const
|
|
21
|
+
*/const Ri=[["path",{d:"M10 17h.01",key:"nbq80n"}],["path",{d:"M10 7v6",key:"nne03l"}],["path",{d:"M14 6h2a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2",key:"1m83kb"}],["path",{d:"M22 14v-4",key:"14q9d5"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"h8lgfh"}]],Ei=V("battery-warning",Ri);/**
|
|
22
22
|
* @license lucide-react v0.555.0 - ISC
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the ISC license.
|
|
25
25
|
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/const
|
|
26
|
+
*/const $i=[["path",{d:"M 22 14 L 22 10",key:"nqc4tb"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],Di=V("battery",$i);/**
|
|
27
27
|
* @license lucide-react v0.555.0 - ISC
|
|
28
28
|
*
|
|
29
29
|
* This source code is licensed under the ISC license.
|
|
30
30
|
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
-
*/const
|
|
31
|
+
*/const Ti=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],Li=V("box",Ti);/**
|
|
32
32
|
* @license lucide-react v0.555.0 - ISC
|
|
33
33
|
*
|
|
34
34
|
* This source code is licensed under the ISC license.
|
|
35
35
|
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/const
|
|
36
|
+
*/const Mi=[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M21 12.598V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1glfrc"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]],Ii=V("calendar-plus",Mi);/**
|
|
37
37
|
* @license lucide-react v0.555.0 - ISC
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the ISC license.
|
|
40
40
|
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/const
|
|
41
|
+
*/const _i=[["path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16",key:"d5nyq2"}],["path",{d:"M22 9v7",key:"pvm9v3"}],["path",{d:"M3.304 13h6.392",key:"1q3zxz"}],["circle",{cx:"18.5",cy:"12.5",r:"3.5",key:"z97x68"}]],Oi=V("case-sensitive",_i);/**
|
|
42
42
|
* @license lucide-react v0.555.0 - ISC
|
|
43
43
|
*
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
-
*/const
|
|
46
|
+
*/const Pi=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],zi=V("chevron-up",Pi);/**
|
|
47
47
|
* @license lucide-react v0.555.0 - ISC
|
|
48
48
|
*
|
|
49
49
|
* This source code is licensed under the ISC license.
|
|
50
50
|
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
-
*/const
|
|
51
|
+
*/const Fi=[["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"}]],Ui=V("circle-question-mark",Fi);/**
|
|
52
52
|
* @license lucide-react v0.555.0 - ISC
|
|
53
53
|
*
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
-
*/const
|
|
56
|
+
*/const Bi=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],Wi=V("clipboard",Bi);/**
|
|
57
57
|
* @license lucide-react v0.555.0 - ISC
|
|
58
58
|
*
|
|
59
59
|
* This source code is licensed under the ISC license.
|
|
60
60
|
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
-
*/const
|
|
61
|
+
*/const Hi=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],Us=V("code-xml",Hi);/**
|
|
62
62
|
* @license lucide-react v0.555.0 - ISC
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the ISC license.
|
|
65
65
|
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/const
|
|
66
|
+
*/const Vi=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]],qi=V("crosshair",Vi);/**
|
|
67
67
|
* @license lucide-react v0.555.0 - ISC
|
|
68
68
|
*
|
|
69
69
|
* This source code is licensed under the ISC license.
|
|
70
70
|
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
-
*/const
|
|
71
|
+
*/const Xi=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],Ki=V("ellipsis",Xi);/**
|
|
72
72
|
* @license lucide-react v0.555.0 - ISC
|
|
73
73
|
*
|
|
74
74
|
* This source code is licensed under the ISC license.
|
|
75
75
|
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
-
*/const
|
|
76
|
+
*/const Gi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Yi=V("grid-3x3",Gi);/**
|
|
77
77
|
* @license lucide-react v0.555.0 - ISC
|
|
78
78
|
*
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
-
*/const
|
|
81
|
+
*/const Zi=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Ji=V("lightbulb",Zi);/**
|
|
82
82
|
* @license lucide-react v0.555.0 - ISC
|
|
83
83
|
*
|
|
84
84
|
* This source code is licensed under the ISC license.
|
|
85
85
|
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
-
*/const
|
|
86
|
+
*/const Qi=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]],er=V("lock-open",Qi);/**
|
|
87
87
|
* @license lucide-react v0.555.0 - ISC
|
|
88
88
|
*
|
|
89
89
|
* This source code is licensed under the ISC license.
|
|
90
90
|
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
-
*/const
|
|
91
|
+
*/const tr=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],sr=V("map-pin",tr);/**
|
|
92
92
|
* @license lucide-react v0.555.0 - ISC
|
|
93
93
|
*
|
|
94
94
|
* This source code is licensed under the ISC license.
|
|
95
95
|
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
-
*/const
|
|
96
|
+
*/const nr=[["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"}]],ir=V("message-square",nr);/**
|
|
97
97
|
* @license lucide-react v0.555.0 - ISC
|
|
98
98
|
*
|
|
99
99
|
* This source code is licensed under the ISC license.
|
|
100
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
-
*/const
|
|
101
|
+
*/const rr=[["path",{d:"M18 5h4",key:"1lhgn2"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],or=V("moon-star",rr);/**
|
|
102
102
|
* @license lucide-react v0.555.0 - ISC
|
|
103
103
|
*
|
|
104
104
|
* This source code is licensed under the ISC license.
|
|
105
105
|
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
-
*/const
|
|
106
|
+
*/const ar=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],cr=V("move",ar);/**
|
|
107
107
|
* @license lucide-react v0.555.0 - ISC
|
|
108
108
|
*
|
|
109
109
|
* This source code is licensed under the ISC license.
|
|
110
110
|
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
-
*/const
|
|
111
|
+
*/const lr=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],dr=V("package",lr);/**
|
|
112
112
|
* @license lucide-react v0.555.0 - ISC
|
|
113
113
|
*
|
|
114
114
|
* This source code is licensed under the ISC license.
|
|
115
115
|
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
-
*/const
|
|
116
|
+
*/const ur=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],mr=V("panels-top-left",ur);/**
|
|
117
117
|
* @license lucide-react v0.555.0 - ISC
|
|
118
118
|
*
|
|
119
119
|
* This source code is licensed under the ISC license.
|
|
120
120
|
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
-
*/const
|
|
121
|
+
*/const hr=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]],fr=V("rectangle-horizontal",hr);/**
|
|
122
122
|
* @license lucide-react v0.555.0 - ISC
|
|
123
123
|
*
|
|
124
124
|
* This source code is licensed under the ISC license.
|
|
125
125
|
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
-
*/const
|
|
126
|
+
*/const pr=[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]],gr=V("rectangle-vertical",pr);/**
|
|
127
127
|
* @license lucide-react v0.555.0 - ISC
|
|
128
128
|
*
|
|
129
129
|
* This source code is licensed under the ISC license.
|
|
130
130
|
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
-
*/const
|
|
131
|
+
*/const xr=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],yt=V("rotate-cw",xr);/**
|
|
132
132
|
* @license lucide-react v0.555.0 - ISC
|
|
133
133
|
*
|
|
134
134
|
* This source code is licensed under the ISC license.
|
|
135
135
|
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
-
*/const
|
|
136
|
+
*/const yr=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],vr=V("scroll-text",yr);/**
|
|
137
137
|
* @license lucide-react v0.555.0 - ISC
|
|
138
138
|
*
|
|
139
139
|
* This source code is licensed under the ISC license.
|
|
140
140
|
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
-
*/const
|
|
141
|
+
*/const br=[["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"}]],Qe=V("shield-alert",br);/**
|
|
142
142
|
* @license lucide-react v0.555.0 - ISC
|
|
143
143
|
*
|
|
144
144
|
* This source code is licensed under the ISC license.
|
|
145
145
|
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
-
*/const
|
|
146
|
+
*/const wr=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],ys=V("sparkles",wr);/**
|
|
147
147
|
* @license lucide-react v0.555.0 - ISC
|
|
148
148
|
*
|
|
149
149
|
* This source code is licensed under the ISC license.
|
|
150
150
|
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
-
*/const
|
|
151
|
+
*/const jr=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],Nr=V("tag",jr);/**
|
|
152
152
|
* @license lucide-react v0.555.0 - ISC
|
|
153
153
|
*
|
|
154
154
|
* This source code is licensed under the ISC license.
|
|
155
155
|
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
-
*/const
|
|
156
|
+
*/const Cr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],ls=V("target",Cr);/**
|
|
157
157
|
* @license lucide-react v0.555.0 - ISC
|
|
158
158
|
*
|
|
159
159
|
* This source code is licensed under the ISC license.
|
|
160
160
|
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
-
*/const
|
|
161
|
+
*/const Sr=[["path",{d:"m16 16-3 3 3 3",key:"117b85"}],["path",{d:"M3 12h14.5a1 1 0 0 1 0 7H13",key:"18xa6z"}],["path",{d:"M3 19h6",key:"1ygdsz"}],["path",{d:"M3 5h18",key:"1u36vt"}]],kr=V("text-wrap",Sr);/**
|
|
162
162
|
* @license lucide-react v0.555.0 - ISC
|
|
163
163
|
*
|
|
164
164
|
* This source code is licensed under the ISC license.
|
|
165
165
|
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
-
*/const
|
|
166
|
+
*/const Ar=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],Rr=V("thermometer",Ar);/**
|
|
167
167
|
* @license lucide-react v0.555.0 - ISC
|
|
168
168
|
*
|
|
169
169
|
* This source code is licensed under the ISC license.
|
|
170
170
|
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
-
*/const
|
|
171
|
+
*/const Er=[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M12 20v-6",key:"1rm09r"}]],Bs=V("touchpad",Er);/**
|
|
172
172
|
* @license lucide-react v0.555.0 - ISC
|
|
173
173
|
*
|
|
174
174
|
* This source code is licensed under the ISC license.
|
|
175
175
|
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
-
*/const
|
|
176
|
+
*/const $r=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]],Dr=V("volume-1",$r);/**
|
|
177
177
|
* @license lucide-react v0.555.0 - ISC
|
|
178
178
|
*
|
|
179
179
|
* This source code is licensed under the ISC license.
|
|
180
180
|
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
-
*/const
|
|
181
|
+
*/const Tr=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Lr=V("volume-2",Tr);/**
|
|
182
182
|
* @license lucide-react v0.555.0 - ISC
|
|
183
183
|
*
|
|
184
184
|
* This source code is licensed under the ISC license.
|
|
185
185
|
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
-
*/const Dr=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],Tr=W("thermometer",Dr);/**
|
|
187
|
-
* @license lucide-react v0.555.0 - ISC
|
|
188
|
-
*
|
|
189
|
-
* This source code is licensed under the ISC license.
|
|
190
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
191
|
-
*/const Lr=[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M12 20v-6",key:"1rm09r"}]],Bs=W("touchpad",Lr);/**
|
|
192
|
-
* @license lucide-react v0.555.0 - ISC
|
|
193
|
-
*
|
|
194
|
-
* This source code is licensed under the ISC license.
|
|
195
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
196
|
-
*/const Mr=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]],Ir=W("volume-1",Mr);/**
|
|
197
|
-
* @license lucide-react v0.555.0 - ISC
|
|
198
|
-
*
|
|
199
|
-
* This source code is licensed under the ISC license.
|
|
200
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
201
|
-
*/const _r=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Or=W("volume-2",_r);/**
|
|
202
|
-
* @license lucide-react v0.555.0 - ISC
|
|
203
|
-
*
|
|
204
|
-
* This source code is licensed under the ISC license.
|
|
205
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
206
|
-
*/const Pr=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],zr=W("wifi",Pr);function Fr(e){if(typeof e!="number")throw new TypeError("Expected a number");const s=e>0?Math.floor:Math.ceil;return{days:s(e/864e5),hours:s(e/36e5)%24,minutes:s(e/6e4)%60,seconds:s(e/1e3)%60,milliseconds:s(e)%1e3,microseconds:s(e*1e3)%1e3,nanoseconds:s(e*1e6)%1e3}}const Ur=(e,s)=>s===1?e:`${e}s`,Br=1e-7;function Nn(e,s={}){if(!Number.isFinite(e))throw new TypeError("Expected a finite number");s.colonNotation&&(s.compact=!1,s.formatSubMilliseconds=!1,s.separateMilliseconds=!1,s.verbose=!1),s.compact&&(s.secondsDecimalDigits=0,s.millisecondsDecimalDigits=0);const n=[],i=(c,l)=>{const o=Math.floor(c*10**l+Br);return(Math.round(o)/10**l).toFixed(l)},r=(c,l,o,u)=>{if((n.length===0||!s.colonNotation)&&c===0&&!(s.colonNotation&&o==="m"))return;u=(u||c||"0").toString();let m,f;if(s.colonNotation){m=n.length>0?":":"",f="";const p=u.includes(".")?u.split(".")[0].length:u.length,y=n.length>0?2:1;u="0".repeat(Math.max(0,y-p))+u}else m="",f=s.verbose?" "+Ur(l,c):o;n.push(m+u+f)},a=Fr(e);if(r(Math.trunc(a.days/365),"year","y"),r(a.days%365,"day","d"),r(a.hours,"hour","h"),r(a.minutes,"minute","m"),s.separateMilliseconds||s.formatSubMilliseconds||!s.colonNotation&&e<1e3)if(r(a.seconds,"second","s"),s.formatSubMilliseconds)r(a.milliseconds,"millisecond","ms"),r(a.microseconds,"microsecond","µs"),r(a.nanoseconds,"nanosecond","ns");else{const c=a.milliseconds+a.microseconds/1e3+a.nanoseconds/1e6,l=typeof s.millisecondsDecimalDigits=="number"?s.millisecondsDecimalDigits:0,o=c>=1?Math.round(c):Math.ceil(c),u=l?c.toFixed(l):o;r(Number.parseFloat(u),"millisecond","ms",u)}else{const c=e/1e3%60,l=typeof s.secondsDecimalDigits=="number"?s.secondsDecimalDigits:1,o=i(c,l),u=s.keepDecimalsOnWholeSeconds?o:o.replace(/\.0+$/,"");r(Number.parseFloat(u),"second","s",u)}if(n.length===0)return"0"+(s.verbose?" milliseconds":"ms");if(s.compact)return n[0];if(typeof s.unitCount=="number"){const c=s.colonNotation?"":" ";return n.slice(0,Math.max(s.unitCount,1)).join(c)}return s.colonNotation?n.join(""):n.join(" ")}function Hr(e){return!Number.isFinite(e)||e<=0?"expiring":Nn(e,{unitCount:2})}const Wr=({kind:e,size:s=6,className:n})=>t.jsx("span",{className:`status-dot status-dot-${e}${n?" "+n:""}`,style:{width:s,height:s},"aria-hidden":!0}),Vr=({kind:e,showDot:s,children:n})=>t.jsxs("span",{className:`status-code status-code-${e}`,children:[s&&t.jsx(Wr,{kind:e}),t.jsx("span",{className:"status-code-label",children:qr(String(n))})]});function qr(e){const s=e.trim().toLowerCase();return s.charAt(0).toUpperCase()+s.slice(1)}const ds=({label:e,value:s,mono:n,valueClassName:i})=>t.jsxs("div",{className:"kv-row",children:[t.jsx("span",{className:"kv-label",children:e}),t.jsx("span",{className:`kv-value${n?" kv-value-mono":""}${i?" "+i:""}`,children:s})]}),Xr=["top","right","bottom","left"],Pe=Math.min,le=Math.max,qt=Math.round,Pt=Math.floor,Ce=e=>({x:e,y:e}),Kr={left:"right",right:"left",bottom:"top",top:"bottom"};function vs(e,s,n){return le(e,Pe(s,n))}function $e(e,s){return typeof e=="function"?e(s):e}function De(e){return e.split("-")[0]}function ot(e){return e.split("-")[1]}function Rs(e){return e==="x"?"y":"x"}function Es(e){return e==="y"?"height":"width"}function Ne(e){const s=e[0];return s==="t"||s==="b"?"y":"x"}function $s(e){return Rs(Ne(e))}function Gr(e,s,n){n===void 0&&(n=!1);const i=ot(e),r=$s(e),a=Es(r);let c=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return s.reference[a]>s.floating[a]&&(c=Xt(c)),[c,Xt(c)]}function Yr(e){const s=Xt(e);return[bs(e),s,bs(s)]}function bs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Hs=["left","right"],Ws=["right","left"],Zr=["top","bottom"],Jr=["bottom","top"];function Qr(e,s,n){switch(e){case"top":case"bottom":return n?s?Ws:Hs:s?Hs:Ws;case"left":case"right":return s?Zr:Jr;default:return[]}}function eo(e,s,n,i){const r=ot(e);let a=Qr(De(e),n==="start",i);return r&&(a=a.map(c=>c+"-"+r),s&&(a=a.concat(a.map(bs)))),a}function Xt(e){const s=De(e);return Kr[s]+e.slice(s.length)}function to(e){return{top:0,right:0,bottom:0,left:0,...e}}function Cn(e){return typeof e!="number"?to(e):{top:e,right:e,bottom:e,left:e}}function Kt(e){const{x:s,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:s,right:s+i,bottom:n+r,x:s,y:n}}function Vs(e,s,n){let{reference:i,floating:r}=e;const a=Ne(s),c=$s(s),l=Es(c),o=De(s),u=a==="y",m=i.x+i.width/2-r.width/2,f=i.y+i.height/2-r.height/2,p=i[l]/2-r[l]/2;let y;switch(o){case"top":y={x:m,y:i.y-r.height};break;case"bottom":y={x:m,y:i.y+i.height};break;case"right":y={x:i.x+i.width,y:f};break;case"left":y={x:i.x-r.width,y:f};break;default:y={x:i.x,y:i.y}}switch(ot(s)){case"start":y[c]-=p*(n&&u?-1:1);break;case"end":y[c]+=p*(n&&u?-1:1);break}return y}async function so(e,s){var n;s===void 0&&(s={});const{x:i,y:r,platform:a,rects:c,elements:l,strategy:o}=e,{boundary:u="clippingAncestors",rootBoundary:m="viewport",elementContext:f="floating",altBoundary:p=!1,padding:y=0}=$e(s,e),g=Cn(y),v=l[p?f==="floating"?"reference":"floating":f],k=Kt(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(l.floating)),boundary:u,rootBoundary:m,strategy:o})),N=f==="floating"?{x:i,y:r,width:c.floating.width,height:c.floating.height}:c.reference,j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),w=await(a.isElement==null?void 0:a.isElement(j))?await(a.getScale==null?void 0:a.getScale(j))||{x:1,y:1}:{x:1,y:1},D=Kt(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:j,strategy:o}):N);return{top:(k.top-D.top+g.top)/w.y,bottom:(D.bottom-k.bottom+g.bottom)/w.y,left:(k.left-D.left+g.left)/w.x,right:(D.right-k.right+g.right)/w.x}}const no=50,io=async(e,s,n)=>{const{placement:i="bottom",strategy:r="absolute",middleware:a=[],platform:c}=n,l=c.detectOverflow?c:{...c,detectOverflow:so},o=await(c.isRTL==null?void 0:c.isRTL(s));let u=await c.getElementRects({reference:e,floating:s,strategy:r}),{x:m,y:f}=Vs(u,i,o),p=i,y=0;const g={};for(let b=0;b<a.length;b++){const v=a[b];if(!v)continue;const{name:k,fn:N}=v,{x:j,y:w,data:D,reset:$}=await N({x:m,y:f,initialPlacement:i,placement:p,strategy:r,middlewareData:g,rects:u,platform:l,elements:{reference:e,floating:s}});m=j??m,f=w??f,g[k]={...g[k],...D},$&&y<no&&(y++,typeof $=="object"&&($.placement&&(p=$.placement),$.rects&&(u=$.rects===!0?await c.getElementRects({reference:e,floating:s,strategy:r}):$.rects),{x:m,y:f}=Vs(u,p,o)),b=-1)}return{x:m,y:f,placement:p,strategy:r,middlewareData:g}},ro=e=>({name:"arrow",options:e,async fn(s){const{x:n,y:i,placement:r,rects:a,platform:c,elements:l,middlewareData:o}=s,{element:u,padding:m=0}=$e(e,s)||{};if(u==null)return{};const f=Cn(m),p={x:n,y:i},y=$s(r),g=Es(y),b=await c.getDimensions(u),v=y==="y",k=v?"top":"left",N=v?"bottom":"right",j=v?"clientHeight":"clientWidth",w=a.reference[g]+a.reference[y]-p[y]-a.floating[g],D=p[y]-a.reference[y],$=await(c.getOffsetParent==null?void 0:c.getOffsetParent(u));let T=$?$[j]:0;(!T||!await(c.isElement==null?void 0:c.isElement($)))&&(T=l.floating[j]||a.floating[g]);const L=w/2-D/2,F=T/2-b[g]/2-1,M=Pe(f[k],F),O=Pe(f[N],F),U=M,G=T-b[g]-O,q=T/2-b[g]/2+L,Z=vs(U,q,G),V=!o.arrow&&ot(r)!=null&&q!==Z&&a.reference[g]/2-(q<U?M:O)-b[g]/2<0,B=V?q<U?q-U:q-G:0;return{[y]:p[y]+B,data:{[y]:Z,centerOffset:q-Z-B,...V&&{alignmentOffset:B}},reset:V}}}),oo=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(s){var n,i;const{placement:r,middlewareData:a,rects:c,initialPlacement:l,platform:o,elements:u}=s,{mainAxis:m=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=$e(e,s);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const k=De(r),N=Ne(l),j=De(l)===l,w=await(o.isRTL==null?void 0:o.isRTL(u.floating)),D=p||(j||!b?[Xt(l)]:Yr(l)),$=g!=="none";!p&&$&&D.push(...eo(l,b,g,w));const T=[l,...D],L=await o.detectOverflow(s,v),F=[];let M=((i=a.flip)==null?void 0:i.overflows)||[];if(m&&F.push(L[k]),f){const q=Gr(r,c,w);F.push(L[q[0]],L[q[1]])}if(M=[...M,{placement:r,overflows:F}],!F.every(q=>q<=0)){var O,U;const q=(((O=a.flip)==null?void 0:O.index)||0)+1,Z=T[q];if(Z&&(!(f==="alignment"?N!==Ne(Z):!1)||M.every(R=>Ne(R.placement)===N?R.overflows[0]>0:!0)))return{data:{index:q,overflows:M},reset:{placement:Z}};let V=(U=M.filter(B=>B.overflows[0]<=0).sort((B,R)=>B.overflows[1]-R.overflows[1])[0])==null?void 0:U.placement;if(!V)switch(y){case"bestFit":{var G;const B=(G=M.filter(R=>{if($){const C=Ne(R.placement);return C===N||C==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(C=>C>0).reduce((C,ne)=>C+ne,0)]).sort((R,C)=>R[1]-C[1])[0])==null?void 0:G[0];B&&(V=B);break}case"initialPlacement":V=l;break}if(r!==V)return{reset:{placement:V}}}return{}}}};function qs(e,s){return{top:e.top-s.height,right:e.right-s.width,bottom:e.bottom-s.height,left:e.left-s.width}}function Xs(e){return Xr.some(s=>e[s]>=0)}const ao=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(s){const{rects:n,platform:i}=s,{strategy:r="referenceHidden",...a}=$e(e,s);switch(r){case"referenceHidden":{const c=await i.detectOverflow(s,{...a,elementContext:"reference"}),l=qs(c,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Xs(l)}}}case"escaped":{const c=await i.detectOverflow(s,{...a,altBoundary:!0}),l=qs(c,n.floating);return{data:{escapedOffsets:l,escaped:Xs(l)}}}default:return{}}}}},Sn=new Set(["left","top"]);async function co(e,s){const{placement:n,platform:i,elements:r}=e,a=await(i.isRTL==null?void 0:i.isRTL(r.floating)),c=De(n),l=ot(n),o=Ne(n)==="y",u=Sn.has(c)?-1:1,m=a&&o?-1:1,f=$e(s,e);let{mainAxis:p,crossAxis:y,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(y=l==="end"?g*-1:g),o?{x:y*m,y:p*u}:{x:p*u,y:y*m}}const lo=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(s){var n,i;const{x:r,y:a,placement:c,middlewareData:l}=s,o=await co(s,e);return c===((n=l.offset)==null?void 0:n.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:r+o.x,y:a+o.y,data:{...o,placement:c}}}}},uo=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(s){const{x:n,y:i,placement:r,platform:a}=s,{mainAxis:c=!0,crossAxis:l=!1,limiter:o={fn:k=>{let{x:N,y:j}=k;return{x:N,y:j}}},...u}=$e(e,s),m={x:n,y:i},f=await a.detectOverflow(s,u),p=Ne(De(r)),y=Rs(p);let g=m[y],b=m[p];if(c){const k=y==="y"?"top":"left",N=y==="y"?"bottom":"right",j=g+f[k],w=g-f[N];g=vs(j,g,w)}if(l){const k=p==="y"?"top":"left",N=p==="y"?"bottom":"right",j=b+f[k],w=b-f[N];b=vs(j,b,w)}const v=o.fn({...s,[y]:g,[p]:b});return{...v,data:{x:v.x-n,y:v.y-i,enabled:{[y]:c,[p]:l}}}}}},mo=function(e){return e===void 0&&(e={}),{options:e,fn(s){const{x:n,y:i,placement:r,rects:a,middlewareData:c}=s,{offset:l=0,mainAxis:o=!0,crossAxis:u=!0}=$e(e,s),m={x:n,y:i},f=Ne(r),p=Rs(f);let y=m[p],g=m[f];const b=$e(l,s),v=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(o){const j=p==="y"?"height":"width",w=a.reference[p]-a.floating[j]+v.mainAxis,D=a.reference[p]+a.reference[j]-v.mainAxis;y<w?y=w:y>D&&(y=D)}if(u){var k,N;const j=p==="y"?"width":"height",w=Sn.has(De(r)),D=a.reference[f]-a.floating[j]+(w&&((k=c.offset)==null?void 0:k[f])||0)+(w?0:v.crossAxis),$=a.reference[f]+a.reference[j]+(w?0:((N=c.offset)==null?void 0:N[f])||0)-(w?v.crossAxis:0);g<D?g=D:g>$&&(g=$)}return{[p]:y,[f]:g}}}},ho=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(s){var n,i;const{placement:r,rects:a,platform:c,elements:l}=s,{apply:o=()=>{},...u}=$e(e,s),m=await c.detectOverflow(s,u),f=De(r),p=ot(r),y=Ne(r)==="y",{width:g,height:b}=a.floating;let v,k;f==="top"||f==="bottom"?(v=f,k=p===(await(c.isRTL==null?void 0:c.isRTL(l.floating))?"start":"end")?"left":"right"):(k=f,v=p==="end"?"top":"bottom");const N=b-m.top-m.bottom,j=g-m.left-m.right,w=Pe(b-m[v],N),D=Pe(g-m[k],j),$=!s.middlewareData.shift;let T=w,L=D;if((n=s.middlewareData.shift)!=null&&n.enabled.x&&(L=j),(i=s.middlewareData.shift)!=null&&i.enabled.y&&(T=N),$&&!p){const M=le(m.left,0),O=le(m.right,0),U=le(m.top,0),G=le(m.bottom,0);y?L=g-2*(M!==0||O!==0?M+O:le(m.left,m.right)):T=b-2*(U!==0||G!==0?U+G:le(m.top,m.bottom))}await o({...s,availableWidth:L,availableHeight:T});const F=await c.getDimensions(l.floating);return g!==F.width||b!==F.height?{reset:{rects:!0}}:{}}}};function Qt(){return typeof window<"u"}function at(e){return kn(e)?(e.nodeName||"").toLowerCase():"#document"}function de(e){var s;return(e==null||(s=e.ownerDocument)==null?void 0:s.defaultView)||window}function Se(e){var s;return(s=(kn(e)?e.ownerDocument:e.document)||window.document)==null?void 0:s.documentElement}function kn(e){return Qt()?e instanceof Node||e instanceof de(e).Node:!1}function xe(e){return Qt()?e instanceof Element||e instanceof de(e).Element:!1}function Le(e){return Qt()?e instanceof HTMLElement||e instanceof de(e).HTMLElement:!1}function Ks(e){return!Qt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof de(e).ShadowRoot}function jt(e){const{overflow:s,overflowX:n,overflowY:i,display:r}=ye(e);return/auto|scroll|overlay|hidden|clip/.test(s+i+n)&&r!=="inline"&&r!=="contents"}function fo(e){return/^(table|td|th)$/.test(at(e))}function es(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const po=/transform|translate|scale|rotate|perspective|filter/,go=/paint|layout|strict|content/,Ve=e=>!!e&&e!=="none";let us;function Ds(e){const s=xe(e)?ye(e):e;return Ve(s.transform)||Ve(s.translate)||Ve(s.scale)||Ve(s.rotate)||Ve(s.perspective)||!Ts()&&(Ve(s.backdropFilter)||Ve(s.filter))||po.test(s.willChange||"")||go.test(s.contain||"")}function xo(e){let s=ze(e);for(;Le(s)&&!it(s);){if(Ds(s))return s;if(es(s))return null;s=ze(s)}return null}function Ts(){return us==null&&(us=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),us}function it(e){return/^(html|body|#document)$/.test(at(e))}function ye(e){return de(e).getComputedStyle(e)}function ts(e){return xe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ze(e){if(at(e)==="html")return e;const s=e.assignedSlot||e.parentNode||Ks(e)&&e.host||Se(e);return Ks(s)?s.host:s}function An(e){const s=ze(e);return it(s)?e.ownerDocument?e.ownerDocument.body:e.body:Le(s)&&jt(s)?s:An(s)}function bt(e,s,n){var i;s===void 0&&(s=[]),n===void 0&&(n=!0);const r=An(e),a=r===((i=e.ownerDocument)==null?void 0:i.body),c=de(r);if(a){const l=ws(c);return s.concat(c,c.visualViewport||[],jt(r)?r:[],l&&n?bt(l):[])}else return s.concat(r,bt(r,[],n))}function ws(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Rn(e){const s=ye(e);let n=parseFloat(s.width)||0,i=parseFloat(s.height)||0;const r=Le(e),a=r?e.offsetWidth:n,c=r?e.offsetHeight:i,l=qt(n)!==a||qt(i)!==c;return l&&(n=a,i=c),{width:n,height:i,$:l}}function Ls(e){return xe(e)?e:e.contextElement}function nt(e){const s=Ls(e);if(!Le(s))return Ce(1);const n=s.getBoundingClientRect(),{width:i,height:r,$:a}=Rn(s);let c=(a?qt(n.width):n.width)/i,l=(a?qt(n.height):n.height)/r;return(!c||!Number.isFinite(c))&&(c=1),(!l||!Number.isFinite(l))&&(l=1),{x:c,y:l}}const yo=Ce(0);function En(e){const s=de(e);return!Ts()||!s.visualViewport?yo:{x:s.visualViewport.offsetLeft,y:s.visualViewport.offsetTop}}function vo(e,s,n){return s===void 0&&(s=!1),!n||s&&n!==de(e)?!1:s}function Xe(e,s,n,i){s===void 0&&(s=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),a=Ls(e);let c=Ce(1);s&&(i?xe(i)&&(c=nt(i)):c=nt(e));const l=vo(a,n,i)?En(a):Ce(0);let o=(r.left+l.x)/c.x,u=(r.top+l.y)/c.y,m=r.width/c.x,f=r.height/c.y;if(a){const p=de(a),y=i&&xe(i)?de(i):i;let g=p,b=ws(g);for(;b&&i&&y!==g;){const v=nt(b),k=b.getBoundingClientRect(),N=ye(b),j=k.left+(b.clientLeft+parseFloat(N.paddingLeft))*v.x,w=k.top+(b.clientTop+parseFloat(N.paddingTop))*v.y;o*=v.x,u*=v.y,m*=v.x,f*=v.y,o+=j,u+=w,g=de(b),b=ws(g)}}return Kt({width:m,height:f,x:o,y:u})}function ss(e,s){const n=ts(e).scrollLeft;return s?s.left+n:Xe(Se(e)).left+n}function $n(e,s){const n=e.getBoundingClientRect(),i=n.left+s.scrollLeft-ss(e,n),r=n.top+s.scrollTop;return{x:i,y:r}}function bo(e){let{elements:s,rect:n,offsetParent:i,strategy:r}=e;const a=r==="fixed",c=Se(i),l=s?es(s.floating):!1;if(i===c||l&&a)return n;let o={scrollLeft:0,scrollTop:0},u=Ce(1);const m=Ce(0),f=Le(i);if((f||!f&&!a)&&((at(i)!=="body"||jt(c))&&(o=ts(i)),f)){const y=Xe(i);u=nt(i),m.x=y.x+i.clientLeft,m.y=y.y+i.clientTop}const p=c&&!f&&!a?$n(c,o):Ce(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-o.scrollLeft*u.x+m.x+p.x,y:n.y*u.y-o.scrollTop*u.y+m.y+p.y}}function wo(e){return Array.from(e.getClientRects())}function jo(e){const s=Se(e),n=ts(e),i=e.ownerDocument.body,r=le(s.scrollWidth,s.clientWidth,i.scrollWidth,i.clientWidth),a=le(s.scrollHeight,s.clientHeight,i.scrollHeight,i.clientHeight);let c=-n.scrollLeft+ss(e);const l=-n.scrollTop;return ye(i).direction==="rtl"&&(c+=le(s.clientWidth,i.clientWidth)-r),{width:r,height:a,x:c,y:l}}const Gs=25;function No(e,s){const n=de(e),i=Se(e),r=n.visualViewport;let a=i.clientWidth,c=i.clientHeight,l=0,o=0;if(r){a=r.width,c=r.height;const m=Ts();(!m||m&&s==="fixed")&&(l=r.offsetLeft,o=r.offsetTop)}const u=ss(i);if(u<=0){const m=i.ownerDocument,f=m.body,p=getComputedStyle(f),y=m.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(i.clientWidth-f.clientWidth-y);g<=Gs&&(a-=g)}else u<=Gs&&(a+=u);return{width:a,height:c,x:l,y:o}}function Co(e,s){const n=Xe(e,!0,s==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,a=Le(e)?nt(e):Ce(1),c=e.clientWidth*a.x,l=e.clientHeight*a.y,o=r*a.x,u=i*a.y;return{width:c,height:l,x:o,y:u}}function Ys(e,s,n){let i;if(s==="viewport")i=No(e,n);else if(s==="document")i=jo(Se(e));else if(xe(s))i=Co(s,n);else{const r=En(e);i={x:s.x-r.x,y:s.y-r.y,width:s.width,height:s.height}}return Kt(i)}function Dn(e,s){const n=ze(e);return n===s||!xe(n)||it(n)?!1:ye(n).position==="fixed"||Dn(n,s)}function So(e,s){const n=s.get(e);if(n)return n;let i=bt(e,[],!1).filter(l=>xe(l)&&at(l)!=="body"),r=null;const a=ye(e).position==="fixed";let c=a?ze(e):e;for(;xe(c)&&!it(c);){const l=ye(c),o=Ds(c);!o&&l.position==="fixed"&&(r=null),(a?!o&&!r:!o&&l.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||jt(c)&&!o&&Dn(e,c))?i=i.filter(m=>m!==c):r=l,c=ze(c)}return s.set(e,i),i}function ko(e){let{element:s,boundary:n,rootBoundary:i,strategy:r}=e;const c=[...n==="clippingAncestors"?es(s)?[]:So(s,this._c):[].concat(n),i],l=Ys(s,c[0],r);let o=l.top,u=l.right,m=l.bottom,f=l.left;for(let p=1;p<c.length;p++){const y=Ys(s,c[p],r);o=le(y.top,o),u=Pe(y.right,u),m=Pe(y.bottom,m),f=le(y.left,f)}return{width:u-f,height:m-o,x:f,y:o}}function Ao(e){const{width:s,height:n}=Rn(e);return{width:s,height:n}}function Ro(e,s,n){const i=Le(s),r=Se(s),a=n==="fixed",c=Xe(e,!0,a,s);let l={scrollLeft:0,scrollTop:0};const o=Ce(0);function u(){o.x=ss(r)}if(i||!i&&!a)if((at(s)!=="body"||jt(r))&&(l=ts(s)),i){const y=Xe(s,!0,a,s);o.x=y.x+s.clientLeft,o.y=y.y+s.clientTop}else r&&u();a&&!i&&r&&u();const m=r&&!i&&!a?$n(r,l):Ce(0),f=c.left+l.scrollLeft-o.x-m.x,p=c.top+l.scrollTop-o.y-m.y;return{x:f,y:p,width:c.width,height:c.height}}function ms(e){return ye(e).position==="static"}function Zs(e,s){if(!Le(e)||ye(e).position==="fixed")return null;if(s)return s(e);let n=e.offsetParent;return Se(e)===n&&(n=n.ownerDocument.body),n}function Tn(e,s){const n=de(e);if(es(e))return n;if(!Le(e)){let r=ze(e);for(;r&&!it(r);){if(xe(r)&&!ms(r))return r;r=ze(r)}return n}let i=Zs(e,s);for(;i&&fo(i)&&ms(i);)i=Zs(i,s);return i&&it(i)&&ms(i)&&!Ds(i)?n:i||xo(e)||n}const Eo=async function(e){const s=this.getOffsetParent||Tn,n=this.getDimensions,i=await n(e.floating);return{reference:Ro(e.reference,await s(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function $o(e){return ye(e).direction==="rtl"}const Do={convertOffsetParentRelativeRectToViewportRelativeRect:bo,getDocumentElement:Se,getClippingRect:ko,getOffsetParent:Tn,getElementRects:Eo,getClientRects:wo,getDimensions:Ao,getScale:nt,isElement:xe,isRTL:$o};function Ln(e,s){return e.x===s.x&&e.y===s.y&&e.width===s.width&&e.height===s.height}function To(e,s){let n=null,i;const r=Se(e);function a(){var l;clearTimeout(i),(l=n)==null||l.disconnect(),n=null}function c(l,o){l===void 0&&(l=!1),o===void 0&&(o=1),a();const u=e.getBoundingClientRect(),{left:m,top:f,width:p,height:y}=u;if(l||s(),!p||!y)return;const g=Pt(f),b=Pt(r.clientWidth-(m+p)),v=Pt(r.clientHeight-(f+y)),k=Pt(m),j={rootMargin:-g+"px "+-b+"px "+-v+"px "+-k+"px",threshold:le(0,Pe(1,o))||1};let w=!0;function D($){const T=$[0].intersectionRatio;if(T!==o){if(!w)return c();T?c(!1,T):i=setTimeout(()=>{c(!1,1e-7)},1e3)}T===1&&!Ln(u,e.getBoundingClientRect())&&c(),w=!1}try{n=new IntersectionObserver(D,{...j,root:r.ownerDocument})}catch{n=new IntersectionObserver(D,j)}n.observe(e)}return c(!0),a}function Lo(e,s,n,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:o=!1}=i,u=Ls(e),m=r||a?[...u?bt(u):[],...s?bt(s):[]]:[];m.forEach(k=>{r&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const f=u&&l?To(u,n):null;let p=-1,y=null;c&&(y=new ResizeObserver(k=>{let[N]=k;N&&N.target===u&&y&&s&&(y.unobserve(s),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var j;(j=y)==null||j.observe(s)})),n()}),u&&!o&&y.observe(u),s&&y.observe(s));let g,b=o?Xe(e):null;o&&v();function v(){const k=Xe(e);b&&!Ln(b,k)&&n(),b=k,g=requestAnimationFrame(v)}return n(),()=>{var k;m.forEach(N=>{r&&N.removeEventListener("scroll",n),a&&N.removeEventListener("resize",n)}),f==null||f(),(k=y)==null||k.disconnect(),y=null,o&&cancelAnimationFrame(g)}}const Mo=lo,Io=uo,_o=oo,Oo=ho,Po=ao,Js=ro,zo=mo,Fo=(e,s,n)=>{const i=new Map,r={platform:Do,...n},a={...r.platform,_c:i};return io(e,s,{...r,platform:a})};var Uo=typeof document<"u",Bo=function(){},Wt=Uo?d.useLayoutEffect:Bo;function Gt(e,s){if(e===s)return!0;if(typeof e!=typeof s)return!1;if(typeof e=="function"&&e.toString()===s.toString())return!0;let n,i,r;if(e&&s&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==s.length)return!1;for(i=n;i--!==0;)if(!Gt(e[i],s[i]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(s).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(s,r[i]))return!1;for(i=n;i--!==0;){const a=r[i];if(!(a==="_owner"&&e.$$typeof)&&!Gt(e[a],s[a]))return!1}return!0}return e!==e&&s!==s}function Mn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qs(e,s){const n=Mn(e);return Math.round(s*n)/n}function hs(e){const s=d.useRef(e);return Wt(()=>{s.current=e}),s}function Ho(e){e===void 0&&(e={});const{placement:s="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:a,floating:c}={},transform:l=!0,whileElementsMounted:o,open:u}=e,[m,f]=d.useState({x:0,y:0,strategy:n,placement:s,middlewareData:{},isPositioned:!1}),[p,y]=d.useState(i);Gt(p,i)||y(i);const[g,b]=d.useState(null),[v,k]=d.useState(null),N=d.useCallback(R=>{R!==$.current&&($.current=R,b(R))},[]),j=d.useCallback(R=>{R!==T.current&&(T.current=R,k(R))},[]),w=a||g,D=c||v,$=d.useRef(null),T=d.useRef(null),L=d.useRef(m),F=o!=null,M=hs(o),O=hs(r),U=hs(u),G=d.useCallback(()=>{if(!$.current||!T.current)return;const R={placement:s,strategy:n,middleware:p};O.current&&(R.platform=O.current),Fo($.current,T.current,R).then(C=>{const ne={...C,isPositioned:U.current!==!1};q.current&&!Gt(L.current,ne)&&(L.current=ne,mn.flushSync(()=>{f(ne)}))})},[p,s,n,O,U]);Wt(()=>{u===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,f(R=>({...R,isPositioned:!1})))},[u]);const q=d.useRef(!1);Wt(()=>(q.current=!0,()=>{q.current=!1}),[]),Wt(()=>{if(w&&($.current=w),D&&(T.current=D),w&&D){if(M.current)return M.current(w,D,G);G()}},[w,D,G,M,F]);const Z=d.useMemo(()=>({reference:$,floating:T,setReference:N,setFloating:j}),[N,j]),V=d.useMemo(()=>({reference:w,floating:D}),[w,D]),B=d.useMemo(()=>{const R={position:n,left:0,top:0};if(!V.floating)return R;const C=Qs(V.floating,m.x),ne=Qs(V.floating,m.y);return l?{...R,transform:"translate("+C+"px, "+ne+"px)",...Mn(V.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:C,top:ne}},[n,l,V.floating,m.x,m.y]);return d.useMemo(()=>({...m,update:G,refs:Z,elements:V,floatingStyles:B}),[m,G,Z,V,B])}const Wo=e=>{function s(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:i,padding:r}=typeof e=="function"?e(n):e;return i&&s(i)?i.current!=null?Js({element:i.current,padding:r}).fn(n):{}:i?Js({element:i,padding:r}).fn(n):{}}}},Vo=(e,s)=>{const n=Mo(e);return{name:n.name,fn:n.fn,options:[e,s]}},qo=(e,s)=>{const n=Io(e);return{name:n.name,fn:n.fn,options:[e,s]}},Xo=(e,s)=>({fn:zo(e).fn,options:[e,s]}),Ko=(e,s)=>{const n=_o(e);return{name:n.name,fn:n.fn,options:[e,s]}},Go=(e,s)=>{const n=Oo(e);return{name:n.name,fn:n.fn,options:[e,s]}},Yo=(e,s)=>{const n=Po(e);return{name:n.name,fn:n.fn,options:[e,s]}},Zo=(e,s)=>{const n=Wo(e);return{name:n.name,fn:n.fn,options:[e,s]}};var Jo="Arrow",In=d.forwardRef((e,s)=>{const{children:n,width:i=10,height:r=5,...a}=e;return t.jsx(wt.svg,{...a,ref:s,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});In.displayName=Jo;var Qo=In;function ea(e){const[s,n]=d.useState(void 0);return Vt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const a=r[0];let c,l;if("borderBoxSize"in a){const o=a.borderBoxSize,u=Array.isArray(o)?o[0]:o;c=u.inlineSize,l=u.blockSize}else c=e.offsetWidth,l=e.offsetHeight;n({width:c,height:l})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),s}var Ms="Popper",[_n]=As(Ms),[ta,On]=_n(Ms),Pn=e=>{const{__scopePopper:s,children:n}=e,[i,r]=d.useState(null);return t.jsx(ta,{scope:s,anchor:i,onAnchorChange:r,children:n})};Pn.displayName=Ms;var zn="PopperAnchor",Fn=d.forwardRef((e,s)=>{const{__scopePopper:n,virtualRef:i,...r}=e,a=On(zn,n),c=d.useRef(null),l=vt(s,c),o=d.useRef(null);return d.useEffect(()=>{const u=o.current;o.current=(i==null?void 0:i.current)||c.current,u!==o.current&&a.onAnchorChange(o.current)}),i?null:t.jsx(wt.div,{...r,ref:l})});Fn.displayName=zn;var Is="PopperContent",[sa,na]=_n(Is),Un=d.forwardRef((e,s)=>{var P,J,se,re,he,Me;const{__scopePopper:n,side:i="bottom",sideOffset:r=0,align:a="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:o=!0,collisionBoundary:u=[],collisionPadding:m=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:y="optimized",onPlaced:g,...b}=e,v=On(Is,n),[k,N]=d.useState(null),j=vt(s,fe=>N(fe)),[w,D]=d.useState(null),$=ea(w),T=($==null?void 0:$.width)??0,L=($==null?void 0:$.height)??0,F=i+(a!=="center"?"-"+a:""),M=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},O=Array.isArray(u)?u:[u],U=O.length>0,G={padding:M,boundary:O.filter(oa),altBoundary:U},{refs:q,floatingStyles:Z,placement:V,isPositioned:B,middlewareData:R}=Ho({strategy:"fixed",placement:F,whileElementsMounted:(...fe)=>Lo(...fe,{animationFrame:y==="always"}),elements:{reference:v.anchor},middleware:[Vo({mainAxis:r+L,alignmentAxis:c}),o&&qo({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Xo():void 0,...G}),o&&Ko({...G}),Go({...G,apply:({elements:fe,rects:ve,availableWidth:Ue,availableHeight:Ke})=>{const{width:Ae,height:ct}=ve.reference,Ie=fe.floating.style;Ie.setProperty("--radix-popper-available-width",`${Ue}px`),Ie.setProperty("--radix-popper-available-height",`${Ke}px`),Ie.setProperty("--radix-popper-anchor-width",`${Ae}px`),Ie.setProperty("--radix-popper-anchor-height",`${ct}px`)}}),w&&Zo({element:w,padding:l}),aa({arrowWidth:T,arrowHeight:L}),p&&Yo({strategy:"referenceHidden",...G})]}),[C,ne]=Hn(V),ae=gn(g);Vt(()=>{B&&(ae==null||ae())},[B,ae]);const Fe=(P=R.arrow)==null?void 0:P.x,ue=(J=R.arrow)==null?void 0:J.y,me=((se=R.arrow)==null?void 0:se.centerOffset)!==0,[ke,ee]=d.useState();return Vt(()=>{k&&ee(window.getComputedStyle(k).zIndex)},[k]),t.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:B?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ke,"--radix-popper-transform-origin":[(re=R.transformOrigin)==null?void 0:re.x,(he=R.transformOrigin)==null?void 0:he.y].join(" "),...((Me=R.hide)==null?void 0:Me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(sa,{scope:n,placedSide:C,onArrowChange:D,arrowX:Fe,arrowY:ue,shouldHideArrow:me,children:t.jsx(wt.div,{"data-side":C,"data-align":ne,...b,ref:j,style:{...b.style,animation:B?void 0:"none"}})})})});Un.displayName=Is;var Bn="PopperArrow",ia={top:"bottom",right:"left",bottom:"top",left:"right"},ra=d.forwardRef(function(s,n){const{__scopePopper:i,...r}=s,a=na(Bn,i),c=ia[a.placedSide];return t.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[c]: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:t.jsx(Qo,{...r,ref:n,style:{...r.style,display:"block"}})})});ra.displayName=Bn;function oa(e){return e!==null}var aa=e=>({name:"transformOrigin",options:e,fn(s){var v,k,N;const{placement:n,rects:i,middlewareData:r}=s,c=((v=r.arrow)==null?void 0:v.centerOffset)!==0,l=c?0:e.arrowWidth,o=c?0:e.arrowHeight,[u,m]=Hn(n),f={start:"0%",center:"50%",end:"100%"}[m],p=(((k=r.arrow)==null?void 0:k.x)??0)+l/2,y=(((N=r.arrow)==null?void 0:N.y)??0)+o/2;let g="",b="";return u==="bottom"?(g=c?f:`${p}px`,b=`${-o}px`):u==="top"?(g=c?f:`${p}px`,b=`${i.floating.height+o}px`):u==="right"?(g=`${-o}px`,b=c?f:`${y}px`):u==="left"&&(g=`${i.floating.width+o}px`,b=c?f:`${y}px`),{data:{x:g,y:b}}}});function Hn(e){const[s,n="center"]=e.split("-");return[s,n]}var ca=Pn,la=Fn,da=Un,ua=Symbol.for("react.lazy"),Yt=Qn[" use ".trim().toString()];function ma(e){return typeof e=="object"&&e!==null&&"then"in e}function Wn(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ua&&"_payload"in e&&ma(e._payload)}function ha(e){const s=fa(e),n=d.forwardRef((i,r)=>{let{children:a,...c}=i;Wn(a)&&typeof Yt=="function"&&(a=Yt(a._payload));const l=d.Children.toArray(a),o=l.find(ga);if(o){const u=o.props.children,m=l.map(f=>f===o?d.Children.count(u)>1?d.Children.only(null):d.isValidElement(u)?u.props.children:null:f);return t.jsx(s,{...c,ref:r,children:d.isValidElement(u)?d.cloneElement(u,void 0,m):null})}return t.jsx(s,{...c,ref:r,children:a})});return n.displayName=`${e}.Slot`,n}function fa(e){const s=d.forwardRef((n,i)=>{let{children:r,...a}=n;if(Wn(r)&&typeof Yt=="function"&&(r=Yt(r._payload)),d.isValidElement(r)){const c=ya(r),l=xa(a,r.props);return r.type!==d.Fragment&&(l.ref=i?ai(i,c):c),d.cloneElement(r,l)}return d.Children.count(r)>1?d.Children.only(null):null});return s.displayName=`${e}.SlotClone`,s}var pa=Symbol("radix.slottable");function ga(e){return d.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===pa}function xa(e,s){const n={...s};for(const i in s){const r=e[i],a=s[i];/^on[A-Z]/.test(i)?r&&a?n[i]=(...l)=>{const o=a(...l);return r(...l),o}:r&&(n[i]=r):i==="style"?n[i]={...r,...a}:i==="className"&&(n[i]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}function ya(e){var i,r;let s=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?e.ref:(s=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var va=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ba=va.reduce((e,s)=>{const n=ha(`Primitive.${s}`),i=d.forwardRef((r,a)=>{const{asChild:c,...l}=r,o=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(o,{...l,ref:a})});return i.displayName=`Primitive.${s}`,{...e,[s]:i}},{}),wa="Portal",Vn=d.forwardRef((e,s)=>{var l;const{container:n,...i}=e,[r,a]=d.useState(!1);Vt(()=>a(!0),[]);const c=n||r&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return c?ei.createPortal(t.jsx(ba.div,{...i,ref:s}),c):null});Vn.displayName=wa;const ja=({open:e,onClose:s,anchorRef:n,placement:i="bottom-end",children:r})=>{const a=d.useRef(null);if(d.useEffect(()=>{if(!e)return;const u=m=>{var f,p;e&&((f=a.current)!=null&&f.contains(m.target)||(p=n.current)!=null&&p.contains(m.target)||s())};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e,s,n]),!e)return null;const c=i.startsWith("top")?"top":"bottom",l=i.endsWith("end")?"end":"start",o=i.startsWith("top")?8:4;return t.jsxs(ca,{children:[t.jsx(la,{virtualRef:n}),t.jsx(Vn,{children:t.jsx(ci,{onEscapeKeyDown:u=>{u.preventDefault(),s()},onPointerDownOutside:u=>{var m;if((m=n.current)!=null&&m.contains(u.target)){u.preventDefault();return}s()},children:t.jsx(da,{ref:a,side:c,align:l,sideOffset:o,className:`popover popover-${i}`,role:"dialog",children:r})})})]})};function Na(e){const s=e+"CollectionProvider",[n,i]=As(s),[r,a]=n(s,{collectionRef:{current:null},itemMap:new Map}),c=b=>{const{scope:v,children:k}=b,N=je.useRef(null),j=je.useRef(new Map).current;return t.jsx(r,{scope:v,itemMap:j,collectionRef:N,children:k})};c.displayName=s;const l=e+"CollectionSlot",o=zs(l),u=je.forwardRef((b,v)=>{const{scope:k,children:N}=b,j=a(l,k),w=vt(v,j.collectionRef);return t.jsx(o,{ref:w,children:N})});u.displayName=l;const m=e+"CollectionItemSlot",f="data-radix-collection-item",p=zs(m),y=je.forwardRef((b,v)=>{const{scope:k,children:N,...j}=b,w=je.useRef(null),D=vt(v,w),$=a(m,k);return je.useEffect(()=>($.itemMap.set(w,{ref:w,...j}),()=>void $.itemMap.delete(w))),t.jsx(p,{[f]:"",ref:D,children:N})});y.displayName=m;function g(b){const v=a(e+"CollectionConsumer",b);return je.useCallback(()=>{const N=v.collectionRef.current;if(!N)return[];const j=Array.from(N.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort(($,T)=>j.indexOf($.ref.current)-j.indexOf(T.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:u,ItemSlot:y},g,i]}var Ca=d.createContext(void 0);function Sa(e){const s=d.useContext(Ca);return e||s||"ltr"}var fs="rovingFocusGroup.onEntryFocus",ka={bubbles:!1,cancelable:!0},Nt="RovingFocusGroup",[js,qn,Aa]=Na(Nt),[Ra]=As(Nt,[Aa]),[Ea,$a]=Ra(Nt),Xn=d.forwardRef((e,s)=>t.jsx(js.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(js.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Da,{...e,ref:s})})}));Xn.displayName=Nt;var Da=d.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:n,orientation:i,loop:r=!1,dir:a,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:o,onEntryFocus:u,preventScrollOnEntryFocus:m=!1,...f}=e,p=d.useRef(null),y=vt(s,p),g=Sa(a),[b,v]=di({prop:c,defaultProp:l??null,onChange:o,caller:Nt}),[k,N]=d.useState(!1),j=gn(u),w=qn(n),D=d.useRef(!1),[$,T]=d.useState(0);return d.useEffect(()=>{const L=p.current;if(L)return L.addEventListener(fs,j),()=>L.removeEventListener(fs,j)},[j]),t.jsx(Ea,{scope:n,orientation:i,dir:g,loop:r,currentTabStopId:b,onItemFocus:d.useCallback(L=>v(L),[v]),onItemShiftTab:d.useCallback(()=>N(!0),[]),onFocusableItemAdd:d.useCallback(()=>T(L=>L+1),[]),onFocusableItemRemove:d.useCallback(()=>T(L=>L-1),[]),children:t.jsx(wt.div,{tabIndex:k||$===0?-1:0,"data-orientation":i,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:st(e.onMouseDown,()=>{D.current=!0}),onFocus:st(e.onFocus,L=>{const F=!D.current;if(L.target===L.currentTarget&&F&&!k){const M=new CustomEvent(fs,ka);if(L.currentTarget.dispatchEvent(M),!M.defaultPrevented){const O=w().filter(V=>V.focusable),U=O.find(V=>V.active),G=O.find(V=>V.id===b),Z=[U,G,...O].filter(Boolean).map(V=>V.ref.current);Yn(Z,m)}}D.current=!1}),onBlur:st(e.onBlur,()=>N(!1))})})}),Kn="RovingFocusGroupItem",Gn=d.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:n,focusable:i=!0,active:r=!1,tabStopId:a,children:c,...l}=e,o=li(),u=a||o,m=$a(Kn,n),f=m.currentTabStopId===u,p=qn(n),{onFocusableItemAdd:y,onFocusableItemRemove:g,currentTabStopId:b}=m;return d.useEffect(()=>{if(i)return y(),()=>g()},[i,y,g]),t.jsx(js.ItemSlot,{scope:n,id:u,focusable:i,active:r,children:t.jsx(wt.span,{tabIndex:f?0:-1,"data-orientation":m.orientation,...l,ref:s,onMouseDown:st(e.onMouseDown,v=>{i?m.onItemFocus(u):v.preventDefault()}),onFocus:st(e.onFocus,()=>m.onItemFocus(u)),onKeyDown:st(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){m.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=Ma(v,m.orientation,m.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let j=p().filter(w=>w.focusable).map(w=>w.ref.current);if(k==="last")j.reverse();else if(k==="prev"||k==="next"){k==="prev"&&j.reverse();const w=j.indexOf(v.currentTarget);j=m.loop?Ia(j,w+1):j.slice(w+1)}setTimeout(()=>Yn(j))}}),children:typeof c=="function"?c({isCurrentTabStop:f,hasTabStop:b!=null}):c})})});Gn.displayName=Kn;var Ta={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function La(e,s){return s!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ma(e,s,n){const i=La(e.key,n);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return Ta[i]}function Yn(e,s=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:s}),document.activeElement!==n))return}function Ia(e,s){return e.map((n,i)=>e[(s+i)%e.length])}var _a=Xn,Oa=Gn;const zt=({icon:e,children:s,onClick:n,danger:i,disabled:r})=>t.jsx(Oa,{asChild:!0,focusable:!r,active:!1,children:t.jsxs("button",{type:"button",role:"menuitem",className:`menu-item${i?" menu-item-danger":""}`,onClick:n,disabled:r,children:[e&&t.jsx("span",{className:"menu-item-icon",children:e}),t.jsx("span",{className:"menu-item-label",children:s})]})}),Pa=({children:e})=>t.jsx(_a,{asChild:!0,orientation:"vertical",loop:!0,children:t.jsx("div",{className:"menu",role:"menu",children:e})}),za=[{label:"1 Hour",value:"1h"},{label:"2 Hours",value:"2h"},{label:"4 Hours",value:"4h"},{label:"8 Hours",value:"8h"}],Fa=({device:e,onClose:s,onReserved:n})=>{const[i,r]=d.useState(""),[a,c]=d.useState("1h"),[l,o]=d.useState(""),[u,m]=d.useState(!1),[f,p]=d.useState(null),[y,g]=d.useState(null),b=async()=>{if(!i.trim()){p("Please enter your name/ID");return}m(!0),p(null),g(null);try{const v=await H.reserveDevice(e.udid,e.host,i,a,l);v.success?(n(),s()):g(v.error||"Failed to reserve device")}catch(v){g(v.message||"An unexpected error occurred")}finally{m(!1)}};return t.jsx(xn,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(Li,{size:16,className:"title-icon"}),"Reserve device"]}),footer:t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"btn-cancel",onClick:s,disabled:u,children:"Cancel"}),t.jsx("button",{className:"btn-reserve",onClick:b,disabled:u||!i.trim(),children:u?"Reserving...":"Confirm Reservation"})]}),children:t.jsxs("div",{className:"reservation-modal-body",children:[t.jsxs("div",{className:"device-id-badge",children:[t.jsx("span",{className:"label",children:"Device:"}),t.jsx("span",{className:"value",children:e.udid})]}),t.jsxs("p",{children:["Reserve ",t.jsx("strong",{children:e.name||e.udid})," for exclusive use. This will prevent CI sessions from using this device."]}),t.jsx(Ut,{label:t.jsxs(t.Fragment,{children:[t.jsx(ti,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Reserved by"]}),htmlFor:"reservation-reserved-by",error:f?t.jsxs(t.Fragment,{children:[t.jsx(Os,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),f]}):void 0,children:t.jsx("input",{id:"reservation-reserved-by",type:"text",className:"reservation-input",placeholder:"Enter your name or ID",value:i,onChange:v=>{r(v.target.value),f&&p(null)},disabled:u})}),t.jsx(Ut,{label:t.jsxs(t.Fragment,{children:[t.jsx(yn,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Duration"]}),children:t.jsx("div",{className:"duration-selector",children:za.map(v=>t.jsx("div",{className:`duration-option ${a===v.value?"active":""}`,onClick:()=>c(v.value),children:v.label},v.value))})}),t.jsx(Ut,{label:t.jsxs(t.Fragment,{children:[t.jsx(ar,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Reason (optional)"]}),htmlFor:"reservation-reason",error:y?t.jsxs(t.Fragment,{children:[t.jsx(Os,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),y]}):void 0,children:t.jsx("input",{id:"reservation-reason",type:"text",className:"reservation-input",placeholder:"e.g., Debugging flaky login test",value:l,onChange:v=>o(v.target.value),disabled:u})})]})})},Ua=({device:e,onClose:s,onUpdated:n})=>{const{toast:i}=Zt(),[r,a]=d.useState(e.tags||[]),[c,l]=d.useState(""),[o,u]=d.useState(!1),m=d.useRef(null);d.useEffect(()=>{m.current&&m.current.focus()},[]);const f=()=>{const b=c.trim();b&&!r.includes(b)&&(a([...r,b]),l(""))},p=b=>{a(r.filter(v=>v!==b))},y=b=>{b.key==="Enter"&&f()},g=async()=>{u(!0);try{await H.updateDeviceTags(e.udid,e.host,r),n(),s()}catch(b){console.error("Failed to update tags",b),i("Error saving tags. Please try again.","error")}finally{u(!1)}};return t.jsx(xn,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(Ar,{size:16,className:"title-icon"}),"Manage device tags"]}),footer:t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"btn-cancel",onClick:s,children:"Cancel"}),t.jsx("button",{className:"btn-save",onClick:g,disabled:o,children:o?"Saving...":"Apply Changes"})]}),children:t.jsxs("div",{className:"tag-modal-body",children:[t.jsxs("div",{className:"device-id-badge",children:[t.jsx("span",{className:"label",children:"Device:"}),t.jsx("span",{className:"value",children:e.udid})]}),t.jsx(Ut,{label:"Add new tag",description:"Press Enter to add multiple tags",htmlFor:"tag-input",children:t.jsxs("div",{className:"input-with-button",children:[t.jsx("input",{ref:m,id:"tag-input",type:"text",placeholder:"e.g. stable, team-a, ios-17",value:c,onChange:b=>l(b.target.value),onKeyDown:y}),t.jsx("button",{className:"add-inline-btn",onClick:f,disabled:!c.trim(),children:t.jsx(ui,{size:16})})]})}),t.jsxs("div",{className:"tags-display-section",children:[t.jsx("label",{children:"Current Tags"}),t.jsx("div",{className:"tags-list",children:r.length>0?r.map(b=>t.jsxs("div",{className:"tag-pill-editable",children:[b,t.jsx("button",{className:"remove-tag",onClick:()=>p(b),children:t.jsx(hn,{size:12})})]},b)):t.jsx("div",{className:"empty-tags",children:"No tags assigned to this device."})})]})]})})};function Ba(e){return e>=50?"ready":e>=20?"reserved":"error"}function Ha(e){return e>=50?t.jsx(Ei,{size:10}):e>=20?t.jsx(Si,{size:10}):t.jsx(Ai,{size:10})}function Wa(e){return e==="Normal"?"ready":e==="Critical"?"error":"reserved"}const Va=({device:e})=>{const s=typeof e.batteryLevel=="number",n=typeof e.thermalStatus=="string"&&e.thermalStatus.length>0&&e.thermalStatus!=="Unknown";return!s&&!n?t.jsx("div",{className:"dc2-health",children:t.jsxs(Oe,{tone:"neutral",title:"Device does not report battery or thermal data",children:[t.jsx(mi,{size:10}),"No telemetry"]})}):t.jsxs("div",{className:"dc2-health",children:[s&&t.jsxs(Oe,{tone:Ba(e.batteryLevel),title:`Battery ${e.batteryLevel}%`,children:[Ha(e.batteryLevel),e.batteryLevel,"%"]}),n&&t.jsxs(Oe,{tone:Wa(e.thermalStatus),title:`Thermal: ${e.thermalStatus}`,children:[t.jsx(Tr,{size:10}),e.thermalStatus]})]})},qa=/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i,Xa=/^(?:\d{1,3}\.){3}\d{1,3}$/;function Ka(e){const s=e.trim();return!s||qa.test(s)||!Xa.test(s)?!1:s.split(".").every(n=>{const i=Number(n);return Number.isInteger(i)&&i>=0&&i<=255})}function Ga(e){return e==="127.0.0.1"||e==="localhost"||e==="0.0.0.0"}function Ya(e){if(!e)return null;try{const s=new URL(e.includes("://")?e:`http://${e}`);return s.port?`${s.hostname}:${s.port}`:s.hostname}catch{return e}}function Za(e){if(e.ip&&Ka(e.ip))return e.ip;const s=Ya(e.host);if(!s)return"—";const n=s.split(":")[0];return Ga(n)?"—":s}const Ja="/wd/hub";function Qa(e){return e==="android"?"UiAutomator2":"XCUITest"}function ec(e){return e==="android"?"Android":e==="tvos"?"tvOS":"iOS"}function tc(e,s=Ja){if(!e)return"—";try{const n=new URL(e.includes("://")?e:`http://${e}`),i=s.startsWith("/")?s:`/${s}`,r=n.pathname.replace(/\/$/,"");return r===i||r.endsWith(i)?`${n.protocol}//${n.host}${r}`:`${n.protocol}//${n.host}${i}`}catch{return e}}function sc(e){const s={platformName:ec(e.platform),"appium:automationName":Qa(e.platform),"appium:udid":e.udid};return e.sdk&&e.sdk!=="Unknown"&&e.sdk!=="unknown"&&(s["appium:platformVersion"]=e.sdk),e.name&&(s["appium:deviceName"]=e.name),s}function nc(e){return JSON.stringify(sc(e),null,2)}function ic(e){return e==="real"?"Real":e==="simulator"?"Simulator":e==="emulator"?"Emulator":null}const en="Shared",rc="Shared pool — visible to all authenticated users",oc=({udid:e,currentTeamId:s,resolvedTeamName:n,teams:i,canEdit:r,onChanged:a})=>{const{toast:c}=Zt(),[l,o]=d.useState(!1),[u,m]=d.useState(!1),f=s?i.get(s)??n??`Team ${s.slice(0,6)}`:en;async function p(y){m(!0);try{await H.setDeviceTeam(e,y),c(y?"Device assigned":"Device returned to shared pool","success"),a(),o(!1)}catch(g){c((g==null?void 0:g.message)||"Failed to update team","error")}finally{m(!1)}}return r?l?t.jsxs(Jt,{selectSize:"sm",autoFocus:!0,disabled:u,defaultValue:s??"",onBlur:()=>o(!1),onChange:y=>p(y.target.value||null),children:[t.jsx("option",{value:"",children:"(Shared pool)"}),Array.from(i.entries()).map(([y,g])=>t.jsx("option",{value:y,children:g},y))]}):t.jsx("button",{type:"button",onClick:()=>o(!0),className:"dc2-team-pill",title:s?"Click to change team":"Click to assign to a team",children:f}):s?t.jsx(Oe,{tone:"accent",title:`Team: ${f}`,children:f}):t.jsx(Oe,{tone:"neutral",title:rc,children:en})};function ac(e){return e.offline?"offline":e.userBlocked?"error":e.busy?"busy":e.reservedUntil&&Date.now()<e.reservedUntil?"reserved":"ready"}function cc(e,s=10,n=4){return!e||e.length<=s+n+1?e:`${e.slice(0,s)}…${e.slice(-n)}`}const lc=({device:e,reloadDevices:s,navigate:n,teams:i})=>{var T,L,F;const[r,a]=d.useState(!1),[c,l]=d.useState(!1),[o,u]=d.useState(!1),m=d.useRef(null),{me:f}=si(),{toast:p}=Zt(),y=(f==null?void 0:f.role)==="ADMIN"||(f==null?void 0:f.role)==="SUPER_ADMIN",g=ac(e),b=g==="reserved",v=!!(e.busy&&e.session_id&&!String(e.session_id).startsWith("manual_")),k=async(M,O)=>{var U;try{await((U=navigator.clipboard)==null?void 0:U.writeText(M)),p(O,"success")}catch{p("Failed to copy","error")}},N=tc(e.host),j=ic(e.deviceType),w=async()=>{await H.releaseReservation(e.udid,e.host),s()},D=async()=>{await H.blockDevice(e.udid,e.host),s()},$=async()=>{await H.unblockDevice(e.udid,e.host),s()};return t.jsxs("div",{className:`dc2 dc2-${g}`,children:[t.jsx("div",{className:"dc2-stripe"}),t.jsxs("div",{className:"dc2-header",children:[t.jsxs("span",{className:"dc2-platform",children:[vn(e.platform)," · ",e.sdk]}),t.jsx(Vr,{kind:g,showDot:!0,children:g})]}),t.jsx("div",{className:"dc2-name",title:e.name,children:e.name}),t.jsxs("div",{className:"dc2-udid-row",children:[t.jsx("div",{className:"dc2-udid",title:e.udid,children:cc(e.udid)}),t.jsx("button",{type:"button",className:"dc2-udid-copy",onClick:()=>k(e.udid,"UDID copied"),"aria-label":"Copy UDID",title:"Copy UDID",children:t.jsx(qe,{size:12})})]}),t.jsx(Va,{device:e}),t.jsxs("div",{className:"dc2-tags",children:[j&&t.jsx(Oe,{tone:"neutral",title:`Device type: ${j}`,children:j}),t.jsx(oc,{udid:e.udid,currentTeamId:e.teamId??null,resolvedTeamName:e.teamName??null,teams:i??new Map,canEdit:y,onChanged:s}),(T=e.tags)==null?void 0:T.slice(0,3).map(M=>t.jsx(Oe,{tone:"neutral",title:M,children:M},M)),(((L=e.tags)==null?void 0:L.length)||0)>3&&t.jsxs(Oe,{tone:"neutral",children:["+",(((F=e.tags)==null?void 0:F.length)||0)-3]})]}),t.jsxs("div",{className:"dc2-metrics",children:[b?t.jsxs("div",{className:"dc2-banner dc2-banner-reserved",children:[t.jsx(yn,{size:12}),t.jsxs("span",{children:["RES · ",e.reservedBy||"anon",e.reservedUntil?` (${Hr(e.reservedUntil-Date.now())})`:""]})]}):e.session_id?t.jsxs("div",{className:"dc2-banner dc2-banner-session",children:[t.jsx(bn,{size:12}),t.jsxs("span",{children:["SID · ",String(e.session_id).slice(0,10)]})]}):t.jsx(ds,{label:"Time in use",value:e.totalUtilizationTimeMilliSec?Nn(e.totalUtilizationTimeMilliSec,{compact:!0}):"—"}),t.jsx(ds,{label:"Network",value:Za(e),mono:!0}),t.jsx(ds,{label:"Server",mono:!0,value:t.jsxs("span",{className:"dc2-copyable",children:[t.jsx("span",{className:"dc2-copyable-text",title:N,children:N}),N!=="—"&&t.jsx("button",{type:"button",className:"dc2-udid-copy",onClick:()=>k(N,"Server URL copied"),"aria-label":"Copy Appium server URL",title:"Copy Appium server URL",children:t.jsx(qe,{size:12})})]})})]}),t.jsxs("div",{className:"dc2-actions",children:[t.jsx(tt,{variant:"primary",size:"sm",disabled:v,onClick:()=>{v||n(`/devices/${e.udid}/control`)},title:v?"Locked: Appium session running":"Take control",className:"dc2-primary",children:"Control"}),b?t.jsx(tt,{variant:"secondary",size:"sm",onClick:w,children:"Release"}):!e.userBlocked&&!e.busy?t.jsx(tt,{variant:"secondary",size:"sm",onClick:()=>a(!0),children:"Reserve"}):null,t.jsx("button",{ref:m,type:"button",className:"dc2-more",onClick:()=>u(M=>!M),"aria-label":"More actions",children:t.jsx(Gi,{size:14})}),t.jsx(ja,{open:o,onClose:()=>u(!1),anchorRef:m,children:t.jsxs(Pa,{children:[t.jsx(zt,{icon:t.jsx(qe,{size:12}),onClick:()=>{u(!1),k(nc(e),"Session capabilities copied")},children:"Copy caps…"}),t.jsx(zt,{onClick:()=>{u(!1),l(!0)},children:"Manage tags…"}),e.userBlocked?t.jsx(zt,{onClick:()=>{u(!1),$()},children:"Exit maintenance"}):t.jsx(zt,{onClick:()=>{u(!1),D()},children:"Enter maintenance"})]})})]}),r&&t.jsx(Fa,{device:e,onClose:()=>a(!1),onReserved:()=>s()}),c&&t.jsx(Ua,{device:e,onClose:()=>l(!1),onUpdated:()=>s()})]})};function dc(e){const s=ks();return t.jsx(lc,{device:e.device,reloadDevices:e.reloadDevices,navigate:s,teams:e.teams})}class uc extends je.Component{constructor(){super(...arguments),this.state={teamsMap:new Map}}componentDidMount(){H.listTeams().then(s=>{this.setState({teamsMap:new Map(s.map(n=>[n.id,n.name]))})}).catch(()=>{})}render(){return t.jsx("div",{className:"device-explorer-card-container",children:je.Children.toArray(this.props.devices.map(s=>t.jsx(dc,{device:s,reloadDevices:this.props.reloadDevices,teams:this.state.teamsMap})))})}}var Ft,mc=new Uint8Array(16);function hc(){if(!Ft&&(Ft=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ft))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ft(mc)}const fc=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function pc(e){return typeof e=="string"&&fc.test(e)}var ie=[];for(var ps=0;ps<256;++ps)ie.push((ps+256).toString(16).substr(1));function gc(e){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(ie[e[s+0]]+ie[e[s+1]]+ie[e[s+2]]+ie[e[s+3]]+"-"+ie[e[s+4]]+ie[e[s+5]]+"-"+ie[e[s+6]]+ie[e[s+7]]+"-"+ie[e[s+8]]+ie[e[s+9]]+"-"+ie[e[s+10]]+ie[e[s+11]]+ie[e[s+12]]+ie[e[s+13]]+ie[e[s+14]]+ie[e[s+15]]).toLowerCase();if(!pc(n))throw TypeError("Stringified UUID is invalid");return n}function xc(e,s,n){e=e||{};var i=e.random||(e.rng||hc)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,gc(i)}const yc=({onCommand:e,prompt:s="$",welcomeMessage:n="Interactive Shell (Restricted Mode)",platform:i})=>{const[r,a]=d.useState([{type:"system",content:n,timestamp:Date.now()},{type:"system",content:'Type "help" for allowed commands.',timestamp:Date.now()}]),[c,l]=d.useState(""),[o,u]=d.useState([]),[m,f]=d.useState(-1),[p,y]=d.useState(!1),g=d.useRef(null),b=d.useRef(null);d.useEffect(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[r]);const v=N=>{const j=N.trim();if((j.startsWith("{")||j.startsWith("["))&&(j.endsWith("}")||j.endsWith("]")))try{const w=JSON.parse(j);return JSON.stringify(w,null,2)}catch{}return N},k=async N=>{if(N.key==="Enter"&&!p){const j=c.trim();if(!j)return;if(l(""),a(w=>[...w,{type:"command",content:`${s} ${j}`,timestamp:Date.now()}]),u(w=>[...w,j]),f(-1),y(!0),j==="clear"){a([]),y(!1);return}if(j==="help"){let w="";i==="android"?w=`
|
|
186
|
+
*/const Mr=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],Ir=V("wifi",Mr);function _r(e){if(typeof e!="number")throw new TypeError("Expected a number");const s=e>0?Math.floor:Math.ceil;return{days:s(e/864e5),hours:s(e/36e5)%24,minutes:s(e/6e4)%60,seconds:s(e/1e3)%60,milliseconds:s(e)%1e3,microseconds:s(e*1e3)%1e3,nanoseconds:s(e*1e6)%1e3}}const Or=(e,s)=>s===1?e:`${e}s`,Pr=1e-7;function Nn(e,s={}){if(!Number.isFinite(e))throw new TypeError("Expected a finite number");s.colonNotation&&(s.compact=!1,s.formatSubMilliseconds=!1,s.separateMilliseconds=!1,s.verbose=!1),s.compact&&(s.secondsDecimalDigits=0,s.millisecondsDecimalDigits=0);const n=[],i=(c,l)=>{const o=Math.floor(c*10**l+Pr);return(Math.round(o)/10**l).toFixed(l)},r=(c,l,o,u)=>{if((n.length===0||!s.colonNotation)&&c===0&&!(s.colonNotation&&o==="m"))return;u=(u||c||"0").toString();let m,f;if(s.colonNotation){m=n.length>0?":":"",f="";const p=u.includes(".")?u.split(".")[0].length:u.length,y=n.length>0?2:1;u="0".repeat(Math.max(0,y-p))+u}else m="",f=s.verbose?" "+Or(l,c):o;n.push(m+u+f)},a=_r(e);if(r(Math.trunc(a.days/365),"year","y"),r(a.days%365,"day","d"),r(a.hours,"hour","h"),r(a.minutes,"minute","m"),s.separateMilliseconds||s.formatSubMilliseconds||!s.colonNotation&&e<1e3)if(r(a.seconds,"second","s"),s.formatSubMilliseconds)r(a.milliseconds,"millisecond","ms"),r(a.microseconds,"microsecond","µs"),r(a.nanoseconds,"nanosecond","ns");else{const c=a.milliseconds+a.microseconds/1e3+a.nanoseconds/1e6,l=typeof s.millisecondsDecimalDigits=="number"?s.millisecondsDecimalDigits:0,o=c>=1?Math.round(c):Math.ceil(c),u=l?c.toFixed(l):o;r(Number.parseFloat(u),"millisecond","ms",u)}else{const c=e/1e3%60,l=typeof s.secondsDecimalDigits=="number"?s.secondsDecimalDigits:1,o=i(c,l),u=s.keepDecimalsOnWholeSeconds?o:o.replace(/\.0+$/,"");r(Number.parseFloat(u),"second","s",u)}if(n.length===0)return"0"+(s.verbose?" milliseconds":"ms");if(s.compact)return n[0];if(typeof s.unitCount=="number"){const c=s.colonNotation?"":" ";return n.slice(0,Math.max(s.unitCount,1)).join(c)}return s.colonNotation?n.join(""):n.join(" ")}function zr(e){return!Number.isFinite(e)||e<=0?"expiring":Nn(e,{unitCount:2})}const Fr=({kind:e,size:s=6,className:n})=>t.jsx("span",{className:`status-dot status-dot-${e}${n?" "+n:""}`,style:{width:s,height:s},"aria-hidden":!0}),Ur=({kind:e,showDot:s,children:n})=>t.jsxs("span",{className:`status-code status-code-${e}`,children:[s&&t.jsx(Fr,{kind:e}),t.jsx("span",{className:"status-code-label",children:Br(String(n))})]});function Br(e){const s=e.trim().toLowerCase();return s.charAt(0).toUpperCase()+s.slice(1)}const ds=({label:e,value:s,mono:n,valueClassName:i})=>t.jsxs("div",{className:"kv-row",children:[t.jsx("span",{className:"kv-label",children:e}),t.jsx("span",{className:`kv-value${n?" kv-value-mono":""}${i?" "+i:""}`,children:s})]}),Wr=["top","right","bottom","left"],Pe=Math.min,le=Math.max,qt=Math.round,Pt=Math.floor,Ce=e=>({x:e,y:e}),Hr={left:"right",right:"left",bottom:"top",top:"bottom"};function vs(e,s,n){return le(e,Pe(s,n))}function $e(e,s){return typeof e=="function"?e(s):e}function De(e){return e.split("-")[0]}function ot(e){return e.split("-")[1]}function Rs(e){return e==="x"?"y":"x"}function Es(e){return e==="y"?"height":"width"}function Ne(e){const s=e[0];return s==="t"||s==="b"?"y":"x"}function $s(e){return Rs(Ne(e))}function Vr(e,s,n){n===void 0&&(n=!1);const i=ot(e),r=$s(e),a=Es(r);let c=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return s.reference[a]>s.floating[a]&&(c=Xt(c)),[c,Xt(c)]}function qr(e){const s=Xt(e);return[bs(e),s,bs(s)]}function bs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ws=["left","right"],Hs=["right","left"],Xr=["top","bottom"],Kr=["bottom","top"];function Gr(e,s,n){switch(e){case"top":case"bottom":return n?s?Hs:Ws:s?Ws:Hs;case"left":case"right":return s?Xr:Kr;default:return[]}}function Yr(e,s,n,i){const r=ot(e);let a=Gr(De(e),n==="start",i);return r&&(a=a.map(c=>c+"-"+r),s&&(a=a.concat(a.map(bs)))),a}function Xt(e){const s=De(e);return Hr[s]+e.slice(s.length)}function Zr(e){return{top:0,right:0,bottom:0,left:0,...e}}function Cn(e){return typeof e!="number"?Zr(e):{top:e,right:e,bottom:e,left:e}}function Kt(e){const{x:s,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:s,right:s+i,bottom:n+r,x:s,y:n}}function Vs(e,s,n){let{reference:i,floating:r}=e;const a=Ne(s),c=$s(s),l=Es(c),o=De(s),u=a==="y",m=i.x+i.width/2-r.width/2,f=i.y+i.height/2-r.height/2,p=i[l]/2-r[l]/2;let y;switch(o){case"top":y={x:m,y:i.y-r.height};break;case"bottom":y={x:m,y:i.y+i.height};break;case"right":y={x:i.x+i.width,y:f};break;case"left":y={x:i.x-r.width,y:f};break;default:y={x:i.x,y:i.y}}switch(ot(s)){case"start":y[c]-=p*(n&&u?-1:1);break;case"end":y[c]+=p*(n&&u?-1:1);break}return y}async function Jr(e,s){var n;s===void 0&&(s={});const{x:i,y:r,platform:a,rects:c,elements:l,strategy:o}=e,{boundary:u="clippingAncestors",rootBoundary:m="viewport",elementContext:f="floating",altBoundary:p=!1,padding:y=0}=$e(s,e),g=Cn(y),v=l[p?f==="floating"?"reference":"floating":f],k=Kt(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(l.floating)),boundary:u,rootBoundary:m,strategy:o})),N=f==="floating"?{x:i,y:r,width:c.floating.width,height:c.floating.height}:c.reference,j=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),w=await(a.isElement==null?void 0:a.isElement(j))?await(a.getScale==null?void 0:a.getScale(j))||{x:1,y:1}:{x:1,y:1},D=Kt(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:j,strategy:o}):N);return{top:(k.top-D.top+g.top)/w.y,bottom:(D.bottom-k.bottom+g.bottom)/w.y,left:(k.left-D.left+g.left)/w.x,right:(D.right-k.right+g.right)/w.x}}const Qr=50,eo=async(e,s,n)=>{const{placement:i="bottom",strategy:r="absolute",middleware:a=[],platform:c}=n,l=c.detectOverflow?c:{...c,detectOverflow:Jr},o=await(c.isRTL==null?void 0:c.isRTL(s));let u=await c.getElementRects({reference:e,floating:s,strategy:r}),{x:m,y:f}=Vs(u,i,o),p=i,y=0;const g={};for(let b=0;b<a.length;b++){const v=a[b];if(!v)continue;const{name:k,fn:N}=v,{x:j,y:w,data:D,reset:$}=await N({x:m,y:f,initialPlacement:i,placement:p,strategy:r,middlewareData:g,rects:u,platform:l,elements:{reference:e,floating:s}});m=j??m,f=w??f,g[k]={...g[k],...D},$&&y<Qr&&(y++,typeof $=="object"&&($.placement&&(p=$.placement),$.rects&&(u=$.rects===!0?await c.getElementRects({reference:e,floating:s,strategy:r}):$.rects),{x:m,y:f}=Vs(u,p,o)),b=-1)}return{x:m,y:f,placement:p,strategy:r,middlewareData:g}},to=e=>({name:"arrow",options:e,async fn(s){const{x:n,y:i,placement:r,rects:a,platform:c,elements:l,middlewareData:o}=s,{element:u,padding:m=0}=$e(e,s)||{};if(u==null)return{};const f=Cn(m),p={x:n,y:i},y=$s(r),g=Es(y),b=await c.getDimensions(u),v=y==="y",k=v?"top":"left",N=v?"bottom":"right",j=v?"clientHeight":"clientWidth",w=a.reference[g]+a.reference[y]-p[y]-a.floating[g],D=p[y]-a.reference[y],$=await(c.getOffsetParent==null?void 0:c.getOffsetParent(u));let T=$?$[j]:0;(!T||!await(c.isElement==null?void 0:c.isElement($)))&&(T=l.floating[j]||a.floating[g]);const L=w/2-D/2,F=T/2-b[g]/2-1,M=Pe(f[k],F),O=Pe(f[N],F),U=M,G=T-b[g]-O,q=T/2-b[g]/2+L,Z=vs(U,q,G),H=!o.arrow&&ot(r)!=null&&q!==Z&&a.reference[g]/2-(q<U?M:O)-b[g]/2<0,B=H?q<U?q-U:q-G:0;return{[y]:p[y]+B,data:{[y]:Z,centerOffset:q-Z-B,...H&&{alignmentOffset:B}},reset:H}}}),so=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(s){var n,i;const{placement:r,middlewareData:a,rects:c,initialPlacement:l,platform:o,elements:u}=s,{mainAxis:m=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=$e(e,s);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const k=De(r),N=Ne(l),j=De(l)===l,w=await(o.isRTL==null?void 0:o.isRTL(u.floating)),D=p||(j||!b?[Xt(l)]:qr(l)),$=g!=="none";!p&&$&&D.push(...Yr(l,b,g,w));const T=[l,...D],L=await o.detectOverflow(s,v),F=[];let M=((i=a.flip)==null?void 0:i.overflows)||[];if(m&&F.push(L[k]),f){const q=Vr(r,c,w);F.push(L[q[0]],L[q[1]])}if(M=[...M,{placement:r,overflows:F}],!F.every(q=>q<=0)){var O,U;const q=(((O=a.flip)==null?void 0:O.index)||0)+1,Z=T[q];if(Z&&(!(f==="alignment"?N!==Ne(Z):!1)||M.every(R=>Ne(R.placement)===N?R.overflows[0]>0:!0)))return{data:{index:q,overflows:M},reset:{placement:Z}};let H=(U=M.filter(B=>B.overflows[0]<=0).sort((B,R)=>B.overflows[1]-R.overflows[1])[0])==null?void 0:U.placement;if(!H)switch(y){case"bestFit":{var G;const B=(G=M.filter(R=>{if($){const C=Ne(R.placement);return C===N||C==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(C=>C>0).reduce((C,ne)=>C+ne,0)]).sort((R,C)=>R[1]-C[1])[0])==null?void 0:G[0];B&&(H=B);break}case"initialPlacement":H=l;break}if(r!==H)return{reset:{placement:H}}}return{}}}};function qs(e,s){return{top:e.top-s.height,right:e.right-s.width,bottom:e.bottom-s.height,left:e.left-s.width}}function Xs(e){return Wr.some(s=>e[s]>=0)}const no=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(s){const{rects:n,platform:i}=s,{strategy:r="referenceHidden",...a}=$e(e,s);switch(r){case"referenceHidden":{const c=await i.detectOverflow(s,{...a,elementContext:"reference"}),l=qs(c,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Xs(l)}}}case"escaped":{const c=await i.detectOverflow(s,{...a,altBoundary:!0}),l=qs(c,n.floating);return{data:{escapedOffsets:l,escaped:Xs(l)}}}default:return{}}}}},Sn=new Set(["left","top"]);async function io(e,s){const{placement:n,platform:i,elements:r}=e,a=await(i.isRTL==null?void 0:i.isRTL(r.floating)),c=De(n),l=ot(n),o=Ne(n)==="y",u=Sn.has(c)?-1:1,m=a&&o?-1:1,f=$e(s,e);let{mainAxis:p,crossAxis:y,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(y=l==="end"?g*-1:g),o?{x:y*m,y:p*u}:{x:p*u,y:y*m}}const ro=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(s){var n,i;const{x:r,y:a,placement:c,middlewareData:l}=s,o=await io(s,e);return c===((n=l.offset)==null?void 0:n.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:r+o.x,y:a+o.y,data:{...o,placement:c}}}}},oo=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(s){const{x:n,y:i,placement:r,platform:a}=s,{mainAxis:c=!0,crossAxis:l=!1,limiter:o={fn:k=>{let{x:N,y:j}=k;return{x:N,y:j}}},...u}=$e(e,s),m={x:n,y:i},f=await a.detectOverflow(s,u),p=Ne(De(r)),y=Rs(p);let g=m[y],b=m[p];if(c){const k=y==="y"?"top":"left",N=y==="y"?"bottom":"right",j=g+f[k],w=g-f[N];g=vs(j,g,w)}if(l){const k=p==="y"?"top":"left",N=p==="y"?"bottom":"right",j=b+f[k],w=b-f[N];b=vs(j,b,w)}const v=o.fn({...s,[y]:g,[p]:b});return{...v,data:{x:v.x-n,y:v.y-i,enabled:{[y]:c,[p]:l}}}}}},ao=function(e){return e===void 0&&(e={}),{options:e,fn(s){const{x:n,y:i,placement:r,rects:a,middlewareData:c}=s,{offset:l=0,mainAxis:o=!0,crossAxis:u=!0}=$e(e,s),m={x:n,y:i},f=Ne(r),p=Rs(f);let y=m[p],g=m[f];const b=$e(l,s),v=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(o){const j=p==="y"?"height":"width",w=a.reference[p]-a.floating[j]+v.mainAxis,D=a.reference[p]+a.reference[j]-v.mainAxis;y<w?y=w:y>D&&(y=D)}if(u){var k,N;const j=p==="y"?"width":"height",w=Sn.has(De(r)),D=a.reference[f]-a.floating[j]+(w&&((k=c.offset)==null?void 0:k[f])||0)+(w?0:v.crossAxis),$=a.reference[f]+a.reference[j]+(w?0:((N=c.offset)==null?void 0:N[f])||0)-(w?v.crossAxis:0);g<D?g=D:g>$&&(g=$)}return{[p]:y,[f]:g}}}},co=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(s){var n,i;const{placement:r,rects:a,platform:c,elements:l}=s,{apply:o=()=>{},...u}=$e(e,s),m=await c.detectOverflow(s,u),f=De(r),p=ot(r),y=Ne(r)==="y",{width:g,height:b}=a.floating;let v,k;f==="top"||f==="bottom"?(v=f,k=p===(await(c.isRTL==null?void 0:c.isRTL(l.floating))?"start":"end")?"left":"right"):(k=f,v=p==="end"?"top":"bottom");const N=b-m.top-m.bottom,j=g-m.left-m.right,w=Pe(b-m[v],N),D=Pe(g-m[k],j),$=!s.middlewareData.shift;let T=w,L=D;if((n=s.middlewareData.shift)!=null&&n.enabled.x&&(L=j),(i=s.middlewareData.shift)!=null&&i.enabled.y&&(T=N),$&&!p){const M=le(m.left,0),O=le(m.right,0),U=le(m.top,0),G=le(m.bottom,0);y?L=g-2*(M!==0||O!==0?M+O:le(m.left,m.right)):T=b-2*(U!==0||G!==0?U+G:le(m.top,m.bottom))}await o({...s,availableWidth:L,availableHeight:T});const F=await c.getDimensions(l.floating);return g!==F.width||b!==F.height?{reset:{rects:!0}}:{}}}};function Qt(){return typeof window<"u"}function at(e){return kn(e)?(e.nodeName||"").toLowerCase():"#document"}function de(e){var s;return(e==null||(s=e.ownerDocument)==null?void 0:s.defaultView)||window}function Se(e){var s;return(s=(kn(e)?e.ownerDocument:e.document)||window.document)==null?void 0:s.documentElement}function kn(e){return Qt()?e instanceof Node||e instanceof de(e).Node:!1}function xe(e){return Qt()?e instanceof Element||e instanceof de(e).Element:!1}function Le(e){return Qt()?e instanceof HTMLElement||e instanceof de(e).HTMLElement:!1}function Ks(e){return!Qt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof de(e).ShadowRoot}function jt(e){const{overflow:s,overflowX:n,overflowY:i,display:r}=ye(e);return/auto|scroll|overlay|hidden|clip/.test(s+i+n)&&r!=="inline"&&r!=="contents"}function lo(e){return/^(table|td|th)$/.test(at(e))}function es(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const uo=/transform|translate|scale|rotate|perspective|filter/,mo=/paint|layout|strict|content/,Ve=e=>!!e&&e!=="none";let us;function Ds(e){const s=xe(e)?ye(e):e;return Ve(s.transform)||Ve(s.translate)||Ve(s.scale)||Ve(s.rotate)||Ve(s.perspective)||!Ts()&&(Ve(s.backdropFilter)||Ve(s.filter))||uo.test(s.willChange||"")||mo.test(s.contain||"")}function ho(e){let s=ze(e);for(;Le(s)&&!it(s);){if(Ds(s))return s;if(es(s))return null;s=ze(s)}return null}function Ts(){return us==null&&(us=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),us}function it(e){return/^(html|body|#document)$/.test(at(e))}function ye(e){return de(e).getComputedStyle(e)}function ts(e){return xe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ze(e){if(at(e)==="html")return e;const s=e.assignedSlot||e.parentNode||Ks(e)&&e.host||Se(e);return Ks(s)?s.host:s}function An(e){const s=ze(e);return it(s)?e.ownerDocument?e.ownerDocument.body:e.body:Le(s)&&jt(s)?s:An(s)}function bt(e,s,n){var i;s===void 0&&(s=[]),n===void 0&&(n=!0);const r=An(e),a=r===((i=e.ownerDocument)==null?void 0:i.body),c=de(r);if(a){const l=ws(c);return s.concat(c,c.visualViewport||[],jt(r)?r:[],l&&n?bt(l):[])}else return s.concat(r,bt(r,[],n))}function ws(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Rn(e){const s=ye(e);let n=parseFloat(s.width)||0,i=parseFloat(s.height)||0;const r=Le(e),a=r?e.offsetWidth:n,c=r?e.offsetHeight:i,l=qt(n)!==a||qt(i)!==c;return l&&(n=a,i=c),{width:n,height:i,$:l}}function Ls(e){return xe(e)?e:e.contextElement}function nt(e){const s=Ls(e);if(!Le(s))return Ce(1);const n=s.getBoundingClientRect(),{width:i,height:r,$:a}=Rn(s);let c=(a?qt(n.width):n.width)/i,l=(a?qt(n.height):n.height)/r;return(!c||!Number.isFinite(c))&&(c=1),(!l||!Number.isFinite(l))&&(l=1),{x:c,y:l}}const fo=Ce(0);function En(e){const s=de(e);return!Ts()||!s.visualViewport?fo:{x:s.visualViewport.offsetLeft,y:s.visualViewport.offsetTop}}function po(e,s,n){return s===void 0&&(s=!1),!n||s&&n!==de(e)?!1:s}function Xe(e,s,n,i){s===void 0&&(s=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),a=Ls(e);let c=Ce(1);s&&(i?xe(i)&&(c=nt(i)):c=nt(e));const l=po(a,n,i)?En(a):Ce(0);let o=(r.left+l.x)/c.x,u=(r.top+l.y)/c.y,m=r.width/c.x,f=r.height/c.y;if(a){const p=de(a),y=i&&xe(i)?de(i):i;let g=p,b=ws(g);for(;b&&i&&y!==g;){const v=nt(b),k=b.getBoundingClientRect(),N=ye(b),j=k.left+(b.clientLeft+parseFloat(N.paddingLeft))*v.x,w=k.top+(b.clientTop+parseFloat(N.paddingTop))*v.y;o*=v.x,u*=v.y,m*=v.x,f*=v.y,o+=j,u+=w,g=de(b),b=ws(g)}}return Kt({width:m,height:f,x:o,y:u})}function ss(e,s){const n=ts(e).scrollLeft;return s?s.left+n:Xe(Se(e)).left+n}function $n(e,s){const n=e.getBoundingClientRect(),i=n.left+s.scrollLeft-ss(e,n),r=n.top+s.scrollTop;return{x:i,y:r}}function go(e){let{elements:s,rect:n,offsetParent:i,strategy:r}=e;const a=r==="fixed",c=Se(i),l=s?es(s.floating):!1;if(i===c||l&&a)return n;let o={scrollLeft:0,scrollTop:0},u=Ce(1);const m=Ce(0),f=Le(i);if((f||!f&&!a)&&((at(i)!=="body"||jt(c))&&(o=ts(i)),f)){const y=Xe(i);u=nt(i),m.x=y.x+i.clientLeft,m.y=y.y+i.clientTop}const p=c&&!f&&!a?$n(c,o):Ce(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-o.scrollLeft*u.x+m.x+p.x,y:n.y*u.y-o.scrollTop*u.y+m.y+p.y}}function xo(e){return Array.from(e.getClientRects())}function yo(e){const s=Se(e),n=ts(e),i=e.ownerDocument.body,r=le(s.scrollWidth,s.clientWidth,i.scrollWidth,i.clientWidth),a=le(s.scrollHeight,s.clientHeight,i.scrollHeight,i.clientHeight);let c=-n.scrollLeft+ss(e);const l=-n.scrollTop;return ye(i).direction==="rtl"&&(c+=le(s.clientWidth,i.clientWidth)-r),{width:r,height:a,x:c,y:l}}const Gs=25;function vo(e,s){const n=de(e),i=Se(e),r=n.visualViewport;let a=i.clientWidth,c=i.clientHeight,l=0,o=0;if(r){a=r.width,c=r.height;const m=Ts();(!m||m&&s==="fixed")&&(l=r.offsetLeft,o=r.offsetTop)}const u=ss(i);if(u<=0){const m=i.ownerDocument,f=m.body,p=getComputedStyle(f),y=m.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(i.clientWidth-f.clientWidth-y);g<=Gs&&(a-=g)}else u<=Gs&&(a+=u);return{width:a,height:c,x:l,y:o}}function bo(e,s){const n=Xe(e,!0,s==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,a=Le(e)?nt(e):Ce(1),c=e.clientWidth*a.x,l=e.clientHeight*a.y,o=r*a.x,u=i*a.y;return{width:c,height:l,x:o,y:u}}function Ys(e,s,n){let i;if(s==="viewport")i=vo(e,n);else if(s==="document")i=yo(Se(e));else if(xe(s))i=bo(s,n);else{const r=En(e);i={x:s.x-r.x,y:s.y-r.y,width:s.width,height:s.height}}return Kt(i)}function Dn(e,s){const n=ze(e);return n===s||!xe(n)||it(n)?!1:ye(n).position==="fixed"||Dn(n,s)}function wo(e,s){const n=s.get(e);if(n)return n;let i=bt(e,[],!1).filter(l=>xe(l)&&at(l)!=="body"),r=null;const a=ye(e).position==="fixed";let c=a?ze(e):e;for(;xe(c)&&!it(c);){const l=ye(c),o=Ds(c);!o&&l.position==="fixed"&&(r=null),(a?!o&&!r:!o&&l.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||jt(c)&&!o&&Dn(e,c))?i=i.filter(m=>m!==c):r=l,c=ze(c)}return s.set(e,i),i}function jo(e){let{element:s,boundary:n,rootBoundary:i,strategy:r}=e;const c=[...n==="clippingAncestors"?es(s)?[]:wo(s,this._c):[].concat(n),i],l=Ys(s,c[0],r);let o=l.top,u=l.right,m=l.bottom,f=l.left;for(let p=1;p<c.length;p++){const y=Ys(s,c[p],r);o=le(y.top,o),u=Pe(y.right,u),m=Pe(y.bottom,m),f=le(y.left,f)}return{width:u-f,height:m-o,x:f,y:o}}function No(e){const{width:s,height:n}=Rn(e);return{width:s,height:n}}function Co(e,s,n){const i=Le(s),r=Se(s),a=n==="fixed",c=Xe(e,!0,a,s);let l={scrollLeft:0,scrollTop:0};const o=Ce(0);function u(){o.x=ss(r)}if(i||!i&&!a)if((at(s)!=="body"||jt(r))&&(l=ts(s)),i){const y=Xe(s,!0,a,s);o.x=y.x+s.clientLeft,o.y=y.y+s.clientTop}else r&&u();a&&!i&&r&&u();const m=r&&!i&&!a?$n(r,l):Ce(0),f=c.left+l.scrollLeft-o.x-m.x,p=c.top+l.scrollTop-o.y-m.y;return{x:f,y:p,width:c.width,height:c.height}}function ms(e){return ye(e).position==="static"}function Zs(e,s){if(!Le(e)||ye(e).position==="fixed")return null;if(s)return s(e);let n=e.offsetParent;return Se(e)===n&&(n=n.ownerDocument.body),n}function Tn(e,s){const n=de(e);if(es(e))return n;if(!Le(e)){let r=ze(e);for(;r&&!it(r);){if(xe(r)&&!ms(r))return r;r=ze(r)}return n}let i=Zs(e,s);for(;i&&lo(i)&&ms(i);)i=Zs(i,s);return i&&it(i)&&ms(i)&&!Ds(i)?n:i||ho(e)||n}const So=async function(e){const s=this.getOffsetParent||Tn,n=this.getDimensions,i=await n(e.floating);return{reference:Co(e.reference,await s(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function ko(e){return ye(e).direction==="rtl"}const Ao={convertOffsetParentRelativeRectToViewportRelativeRect:go,getDocumentElement:Se,getClippingRect:jo,getOffsetParent:Tn,getElementRects:So,getClientRects:xo,getDimensions:No,getScale:nt,isElement:xe,isRTL:ko};function Ln(e,s){return e.x===s.x&&e.y===s.y&&e.width===s.width&&e.height===s.height}function Ro(e,s){let n=null,i;const r=Se(e);function a(){var l;clearTimeout(i),(l=n)==null||l.disconnect(),n=null}function c(l,o){l===void 0&&(l=!1),o===void 0&&(o=1),a();const u=e.getBoundingClientRect(),{left:m,top:f,width:p,height:y}=u;if(l||s(),!p||!y)return;const g=Pt(f),b=Pt(r.clientWidth-(m+p)),v=Pt(r.clientHeight-(f+y)),k=Pt(m),j={rootMargin:-g+"px "+-b+"px "+-v+"px "+-k+"px",threshold:le(0,Pe(1,o))||1};let w=!0;function D($){const T=$[0].intersectionRatio;if(T!==o){if(!w)return c();T?c(!1,T):i=setTimeout(()=>{c(!1,1e-7)},1e3)}T===1&&!Ln(u,e.getBoundingClientRect())&&c(),w=!1}try{n=new IntersectionObserver(D,{...j,root:r.ownerDocument})}catch{n=new IntersectionObserver(D,j)}n.observe(e)}return c(!0),a}function Eo(e,s,n,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:o=!1}=i,u=Ls(e),m=r||a?[...u?bt(u):[],...s?bt(s):[]]:[];m.forEach(k=>{r&&k.addEventListener("scroll",n,{passive:!0}),a&&k.addEventListener("resize",n)});const f=u&&l?Ro(u,n):null;let p=-1,y=null;c&&(y=new ResizeObserver(k=>{let[N]=k;N&&N.target===u&&y&&s&&(y.unobserve(s),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var j;(j=y)==null||j.observe(s)})),n()}),u&&!o&&y.observe(u),s&&y.observe(s));let g,b=o?Xe(e):null;o&&v();function v(){const k=Xe(e);b&&!Ln(b,k)&&n(),b=k,g=requestAnimationFrame(v)}return n(),()=>{var k;m.forEach(N=>{r&&N.removeEventListener("scroll",n),a&&N.removeEventListener("resize",n)}),f==null||f(),(k=y)==null||k.disconnect(),y=null,o&&cancelAnimationFrame(g)}}const $o=ro,Do=oo,To=so,Lo=co,Mo=no,Js=to,Io=ao,_o=(e,s,n)=>{const i=new Map,r={platform:Ao,...n},a={...r.platform,_c:i};return eo(e,s,{...r,platform:a})};var Oo=typeof document<"u",Po=function(){},Ht=Oo?d.useLayoutEffect:Po;function Gt(e,s){if(e===s)return!0;if(typeof e!=typeof s)return!1;if(typeof e=="function"&&e.toString()===s.toString())return!0;let n,i,r;if(e&&s&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==s.length)return!1;for(i=n;i--!==0;)if(!Gt(e[i],s[i]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(s).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(s,r[i]))return!1;for(i=n;i--!==0;){const a=r[i];if(!(a==="_owner"&&e.$$typeof)&&!Gt(e[a],s[a]))return!1}return!0}return e!==e&&s!==s}function Mn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qs(e,s){const n=Mn(e);return Math.round(s*n)/n}function hs(e){const s=d.useRef(e);return Ht(()=>{s.current=e}),s}function zo(e){e===void 0&&(e={});const{placement:s="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:a,floating:c}={},transform:l=!0,whileElementsMounted:o,open:u}=e,[m,f]=d.useState({x:0,y:0,strategy:n,placement:s,middlewareData:{},isPositioned:!1}),[p,y]=d.useState(i);Gt(p,i)||y(i);const[g,b]=d.useState(null),[v,k]=d.useState(null),N=d.useCallback(R=>{R!==$.current&&($.current=R,b(R))},[]),j=d.useCallback(R=>{R!==T.current&&(T.current=R,k(R))},[]),w=a||g,D=c||v,$=d.useRef(null),T=d.useRef(null),L=d.useRef(m),F=o!=null,M=hs(o),O=hs(r),U=hs(u),G=d.useCallback(()=>{if(!$.current||!T.current)return;const R={placement:s,strategy:n,middleware:p};O.current&&(R.platform=O.current),_o($.current,T.current,R).then(C=>{const ne={...C,isPositioned:U.current!==!1};q.current&&!Gt(L.current,ne)&&(L.current=ne,mn.flushSync(()=>{f(ne)}))})},[p,s,n,O,U]);Ht(()=>{u===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,f(R=>({...R,isPositioned:!1})))},[u]);const q=d.useRef(!1);Ht(()=>(q.current=!0,()=>{q.current=!1}),[]),Ht(()=>{if(w&&($.current=w),D&&(T.current=D),w&&D){if(M.current)return M.current(w,D,G);G()}},[w,D,G,M,F]);const Z=d.useMemo(()=>({reference:$,floating:T,setReference:N,setFloating:j}),[N,j]),H=d.useMemo(()=>({reference:w,floating:D}),[w,D]),B=d.useMemo(()=>{const R={position:n,left:0,top:0};if(!H.floating)return R;const C=Qs(H.floating,m.x),ne=Qs(H.floating,m.y);return l?{...R,transform:"translate("+C+"px, "+ne+"px)",...Mn(H.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:C,top:ne}},[n,l,H.floating,m.x,m.y]);return d.useMemo(()=>({...m,update:G,refs:Z,elements:H,floatingStyles:B}),[m,G,Z,H,B])}const Fo=e=>{function s(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:i,padding:r}=typeof e=="function"?e(n):e;return i&&s(i)?i.current!=null?Js({element:i.current,padding:r}).fn(n):{}:i?Js({element:i,padding:r}).fn(n):{}}}},Uo=(e,s)=>{const n=$o(e);return{name:n.name,fn:n.fn,options:[e,s]}},Bo=(e,s)=>{const n=Do(e);return{name:n.name,fn:n.fn,options:[e,s]}},Wo=(e,s)=>({fn:Io(e).fn,options:[e,s]}),Ho=(e,s)=>{const n=To(e);return{name:n.name,fn:n.fn,options:[e,s]}},Vo=(e,s)=>{const n=Lo(e);return{name:n.name,fn:n.fn,options:[e,s]}},qo=(e,s)=>{const n=Mo(e);return{name:n.name,fn:n.fn,options:[e,s]}},Xo=(e,s)=>{const n=Fo(e);return{name:n.name,fn:n.fn,options:[e,s]}};var Ko="Arrow",In=d.forwardRef((e,s)=>{const{children:n,width:i=10,height:r=5,...a}=e;return t.jsx(wt.svg,{...a,ref:s,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});In.displayName=Ko;var Go=In;function Yo(e){const[s,n]=d.useState(void 0);return Vt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const a=r[0];let c,l;if("borderBoxSize"in a){const o=a.borderBoxSize,u=Array.isArray(o)?o[0]:o;c=u.inlineSize,l=u.blockSize}else c=e.offsetWidth,l=e.offsetHeight;n({width:c,height:l})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),s}var Ms="Popper",[_n]=As(Ms),[Zo,On]=_n(Ms),Pn=e=>{const{__scopePopper:s,children:n}=e,[i,r]=d.useState(null);return t.jsx(Zo,{scope:s,anchor:i,onAnchorChange:r,children:n})};Pn.displayName=Ms;var zn="PopperAnchor",Fn=d.forwardRef((e,s)=>{const{__scopePopper:n,virtualRef:i,...r}=e,a=On(zn,n),c=d.useRef(null),l=vt(s,c),o=d.useRef(null);return d.useEffect(()=>{const u=o.current;o.current=(i==null?void 0:i.current)||c.current,u!==o.current&&a.onAnchorChange(o.current)}),i?null:t.jsx(wt.div,{...r,ref:l})});Fn.displayName=zn;var Is="PopperContent",[Jo,Qo]=_n(Is),Un=d.forwardRef((e,s)=>{var P,J,se,re,he,Me;const{__scopePopper:n,side:i="bottom",sideOffset:r=0,align:a="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:o=!0,collisionBoundary:u=[],collisionPadding:m=0,sticky:f="partial",hideWhenDetached:p=!1,updatePositionStrategy:y="optimized",onPlaced:g,...b}=e,v=On(Is,n),[k,N]=d.useState(null),j=vt(s,fe=>N(fe)),[w,D]=d.useState(null),$=Yo(w),T=($==null?void 0:$.width)??0,L=($==null?void 0:$.height)??0,F=i+(a!=="center"?"-"+a:""),M=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},O=Array.isArray(u)?u:[u],U=O.length>0,G={padding:M,boundary:O.filter(sa),altBoundary:U},{refs:q,floatingStyles:Z,placement:H,isPositioned:B,middlewareData:R}=zo({strategy:"fixed",placement:F,whileElementsMounted:(...fe)=>Eo(...fe,{animationFrame:y==="always"}),elements:{reference:v.anchor},middleware:[Uo({mainAxis:r+L,alignmentAxis:c}),o&&Bo({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?Wo():void 0,...G}),o&&Ho({...G}),Vo({...G,apply:({elements:fe,rects:ve,availableWidth:Ue,availableHeight:Ke})=>{const{width:Ae,height:ct}=ve.reference,Ie=fe.floating.style;Ie.setProperty("--radix-popper-available-width",`${Ue}px`),Ie.setProperty("--radix-popper-available-height",`${Ke}px`),Ie.setProperty("--radix-popper-anchor-width",`${Ae}px`),Ie.setProperty("--radix-popper-anchor-height",`${ct}px`)}}),w&&Xo({element:w,padding:l}),na({arrowWidth:T,arrowHeight:L}),p&&qo({strategy:"referenceHidden",...G})]}),[C,ne]=Wn(H),ae=gn(g);Vt(()=>{B&&(ae==null||ae())},[B,ae]);const Fe=(P=R.arrow)==null?void 0:P.x,ue=(J=R.arrow)==null?void 0:J.y,me=((se=R.arrow)==null?void 0:se.centerOffset)!==0,[ke,ee]=d.useState();return Vt(()=>{k&&ee(window.getComputedStyle(k).zIndex)},[k]),t.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:B?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ke,"--radix-popper-transform-origin":[(re=R.transformOrigin)==null?void 0:re.x,(he=R.transformOrigin)==null?void 0:he.y].join(" "),...((Me=R.hide)==null?void 0:Me.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(Jo,{scope:n,placedSide:C,onArrowChange:D,arrowX:Fe,arrowY:ue,shouldHideArrow:me,children:t.jsx(wt.div,{"data-side":C,"data-align":ne,...b,ref:j,style:{...b.style,animation:B?void 0:"none"}})})})});Un.displayName=Is;var Bn="PopperArrow",ea={top:"bottom",right:"left",bottom:"top",left:"right"},ta=d.forwardRef(function(s,n){const{__scopePopper:i,...r}=s,a=Qo(Bn,i),c=ea[a.placedSide];return t.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[c]: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:t.jsx(Go,{...r,ref:n,style:{...r.style,display:"block"}})})});ta.displayName=Bn;function sa(e){return e!==null}var na=e=>({name:"transformOrigin",options:e,fn(s){var v,k,N;const{placement:n,rects:i,middlewareData:r}=s,c=((v=r.arrow)==null?void 0:v.centerOffset)!==0,l=c?0:e.arrowWidth,o=c?0:e.arrowHeight,[u,m]=Wn(n),f={start:"0%",center:"50%",end:"100%"}[m],p=(((k=r.arrow)==null?void 0:k.x)??0)+l/2,y=(((N=r.arrow)==null?void 0:N.y)??0)+o/2;let g="",b="";return u==="bottom"?(g=c?f:`${p}px`,b=`${-o}px`):u==="top"?(g=c?f:`${p}px`,b=`${i.floating.height+o}px`):u==="right"?(g=`${-o}px`,b=c?f:`${y}px`):u==="left"&&(g=`${i.floating.width+o}px`,b=c?f:`${y}px`),{data:{x:g,y:b}}}});function Wn(e){const[s,n="center"]=e.split("-");return[s,n]}var ia=Pn,ra=Fn,oa=Un,aa=Symbol.for("react.lazy"),Yt=Qn[" use ".trim().toString()];function ca(e){return typeof e=="object"&&e!==null&&"then"in e}function Hn(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===aa&&"_payload"in e&&ca(e._payload)}function la(e){const s=da(e),n=d.forwardRef((i,r)=>{let{children:a,...c}=i;Hn(a)&&typeof Yt=="function"&&(a=Yt(a._payload));const l=d.Children.toArray(a),o=l.find(ma);if(o){const u=o.props.children,m=l.map(f=>f===o?d.Children.count(u)>1?d.Children.only(null):d.isValidElement(u)?u.props.children:null:f);return t.jsx(s,{...c,ref:r,children:d.isValidElement(u)?d.cloneElement(u,void 0,m):null})}return t.jsx(s,{...c,ref:r,children:a})});return n.displayName=`${e}.Slot`,n}function da(e){const s=d.forwardRef((n,i)=>{let{children:r,...a}=n;if(Hn(r)&&typeof Yt=="function"&&(r=Yt(r._payload)),d.isValidElement(r)){const c=fa(r),l=ha(a,r.props);return r.type!==d.Fragment&&(l.ref=i?ai(i,c):c),d.cloneElement(r,l)}return d.Children.count(r)>1?d.Children.only(null):null});return s.displayName=`${e}.SlotClone`,s}var ua=Symbol("radix.slottable");function ma(e){return d.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ua}function ha(e,s){const n={...s};for(const i in s){const r=e[i],a=s[i];/^on[A-Z]/.test(i)?r&&a?n[i]=(...l)=>{const o=a(...l);return r(...l),o}:r&&(n[i]=r):i==="style"?n[i]={...r,...a}:i==="className"&&(n[i]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}function fa(e){var i,r;let s=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?e.ref:(s=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pa=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ga=pa.reduce((e,s)=>{const n=la(`Primitive.${s}`),i=d.forwardRef((r,a)=>{const{asChild:c,...l}=r,o=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(o,{...l,ref:a})});return i.displayName=`Primitive.${s}`,{...e,[s]:i}},{}),xa="Portal",Vn=d.forwardRef((e,s)=>{var l;const{container:n,...i}=e,[r,a]=d.useState(!1);Vt(()=>a(!0),[]);const c=n||r&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return c?ei.createPortal(t.jsx(ga.div,{...i,ref:s}),c):null});Vn.displayName=xa;const ya=({open:e,onClose:s,anchorRef:n,placement:i="bottom-end",children:r})=>{const a=d.useRef(null);if(d.useEffect(()=>{if(!e)return;const u=m=>{var f,p;e&&((f=a.current)!=null&&f.contains(m.target)||(p=n.current)!=null&&p.contains(m.target)||s())};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e,s,n]),!e)return null;const c=i.startsWith("top")?"top":"bottom",l=i.endsWith("end")?"end":"start",o=i.startsWith("top")?8:4;return t.jsxs(ia,{children:[t.jsx(ra,{virtualRef:n}),t.jsx(Vn,{children:t.jsx(ci,{onEscapeKeyDown:u=>{u.preventDefault(),s()},onPointerDownOutside:u=>{var m;if((m=n.current)!=null&&m.contains(u.target)){u.preventDefault();return}s()},children:t.jsx(oa,{ref:a,side:c,align:l,sideOffset:o,className:`popover popover-${i}`,role:"dialog",children:r})})})]})};function va(e){const s=e+"CollectionProvider",[n,i]=As(s),[r,a]=n(s,{collectionRef:{current:null},itemMap:new Map}),c=b=>{const{scope:v,children:k}=b,N=je.useRef(null),j=je.useRef(new Map).current;return t.jsx(r,{scope:v,itemMap:j,collectionRef:N,children:k})};c.displayName=s;const l=e+"CollectionSlot",o=zs(l),u=je.forwardRef((b,v)=>{const{scope:k,children:N}=b,j=a(l,k),w=vt(v,j.collectionRef);return t.jsx(o,{ref:w,children:N})});u.displayName=l;const m=e+"CollectionItemSlot",f="data-radix-collection-item",p=zs(m),y=je.forwardRef((b,v)=>{const{scope:k,children:N,...j}=b,w=je.useRef(null),D=vt(v,w),$=a(m,k);return je.useEffect(()=>($.itemMap.set(w,{ref:w,...j}),()=>void $.itemMap.delete(w))),t.jsx(p,{[f]:"",ref:D,children:N})});y.displayName=m;function g(b){const v=a(e+"CollectionConsumer",b);return je.useCallback(()=>{const N=v.collectionRef.current;if(!N)return[];const j=Array.from(N.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort(($,T)=>j.indexOf($.ref.current)-j.indexOf(T.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:u,ItemSlot:y},g,i]}var ba=d.createContext(void 0);function wa(e){const s=d.useContext(ba);return e||s||"ltr"}var fs="rovingFocusGroup.onEntryFocus",ja={bubbles:!1,cancelable:!0},Nt="RovingFocusGroup",[js,qn,Na]=va(Nt),[Ca]=As(Nt,[Na]),[Sa,ka]=Ca(Nt),Xn=d.forwardRef((e,s)=>t.jsx(js.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(js.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Aa,{...e,ref:s})})}));Xn.displayName=Nt;var Aa=d.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:n,orientation:i,loop:r=!1,dir:a,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:o,onEntryFocus:u,preventScrollOnEntryFocus:m=!1,...f}=e,p=d.useRef(null),y=vt(s,p),g=wa(a),[b,v]=di({prop:c,defaultProp:l??null,onChange:o,caller:Nt}),[k,N]=d.useState(!1),j=gn(u),w=qn(n),D=d.useRef(!1),[$,T]=d.useState(0);return d.useEffect(()=>{const L=p.current;if(L)return L.addEventListener(fs,j),()=>L.removeEventListener(fs,j)},[j]),t.jsx(Sa,{scope:n,orientation:i,dir:g,loop:r,currentTabStopId:b,onItemFocus:d.useCallback(L=>v(L),[v]),onItemShiftTab:d.useCallback(()=>N(!0),[]),onFocusableItemAdd:d.useCallback(()=>T(L=>L+1),[]),onFocusableItemRemove:d.useCallback(()=>T(L=>L-1),[]),children:t.jsx(wt.div,{tabIndex:k||$===0?-1:0,"data-orientation":i,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:st(e.onMouseDown,()=>{D.current=!0}),onFocus:st(e.onFocus,L=>{const F=!D.current;if(L.target===L.currentTarget&&F&&!k){const M=new CustomEvent(fs,ja);if(L.currentTarget.dispatchEvent(M),!M.defaultPrevented){const O=w().filter(H=>H.focusable),U=O.find(H=>H.active),G=O.find(H=>H.id===b),Z=[U,G,...O].filter(Boolean).map(H=>H.ref.current);Yn(Z,m)}}D.current=!1}),onBlur:st(e.onBlur,()=>N(!1))})})}),Kn="RovingFocusGroupItem",Gn=d.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:n,focusable:i=!0,active:r=!1,tabStopId:a,children:c,...l}=e,o=li(),u=a||o,m=ka(Kn,n),f=m.currentTabStopId===u,p=qn(n),{onFocusableItemAdd:y,onFocusableItemRemove:g,currentTabStopId:b}=m;return d.useEffect(()=>{if(i)return y(),()=>g()},[i,y,g]),t.jsx(js.ItemSlot,{scope:n,id:u,focusable:i,active:r,children:t.jsx(wt.span,{tabIndex:f?0:-1,"data-orientation":m.orientation,...l,ref:s,onMouseDown:st(e.onMouseDown,v=>{i?m.onItemFocus(u):v.preventDefault()}),onFocus:st(e.onFocus,()=>m.onItemFocus(u)),onKeyDown:st(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){m.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const k=$a(v,m.orientation,m.dir);if(k!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let j=p().filter(w=>w.focusable).map(w=>w.ref.current);if(k==="last")j.reverse();else if(k==="prev"||k==="next"){k==="prev"&&j.reverse();const w=j.indexOf(v.currentTarget);j=m.loop?Da(j,w+1):j.slice(w+1)}setTimeout(()=>Yn(j))}}),children:typeof c=="function"?c({isCurrentTabStop:f,hasTabStop:b!=null}):c})})});Gn.displayName=Kn;var Ra={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ea(e,s){return s!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function $a(e,s,n){const i=Ea(e.key,n);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return Ra[i]}function Yn(e,s=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:s}),document.activeElement!==n))return}function Da(e,s){return e.map((n,i)=>e[(s+i)%e.length])}var Ta=Xn,La=Gn;const zt=({icon:e,children:s,onClick:n,danger:i,disabled:r})=>t.jsx(La,{asChild:!0,focusable:!r,active:!1,children:t.jsxs("button",{type:"button",role:"menuitem",className:`menu-item${i?" menu-item-danger":""}`,onClick:n,disabled:r,children:[e&&t.jsx("span",{className:"menu-item-icon",children:e}),t.jsx("span",{className:"menu-item-label",children:s})]})}),Ma=({children:e})=>t.jsx(Ta,{asChild:!0,orientation:"vertical",loop:!0,children:t.jsx("div",{className:"menu",role:"menu",children:e})}),Ia=[{label:"1 Hour",value:"1h"},{label:"2 Hours",value:"2h"},{label:"4 Hours",value:"4h"},{label:"8 Hours",value:"8h"}],_a=({device:e,onClose:s,onReserved:n})=>{const[i,r]=d.useState(""),[a,c]=d.useState("1h"),[l,o]=d.useState(""),[u,m]=d.useState(!1),[f,p]=d.useState(null),[y,g]=d.useState(null),b=async()=>{if(!i.trim()){p("Please enter your name/ID");return}m(!0),p(null),g(null);try{const v=await W.reserveDevice(e.udid,e.host,i,a,l);v.success?(n(),s()):g(v.error||"Failed to reserve device")}catch(v){g(v.message||"An unexpected error occurred")}finally{m(!1)}};return t.jsx(xn,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(Ii,{size:16,className:"title-icon"}),"Reserve device"]}),footer:t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"btn-cancel",onClick:s,disabled:u,children:"Cancel"}),t.jsx("button",{className:"btn-reserve",onClick:b,disabled:u||!i.trim(),children:u?"Reserving...":"Confirm Reservation"})]}),children:t.jsxs("div",{className:"reservation-modal-body",children:[t.jsxs("div",{className:"device-id-badge",children:[t.jsx("span",{className:"label",children:"Device:"}),t.jsx("span",{className:"value",children:e.udid})]}),t.jsxs("p",{children:["Reserve ",t.jsx("strong",{children:e.name||e.udid})," for exclusive use. This will prevent CI sessions from using this device."]}),t.jsx(Ut,{label:t.jsxs(t.Fragment,{children:[t.jsx(ti,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Reserved by"]}),htmlFor:"reservation-reserved-by",error:f?t.jsxs(t.Fragment,{children:[t.jsx(Os,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),f]}):void 0,children:t.jsx("input",{id:"reservation-reserved-by",type:"text",className:"reservation-input",placeholder:"Enter your name or ID",value:i,onChange:v=>{r(v.target.value),f&&p(null)},disabled:u})}),t.jsx(Ut,{label:t.jsxs(t.Fragment,{children:[t.jsx(yn,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Duration"]}),children:t.jsx("div",{className:"duration-selector",children:Ia.map(v=>t.jsx("div",{className:`duration-option ${a===v.value?"active":""}`,onClick:()=>c(v.value),children:v.label},v.value))})}),t.jsx(Ut,{label:t.jsxs(t.Fragment,{children:[t.jsx(ir,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Reason (optional)"]}),htmlFor:"reservation-reason",error:y?t.jsxs(t.Fragment,{children:[t.jsx(Os,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),y]}):void 0,children:t.jsx("input",{id:"reservation-reason",type:"text",className:"reservation-input",placeholder:"e.g., Debugging flaky login test",value:l,onChange:v=>o(v.target.value),disabled:u})})]})})},Oa=({device:e,onClose:s,onUpdated:n})=>{const{toast:i}=Zt(),[r,a]=d.useState(e.tags||[]),[c,l]=d.useState(""),[o,u]=d.useState(!1),m=d.useRef(null);d.useEffect(()=>{m.current&&m.current.focus()},[]);const f=()=>{const b=c.trim();b&&!r.includes(b)&&(a([...r,b]),l(""))},p=b=>{a(r.filter(v=>v!==b))},y=b=>{b.key==="Enter"&&f()},g=async()=>{u(!0);try{await W.updateDeviceTags(e.udid,e.host,r),n(),s()}catch(b){console.error("Failed to update tags",b),i("Error saving tags. Please try again.","error")}finally{u(!1)}};return t.jsx(xn,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(Nr,{size:16,className:"title-icon"}),"Manage device tags"]}),footer:t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"btn-cancel",onClick:s,children:"Cancel"}),t.jsx("button",{className:"btn-save",onClick:g,disabled:o,children:o?"Saving...":"Apply Changes"})]}),children:t.jsxs("div",{className:"tag-modal-body",children:[t.jsxs("div",{className:"device-id-badge",children:[t.jsx("span",{className:"label",children:"Device:"}),t.jsx("span",{className:"value",children:e.udid})]}),t.jsx(Ut,{label:"Add new tag",description:"Press Enter to add multiple tags",htmlFor:"tag-input",children:t.jsxs("div",{className:"input-with-button",children:[t.jsx("input",{ref:m,id:"tag-input",type:"text",placeholder:"e.g. stable, team-a, ios-17",value:c,onChange:b=>l(b.target.value),onKeyDown:y}),t.jsx("button",{className:"add-inline-btn",onClick:f,disabled:!c.trim(),children:t.jsx(ui,{size:16})})]})}),t.jsxs("div",{className:"tags-display-section",children:[t.jsx("label",{children:"Current Tags"}),t.jsx("div",{className:"tags-list",children:r.length>0?r.map(b=>t.jsxs("div",{className:"tag-pill-editable",children:[b,t.jsx("button",{className:"remove-tag",onClick:()=>p(b),children:t.jsx(hn,{size:12})})]},b)):t.jsx("div",{className:"empty-tags",children:"No tags assigned to this device."})})]})]})})};function Pa(e){return e>=50?"ready":e>=20?"reserved":"error"}function za(e){return e>=50?t.jsx(Di,{size:10}):e>=20?t.jsx(Ai,{size:10}):t.jsx(Ei,{size:10})}function Fa(e){return e==="Normal"?"ready":e==="Critical"?"error":"reserved"}const Ua=({device:e})=>{const s=typeof e.batteryLevel=="number",n=typeof e.thermalStatus=="string"&&e.thermalStatus.length>0&&e.thermalStatus!=="Unknown";return!s&&!n?t.jsx("div",{className:"dc2-health",children:t.jsxs(Oe,{tone:"neutral",title:"Device does not report battery or thermal data",children:[t.jsx(mi,{size:10}),"No telemetry"]})}):t.jsxs("div",{className:"dc2-health",children:[s&&t.jsxs(Oe,{tone:Pa(e.batteryLevel),title:`Battery ${e.batteryLevel}%`,children:[za(e.batteryLevel),e.batteryLevel,"%"]}),n&&t.jsxs(Oe,{tone:Fa(e.thermalStatus),title:`Thermal: ${e.thermalStatus}`,children:[t.jsx(Rr,{size:10}),e.thermalStatus]})]})},Ba=/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i,Wa=/^(?:\d{1,3}\.){3}\d{1,3}$/;function Ha(e){const s=e.trim();return!s||Ba.test(s)||!Wa.test(s)?!1:s.split(".").every(n=>{const i=Number(n);return Number.isInteger(i)&&i>=0&&i<=255})}function Va(e){return e==="127.0.0.1"||e==="localhost"||e==="0.0.0.0"}function qa(e){if(!e)return null;try{const s=new URL(e.includes("://")?e:`http://${e}`);return s.port?`${s.hostname}:${s.port}`:s.hostname}catch{return e}}function Xa(e){if(e.ip&&Ha(e.ip))return e.ip;const s=qa(e.host);if(!s)return"—";const n=s.split(":")[0];return Va(n)?"—":s}const Ka="/wd/hub";function Ga(e){return e==="android"?"UiAutomator2":"XCUITest"}function Ya(e){return e==="android"?"Android":e==="tvos"?"tvOS":"iOS"}function Za(e,s=Ka){if(!e)return"—";try{const n=new URL(e.includes("://")?e:`http://${e}`),i=s.startsWith("/")?s:`/${s}`,r=n.pathname.replace(/\/$/,"");return r===i||r.endsWith(i)?`${n.protocol}//${n.host}${r}`:`${n.protocol}//${n.host}${i}`}catch{return e}}function Ja(e){const s={platformName:Ya(e.platform),"appium:automationName":Ga(e.platform),"appium:udid":e.udid};return e.sdk&&e.sdk!=="Unknown"&&e.sdk!=="unknown"&&(s["appium:platformVersion"]=e.sdk),e.name&&(s["appium:deviceName"]=e.name),s}function Qa(e){return JSON.stringify(Ja(e),null,2)}function ec(e){return e==="real"?"Real":e==="simulator"?"Simulator":e==="emulator"?"Emulator":null}const en="Shared",tc="Shared pool — visible to all authenticated users",sc=({udid:e,currentTeamId:s,resolvedTeamName:n,teams:i,canEdit:r,onChanged:a})=>{const{toast:c}=Zt(),[l,o]=d.useState(!1),[u,m]=d.useState(!1),f=s?i.get(s)??n??`Team ${s.slice(0,6)}`:en;async function p(y){m(!0);try{await W.setDeviceTeam(e,y),c(y?"Device assigned":"Device returned to shared pool","success"),a(),o(!1)}catch(g){c((g==null?void 0:g.message)||"Failed to update team","error")}finally{m(!1)}}return r?l?t.jsxs(Jt,{selectSize:"sm",autoFocus:!0,disabled:u,defaultValue:s??"",onBlur:()=>o(!1),onChange:y=>p(y.target.value||null),children:[t.jsx("option",{value:"",children:"(Shared pool)"}),Array.from(i.entries()).map(([y,g])=>t.jsx("option",{value:y,children:g},y))]}):t.jsx("button",{type:"button",onClick:()=>o(!0),className:"dc2-team-pill",title:s?"Click to change team":"Click to assign to a team",children:f}):s?t.jsx(Oe,{tone:"accent",title:`Team: ${f}`,children:f}):t.jsx(Oe,{tone:"neutral",title:tc,children:en})};function nc(e){return e.offline?"offline":e.userBlocked?"error":e.busy?"busy":e.reservedUntil&&Date.now()<e.reservedUntil?"reserved":"ready"}function ic(e,s=10,n=4){return!e||e.length<=s+n+1?e:`${e.slice(0,s)}…${e.slice(-n)}`}const rc=({device:e,reloadDevices:s,navigate:n,teams:i})=>{var T,L,F;const[r,a]=d.useState(!1),[c,l]=d.useState(!1),[o,u]=d.useState(!1),m=d.useRef(null),{me:f}=si(),{toast:p}=Zt(),y=(f==null?void 0:f.role)==="ADMIN"||(f==null?void 0:f.role)==="SUPER_ADMIN",g=nc(e),b=g==="reserved",v=!!(e.busy&&e.session_id&&!String(e.session_id).startsWith("manual_")),k=async(M,O)=>{var U;try{await((U=navigator.clipboard)==null?void 0:U.writeText(M)),p(O,"success")}catch{p("Failed to copy","error")}},N=Za(e.host),j=ec(e.deviceType),w=async()=>{await W.releaseReservation(e.udid,e.host),s()},D=async()=>{await W.blockDevice(e.udid,e.host),s()},$=async()=>{await W.unblockDevice(e.udid,e.host),s()};return t.jsxs("div",{className:`dc2 dc2-${g}`,children:[t.jsx("div",{className:"dc2-stripe"}),t.jsxs("div",{className:"dc2-header",children:[t.jsxs("span",{className:"dc2-platform",children:[vn(e.platform)," · ",e.sdk]}),t.jsx(Ur,{kind:g,showDot:!0,children:g})]}),t.jsx("div",{className:"dc2-name",title:e.name,children:e.name}),t.jsxs("div",{className:"dc2-udid-row",children:[t.jsx("div",{className:"dc2-udid",title:e.udid,children:ic(e.udid)}),t.jsx("button",{type:"button",className:"dc2-udid-copy",onClick:()=>k(e.udid,"UDID copied"),"aria-label":"Copy UDID",title:"Copy UDID",children:t.jsx(qe,{size:12})})]}),t.jsx(Ua,{device:e}),t.jsxs("div",{className:"dc2-tags",children:[j&&t.jsx(Oe,{tone:"neutral",title:`Device type: ${j}`,children:j}),t.jsx(sc,{udid:e.udid,currentTeamId:e.teamId??null,resolvedTeamName:e.teamName??null,teams:i??new Map,canEdit:y,onChanged:s}),(T=e.tags)==null?void 0:T.slice(0,3).map(M=>t.jsx(Oe,{tone:"neutral",title:M,children:M},M)),(((L=e.tags)==null?void 0:L.length)||0)>3&&t.jsxs(Oe,{tone:"neutral",children:["+",(((F=e.tags)==null?void 0:F.length)||0)-3]})]}),t.jsxs("div",{className:"dc2-metrics",children:[b?t.jsxs("div",{className:"dc2-banner dc2-banner-reserved",children:[t.jsx(yn,{size:12}),t.jsxs("span",{children:["RES · ",e.reservedBy||"anon",e.reservedUntil?` (${zr(e.reservedUntil-Date.now())})`:""]})]}):e.session_id?t.jsxs("div",{className:"dc2-banner dc2-banner-session",children:[t.jsx(bn,{size:12}),t.jsxs("span",{children:["SID · ",String(e.session_id).slice(0,10)]})]}):t.jsx(ds,{label:"Time in use",value:e.totalUtilizationTimeMilliSec?Nn(e.totalUtilizationTimeMilliSec,{compact:!0}):"—"}),t.jsx(ds,{label:"Network",value:Xa(e),mono:!0}),t.jsx(ds,{label:"Server",mono:!0,value:t.jsxs("span",{className:"dc2-copyable",children:[t.jsx("span",{className:"dc2-copyable-text",title:N,children:N}),N!=="—"&&t.jsx("button",{type:"button",className:"dc2-udid-copy",onClick:()=>k(N,"Server URL copied"),"aria-label":"Copy Appium server URL",title:"Copy Appium server URL",children:t.jsx(qe,{size:12})})]})})]}),t.jsxs("div",{className:"dc2-actions",children:[t.jsx(tt,{variant:"primary",size:"sm",disabled:v,onClick:()=>{v||n(`/devices/${e.udid}/control`)},title:v?"Locked: Appium session running":"Take control",className:"dc2-primary",children:"Control"}),b?t.jsx(tt,{variant:"secondary",size:"sm",onClick:w,children:"Release"}):!e.userBlocked&&!e.busy?t.jsx(tt,{variant:"secondary",size:"sm",onClick:()=>a(!0),children:"Reserve"}):null,t.jsx("button",{ref:m,type:"button",className:"dc2-more",onClick:()=>u(M=>!M),"aria-label":"More actions",children:t.jsx(Ki,{size:14})}),t.jsx(ya,{open:o,onClose:()=>u(!1),anchorRef:m,children:t.jsxs(Ma,{children:[t.jsx(zt,{icon:t.jsx(qe,{size:12}),onClick:()=>{u(!1),k(Qa(e),"Session capabilities copied")},children:"Copy caps…"}),t.jsx(zt,{onClick:()=>{u(!1),l(!0)},children:"Manage tags…"}),e.userBlocked?t.jsx(zt,{onClick:()=>{u(!1),$()},children:"Exit maintenance"}):t.jsx(zt,{onClick:()=>{u(!1),D()},children:"Enter maintenance"})]})})]}),r&&t.jsx(_a,{device:e,onClose:()=>a(!1),onReserved:()=>s()}),c&&t.jsx(Oa,{device:e,onClose:()=>l(!1),onUpdated:()=>s()})]})};function oc(e){const s=ks();return t.jsx(rc,{device:e.device,reloadDevices:e.reloadDevices,navigate:s,teams:e.teams})}class ac extends je.Component{constructor(){super(...arguments),this.state={teamsMap:new Map}}componentDidMount(){W.listTeams().then(s=>{this.setState({teamsMap:new Map(s.map(n=>[n.id,n.name]))})}).catch(()=>{})}render(){return t.jsx("div",{className:"device-explorer-card-container",children:je.Children.toArray(this.props.devices.map(s=>t.jsx(oc,{device:s,reloadDevices:this.props.reloadDevices,teams:this.state.teamsMap})))})}}var Ft,cc=new Uint8Array(16);function lc(){if(!Ft&&(Ft=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ft))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ft(cc)}const dc=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function uc(e){return typeof e=="string"&&dc.test(e)}var ie=[];for(var ps=0;ps<256;++ps)ie.push((ps+256).toString(16).substr(1));function mc(e){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(ie[e[s+0]]+ie[e[s+1]]+ie[e[s+2]]+ie[e[s+3]]+"-"+ie[e[s+4]]+ie[e[s+5]]+"-"+ie[e[s+6]]+ie[e[s+7]]+"-"+ie[e[s+8]]+ie[e[s+9]]+"-"+ie[e[s+10]]+ie[e[s+11]]+ie[e[s+12]]+ie[e[s+13]]+ie[e[s+14]]+ie[e[s+15]]).toLowerCase();if(!uc(n))throw TypeError("Stringified UUID is invalid");return n}function hc(e,s,n){e=e||{};var i=e.random||(e.rng||lc)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,mc(i)}const fc=({onCommand:e,prompt:s="$",welcomeMessage:n="Interactive Shell (Restricted Mode)",platform:i})=>{const[r,a]=d.useState([{type:"system",content:n,timestamp:Date.now()},{type:"system",content:'Type "help" for allowed commands.',timestamp:Date.now()}]),[c,l]=d.useState(""),[o,u]=d.useState([]),[m,f]=d.useState(-1),[p,y]=d.useState(!1),g=d.useRef(null),b=d.useRef(null);d.useEffect(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[r]);const v=N=>{const j=N.trim();if((j.startsWith("{")||j.startsWith("["))&&(j.endsWith("}")||j.endsWith("]")))try{const w=JSON.parse(j);return JSON.stringify(w,null,2)}catch{}return N},k=async N=>{if(N.key==="Enter"&&!p){const j=c.trim();if(!j)return;if(l(""),a(w=>[...w,{type:"command",content:`${s} ${j}`,timestamp:Date.now()}]),u(w=>[...w,j]),f(-1),y(!0),j==="clear"){a([]),y(!1);return}if(j==="help"){let w="";i==="android"?w=`
|
|
207
187
|
Android Allowed Commands:
|
|
208
188
|
• System Info: getprop, ip addr, date, uptime, cat /proc/meminfo, cat /proc/cpuinfo
|
|
209
189
|
• Process Mgmt: ps, top
|
|
@@ -218,7 +198,7 @@ iOS Allowed Commands:
|
|
|
218
198
|
listapps, get_app_container, list, getenv
|
|
219
199
|
• Simulator System:
|
|
220
200
|
ls, ps, top, date, uptime, whoami
|
|
221
|
-
`),a(D=>[...D,{type:"output",content:w.trim(),timestamp:Date.now()}]),y(!1);return}try{const w=await e(j),D=v(w||"(No output)");a($=>[...$,{type:"output",content:D,timestamp:Date.now()}])}catch(w){a(D=>[...D,{type:"error",content:w.message||"Unknown error",timestamp:Date.now()}])}finally{y(!1),setTimeout(()=>{var w;return(w=b.current)==null?void 0:w.focus()},10)}}else if(N.key==="ArrowUp"){if(N.preventDefault(),o.length>0){const j=m===-1?o.length-1:Math.max(0,m-1);f(j),l(o[j])}}else if(N.key==="ArrowDown"&&(N.preventDefault(),m!==-1)){const j=m+1;j>=o.length?(f(-1),l("")):(f(j),l(o[j]))}};return t.jsxs("div",{className:"terminal-container theme-dark",children:[t.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),t.jsxs("header",{className:"terminal-header",children:[t.jsxs("div",{className:"terminal-controls",children:[t.jsx("div",{className:"dot red"}),t.jsx("div",{className:"dot yellow"}),t.jsx("div",{className:"dot green"})]}),t.jsxs("div",{className:"terminal-title",children:[vn(i)," shell"]}),t.jsx("div",{className:"terminal-actions",children:t.jsx("button",{className:"terminal-action-btn",onClick:()=>a([]),title:"Clear terminal",children:"CLEAR"})})]}),t.jsxs("div",{className:"terminal-history",ref:g,onClick:()=>{var N;return(N=b.current)==null?void 0:N.focus()},children:[r.map((N,j)=>t.jsx("div",{className:`terminal-line ${N.type}`,children:N.content},j)),p&&t.jsx("div",{className:"terminal-line system animate-pulse",children:"Executing command..."})]}),t.jsxs("div",{className:"terminal-input-area",children:[t.jsx("span",{className:"terminal-prompt",children:s}),t.jsx("input",{ref:b,className:"terminal-input",value:c,onChange:N=>l(N.target.value),onKeyDown:k,disabled:p,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"Type a command..."})]})]})};function Te(e,s){var n;s(e),(n=e.children)==null||n.forEach(i=>Te(i,s))}function Ee(e,...s){var n;for(const i of s){const r=(n=e.attributes)==null?void 0:n[i];if(r!=null&&r!=="")return String(r)}}function rt(e){var s;return((s=e.type)==null?void 0:s.split(".").pop())||e.type||""}function
|
|
201
|
+
`),a(D=>[...D,{type:"output",content:w.trim(),timestamp:Date.now()}]),y(!1);return}try{const w=await e(j),D=v(w||"(No output)");a($=>[...$,{type:"output",content:D,timestamp:Date.now()}])}catch(w){a(D=>[...D,{type:"error",content:w.message||"Unknown error",timestamp:Date.now()}])}finally{y(!1),setTimeout(()=>{var w;return(w=b.current)==null?void 0:w.focus()},10)}}else if(N.key==="ArrowUp"){if(N.preventDefault(),o.length>0){const j=m===-1?o.length-1:Math.max(0,m-1);f(j),l(o[j])}}else if(N.key==="ArrowDown"&&(N.preventDefault(),m!==-1)){const j=m+1;j>=o.length?(f(-1),l("")):(f(j),l(o[j]))}};return t.jsxs("div",{className:"terminal-container theme-dark",children:[t.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),t.jsxs("header",{className:"terminal-header",children:[t.jsxs("div",{className:"terminal-controls",children:[t.jsx("div",{className:"dot red"}),t.jsx("div",{className:"dot yellow"}),t.jsx("div",{className:"dot green"})]}),t.jsxs("div",{className:"terminal-title",children:[vn(i)," shell"]}),t.jsx("div",{className:"terminal-actions",children:t.jsx("button",{className:"terminal-action-btn",onClick:()=>a([]),title:"Clear terminal",children:"CLEAR"})})]}),t.jsxs("div",{className:"terminal-history",ref:g,onClick:()=>{var N;return(N=b.current)==null?void 0:N.focus()},children:[r.map((N,j)=>t.jsx("div",{className:`terminal-line ${N.type}`,children:N.content},j)),p&&t.jsx("div",{className:"terminal-line system animate-pulse",children:"Executing command..."})]}),t.jsxs("div",{className:"terminal-input-area",children:[t.jsx("span",{className:"terminal-prompt",children:s}),t.jsx("input",{ref:b,className:"terminal-input",value:c,onChange:N=>l(N.target.value),onKeyDown:k,disabled:p,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"Type a command..."})]})]})};function Te(e,s){var n;s(e),(n=e.children)==null||n.forEach(i=>Te(i,s))}function Ee(e,...s){var n;for(const i of s){const r=(n=e.attributes)==null?void 0:n[i];if(r!=null&&r!=="")return String(r)}}function rt(e){var s;return((s=e.type)==null?void 0:s.split(".").pop())||e.type||""}function pc(e,s){const n=[];return Te(e,i=>{Ee(i,"content-desc","contentDescription","accessibilityId","name","label")===s&&n.push(i)}),n}function gc(e,s){const n=[];return Te(e,i=>{Ee(i,"resource-id","resourceId","identifier")===s&&n.push(i)}),n}function Ns(e,s){const n=[];return Te(e,i=>{(i.type===s||rt(i)===s)&&n.push(i)}),n}function xc(e,s){const n=[];return Te(e,i=>{Ee(i,"name")===s&&n.push(i)}),n}function yc(e){const s=/^\/\/(\*|[A-Za-z_][\w.-]*)\[@([\w-]+)=(["'])(.*?)\3\]$/.exec(e.trim());return s?{tag:s[1]==="*"?null:s[1],attrKey:s[2],attrValue:s[4]}:null}function vc(e,s){const n=s.split("/").filter(Boolean);if(n.length===0)return null;const i=[];for(const a of n){const c=/^([A-Za-z_][\w.-]*)\[(\d+)\]$/.exec(a);if(!c)return null;i.push({type:c[1],index:parseInt(c[2],10)})}if(i[0].type!==e.type&&i[0].type!==rt(e)||i[0].index!==1)return null;let r=e;for(let a=1;a<i.length&&r;a++){const{type:c,index:l}=i[a];let o=0,u;for(const m of r.children||[])if((m.type===c||rt(m)===c)&&(o+=1,o===l)){u=m;break}r=u}return r?[r]:[]}function bc(e,s){const n=vc(e,s);if(n!==null)return{kind:"matched",nodes:n};const i=yc(s);if(i){const r=[];return Te(e,a=>{if(i.tag&&a.type!==i.tag&&rt(a)!==i.tag)return;Ee(a,i.attrKey)===i.attrValue&&r.push(a)}),{kind:"matched",nodes:r}}return{kind:"unsupported",nodes:[],reason:"Complex XPath (axes, multiple predicates, functions) — use a real driver to verify"}}function wc(e,s){const n=s.trim(),i=/^\*\*\/([A-Za-z_]\w*)\[`(\w+)\s*==\s*"([^"]*)"`\]$/.exec(n);if(i){const[,c,l,o]=i,u=[];return Te(e,m=>{if(m.type!==c&&rt(m)!==c)return;Ee(m,l)===o&&u.push(m)}),{kind:"matched",nodes:u}}const r=/^\*\*\/([A-Za-z_]\w*)\[(\d+)\]$/.exec(n);if(r){const[,c,l]=r,o=parseInt(l,10),u=[];return Te(e,m=>{(m.type===c||rt(m)===c)&&u.push(m)}),{kind:"matched",nodes:u[o-1]?[u[o-1]]:[]}}const a=/^\*\*\/([A-Za-z_]\w*)$/.exec(n);return a?Ns(e,a[1]).length>0?{kind:"matched",nodes:Ns(e,a[1])}:{kind:"matched",nodes:[]}:{kind:"unsupported",nodes:[],reason:"Multi-segment class chain — use a real driver to verify"}}function jc(e,s){const i=s.trim().split(/\s+AND\s+/i).map(c=>c.trim()),r=[];for(const c of i){const l=/^(\w+)\s*==\s*"([^"]*)"$/.exec(c);if(!l)return{kind:"unsupported",nodes:[],reason:"Predicate uses unsupported operator (only ==, AND) — use a real driver"};r.push({key:l[1],value:l[2]})}const a=[];return Te(e,c=>{for(const l of r){let o;if(l.key==="type"?o=c.type:l.key==="label"?o=Ee(c,"label")??c.label:l.key==="name"?o=Ee(c,"name")??c.name:l.key==="value"?o=Ee(c,"value")??c.value:o=Ee(c,l.key),o!==l.value)return}a.push(c)}),{kind:"matched",nodes:a}}function Nc(e,s,n){const i=s.toLowerCase();if(!n)return{kind:"matched",nodes:[]};switch(i){case"accessibility id":return{kind:"matched",nodes:pc(e,n)};case"id":return{kind:"matched",nodes:gc(e,n)};case"class name":return{kind:"matched",nodes:Ns(e,n)};case"name":return{kind:"matched",nodes:xc(e,n)};case"xpath":return bc(e,n);case"-ios class chain":return wc(e,n);case"-ios predicate string":return jc(e,n);default:return{kind:"unsupported",nodes:[],reason:`Strategy "${s}" not yet supported by snapshot matcher`}}}function tn(e,s){const n=e.toLowerCase();if(n==="accessibility id")return/[0-9a-f]{8}-[0-9a-f]{4}/i.test(s)?{level:"fragile",reason:"UUID in accessibility ID — dynamically generated, unreliable"}:{level:"stable",reason:"#1 recommended by Appium — portable across Android & iOS"};if(n==="id")return/[0-9a-f]{8}-[0-9a-f]{4}/i.test(s)?{level:"fragile",reason:"UUID in resource ID — dynamically generated"}:/\d{6,}/.test(s)&&!s.includes(":id/")?{level:"moderate",reason:"Long numeric ID without package prefix — may not be unique"}:/^[a-z][a-z0-9.]+:id\//.test(s)?{level:"stable",reason:"Android resource-id with package prefix — #2 by Appium priority"}:{level:"stable",reason:"Element ID — #2 by Appium 2.x recommended priority"};if(n==="xpath"){if(s.startsWith("/hierarchy")||s.startsWith("/")&&!s.startsWith("//"))return{level:"very-fragile",reason:"ABSOLUTE XPath — breaks on any layout change. Avoid entirely"};if(/\[\d+\]/.test(s))return{level:"very-fragile",reason:"Index-based XPath [n] — breaks when element order changes"};const i=(s.match(/\//g)||[]).length;return i>7?{level:"fragile",reason:`${i}-level deep XPath — brittle to layout changes, 10x slower on iOS`}:s.includes("@content-desc")||s.includes("@resource-id")||s.includes("@text")?{level:"moderate",reason:"XPath with semantic attribute — more stable, but still prefer ID/accessibility id"}:{level:"fragile",reason:"XPath is a LAST RESORT per Appium docs — 10x slower on iOS, breaks on UI changes"}}return n==="-ios predicate string"?{level:"stable",reason:"iOS NSPredicate — native engine, excellent performance on iOS"}:n==="-ios class chain"?{level:"stable",reason:"iOS Class Chain — native iOS, faster than XPath"}:n==="-android uiautomator"?s.includes("resourceId")||s.includes("description")?{level:"stable",reason:"UIAutomator2 with resourceId/description — Android native, very reliable"}:s.includes("textContains")||s.includes("text(")?{level:"moderate",reason:"UIAutomator2 with text matching — breaks if copy changes"}:{level:"stable",reason:"UIAutomator2 — Android native engine, preferred over XPath on Android"}:n==="class name"?{level:"fragile",reason:"Class name alone is almost never unique — use with explicit index or prefer accessibility id"}:n==="name"?{level:"fragile",reason:"⚠️ Deprecated in Appium 2.x — replace with accessibility id or id"}:n==="link text"?{level:"moderate",reason:"Text-based locator — breaks if copy/label changes"}:{level:"moderate",reason:"Verify reliability for your target platform"}}function sn(e,s,n,i){var N,j,w,D,$,T,L;const{strategy:r,value:a}=i,c=(e.text||e.name||((N=e.type)==null?void 0:N.split(".").pop())||"element").replace(/[^a-zA-Z0-9]/g,"_").replace(/^_+/,"").slice(0,24)||"element",l=c.charAt(0).toLowerCase()+c.slice(1),o=((j=e.type)==null?void 0:j.toLowerCase().includes("edit"))||((w=e.type)==null?void 0:w.toLowerCase().includes("input"))||((D=e.type)==null?void 0:D.toLowerCase().includes("field"))||(($=e.type)==null?void 0:$.toLowerCase().includes("textfield")),u=((T=e.attributes)==null?void 0:T.scrollable)==="true"||((L=e.attributes)==null?void 0:L.scrollable)===!0,m=r.toLowerCase().startsWith("-ios")&&s!=="ios"?`// ⚠️ -ios predicate/class chain ONLY work with XCUITest (iOS)
|
|
222
202
|
`:r.toLowerCase().startsWith("-android")&&s!=="android"?`// ⚠️ -android uiautomator ONLY works with UIAutomator2 (Android)
|
|
223
203
|
`:"",f={"accessibility id":`~${a}`,id:s==="ios"?`-ios predicate string:label == "${a}"`:`android=new UiSelector().resourceId("${a}")`,xpath:`${a}`,"-ios predicate string":`-ios predicate string:${a}`,"-ios class chain":`-ios class chain:${a}`,"-android uiautomator":`android=${a}`},p={"accessibility id":`AppiumBy.accessibilityId("${a}")`,id:`AppiumBy.id("${a}")`,xpath:`AppiumBy.xpath("${a}")`,"-ios predicate string":`AppiumBy.iOSNsPredicateString("${a}")`,"-ios class chain":`AppiumBy.iOSClassChain("${a}")`,"-android uiautomator":`AppiumBy.androidUIAutomator("${a}")`,"class name":`AppiumBy.className("${a}")`},y={"accessibility id":`AppiumBy.ACCESSIBILITY_ID, "${a}"`,id:`AppiumBy.ID, "${a}"`,xpath:`AppiumBy.XPATH, "${a}"`,"-ios predicate string":`AppiumBy.IOS_PREDICATE, "${a}"`,"-ios class chain":`AppiumBy.IOS_CLASS_CHAIN, "${a}"`,"-android uiautomator":`AppiumBy.ANDROID_UIAUTOMATOR, '${a}'`,"class name":`AppiumBy.CLASS_NAME, "${a}"`},g=p[r.toLowerCase()],b=y[r.toLowerCase()],v=f[r.toLowerCase()];return n==="java"?g?`${m}// Appium Java Client 9.x + Selenium 4 + TestNG
|
|
224
204
|
import io.appium.java_client.AppiumBy;
|
|
@@ -254,12 +234,12 @@ const element = await driver.$('${v}');
|
|
|
254
234
|
await element.waitForExist({ timeout: 5000 });
|
|
255
235
|
${o?`await driver.$('target').clearValue();
|
|
256
236
|
await element.addValue("your text here");`:"await element.click();"}
|
|
257
|
-
// Assert with expect(element).toBeDisplayed()`:`// Strategy "${r}" not supported in WebdriverIO mobile`}function nn(e){var y,g,b,v,k,N,j,w,D,$,T;const s=(e.type||"").toLowerCase(),n=((y=e.attributes)==null?void 0:y.clickable)==="true"||((g=e.attributes)==null?void 0:g.clickable)===!0,i=((b=e.attributes)==null?void 0:b.enabled)!=="false"&&((v=e.attributes)==null?void 0:v.enabled)!==!1,r=((k=e.attributes)==null?void 0:k.scrollable)==="true"||((N=e.attributes)==null?void 0:N.scrollable)===!0,a=e.text||e.label||e.value||"",c=((j=e.children)==null?void 0:j.length)||0;let l="Element",o="📦";s.includes("button")||s.includes("btn")||n&&c===0?(l="Button",o="🔘"):s.includes("edit")||s.includes("input")||s.includes("field")?(l="Text Input",o="✏️"):s.includes("image")||s.includes("img")||s.includes("imageview")?(l="Image",o="🖼️"):s.includes("scroll")||s.includes("recyclerview")||s.includes("listview")||r?(l="Scrollable List",o="📜"):s.includes("text")||s.includes("label")?(l="Text Label",o="📝"):s.includes("switch")||s.includes("toggle")||s.includes("checkbox")?(l="Toggle / Checkbox",o="☑️"):s.includes("nav")||s.includes("toolbar")||s.includes("tabbar")?(l="Navigation Bar",o="🧭"):c>0&&(l=`Container (${c} children)`,o="🗂️");const u=((w=e.suggestedLocators)==null?void 0:w.find(L=>L.strategy==="accessibility id"||L.strategy==="id"))||((D=e.suggestedLocators)==null?void 0:D[0]),m=i?(($=e.rect)==null?void 0:$.width)===0||((T=e.rect)==null?void 0:T.height)===0?"⚠️ Zero-size element — may not be interactable":void 0:"⚠️ Element is disabled",f=a?` with text "${a.slice(0,30)}"`:"",p=`This is a ${l.toLowerCase()}${f}. ${n?"It can be tapped/clicked.":r?"It supports scrolling.":"It is a visual container."}${c>0?` Contains ${c} child element${c>1?"s":""}.`:""}`;return{role:l,description:p,interactable:n||i,bestLocator:u,warning:m,emoji:o}}function rn(e,s){if(!s)return!0;const n=s.toLowerCase().trim(),i={button:["button","btn","clickable","tapable"],input:["edittext","input","field","textfield","textinput","edit"],image:["image","imageview","img","picture","photo","icon"],text:["textview","label","text","statictext"],list:["listview","recyclerview","scrollview","tableview","collectionview","scroll"],toggle:["switch","checkbox","toggle","radiobutton"],nav:["toolbar","navigationbar","tabbar","actionbar","navbar"]},r=(e.type||"").toLowerCase(),a=(e.text||e.label||e.value||"").toLowerCase(),c=(e.name||"").toLowerCase(),l=Object.values(e.attributes||{}).join(" ").toLowerCase();for(const[o,u]of Object.entries(i))if(n.includes(o)&&u.some(m=>r.includes(m)))return!0;return r.includes(n)||a.includes(n)||c.includes(n)||l.includes(n)}const Rc=({sessionId:e,udid:s,streamUrl:n,embedded:i=!1,overlayTarget:r=null,onModeChange:a})=>{var Rt,Et,$t,pt,Dt,Tt,Lt,gt,Mt,It;const[c,l]=d.useState(!0),[o,u]=d.useState(null),[m,f]=d.useState(null),[p,y]=d.useState(null),[g,b]=d.useState(null),[v,k]=d.useState(new Set(["/"])),[N,j]=d.useState(""),[w,D]=d.useState(null),[$,T]=d.useState("info"),[L,F]=d.useState("java"),[M,O]=d.useState(null),[U,G]=d.useState({width:0,height:0}),[q,Z]=d.useState({width:0,height:0}),[V,B]=d.useState(!1),[R,C]=d.useState("inspect");d.useEffect(()=>{a==null||a(R)},[R,a]);const[ne,ae]=d.useState({}),[Fe,ue]=d.useState({}),[me,ke]=d.useState(null),[ee,P]=d.useState(null),[J,se]=d.useState(null),re=d.useRef(null),he=d.useRef(null),Me=d.useRef(null),fe=d.useRef(null),ve=d.useCallback(()=>{var Q,K,Y;if(!re.current)return;const h=re.current.getBoundingClientRect(),A=h.width,_=h.height,x=(Q=o==null?void 0:o.hierarchy)==null?void 0:Q.rect;let S=((K=o==null?void 0:o.metadata)==null?void 0:K.screenWidth)||U.width||1,E=((Y=o==null?void 0:o.metadata)==null?void 0:Y.screenHeight)||U.height||1;x&&x.width>0&&x.height>0&&(S=x.width,E=x.height);const I=S/E;let X,z;A/_>I?(z=_,X=z*I):(X=A,z=X/I),Z({width:X,height:z})},[o,U]);d.useEffect(()=>(ve(),window.addEventListener("resize",ve),()=>window.removeEventListener("resize",ve)),[ve]),d.useEffect(()=>{s&&Ae()},[s]),d.useEffect(()=>{if(!s)return;let h=!1;return H.getAppiumSession(s).then(A=>{h||P({sessionId:(A==null?void 0:A.sessionId)??null,basePath:(A==null?void 0:A.basePath)??""})}).catch(()=>{h||P({sessionId:null,basePath:""})}),()=>{h=!0}},[s]);const Ue=d.useCallback(async(h,A,_)=>{if(ee!=null&&ee.sessionId){ke(h);try{const x=await H.verifyLocator(ee.basePath,ee.sessionId,{strategy:h,selector:A,action:_});ue(S=>({...S,[h]:x}))}catch(x){ue(S=>({...S,[h]:{found:!1,count:0,error:(x==null?void 0:x.message)||String(x)}}))}finally{ke(null)}}},[ee]);d.useEffect(()=>{var h;if((h=p==null?void 0:p.suggestedLocators)!=null&&h.length){const A=p.suggestedLocators.find(_=>_.strategy==="accessibility id"||_.strategy==="id")||p.suggestedLocators[0];O(A)}else O(null);ae({}),ue({}),se(null)},[p]);const Ke=d.useCallback((h,A)=>{if(!(o!=null&&o.hierarchy))return;const _=Ac(o.hierarchy,h,A);ae(x=>({...x,[h]:_})),se(h)},[o]),Ae=async()=>{if(s){l(!0),f(null);try{const h=await H.getInspectorSnapshot(s);if(!(h!=null&&h.hierarchy)){u(null),f((h==null?void 0:h.error)||"Failed to capture snapshot");return}u(h);const A=new Set(["/"]),_=(x,S)=>{var E;S<3&&(A.add(x.xpath),(E=x.children)==null||E.forEach(I=>_(I,S+1)))};_(h.hierarchy,0),k(A)}catch(h){u(null),f(h.message||"Failed to capture snapshot")}finally{l(!1)}}},ct=h=>{const{naturalWidth:A,naturalHeight:_}=h.currentTarget;G({width:A,height:_})},Ie=()=>B(!0),Ge=h=>{B(!1);const{naturalWidth:A,naturalHeight:_}=h.currentTarget;A>0&&_>0&&G({width:A,height:_})},oe=n&&!V,Ye=h=>{if(R!=="interact"||!s)return;const A=h.currentTarget.getBoundingClientRect();fe.current={x:h.clientX-A.left,y:h.clientY-A.top,time:Date.now()}},lt=async h=>{var pe,_e,We;if(R!=="interact"||!s||!fe.current)return;const A=fe.current,_=h.currentTarget.getBoundingClientRect(),x=h.clientX-_.left,S=h.clientY-_.top,E=Date.now()-A.time,I=q.width,X=q.height,z=(pe=o==null?void 0:o.hierarchy)==null?void 0:pe.rect;let Q=((_e=o==null?void 0:o.metadata)==null?void 0:_e.screenWidth)||U.width,K=((We=o==null?void 0:o.metadata)==null?void 0:We.screenHeight)||U.height;if(z&&z.width>0&&z.height>0&&(Q=z.width,K=z.height),!Q||!K||I===0||X===0)return;const Y=(_t,_s)=>({x:Math.round(_t/I*Q),y:Math.round(_s/X*K),px:_t/I,py:_s/X}),te=Y(A.x,A.y),we=Y(x,S),Re=Math.sqrt(Math.pow(x-A.x,2)+Math.pow(S-A.y,2));if(!(te.px<0||te.px>1||te.py<0||te.py>1)){try{E<500&&Re<10?await H.tap(s,te.x,te.y):E>=500&&Re<10?await H.touchAndHold(s,te.x,te.y,E):Re>=10&&await H.swipe(s,te.x,te.y,we.x,we.y)}catch(_t){console.error("Interaction failed:",_t)}fe.current=null}},Ze=h=>{const A=new Set(v);A.has(h)?A.delete(h):A.add(h),k(A)},Ct=()=>{const h=new Set,A=_=>{var x;h.add(_.xpath),(x=_.children)==null||x.forEach(A)};o!=null&&o.hierarchy&&A(o.hierarchy),k(h)},St=()=>k(new Set(["/"])),ge=(h,A)=>{navigator.clipboard.writeText(h),D(A),setTimeout(()=>D(null),2e3)},be=h=>{var _;let A=1;return(_=h.children)==null||_.forEach(x=>A+=be(x)),A},dt=h=>{if(!h)return[];const A={},_=x=>{var I;const S=nn(x),E=S.role.replace(/\s*\(.*?\)\s*/,"");A[E]||(A[E]={emoji:S.emoji,count:0}),A[E].count+=1,(I=x.children)==null||I.forEach(_)};return _(h),Object.entries(A).map(([x,S])=>({role:x,emoji:S.emoji,count:S.count})).sort((x,S)=>S.count-x.count)},Je=h=>h.xpath.split("/").filter(Boolean).slice(-3),ut=(h,A=0)=>{var Y,te,we,Re;if(!h)return null;const _=v.has(h.xpath),x=((Y=h.children)==null?void 0:Y.length)>0,S=(p==null?void 0:p.xpath)===h.xpath,E=(g==null?void 0:g.xpath)===h.xpath,I=((te=h.type)==null?void 0:te.split(".").pop())||"Element",X=h.label||((we=h.attributes)==null?void 0:we["content-desc"])||((Re=h.attributes)==null?void 0:Re["resource-id"])||h.name,z=typeof X=="string"&&X&&X!==I&&X!==h.type?X:null,Q=z||I,K=!N||rn(h,N);if(!K&&!x)return null;if(N&&!K){const pe=_e=>{var We;return rn(_e,N)?!0:((We=_e.children)==null?void 0:We.some(pe))||!1};if(!pe(h))return null}return t.jsxs("div",{className:"tree-node",children:[t.jsxs("div",{className:`tree-item ${S?"selected":""} ${E&&!S?"hovered":""}`,onClick:()=>{y(h),T("info")},onMouseEnter:()=>b(h),onMouseLeave:()=>b(null),children:[t.jsx("div",{className:"tree-item-indent",style:{width:`${A*14}px`}}),x?t.jsx("button",{onClick:pe=>{pe.stopPropagation(),Ze(h.xpath)},className:"tree-toggle",children:_?t.jsx(fn,{size:11}):t.jsx(wn,{size:11})}):t.jsx("span",{className:"tree-toggle-spacer"}),t.jsx(Di,{size:11,className:"tree-icon"}),t.jsx("span",{className:"tree-label",title:`${I}${z?` — ${z}`:""}`,children:Q}),z&&t.jsx("span",{className:"tree-type-tag",title:I,children:I}),h.text&&t.jsxs("span",{className:"tree-text-preview",children:['"',h.text.slice(0,20),'"']}),x&&t.jsx("span",{className:"tree-badge",children:h.children.length})]}),_&&x&&t.jsx("div",{className:"tree-children",children:h.children.map(pe=>ut(pe,A+1))})]},h.xpath)},kt=()=>{var x,S,E;const h=(x=o==null?void 0:o.hierarchy)==null?void 0:x.rect;if(h&&h.width>0&&h.height>0)return{w:h.width,h:h.height};const A=((S=o==null?void 0:o.metadata)==null?void 0:S.screenWidth)||U.width,_=((E=o==null?void 0:o.metadata)==null?void 0:E.screenHeight)||U.height;return A>0&&_>0?{w:A,h:_}:null},mt=h=>{const A=kt();if(!A)return[];const _=[],{w:x,h:S}=A,E=(I,X)=>{var Q,K,Y;const z=!I.children||I.children.length===0;((Q=I.rect)==null?void 0:Q.width)>0&&((K=I.rect)==null?void 0:K.height)>0&&z&&_.push(t.jsx("div",{className:"omni-hit-area",style:{left:`${I.rect.x/x*100}%`,top:`${I.rect.y/S*100}%`,width:`${I.rect.width/x*100}%`,height:`${I.rect.height/S*100}%`,zIndex:X},onClick:te=>{te.stopPropagation(),y(I),T("info")},onMouseEnter:()=>b(I),onMouseLeave:()=>b(null)},I.xpath)),(Y=I.children)==null||Y.forEach(te=>E(te,X+1))};return o!=null&&o.hierarchy&&E(o.hierarchy,1),_},Be=()=>{var E,I,X;if(!J||!U.width)return[];const h=ne[J];if(!h||h.kind!=="matched"||h.nodes.length===0)return[];const A=(E=o==null?void 0:o.hierarchy)==null?void 0:E.rect;let _=((I=o==null?void 0:o.metadata)==null?void 0:I.screenWidth)||U.width,x=((X=o==null?void 0:o.metadata)==null?void 0:X.screenHeight)||U.height;A&&A.width>0&&A.height>0&&(_=A.width,x=A.height);const S=h.nodes.length===1?"omni-frame-match unique":"omni-frame-match multi";return h.nodes.filter(z=>z.rect&&z.rect.width>0&&z.rect.height>0).map((z,Q)=>t.jsx("div",{className:S,style:{left:`${z.rect.x/_*100}%`,top:`${z.rect.y/x*100}%`,width:`${z.rect.width/_*100}%`,height:`${z.rect.height/x*100}%`}},`match-${J}-${Q}`))},He=(h,A)=>{const _=kt();if(!(h!=null&&h.rect)||!_)return null;const{w:x,h:S}=_;return t.jsx("div",{className:`omni-frame-${A}`,style:{left:`${h.rect.x/x*100}%`,top:`${h.rect.y/S*100}%`,width:`${h.rect.width/x*100}%`,height:`${h.rect.height/S*100}%`}})},ht=o!=null&&o.hierarchy?be(o.hierarchy):0,ce=p?nn(p):null,ft=o!=null&&o.hierarchy&&R==="inspect"?t.jsxs("div",{className:"omni-overlay",children:[mt(o.hierarchy),Be(),He(g,"hover"),He(p,"select")]}):null,ns={stable:{icon:t.jsx(Ot,{size:10}),cls:"stable"},moderate:{icon:t.jsx(et,{size:10}),cls:"moderate"},fragile:{icon:t.jsx(Qe,{size:10}),cls:"fragile"},"very-fragile":{icon:t.jsx(Qe,{size:10}),cls:"very-fragile"}},At=i&&(o!=null&&o.hierarchy)?dt(o.hierarchy):[];return t.jsxs("div",{className:`omni-inspector-container ${i?"omni-embedded":""}`,children:[i&&r&&ft?mn.createPortal(ft,r):null,t.jsxs("div",{className:"omni-main-content",children:[!i&&t.jsxs("div",{className:"omni-screenshot-panel",children:[t.jsxs("div",{className:"omni-screenshot-header",children:[t.jsxs("div",{className:"omni-header-left",children:[t.jsx("span",{className:"omni-screenshot-title",children:"Device Preview"}),t.jsxs("div",{className:"omni-mode-toggle",children:[t.jsxs("button",{className:`omni-mode-btn ${R==="inspect"?"active":""}`,onClick:()=>C("inspect"),title:"Inspection mode (highlight elements)",children:[t.jsx(Fs,{size:12}),t.jsx("span",{children:"Inspect"})]}),t.jsxs("button",{className:`omni-mode-btn ${R==="interact"?"active":""}`,onClick:()=>C("interact"),title:"Interaction mode (direct control)",children:[t.jsx(Bs,{size:12}),t.jsx("span",{children:"Interact"})]})]})]}),t.jsxs("button",{className:"omni-refresh-btn",onClick:Ae,disabled:c,children:[t.jsx(yt,{size:12,className:c?"animate-spin":""}),c?"Capturing...":"Refresh"]})]}),t.jsxs("div",{className:"omni-screenshot-container",ref:re,children:[c&&!oe&&t.jsxs("div",{className:"omni-loading-overlay",children:[t.jsx("div",{className:"omni-spinner"}),t.jsx("span",{children:"Capturing screen..."})]}),!o&&!c&&!oe&&t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(ls,{size:40}),t.jsx("span",{children:"Click Refresh to capture"})]}),oe&&t.jsxs("div",{className:`omni-screenshot-wrapper ${R==="interact"?"interactable":""}`,onMouseDown:Ye,onMouseUp:lt,children:[t.jsx("img",{ref:Me,src:n,onLoad:Ge,onError:Ie,className:"omni-screenshot-img",style:R==="interact"?{pointerEvents:"none"}:{},draggable:!1,alt:"Live Device Stream"}),ft]}),!oe&&(o==null?void 0:o.screenshot)&&t.jsxs("div",{className:`omni-screenshot-wrapper ${R==="interact"?"interactable":""}`,onMouseDown:Ye,onMouseUp:lt,children:[t.jsx("img",{ref:he,src:`data:image/png;base64,${o.screenshot}`,onLoad:ct,className:"omni-screenshot-img",style:R==="interact"?{pointerEvents:"none"}:{},draggable:!1}),R==="inspect"&&t.jsxs("div",{className:"omni-overlay",children:[mt(o.hierarchy),Be(),He(g,"hover"),He(p,"select")]})]})]})]}),t.jsxs("div",{className:"omni-tree-panel",children:[t.jsxs("div",{className:"omni-tree-header",children:[t.jsxs("div",{className:"omni-tree-title",children:[t.jsx(gi,{size:14}),t.jsx("span",{children:"Source"}),ht>0&&t.jsxs("span",{className:"omni-count-badge",children:[ht," elements"]}),(o==null?void 0:o.hierarchySource)&&t.jsx("span",{className:`omni-source-badge ${o.hierarchySource==="appium-session"?"is-session":"is-device"}`,title:o.hierarchySource==="appium-session"?`From Appium session ${o.sessionId} — the same tree the driver resolves locators against`:"Read from the device. No Appium session is driving it.",children:o.hierarchySource==="appium-session"?"Session":"Device"})]}),t.jsxs("div",{className:"omni-tree-actions",children:[t.jsx("button",{onClick:Ct,className:"omni-action-btn",title:"Expand all",children:t.jsx(Zi,{size:12})}),t.jsx("button",{onClick:St,className:"omni-action-btn",title:"Collapse all",children:t.jsx(pr,{size:12})}),i&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>C(R==="inspect"?"interact":"inspect"),className:`omni-action-btn ${R==="inspect"?"active":""}`,title:R==="inspect"?"Inspect mode — click the device to select an element":"Interact mode — clicks control the device","aria-pressed":R==="inspect",children:R==="inspect"?t.jsx(Fs,{size:12}):t.jsx(Bs,{size:12})}),t.jsx("button",{onClick:Ae,className:"omni-action-btn",title:c?"Capturing…":"Refresh snapshot",disabled:c,children:t.jsx(yt,{size:12,className:c?"animate-spin":""})})]})]})]}),m&&!c&&t.jsxs("div",{className:"omni-tree-error",role:"alert",children:[t.jsx(Qe,{size:12}),t.jsx("span",{children:m}),t.jsx("button",{type:"button",onClick:Ae,className:"omni-tree-error-retry",children:"Retry"})]}),t.jsxs("div",{className:"omni-tree-search",children:[t.jsx(ni,{size:14}),t.jsx("input",{type:"text",placeholder:"Search elements... (try 'login button' or 'text field')",value:N,onChange:h=>j(h.target.value),"aria-label":"Search elements"}),N&&t.jsx("button",{onClick:()=>j(""),className:"omni-clear-btn",children:"×"})]}),N&&t.jsxs("div",{className:"omni-search-hint",children:[t.jsx(ys,{size:10}),' Smart search active — try "button", "input", "image"']}),t.jsx("div",{className:"omni-tree-content",children:o!=null&&o.hierarchy?ut(o.hierarchy):t.jsx("div",{className:"omni-empty-state small",children:t.jsx("span",{children:"No hierarchy loaded"})})})]}),t.jsxs("div",{className:"omni-details-panel",children:[t.jsxs("div",{className:"omni-details-tabs",role:"tablist",children:[t.jsxs("button",{className:`omni-details-tab ${$==="info"?"active":""}`,onClick:()=>T("info"),role:"tab","aria-selected":$==="info",children:[t.jsx(rr,{size:12})," ",t.jsx("span",{children:"Info"})]}),t.jsxs("button",{className:`omni-details-tab ${$==="insight"?"active":""}`,onClick:()=>T("insight"),disabled:!p,title:"AI element analysis",role:"tab","aria-selected":$==="insight",children:[t.jsx(tr,{size:12})," ",t.jsx("span",{children:"AI Insight"})]}),t.jsxs("button",{className:`omni-details-tab ${$==="code"?"active":""}`,onClick:()=>T("code"),disabled:!p,title:"Generate test code",role:"tab","aria-selected":$==="code",children:[t.jsx(Us,{size:12})," ",t.jsx("span",{children:"Code Gen"})]})]}),t.jsx("div",{className:"omni-details-content",children:p?t.jsxs(t.Fragment,{children:[$==="info"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Element Info"}),t.jsxs("div",{className:"omni-info-table",children:[t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Type"}),t.jsx("span",{className:"omni-info-value mono",children:p.type})]}),p.text&&t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Text"}),t.jsx("span",{className:"omni-info-value",children:p.text})]}),t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Path"}),t.jsx("span",{className:"omni-info-value mono small",children:Je(p).join(" › ")})]})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Layout"}),t.jsx("div",{className:"omni-layout-grid",children:["x","y","width","height"].map(h=>t.jsxs("div",{className:"omni-layout-item",children:[t.jsx("span",{className:"omni-layout-label",children:h.toUpperCase()}),t.jsx("span",{className:"omni-layout-value",children:p.rect[h]})]},h))})]}),t.jsxs("div",{className:"omni-section",children:[t.jsxs("div",{className:"omni-section-header",children:["Locators",t.jsx("span",{className:"omni-section-badge",children:"Stability Scored"})]}),t.jsxs("div",{className:"omni-locators-list",children:[!(($t=p.suggestedLocators)!=null&&$t.length)&&t.jsx("div",{className:"omni-locators-empty",children:p===(o==null?void 0:o.hierarchy)?"This is the XML document root, not a UI element — no Appium locator can select it. Pick a node beneath it.":"No locator could be derived for this node."}),(pt=p.suggestedLocators)==null?void 0:pt.map(h=>{const A=tn(h.strategy,h.value),_=ns[A.level],x=ne[h.strategy];let S=null;return x&&(x.kind==="unsupported"?S=t.jsxs("span",{className:"omni-match-badge unsupported",title:x.reason||"Cannot evaluate without a real driver",children:[t.jsx(Fi,{size:10})," preview unavailable"]}):x.nodes.length===0?S=t.jsxs("span",{className:"omni-match-badge zero",title:"No element matches this selector in the current snapshot",children:[t.jsx(Qe,{size:10})," 0 matches"]}):x.nodes.length===1?S=t.jsxs("span",{className:"omni-match-badge unique",title:"Selector is unique in the current snapshot",children:[t.jsx(Ot,{size:10})," unique"]}):S=t.jsxs("span",{className:"omni-match-badge multi",title:`${x.nodes.length} elements match — selector is not unique`,children:[t.jsx(et,{size:10})," ",x.nodes.length," matches"]})),t.jsxs("div",{className:`omni-locator-row ${(M==null?void 0:M.strategy)===h.strategy?"selected-for-code":""}`,onClick:()=>O(h),title:"Click to use in Code Generator",children:[t.jsxs("div",{className:"omni-locator-left",children:[t.jsxs("div",{className:"omni-locator-top",children:[t.jsx("span",{className:"omni-locator-strategy",children:h.strategy}),t.jsxs("span",{className:`omni-stability-badge ${_.cls}`,title:A.reason,children:[_.icon,A.level]}),S]}),t.jsx("code",{className:"omni-locator-value",children:h.value}),t.jsx("span",{className:"omni-stability-reason",children:A.reason}),(()=>{const E=Fe[h.strategy];return E?E.error?t.jsxs("span",{className:"omni-verify-line is-error",children:[t.jsx(Qe,{size:10})," Appium error: ",E.error]}):E.found?E.count>1?t.jsxs("span",{className:"omni-verify-line is-warn",children:[t.jsx(et,{size:10})," Ambiguous — Appium found"," ",E.count," elements",E.actionError?` · ${E.actionError}`:""]}):t.jsxs("span",{className:"omni-verify-line is-ok",children:[t.jsx(Ot,{size:10})," Appium found 1 element",E.elapsedMs!=null?` in ${E.elapsedMs}ms`:"",E.actionPerformed&&E.actionPerformed!=="none"?` · ${E.actionPerformed} ok`:"",E.actionError?` · action failed: ${E.actionError}`:""]}):t.jsxs("span",{className:"omni-verify-line is-error",children:[t.jsx(Qe,{size:10})," Appium found 0 elements"]}):null})()]}),t.jsxs("div",{className:"omni-locator-actions",children:[t.jsx("button",{type:"button",onClick:E=>{E.stopPropagation(),Ke(h.strategy,h.value)},className:`omni-test-btn ${J===h.strategy?"active":""}`,title:"Test this locator against the current snapshot",children:t.jsx(Xi,{size:12})}),t.jsx("button",{type:"button",disabled:!(ee!=null&&ee.sessionId)||me===h.strategy,onClick:E=>{E.stopPropagation(),Ue(h.strategy,h.value,"none")},className:"omni-test-btn",title:ee!=null&&ee.sessionId?"Verify with Appium — does the driver actually find this?":"Needs an active Appium session on this device",children:me===h.strategy?t.jsx(yt,{size:12,className:"animate-spin"}):t.jsx(Ot,{size:12})}),t.jsx("button",{type:"button",disabled:!(ee!=null&&ee.sessionId)||me===h.strategy,onClick:E=>{E.stopPropagation(),Ue(h.strategy,h.value,"tap")},className:"omni-test-btn",title:ee!=null&&ee.sessionId?"Find with Appium and tap the element it returns":"Needs an active Appium session on this device",children:t.jsx(xs,{size:12})}),t.jsx("button",{onClick:E=>{E.stopPropagation(),ge(h.value,h.strategy)},className:`omni-copy-btn ${w===h.strategy?"copied":""}`,children:w===h.strategy?t.jsx(Bt,{size:12}):t.jsx(qe,{size:12})})]})]},h.strategy)})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Attributes"}),t.jsx("div",{className:"omni-attributes-table",children:Object.entries(p.attributes||{}).filter(([h,A])=>A!=null&&A!=="").map(([h,A])=>t.jsxs("div",{className:"omni-attr-row",children:[t.jsx("span",{className:"omni-attr-key",children:h}),t.jsx("span",{className:"omni-attr-value",children:String(A)})]},h))})]})]}),$==="insight"&&ce&&t.jsxs("div",{className:"omni-insight-panel",children:[t.jsxs("div",{className:"omni-insight-role",children:[t.jsx("span",{className:"omni-insight-emoji",children:ce.emoji}),t.jsxs("div",{children:[t.jsx("div",{className:"omni-insight-role-name",children:ce.role}),t.jsx("div",{className:"omni-insight-interactable",children:ce.interactable?t.jsxs("span",{className:"omni-badge-green",children:[t.jsx(xs,{size:10})," Interactable"]}):t.jsx("span",{className:"omni-badge-gray",children:"Visual Only"})})]})]}),ce.warning&&t.jsx("div",{className:"omni-insight-warning",children:ce.warning}),t.jsxs("div",{className:"omni-insight-description",children:[t.jsx(ys,{size:12,className:"omni-insight-icon"}),t.jsx("p",{children:ce.description})]}),ce.bestLocator&&t.jsxs("div",{className:"omni-insight-best-locator",children:[t.jsx("div",{className:"omni-section-header",children:"Recommended Locator"}),t.jsxs("div",{className:"omni-locator-row",children:[t.jsxs("div",{className:"omni-locator-left",children:[t.jsx("span",{className:"omni-locator-strategy",children:ce.bestLocator.strategy}),t.jsx("code",{className:"omni-locator-value",children:ce.bestLocator.value})]}),t.jsx("button",{onClick:()=>ge(ce.bestLocator.value,"best"),className:`omni-copy-btn ${w==="best"?"copied":""}`,children:w==="best"?t.jsx(Bt,{size:12}):t.jsx(qe,{size:12})})]})]}),t.jsxs("div",{className:"omni-insight-attributes",children:[t.jsx("div",{className:"omni-section-header",children:"Quick Facts"}),t.jsx("div",{className:"omni-quick-facts",children:[{label:"Clickable",value:(Dt=p.attributes)==null?void 0:Dt.clickable},{label:"Enabled",value:(Tt=p.attributes)==null?void 0:Tt.enabled},{label:"Scrollable",value:(Lt=p.attributes)==null?void 0:Lt.scrollable},{label:"Focusable",value:(gt=p.attributes)==null?void 0:gt.focusable},{label:"Children",value:((Mt=p.children)==null?void 0:Mt.length)||0}].map(({label:h,value:A})=>t.jsxs("div",{className:"omni-quick-fact-row",children:[t.jsx("span",{className:"omni-quick-fact-label",children:h}),t.jsx("span",{className:`omni-quick-fact-value ${A==="true"||A===!0?"true":""}`,children:String(A??"—")})]},h))})]})]}),$==="code"&&t.jsxs("div",{className:"omni-codegen-panel",children:[t.jsx("div",{className:"omni-codegen-frameworks",children:["java","python","javascript","wdio"].map(h=>t.jsx("button",{className:`omni-fw-btn ${L===h?"active":""}`,onClick:()=>F(h),children:h==="java"?"☕ Java":h==="python"?"🐍 Python":h==="javascript"?"🟨 JS":"🔷 WD.io"},h))}),M?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"omni-codegen-locator-selector",children:[t.jsx("span",{className:"omni-codegen-label",children:"Locator:"}),t.jsx(Jt,{selectSize:"sm",value:M.strategy,onChange:h=>{var _;const A=(_=p.suggestedLocators)==null?void 0:_.find(x=>x.strategy===h.target.value);A&&O(A)},className:"flex-1",children:(It=p.suggestedLocators)==null?void 0:It.map(h=>t.jsxs("option",{value:h.strategy,children:[h.strategy," — ",tn(h.strategy,h.value).level]},h.strategy))})]}),t.jsxs("div",{className:"omni-codegen-output",children:[t.jsxs("div",{className:"omni-codegen-header",children:[t.jsx("span",{className:"omni-codegen-lang",children:L==="java"?"Java / TestNG":L==="python"?"Python / unittest":L==="javascript"?"JavaScript / Mocha":"WebdriverIO"}),t.jsx("button",{className:"omni-copy-btn",onClick:()=>ge(sn(p,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",L,M),"code"),children:w==="code"?t.jsx(Bt,{size:12}):t.jsx(qe,{size:12})})]}),t.jsx("pre",{className:"omni-codegen-pre theme-dark",children:t.jsx("code",{children:sn(p,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",L,M)})})]})]}):t.jsxs("div",{className:"omni-empty-state small",children:[t.jsx(Us,{size:24}),t.jsx("span",{children:"No locators available for this element"})]})]})]}):o!=null&&o.hierarchy?t.jsxs("div",{className:"omni-summary-panel",children:[t.jsxs("div",{className:"omni-summary-hero",children:[t.jsx(ls,{size:28}),t.jsxs("div",{children:[t.jsx("div",{className:"omni-summary-title",children:"No element selected"}),t.jsx("div",{className:"omni-summary-subtitle",children:"Click any node in the tree (or use Inspect mode on the device) to drill in."})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Snapshot Stats"}),t.jsxs("div",{className:"omni-summary-stats",children:[t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Elements"}),t.jsx("span",{className:"omni-summary-stat__value",children:ht})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Width"}),t.jsx("span",{className:"omni-summary-stat__value",children:((Rt=o.metadata)==null?void 0:Rt.screenWidth)??U.width??"—"})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Height"}),t.jsx("span",{className:"omni-summary-stat__value",children:((Et=o.metadata)==null?void 0:Et.screenHeight)??U.height??"—"})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Platform"}),t.jsx("span",{className:"omni-summary-stat__value",children:o.platform||"—"})]})]})]}),At.length>0&&t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"By Role"}),t.jsx("div",{className:"omni-summary-roles",children:At.slice(0,8).map(h=>t.jsxs("div",{className:"omni-summary-role",children:[t.jsx("span",{className:"omni-summary-role__emoji",children:h.emoji}),t.jsx("span",{className:"omni-summary-role__name",children:h.role}),t.jsx("span",{className:"omni-summary-role__count",children:h.count})]},h.role))})]})]}):t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(ls,{size:32}),t.jsx("span",{children:c?"Capturing snapshot…":"Select an element from the tree or screenshot"})]})})]})]})]})},on=5e3;function Ec(e,s=!0){const[n,i]=d.useState("unknown"),r=d.useRef("unknown");return d.useEffect(()=>{if(!e||!s){i("unknown"),r.current="unknown";return}let a=!1,c;const l=m=>{a||m===r.current||(r.current=m,i(m))},o=async()=>{if(!a){if(c&&(clearTimeout(c),c=void 0),typeof document<"u"&&document.visibilityState==="hidden"){c=setTimeout(o,on);return}try{const m=await H.getDisplayState(e);l((m==null?void 0:m.state)??"unknown")}catch{}a||(c=setTimeout(o,on))}};o();const u=()=>{document.visibilityState==="visible"&&o()};return document.addEventListener("visibilitychange",u),()=>{a=!0,c&&clearTimeout(c),document.removeEventListener("visibilitychange",u)}},[e,s]),n}const an=5e3,$c=500,Dc=1e4,Tc=10,Lc=50;function Mc(e,s,n){const i=`${((n==null?void 0:n.levels)??[]).join(",")}|${(n==null?void 0:n.process)??""}`,[r,a]=d.useState([]),[c,l]=d.useState(!1),[o,u]=d.useState(null),[m,f]=d.useState(!1),p=d.useRef(null),y=d.useRef(0),g=d.useRef(void 0),b=d.useRef(()=>{}),v=d.useRef([]),k=d.useRef(void 0),N=d.useRef(0),j=d.useRef(void 0),w=d.useCallback(()=>{if(v.current.length===0)return;const L=v.current;v.current=[],a(F=>{const M=F.concat(L);return M.length>an?M.slice(-an):M})},[]),D=d.useCallback(()=>{k.current===void 0&&(k.current=window.setTimeout(()=>{k.current=void 0,w()},Lc))},[w]),$=d.useCallback(()=>{v.current=[],a([])},[]);d.useEffect(()=>{if(!s){l(!1),u(null),f(!1);return}u(null),f(!1),y.current=0;const L={cancelled:!1},F=()=>{if(L.cancelled)return;if(y.current>=Tc){f(!0);return}const O=Math.min($c*2**y.current,Dc);y.current+=1,g.current=window.setTimeout(M,O)},M=async()=>{if(!L.cancelled)try{const O=await fetch(`/xenon/api/control/${encodeURIComponent(e)}/stream/ticket`,{method:"POST",credentials:"include"});if(L.cancelled)return;if(!O.ok){F();return}const{ticket:U}=await O.json();if(L.cancelled)return;if(!U){F();return}const G=window.location.protocol==="https:"?"wss":"ws",[q,Z]=i.split("|"),V=(q?`&levels=${encodeURIComponent(q)}`:"")+(Z?`&process=${encodeURIComponent(Z)}`:""),B=new WebSocket(`${G}://${window.location.host}/xenon/api/control/${encodeURIComponent(e)}/logcat?ticket=${encodeURIComponent(U)}${V}`);p.current=B,B.onopen=()=>{y.current=0,j.current!==1012&&(v.current=[],a([])),j.current=void 0,l(!0)},B.onmessage=R=>{try{const C=JSON.parse(R.data);v.current.push({...C,seq:N.current++}),D()}catch{}},B.onclose=R=>{if(l(!1),j.current=R.code,w(),R.code===1008){L.cancelled=!0,u(R.reason||"access denied");return}if(R.code===1012){F();return}console.warn(`[logcat] WS closed unexpectedly (code ${R.code}) — retrying`),F()},B.onerror=()=>B.close()}catch{F()}};return b.current=()=>{L.cancelled=!1,y.current=0,u(null),f(!1),M()},M(),()=>{var O;L.cancelled=!0,g.current!==void 0&&window.clearTimeout(g.current),k.current!==void 0&&(window.clearTimeout(k.current),k.current=void 0),w(),(O=p.current)==null||O.close(),p.current=null}},[e,s,i,w,D]);const T=d.useCallback(()=>{b.current()},[]);return{records:r,connected:c,clear:$,deniedReason:o,exhausted:m,retry:T}}const Cs=["V","D","I","W","E","F"];function Ic(e){const s=[];let n="",i=!1,r=!1;for(const a of e){if(a==='"'){i=!i,r=!0;continue}if(!i&&/\s/.test(a)){(r||n)&&s.push(n),n="",r=!1;continue}n+=a,r=!0}return(r||n)&&s.push(n),s.filter(a=>a.length>0)}function Zn(e,s={}){const n=s.caseSensitive===!0,i=c=>n?c:c.toLowerCase(),r=n?{caseSensitive:!0}:{},a=[];for(const c of Ic(e)){const[l,...o]=c.split(":"),u=o.join(":");u&&l.toLowerCase()==="level"?r.minLevel=u.toUpperCase():u&&l.toLowerCase()==="tag"?r.tag=i(u):u&&l.toLowerCase()==="package"?r.pkg=i(u):a.push(c)}return a.length&&(r.text=i(a.join(" "))),r}function _c(e,s){if(e.synthetic)return!0;if(s.minLevel){const i=Cs.indexOf(s.minLevel),r=Cs.indexOf(e.level);if(i>=0&&r>=0&&r<i)return!1}const n=i=>s.caseSensitive?i:i.toLowerCase();return!(s.tag&&!n(e.tag).includes(s.tag)||s.pkg&&!n(e.pkg??"").includes(s.pkg)||s.text&&!n(e.message).includes(s.text))}function Oc(e,s){const n=e.trim().split(/\s+/).filter(Boolean).filter(i=>{const[r,...a]=i.split(":");return!(a.join(":")&&r.toLowerCase()==="level")});return s?["level:"+s.toUpperCase(),...n].join(" "):n.join(" ")}const gs=[{ios:"Debug",android:"D"},{ios:"Info",android:"I"},{ios:"Default",android:"I"},{ios:"Error",android:"E"},{ios:"Fault",android:"F"}],cn=["V","D","I","W","E","F"];function Pc(e){if(!e)return gs.filter(n=>n.ios!=="Debug").map(n=>n.ios);const s=cn.indexOf(e.toUpperCase());return s<0?gs.map(n=>n.ios):gs.filter(n=>cn.indexOf(n.android)>=s).map(n=>n.ios)}function zc(e){const s=Zn(e,{caseSensitive:!0});return{levels:Pc(s.minLevel),process:s.pkg||void 0}}const ln=["#7dd3fc","#c4b5fd","#5eead4","#f0abfc","#93c5fd","#a5b4fc","#67e8f9","#d8b4fe","#f9a8d4","#99f6e4","#bae6fd","#e9d5ff"];function Fc(e){let s=2166136261;for(let n=0;n<e.length;n++)s^=e.charCodeAt(n),s=Math.imul(s,16777619)>>>0;return s>>>0}function Uc(e){return e?ln[Fc(e)%ln.length]:"var(--text-muted)"}const Ss=5e5;function Jn(e){return`${new Date(e.ts).toISOString()} ${e.pid} ${e.level}/${e.tag}: ${e.message}`}function Bc(e){return{lines:[],startedAt:e,dropped:0}}function Hc(e,s){for(const n of s){if(e.lines.length>=Ss){e.dropped+=1;continue}e.lines.push(Jn(n))}return e}function Wc(e,s,n){const i=["# Xenon logcat recording",`# device: ${n}`,`# started: ${new Date(e.startedAt).toISOString()}`,`# stopped: ${new Date(s).toISOString()}`,`# duration: ${((s-e.startedAt)/1e3).toFixed(1)}s`,`# lines: ${e.lines.length}`];e.dropped>0&&i.push(`# TRUNCATED: ${e.dropped} further line(s) were dropped after the ${Ss}-line cap. This capture is INCOMPLETE.`);const r=e.lines.join(`
|
|
237
|
+
// Assert with expect(element).toBeDisplayed()`:`// Strategy "${r}" not supported in WebdriverIO mobile`}function nn(e){var y,g,b,v,k,N,j,w,D,$,T;const s=(e.type||"").toLowerCase(),n=((y=e.attributes)==null?void 0:y.clickable)==="true"||((g=e.attributes)==null?void 0:g.clickable)===!0,i=((b=e.attributes)==null?void 0:b.enabled)!=="false"&&((v=e.attributes)==null?void 0:v.enabled)!==!1,r=((k=e.attributes)==null?void 0:k.scrollable)==="true"||((N=e.attributes)==null?void 0:N.scrollable)===!0,a=e.text||e.label||e.value||"",c=((j=e.children)==null?void 0:j.length)||0;let l="Element",o="📦";s.includes("button")||s.includes("btn")||n&&c===0?(l="Button",o="🔘"):s.includes("edit")||s.includes("input")||s.includes("field")?(l="Text Input",o="✏️"):s.includes("image")||s.includes("img")||s.includes("imageview")?(l="Image",o="🖼️"):s.includes("scroll")||s.includes("recyclerview")||s.includes("listview")||r?(l="Scrollable List",o="📜"):s.includes("text")||s.includes("label")?(l="Text Label",o="📝"):s.includes("switch")||s.includes("toggle")||s.includes("checkbox")?(l="Toggle / Checkbox",o="☑️"):s.includes("nav")||s.includes("toolbar")||s.includes("tabbar")?(l="Navigation Bar",o="🧭"):c>0&&(l=`Container (${c} children)`,o="🗂️");const u=((w=e.suggestedLocators)==null?void 0:w.find(L=>L.strategy==="accessibility id"||L.strategy==="id"))||((D=e.suggestedLocators)==null?void 0:D[0]),m=i?(($=e.rect)==null?void 0:$.width)===0||((T=e.rect)==null?void 0:T.height)===0?"⚠️ Zero-size element — may not be interactable":void 0:"⚠️ Element is disabled",f=a?` with text "${a.slice(0,30)}"`:"",p=`This is a ${l.toLowerCase()}${f}. ${n?"It can be tapped/clicked.":r?"It supports scrolling.":"It is a visual container."}${c>0?` Contains ${c} child element${c>1?"s":""}.`:""}`;return{role:l,description:p,interactable:n||i,bestLocator:u,warning:m,emoji:o}}function rn(e,s){if(!s)return!0;const n=s.toLowerCase().trim(),i={button:["button","btn","clickable","tapable"],input:["edittext","input","field","textfield","textinput","edit"],image:["image","imageview","img","picture","photo","icon"],text:["textview","label","text","statictext"],list:["listview","recyclerview","scrollview","tableview","collectionview","scroll"],toggle:["switch","checkbox","toggle","radiobutton"],nav:["toolbar","navigationbar","tabbar","actionbar","navbar"]},r=(e.type||"").toLowerCase(),a=(e.text||e.label||e.value||"").toLowerCase(),c=(e.name||"").toLowerCase(),l=Object.values(e.attributes||{}).join(" ").toLowerCase();for(const[o,u]of Object.entries(i))if(n.includes(o)&&u.some(m=>r.includes(m)))return!0;return r.includes(n)||a.includes(n)||c.includes(n)||l.includes(n)}const Cc=({sessionId:e,udid:s,streamUrl:n,embedded:i=!1,overlayTarget:r=null,onModeChange:a})=>{var Rt,Et,$t,pt,Dt,Tt,Lt,gt,Mt,It;const[c,l]=d.useState(!0),[o,u]=d.useState(null),[m,f]=d.useState(null),[p,y]=d.useState(null),[g,b]=d.useState(null),[v,k]=d.useState(new Set(["/"])),[N,j]=d.useState(""),[w,D]=d.useState(null),[$,T]=d.useState("info"),[L,F]=d.useState("java"),[M,O]=d.useState(null),[U,G]=d.useState({width:0,height:0}),[q,Z]=d.useState({width:0,height:0}),[H,B]=d.useState(!1),[R,C]=d.useState("inspect");d.useEffect(()=>{a==null||a(R)},[R,a]);const[ne,ae]=d.useState({}),[Fe,ue]=d.useState({}),[me,ke]=d.useState(null),[ee,P]=d.useState(null),[J,se]=d.useState(null),re=d.useRef(null),he=d.useRef(null),Me=d.useRef(null),fe=d.useRef(null),ve=d.useCallback(()=>{var Q,K,Y;if(!re.current)return;const h=re.current.getBoundingClientRect(),A=h.width,_=h.height,x=(Q=o==null?void 0:o.hierarchy)==null?void 0:Q.rect;let S=((K=o==null?void 0:o.metadata)==null?void 0:K.screenWidth)||U.width||1,E=((Y=o==null?void 0:o.metadata)==null?void 0:Y.screenHeight)||U.height||1;x&&x.width>0&&x.height>0&&(S=x.width,E=x.height);const I=S/E;let X,z;A/_>I?(z=_,X=z*I):(X=A,z=X/I),Z({width:X,height:z})},[o,U]);d.useEffect(()=>(ve(),window.addEventListener("resize",ve),()=>window.removeEventListener("resize",ve)),[ve]),d.useEffect(()=>{s&&Ae()},[s]),d.useEffect(()=>{if(!s)return;let h=!1;return W.getAppiumSession(s).then(A=>{h||P({sessionId:(A==null?void 0:A.sessionId)??null,basePath:(A==null?void 0:A.basePath)??""})}).catch(()=>{h||P({sessionId:null,basePath:""})}),()=>{h=!0}},[s]);const Ue=d.useCallback(async(h,A,_)=>{if(ee!=null&&ee.sessionId){ke(h);try{const x=await W.verifyLocator(ee.basePath,ee.sessionId,{strategy:h,selector:A,action:_});ue(S=>({...S,[h]:x}))}catch(x){ue(S=>({...S,[h]:{found:!1,count:0,error:(x==null?void 0:x.message)||String(x)}}))}finally{ke(null)}}},[ee]);d.useEffect(()=>{var h;if((h=p==null?void 0:p.suggestedLocators)!=null&&h.length){const A=p.suggestedLocators.find(_=>_.strategy==="accessibility id"||_.strategy==="id")||p.suggestedLocators[0];O(A)}else O(null);ae({}),ue({}),se(null)},[p]);const Ke=d.useCallback((h,A)=>{if(!(o!=null&&o.hierarchy))return;const _=Nc(o.hierarchy,h,A);ae(x=>({...x,[h]:_})),se(h)},[o]),Ae=async()=>{if(s){l(!0),f(null);try{const h=await W.getInspectorSnapshot(s);if(!(h!=null&&h.hierarchy)){u(null),f((h==null?void 0:h.error)||"Failed to capture snapshot");return}u(h);const A=new Set(["/"]),_=(x,S)=>{var E;S<3&&(A.add(x.xpath),(E=x.children)==null||E.forEach(I=>_(I,S+1)))};_(h.hierarchy,0),k(A)}catch(h){u(null),f(h.message||"Failed to capture snapshot")}finally{l(!1)}}},ct=h=>{const{naturalWidth:A,naturalHeight:_}=h.currentTarget;G({width:A,height:_})},Ie=()=>B(!0),Ge=h=>{B(!1);const{naturalWidth:A,naturalHeight:_}=h.currentTarget;A>0&&_>0&&G({width:A,height:_})},oe=n&&!H,Ye=h=>{if(R!=="interact"||!s)return;const A=h.currentTarget.getBoundingClientRect();fe.current={x:h.clientX-A.left,y:h.clientY-A.top,time:Date.now()}},lt=async h=>{var pe,_e,He;if(R!=="interact"||!s||!fe.current)return;const A=fe.current,_=h.currentTarget.getBoundingClientRect(),x=h.clientX-_.left,S=h.clientY-_.top,E=Date.now()-A.time,I=q.width,X=q.height,z=(pe=o==null?void 0:o.hierarchy)==null?void 0:pe.rect;let Q=((_e=o==null?void 0:o.metadata)==null?void 0:_e.screenWidth)||U.width,K=((He=o==null?void 0:o.metadata)==null?void 0:He.screenHeight)||U.height;if(z&&z.width>0&&z.height>0&&(Q=z.width,K=z.height),!Q||!K||I===0||X===0)return;const Y=(_t,_s)=>({x:Math.round(_t/I*Q),y:Math.round(_s/X*K),px:_t/I,py:_s/X}),te=Y(A.x,A.y),we=Y(x,S),Re=Math.sqrt(Math.pow(x-A.x,2)+Math.pow(S-A.y,2));if(!(te.px<0||te.px>1||te.py<0||te.py>1)){try{E<500&&Re<10?await W.tap(s,te.x,te.y):E>=500&&Re<10?await W.touchAndHold(s,te.x,te.y,E):Re>=10&&await W.swipe(s,te.x,te.y,we.x,we.y)}catch(_t){console.error("Interaction failed:",_t)}fe.current=null}},Ze=h=>{const A=new Set(v);A.has(h)?A.delete(h):A.add(h),k(A)},Ct=()=>{const h=new Set,A=_=>{var x;h.add(_.xpath),(x=_.children)==null||x.forEach(A)};o!=null&&o.hierarchy&&A(o.hierarchy),k(h)},St=()=>k(new Set(["/"])),ge=(h,A)=>{navigator.clipboard.writeText(h),D(A),setTimeout(()=>D(null),2e3)},be=h=>{var _;let A=1;return(_=h.children)==null||_.forEach(x=>A+=be(x)),A},dt=h=>{if(!h)return[];const A={},_=x=>{var I;const S=nn(x),E=S.role.replace(/\s*\(.*?\)\s*/,"");A[E]||(A[E]={emoji:S.emoji,count:0}),A[E].count+=1,(I=x.children)==null||I.forEach(_)};return _(h),Object.entries(A).map(([x,S])=>({role:x,emoji:S.emoji,count:S.count})).sort((x,S)=>S.count-x.count)},Je=h=>h.xpath.split("/").filter(Boolean).slice(-3),ut=(h,A=0)=>{var Y,te,we,Re;if(!h)return null;const _=v.has(h.xpath),x=((Y=h.children)==null?void 0:Y.length)>0,S=(p==null?void 0:p.xpath)===h.xpath,E=(g==null?void 0:g.xpath)===h.xpath,I=((te=h.type)==null?void 0:te.split(".").pop())||"Element",X=h.label||((we=h.attributes)==null?void 0:we["content-desc"])||((Re=h.attributes)==null?void 0:Re["resource-id"])||h.name,z=typeof X=="string"&&X&&X!==I&&X!==h.type?X:null,Q=z||I,K=!N||rn(h,N);if(!K&&!x)return null;if(N&&!K){const pe=_e=>{var He;return rn(_e,N)?!0:((He=_e.children)==null?void 0:He.some(pe))||!1};if(!pe(h))return null}return t.jsxs("div",{className:"tree-node",children:[t.jsxs("div",{className:`tree-item ${S?"selected":""} ${E&&!S?"hovered":""}`,onClick:()=>{y(h),T("info")},onMouseEnter:()=>b(h),onMouseLeave:()=>b(null),children:[t.jsx("div",{className:"tree-item-indent",style:{width:`${A*14}px`}}),x?t.jsx("button",{onClick:pe=>{pe.stopPropagation(),Ze(h.xpath)},className:"tree-toggle",children:_?t.jsx(fn,{size:11}):t.jsx(wn,{size:11})}):t.jsx("span",{className:"tree-toggle-spacer"}),t.jsx(Li,{size:11,className:"tree-icon"}),t.jsx("span",{className:"tree-label",title:`${I}${z?` — ${z}`:""}`,children:Q}),z&&t.jsx("span",{className:"tree-type-tag",title:I,children:I}),h.text&&t.jsxs("span",{className:"tree-text-preview",children:['"',h.text.slice(0,20),'"']}),x&&t.jsx("span",{className:"tree-badge",children:h.children.length})]}),_&&x&&t.jsx("div",{className:"tree-children",children:h.children.map(pe=>ut(pe,A+1))})]},h.xpath)},kt=()=>{var x,S,E;const h=(x=o==null?void 0:o.hierarchy)==null?void 0:x.rect;if(h&&h.width>0&&h.height>0)return{w:h.width,h:h.height};const A=((S=o==null?void 0:o.metadata)==null?void 0:S.screenWidth)||U.width,_=((E=o==null?void 0:o.metadata)==null?void 0:E.screenHeight)||U.height;return A>0&&_>0?{w:A,h:_}:null},mt=h=>{const A=kt();if(!A)return[];const _=[],{w:x,h:S}=A,E=(I,X)=>{var Q,K,Y;const z=!I.children||I.children.length===0;((Q=I.rect)==null?void 0:Q.width)>0&&((K=I.rect)==null?void 0:K.height)>0&&z&&_.push(t.jsx("div",{className:"omni-hit-area",style:{left:`${I.rect.x/x*100}%`,top:`${I.rect.y/S*100}%`,width:`${I.rect.width/x*100}%`,height:`${I.rect.height/S*100}%`,zIndex:X},onClick:te=>{te.stopPropagation(),y(I),T("info")},onMouseEnter:()=>b(I),onMouseLeave:()=>b(null)},I.xpath)),(Y=I.children)==null||Y.forEach(te=>E(te,X+1))};return o!=null&&o.hierarchy&&E(o.hierarchy,1),_},Be=()=>{var E,I,X;if(!J||!U.width)return[];const h=ne[J];if(!h||h.kind!=="matched"||h.nodes.length===0)return[];const A=(E=o==null?void 0:o.hierarchy)==null?void 0:E.rect;let _=((I=o==null?void 0:o.metadata)==null?void 0:I.screenWidth)||U.width,x=((X=o==null?void 0:o.metadata)==null?void 0:X.screenHeight)||U.height;A&&A.width>0&&A.height>0&&(_=A.width,x=A.height);const S=h.nodes.length===1?"omni-frame-match unique":"omni-frame-match multi";return h.nodes.filter(z=>z.rect&&z.rect.width>0&&z.rect.height>0).map((z,Q)=>t.jsx("div",{className:S,style:{left:`${z.rect.x/_*100}%`,top:`${z.rect.y/x*100}%`,width:`${z.rect.width/_*100}%`,height:`${z.rect.height/x*100}%`}},`match-${J}-${Q}`))},We=(h,A)=>{const _=kt();if(!(h!=null&&h.rect)||!_)return null;const{w:x,h:S}=_;return t.jsx("div",{className:`omni-frame-${A}`,style:{left:`${h.rect.x/x*100}%`,top:`${h.rect.y/S*100}%`,width:`${h.rect.width/x*100}%`,height:`${h.rect.height/S*100}%`}})},ht=o!=null&&o.hierarchy?be(o.hierarchy):0,ce=p?nn(p):null,ft=o!=null&&o.hierarchy&&R==="inspect"?t.jsxs("div",{className:"omni-overlay",children:[mt(o.hierarchy),Be(),We(g,"hover"),We(p,"select")]}):null,ns={stable:{icon:t.jsx(Ot,{size:10}),cls:"stable"},moderate:{icon:t.jsx(et,{size:10}),cls:"moderate"},fragile:{icon:t.jsx(Qe,{size:10}),cls:"fragile"},"very-fragile":{icon:t.jsx(Qe,{size:10}),cls:"very-fragile"}},At=i&&(o!=null&&o.hierarchy)?dt(o.hierarchy):[];return t.jsxs("div",{className:`omni-inspector-container ${i?"omni-embedded":""}`,children:[i&&r&&ft?mn.createPortal(ft,r):null,t.jsxs("div",{className:"omni-main-content",children:[!i&&t.jsxs("div",{className:"omni-screenshot-panel",children:[t.jsxs("div",{className:"omni-screenshot-header",children:[t.jsxs("div",{className:"omni-header-left",children:[t.jsx("span",{className:"omni-screenshot-title",children:"Device Preview"}),t.jsxs("div",{className:"omni-mode-toggle",children:[t.jsxs("button",{className:`omni-mode-btn ${R==="inspect"?"active":""}`,onClick:()=>C("inspect"),title:"Inspection mode (highlight elements)",children:[t.jsx(Fs,{size:12}),t.jsx("span",{children:"Inspect"})]}),t.jsxs("button",{className:`omni-mode-btn ${R==="interact"?"active":""}`,onClick:()=>C("interact"),title:"Interaction mode (direct control)",children:[t.jsx(Bs,{size:12}),t.jsx("span",{children:"Interact"})]})]})]}),t.jsxs("button",{className:"omni-refresh-btn",onClick:Ae,disabled:c,children:[t.jsx(yt,{size:12,className:c?"animate-spin":""}),c?"Capturing...":"Refresh"]})]}),t.jsxs("div",{className:"omni-screenshot-container",ref:re,children:[c&&!oe&&t.jsxs("div",{className:"omni-loading-overlay",children:[t.jsx("div",{className:"omni-spinner"}),t.jsx("span",{children:"Capturing screen..."})]}),!o&&!c&&!oe&&t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(ls,{size:40}),t.jsx("span",{children:"Click Refresh to capture"})]}),oe&&t.jsxs("div",{className:`omni-screenshot-wrapper ${R==="interact"?"interactable":""}`,onMouseDown:Ye,onMouseUp:lt,children:[t.jsx("img",{ref:Me,src:n,onLoad:Ge,onError:Ie,className:"omni-screenshot-img",style:R==="interact"?{pointerEvents:"none"}:{},draggable:!1,alt:"Live Device Stream"}),ft]}),!oe&&(o==null?void 0:o.screenshot)&&t.jsxs("div",{className:`omni-screenshot-wrapper ${R==="interact"?"interactable":""}`,onMouseDown:Ye,onMouseUp:lt,children:[t.jsx("img",{ref:he,src:`data:image/png;base64,${o.screenshot}`,onLoad:ct,className:"omni-screenshot-img",style:R==="interact"?{pointerEvents:"none"}:{},draggable:!1}),R==="inspect"&&t.jsxs("div",{className:"omni-overlay",children:[mt(o.hierarchy),Be(),We(g,"hover"),We(p,"select")]})]})]})]}),t.jsxs("div",{className:"omni-tree-panel",children:[t.jsxs("div",{className:"omni-tree-header",children:[t.jsxs("div",{className:"omni-tree-title",children:[t.jsx(gi,{size:14}),t.jsx("span",{children:"Source"}),ht>0&&t.jsxs("span",{className:"omni-count-badge",children:[ht," elements"]}),(o==null?void 0:o.hierarchySource)&&t.jsx("span",{className:`omni-source-badge ${o.hierarchySource==="appium-session"?"is-session":"is-device"}`,title:o.hierarchySource==="appium-session"?`From Appium session ${o.sessionId} — the same tree the driver resolves locators against`:"Read from the device. No Appium session is driving it.",children:o.hierarchySource==="appium-session"?"Session":"Device"})]}),t.jsxs("div",{className:"omni-tree-actions",children:[t.jsx("button",{onClick:Ct,className:"omni-action-btn",title:"Expand all",children:t.jsx(Yi,{size:12})}),t.jsx("button",{onClick:St,className:"omni-action-btn",title:"Collapse all",children:t.jsx(mr,{size:12})}),i&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>C(R==="inspect"?"interact":"inspect"),className:`omni-action-btn ${R==="inspect"?"active":""}`,title:R==="inspect"?"Inspect mode — click the device to select an element":"Interact mode — clicks control the device","aria-pressed":R==="inspect",children:R==="inspect"?t.jsx(Fs,{size:12}):t.jsx(Bs,{size:12})}),t.jsx("button",{onClick:Ae,className:"omni-action-btn",title:c?"Capturing…":"Refresh snapshot",disabled:c,children:t.jsx(yt,{size:12,className:c?"animate-spin":""})})]})]})]}),m&&!c&&t.jsxs("div",{className:"omni-tree-error",role:"alert",children:[t.jsx(Qe,{size:12}),t.jsx("span",{children:m}),t.jsx("button",{type:"button",onClick:Ae,className:"omni-tree-error-retry",children:"Retry"})]}),t.jsxs("div",{className:"omni-tree-search",children:[t.jsx(ni,{size:14}),t.jsx("input",{type:"text",placeholder:"Search elements... (try 'login button' or 'text field')",value:N,onChange:h=>j(h.target.value),"aria-label":"Search elements"}),N&&t.jsx("button",{onClick:()=>j(""),className:"omni-clear-btn",children:"×"})]}),N&&t.jsxs("div",{className:"omni-search-hint",children:[t.jsx(ys,{size:10}),' Smart search active — try "button", "input", "image"']}),t.jsx("div",{className:"omni-tree-content",children:o!=null&&o.hierarchy?ut(o.hierarchy):t.jsx("div",{className:"omni-empty-state small",children:t.jsx("span",{children:"No hierarchy loaded"})})})]}),t.jsxs("div",{className:"omni-details-panel",children:[t.jsxs("div",{className:"omni-details-tabs",role:"tablist",children:[t.jsxs("button",{className:`omni-details-tab ${$==="info"?"active":""}`,onClick:()=>T("info"),role:"tab","aria-selected":$==="info",children:[t.jsx(sr,{size:12})," ",t.jsx("span",{children:"Info"})]}),t.jsxs("button",{className:`omni-details-tab ${$==="insight"?"active":""}`,onClick:()=>T("insight"),disabled:!p,title:"AI element analysis",role:"tab","aria-selected":$==="insight",children:[t.jsx(Ji,{size:12})," ",t.jsx("span",{children:"AI Insight"})]}),t.jsxs("button",{className:`omni-details-tab ${$==="code"?"active":""}`,onClick:()=>T("code"),disabled:!p,title:"Generate test code",role:"tab","aria-selected":$==="code",children:[t.jsx(Us,{size:12})," ",t.jsx("span",{children:"Code Gen"})]})]}),t.jsx("div",{className:"omni-details-content",children:p?t.jsxs(t.Fragment,{children:[$==="info"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Element Info"}),t.jsxs("div",{className:"omni-info-table",children:[t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Type"}),t.jsx("span",{className:"omni-info-value mono",children:p.type})]}),p.text&&t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Text"}),t.jsx("span",{className:"omni-info-value",children:p.text})]}),t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Path"}),t.jsx("span",{className:"omni-info-value mono small",children:Je(p).join(" › ")})]})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Layout"}),t.jsx("div",{className:"omni-layout-grid",children:["x","y","width","height"].map(h=>t.jsxs("div",{className:"omni-layout-item",children:[t.jsx("span",{className:"omni-layout-label",children:h.toUpperCase()}),t.jsx("span",{className:"omni-layout-value",children:p.rect[h]})]},h))})]}),t.jsxs("div",{className:"omni-section",children:[t.jsxs("div",{className:"omni-section-header",children:["Locators",t.jsx("span",{className:"omni-section-badge",children:"Stability Scored"})]}),t.jsxs("div",{className:"omni-locators-list",children:[!(($t=p.suggestedLocators)!=null&&$t.length)&&t.jsx("div",{className:"omni-locators-empty",children:p===(o==null?void 0:o.hierarchy)?"This is the XML document root, not a UI element — no Appium locator can select it. Pick a node beneath it.":"No locator could be derived for this node."}),(pt=p.suggestedLocators)==null?void 0:pt.map(h=>{const A=tn(h.strategy,h.value),_=ns[A.level],x=ne[h.strategy];let S=null;return x&&(x.kind==="unsupported"?S=t.jsxs("span",{className:"omni-match-badge unsupported",title:x.reason||"Cannot evaluate without a real driver",children:[t.jsx(Ui,{size:10})," preview unavailable"]}):x.nodes.length===0?S=t.jsxs("span",{className:"omni-match-badge zero",title:"No element matches this selector in the current snapshot",children:[t.jsx(Qe,{size:10})," 0 matches"]}):x.nodes.length===1?S=t.jsxs("span",{className:"omni-match-badge unique",title:"Selector is unique in the current snapshot",children:[t.jsx(Ot,{size:10})," unique"]}):S=t.jsxs("span",{className:"omni-match-badge multi",title:`${x.nodes.length} elements match — selector is not unique`,children:[t.jsx(et,{size:10})," ",x.nodes.length," matches"]})),t.jsxs("div",{className:`omni-locator-row ${(M==null?void 0:M.strategy)===h.strategy?"selected-for-code":""}`,onClick:()=>O(h),title:"Click to use in Code Generator",children:[t.jsxs("div",{className:"omni-locator-left",children:[t.jsxs("div",{className:"omni-locator-top",children:[t.jsx("span",{className:"omni-locator-strategy",children:h.strategy}),t.jsxs("span",{className:`omni-stability-badge ${_.cls}`,title:A.reason,children:[_.icon,A.level]}),S]}),t.jsx("code",{className:"omni-locator-value",children:h.value}),t.jsx("span",{className:"omni-stability-reason",children:A.reason}),(()=>{const E=Fe[h.strategy];return E?E.error?t.jsxs("span",{className:"omni-verify-line is-error",children:[t.jsx(Qe,{size:10})," Appium error: ",E.error]}):E.found?E.count>1?t.jsxs("span",{className:"omni-verify-line is-warn",children:[t.jsx(et,{size:10})," Ambiguous — Appium found"," ",E.count," elements",E.actionError?` · ${E.actionError}`:""]}):t.jsxs("span",{className:"omni-verify-line is-ok",children:[t.jsx(Ot,{size:10})," Appium found 1 element",E.elapsedMs!=null?` in ${E.elapsedMs}ms`:"",E.actionPerformed&&E.actionPerformed!=="none"?` · ${E.actionPerformed} ok`:"",E.actionError?` · action failed: ${E.actionError}`:""]}):t.jsxs("span",{className:"omni-verify-line is-error",children:[t.jsx(Qe,{size:10})," Appium found 0 elements"]}):null})()]}),t.jsxs("div",{className:"omni-locator-actions",children:[t.jsx("button",{type:"button",onClick:E=>{E.stopPropagation(),Ke(h.strategy,h.value)},className:`omni-test-btn ${J===h.strategy?"active":""}`,title:"Test this locator against the current snapshot",children:t.jsx(qi,{size:12})}),t.jsx("button",{type:"button",disabled:!(ee!=null&&ee.sessionId)||me===h.strategy,onClick:E=>{E.stopPropagation(),Ue(h.strategy,h.value,"none")},className:"omni-test-btn",title:ee!=null&&ee.sessionId?"Verify with Appium — does the driver actually find this?":"Needs an active Appium session on this device",children:me===h.strategy?t.jsx(yt,{size:12,className:"animate-spin"}):t.jsx(Ot,{size:12})}),t.jsx("button",{type:"button",disabled:!(ee!=null&&ee.sessionId)||me===h.strategy,onClick:E=>{E.stopPropagation(),Ue(h.strategy,h.value,"tap")},className:"omni-test-btn",title:ee!=null&&ee.sessionId?"Find with Appium and tap the element it returns":"Needs an active Appium session on this device",children:t.jsx(xs,{size:12})}),t.jsx("button",{onClick:E=>{E.stopPropagation(),ge(h.value,h.strategy)},className:`omni-copy-btn ${w===h.strategy?"copied":""}`,children:w===h.strategy?t.jsx(Bt,{size:12}):t.jsx(qe,{size:12})})]})]},h.strategy)})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Attributes"}),t.jsx("div",{className:"omni-attributes-table",children:Object.entries(p.attributes||{}).filter(([h,A])=>A!=null&&A!=="").map(([h,A])=>t.jsxs("div",{className:"omni-attr-row",children:[t.jsx("span",{className:"omni-attr-key",children:h}),t.jsx("span",{className:"omni-attr-value",children:String(A)})]},h))})]})]}),$==="insight"&&ce&&t.jsxs("div",{className:"omni-insight-panel",children:[t.jsxs("div",{className:"omni-insight-role",children:[t.jsx("span",{className:"omni-insight-emoji",children:ce.emoji}),t.jsxs("div",{children:[t.jsx("div",{className:"omni-insight-role-name",children:ce.role}),t.jsx("div",{className:"omni-insight-interactable",children:ce.interactable?t.jsxs("span",{className:"omni-badge-green",children:[t.jsx(xs,{size:10})," Interactable"]}):t.jsx("span",{className:"omni-badge-gray",children:"Visual Only"})})]})]}),ce.warning&&t.jsx("div",{className:"omni-insight-warning",children:ce.warning}),t.jsxs("div",{className:"omni-insight-description",children:[t.jsx(ys,{size:12,className:"omni-insight-icon"}),t.jsx("p",{children:ce.description})]}),ce.bestLocator&&t.jsxs("div",{className:"omni-insight-best-locator",children:[t.jsx("div",{className:"omni-section-header",children:"Recommended Locator"}),t.jsxs("div",{className:"omni-locator-row",children:[t.jsxs("div",{className:"omni-locator-left",children:[t.jsx("span",{className:"omni-locator-strategy",children:ce.bestLocator.strategy}),t.jsx("code",{className:"omni-locator-value",children:ce.bestLocator.value})]}),t.jsx("button",{onClick:()=>ge(ce.bestLocator.value,"best"),className:`omni-copy-btn ${w==="best"?"copied":""}`,children:w==="best"?t.jsx(Bt,{size:12}):t.jsx(qe,{size:12})})]})]}),t.jsxs("div",{className:"omni-insight-attributes",children:[t.jsx("div",{className:"omni-section-header",children:"Quick Facts"}),t.jsx("div",{className:"omni-quick-facts",children:[{label:"Clickable",value:(Dt=p.attributes)==null?void 0:Dt.clickable},{label:"Enabled",value:(Tt=p.attributes)==null?void 0:Tt.enabled},{label:"Scrollable",value:(Lt=p.attributes)==null?void 0:Lt.scrollable},{label:"Focusable",value:(gt=p.attributes)==null?void 0:gt.focusable},{label:"Children",value:((Mt=p.children)==null?void 0:Mt.length)||0}].map(({label:h,value:A})=>t.jsxs("div",{className:"omni-quick-fact-row",children:[t.jsx("span",{className:"omni-quick-fact-label",children:h}),t.jsx("span",{className:`omni-quick-fact-value ${A==="true"||A===!0?"true":""}`,children:String(A??"—")})]},h))})]})]}),$==="code"&&t.jsxs("div",{className:"omni-codegen-panel",children:[t.jsx("div",{className:"omni-codegen-frameworks",children:["java","python","javascript","wdio"].map(h=>t.jsx("button",{className:`omni-fw-btn ${L===h?"active":""}`,onClick:()=>F(h),children:h==="java"?"☕ Java":h==="python"?"🐍 Python":h==="javascript"?"🟨 JS":"🔷 WD.io"},h))}),M?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"omni-codegen-locator-selector",children:[t.jsx("span",{className:"omni-codegen-label",children:"Locator:"}),t.jsx(Jt,{selectSize:"sm",value:M.strategy,onChange:h=>{var _;const A=(_=p.suggestedLocators)==null?void 0:_.find(x=>x.strategy===h.target.value);A&&O(A)},className:"flex-1",children:(It=p.suggestedLocators)==null?void 0:It.map(h=>t.jsxs("option",{value:h.strategy,children:[h.strategy," — ",tn(h.strategy,h.value).level]},h.strategy))})]}),t.jsxs("div",{className:"omni-codegen-output",children:[t.jsxs("div",{className:"omni-codegen-header",children:[t.jsx("span",{className:"omni-codegen-lang",children:L==="java"?"Java / TestNG":L==="python"?"Python / unittest":L==="javascript"?"JavaScript / Mocha":"WebdriverIO"}),t.jsx("button",{className:"omni-copy-btn",onClick:()=>ge(sn(p,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",L,M),"code"),children:w==="code"?t.jsx(Bt,{size:12}):t.jsx(qe,{size:12})})]}),t.jsx("pre",{className:"omni-codegen-pre theme-dark",children:t.jsx("code",{children:sn(p,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",L,M)})})]})]}):t.jsxs("div",{className:"omni-empty-state small",children:[t.jsx(Us,{size:24}),t.jsx("span",{children:"No locators available for this element"})]})]})]}):o!=null&&o.hierarchy?t.jsxs("div",{className:"omni-summary-panel",children:[t.jsxs("div",{className:"omni-summary-hero",children:[t.jsx(ls,{size:28}),t.jsxs("div",{children:[t.jsx("div",{className:"omni-summary-title",children:"No element selected"}),t.jsx("div",{className:"omni-summary-subtitle",children:"Click any node in the tree (or use Inspect mode on the device) to drill in."})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Snapshot Stats"}),t.jsxs("div",{className:"omni-summary-stats",children:[t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Elements"}),t.jsx("span",{className:"omni-summary-stat__value",children:ht})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Width"}),t.jsx("span",{className:"omni-summary-stat__value",children:((Rt=o.metadata)==null?void 0:Rt.screenWidth)??U.width??"—"})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Height"}),t.jsx("span",{className:"omni-summary-stat__value",children:((Et=o.metadata)==null?void 0:Et.screenHeight)??U.height??"—"})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Platform"}),t.jsx("span",{className:"omni-summary-stat__value",children:o.platform||"—"})]})]})]}),At.length>0&&t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"By Role"}),t.jsx("div",{className:"omni-summary-roles",children:At.slice(0,8).map(h=>t.jsxs("div",{className:"omni-summary-role",children:[t.jsx("span",{className:"omni-summary-role__emoji",children:h.emoji}),t.jsx("span",{className:"omni-summary-role__name",children:h.role}),t.jsx("span",{className:"omni-summary-role__count",children:h.count})]},h.role))})]})]}):t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(ls,{size:32}),t.jsx("span",{children:c?"Capturing snapshot…":"Select an element from the tree or screenshot"})]})})]})]})]})},on=5e3;function Sc(e,s=!0){const[n,i]=d.useState("unknown"),r=d.useRef("unknown");return d.useEffect(()=>{if(!e||!s){i("unknown"),r.current="unknown";return}let a=!1,c;const l=m=>{a||m===r.current||(r.current=m,i(m))},o=async()=>{if(!a){if(c&&(clearTimeout(c),c=void 0),typeof document<"u"&&document.visibilityState==="hidden"){c=setTimeout(o,on);return}try{const m=await W.getDisplayState(e);l((m==null?void 0:m.state)??"unknown")}catch{}a||(c=setTimeout(o,on))}};o();const u=()=>{document.visibilityState==="visible"&&o()};return document.addEventListener("visibilitychange",u),()=>{a=!0,c&&clearTimeout(c),document.removeEventListener("visibilitychange",u)}},[e,s]),n}const an=5e3,kc=500,Ac=1e4,Rc=10,Ec=50;function $c(e,s,n){const i=`${((n==null?void 0:n.levels)??[]).join(",")}|${(n==null?void 0:n.process)??""}`,[r,a]=d.useState([]),[c,l]=d.useState(!1),[o,u]=d.useState(null),[m,f]=d.useState(!1),p=d.useRef(null),y=d.useRef(0),g=d.useRef(void 0),b=d.useRef(()=>{}),v=d.useRef([]),k=d.useRef(void 0),N=d.useRef(0),j=d.useRef(void 0),w=d.useCallback(()=>{if(v.current.length===0)return;const L=v.current;v.current=[],a(F=>{const M=F.concat(L);return M.length>an?M.slice(-an):M})},[]),D=d.useCallback(()=>{k.current===void 0&&(k.current=window.setTimeout(()=>{k.current=void 0,w()},Ec))},[w]),$=d.useCallback(()=>{v.current=[],a([])},[]);d.useEffect(()=>{if(!s){l(!1),u(null),f(!1);return}u(null),f(!1),y.current=0;const L={cancelled:!1},F=()=>{if(L.cancelled)return;if(y.current>=Rc){f(!0);return}const O=Math.min(kc*2**y.current,Ac);y.current+=1,g.current=window.setTimeout(M,O)},M=async()=>{if(!L.cancelled)try{const O=await fetch(`/xenon/api/control/${encodeURIComponent(e)}/stream/ticket`,{method:"POST",credentials:"include"});if(L.cancelled)return;if(!O.ok){F();return}const{ticket:U}=await O.json();if(L.cancelled)return;if(!U){F();return}const G=window.location.protocol==="https:"?"wss":"ws",[q,Z]=i.split("|"),H=(q?`&levels=${encodeURIComponent(q)}`:"")+(Z?`&process=${encodeURIComponent(Z)}`:""),B=new WebSocket(`${G}://${window.location.host}/xenon/api/control/${encodeURIComponent(e)}/logcat?ticket=${encodeURIComponent(U)}${H}`);p.current=B,B.onopen=()=>{y.current=0,j.current!==1012&&(v.current=[],a([])),j.current=void 0,l(!0)},B.onmessage=R=>{try{const C=JSON.parse(R.data);v.current.push({...C,seq:N.current++}),D()}catch{}},B.onclose=R=>{if(l(!1),j.current=R.code,w(),R.code===1008){L.cancelled=!0,u(R.reason||"access denied");return}if(R.code===1012){F();return}console.warn(`[logcat] WS closed unexpectedly (code ${R.code}) — retrying`),F()},B.onerror=()=>B.close()}catch{F()}};return b.current=()=>{L.cancelled=!1,y.current=0,u(null),f(!1),M()},M(),()=>{var O;L.cancelled=!0,g.current!==void 0&&window.clearTimeout(g.current),k.current!==void 0&&(window.clearTimeout(k.current),k.current=void 0),w(),(O=p.current)==null||O.close(),p.current=null}},[e,s,i,w,D]);const T=d.useCallback(()=>{b.current()},[]);return{records:r,connected:c,clear:$,deniedReason:o,exhausted:m,retry:T}}const Cs=["V","D","I","W","E","F"];function Dc(e){const s=[];let n="",i=!1,r=!1;for(const a of e){if(a==='"'){i=!i,r=!0;continue}if(!i&&/\s/.test(a)){(r||n)&&s.push(n),n="",r=!1;continue}n+=a,r=!0}return(r||n)&&s.push(n),s.filter(a=>a.length>0)}function Zn(e,s={}){const n=s.caseSensitive===!0,i=c=>n?c:c.toLowerCase(),r=n?{caseSensitive:!0}:{},a=[];for(const c of Dc(e)){const[l,...o]=c.split(":"),u=o.join(":");u&&l.toLowerCase()==="level"?r.minLevel=u.toUpperCase():u&&l.toLowerCase()==="tag"?r.tag=i(u):u&&l.toLowerCase()==="package"?r.pkg=i(u):a.push(c)}return a.length&&(r.text=i(a.join(" "))),r}function Tc(e,s){if(e.synthetic)return!0;if(s.minLevel){const i=Cs.indexOf(s.minLevel),r=Cs.indexOf(e.level);if(i>=0&&r>=0&&r<i)return!1}const n=i=>s.caseSensitive?i:i.toLowerCase();return!(s.tag&&!n(e.tag).includes(s.tag)||s.pkg&&!n(e.pkg??"").includes(s.pkg)||s.text&&!n(e.message).includes(s.text))}function Lc(e,s){const n=e.trim().split(/\s+/).filter(Boolean).filter(i=>{const[r,...a]=i.split(":");return!(a.join(":")&&r.toLowerCase()==="level")});return s?["level:"+s.toUpperCase(),...n].join(" "):n.join(" ")}const gs=[{ios:"Debug",android:"D"},{ios:"Info",android:"I"},{ios:"Default",android:"I"},{ios:"Error",android:"E"},{ios:"Fault",android:"F"}],cn=["V","D","I","W","E","F"];function Mc(e){if(!e)return gs.filter(n=>n.ios!=="Debug").map(n=>n.ios);const s=cn.indexOf(e.toUpperCase());return s<0?gs.map(n=>n.ios):gs.filter(n=>cn.indexOf(n.android)>=s).map(n=>n.ios)}function Ic(e){const s=Zn(e,{caseSensitive:!0});return{levels:Mc(s.minLevel),process:s.pkg||void 0}}const ln=["#7dd3fc","#c4b5fd","#5eead4","#f0abfc","#93c5fd","#a5b4fc","#67e8f9","#d8b4fe","#f9a8d4","#99f6e4","#bae6fd","#e9d5ff"];function _c(e){let s=2166136261;for(let n=0;n<e.length;n++)s^=e.charCodeAt(n),s=Math.imul(s,16777619)>>>0;return s>>>0}function Oc(e){return e?ln[_c(e)%ln.length]:"var(--text-muted)"}const Ss=5e5;function Jn(e){return`${new Date(e.ts).toISOString()} ${e.pid} ${e.level}/${e.tag}: ${e.message}`}function Pc(e){return{lines:[],startedAt:e,dropped:0}}function zc(e,s){for(const n of s){if(e.lines.length>=Ss){e.dropped+=1;continue}e.lines.push(Jn(n))}return e}function Fc(e,s,n){const i=["# Xenon logcat recording",`# device: ${n}`,`# started: ${new Date(e.startedAt).toISOString()}`,`# stopped: ${new Date(s).toISOString()}`,`# duration: ${((s-e.startedAt)/1e3).toFixed(1)}s`,`# lines: ${e.lines.length}`];e.dropped>0&&i.push(`# TRUNCATED: ${e.dropped} further line(s) were dropped after the ${Ss}-line cap. This capture is INCOMPLETE.`);const r=e.lines.join(`
|
|
258
238
|
`),a=e.dropped>0?`
|
|
259
239
|
# --- TRUNCATED: ${e.dropped} line(s) not captured (cap ${Ss}) ---`:"";return`${i.join(`
|
|
260
240
|
`)}
|
|
261
241
|
|
|
262
242
|
${r}${a}
|
|
263
|
-
`}function
|
|
264
|
-
`),`logcat-${e}-${Date.now()}.txt`)},[B,e]);d.useEffect(()=>{const P=M.current;if(!P||!o.length)return;const J=o.filter(re=>re.seq>Z.current);if(!J.length)return;const se=Z.current+1;Z.current>=0&&J[0].seq>se&&(P.dropped+=J[0].seq-se),Hc(P,J),Z.current=J[J.length-1].seq,q(P.lines.length)},[o]);const me=d.useCallback(()=>{const P=M.current;if(!P){Z.current=o.length?o[o.length-1].seq:-1,M.current=Bc(Date.now()),q(0),U(!0);return}const J=Wc(P,Date.now(),e);M.current=null,U(!1),q(0),un(J,Vc(e,P.startedAt))},[o,e]);if(d.useEffect(()=>{var P;g&&((P=L.current)==null||P.scrollIntoView({block:"end"}))},[B.length,g]),!r)return t.jsxs("div",{className:"log-empty-state",children:[t.jsx("p",{className:"log-empty-title",children:"Live logs are not available here"}),t.jsx("p",{className:"log-empty-subtitle",children:"Streaming is wired up for Android (logcat) and iOS (os_trace), not for this device's platform."})]});const ke=f?"Denied":p?"Offline":u?"Live":"Connecting",ee=!u&&(!!f||p);return t.jsxs("div",{className:"logcat-root",children:[t.jsxs("div",{className:"log-toolbar",children:[t.jsxs("div",{className:"log-filter-group",children:[t.jsxs("div",{className:"log-stat-pill",title:f??void 0,children:[t.jsx("span",{className:`log-live-dot ${u?"active":""} ${ee?"is-error":""}`}),ke]}),t.jsxs("div",{className:"log-stat-pill logcat-count",children:[B.length," / ",o.length]}),t.jsxs(Jt,{selectSize:"sm",value:Fe,onChange:P=>c(Oc(a,P.target.value)),"aria-label":"Minimum log level",children:[t.jsx("option",{value:"",children:"All levels"}),dn.map(P=>t.jsx("option",{value:P.value,children:P.label},P.value))]}),t.jsxs("div",{className:"logcat-input-wrap",children:[t.jsx("input",{type:"text",className:"type-input-field tiny logcat-query",placeholder:"tag:Wifi package:com.android.systemui free text",value:a,onChange:P=>c(P.target.value),"aria-label":"Filter logs"}),a&&t.jsx("button",{type:"button",className:"logcat-input-btn",onClick:()=>c(""),"aria-label":"Clear filter",title:"Clear filter",children:t.jsx(hn,{size:12})})]}),t.jsxs("div",{className:"logcat-input-wrap",children:[t.jsx("input",{type:"text",className:"type-input-field tiny logcat-find",placeholder:"Find…",value:w,onChange:P=>{D(P.target.value),T(0)},onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),ae(P.shiftKey?-1:1))},"aria-label":"Find in logs"}),w&&t.jsx("span",{className:"logcat-hit-count","aria-live":"polite",children:R.length?`${C+1}/${R.length}`:"0/0"})]}),t.jsx("button",{type:"button",className:"btn-secondary btn-sm logcat-icon-btn",onClick:()=>ae(-1),disabled:!R.length,"aria-label":"Previous match",title:"Previous match (Shift+Enter)",children:t.jsx(Ni,{size:14})}),t.jsx("button",{type:"button",className:"btn-secondary btn-sm logcat-icon-btn",onClick:()=>ae(1),disabled:!R.length,"aria-label":"Next match",title:"Next match (Enter)",children:t.jsx(wi,{size:14})}),t.jsx("button",{type:"button",className:`btn-secondary btn-sm logcat-icon-btn ${v?"active":""}`,onClick:()=>k(!v),"aria-pressed":v,"aria-label":"Match case",title:"Match case",children:t.jsx(_i,{size:15})}),t.jsx("button",{type:"button",className:`btn-secondary btn-sm logcat-icon-btn ${N?"active":""}`,onClick:()=>j(!N),"aria-pressed":N,"aria-label":"Soft wrap",title:"Soft wrap long messages",children:t.jsx($r,{size:14})})]}),t.jsxs("div",{className:"log-actions-group",children:[(f||p)&&t.jsxs("button",{className:"btn-secondary btn-sm",onClick:y,children:[t.jsx(yt,{size:14})," RECONNECT"]}),t.jsxs("button",{className:`btn-secondary btn-sm ${g?"active":""}`,onClick:()=>b(!g),children:[t.jsx(zr,{size:14})," ",g?"FREEZE":"FOLLOW"]}),t.jsxs("button",{className:`btn-secondary btn-sm ${O?"is-recording":""}`,onClick:me,"aria-pressed":O,title:O?"Stop recording and download the capture":"Record the raw log stream to a file",children:[O?t.jsx(jn,{size:12}):t.jsx(Bi,{size:12})," ",O?`STOP · ${G.toLocaleString()}`:"RECORD"]}),t.jsxs("button",{className:"btn-premium btn-sm",disabled:B.length===0,onClick:ue,children:[t.jsx(xi,{size:14})," EXPORT"]}),t.jsxs("button",{className:"btn-secondary btn-sm",onClick:m,children:[t.jsx(Ht,{size:14})," CLEAR"]})]})]}),t.jsxs("div",{className:`logcat-rows theme-dark ${N?"":"no-wrap"}`,ref:F,children:[f&&t.jsxs("div",{className:"logcat-status-banner is-denied",role:"alert",children:[t.jsx(et,{size:14}),t.jsxs("span",{children:["Access denied — ",f]})]}),!f&&p&&t.jsxs("div",{className:"logcat-status-banner is-exhausted",role:"alert",children:[t.jsx(et,{size:14}),t.jsx("span",{children:"Connection lost after repeated attempts. Use Reconnect above to try again."})]}),B.map((P,J)=>t.jsx(Xc,{record:P,index:J,isHit:ne.has(J),isActiveHit:R.length>0&&R[C]===J},P.seq)),t.jsx("div",{ref:L})]})]})}function Gc({device:e,onClose:s,titleId:n}){const{toast:i,removeToast:r}=Zt(),a=ks(),{tab:c}=pn(),l=d.useRef(null),[o,u]=d.useState({width:0,height:0}),[m,f]=d.useState("inspect"),[p,y]=d.useState(null),[g,b]=d.useState(c||"actions"),v=g==="omni"&&m==="inspect",[k,N]=d.useState(""),[j,w]=d.useState(""),[D,$]=d.useState(""),[T,L]=d.useState(!0),[F,M]=d.useState([]),[O,U]=d.useState(null),[G,q]=d.useState(!1),[Z,V]=d.useState(!1),[B,R]=d.useState(0),[C,ne]=d.useState(e),[ae,Fe]=d.useState([]),[ue,me]=d.useState(!1),[ke,ee]=d.useState(!1),[P,J]=d.useState(null),[se,re]=d.useState(!1),[he,Me]=d.useState(!1),fe=10,[ve,Ue]=d.useState(!1),[Ke,Ae]=d.useState(!1),ct=Ec(C==null?void 0:C.udid,!he),Ie=()=>{navigator.clipboard.writeText(C.udid).catch(()=>{}),Ue(!0),setTimeout(()=>Ue(!1),1500)},Ge=d.useRef(""),oe=d.useRef(null),[Ye,lt]=d.useState(!1);d.useEffect(()=>{g&&(!c||c!==g)&&a(`/devices/${e.udid}/control/${g}`,{replace:!0})},[g,c,e.udid,a]),d.useEffect(()=>((async()=>{try{V(!0),await H.startStream(C.udid);const E=(await H.getDevices()).find(I=>I.udid===C.udid);E&&ne(E)}catch(S){console.error("Auto-start stream failed:",S)}finally{V(!1)}})(),()=>{H.stopStream(C.udid).catch(()=>{})}),[e.udid]);const Ze=d.useCallback(async()=>{try{me(!0);const x=await H.listApps(C.udid);Array.isArray(x)&&Fe(x)}catch(x){console.error("Failed to load apps:",x)}finally{me(!1)}},[C.udid]);d.useEffect(()=>{g==="actions"&&Ze()},[g,Ze]);const Ct=parseInt(C.screenWidth||"1080",10),St=parseInt(C.screenHeight||"1920",10),ge=Math.min(Ct,St),be=Math.max(Ct,St),dt=ge/be,Je=d.useCallback(()=>{const x=!T,S=x?window.innerHeight*.55:window.innerHeight*.7,E=620,X=window.innerWidth>900;let z;x?z=X?Math.min(window.innerWidth*.8,window.innerWidth-E):window.innerWidth*.8:z=window.innerWidth*.45;const Q=T?dt:1/dt;let K,Y;T?(K=S,Y=K*Q,Y>z&&(Y=z,K=Y/Q)):(Y=z,K=Y/Q,K>S&&(K=S,Y=K*Q)),u({width:Y,height:K})},[dt,T]);d.useEffect(()=>(Je(),window.addEventListener("resize",Je),()=>window.removeEventListener("resize",Je)),[Je]),d.useEffect(()=>{const x=async()=>{if(Ge.current.length>0){const E=Ge.current;Ge.current="";try{await H.typeText(C.udid,E)}catch(I){console.error("Keyboard buffering flush failed:",I)}}},S=E=>{const I=document.activeElement;if(I&&(I.tagName==="INPUT"||I.tagName==="TEXTAREA"||I.isContentEditable)||!Ye&&g!=="terminal")return;const z=E.key;z==="Enter"?(oe.current&&clearTimeout(oe.current),x(),H.pressKey(C.udid,C.platform==="android"?66:"enter")):z==="Backspace"?(oe.current&&clearTimeout(oe.current),x(),H.pressKey(C.udid,C.platform==="android"?67:"backspace")):z.length===1&&(Ge.current+=z,oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{x()},50))};return window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S),oe.current&&clearTimeout(oe.current)}},[C.udid,C.platform,Ye,g]);const[ut,kt]=d.useState(Date.now()),mt=()=>{const x=B>0?`r=${B}&`:"";return C.session_id&&!String(C.session_id).startsWith("manual_")?`/xenon/api/session/${C.session_id}/live_video?${x}t=${ut}`:`/xenon/api/control/${C.udid}/stream?${x}t=${ut}`};d.useEffect(()=>{B>0&&kt(Date.now())},[B]),d.useEffect(()=>{if(se||he)return;const x=setTimeout(()=>Me(!0),3e4);return()=>clearTimeout(x)},[se,he,B]);const Be=d.useRef(null),He=x=>{const S=x.currentTarget.getBoundingClientRect();return{x:x.clientX-S.left,y:x.clientY-S.top}},ht=x=>{const S=He(x);Be.current={x:S.x,y:S.y,time:Date.now()}},ce=async x=>{var _e;if(!Be.current)return;const S=Be.current,E=He(x),I=Date.now()-S.time,X=(_e=l.current)==null?void 0:_e.getBoundingClientRect(),z=(X==null?void 0:X.width)||o.width,Q=(X==null?void 0:X.height)||o.height;let K,Y,te,we;T?(K=S.x/z*ge,Y=S.y/Q*be,te=E.x/z*ge,we=E.y/Q*be):(K=S.x/z*be,Y=S.y/Q*ge,te=E.x/z*be,we=E.y/Q*ge);const Re=Math.abs(te-K),pe=Math.abs(we-Y);try{I<500&&Re<10&&pe<10?await H.tap(C.udid,Math.round(K),Math.round(Y)):I>=500&&Re<10&&pe<10?await H.touchAndHold(C.udid,Math.round(K),Math.round(Y),I):await H.swipe(C.udid,Math.round(K),Math.round(Y),Math.round(te),Math.round(we))}catch(We){console.error("Action failed:",We)}Be.current=null},ft=()=>H.pressKey(C.udid,C.platform==="android"?xt.HOME:as.HOME),ns=()=>H.pressKey(C.udid,xt.BACK),At=()=>H.pressKey(C.udid,xt.APP_SWITCH),Rt=()=>H.pressKey(C.udid,C.platform==="android"?xt.VOLUME_UP:as.VOLUME_UP),Et=()=>H.pressKey(C.udid,C.platform==="android"?xt.VOLUME_DOWN:as.VOLUME_DOWN),$t=()=>H.lock(C.udid),pt=async()=>{Ae(!0);try{await H.unlock(C.udid)}finally{setTimeout(()=>Ae(!1),2500)}},Dt=async()=>{k.trim()&&(await H.typeText(C.udid,k),N(""))},Tt=async()=>{try{w("Fetching...");const x=await H.getClipboard(C.udid);x&&x.content!==void 0?w(x.content||"(Clipboard is empty)"):w("No content received")}catch{w("Error: Check Appium Settings app")}},Lt=async()=>{q(!0);try{const x=await H.getScreenshot(C.udid);if(x!=null&&x.screenshot){const S={id:xc(),base64:x.screenshot,timestamp:Date.now()};M(E=>[S,...E]),U(0)}}catch(x){console.error("Failed to take screenshot:",x)}finally{q(!1)}},gt=x=>{M(S=>{const E=S.filter(I=>I.id!==x);return E.length===0?U(null):O!==null&&O>=E.length&&U(0),E})},Mt=()=>{M([]),U(null),i("Cleared all captured evidence.","success")},It=x=>{const S=document.createElement("a");S.href=`data:image/png;base64,${x}`,S.download=`screenshot-${C.udid}-${Date.now()}.png`,S.click()},h=async x=>{const S=ge/2,E=be/2,I=ge*.4,X=be*.4;let z,Q,K,Y;switch(x){case"left":z=S+I,Q=E,K=S-I,Y=E;break;case"right":z=S-I,Q=E,K=S+I,Y=E;break;case"up":z=S,Q=E+X,K=S,Y=E-X;break;case"down":z=S,Q=E-X,K=S,Y=E+X;break}try{await H.swipe(C.udid,Math.round(z),Math.round(Q),Math.round(K),Math.round(Y))}catch(te){console.error(`Quick swipe ${x} failed:`,te)}},A=async()=>{if(D.trim()){const x=i(`Uninstalling ${D}...`,"loading",0);try{me(!0),await H.uninstallApp(C.udid,D),$(""),i(`Request sent for ${D}`,"success"),setTimeout(Ze,3e3)}catch{i("Uninstall failed. Check logs.","error")}finally{me(!1),r(x)}}},_=async()=>{if(!P)return;let x;try{ee(!0),x=i(`Installing app to ${C.udid}...`,"loading",0);const S=await H.uploadAndInstallApp(C.udid,P);S.success?(i(S.message||"App installed successfully","success"),J(null),setTimeout(Ze,5e3)):i("Installation failed: "+(S.error||"Unknown error"),"error")}catch(S){i("Installation failed: "+S.message,"error")}finally{x&&r(x),ee(!1)}};return t.jsxs("div",{className:"device-control-view",children:[t.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),t.jsxs("header",{className:"control-view-top-bar",children:[t.jsxs("button",{className:"back-to-devices-btn",onClick:s,children:[t.jsx(os,{size:18})," DEVICES"]}),t.jsxs("div",{className:"device-info-mini",children:[t.jsx("span",{className:`device-pill platform-pill ${C.platform}`,children:C.platform==="ios"?"Apple":"Android"}),t.jsxs("span",{className:"device-pill version-pill",children:["v",C.sdk]}),C.reservedUntil&&Date.now()<C.reservedUntil&&t.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${C.reservedBy}${C.reservationReason?`: ${C.reservationReason}`:""}`,children:["Reserved by ",C.reservedBy||"someone"]}),t.jsx("h2",{id:n,className:"device-name-text",children:C.name}),t.jsxs("span",{className:"udid-chip",title:C.udid,children:[t.jsx("span",{className:"udid-chip__value",children:C.udid}),t.jsx("button",{type:"button",className:"udid-chip__copy",onClick:Ie,"aria-label":"Copy UDID",title:ve?"Copied!":"Copy UDID",children:ve?t.jsx(Bt,{size:12}):t.jsx(qe,{size:12})})]})]})]}),t.jsxs("div",{className:`control-view-main ${T?"":"is-landscape"} ${g==="omni"?"omni-mode":""}`,children:[t.jsxs("div",{className:"device-preview-column",children:[t.jsx("div",{className:"device-screen-wrapper",children:t.jsxs("div",{ref:x=>{l.current=x,y(x)},className:`device-stream-canvas ${T?"":"landscape"} ${Ye?"focused":""} ${v?"is-inspecting":""}`,style:{width:o.width,height:o.height,background:"var(--black)"},tabIndex:0,onFocus:()=>lt(!0),onBlur:()=>lt(!1),onMouseDown:v?void 0:ht,onMouseUp:v?void 0:ce,children:[he?t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(et,{size:40,color:"var(--red, #f87171)"}),t.jsx("p",{style:{marginTop:16},children:"Stream unavailable"}),t.jsx("button",{className:"btn-premium btn-sm",style:{marginTop:12},onClick:()=>{Me(!1),R(0)},children:"Retry"})]}):(Z||!se)&&t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(yt,{size:40,className:"animate-spin",color:"var(--color-accent)"}),t.jsx("p",{style:{marginTop:16},children:Z?"ESTABLISHING TRACE...":"Waiting for stream…"})]}),!he&&t.jsx("img",{src:mt(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onLoad:()=>re(!0),onError:()=>{if(console.warn("Stream failed to load, retrying..."),re(!1),B>=fe){Me(!0);return}setTimeout(()=>R(x=>x+1),2e3)}}),ct==="off"&&!he&&t.jsxs("div",{className:"device-screen-off",role:"status",children:[t.jsx(lr,{size:32}),t.jsx("p",{children:"Display is off"}),t.jsx("span",{children:"The stream is fine — the device is asleep."}),t.jsx("button",{type:"button",className:"btn-premium btn-sm",onClick:pt,disabled:Ke,children:Ke?"Waking…":"Wake device"})]})]})}),t.jsxs("aside",{className:"device-footer-actions",role:"toolbar","aria-label":"Device controls","aria-orientation":T?"vertical":"horizontal",children:[t.jsx("button",{className:`footer-action-btn ${T?"active":""}`,onClick:()=>L(!0),title:"Portrait","aria-label":"Portrait orientation","aria-pressed":T,children:t.jsx(vr,{size:18})}),t.jsx("button",{className:`footer-action-btn ${T?"":"active"}`,onClick:()=>L(!1),title:"Landscape","aria-label":"Landscape orientation","aria-pressed":!T,children:t.jsx(xr,{size:18})}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:ft,title:"Home","aria-label":"Home",children:t.jsx(Qi,{size:18})}),C.platform==="android"&&t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"footer-action-btn",onClick:ns,title:"Back","aria-label":"Back",children:t.jsx(os,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:At,title:"App switcher","aria-label":"App switcher",children:t.jsx(jn,{size:18})})]}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:Rt,title:"Volume up","aria-label":"Volume up",children:t.jsx(Or,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:Et,title:"Volume down","aria-label":"Volume down",children:t.jsx(Ir,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:$t,title:"Lock device","aria-label":"Lock device",children:t.jsx(yi,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:pt,title:"Unlock device","aria-label":"Unlock device",children:t.jsx(nr,{size:18})})]})]}),t.jsxs("div",{className:"device-interactions-column",children:[t.jsxs("div",{className:"interaction-tabs",role:"tablist",children:[t.jsxs("button",{className:`tab-btn ${g==="actions"?"active":""}`,onClick:()=>b("actions"),role:"tab","aria-selected":g==="actions",children:[t.jsx(xs,{size:13}),t.jsx("span",{children:"Actions"})]}),t.jsxs("button",{className:`tab-btn ${g==="screenshot"?"active":""}`,onClick:()=>b("screenshot"),role:"tab","aria-selected":g==="screenshot",children:[t.jsx(cs,{size:13}),t.jsx("span",{children:"Screenshot"})]}),t.jsxs("button",{className:`tab-btn ${g==="logs"?"active":""}`,onClick:()=>b("logs"),role:"tab","aria-selected":g==="logs",children:[t.jsx(jr,{size:13}),t.jsx("span",{children:"Logs"})]}),t.jsxs("button",{className:`tab-btn ${g==="terminal"?"active":""}`,onClick:()=>b("terminal"),role:"tab","aria-selected":g==="terminal",children:[t.jsx(bn,{size:13}),t.jsx("span",{children:"Shell"})]}),t.jsxs("button",{className:`tab-btn ${g==="omni"?"active":""}`,onClick:()=>b("omni"),role:"tab","aria-selected":g==="omni",children:[t.jsx(ys,{size:13}),t.jsx("span",{children:"Omni-Vision"})]})]}),t.jsx("div",{className:`interactions-scroll-area ${g==="terminal"?"terminal-mode":""} ${g==="screenshot"||g==="logs"?"screenshot-mode":""}`,children:t.jsxs("div",{className:"tab-content",children:[g==="omni"&&t.jsx("div",{className:"omni-inspector-tab-wrapper animate-fade-in",children:t.jsx(Rc,{sessionId:C.session_id?String(C.session_id):null,udid:C.udid,streamUrl:mt(),embedded:!0,overlayTarget:p,onModeChange:f})}),g==="actions"&&t.jsxs("div",{className:"actions-grid",children:[t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(pi,{size:18,color:"var(--color-accent)"})," Smart Input"]}),t.jsx("p",{className:"action-card-hint",children:"Relay keystrokes to the focused element on the device."}),t.jsx("input",{type:"text",className:"type-input-field compact",placeholder:"Type and press Enter to send…",value:k,onChange:x=>N(x.target.value),onKeyDown:x=>x.key==="Enter"&&Dt()})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(hr,{size:18,color:"var(--color-accent)"})," App Management"]}),t.jsxs("div",{className:"app-mgmt-content",children:[t.jsxs("div",{className:"install-section",children:[t.jsx("p",{className:"compact-label",children:"Install Package"}),t.jsxs("div",{className:"upload-box-row",children:[t.jsxs("label",{className:"file-upload-launcher",title:P?P.name:"Select an .apk, .ipa or .app file",children:[t.jsx(hi,{size:14}),t.jsx("span",{children:P?P.name:"Select File"}),t.jsx("input",{type:"file",accept:".apk,.ipa,.app",onChange:x=>{var S;return J(((S=x.target.files)==null?void 0:S[0])||null)},hidden:!0})]}),t.jsx("button",{className:"btn-premium btn-sm",disabled:!P||ke,onClick:_,children:ke?t.jsx(is,{className:"animate-spin",size:14}):"INSTALL"})]}),t.jsx("p",{className:"hint-text",children:"Accepts .apk, .ipa or .app"})]}),t.jsx("div",{className:"divider-v"}),t.jsxs("div",{className:"uninstall-section",children:[t.jsx("p",{className:"compact-label",children:"Quick Uninstall"}),t.jsxs("div",{className:"uninstall-controls-row",children:[t.jsxs("div",{className:"select-wrapper",children:[t.jsxs(Jt,{selectSize:"sm",className:"w-full",value:D,onChange:x=>$(x.target.value),disabled:ue,children:[t.jsx("option",{value:"",children:ue?"Loading apps...":"-- Select App to Remove --"}),ae.map(x=>t.jsx("option",{value:x,children:x},x))]}),ue&&t.jsx(is,{className:"animate-spin select-loader",size:12})]}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:A,disabled:!D||ue,children:[t.jsx(Ht,{size:14})," UNINSTALL"]})]}),t.jsxs("div",{className:"manual-input-box",children:[t.jsx("p",{className:"hint-text",children:"Or enter manually:"}),t.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"com.example.app",value:D,onChange:x=>$(x.target.value)})]})]})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(Wi,{size:18,color:"var(--color-accent)"})," Clipboard"]}),t.jsxs("div",{className:"clipboard-row",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:Tt,children:"FETCH VALUE"}),t.jsx("div",{className:"clipboard-display compact",children:j})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(ur,{size:18,color:"var(--color-accent)"})," Directional Gestures"]}),t.jsxs("div",{className:"gestures-grid-container",children:[t.jsxs("div",{className:"gestures-dpad",children:[t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>h("up"),children:t.jsx(Pi,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>h("left"),children:t.jsx(os,{size:24})}),t.jsx("div",{className:"dpad-center"}),t.jsx("button",{className:"dpad-btn",onClick:()=>h("right"),children:t.jsx(wn,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>h("down"),children:t.jsx(fn,{size:24})}),t.jsx("div",{})]}),t.jsx("p",{className:"compact-label dpad-caption",children:"Quick swipe in a direction"})]})]})]}),g==="screenshot"&&t.jsxs("div",{className:"action-card screenshot-card",children:[F.length>0&&t.jsx("header",{className:"action-card-header",children:t.jsx("button",{className:"btn-text-only",onClick:Mt,children:"CLEAR ALL"})}),t.jsxs("div",{className:`screenshot-workspace ${F.length===0?"is-empty":""}`,children:[t.jsxs("div",{className:"screenshot-gallery-sidebar",children:[t.jsxs("button",{className:"btn-premium take-screenshot-btn",onClick:Lt,disabled:G,children:[G?t.jsx(is,{className:"animate-spin",size:16}):t.jsx(cs,{size:16}),t.jsx("span",{children:G?"CAPTURING...":"NEW CAPTURE"})]}),t.jsxs("div",{className:"screenshot-thumbnails-list",children:[F.length===0&&!G&&t.jsxs("div",{className:"empty-gallery-state",children:[t.jsx(cs,{size:20,className:"empty-gallery-icon"}),t.jsx("p",{className:"empty-gallery-title",children:"No captures yet"}),t.jsx("p",{className:"empty-gallery-hint",children:"Grab a screenshot of the device to begin analysis."})]}),F.map((x,S)=>t.jsxs("div",{className:`screenshot-thumb-item ${O===S?"active":""}`,onClick:()=>U(S),children:[t.jsx("img",{src:`data:image/png;base64,${x.base64}`,alt:"Thumb"}),t.jsx("span",{className:"thumb-time",children:new Date(x.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),t.jsx("button",{className:"thumb-delete-btn",onClick:E=>{E.stopPropagation(),gt(x.id)},children:t.jsx(Ht,{size:12})})]},x.id))]})]}),t.jsx("div",{className:"screenshot-main-preview",children:O!==null&&F[O]?t.jsxs("div",{className:"preview-container",children:[t.jsx("div",{className:"preview-image-wrapper",children:t.jsx("img",{src:`data:image/png;base64,${F[O].base64}`,alt:"Selected Evidence"})}),t.jsxs("footer",{className:"preview-footer",children:[t.jsxs("div",{className:"preview-meta",children:[t.jsx("span",{className:"meta-label",children:"ID:"}),t.jsx("span",{className:"meta-value",children:F[O].id.substring(0,8)}),t.jsx("span",{className:"meta-divider",children:"|"}),t.jsx("span",{className:"meta-value",children:fi(F[O].timestamp)})]}),t.jsxs("div",{className:"preview-actions",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:()=>It(F[O].base64),children:"DOWNLOAD PNG"}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:()=>gt(F[O].id),children:[t.jsx(Ht,{size:14})," DELETE"]})]})]})]}):null})]})]}),g==="logs"&&t.jsx("div",{className:"action-card screenshot-card",children:t.jsx(Kc,{udid:C.udid,platform:C.platform})}),g==="terminal"&&t.jsx("div",{className:"action-card full-height",children:t.jsx(yc,{platform:(C.platform||"").toLowerCase(),prompt:`${(C.platform||"").toLowerCase()==="ios"?"ios":"adb"} $`,welcomeMessage:`Connected to ${C.name} (${C.udid}).
|
|
265
|
-
Internal Shell Environment.`,onCommand:async x=>{const S=await
|
|
243
|
+
`}function Uc(e,s){const n=new Date(s).toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");return`logcat-${e}-${n}.txt`}const dn=Cs.filter(e=>e!=="V").map(e=>({value:e,label:e==="F"?"F only":`${e} and above`})),Bc=new Intl.DateTimeFormat([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function un(e,s){const n=URL.createObjectURL(new Blob([e],{type:"text/plain"})),i=document.createElement("a");i.href=n,i.download=s,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(n),0)}const Wc=d.memo(function({record:s,index:n,isHit:i,isActiveHit:r}){return t.jsxs("div",{"data-row-index":n,className:`logcat-row ${s.synthetic?"is-synthetic":""} ${i?"is-hit":""} ${r?"is-active-hit":""}`,children:[t.jsx("span",{className:"logcat-time",children:Bc.format(s.ts)}),t.jsxs("span",{className:"logcat-pid",children:[s.pid,"-",s.tid]}),t.jsx("span",{className:"logcat-tag",title:s.tag,style:{color:Oc(s.tag)},children:s.tag}),t.jsx("span",{className:"logcat-pkg",title:s.pkg,children:s.pkg??""}),t.jsx("span",{className:`logcat-level lvl-${s.level}`,children:s.level}),t.jsx("span",{className:"logcat-msg",children:s.message})]})});function Hc({udid:e,platform:s}){const n=(s||"").toLowerCase(),i=n==="ios",r=n==="android"||i,[a,c]=d.useState(""),l=d.useMemo(()=>i?Ic(a):void 0,[i,a]),{records:o,connected:u,clear:m,deniedReason:f,exhausted:p,retry:y}=$c(e,r,l),[g,b]=d.useState(!0),[v,k]=d.useState(!1),[N,j]=d.useState(!0),[w,D]=d.useState(""),[$,T]=d.useState(0),L=d.useRef(null),F=d.useRef(null),M=d.useRef(null),[O,U]=d.useState(!1),[G,q]=d.useState(0),Z=d.useRef(-1),H=d.useMemo(()=>Zn(a,{caseSensitive:v}),[a,v]),B=d.useMemo(()=>o.filter(P=>Tc(P,H)),[o,H]),R=d.useMemo(()=>{if(!w)return[];const P=v?w:w.toLowerCase(),J=[];return B.forEach((se,re)=>{(v?`${se.tag} ${se.message}`:`${se.tag} ${se.message}`.toLowerCase()).includes(P)&&J.push(re)}),J},[B,w,v]),C=R.length?Math.min($,R.length-1):0,ne=d.useMemo(()=>new Set(R),[R]),ae=d.useCallback(P=>{var se,re;if(!R.length)return;const J=(C+P+R.length)%R.length;T(J),b(!1),(re=(se=F.current)==null?void 0:se.querySelector(`[data-row-index="${R[J]}"]`))==null||re.scrollIntoView({block:"center"})},[R,C]),Fe=dn.some(P=>P.value===H.minLevel)?H.minLevel:"",ue=d.useCallback(()=>{un(B.map(Jn).join(`
|
|
244
|
+
`),`logcat-${e}-${Date.now()}.txt`)},[B,e]);d.useEffect(()=>{const P=M.current;if(!P||!o.length)return;const J=o.filter(re=>re.seq>Z.current);if(!J.length)return;const se=Z.current+1;Z.current>=0&&J[0].seq>se&&(P.dropped+=J[0].seq-se),zc(P,J),Z.current=J[J.length-1].seq,q(P.lines.length)},[o]);const me=d.useCallback(()=>{const P=M.current;if(!P){Z.current=o.length?o[o.length-1].seq:-1,M.current=Pc(Date.now()),q(0),U(!0);return}const J=Fc(P,Date.now(),e);M.current=null,U(!1),q(0),un(J,Uc(e,P.startedAt))},[o,e]);if(d.useEffect(()=>{var P;g&&((P=L.current)==null||P.scrollIntoView({block:"end"}))},[B.length,g]),!r)return t.jsxs("div",{className:"log-empty-state",children:[t.jsx("p",{className:"log-empty-title",children:"Live logs are not available here"}),t.jsx("p",{className:"log-empty-subtitle",children:"Streaming is wired up for Android (logcat) and iOS (os_trace), not for this device's platform."})]});const ke=f?"Denied":p?"Offline":u?"Live":"Connecting",ee=!u&&(!!f||p);return t.jsxs("div",{className:"logcat-root",children:[t.jsxs("div",{className:"log-toolbar",children:[t.jsxs("div",{className:"log-filter-group",children:[t.jsxs("div",{className:"log-stat-pill",title:f??void 0,children:[t.jsx("span",{className:`log-live-dot ${u?"active":""} ${ee?"is-error":""}`}),ke]}),t.jsxs("div",{className:"log-stat-pill logcat-count",children:[B.length," / ",o.length]}),t.jsxs(Jt,{selectSize:"sm",value:Fe,onChange:P=>c(Lc(a,P.target.value)),"aria-label":"Minimum log level",children:[t.jsx("option",{value:"",children:"All levels"}),dn.map(P=>t.jsx("option",{value:P.value,children:P.label},P.value))]}),t.jsxs("div",{className:"logcat-input-wrap",children:[t.jsx("input",{type:"text",className:"type-input-field tiny logcat-query",placeholder:"tag:Wifi package:com.android.systemui free text",value:a,onChange:P=>c(P.target.value),"aria-label":"Filter logs"}),a&&t.jsx("button",{type:"button",className:"logcat-input-btn",onClick:()=>c(""),"aria-label":"Clear filter",title:"Clear filter",children:t.jsx(hn,{size:12})})]}),t.jsxs("div",{className:"logcat-input-wrap",children:[t.jsx("input",{type:"text",className:"type-input-field tiny logcat-find",placeholder:"Find…",value:w,onChange:P=>{D(P.target.value),T(0)},onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),ae(P.shiftKey?-1:1))},"aria-label":"Find in logs"}),w&&t.jsx("span",{className:"logcat-hit-count","aria-live":"polite",children:R.length?`${C+1}/${R.length}`:"0/0"})]}),t.jsx("button",{type:"button",className:"btn-secondary btn-sm logcat-icon-btn",onClick:()=>ae(-1),disabled:!R.length,"aria-label":"Previous match",title:"Previous match (Shift+Enter)",children:t.jsx(Si,{size:14})}),t.jsx("button",{type:"button",className:"btn-secondary btn-sm logcat-icon-btn",onClick:()=>ae(1),disabled:!R.length,"aria-label":"Next match",title:"Next match (Enter)",children:t.jsx(Ni,{size:14})}),t.jsx("button",{type:"button",className:`btn-secondary btn-sm logcat-icon-btn ${v?"active":""}`,onClick:()=>k(!v),"aria-pressed":v,"aria-label":"Match case",title:"Match case",children:t.jsx(Oi,{size:15})}),t.jsx("button",{type:"button",className:`btn-secondary btn-sm logcat-icon-btn ${N?"active":""}`,onClick:()=>j(!N),"aria-pressed":N,"aria-label":"Soft wrap",title:"Soft wrap long messages",children:t.jsx(kr,{size:14})})]}),t.jsxs("div",{className:"log-actions-group",children:[(f||p)&&t.jsxs("button",{className:"btn-secondary btn-sm",onClick:y,children:[t.jsx(yt,{size:14})," RECONNECT"]}),t.jsxs("button",{className:`btn-secondary btn-sm ${g?"active":""}`,onClick:()=>b(!g),children:[t.jsx(Ir,{size:14})," ",g?"FREEZE":"FOLLOW"]}),t.jsxs("button",{className:`btn-secondary btn-sm ${O?"is-recording":""}`,onClick:me,"aria-pressed":O,title:O?"Stop recording and download the capture":"Record the raw log stream to a file",children:[O?t.jsx(jn,{size:12}):t.jsx(xi,{size:12})," ",O?`STOP · ${G.toLocaleString()}`:"RECORD"]}),t.jsxs("button",{className:"btn-premium btn-sm",disabled:B.length===0,onClick:ue,children:[t.jsx(vi,{size:14})," EXPORT"]}),t.jsxs("button",{className:"btn-secondary btn-sm",onClick:m,children:[t.jsx(Wt,{size:14})," CLEAR"]})]})]}),t.jsxs("div",{className:`logcat-rows theme-dark ${N?"":"no-wrap"}`,ref:F,children:[f&&t.jsxs("div",{className:"logcat-status-banner is-denied",role:"alert",children:[t.jsx(et,{size:14}),t.jsxs("span",{children:["Access denied — ",f]})]}),!f&&p&&t.jsxs("div",{className:"logcat-status-banner is-exhausted",role:"alert",children:[t.jsx(et,{size:14}),t.jsx("span",{children:"Connection lost after repeated attempts. Use Reconnect above to try again."})]}),B.map((P,J)=>t.jsx(Wc,{record:P,index:J,isHit:ne.has(J),isActiveHit:R.length>0&&R[C]===J},P.seq)),t.jsx("div",{ref:L})]})]})}function Vc({device:e,onClose:s,titleId:n}){const{toast:i,removeToast:r}=Zt(),a=ks(),{tab:c}=pn(),l=d.useRef(null),[o,u]=d.useState({width:0,height:0}),[m,f]=d.useState("inspect"),[p,y]=d.useState(null),[g,b]=d.useState(c||"actions"),v=g==="omni"&&m==="inspect",[k,N]=d.useState(""),[j,w]=d.useState(""),[D,$]=d.useState(""),[T,L]=d.useState(!0),[F,M]=d.useState([]),[O,U]=d.useState(null),[G,q]=d.useState(!1),[Z,H]=d.useState(!1),[B,R]=d.useState(0),[C,ne]=d.useState(e),[ae,Fe]=d.useState([]),[ue,me]=d.useState(!1),[ke,ee]=d.useState(!1),[P,J]=d.useState(null),[se,re]=d.useState(!1),[he,Me]=d.useState(!1),fe=10,[ve,Ue]=d.useState(!1),[Ke,Ae]=d.useState(!1),ct=Sc(C==null?void 0:C.udid,!he),Ie=()=>{navigator.clipboard.writeText(C.udid).catch(()=>{}),Ue(!0),setTimeout(()=>Ue(!1),1500)},Ge=d.useRef(""),oe=d.useRef(null),[Ye,lt]=d.useState(!1);d.useEffect(()=>{g&&(!c||c!==g)&&a(`/devices/${e.udid}/control/${g}`,{replace:!0})},[g,c,e.udid,a]),d.useEffect(()=>((async()=>{try{H(!0),await W.startStream(C.udid);const E=(await W.getDevices()).find(I=>I.udid===C.udid);E&&ne(E)}catch(S){console.error("Auto-start stream failed:",S)}finally{H(!1)}})(),()=>{W.stopStream(C.udid).catch(()=>{})}),[e.udid]);const Ze=d.useCallback(async()=>{try{me(!0);const x=await W.listApps(C.udid);Array.isArray(x)&&Fe(x)}catch(x){console.error("Failed to load apps:",x)}finally{me(!1)}},[C.udid]);d.useEffect(()=>{g==="actions"&&Ze()},[g,Ze]);const Ct=parseInt(C.screenWidth||"1080",10),St=parseInt(C.screenHeight||"1920",10),ge=Math.min(Ct,St),be=Math.max(Ct,St),dt=ge/be,Je=d.useCallback(()=>{const x=!T,S=x?window.innerHeight*.55:window.innerHeight*.7,E=620,X=window.innerWidth>900;let z;x?z=X?Math.min(window.innerWidth*.8,window.innerWidth-E):window.innerWidth*.8:z=window.innerWidth*.45;const Q=T?dt:1/dt;let K,Y;T?(K=S,Y=K*Q,Y>z&&(Y=z,K=Y/Q)):(Y=z,K=Y/Q,K>S&&(K=S,Y=K*Q)),u({width:Y,height:K})},[dt,T]);d.useEffect(()=>(Je(),window.addEventListener("resize",Je),()=>window.removeEventListener("resize",Je)),[Je]),d.useEffect(()=>{const x=async()=>{if(Ge.current.length>0){const E=Ge.current;Ge.current="";try{await W.typeText(C.udid,E)}catch(I){console.error("Keyboard buffering flush failed:",I)}}},S=E=>{const I=document.activeElement;if(I&&(I.tagName==="INPUT"||I.tagName==="TEXTAREA"||I.isContentEditable)||!Ye&&g!=="terminal")return;const z=E.key;z==="Enter"?(oe.current&&clearTimeout(oe.current),x(),W.pressKey(C.udid,C.platform==="android"?66:"enter")):z==="Backspace"?(oe.current&&clearTimeout(oe.current),x(),W.pressKey(C.udid,C.platform==="android"?67:"backspace")):z.length===1&&(Ge.current+=z,oe.current&&clearTimeout(oe.current),oe.current=setTimeout(()=>{x()},50))};return window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S),oe.current&&clearTimeout(oe.current)}},[C.udid,C.platform,Ye,g]);const[ut,kt]=d.useState(Date.now()),mt=()=>{const x=B>0?`r=${B}&`:"";return C.session_id&&!String(C.session_id).startsWith("manual_")?`/xenon/api/session/${C.session_id}/live_video?${x}t=${ut}`:`/xenon/api/control/${C.udid}/stream?${x}t=${ut}`};d.useEffect(()=>{B>0&&kt(Date.now())},[B]),d.useEffect(()=>{if(se||he)return;const x=setTimeout(()=>Me(!0),3e4);return()=>clearTimeout(x)},[se,he,B]);const Be=d.useRef(null),We=x=>{const S=x.currentTarget.getBoundingClientRect();return{x:x.clientX-S.left,y:x.clientY-S.top}},ht=x=>{const S=We(x);Be.current={x:S.x,y:S.y,time:Date.now()}},ce=async x=>{var _e;if(!Be.current)return;const S=Be.current,E=We(x),I=Date.now()-S.time,X=(_e=l.current)==null?void 0:_e.getBoundingClientRect(),z=(X==null?void 0:X.width)||o.width,Q=(X==null?void 0:X.height)||o.height;let K,Y,te,we;T?(K=S.x/z*ge,Y=S.y/Q*be,te=E.x/z*ge,we=E.y/Q*be):(K=S.x/z*be,Y=S.y/Q*ge,te=E.x/z*be,we=E.y/Q*ge);const Re=Math.abs(te-K),pe=Math.abs(we-Y);try{I<500&&Re<10&&pe<10?await W.tap(C.udid,Math.round(K),Math.round(Y)):I>=500&&Re<10&&pe<10?await W.touchAndHold(C.udid,Math.round(K),Math.round(Y),I):await W.swipe(C.udid,Math.round(K),Math.round(Y),Math.round(te),Math.round(we))}catch(He){console.error("Action failed:",He)}Be.current=null},ft=()=>W.pressKey(C.udid,C.platform==="android"?xt.HOME:as.HOME),ns=()=>W.pressKey(C.udid,xt.BACK),At=()=>W.pressKey(C.udid,xt.APP_SWITCH),Rt=()=>W.pressKey(C.udid,C.platform==="android"?xt.VOLUME_UP:as.VOLUME_UP),Et=()=>W.pressKey(C.udid,C.platform==="android"?xt.VOLUME_DOWN:as.VOLUME_DOWN),$t=()=>W.lock(C.udid),pt=async()=>{Ae(!0);try{await W.unlock(C.udid)}finally{setTimeout(()=>Ae(!1),2500)}},Dt=async()=>{k.trim()&&(await W.typeText(C.udid,k),N(""))},Tt=async()=>{try{w("Fetching...");const x=await W.getClipboard(C.udid);x&&x.content!==void 0?w(x.content||"(Clipboard is empty)"):w("No content received")}catch{w("Error: Check Appium Settings app")}},Lt=async()=>{q(!0);try{const x=await W.getScreenshot(C.udid);if(x!=null&&x.screenshot){const S={id:hc(),base64:x.screenshot,timestamp:Date.now()};M(E=>[S,...E]),U(0)}}catch(x){console.error("Failed to take screenshot:",x)}finally{q(!1)}},gt=x=>{M(S=>{const E=S.filter(I=>I.id!==x);return E.length===0?U(null):O!==null&&O>=E.length&&U(0),E})},Mt=()=>{M([]),U(null),i("Cleared all captured evidence.","success")},It=x=>{const S=document.createElement("a");S.href=`data:image/png;base64,${x}`,S.download=`screenshot-${C.udid}-${Date.now()}.png`,S.click()},h=async x=>{const S=ge/2,E=be/2,I=ge*.4,X=be*.4;let z,Q,K,Y;switch(x){case"left":z=S+I,Q=E,K=S-I,Y=E;break;case"right":z=S-I,Q=E,K=S+I,Y=E;break;case"up":z=S,Q=E+X,K=S,Y=E-X;break;case"down":z=S,Q=E-X,K=S,Y=E+X;break}try{await W.swipe(C.udid,Math.round(z),Math.round(Q),Math.round(K),Math.round(Y))}catch(te){console.error(`Quick swipe ${x} failed:`,te)}},A=async()=>{if(D.trim()){const x=i(`Uninstalling ${D}...`,"loading",0);try{me(!0),await W.uninstallApp(C.udid,D),$(""),i(`Request sent for ${D}`,"success"),setTimeout(Ze,3e3)}catch{i("Uninstall failed. Check logs.","error")}finally{me(!1),r(x)}}},_=async()=>{if(!P)return;let x;try{ee(!0),x=i(`Installing app to ${C.udid}...`,"loading",0);const S=await W.uploadAndInstallApp(C.udid,P);S.success?(i(S.message||"App installed successfully","success"),J(null),setTimeout(Ze,5e3)):i("Installation failed: "+(S.error||"Unknown error"),"error")}catch(S){i("Installation failed: "+S.message,"error")}finally{x&&r(x),ee(!1)}};return t.jsxs("div",{className:"device-control-view",children:[t.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),t.jsxs("header",{className:"control-view-top-bar",children:[t.jsxs("button",{className:"back-to-devices-btn",onClick:s,children:[t.jsx(cs,{size:18})," DEVICES"]}),t.jsxs("div",{className:"device-info-mini",children:[t.jsx("span",{className:`device-pill platform-pill ${C.platform}`,children:C.platform==="ios"?"Apple":"Android"}),t.jsxs("span",{className:"device-pill version-pill",children:["v",C.sdk]}),C.reservedUntil&&Date.now()<C.reservedUntil&&t.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${C.reservedBy}${C.reservationReason?`: ${C.reservationReason}`:""}`,children:["Reserved by ",C.reservedBy||"someone"]}),t.jsx("h2",{id:n,className:"device-name-text",children:C.name}),t.jsxs("span",{className:"udid-chip",title:C.udid,children:[t.jsx("span",{className:"udid-chip__value",children:C.udid}),t.jsx("button",{type:"button",className:"udid-chip__copy",onClick:Ie,"aria-label":"Copy UDID",title:ve?"Copied!":"Copy UDID",children:ve?t.jsx(Bt,{size:12}):t.jsx(qe,{size:12})})]})]})]}),t.jsxs("div",{className:`control-view-main ${T?"":"is-landscape"} ${g==="omni"?"omni-mode":""}`,children:[t.jsxs("div",{className:"device-preview-column",children:[t.jsx("div",{className:"device-screen-wrapper",children:t.jsxs("div",{ref:x=>{l.current=x,y(x)},className:`device-stream-canvas ${T?"":"landscape"} ${Ye?"focused":""} ${v?"is-inspecting":""}`,style:{width:o.width,height:o.height,background:"var(--black)"},tabIndex:0,onFocus:()=>lt(!0),onBlur:()=>lt(!1),onMouseDown:v?void 0:ht,onMouseUp:v?void 0:ce,children:[he?t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(et,{size:40,color:"var(--red, #f87171)"}),t.jsx("p",{style:{marginTop:16},children:"Stream unavailable"}),t.jsx("button",{className:"btn-premium btn-sm",style:{marginTop:12},onClick:()=>{Me(!1),R(0)},children:"Retry"})]}):(Z||!se)&&t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(yt,{size:40,className:"animate-spin",color:"var(--color-accent)"}),t.jsx("p",{style:{marginTop:16},children:Z?"ESTABLISHING TRACE...":"Waiting for stream…"})]}),!he&&t.jsx("img",{src:mt(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onLoad:()=>re(!0),onError:()=>{if(console.warn("Stream failed to load, retrying..."),re(!1),B>=fe){Me(!0);return}setTimeout(()=>R(x=>x+1),2e3)}}),ct==="off"&&!he&&t.jsxs("div",{className:"device-screen-off",role:"status",children:[t.jsx(or,{size:32}),t.jsx("p",{children:"Display is off"}),t.jsx("span",{children:"The stream is fine — the device is asleep."}),t.jsx("button",{type:"button",className:"btn-premium btn-sm",onClick:pt,disabled:Ke,children:Ke?"Waking…":"Wake device"})]})]})}),t.jsxs("aside",{className:"device-footer-actions",role:"toolbar","aria-label":"Device controls","aria-orientation":T?"vertical":"horizontal",children:[t.jsx("button",{className:`footer-action-btn ${T?"active":""}`,onClick:()=>L(!0),title:"Portrait","aria-label":"Portrait orientation","aria-pressed":T,children:t.jsx(gr,{size:18})}),t.jsx("button",{className:`footer-action-btn ${T?"":"active"}`,onClick:()=>L(!1),title:"Landscape","aria-label":"Landscape orientation","aria-pressed":!T,children:t.jsx(fr,{size:18})}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:ft,title:"Home","aria-label":"Home",children:t.jsx(yi,{size:18})}),C.platform==="android"&&t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"footer-action-btn",onClick:ns,title:"Back","aria-label":"Back",children:t.jsx(cs,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:At,title:"App switcher","aria-label":"App switcher",children:t.jsx(jn,{size:18})})]}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:Rt,title:"Volume up","aria-label":"Volume up",children:t.jsx(Lr,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:Et,title:"Volume down","aria-label":"Volume down",children:t.jsx(Dr,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:$t,title:"Lock device","aria-label":"Lock device",children:t.jsx(bi,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:pt,title:"Unlock device","aria-label":"Unlock device",children:t.jsx(er,{size:18})})]})]}),t.jsxs("div",{className:"device-interactions-column",children:[t.jsxs("div",{className:"interaction-tabs",role:"tablist",children:[t.jsxs("button",{className:`tab-btn ${g==="actions"?"active":""}`,onClick:()=>b("actions"),role:"tab","aria-selected":g==="actions",children:[t.jsx(xs,{size:13}),t.jsx("span",{children:"Actions"})]}),t.jsxs("button",{className:`tab-btn ${g==="screenshot"?"active":""}`,onClick:()=>b("screenshot"),role:"tab","aria-selected":g==="screenshot",children:[t.jsx(os,{size:13}),t.jsx("span",{children:"Screenshot"})]}),t.jsxs("button",{className:`tab-btn ${g==="logs"?"active":""}`,onClick:()=>b("logs"),role:"tab","aria-selected":g==="logs",children:[t.jsx(vr,{size:13}),t.jsx("span",{children:"Logs"})]}),t.jsxs("button",{className:`tab-btn ${g==="terminal"?"active":""}`,onClick:()=>b("terminal"),role:"tab","aria-selected":g==="terminal",children:[t.jsx(bn,{size:13}),t.jsx("span",{children:"Shell"})]}),t.jsxs("button",{className:`tab-btn ${g==="omni"?"active":""}`,onClick:()=>b("omni"),role:"tab","aria-selected":g==="omni",children:[t.jsx(ys,{size:13}),t.jsx("span",{children:"Omni-Vision"})]})]}),t.jsx("div",{className:`interactions-scroll-area ${g==="terminal"?"terminal-mode":""} ${g==="screenshot"||g==="logs"?"screenshot-mode":""}`,children:t.jsxs("div",{className:"tab-content",children:[g==="omni"&&t.jsx("div",{className:"omni-inspector-tab-wrapper animate-fade-in",children:t.jsx(Cc,{sessionId:C.session_id?String(C.session_id):null,udid:C.udid,streamUrl:mt(),embedded:!0,overlayTarget:p,onModeChange:f})}),g==="actions"&&t.jsxs("div",{className:"actions-grid",children:[t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(pi,{size:18,color:"var(--color-accent)"})," Smart Input"]}),t.jsx("p",{className:"action-card-hint",children:"Relay keystrokes to the focused element on the device."}),t.jsx("input",{type:"text",className:"type-input-field compact",placeholder:"Type and press Enter to send…",value:k,onChange:x=>N(x.target.value),onKeyDown:x=>x.key==="Enter"&&Dt()})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(dr,{size:18,color:"var(--color-accent)"})," App Management"]}),t.jsxs("div",{className:"app-mgmt-content",children:[t.jsxs("div",{className:"install-section",children:[t.jsx("p",{className:"compact-label",children:"Install Package"}),t.jsxs("div",{className:"upload-box-row",children:[t.jsxs("label",{className:"file-upload-launcher",title:P?P.name:"Select an .apk, .ipa or .app file",children:[t.jsx(hi,{size:14}),t.jsx("span",{children:P?P.name:"Select File"}),t.jsx("input",{type:"file",accept:".apk,.ipa,.app",onChange:x=>{var S;return J(((S=x.target.files)==null?void 0:S[0])||null)},hidden:!0})]}),t.jsx("button",{className:"btn-premium btn-sm",disabled:!P||ke,onClick:_,children:ke?t.jsx(is,{className:"animate-spin",size:14}):"INSTALL"})]}),t.jsx("p",{className:"hint-text",children:"Accepts .apk, .ipa or .app"})]}),t.jsx("div",{className:"divider-v"}),t.jsxs("div",{className:"uninstall-section",children:[t.jsx("p",{className:"compact-label",children:"Quick Uninstall"}),t.jsxs("div",{className:"uninstall-controls-row",children:[t.jsxs("div",{className:"select-wrapper",children:[t.jsxs(Jt,{selectSize:"sm",className:"w-full",value:D,onChange:x=>$(x.target.value),disabled:ue,children:[t.jsx("option",{value:"",children:ue?"Loading apps...":"-- Select App to Remove --"}),ae.map(x=>t.jsx("option",{value:x,children:x},x))]}),ue&&t.jsx(is,{className:"animate-spin select-loader",size:12})]}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:A,disabled:!D||ue,children:[t.jsx(Wt,{size:14})," UNINSTALL"]})]}),t.jsxs("div",{className:"manual-input-box",children:[t.jsx("p",{className:"hint-text",children:"Or enter manually:"}),t.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"com.example.app",value:D,onChange:x=>$(x.target.value)})]})]})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(Wi,{size:18,color:"var(--color-accent)"})," Clipboard"]}),t.jsxs("div",{className:"clipboard-row",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:Tt,children:"FETCH VALUE"}),t.jsx("div",{className:"clipboard-display compact",children:j})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(cr,{size:18,color:"var(--color-accent)"})," Directional Gestures"]}),t.jsxs("div",{className:"gestures-grid-container",children:[t.jsxs("div",{className:"gestures-dpad",children:[t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>h("up"),children:t.jsx(zi,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>h("left"),children:t.jsx(cs,{size:24})}),t.jsx("div",{className:"dpad-center"}),t.jsx("button",{className:"dpad-btn",onClick:()=>h("right"),children:t.jsx(wn,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>h("down"),children:t.jsx(fn,{size:24})}),t.jsx("div",{})]}),t.jsx("p",{className:"compact-label dpad-caption",children:"Quick swipe in a direction"})]})]})]}),g==="screenshot"&&t.jsxs("div",{className:"action-card screenshot-card",children:[F.length>0&&t.jsx("header",{className:"action-card-header",children:t.jsx("button",{className:"btn-text-only",onClick:Mt,children:"CLEAR ALL"})}),t.jsxs("div",{className:`screenshot-workspace ${F.length===0?"is-empty":""}`,children:[t.jsxs("div",{className:"screenshot-gallery-sidebar",children:[t.jsxs("button",{className:"btn-premium take-screenshot-btn",onClick:Lt,disabled:G,children:[G?t.jsx(is,{className:"animate-spin",size:16}):t.jsx(os,{size:16}),t.jsx("span",{children:G?"CAPTURING...":"NEW CAPTURE"})]}),t.jsxs("div",{className:"screenshot-thumbnails-list",children:[F.length===0&&!G&&t.jsxs("div",{className:"empty-gallery-state",children:[t.jsx(os,{size:20,className:"empty-gallery-icon"}),t.jsx("p",{className:"empty-gallery-title",children:"No captures yet"}),t.jsx("p",{className:"empty-gallery-hint",children:"Grab a screenshot of the device to begin analysis."})]}),F.map((x,S)=>t.jsxs("div",{className:`screenshot-thumb-item ${O===S?"active":""}`,onClick:()=>U(S),children:[t.jsx("img",{src:`data:image/png;base64,${x.base64}`,alt:"Thumb"}),t.jsx("span",{className:"thumb-time",children:new Date(x.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),t.jsx("button",{className:"thumb-delete-btn",onClick:E=>{E.stopPropagation(),gt(x.id)},children:t.jsx(Wt,{size:12})})]},x.id))]})]}),t.jsx("div",{className:"screenshot-main-preview",children:O!==null&&F[O]?t.jsxs("div",{className:"preview-container",children:[t.jsx("div",{className:"preview-image-wrapper",children:t.jsx("img",{src:`data:image/png;base64,${F[O].base64}`,alt:"Selected Evidence"})}),t.jsxs("footer",{className:"preview-footer",children:[t.jsxs("div",{className:"preview-meta",children:[t.jsx("span",{className:"meta-label",children:"ID:"}),t.jsx("span",{className:"meta-value",children:F[O].id.substring(0,8)}),t.jsx("span",{className:"meta-divider",children:"|"}),t.jsx("span",{className:"meta-value",children:fi(F[O].timestamp)})]}),t.jsxs("div",{className:"preview-actions",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:()=>It(F[O].base64),children:"DOWNLOAD PNG"}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:()=>gt(F[O].id),children:[t.jsx(Wt,{size:14})," DELETE"]})]})]})]}):null})]})]}),g==="logs"&&t.jsx("div",{className:"action-card screenshot-card",children:t.jsx(Hc,{udid:C.udid,platform:C.platform})}),g==="terminal"&&t.jsx("div",{className:"action-card full-height",children:t.jsx(fc,{platform:(C.platform||"").toLowerCase(),prompt:`${(C.platform||"").toLowerCase()==="ios"?"ios":"adb"} $`,welcomeMessage:`Connected to ${C.name} (${C.udid}).
|
|
245
|
+
Internal Shell Environment.`,onCommand:async x=>{const S=await W.executeShell(C.udid,x);if(S.error)throw new Error(S.error);return S.output}})})]})})]})]}),C.session_id&&!String(C.session_id).startsWith("manual_")&&t.jsx(oi,{sessionId:String(C.session_id),mode:"slice",windowSec:60,variant:"floating"})]})}const qc=/^(INPUT|TEXTAREA|SELECT)$/;function Xc({labelledBy:e,onClose:s,children:n,style:i,...r}){const a=d.useRef(null),c=d.useRef(s);return c.current=s,d.useEffect(()=>{const l=a.current;if(!l)return;const o=document.activeElement,u=[];for(let f=l;f.parentElement&&f!==document.body;f=f.parentElement)for(const p of Array.from(f.parentElement.children))p===f||p.hasAttribute("inert")||p.matches("[aria-live], script, style, link, template")||(p.setAttribute("inert",""),u.push(p));l.contains(document.activeElement)||l.focus();const m=f=>{if(f.key!=="Escape"||f.defaultPrevented)return;const p=f.target;qc.test(p.tagName)||p.isContentEditable||(f.preventDefault(),c.current())};return l.addEventListener("keydown",m),()=>{l.removeEventListener("keydown",m),u.forEach(f=>f.removeAttribute("inert")),o&&o.isConnected&&o!==document.body&&o.focus()}},[]),t.jsx("div",{ref:a,role:"dialog","aria-modal":"true","aria-labelledby":e,tabIndex:-1,style:{outline:"none",...i},...r,children:n})}class Kc extends je.Component{constructor(s){super(s),this.socketCleanups=[],this.refreshTimeout=null,this.state={devices:[],activeSessionsCount:0,pendingSessionsCount:0,queueSummary:null,statusFilter:"all",search:"",loaded:!1}}componentDidMount(){this.fetchDevices(),this.devicePolling=setInterval(()=>{this.fetchDevices()},1e4);const s=this.props.onSocketEvent("device_unblocked",()=>{this.fetchDevicesDebounced()}),n=this.props.onSocketEvent("device_blocked",()=>{this.fetchDevicesDebounced()});this.socketCleanups.push(s,n)}componentWillUnmount(){this.devicePolling&&(clearInterval(this.devicePolling),this.devicePolling=void 0),this.refreshTimeout&&(clearTimeout(this.refreshTimeout),this.refreshTimeout=null),this.socketCleanups.forEach(s=>s())}fetchDevicesDebounced(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>{this.refreshTimeout=null,this.fetchDevices()},500)}getBusyDevicesCount(s){return s.filter(n=>n.busy).length}async fetchDevices(){try{const s=await W.getDevices(),n=this.getBusyDevicesCount(s),i=await W.getPendingSessionsCount(),r=await W.getQueueSummary();this.setState({devices:s,activeSessionsCount:n,pendingSessionsCount:i,queueSummary:r,loaded:!0})}catch(s){console.log(s),this.setState({loaded:!0})}}getFiltered(){const s=Date.now(),n=r=>!!(r.reservedUntil&&s<r.reservedUntil),i=this.state.search.trim().toLowerCase();return this.state.devices.filter(r=>{if(i&&!`${r.name} ${r.udid}`.toLowerCase().includes(i))return!1;switch(this.state.statusFilter){case"all":return!0;case"offline":return r.offline;case"busy":return r.busy&&!r.offline;case"reserved":return n(r)&&!r.busy&&!r.offline;case"ready":return!r.offline&&!r.busy&&!n(r)&&!r.userBlocked;default:return!0}})}statusCount(s){const n=Date.now(),i=r=>!!(r.reservedUntil&&n<r.reservedUntil);switch(s){case"all":return this.state.devices.length;case"offline":return this.state.devices.filter(r=>r.offline).length;case"busy":return this.state.devices.filter(r=>r.busy&&!r.offline).length;case"reserved":return this.state.devices.filter(r=>i(r)&&!r.busy&&!r.offline).length;case"ready":return this.state.devices.filter(r=>!r.offline&&!r.busy&&!i(r)&&!r.userBlocked).length}}render(){const s=this.getFiltered(),{udid:n}=this.props.params,i=n?this.state.devices.find(r=>r.udid===n):null;return t.jsxs("div",{className:"device-explorer-container",children:[t.jsxs("div",{className:"de2-sticky-group",children:[t.jsx(ri,{icon:Ps,title:"Devices",subtitle:`${this.state.devices.length} device${this.state.devices.length===1?"":"s"} registered across the global pool.`}),t.jsxs("div",{className:"de2-toolbar",children:[t.jsx(wi,{size:"sm",value:this.state.statusFilter,onChange:r=>this.setState({statusFilter:r}),segments:[{value:"all",label:"All",count:this.statusCount("all")},{value:"ready",label:"Ready",count:this.statusCount("ready")},{value:"busy",label:"Busy",count:this.statusCount("busy")},{value:"reserved",label:"Reserved",count:this.statusCount("reserved")},{value:"offline",label:"Offline",count:this.statusCount("offline")}]}),t.jsx("input",{type:"text",className:"de2-search",placeholder:"Search by name or UDID…",value:this.state.search,onChange:r=>this.setState({search:r.target.value})}),t.jsxs(tt,{variant:"secondary",size:"sm",onClick:()=>this.fetchDevices(),children:[t.jsx(rs,{size:12})," Refresh"]})]})]}),s.length>0?t.jsx(ac,{devices:s,reloadDevices:()=>this.fetchDevices()}):t.jsxs("div",{className:"device-explorer-empty stagger-1",children:[t.jsx("div",{className:"device-explorer-empty-icon",children:this.state.loaded?t.jsx(Ps,{size:32}):t.jsx(rs,{size:32,className:"animate-spin"})}),this.state.loaded?this.state.devices.length===0?t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"Global Device Registry Empty"}),t.jsx("p",{children:"Xenon hasn't detected any active device nodes in your infrastructure. Ensure your device farm is connected and heartbeat signals are active."}),t.jsxs(tt,{variant:"primary",onClick:()=>this.fetchDevices(),children:[t.jsx(rs,{size:14}),"Manual sync"]})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"No Devices Found"}),t.jsx("p",{children:"Deployment configuration mismatch. Adjust your platform or state filters to find the appropriate testing target."}),t.jsx(tt,{variant:"secondary",onClick:()=>this.setState({statusFilter:"all",search:""}),children:"Reset filters"})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"Loading devices…"}),t.jsx("p",{children:"Syncing the global device registry."})]})]}),i&&t.jsx(Xc,{className:"device-control-modal-overlay",labelledBy:"device-control-title",onClose:()=>this.props.navigate("/devices"),children:t.jsx("div",{className:"device-control-modal",children:t.jsx(Vc,{device:i,titleId:"device-control-title",onClose:()=>this.props.navigate("/devices")})})})]})}}function wl(){const e=pn(),s=ks(),{on:n}=ii();return t.jsx(Kc,{params:e,navigate:s,onSocketEvent:n})}export{Kc as DeviceExplorer,wl as default};
|