@xenon-device-management/xenon 1.26.2 → 1.28.0
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-vELAdQLu.js → ApiKeyGate-CYrHWuf9.js} +1 -1
- package/lib/public/assets/{BugReportButton-ySiZDywe.js → BugReportButton-CRRZnSs2.js} +1 -1
- package/lib/public/assets/{DeviceMosaicView-Chtp0wAI.js → DeviceMosaicView-Dw7dK-Ri.js} +1 -1
- package/lib/public/assets/{EmptyState-CYQYScPo.js → EmptyState-BDSDbxbe.js} +1 -1
- package/lib/public/assets/{FieldGroup-Dea68RfI.js → FieldGroup-DTSy35Hp.js} +1 -1
- package/lib/public/assets/{Modal-BgzTzImP.js → Modal-BC9RPZeO.js} +1 -1
- package/lib/public/assets/{SegmentedControl-DyRq9blY.js → SegmentedControl-DUw7pxfw.js} +1 -1
- package/lib/public/assets/{SettingCard-CardwBu3.js → SettingCard-DwHb-9y7.js} +1 -1
- package/lib/public/assets/{Table-BczCxsDm.js → Table-C167c0iD.js} +1 -1
- package/lib/public/assets/{activity-CS-Op-T6.js → activity-C8ktgelv.js} +1 -1
- package/lib/public/assets/{ai-settings-CIvB7rNM.js → ai-settings-BtH8D-Vk.js} +3 -3
- package/lib/public/assets/{api-keys-peJzllzQ.js → api-keys-D0CPHe_-.js} +1 -1
- package/lib/public/assets/{apps-__WvcJaP.js → apps-f6Z9888a.js} +3 -3
- package/lib/public/assets/{arrow-left-Dx-cXFLT.js → arrow-left-CEnrTC1h.js} +1 -1
- package/lib/public/assets/{arrow-right-Ax_FfBMv.js → arrow-right-DJbja5Vo.js} +1 -1
- package/lib/public/assets/{arrow-up-right-B6uJmGeA.js → arrow-up-right-DvIZquNN.js} +1 -1
- package/lib/public/assets/{auth-shell-BQqcjjC9.js → auth-shell-5XCL86e9.js} +2 -2
- package/lib/public/assets/{builds-page-BA-_iEjx.js → builds-page-DQbsMgZp.js} +1 -1
- package/lib/public/assets/{button-DcbnByKB.js → button-CMj-iXRu.js} +1 -1
- package/lib/public/assets/{calendar-C3pYg1V7.js → calendar-BKb9JzMb.js} +1 -1
- package/lib/public/assets/{check-DKdLfzhJ.js → check-BioFa43z.js} +1 -1
- package/lib/public/assets/{chevron-left-Bb9PBLG5.js → chevron-left-BfiSwNHE.js} +1 -1
- package/lib/public/assets/{chevron-right-DJcpeY_o.js → chevron-right-BLqjv9Fz.js} +1 -1
- package/lib/public/assets/{circle-check-DY6ntqp3.js → circle-check-N7nCeFZH.js} +1 -1
- package/lib/public/assets/{circle-x-DgK9drRH.js → circle-x-DzRW2cW-.js} +1 -1
- package/lib/public/assets/{clock-I9zEVPan.js → clock-Q8bhs7zV.js} +1 -1
- package/lib/public/assets/{copy-Dy3oRuWT.js → copy-Dh1ppPe1.js} +1 -1
- package/lib/public/assets/device-explorer-Cbwojnbb.js +277 -0
- package/lib/public/assets/device-explorer-CcLOID3w.css +1 -0
- package/lib/public/assets/{download-BotTmDty.js → download-Dit5_Lob.js} +1 -1
- package/lib/public/assets/{forgot-password-BaWiD2U2.js → forgot-password-yhK1Eo6h.js} +1 -1
- package/lib/public/assets/{funnel-D2Qw4nTX.js → funnel-DQo9dvhT.js} +1 -1
- package/lib/public/assets/{index-CI9Nz3HY.js → index-kcl0icXA.js} +2 -2
- package/lib/public/assets/{input-cBBGau4X.js → input-DwXEwtQD.js} +1 -1
- package/lib/public/assets/{keycodes-CY4uwulo.js → keycodes-mlL7WkFd.js} +1 -1
- package/lib/public/assets/{layers-MHwJM2Ll.js → layers-DFEJsDA2.js} +1 -1
- package/lib/public/assets/{lock-Bpc8rJFu.js → lock-DVGX1wMR.js} +1 -1
- package/lib/public/assets/{login-BmcyszP5.js → login-BtczO6mT.js} +1 -1
- package/lib/public/assets/{maintenance-settings-DMFVuToe.js → maintenance-settings-BNkCNkdA.js} +2 -2
- package/lib/public/assets/{monitor-irjK6PRV.js → monitor-DXiFh_zm.js} +1 -1
- package/lib/public/assets/mouse-pointer-2-iiFLrBfo.js +6 -0
- package/lib/public/assets/{network-CVZ32MhH.js → network-D-64m0lI.js} +1 -1
- package/lib/public/assets/{overview-DRRSIpnD.js → overview-Bs8fij0f.js} +1 -1
- package/lib/public/assets/{page-header-Bl7uTiQF.js → page-header-2aP5HfMz.js} +1 -1
- package/lib/public/assets/{plus-C3lvaMcL.js → plus-l0nFcN3u.js} +1 -1
- package/lib/public/assets/{profile-page-B3wsnR1n.js → profile-page-DRQxEDPv.js} +1 -1
- package/lib/public/assets/{reset-password-BIGj_ULj.js → reset-password-TeZbTlY3.js} +1 -1
- package/lib/public/assets/{runbook-page-DEznNZhc.js → runbook-page-CfB3Sgqd.js} +1 -1
- package/lib/public/assets/{select-BpuZWZuE.js → select-CfLeV0bn.js} +1 -1
- package/lib/public/assets/{selector-detail-page-ZCvmtQ5Y.js → selector-detail-page-sjSLgf2y.js} +1 -1
- package/lib/public/assets/{selector-health-D-hvfY2E.js → selector-health-DobHOezq.js} +1 -1
- package/lib/public/assets/{selector-health-page-C0ZqZ_VT.js → selector-health-page-BeGTmjeJ.js} +1 -1
- package/lib/public/assets/{session-detail-page-Bv7IwFTQ.js → session-detail-page-B7Be2Uxw.js} +1 -1
- package/lib/public/assets/settings-DWlkn05y.js +6 -0
- package/lib/public/assets/{status-pill-outline-B5dWsaer.js → status-pill-outline-DqZaavRm.js} +1 -1
- package/lib/public/assets/{tablet-DxwkBlhd.js → tablet-D2ApmdVm.js} +1 -1
- package/lib/public/assets/{teams-D3s8GhkG.js → teams-DVm0mUGI.js} +1 -1
- package/lib/public/assets/{trash-2-Dyf4Jcyk.js → trash-2-BklI15pS.js} +1 -1
- package/lib/public/assets/{upload-B6ZJ1_f1.js → upload-BMYoLWMh.js} +1 -1
- package/lib/public/assets/{use-password-reset-mode-B-oOrt1d.js → use-password-reset-mode-Dx_zeU5K.js} +1 -1
- package/lib/public/assets/{users-QfiFclLn.js → users-CnVdUoqL.js} +1 -1
- package/lib/public/assets/{users-BfvPE2wX.js → users-DqVUPDed.js} +1 -1
- package/lib/public/assets/{video-off-C2quR4KF.js → video-off-DEmVhLd9.js} +1 -1
- package/lib/public/assets/{webhook-settings-BjbGi-Pi.js → webhook-settings-CHpCrpob.js} +1 -1
- package/lib/public/assets/{zap-C2lxP7TK.js → zap-ovWf2UbO.js} +1 -1
- package/lib/public/index.html +1 -1
- package/lib/src/app/routers/control.js +5 -0
- package/lib/src/device-managers/AndroidDeviceManager.js +31 -95
- package/lib/src/device-managers/HealthMonitorService.js +10 -6
- package/lib/src/device-managers/android/AndroidH264StreamService.js +6 -1
- package/lib/src/device-managers/android/AndroidStreamService.js +9 -18
- package/lib/src/device-managers/android/clipboardBroadcast.js +24 -0
- package/lib/src/device-managers/android/previewHold.js +72 -0
- package/lib/src/device-managers/clipboardErrors.js +15 -0
- package/lib/test/unit/android-clipboard.spec.js +147 -0
- package/lib/test/unit/android-preview-hold.spec.js +179 -0
- package/lib/test/unit/clipboard-route.spec.js +110 -0
- package/lib/test/unit/health-monitor-stream-lookup.spec.js +107 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/lib/public/assets/device-explorer-BPyGYs0c.js +0 -246
- package/lib/public/assets/device-explorer-C9qg30Jn.css +0 -1
- package/lib/public/assets/mouse-pointer-2-CYkC-Dyq.js +0 -11
- package/lib/public/assets/settings-DCR9vnQ5.js +0 -1
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import{c as V,r as d,t as Mn,j as n,R as mr,v as fr,w as je,C as Rs,U as hr,X as U,x as it,y as qn,u as rn,a as Kn,b as pr,T as yr,q as _n,z as xr,A as Le,B as Xn,I as ri,S as Pt,f as Ct,D as Ut,i as ai,E as gr,p as vr}from"./index-kcl0icXA.js";import{P as br}from"./page-header-2aP5HfMz.js";import{B as se}from"./button-CMj-iXRu.js";import{S as Yn}from"./select-CfLeV0bn.js";import{P as Ht,B as wr}from"./BugReportButton-CRRZnSs2.js";import{P as Rt,u as Yt,a as kt,b as oi,c as Gn,d as jr,D as Nr,e as Es,f as Cr,g as ft,h as Sr,M as Zn}from"./Modal-BC9RPZeO.js";import{C as pt}from"./check-BioFa43z.js";import{F as Vt}from"./FieldGroup-DTSy35Hp.js";import{C as kr}from"./clock-Q8bhs7zV.js";import{P as ci}from"./plus-l0nFcN3u.js";import{A as Ar}from"./activity-C8ktgelv.js";import{p as Jn}from"./labels-C21SA4JG.js";import{C as Oe}from"./copy-Dh1ppPe1.js";import{T as Rr}from"./tablet-D2ApmdVm.js";import{f as Er}from"./time-B8FIgwPE.js";import{L as li}from"./layers-DFEJsDA2.js";import{C as $r}from"./chevron-right-BLqjv9Fz.js";import{M as $s}from"./mouse-pointer-2-iiFLrBfo.js";import{Z as di}from"./zap-ovWf2UbO.js";import{C as ui}from"./circle-check-N7nCeFZH.js";import{C as mi}from"./circle-x-DzRW2cW-.js";import{S as fi,C as Tr,H as Ir,a as jn,A as Nt,I as Nn}from"./keycodes-mlL7WkFd.js";import{D as Dr}from"./download-Dit5_Lob.js";import{T as Ln}from"./trash-2-BklI15pS.js";import{U as Mr,T as _r}from"./upload-BMYoLWMh.js";import{A as Lr}from"./arrow-left-CEnrTC1h.js";import{A as Or}from"./arrow-right-DJbja5Vo.js";import{C as Ts}from"./chevron-left-BfiSwNHE.js";import{L as zr}from"./lock-DVGX1wMR.js";import{S as Pr}from"./SegmentedControl-DUw7pxfw.js";import"./utils-CDN07tui.js";/**
|
|
2
|
+
* @license lucide-react v0.555.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Fr=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],hi=V("arrow-down",Fr);/**
|
|
7
|
+
* @license lucide-react v0.555.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Br=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],pi=V("arrow-up",Br);/**
|
|
12
|
+
* @license lucide-react v0.555.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const Wr=[["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"}]],Ur=V("battery-low",Wr);/**
|
|
17
|
+
* @license lucide-react v0.555.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const Hr=[["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"}]],Vr=V("battery-warning",Hr);/**
|
|
22
|
+
* @license lucide-react v0.555.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const qr=[["path",{d:"M 22 14 L 22 10",key:"nqc4tb"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],Kr=V("battery",qr);/**
|
|
27
|
+
* @license lucide-react v0.555.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const Xr=[["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"}]],Yr=V("box",Xr);/**
|
|
32
|
+
* @license lucide-react v0.555.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const Gr=[["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"}]],Zr=V("calendar-plus",Gr);/**
|
|
37
|
+
* @license lucide-react v0.555.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const Jr=[["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"}]],Qr=V("case-sensitive",Jr);/**
|
|
42
|
+
* @license lucide-react v0.555.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const ea=[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]],ta=V("chevrons-down-up",ea);/**
|
|
47
|
+
* @license lucide-react v0.555.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const na=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],sa=V("chevrons-up-down",na);/**
|
|
52
|
+
* @license lucide-react v0.555.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const ia=[["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"}]],ra=V("circle-question-mark",ia);/**
|
|
57
|
+
* @license lucide-react v0.555.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const aa=[["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"}]],Is=V("code-xml",aa);/**
|
|
62
|
+
* @license lucide-react v0.555.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const oa=[["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"}]],ca=V("crosshair",oa);/**
|
|
67
|
+
* @license lucide-react v0.555.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const la=[["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"}]],da=V("ellipsis",la);/**
|
|
72
|
+
* @license lucide-react v0.555.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const ua=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],ma=V("hand",ua);/**
|
|
77
|
+
* @license lucide-react v0.555.0 - ISC
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the ISC license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/const fa=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],ha=V("image",fa);/**
|
|
82
|
+
* @license lucide-react v0.555.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/const pa=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],ya=V("keyboard",pa);/**
|
|
87
|
+
* @license lucide-react v0.555.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/const xa=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],ga=V("library",xa);/**
|
|
92
|
+
* @license lucide-react v0.555.0 - ISC
|
|
93
|
+
*
|
|
94
|
+
* This source code is licensed under the ISC license.
|
|
95
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
+
*/const va=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]],ba=V("list-checks",va);/**
|
|
97
|
+
* @license lucide-react v0.555.0 - ISC
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the ISC license.
|
|
100
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/const wa=[["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"}]],ja=V("lock-open",wa);/**
|
|
102
|
+
* @license lucide-react v0.555.0 - ISC
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the ISC license.
|
|
105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/const Na=[["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"}]],Ca=V("map-pin",Na);/**
|
|
107
|
+
* @license lucide-react v0.555.0 - ISC
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the ISC license.
|
|
110
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
+
*/const Sa=[["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"}]],ka=V("message-square",Sa);/**
|
|
112
|
+
* @license lucide-react v0.555.0 - ISC
|
|
113
|
+
*
|
|
114
|
+
* This source code is licensed under the ISC license.
|
|
115
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
+
*/const Aa=[["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"}]],Ra=V("moon-star",Aa);/**
|
|
117
|
+
* @license lucide-react v0.555.0 - ISC
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the ISC license.
|
|
120
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
+
*/const Ea=[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]],$a=V("mouse-pointer-click",Ea);/**
|
|
122
|
+
* @license lucide-react v0.555.0 - ISC
|
|
123
|
+
*
|
|
124
|
+
* This source code is licensed under the ISC license.
|
|
125
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
+
*/const Ta=[["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"}]],Ia=V("package",Ta);/**
|
|
127
|
+
* @license lucide-react v0.555.0 - ISC
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the ISC license.
|
|
130
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
+
*/const Da=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]],Ma=V("panel-top",Da);/**
|
|
132
|
+
* @license lucide-react v0.555.0 - ISC
|
|
133
|
+
*
|
|
134
|
+
* This source code is licensed under the ISC license.
|
|
135
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
136
|
+
*/const _a=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]],La=V("rectangle-horizontal",_a);/**
|
|
137
|
+
* @license lucide-react v0.555.0 - ISC
|
|
138
|
+
*
|
|
139
|
+
* This source code is licensed under the ISC license.
|
|
140
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
141
|
+
*/const Oa=[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]],za=V("rectangle-vertical",Oa);/**
|
|
142
|
+
* @license lucide-react v0.555.0 - ISC
|
|
143
|
+
*
|
|
144
|
+
* This source code is licensed under the ISC license.
|
|
145
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
146
|
+
*/const Pa=[["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"}]],St=V("rotate-cw",Pa);/**
|
|
147
|
+
* @license lucide-react v0.555.0 - ISC
|
|
148
|
+
*
|
|
149
|
+
* This source code is licensed under the ISC license.
|
|
150
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
151
|
+
*/const Fa=[["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"}]],yi=V("scroll-text",Fa);/**
|
|
152
|
+
* @license lucide-react v0.555.0 - ISC
|
|
153
|
+
*
|
|
154
|
+
* This source code is licensed under the ISC license.
|
|
155
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
156
|
+
*/const Ba=[["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"}]],mt=V("shield-alert",Ba);/**
|
|
157
|
+
* @license lucide-react v0.555.0 - ISC
|
|
158
|
+
*
|
|
159
|
+
* This source code is licensed under the ISC license.
|
|
160
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
161
|
+
*/const Wa=[["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"}]],Ua=V("sparkles",Wa);/**
|
|
162
|
+
* @license lucide-react v0.555.0 - ISC
|
|
163
|
+
*
|
|
164
|
+
* This source code is licensed under the ISC license.
|
|
165
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
166
|
+
*/const Ha=[["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"}]],Va=V("tag",Ha);/**
|
|
167
|
+
* @license lucide-react v0.555.0 - ISC
|
|
168
|
+
*
|
|
169
|
+
* This source code is licensed under the ISC license.
|
|
170
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
171
|
+
*/const qa=[["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"}]],Cn=V("target",qa);/**
|
|
172
|
+
* @license lucide-react v0.555.0 - ISC
|
|
173
|
+
*
|
|
174
|
+
* This source code is licensed under the ISC license.
|
|
175
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
176
|
+
*/const Ka=[["path",{d:"M12 20h-1a2 2 0 0 1-2-2 2 2 0 0 1-2 2H6",key:"1528k5"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M6 4h1a2 2 0 0 1 2 2 2 2 0 0 1 2-2h1",key:"1mj8rg"}],["path",{d:"M9 6v12",key:"velyjx"}]],Xa=V("text-cursor-input",Ka);/**
|
|
177
|
+
* @license lucide-react v0.555.0 - ISC
|
|
178
|
+
*
|
|
179
|
+
* This source code is licensed under the ISC license.
|
|
180
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
181
|
+
*/const Ya=[["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"}]],Ga=V("text-wrap",Ya);/**
|
|
182
|
+
* @license lucide-react v0.555.0 - ISC
|
|
183
|
+
*
|
|
184
|
+
* This source code is licensed under the ISC license.
|
|
185
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
186
|
+
*/const Za=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],Ja=V("thermometer",Za);/**
|
|
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 Qa=[["circle",{cx:"9",cy:"12",r:"3",key:"u3jwor"}],["rect",{width:"20",height:"14",x:"2",y:"5",rx:"7",key:"g7kal2"}]],eo=V("toggle-left",Qa);/**
|
|
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 to=[["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"}]],Ds=V("touchpad",to);/**
|
|
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 no=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],so=V("type",no);/**
|
|
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 io=[["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"}]],ro=V("volume-1",io);/**
|
|
207
|
+
* @license lucide-react v0.555.0 - ISC
|
|
208
|
+
*
|
|
209
|
+
* This source code is licensed under the ISC license.
|
|
210
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
211
|
+
*/const ao=[["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"}]],oo=V("volume-2",ao);/**
|
|
212
|
+
* @license lucide-react v0.555.0 - ISC
|
|
213
|
+
*
|
|
214
|
+
* This source code is licensed under the ISC license.
|
|
215
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
216
|
+
*/const co=[["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"}]],lo=V("wifi",co),uo=["top","right","bottom","left"],Ke=Math.min,ye=Math.max,Gt=Math.round,Ft=Math.floor,Te=e=>({x:e,y:e}),mo={left:"right",right:"left",bottom:"top",top:"bottom"};function On(e,t,s){return ye(e,Ke(t,s))}function Pe(e,t){return typeof e=="function"?e(t):e}function Fe(e){return e.split("-")[0]}function gt(e){return e.split("-")[1]}function Qn(e){return e==="x"?"y":"x"}function es(e){return e==="y"?"height":"width"}function $e(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ts(e){return Qn($e(e))}function fo(e,t,s){s===void 0&&(s=!1);const i=gt(e),r=ts(e),a=es(r);let c=r==="x"?i===(s?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(c=Zt(c)),[c,Zt(c)]}function ho(e){const t=Zt(e);return[zn(e),t,zn(t)]}function zn(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ms=["left","right"],_s=["right","left"],po=["top","bottom"],yo=["bottom","top"];function xo(e,t,s){switch(e){case"top":case"bottom":return s?t?_s:Ms:t?Ms:_s;case"left":case"right":return t?po:yo;default:return[]}}function go(e,t,s,i){const r=gt(e);let a=xo(Fe(e),s==="start",i);return r&&(a=a.map(c=>c+"-"+r),t&&(a=a.concat(a.map(zn)))),a}function Zt(e){const t=Fe(e);return mo[t]+e.slice(t.length)}function vo(e){return{top:0,right:0,bottom:0,left:0,...e}}function xi(e){return typeof e!="number"?vo(e):{top:e,right:e,bottom:e,left:e}}function Jt(e){const{x:t,y:s,width:i,height:r}=e;return{width:i,height:r,top:s,left:t,right:t+i,bottom:s+r,x:t,y:s}}function Ls(e,t,s){let{reference:i,floating:r}=e;const a=$e(t),c=ts(t),l=es(c),u=Fe(t),o=a==="y",m=i.x+i.width/2-r.width/2,h=i.y+i.height/2-r.height/2,x=i[l]/2-r[l]/2;let f;switch(u){case"top":f={x:m,y:i.y-r.height};break;case"bottom":f={x:m,y:i.y+i.height};break;case"right":f={x:i.x+i.width,y:h};break;case"left":f={x:i.x-r.width,y:h};break;default:f={x:i.x,y:i.y}}switch(gt(t)){case"start":f[c]-=x*(s&&o?-1:1);break;case"end":f[c]+=x*(s&&o?-1:1);break}return f}async function bo(e,t){var s;t===void 0&&(t={});const{x:i,y:r,platform:a,rects:c,elements:l,strategy:u}=e,{boundary:o="clippingAncestors",rootBoundary:m="viewport",elementContext:h="floating",altBoundary:x=!1,padding:f=0}=Pe(t,e),y=xi(f),g=l[x?h==="floating"?"reference":"floating":h],C=Jt(await a.getClippingRect({element:(s=await(a.isElement==null?void 0:a.isElement(g)))==null||s?g:g.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:o,rootBoundary:m,strategy:u})),N=h==="floating"?{x:i,y:r,width:c.floating.width,height:c.floating.height}:c.reference,v=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),p=await(a.isElement==null?void 0:a.isElement(v))?await(a.getScale==null?void 0:a.getScale(v))||{x:1,y:1}:{x:1,y:1},j=Jt(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:v,strategy:u}):N);return{top:(C.top-j.top+y.top)/p.y,bottom:(j.bottom-C.bottom+y.bottom)/p.y,left:(C.left-j.left+y.left)/p.x,right:(j.right-C.right+y.right)/p.x}}const wo=50,jo=async(e,t,s)=>{const{placement:i="bottom",strategy:r="absolute",middleware:a=[],platform:c}=s,l=c.detectOverflow?c:{...c,detectOverflow:bo},u=await(c.isRTL==null?void 0:c.isRTL(t));let o=await c.getElementRects({reference:e,floating:t,strategy:r}),{x:m,y:h}=Ls(o,i,u),x=i,f=0;const y={};for(let w=0;w<a.length;w++){const g=a[w];if(!g)continue;const{name:C,fn:N}=g,{x:v,y:p,data:j,reset:k}=await N({x:m,y:h,initialPlacement:i,placement:x,strategy:r,middlewareData:y,rects:o,platform:l,elements:{reference:e,floating:t}});m=v??m,h=p??h,y[C]={...y[C],...j},k&&f<wo&&(f++,typeof k=="object"&&(k.placement&&(x=k.placement),k.rects&&(o=k.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:r}):k.rects),{x:m,y:h}=Ls(o,x,u)),w=-1)}return{x:m,y:h,placement:x,strategy:r,middlewareData:y}},No=e=>({name:"arrow",options:e,async fn(t){const{x:s,y:i,placement:r,rects:a,platform:c,elements:l,middlewareData:u}=t,{element:o,padding:m=0}=Pe(e,t)||{};if(o==null)return{};const h=xi(m),x={x:s,y:i},f=ts(r),y=es(f),w=await c.getDimensions(o),g=f==="y",C=g?"top":"left",N=g?"bottom":"right",v=g?"clientHeight":"clientWidth",p=a.reference[y]+a.reference[f]-x[f]-a.floating[y],j=x[f]-a.reference[f],k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(o));let A=k?k[v]:0;(!A||!await(c.isElement==null?void 0:c.isElement(k)))&&(A=l.floating[v]||a.floating[y]);const T=p/2-j/2,z=A/2-w[y]/2-1,M=Ke(h[C],z),O=Ke(h[N],z),Y=M,S=A-w[y]-O,q=A/2-w[y]/2+T,G=On(Y,q,S),B=!u.arrow&>(r)!=null&&q!==G&&a.reference[y]/2-(q<Y?M:O)-w[y]/2<0,D=B?q<Y?q-Y:q-S:0;return{[f]:x[f]+D,data:{[f]:G,centerOffset:q-G-D,...B&&{alignmentOffset:D}},reset:B}}}),Co=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var s,i;const{placement:r,middlewareData:a,rects:c,initialPlacement:l,platform:u,elements:o}=t,{mainAxis:m=!0,crossAxis:h=!0,fallbackPlacements:x,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:w=!0,...g}=Pe(e,t);if((s=a.arrow)!=null&&s.alignmentOffset)return{};const C=Fe(r),N=$e(l),v=Fe(l)===l,p=await(u.isRTL==null?void 0:u.isRTL(o.floating)),j=x||(v||!w?[Zt(l)]:ho(l)),k=y!=="none";!x&&k&&j.push(...go(l,w,y,p));const A=[l,...j],T=await u.detectOverflow(t,g),z=[];let M=((i=a.flip)==null?void 0:i.overflows)||[];if(m&&z.push(T[C]),h){const q=fo(r,c,p);z.push(T[q[0]],T[q[1]])}if(M=[...M,{placement:r,overflows:z}],!z.every(q=>q<=0)){var O,Y;const q=(((O=a.flip)==null?void 0:O.index)||0)+1,G=A[q];if(G&&(!(h==="alignment"?N!==$e(G):!1)||M.every(R=>$e(R.placement)===N?R.overflows[0]>0:!0)))return{data:{index:q,overflows:M},reset:{placement:G}};let B=(Y=M.filter(D=>D.overflows[0]<=0).sort((D,R)=>D.overflows[1]-R.overflows[1])[0])==null?void 0:Y.placement;if(!B)switch(f){case"bestFit":{var S;const D=(S=M.filter(R=>{if(k){const K=$e(R.placement);return K===N||K==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(K=>K>0).reduce((K,Q)=>K+Q,0)]).sort((R,K)=>R[1]-K[1])[0])==null?void 0:S[0];D&&(B=D);break}case"initialPlacement":B=l;break}if(r!==B)return{reset:{placement:B}}}return{}}}};function Os(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zs(e){return uo.some(t=>e[t]>=0)}const So=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:s,platform:i}=t,{strategy:r="referenceHidden",...a}=Pe(e,t);switch(r){case"referenceHidden":{const c=await i.detectOverflow(t,{...a,elementContext:"reference"}),l=Os(c,s.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:zs(l)}}}case"escaped":{const c=await i.detectOverflow(t,{...a,altBoundary:!0}),l=Os(c,s.floating);return{data:{escapedOffsets:l,escaped:zs(l)}}}default:return{}}}}},gi=new Set(["left","top"]);async function ko(e,t){const{placement:s,platform:i,elements:r}=e,a=await(i.isRTL==null?void 0:i.isRTL(r.floating)),c=Fe(s),l=gt(s),u=$e(s)==="y",o=gi.has(c)?-1:1,m=a&&u?-1:1,h=Pe(t,e);let{mainAxis:x,crossAxis:f,alignmentAxis:y}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof y=="number"&&(f=l==="end"?y*-1:y),u?{x:f*m,y:x*o}:{x:x*o,y:f*m}}const Ao=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var s,i;const{x:r,y:a,placement:c,middlewareData:l}=t,u=await ko(t,e);return c===((s=l.offset)==null?void 0:s.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:r+u.x,y:a+u.y,data:{...u,placement:c}}}}},Ro=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:s,y:i,placement:r,platform:a}=t,{mainAxis:c=!0,crossAxis:l=!1,limiter:u={fn:C=>{let{x:N,y:v}=C;return{x:N,y:v}}},...o}=Pe(e,t),m={x:s,y:i},h=await a.detectOverflow(t,o),x=$e(Fe(r)),f=Qn(x);let y=m[f],w=m[x];if(c){const C=f==="y"?"top":"left",N=f==="y"?"bottom":"right",v=y+h[C],p=y-h[N];y=On(v,y,p)}if(l){const C=x==="y"?"top":"left",N=x==="y"?"bottom":"right",v=w+h[C],p=w-h[N];w=On(v,w,p)}const g=u.fn({...t,[f]:y,[x]:w});return{...g,data:{x:g.x-s,y:g.y-i,enabled:{[f]:c,[x]:l}}}}}},Eo=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:s,y:i,placement:r,rects:a,middlewareData:c}=t,{offset:l=0,mainAxis:u=!0,crossAxis:o=!0}=Pe(e,t),m={x:s,y:i},h=$e(r),x=Qn(h);let f=m[x],y=m[h];const w=Pe(l,t),g=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(u){const v=x==="y"?"height":"width",p=a.reference[x]-a.floating[v]+g.mainAxis,j=a.reference[x]+a.reference[v]-g.mainAxis;f<p?f=p:f>j&&(f=j)}if(o){var C,N;const v=x==="y"?"width":"height",p=gi.has(Fe(r)),j=a.reference[h]-a.floating[v]+(p&&((C=c.offset)==null?void 0:C[h])||0)+(p?0:g.crossAxis),k=a.reference[h]+a.reference[v]+(p?0:((N=c.offset)==null?void 0:N[h])||0)-(p?g.crossAxis:0);y<j?y=j:y>k&&(y=k)}return{[x]:f,[h]:y}}}},$o=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var s,i;const{placement:r,rects:a,platform:c,elements:l}=t,{apply:u=()=>{},...o}=Pe(e,t),m=await c.detectOverflow(t,o),h=Fe(r),x=gt(r),f=$e(r)==="y",{width:y,height:w}=a.floating;let g,C;h==="top"||h==="bottom"?(g=h,C=x===(await(c.isRTL==null?void 0:c.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,g=x==="end"?"top":"bottom");const N=w-m.top-m.bottom,v=y-m.left-m.right,p=Ke(w-m[g],N),j=Ke(y-m[C],v),k=!t.middlewareData.shift;let A=p,T=j;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(T=v),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(A=N),k&&!x){const M=ye(m.left,0),O=ye(m.right,0),Y=ye(m.top,0),S=ye(m.bottom,0);f?T=y-2*(M!==0||O!==0?M+O:ye(m.left,m.right)):A=w-2*(Y!==0||S!==0?Y+S:ye(m.top,m.bottom))}await u({...t,availableWidth:T,availableHeight:A});const z=await c.getDimensions(l.floating);return y!==z.width||w!==z.height?{reset:{rects:!0}}:{}}}};function an(){return typeof window<"u"}function vt(e){return vi(e)?(e.nodeName||"").toLowerCase():"#document"}function xe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ie(e){var t;return(t=(vi(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function vi(e){return an()?e instanceof Node||e instanceof xe(e).Node:!1}function Ae(e){return an()?e instanceof Element||e instanceof xe(e).Element:!1}function We(e){return an()?e instanceof HTMLElement||e instanceof xe(e).HTMLElement:!1}function Ps(e){return!an()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof xe(e).ShadowRoot}function Et(e){const{overflow:t,overflowX:s,overflowY:i,display:r}=Re(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+s)&&r!=="inline"&&r!=="contents"}function To(e){return/^(table|td|th)$/.test(vt(e))}function on(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Io=/transform|translate|scale|rotate|perspective|filter/,Do=/paint|layout|strict|content/,et=e=>!!e&&e!=="none";let Sn;function ns(e){const t=Ae(e)?Re(e):e;return et(t.transform)||et(t.translate)||et(t.scale)||et(t.rotate)||et(t.perspective)||!ss()&&(et(t.backdropFilter)||et(t.filter))||Io.test(t.willChange||"")||Do.test(t.contain||"")}function Mo(e){let t=Xe(e);for(;We(t)&&!yt(t);){if(ns(t))return t;if(on(t))return null;t=Xe(t)}return null}function ss(){return Sn==null&&(Sn=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Sn}function yt(e){return/^(html|body|#document)$/.test(vt(e))}function Re(e){return xe(e).getComputedStyle(e)}function cn(e){return Ae(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xe(e){if(vt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ps(e)&&e.host||Ie(e);return Ps(t)?t.host:t}function bi(e){const t=Xe(e);return yt(t)?e.ownerDocument?e.ownerDocument.body:e.body:We(t)&&Et(t)?t:bi(t)}function At(e,t,s){var i;t===void 0&&(t=[]),s===void 0&&(s=!0);const r=bi(e),a=r===((i=e.ownerDocument)==null?void 0:i.body),c=xe(r);if(a){const l=Pn(c);return t.concat(c,c.visualViewport||[],Et(r)?r:[],l&&s?At(l):[])}else return t.concat(r,At(r,[],s))}function Pn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wi(e){const t=Re(e);let s=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const r=We(e),a=r?e.offsetWidth:s,c=r?e.offsetHeight:i,l=Gt(s)!==a||Gt(i)!==c;return l&&(s=a,i=c),{width:s,height:i,$:l}}function is(e){return Ae(e)?e:e.contextElement}function ht(e){const t=is(e);if(!We(t))return Te(1);const s=t.getBoundingClientRect(),{width:i,height:r,$:a}=wi(t);let c=(a?Gt(s.width):s.width)/i,l=(a?Gt(s.height):s.height)/r;return(!c||!Number.isFinite(c))&&(c=1),(!l||!Number.isFinite(l))&&(l=1),{x:c,y:l}}const _o=Te(0);function ji(e){const t=xe(e);return!ss()||!t.visualViewport?_o:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Lo(e,t,s){return t===void 0&&(t=!1),!s||t&&s!==xe(e)?!1:t}function st(e,t,s,i){t===void 0&&(t=!1),s===void 0&&(s=!1);const r=e.getBoundingClientRect(),a=is(e);let c=Te(1);t&&(i?Ae(i)&&(c=ht(i)):c=ht(e));const l=Lo(a,s,i)?ji(a):Te(0);let u=(r.left+l.x)/c.x,o=(r.top+l.y)/c.y,m=r.width/c.x,h=r.height/c.y;if(a){const x=xe(a),f=i&&Ae(i)?xe(i):i;let y=x,w=Pn(y);for(;w&&i&&f!==y;){const g=ht(w),C=w.getBoundingClientRect(),N=Re(w),v=C.left+(w.clientLeft+parseFloat(N.paddingLeft))*g.x,p=C.top+(w.clientTop+parseFloat(N.paddingTop))*g.y;u*=g.x,o*=g.y,m*=g.x,h*=g.y,u+=v,o+=p,y=xe(w),w=Pn(y)}}return Jt({width:m,height:h,x:u,y:o})}function ln(e,t){const s=cn(e).scrollLeft;return t?t.left+s:st(Ie(e)).left+s}function Ni(e,t){const s=e.getBoundingClientRect(),i=s.left+t.scrollLeft-ln(e,s),r=s.top+t.scrollTop;return{x:i,y:r}}function Oo(e){let{elements:t,rect:s,offsetParent:i,strategy:r}=e;const a=r==="fixed",c=Ie(i),l=t?on(t.floating):!1;if(i===c||l&&a)return s;let u={scrollLeft:0,scrollTop:0},o=Te(1);const m=Te(0),h=We(i);if((h||!h&&!a)&&((vt(i)!=="body"||Et(c))&&(u=cn(i)),h)){const f=st(i);o=ht(i),m.x=f.x+i.clientLeft,m.y=f.y+i.clientTop}const x=c&&!h&&!a?Ni(c,u):Te(0);return{width:s.width*o.x,height:s.height*o.y,x:s.x*o.x-u.scrollLeft*o.x+m.x+x.x,y:s.y*o.y-u.scrollTop*o.y+m.y+x.y}}function zo(e){return Array.from(e.getClientRects())}function Po(e){const t=Ie(e),s=cn(e),i=e.ownerDocument.body,r=ye(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),a=ye(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let c=-s.scrollLeft+ln(e);const l=-s.scrollTop;return Re(i).direction==="rtl"&&(c+=ye(t.clientWidth,i.clientWidth)-r),{width:r,height:a,x:c,y:l}}const Fs=25;function Fo(e,t){const s=xe(e),i=Ie(e),r=s.visualViewport;let a=i.clientWidth,c=i.clientHeight,l=0,u=0;if(r){a=r.width,c=r.height;const m=ss();(!m||m&&t==="fixed")&&(l=r.offsetLeft,u=r.offsetTop)}const o=ln(i);if(o<=0){const m=i.ownerDocument,h=m.body,x=getComputedStyle(h),f=m.compatMode==="CSS1Compat"&&parseFloat(x.marginLeft)+parseFloat(x.marginRight)||0,y=Math.abs(i.clientWidth-h.clientWidth-f);y<=Fs&&(a-=y)}else o<=Fs&&(a+=o);return{width:a,height:c,x:l,y:u}}function Bo(e,t){const s=st(e,!0,t==="fixed"),i=s.top+e.clientTop,r=s.left+e.clientLeft,a=We(e)?ht(e):Te(1),c=e.clientWidth*a.x,l=e.clientHeight*a.y,u=r*a.x,o=i*a.y;return{width:c,height:l,x:u,y:o}}function Bs(e,t,s){let i;if(t==="viewport")i=Fo(e,s);else if(t==="document")i=Po(Ie(e));else if(Ae(t))i=Bo(t,s);else{const r=ji(e);i={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return Jt(i)}function Ci(e,t){const s=Xe(e);return s===t||!Ae(s)||yt(s)?!1:Re(s).position==="fixed"||Ci(s,t)}function Wo(e,t){const s=t.get(e);if(s)return s;let i=At(e,[],!1).filter(l=>Ae(l)&&vt(l)!=="body"),r=null;const a=Re(e).position==="fixed";let c=a?Xe(e):e;for(;Ae(c)&&!yt(c);){const l=Re(c),u=ns(c);!u&&l.position==="fixed"&&(r=null),(a?!u&&!r:!u&&l.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||Et(c)&&!u&&Ci(e,c))?i=i.filter(m=>m!==c):r=l,c=Xe(c)}return t.set(e,i),i}function Uo(e){let{element:t,boundary:s,rootBoundary:i,strategy:r}=e;const c=[...s==="clippingAncestors"?on(t)?[]:Wo(t,this._c):[].concat(s),i],l=Bs(t,c[0],r);let u=l.top,o=l.right,m=l.bottom,h=l.left;for(let x=1;x<c.length;x++){const f=Bs(t,c[x],r);u=ye(f.top,u),o=Ke(f.right,o),m=Ke(f.bottom,m),h=ye(f.left,h)}return{width:o-h,height:m-u,x:h,y:u}}function Ho(e){const{width:t,height:s}=wi(e);return{width:t,height:s}}function Vo(e,t,s){const i=We(t),r=Ie(t),a=s==="fixed",c=st(e,!0,a,t);let l={scrollLeft:0,scrollTop:0};const u=Te(0);function o(){u.x=ln(r)}if(i||!i&&!a)if((vt(t)!=="body"||Et(r))&&(l=cn(t)),i){const f=st(t,!0,a,t);u.x=f.x+t.clientLeft,u.y=f.y+t.clientTop}else r&&o();a&&!i&&r&&o();const m=r&&!i&&!a?Ni(r,l):Te(0),h=c.left+l.scrollLeft-u.x-m.x,x=c.top+l.scrollTop-u.y-m.y;return{x:h,y:x,width:c.width,height:c.height}}function kn(e){return Re(e).position==="static"}function Ws(e,t){if(!We(e)||Re(e).position==="fixed")return null;if(t)return t(e);let s=e.offsetParent;return Ie(e)===s&&(s=s.ownerDocument.body),s}function Si(e,t){const s=xe(e);if(on(e))return s;if(!We(e)){let r=Xe(e);for(;r&&!yt(r);){if(Ae(r)&&!kn(r))return r;r=Xe(r)}return s}let i=Ws(e,t);for(;i&&To(i)&&kn(i);)i=Ws(i,t);return i&&yt(i)&&kn(i)&&!ns(i)?s:i||Mo(e)||s}const qo=async function(e){const t=this.getOffsetParent||Si,s=this.getDimensions,i=await s(e.floating);return{reference:Vo(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Ko(e){return Re(e).direction==="rtl"}const Xo={convertOffsetParentRelativeRectToViewportRelativeRect:Oo,getDocumentElement:Ie,getClippingRect:Uo,getOffsetParent:Si,getElementRects:qo,getClientRects:zo,getDimensions:Ho,getScale:ht,isElement:Ae,isRTL:Ko};function ki(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Yo(e,t){let s=null,i;const r=Ie(e);function a(){var l;clearTimeout(i),(l=s)==null||l.disconnect(),s=null}function c(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),a();const o=e.getBoundingClientRect(),{left:m,top:h,width:x,height:f}=o;if(l||t(),!x||!f)return;const y=Ft(h),w=Ft(r.clientWidth-(m+x)),g=Ft(r.clientHeight-(h+f)),C=Ft(m),v={rootMargin:-y+"px "+-w+"px "+-g+"px "+-C+"px",threshold:ye(0,Ke(1,u))||1};let p=!0;function j(k){const A=k[0].intersectionRatio;if(A!==u){if(!p)return c();A?c(!1,A):i=setTimeout(()=>{c(!1,1e-7)},1e3)}A===1&&!ki(o,e.getBoundingClientRect())&&c(),p=!1}try{s=new IntersectionObserver(j,{...v,root:r.ownerDocument})}catch{s=new IntersectionObserver(j,v)}s.observe(e)}return c(!0),a}function Go(e,t,s,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=i,o=is(e),m=r||a?[...o?At(o):[],...t?At(t):[]]:[];m.forEach(C=>{r&&C.addEventListener("scroll",s,{passive:!0}),a&&C.addEventListener("resize",s)});const h=o&&l?Yo(o,s):null;let x=-1,f=null;c&&(f=new ResizeObserver(C=>{let[N]=C;N&&N.target===o&&f&&t&&(f.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(t)})),s()}),o&&!u&&f.observe(o),t&&f.observe(t));let y,w=u?st(e):null;u&&g();function g(){const C=st(e);w&&!ki(w,C)&&s(),w=C,y=requestAnimationFrame(g)}return s(),()=>{var C;m.forEach(N=>{r&&N.removeEventListener("scroll",s),a&&N.removeEventListener("resize",s)}),h==null||h(),(C=f)==null||C.disconnect(),f=null,u&&cancelAnimationFrame(y)}}const Zo=Ao,Jo=Ro,Qo=Co,ec=$o,tc=So,Us=No,nc=Eo,sc=(e,t,s)=>{const i=new Map,r={platform:Xo,...s},a={...r.platform,_c:i};return jo(e,t,{...r,platform:a})};var ic=typeof document<"u",rc=function(){},qt=ic?d.useLayoutEffect:rc;function Qt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let s,i,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==t.length)return!1;for(i=s;i--!==0;)if(!Qt(e[i],t[i]))return!1;return!0}if(r=Object.keys(e),s=r.length,s!==Object.keys(t).length)return!1;for(i=s;i--!==0;)if(!{}.hasOwnProperty.call(t,r[i]))return!1;for(i=s;i--!==0;){const a=r[i];if(!(a==="_owner"&&e.$$typeof)&&!Qt(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Ai(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Hs(e,t){const s=Ai(e);return Math.round(t*s)/s}function An(e){const t=d.useRef(e);return qt(()=>{t.current=e}),t}function ac(e){e===void 0&&(e={});const{placement:t="bottom",strategy:s="absolute",middleware:i=[],platform:r,elements:{reference:a,floating:c}={},transform:l=!0,whileElementsMounted:u,open:o}=e,[m,h]=d.useState({x:0,y:0,strategy:s,placement:t,middlewareData:{},isPositioned:!1}),[x,f]=d.useState(i);Qt(x,i)||f(i);const[y,w]=d.useState(null),[g,C]=d.useState(null),N=d.useCallback(R=>{R!==k.current&&(k.current=R,w(R))},[]),v=d.useCallback(R=>{R!==A.current&&(A.current=R,C(R))},[]),p=a||y,j=c||g,k=d.useRef(null),A=d.useRef(null),T=d.useRef(m),z=u!=null,M=An(u),O=An(r),Y=An(o),S=d.useCallback(()=>{if(!k.current||!A.current)return;const R={placement:t,strategy:s,middleware:x};O.current&&(R.platform=O.current),sc(k.current,A.current,R).then(K=>{const Q={...K,isPositioned:Y.current!==!1};q.current&&!Qt(T.current,Q)&&(T.current=Q,Mn.flushSync(()=>{h(Q)}))})},[x,t,s,O,Y]);qt(()=>{o===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,h(R=>({...R,isPositioned:!1})))},[o]);const q=d.useRef(!1);qt(()=>(q.current=!0,()=>{q.current=!1}),[]),qt(()=>{if(p&&(k.current=p),j&&(A.current=j),p&&j){if(M.current)return M.current(p,j,S);S()}},[p,j,S,M,z]);const G=d.useMemo(()=>({reference:k,floating:A,setReference:N,setFloating:v}),[N,v]),B=d.useMemo(()=>({reference:p,floating:j}),[p,j]),D=d.useMemo(()=>{const R={position:s,left:0,top:0};if(!B.floating)return R;const K=Hs(B.floating,m.x),Q=Hs(B.floating,m.y);return l?{...R,transform:"translate("+K+"px, "+Q+"px)",...Ai(B.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:K,top:Q}},[s,l,B.floating,m.x,m.y]);return d.useMemo(()=>({...m,update:S,refs:G,elements:B,floatingStyles:D}),[m,S,G,B,D])}const oc=e=>{function t(s){return{}.hasOwnProperty.call(s,"current")}return{name:"arrow",options:e,fn(s){const{element:i,padding:r}=typeof e=="function"?e(s):e;return i&&t(i)?i.current!=null?Us({element:i.current,padding:r}).fn(s):{}:i?Us({element:i,padding:r}).fn(s):{}}}},cc=(e,t)=>{const s=Zo(e);return{name:s.name,fn:s.fn,options:[e,t]}},lc=(e,t)=>{const s=Jo(e);return{name:s.name,fn:s.fn,options:[e,t]}},dc=(e,t)=>({fn:nc(e).fn,options:[e,t]}),uc=(e,t)=>{const s=Qo(e);return{name:s.name,fn:s.fn,options:[e,t]}},mc=(e,t)=>{const s=ec(e);return{name:s.name,fn:s.fn,options:[e,t]}},fc=(e,t)=>{const s=tc(e);return{name:s.name,fn:s.fn,options:[e,t]}},hc=(e,t)=>{const s=oc(e);return{name:s.name,fn:s.fn,options:[e,t]}};var pc="Arrow",Ri=d.forwardRef((e,t)=>{const{children:s,width:i=10,height:r=5,...a}=e;return n.jsx(Rt.svg,{...a,ref:t,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?s:n.jsx("polygon",{points:"0,0 30,0 15,10"})})});Ri.displayName=pc;var yc=Ri;function xc(e){const[t,s]=d.useState(void 0);return Yt(()=>{if(e){s({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 u=a.borderBoxSize,o=Array.isArray(u)?u[0]:u;c=o.inlineSize,l=o.blockSize}else c=e.offsetWidth,l=e.offsetHeight;s({width:c,height:l})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else s(void 0)},[e]),t}var rs="Popper",[Ei]=Gn(rs),[gc,$i]=Ei(rs),Ti=e=>{const{__scopePopper:t,children:s}=e,[i,r]=d.useState(null);return n.jsx(gc,{scope:t,anchor:i,onAnchorChange:r,children:s})};Ti.displayName=rs;var Ii="PopperAnchor",Di=d.forwardRef((e,t)=>{const{__scopePopper:s,virtualRef:i,...r}=e,a=$i(Ii,s),c=d.useRef(null),l=kt(t,c),u=d.useRef(null);return d.useEffect(()=>{const o=u.current;u.current=(i==null?void 0:i.current)||c.current,o!==u.current&&a.onAnchorChange(u.current)}),i?null:n.jsx(Rt.div,{...r,ref:l})});Di.displayName=Ii;var as="PopperContent",[vc,bc]=Ei(as),Mi=d.forwardRef((e,t)=>{var P,E,Z,W,J,be;const{__scopePopper:s,side:i="bottom",sideOffset:r=0,align:a="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:o=[],collisionPadding:m=0,sticky:h="partial",hideWhenDetached:x=!1,updatePositionStrategy:f="optimized",onPlaced:y,...w}=e,g=$i(as,s),[C,N]=d.useState(null),v=kt(t,Ne=>N(Ne)),[p,j]=d.useState(null),k=xc(p),A=(k==null?void 0:k.width)??0,T=(k==null?void 0:k.height)??0,z=i+(a!=="center"?"-"+a:""),M=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},O=Array.isArray(o)?o:[o],Y=O.length>0,S={padding:M,boundary:O.filter(Nc),altBoundary:Y},{refs:q,floatingStyles:G,placement:B,isPositioned:D,middlewareData:R}=ac({strategy:"fixed",placement:z,whileElementsMounted:(...Ne)=>Go(...Ne,{animationFrame:f==="always"}),elements:{reference:g.anchor},middleware:[cc({mainAxis:r+T,alignmentAxis:c}),u&&lc({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?dc():void 0,...S}),u&&uc({...S}),mc({...S,apply:({elements:Ne,rects:rt,availableWidth:Ye,availableHeight:Ue})=>{const{width:Ge,height:te}=rt.reference,me=Ne.floating.style;me.setProperty("--radix-popper-available-width",`${Ye}px`),me.setProperty("--radix-popper-available-height",`${Ue}px`),me.setProperty("--radix-popper-anchor-width",`${Ge}px`),me.setProperty("--radix-popper-anchor-height",`${te}px`)}}),p&&hc({element:p,padding:l}),Cc({arrowWidth:A,arrowHeight:T}),x&&fc({strategy:"referenceHidden",...S})]}),[K,Q]=Li(B),re=oi(y);Yt(()=>{D&&(re==null||re())},[D,re]);const le=(P=R.arrow)==null?void 0:P.x,he=(E=R.arrow)==null?void 0:E.y,ie=((Z=R.arrow)==null?void 0:Z.centerOffset)!==0,[ge,ve]=d.useState();return Yt(()=>{C&&ve(window.getComputedStyle(C).zIndex)},[C]),n.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...G,transform:D?G.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ge,"--radix-popper-transform-origin":[(W=R.transformOrigin)==null?void 0:W.x,(J=R.transformOrigin)==null?void 0:J.y].join(" "),...((be=R.hide)==null?void 0:be.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:n.jsx(vc,{scope:s,placedSide:K,onArrowChange:j,arrowX:le,arrowY:he,shouldHideArrow:ie,children:n.jsx(Rt.div,{"data-side":K,"data-align":Q,...w,ref:v,style:{...w.style,animation:D?void 0:"none"}})})})});Mi.displayName=as;var _i="PopperArrow",wc={top:"bottom",right:"left",bottom:"top",left:"right"},jc=d.forwardRef(function(t,s){const{__scopePopper:i,...r}=t,a=bc(_i,i),c=wc[a.placedSide];return n.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:n.jsx(yc,{...r,ref:s,style:{...r.style,display:"block"}})})});jc.displayName=_i;function Nc(e){return e!==null}var Cc=e=>({name:"transformOrigin",options:e,fn(t){var g,C,N;const{placement:s,rects:i,middlewareData:r}=t,c=((g=r.arrow)==null?void 0:g.centerOffset)!==0,l=c?0:e.arrowWidth,u=c?0:e.arrowHeight,[o,m]=Li(s),h={start:"0%",center:"50%",end:"100%"}[m],x=(((C=r.arrow)==null?void 0:C.x)??0)+l/2,f=(((N=r.arrow)==null?void 0:N.y)??0)+u/2;let y="",w="";return o==="bottom"?(y=c?h:`${x}px`,w=`${-u}px`):o==="top"?(y=c?h:`${x}px`,w=`${i.floating.height+u}px`):o==="right"?(y=`${-u}px`,w=c?h:`${f}px`):o==="left"&&(y=`${i.floating.width+u}px`,w=c?h:`${f}px`),{data:{x:y,y:w}}}});function Li(e){const[t,s="center"]=e.split("-");return[t,s]}var Sc=Ti,kc=Di,Ac=Mi,Rc=Symbol.for("react.lazy"),en=mr[" use ".trim().toString()];function Ec(e){return typeof e=="object"&&e!==null&&"then"in e}function Oi(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Rc&&"_payload"in e&&Ec(e._payload)}function $c(e){const t=Tc(e),s=d.forwardRef((i,r)=>{let{children:a,...c}=i;Oi(a)&&typeof en=="function"&&(a=en(a._payload));const l=d.Children.toArray(a),u=l.find(Dc);if(u){const o=u.props.children,m=l.map(h=>h===u?d.Children.count(o)>1?d.Children.only(null):d.isValidElement(o)?o.props.children:null:h);return n.jsx(t,{...c,ref:r,children:d.isValidElement(o)?d.cloneElement(o,void 0,m):null})}return n.jsx(t,{...c,ref:r,children:a})});return s.displayName=`${e}.Slot`,s}function Tc(e){const t=d.forwardRef((s,i)=>{let{children:r,...a}=s;if(Oi(r)&&typeof en=="function"&&(r=en(r._payload)),d.isValidElement(r)){const c=_c(r),l=Mc(a,r.props);return r.type!==d.Fragment&&(l.ref=i?jr(i,c):c),d.cloneElement(r,l)}return d.Children.count(r)>1?d.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ic=Symbol("radix.slottable");function Dc(e){return d.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ic}function Mc(e,t){const s={...t};for(const i in t){const r=e[i],a=t[i];/^on[A-Z]/.test(i)?r&&a?s[i]=(...l)=>{const u=a(...l);return r(...l),u}:r&&(s[i]=r):i==="style"?s[i]={...r,...a}:i==="className"&&(s[i]=[r,a].filter(Boolean).join(" "))}return{...e,...s}}function _c(e){var i,r;let t=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,s=t&&"isReactWarning"in t&&t.isReactWarning;return s?e.ref:(t=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,s=t&&"isReactWarning"in t&&t.isReactWarning,s?e.props.ref:e.props.ref||e.ref)}var Lc=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Oc=Lc.reduce((e,t)=>{const s=$c(`Primitive.${t}`),i=d.forwardRef((r,a)=>{const{asChild:c,...l}=r,u=c?s:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),n.jsx(u,{...l,ref:a})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{}),zc="Portal",zi=d.forwardRef((e,t)=>{var l;const{container:s,...i}=e,[r,a]=d.useState(!1);Yt(()=>a(!0),[]);const c=s||r&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return c?fr.createPortal(n.jsx(Oc.div,{...i,ref:t}),c):null});zi.displayName=zc;const os=({open:e,onClose:t,anchorRef:s,placement:i="bottom-end",children:r})=>{const a=d.useRef(null);if(d.useEffect(()=>{if(!e)return;const o=m=>{var h,x;e&&((h=a.current)!=null&&h.contains(m.target)||(x=s.current)!=null&&x.contains(m.target)||t())};return document.addEventListener("mousedown",o),()=>document.removeEventListener("mousedown",o)},[e,t,s]),!e)return null;const c=i.startsWith("top")?"top":"bottom",l=i.endsWith("end")?"end":"start",u=i.startsWith("top")?8:4;return n.jsxs(Sc,{children:[n.jsx(kc,{virtualRef:s}),n.jsx(zi,{children:n.jsx(Nr,{onEscapeKeyDown:o=>{o.preventDefault(),t()},onPointerDownOutside:o=>{var m;if((m=s.current)!=null&&m.contains(o.target)){o.preventDefault();return}t()},children:n.jsx(Ac,{ref:a,side:c,align:l,sideOffset:u,className:`popover popover-${i}`,role:"dialog",children:r})})})]})};function Pc(e){const t=e+"CollectionProvider",[s,i]=Gn(t),[r,a]=s(t,{collectionRef:{current:null},itemMap:new Map}),c=w=>{const{scope:g,children:C}=w,N=je.useRef(null),v=je.useRef(new Map).current;return n.jsx(r,{scope:g,itemMap:v,collectionRef:N,children:C})};c.displayName=t;const l=e+"CollectionSlot",u=Es(l),o=je.forwardRef((w,g)=>{const{scope:C,children:N}=w,v=a(l,C),p=kt(g,v.collectionRef);return n.jsx(u,{ref:p,children:N})});o.displayName=l;const m=e+"CollectionItemSlot",h="data-radix-collection-item",x=Es(m),f=je.forwardRef((w,g)=>{const{scope:C,children:N,...v}=w,p=je.useRef(null),j=kt(g,p),k=a(m,C);return je.useEffect(()=>(k.itemMap.set(p,{ref:p,...v}),()=>void k.itemMap.delete(p))),n.jsx(x,{[h]:"",ref:j,children:N})});f.displayName=m;function y(w){const g=a(e+"CollectionConsumer",w);return je.useCallback(()=>{const N=g.collectionRef.current;if(!N)return[];const v=Array.from(N.querySelectorAll(`[${h}]`));return Array.from(g.itemMap.values()).sort((k,A)=>v.indexOf(k.ref.current)-v.indexOf(A.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:c,Slot:o,ItemSlot:f},y,i]}var Fc=d.createContext(void 0);function Bc(e){const t=d.useContext(Fc);return e||t||"ltr"}var Rn="rovingFocusGroup.onEntryFocus",Wc={bubbles:!1,cancelable:!0},$t="RovingFocusGroup",[Fn,Pi,Uc]=Pc($t),[Hc]=Gn($t,[Uc]),[Vc,qc]=Hc($t),Fi=d.forwardRef((e,t)=>n.jsx(Fn.Provider,{scope:e.__scopeRovingFocusGroup,children:n.jsx(Fn.Slot,{scope:e.__scopeRovingFocusGroup,children:n.jsx(Kc,{...e,ref:t})})}));Fi.displayName=$t;var Kc=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:s,orientation:i,loop:r=!1,dir:a,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:o,preventScrollOnEntryFocus:m=!1,...h}=e,x=d.useRef(null),f=kt(t,x),y=Bc(a),[w,g]=Sr({prop:c,defaultProp:l??null,onChange:u,caller:$t}),[C,N]=d.useState(!1),v=oi(o),p=Pi(s),j=d.useRef(!1),[k,A]=d.useState(0);return d.useEffect(()=>{const T=x.current;if(T)return T.addEventListener(Rn,v),()=>T.removeEventListener(Rn,v)},[v]),n.jsx(Vc,{scope:s,orientation:i,dir:y,loop:r,currentTabStopId:w,onItemFocus:d.useCallback(T=>g(T),[g]),onItemShiftTab:d.useCallback(()=>N(!0),[]),onFocusableItemAdd:d.useCallback(()=>A(T=>T+1),[]),onFocusableItemRemove:d.useCallback(()=>A(T=>T-1),[]),children:n.jsx(Rt.div,{tabIndex:C||k===0?-1:0,"data-orientation":i,...h,ref:f,style:{outline:"none",...e.style},onMouseDown:ft(e.onMouseDown,()=>{j.current=!0}),onFocus:ft(e.onFocus,T=>{const z=!j.current;if(T.target===T.currentTarget&&z&&!C){const M=new CustomEvent(Rn,Wc);if(T.currentTarget.dispatchEvent(M),!M.defaultPrevented){const O=p().filter(B=>B.focusable),Y=O.find(B=>B.active),S=O.find(B=>B.id===w),G=[Y,S,...O].filter(Boolean).map(B=>B.ref.current);Ui(G,m)}}j.current=!1}),onBlur:ft(e.onBlur,()=>N(!1))})})}),Bi="RovingFocusGroupItem",Wi=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:s,focusable:i=!0,active:r=!1,tabStopId:a,children:c,...l}=e,u=Cr(),o=a||u,m=qc(Bi,s),h=m.currentTabStopId===o,x=Pi(s),{onFocusableItemAdd:f,onFocusableItemRemove:y,currentTabStopId:w}=m;return d.useEffect(()=>{if(i)return f(),()=>y()},[i,f,y]),n.jsx(Fn.ItemSlot,{scope:s,id:o,focusable:i,active:r,children:n.jsx(Rt.span,{tabIndex:h?0:-1,"data-orientation":m.orientation,...l,ref:t,onMouseDown:ft(e.onMouseDown,g=>{i?m.onItemFocus(o):g.preventDefault()}),onFocus:ft(e.onFocus,()=>m.onItemFocus(o)),onKeyDown:ft(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){m.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const C=Gc(g,m.orientation,m.dir);if(C!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let v=x().filter(p=>p.focusable).map(p=>p.ref.current);if(C==="last")v.reverse();else if(C==="prev"||C==="next"){C==="prev"&&v.reverse();const p=v.indexOf(g.currentTarget);v=m.loop?Zc(v,p+1):v.slice(p+1)}setTimeout(()=>Ui(v))}}),children:typeof c=="function"?c({isCurrentTabStop:h,hasTabStop:w!=null}):c})})});Wi.displayName=Bi;var Xc={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Yc(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Gc(e,t,s){const i=Yc(e.key,s);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return Xc[i]}function Ui(e,t=!1){const s=document.activeElement;for(const i of e)if(i===s||(i.focus({preventScroll:t}),document.activeElement!==s))return}function Zc(e,t){return e.map((s,i)=>e[(t+i)%e.length])}var Jc=Fi,Qc=Wi;const pe=({icon:e,children:t,onClick:s,danger:i,disabled:r,checked:a,note:c,trailing:l})=>n.jsx(Qc,{asChild:!0,focusable:!r,active:!1,children:n.jsxs("button",{type:"button",role:a===void 0?"menuitem":"menuitemradio","aria-checked":a,className:`menu-item${i?" menu-item-danger":""}`,onClick:s,disabled:r,children:[a!==void 0&&n.jsx("span",{className:"menu-item-check","aria-hidden":"true",children:a&&n.jsx(pt,{size:12})}),e&&n.jsx("span",{className:"menu-item-icon",children:e}),n.jsxs("span",{className:"menu-item-label",children:[t,c&&n.jsx("span",{className:"menu-item-note",children:c})]}),l!==void 0&&n.jsx("span",{className:"menu-item-trailing",children:l})]})}),el=()=>n.jsx("div",{className:"menu-divider",role:"separator"}),cs=({children:e})=>n.jsx(Jc,{asChild:!0,orientation:"vertical",loop:!0,children:n.jsx("div",{className:"menu",role:"menu",children:e})}),tl=[{label:"1 Hour",value:"1h"},{label:"2 Hours",value:"2h"},{label:"4 Hours",value:"4h"},{label:"8 Hours",value:"8h"}],nl=({device:e,onClose:t,onReserved:s})=>{const[i,r]=d.useState(""),[a,c]=d.useState("1h"),[l,u]=d.useState(""),[o,m]=d.useState(!1),[h,x]=d.useState(null),[f,y]=d.useState(null),w=async()=>{if(!i.trim()){x("Please enter your name/ID");return}m(!0),x(null),y(null);try{const g=await U.reserveDevice(e.udid,e.host,i,a,l);g.success?(s(),t()):y(g.error||"Failed to reserve device")}catch(g){y(g.message||"An unexpected error occurred")}finally{m(!1)}};return n.jsx(Zn,{open:!0,onClose:t,width:520,title:n.jsxs(n.Fragment,{children:[n.jsx(Zr,{size:16,className:"title-icon"}),"Reserve device"]}),footer:n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"btn-cancel",onClick:t,disabled:o,children:"Cancel"}),n.jsx("button",{className:"btn-reserve",onClick:w,disabled:o||!i.trim(),children:o?"Reserving...":"Confirm Reservation"})]}),children:n.jsxs("div",{className:"reservation-modal-body",children:[n.jsxs("div",{className:"device-id-badge",children:[n.jsx("span",{className:"label",children:"Device:"}),n.jsx("span",{className:"value",children:e.udid})]}),n.jsxs("p",{children:["Reserve ",n.jsx("strong",{children:e.name||e.udid})," for exclusive use. This will prevent CI sessions from using this device."]}),n.jsx(Vt,{label:n.jsxs(n.Fragment,{children:[n.jsx(hr,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Reserved by"]}),htmlFor:"reservation-reserved-by",error:h?n.jsxs(n.Fragment,{children:[n.jsx(Rs,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),h]}):void 0,children:n.jsx("input",{id:"reservation-reserved-by",type:"text",className:"reservation-input",placeholder:"Enter your name or ID",value:i,onChange:g=>{r(g.target.value),h&&x(null)},disabled:o})}),n.jsx(Vt,{label:n.jsxs(n.Fragment,{children:[n.jsx(kr,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Duration"]}),children:n.jsx("div",{className:"duration-selector",children:tl.map(g=>n.jsx("div",{className:`duration-option ${a===g.value?"active":""}`,onClick:()=>c(g.value),children:g.label},g.value))})}),n.jsx(Vt,{label:n.jsxs(n.Fragment,{children:[n.jsx(ka,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Reason (optional)"]}),htmlFor:"reservation-reason",error:f?n.jsxs(n.Fragment,{children:[n.jsx(Rs,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),f]}):void 0,children:n.jsx("input",{id:"reservation-reason",type:"text",className:"reservation-input",placeholder:"e.g., Debugging flaky login test",value:l,onChange:g=>u(g.target.value),disabled:o})})]})})},sl=({device:e,onClose:t,onUpdated:s})=>{const{toast:i}=it(),[r,a]=d.useState(e.tags||[]),[c,l]=d.useState(""),[u,o]=d.useState(!1),m=d.useRef(null);d.useEffect(()=>{m.current&&m.current.focus()},[]);const h=()=>{const w=c.trim();w&&!r.includes(w)&&(a([...r,w]),l(""))},x=w=>{a(r.filter(g=>g!==w))},f=w=>{w.key==="Enter"&&h()},y=async()=>{o(!0);try{await U.updateDeviceTags(e.udid,e.host,r),s(),t()}catch(w){console.error("Failed to update tags",w),i("Error saving tags. Please try again.","error")}finally{o(!1)}};return n.jsx(Zn,{open:!0,onClose:t,width:520,title:n.jsxs(n.Fragment,{children:[n.jsx(Va,{size:16,className:"title-icon"}),"Manage device tags"]}),footer:n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"btn-cancel",onClick:t,children:"Cancel"}),n.jsx("button",{className:"btn-save",onClick:y,disabled:u,children:u?"Saving...":"Apply Changes"})]}),children:n.jsxs("div",{className:"tag-modal-body",children:[n.jsxs("div",{className:"device-id-badge",children:[n.jsx("span",{className:"label",children:"Device:"}),n.jsx("span",{className:"value",children:e.udid})]}),n.jsx(Vt,{label:"Add new tag",description:"Press Enter to add multiple tags",htmlFor:"tag-input",children:n.jsxs("div",{className:"input-with-button",children:[n.jsx("input",{ref:m,id:"tag-input",type:"text",placeholder:"e.g. stable, team-a, ios-17",value:c,onChange:w=>l(w.target.value),onKeyDown:f}),n.jsx("button",{className:"add-inline-btn",onClick:h,disabled:!c.trim(),children:n.jsx(ci,{size:16})})]})}),n.jsxs("div",{className:"tags-display-section",children:[n.jsx("label",{children:"Current Tags"}),n.jsx("div",{className:"tags-list",children:r.length>0?r.map(w=>n.jsxs("div",{className:"tag-pill-editable",children:[w,n.jsx("button",{className:"remove-tag",onClick:()=>x(w),children:n.jsx(qn,{size:12})})]},w)):n.jsx("div",{className:"empty-tags",children:"No tags assigned to this device."})})]})]})})};function il(e){return e>=50?"ready":e>=20?"warning":"error"}function rl(e){return e>=50?n.jsx(Kr,{size:10}):e>=20?n.jsx(Ur,{size:10}):n.jsx(Vr,{size:10})}function al(e){return e==="Normal"?"ready":e==="Critical"?"error":"warning"}const ol=({device:e})=>{if(e.deviceType==="emulator"||e.deviceType==="simulator"||e.offline)return null;const s=typeof e.batteryLevel=="number",i=typeof e.thermalStatus=="string"&&e.thermalStatus.length>0&&e.thermalStatus!=="Unknown";return!s&&!i?n.jsx("div",{className:"dc2-health",children:n.jsxs(Ht,{tone:"neutral",title:"Device does not report battery or thermal data",children:[n.jsx(Ar,{size:10}),"No telemetry"]})}):n.jsxs("div",{className:"dc2-health",children:[s&&n.jsxs(Ht,{tone:il(e.batteryLevel),title:`Battery ${e.batteryLevel}%`,children:[rl(e.batteryLevel),e.batteryLevel,"%"]}),i&&n.jsxs(Ht,{tone:al(e.thermalStatus),title:`Thermal: ${e.thermalStatus}`,children:[n.jsx(Ja,{size:10}),e.thermalStatus]})]})},cl="/wd/hub";function ll(e){return e==="android"?"UiAutomator2":"XCUITest"}function dl(e){return e==="android"?"Android":e==="tvos"?"tvOS":"iOS"}function ul(e,t=cl){if(!e)return"—";try{const s=new URL(e.includes("://")?e:`http://${e}`),i=t.startsWith("/")?t:`/${t}`,r=s.pathname.replace(/\/$/,"");return r===i||r.endsWith(i)?`${s.protocol}//${s.host}${r}`:`${s.protocol}//${s.host}${i}`}catch{return e}}function ml(e){const t={platformName:dl(e.platform),"appium:automationName":ll(e.platform),"appium:udid":e.udid};return e.sdk&&e.sdk!=="Unknown"&&e.sdk!=="unknown"&&(t["appium:platformVersion"]=e.sdk),e.name&&(t["appium:deviceName"]=e.name),t}function fl(e){return JSON.stringify(ml(e),null,2)}const hl=/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i,pl=/^(?:\d{1,3}\.){3}\d{1,3}$/;function yl(e){const t=e.trim();return!t||hl.test(t)||!pl.test(t)?!1:t.split(".").every(s=>{const i=Number(s);return Number.isInteger(i)&&i>=0&&i<=255})}function xl(e){return e.ip&&yl(e.ip)?e.ip.trim():null}function gl(e){if(typeof e!="number")throw new TypeError("Expected a number");const t=e>0?Math.floor:Math.ceil;return{days:t(e/864e5),hours:t(e/36e5)%24,minutes:t(e/6e4)%60,seconds:t(e/1e3)%60,milliseconds:t(e)%1e3,microseconds:t(e*1e3)%1e3,nanoseconds:t(e*1e6)%1e3}}const vl=(e,t)=>t===1?e:`${e}s`,bl=1e-7;function Hi(e,t={}){if(!Number.isFinite(e))throw new TypeError("Expected a finite number");t.colonNotation&&(t.compact=!1,t.formatSubMilliseconds=!1,t.separateMilliseconds=!1,t.verbose=!1),t.compact&&(t.secondsDecimalDigits=0,t.millisecondsDecimalDigits=0);const s=[],i=(c,l)=>{const u=Math.floor(c*10**l+bl);return(Math.round(u)/10**l).toFixed(l)},r=(c,l,u,o)=>{if((s.length===0||!t.colonNotation)&&c===0&&!(t.colonNotation&&u==="m"))return;o=(o||c||"0").toString();let m,h;if(t.colonNotation){m=s.length>0?":":"",h="";const x=o.includes(".")?o.split(".")[0].length:o.length,f=s.length>0?2:1;o="0".repeat(Math.max(0,f-x))+o}else m="",h=t.verbose?" "+vl(l,c):u;s.push(m+o+h)},a=gl(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"),t.separateMilliseconds||t.formatSubMilliseconds||!t.colonNotation&&e<1e3)if(r(a.seconds,"second","s"),t.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 t.millisecondsDecimalDigits=="number"?t.millisecondsDecimalDigits:0,u=c>=1?Math.round(c):Math.ceil(c),o=l?c.toFixed(l):u;r(Number.parseFloat(o),"millisecond","ms",o)}else{const c=e/1e3%60,l=typeof t.secondsDecimalDigits=="number"?t.secondsDecimalDigits:1,u=i(c,l),o=t.keepDecimalsOnWholeSeconds?u:u.replace(/\.0+$/,"");r(Number.parseFloat(o),"second","s",o)}if(s.length===0)return"0"+(t.verbose?" milliseconds":"ms");if(t.compact)return s[0];if(typeof t.unitCount=="number"){const c=t.colonNotation?"":" ";return s.slice(0,Math.max(t.unitCount,1)).join(c)}return t.colonNotation?s.join(""):s.join(" ")}const En=6e4;function wl(e){return!Number.isFinite(e)||e<=0?"expiring":e<En?"under 1m":Hi(Math.floor(e/En)*En,{unitCount:2})}const jl=["ready","busy","reserved","maintenance","offline"];function ls(e,t){return e.offline?"offline":e.userBlocked?"maintenance":e.busy?"busy":e.reservedUntil&&t<e.reservedUntil?"reserved":"ready"}function Vi(e,t){if(!e.busy||!e.session_id)return null;const s=String(e.session_id);return s.startsWith("manual_")?t!=null&&t.userId&&s===`manual_${t.userId}_${e.udid}`?"self":"other":"session"}const Vs=e=>(e==null?void 0:e.role)==="ADMIN"||(e==null?void 0:e.role)==="SUPER_ADMIN";function Nl(e,t,s){switch(Vi(e,t)){case"session":return e.sessionStartTime&&e.sessionStartTime>0&&s>e.sessionStartTime?`Test session · ${Hi(s-e.sessionStartTime,{compact:!0})}`:"Test session running";case"self":return"Live control by you";case"other":return"Live control by another user"}if(e.reservedUntil&&s<e.reservedUntil){const r=!!e.reservedBy&&(e.reservedBy===(t==null?void 0:t.email)||e.reservedBy===(t==null?void 0:t.name))?"you":e.reservedBy||"another user";return`${wl(e.reservedUntil-s)} left · by ${r}`}return null}function Cl(e,t){if(e.offline)return{enabled:!1,reason:"Device is offline"};if(e.userBlocked&&!Vs(t))return{enabled:!1,reason:"In maintenance"};const s=Vi(e,t);return s==="session"?{enabled:!1,reason:"A test is running"}:s==="other"&&!Vs(t)?{enabled:!1,reason:"Another user has control"}:{enabled:!0}}function ds(e){var t;return((t=e.marketingName)==null?void 0:t.trim())||e.name}function Sl(e){const t=[Jn(e.platform),e.sdk].filter(Boolean).join(" ");if(e.deviceType==="emulator")return`Emulator · ${t}`;if(e.deviceType==="simulator")return`Simulator · ${t}`;const i=[e.manufacturer?e.manufacturer.charAt(0).toUpperCase()+e.manufacturer.slice(1):"",e.model].filter(Boolean).join(" ");return i?`${i} · ${t}`:t}function kl(e){return e.formFactor==="tablet"||e.formFactor==="tv"?e.formFactor:"phone"}const Al={ready:"Ready",busy:"Busy",reserved:"Reserved",maintenance:"Maintenance",offline:"Offline"},Rl=({device:e})=>{const t={phone:_n,tablet:Rr,tv:yr}[kl(e)],s=e.deviceType==="emulator"||e.deviceType==="simulator";return n.jsx(t,{size:26,strokeWidth:1.5,strokeDasharray:s?"3 2":void 0})},El=({udid:e,currentTeamId:t,teams:s,onDone:i})=>{const{toast:r}=it(),[a,c]=d.useState(!1);async function l(u){c(!0);try{await U.setDeviceTeam(e,u),r(u?"Device assigned":"Device returned to shared pool","success"),i(!0)}catch(o){r((o==null?void 0:o.message)||"Failed to update team","error")}finally{c(!1)}}return n.jsxs(Yn,{selectSize:"sm",autoFocus:!0,"aria-label":"Team",disabled:a,defaultValue:t??"",onBlur:()=>i(!1),onChange:u=>l(u.target.value||null),children:[n.jsx("option",{value:"",children:"(Shared pool)"}),Array.from(s.entries()).map(([u,o])=>n.jsx("option",{value:u,children:o},u))]})},$l=({device:e,reloadDevices:t,navigate:s,teams:i})=>{var q,G,B;const[r,a]=d.useState(!1),[c,l]=d.useState(!1),[u,o]=d.useState(!1),[m,h]=d.useState(!1),x=d.useRef(null),{me:f}=pr(),{toast:y}=it(),w=(f==null?void 0:f.role)==="ADMIN"||(f==null?void 0:f.role)==="SUPER_ADMIN",g=Date.now(),C=ls(e,g),N=C==="reserved",v=Nl(e,f,g),p=Cl(e,f),j=`dc2-reason-${e.udid}`,k=ds(e),A=e.teamId?(i==null?void 0:i.get(e.teamId))??e.teamName??`Team ${e.teamId.slice(0,6)}`:null,T=ul(e.host),z=xl(e),M=async(D,R)=>{var K;try{await((K=navigator.clipboard)==null?void 0:K.writeText(D)),y(R,"success")}catch{y("Failed to copy","error")}},O=async()=>{await U.releaseReservation(e.udid,e.host),t()},Y=async()=>{await U.blockDevice(e.udid,e.host),t()},S=async()=>{await U.unblockDevice(e.udid,e.host),t()};return n.jsxs("div",{className:`dc2 dc2-${C}`,children:[n.jsxs("div",{className:`dc2-band dc2-band-${C}`,children:[n.jsxs("span",{className:"dc2-band-label",children:[n.jsx("span",{className:"dc2-band-dot","aria-hidden":!0}),Al[C]]}),v&&n.jsx("span",{className:"dc2-band-activity",title:v,children:v})]}),n.jsxs("div",{className:`dc2-body${C==="offline"?" dc2-dim":""}`,children:[n.jsxs("div",{className:"dc2-head",children:[n.jsx("div",{className:"dc2-icon","aria-hidden":!0,children:n.jsx(Rl,{device:e})}),n.jsxs("div",{className:"dc2-id",children:[n.jsx("div",{className:"dc2-title",title:`${k}
|
|
217
|
+
${e.udid}`,children:k}),n.jsx("div",{className:"dc2-subtitle",children:Sl(e)})]})]}),n.jsxs("div",{className:"dc2-meta",children:[n.jsx(ol,{device:e}),u?n.jsx(El,{udid:e.udid,currentTeamId:e.teamId??null,teams:i??new Map,onDone:D=>{o(!1),D&&t()}}):A&&n.jsx(Ht,{tone:"accent",title:`Team: ${A}`,children:A}),(q=e.tags)==null?void 0:q.slice(0,2).map(D=>n.jsxs("span",{className:"dc2-tag",title:D,children:["#",D]},D)),(((G=e.tags)==null?void 0:G.length)||0)>2&&n.jsxs("span",{className:"dc2-tag",children:["+",(((B=e.tags)==null?void 0:B.length)||0)-2]})]})]}),n.jsxs("div",{className:"dc2-foot",children:[n.jsx(se,{variant:"tonal",size:"sm",disabled:!p.enabled,"aria-describedby":p.enabled?void 0:j,onClick:()=>{p.enabled&&s(`/devices/${e.udid}/control`)},children:"Control"}),N?n.jsx(se,{variant:"secondary",size:"sm",onClick:O,children:"Release"}):C==="ready"?n.jsx(se,{variant:"secondary",size:"sm",onClick:()=>a(!0),children:"Reserve"}):null,!p.enabled&&n.jsx("span",{id:j,className:"dc2-unavailable",title:p.reason,children:p.reason}),n.jsx("span",{className:"dc2-spacer"}),n.jsx("button",{ref:x,type:"button",className:"dc2-more",onClick:()=>h(D=>!D),"aria-label":"More actions",children:n.jsx(da,{size:14})}),n.jsx(os,{open:m,onClose:()=>h(!1),anchorRef:x,children:n.jsxs(cs,{children:[n.jsx(pe,{icon:n.jsx(Oe,{size:12}),onClick:()=>{h(!1),M(e.udid,"UDID copied")},children:"Copy UDID"}),T!=="—"&&n.jsx(pe,{icon:n.jsx(Oe,{size:12}),onClick:()=>{h(!1),M(T,"Server URL copied")},children:"Copy server URL"}),z&&n.jsx(pe,{icon:n.jsx(Oe,{size:12}),onClick:()=>{h(!1),M(z,"IP address copied")},children:"Copy IP address"}),n.jsx(pe,{icon:n.jsx(Oe,{size:12}),onClick:()=>{h(!1),M(fl(e),"Session capabilities copied")},children:"Copy capabilities"}),w&&n.jsxs(n.Fragment,{children:[n.jsx(el,{}),n.jsx(pe,{onClick:()=>{h(!1),l(!0)},children:"Manage tags…"}),n.jsx(pe,{onClick:()=>{h(!1),o(!0)},children:"Assign team…"}),n.jsx(pe,{onClick:()=>{h(!1),e.userBlocked?S():Y()},children:e.userBlocked?"Exit maintenance":"Enter maintenance"})]})]})})]}),r&&n.jsx(nl,{device:e,onClose:()=>a(!1),onReserved:()=>t()}),c&&n.jsx(sl,{device:e,onClose:()=>l(!1),onUpdated:()=>t()})]})};function Tl(e){const t=rn(),{search:s}=Kn();return n.jsx($l,{device:e.device,reloadDevices:e.reloadDevices,navigate:i=>t(`${i}${s}`),teams:e.teams})}class Il extends je.Component{constructor(){super(...arguments),this.state={teamsMap:new Map}}componentDidMount(){U.listTeams().then(t=>{this.setState({teamsMap:new Map(t.map(s=>[s.id,s.name]))})}).catch(()=>{})}render(){return n.jsx("div",{className:"device-explorer-card-container",children:je.Children.toArray(this.props.devices.map(t=>n.jsx(Tl,{device:t,reloadDevices:this.props.reloadDevices,teams:this.state.teamsMap})))})}}var Bt,Dl=new Uint8Array(16);function Ml(){if(!Bt&&(Bt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Bt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Bt(Dl)}const _l=/^(?:[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 Ll(e){return typeof e=="string"&&_l.test(e)}var ue=[];for(var $n=0;$n<256;++$n)ue.push(($n+256).toString(16).substr(1));function Ol(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=(ue[e[t+0]]+ue[e[t+1]]+ue[e[t+2]]+ue[e[t+3]]+"-"+ue[e[t+4]]+ue[e[t+5]]+"-"+ue[e[t+6]]+ue[e[t+7]]+"-"+ue[e[t+8]]+ue[e[t+9]]+"-"+ue[e[t+10]]+ue[e[t+11]]+ue[e[t+12]]+ue[e[t+13]]+ue[e[t+14]]+ue[e[t+15]]).toLowerCase();if(!Ll(s))throw TypeError("Stringified UUID is invalid");return s}function zl(e,t,s){e=e||{};var i=e.random||(e.rng||Ml)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Ol(i)}const Pl=({onCommand:e,prompt:t="$",welcomeMessage:s="Interactive Shell (Restricted Mode)",platform:i})=>{const[r,a]=d.useState([{type:"system",content:s,timestamp:Date.now()},{type:"system",content:'Type "help" for allowed commands.',timestamp:Date.now()}]),[c,l]=d.useState(""),[u,o]=d.useState([]),[m,h]=d.useState(-1),[x,f]=d.useState(!1),y=d.useRef(null),w=d.useRef(null);d.useEffect(()=>{y.current&&(y.current.scrollTop=y.current.scrollHeight)},[r]);const g=N=>{const v=N.trim();if((v.startsWith("{")||v.startsWith("["))&&(v.endsWith("}")||v.endsWith("]")))try{const p=JSON.parse(v);return JSON.stringify(p,null,2)}catch{}return N},C=async N=>{if(N.key==="Enter"&&!x){const v=c.trim();if(!v)return;if(l(""),a(p=>[...p,{type:"command",content:`${t} ${v}`,timestamp:Date.now()}]),o(p=>[...p,v]),h(-1),f(!0),v==="clear"){a([]),f(!1);return}if(v==="help"){let p="";i==="android"?p=`
|
|
218
|
+
Android Allowed Commands:
|
|
219
|
+
• System Info: getprop, ip addr, date, uptime, cat /proc/meminfo, cat /proc/cpuinfo
|
|
220
|
+
• Process Mgmt: ps, top
|
|
221
|
+
• File System: ls
|
|
222
|
+
• Diagnostics: dumpsys [battery|wifi|power]
|
|
223
|
+
• Packages: pm list packages
|
|
224
|
+
`:(i==="ios"||i==="tvos")&&(p=`
|
|
225
|
+
iOS Allowed Commands:
|
|
226
|
+
• Real Device (go-ios):
|
|
227
|
+
apps, info, list, syslog, deviceinfo, diagnostics
|
|
228
|
+
• Simulator (xcrun simctl):
|
|
229
|
+
listapps, get_app_container, list, getenv
|
|
230
|
+
• Simulator System:
|
|
231
|
+
ls, ps, top, date, uptime, whoami
|
|
232
|
+
`),a(j=>[...j,{type:"output",content:p.trim(),timestamp:Date.now()}]),f(!1);return}try{const p=await e(v),j=g(p||"(No output)");a(k=>[...k,{type:"output",content:j,timestamp:Date.now()}])}catch(p){a(j=>[...j,{type:"error",content:p.message||"Unknown error",timestamp:Date.now()}])}finally{f(!1),setTimeout(()=>{var p;return(p=w.current)==null?void 0:p.focus()},10)}}else if(N.key==="ArrowUp"){if(N.preventDefault(),u.length>0){const v=m===-1?u.length-1:Math.max(0,m-1);h(v),l(u[v])}}else if(N.key==="ArrowDown"&&(N.preventDefault(),m!==-1)){const v=m+1;v>=u.length?(h(-1),l("")):(h(v),l(u[v]))}};return n.jsxs("div",{className:"terminal-container theme-dark",children:[n.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),n.jsxs("header",{className:"terminal-header",children:[n.jsxs("div",{className:"terminal-controls",children:[n.jsx("div",{className:"dot red"}),n.jsx("div",{className:"dot yellow"}),n.jsx("div",{className:"dot green"})]}),n.jsxs("div",{className:"terminal-title",children:[Jn(i)," shell"]}),n.jsx("div",{className:"terminal-actions",children:n.jsx("button",{className:"terminal-action-btn",onClick:()=>a([]),title:"Clear terminal",children:"CLEAR"})})]}),n.jsxs("div",{className:"terminal-history",ref:y,onClick:()=>{var N;return(N=w.current)==null?void 0:N.focus()},children:[r.map((N,v)=>n.jsx("div",{className:`terminal-line ${N.type}`,children:N.content},v)),x&&n.jsx("div",{className:"terminal-line system animate-pulse",children:"Executing command..."})]}),n.jsxs("div",{className:"terminal-input-area",children:[n.jsx("span",{className:"terminal-prompt",children:t}),n.jsx("input",{ref:w,className:"terminal-input",value:c,onChange:N=>l(N.target.value),onKeyDown:C,disabled:x,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"Type a command..."})]})]})};function Be(e,t){var s;t(e),(s=e.children)==null||s.forEach(i=>Be(i,t))}function ze(e,...t){var s;for(const i of t){const r=(s=e.attributes)==null?void 0:s[i];if(r!=null&&r!=="")return String(r)}}function xt(e){var t;return((t=e.type)==null?void 0:t.split(".").pop())||e.type||""}function Fl(e,t){const s=[];return Be(e,i=>{ze(i,"content-desc","contentDescription","accessibilityId","name","label")===t&&s.push(i)}),s}function Bl(e,t){const s=[];return Be(e,i=>{ze(i,"resource-id","resourceId","identifier")===t&&s.push(i)}),s}function Bn(e,t){const s=[];return Be(e,i=>{(i.type===t||xt(i)===t)&&s.push(i)}),s}function Wl(e,t){const s=[];return Be(e,i=>{ze(i,"name")===t&&s.push(i)}),s}function Ul(e){const t=/^\/\/(\*|[A-Za-z_][\w.-]*)\[@([\w-]+)=(["'])(.*?)\3\]$/.exec(e.trim());return t?{tag:t[1]==="*"?null:t[1],attrKey:t[2],attrValue:t[4]}:null}function Hl(e,t){const s=t.split("/").filter(Boolean);if(s.length===0)return null;const i=[];for(const a of s){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!==xt(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 u=0,o;for(const m of r.children||[])if((m.type===c||xt(m)===c)&&(u+=1,u===l)){o=m;break}r=o}return r?[r]:[]}function Vl(e,t){const s=Hl(e,t);if(s!==null)return{kind:"matched",nodes:s};const i=Ul(t);if(i){const r=[];return Be(e,a=>{if(i.tag&&a.type!==i.tag&&xt(a)!==i.tag)return;ze(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 ql(e,t){const s=t.trim(),i=/^\*\*\/([A-Za-z_]\w*)\[`(\w+)\s*==\s*"([^"]*)"`\]$/.exec(s);if(i){const[,c,l,u]=i,o=[];return Be(e,m=>{if(m.type!==c&&xt(m)!==c)return;ze(m,l)===u&&o.push(m)}),{kind:"matched",nodes:o}}const r=/^\*\*\/([A-Za-z_]\w*)\[(\d+)\]$/.exec(s);if(r){const[,c,l]=r,u=parseInt(l,10),o=[];return Be(e,m=>{(m.type===c||xt(m)===c)&&o.push(m)}),{kind:"matched",nodes:o[u-1]?[o[u-1]]:[]}}const a=/^\*\*\/([A-Za-z_]\w*)$/.exec(s);return a?Bn(e,a[1]).length>0?{kind:"matched",nodes:Bn(e,a[1])}:{kind:"matched",nodes:[]}:{kind:"unsupported",nodes:[],reason:"Multi-segment class chain — use a real driver to verify"}}function Kl(e,t){const i=t.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 Be(e,c=>{for(const l of r){let u;if(l.key==="type"?u=c.type:l.key==="label"?u=ze(c,"label")??c.label:l.key==="name"?u=ze(c,"name")??c.name:l.key==="value"?u=ze(c,"value")??c.value:u=ze(c,l.key),u!==l.value)return}a.push(c)}),{kind:"matched",nodes:a}}function Wn(e,t,s){const i=t.toLowerCase();if(!s)return{kind:"matched",nodes:[]};switch(i){case"accessibility id":return{kind:"matched",nodes:Fl(e,s)};case"id":return{kind:"matched",nodes:Bl(e,s)};case"class name":return{kind:"matched",nodes:Bn(e,s)};case"name":return{kind:"matched",nodes:Wl(e,s)};case"xpath":return Vl(e,s);case"-ios class chain":return ql(e,s);case"-ios predicate string":return Kl(e,s);default:return{kind:"unsupported",nodes:[],reason:`Strategy "${t}" not yet supported by snapshot matcher`}}}function qs(e){return{"accessibility id":1,id:2,"-ios predicate string":3,"-ios class chain":4,"-android uiautomator":3,"class name":8,xpath:9,name:10,"link text":10}[e.toLowerCase()]??7}function Un(e,t){const s=e.toLowerCase();if(s==="accessibility id")return/[0-9a-f]{8}-[0-9a-f]{4}/i.test(t)?{level:"fragile",reason:"UUID in accessibility ID — dynamically generated, unreliable"}:{level:"stable",reason:"#1 recommended by Appium — portable across Android & iOS"};if(s==="id")return/[0-9a-f]{8}-[0-9a-f]{4}/i.test(t)?{level:"fragile",reason:"UUID in resource ID — dynamically generated"}:/\d{6,}/.test(t)&&!t.includes(":id/")?{level:"moderate",reason:"Long numeric ID without package prefix — may not be unique"}:/^[a-z][a-z0-9.]+:id\//.test(t)?{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(s==="xpath"){if(t.startsWith("/hierarchy")||t.startsWith("/")&&!t.startsWith("//"))return{level:"very-fragile",reason:"ABSOLUTE XPath — breaks on any layout change. Avoid entirely"};if(/\[\d+\]/.test(t))return{level:"very-fragile",reason:"Index-based XPath [n] — breaks when element order changes"};const i=(t.match(/\//g)||[]).length;return i>7?{level:"fragile",reason:`${i}-level deep XPath — brittle to layout changes, 10x slower on iOS`}:t.includes("@content-desc")||t.includes("@resource-id")||t.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 s==="-ios predicate string"?{level:"stable",reason:"iOS NSPredicate — native engine, excellent performance on iOS"}:s==="-ios class chain"?{level:"stable",reason:"iOS Class Chain — native iOS, faster than XPath"}:s==="-android uiautomator"?t.includes("resourceId")||t.includes("description")?{level:"stable",reason:"UIAutomator2 with resourceId/description — Android native, very reliable"}:t.includes("textContains")||t.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"}:s==="class name"?{level:"fragile",reason:"Class name alone is almost never unique — use with explicit index or prefer accessibility id"}:s==="name"?{level:"fragile",reason:"⚠️ Deprecated in Appium 2.x — replace with accessibility id or id"}:s==="link text"?{level:"moderate",reason:"Text-based locator — breaks if copy/label changes"}:{level:"moderate",reason:"Verify reliability for your target platform"}}function qi(e){return[...e].sort((t,s)=>qs(t.strategy)-qs(s.strategy))}const Wt=e=>e===!0||e==="true",Xl=/^XCUIElementType(Button|Cell|Switch|Slider|TextField|SecureTextField|SearchField|TextView|Link|Tab|SegmentedControl|Stepper|PickerWheel|Key|MenuItem)$/,Yl=/(EditText|AutoCompleteTextView)$/;function Ki(e){const t=e.attributes||{};return Wt(t.clickable)||Wt(t["long-clickable"])||Wt(t.checkable)||Wt(t.scrollable)||Yl.test(e.type||"")||Xl.test(e.type||"")}function Gl(e){const t=e.attributes||{};return String(e.text||t["content-desc"]||e.label||t.label||t.name||"").trim()}function Zl(e,t){const s="Unique locator",i=qi(e.suggestedLocators||[]),r=i[0];if(!r)return{id:"unique",label:s,status:"fail",detail:"No locator suggested"};const a=Wn(t.hierarchy,r.strategy,r.value),c=`${r.strategy} ${r.value}`;if(a.kind==="unsupported")return{id:"unique",label:s,status:"info",detail:`Can’t check ${r.strategy} locators here`};const l=x=>x.length===1&&x[0].xpath===e.xpath;if(l(a.nodes))return{id:"unique",label:s,status:"pass",detail:`${c} matches only this element`};const u=i.slice(1).find(x=>{const f=Wn(t.hierarchy,x.strategy,x.value);return f.kind==="matched"&&l(f.nodes)}),o=u?`; use ${u.strategy} ${u.value} instead`:"",m=a.nodes.length,h=m===0?"matches nothing in this capture":`matches ${m} elements`;return{id:"unique",label:s,status:"fail",detail:`${c} ${h}${o}`}}function Jl(e){const t=qi(e.suggestedLocators||[])[0];if(!t)return null;const{level:s,reason:i}=Un(t.strategy,t.value);return{id:"stable",label:"Stable locator",status:s==="stable"||s==="moderate"?"pass":"warn",detail:i}}function Ql(e,t){const{screenWidth:s,screenHeight:i}=t.metadata||{screenWidth:0,screenHeight:0};if(!s||!i)return null;const{x:r,y:a,width:c,height:l}=e.rect,u="On screen";return r+c<=0||a+l<=0||r>=s||a>=i?{id:"onscreen",label:u,status:"warn",detail:"Off screen — scroll it into view first"}:r<0||a<0||r+c>s||a+l>i?{id:"onscreen",label:u,status:"warn",detail:"Partly off screen — scroll it into view first"}:{id:"onscreen",label:u,status:"pass",detail:"Fully inside the screen"}}function ed(e,t){var l,u;const s=Ki(e),i=!(((l=e.attributes)==null?void 0:l.enabled)===!1||((u=e.attributes)==null?void 0:u.enabled)==="false"),r=e.rect.width>0&&e.rect.height>0,a=Gl(e);return[Zl(e,t),Jl(e),s?{id:"interactive",label:"Interactive",status:"pass",detail:"Can be tapped, typed into or scrolled"}:{id:"interactive",label:"Interactive",status:"info",detail:"Not interactive — a tap here goes to whatever is under it"},i?{id:"enabled",label:"Enabled",status:"pass",detail:"Enabled"}:{id:"enabled",label:"Enabled",status:"fail",detail:"Disabled — taps are ignored"},r?{id:"size",label:"Has size",status:"pass",detail:`${e.rect.width} × ${e.rect.height}`}:{id:"size",label:"Has size",status:"fail",detail:"Zero-size — it can’t be tapped or seen"},Ql(e,t),s?a?{id:"name",label:"Accessible name",status:"pass",detail:`“${a.slice(0,40)}”`}:{id:"name",label:"Accessible name",status:"warn",detail:"No accessible name — screen readers and accessibility-id locators have nothing to use"}:null].filter(o=>o!==null)}function td(e){return{pass:e.filter(t=>t.status==="pass").length,warn:e.filter(t=>t.status==="warn").length,fail:e.filter(t=>t.status==="fail").length}}function nd(e,t){const s=Math.max(0,Math.round((t-e)/1e3));if(s<5)return"Captured just now";if(s<60)return`Captured ${s} s ago`;const i=Math.floor(s/60);return i<60?`Captured ${i} min ago`:`Captured ${Math.floor(i/60)} h ago`}function sd(e,t){return e>0&&t>e}function Xi(e){var a,c,l,u,o;const t=(e.type||"").toLowerCase(),s=((a=e.attributes)==null?void 0:a.clickable)==="true"||((c=e.attributes)==null?void 0:c.clickable)===!0,i=((l=e.attributes)==null?void 0:l.scrollable)==="true"||((u=e.attributes)==null?void 0:u.scrollable)===!0,r=((o=e.children)==null?void 0:o.length)||0;return t.includes("button")||t.includes("btn")||s&&r===0?{role:"Button",key:"button"}:t.includes("edit")||t.includes("input")||t.includes("field")?{role:"Text input",key:"input"}:t.includes("image")||t.includes("img")||t.includes("imageview")?{role:"Image",key:"image"}:t.includes("scroll")||t.includes("recyclerview")||t.includes("listview")||i?{role:"Scrollable list",key:"list"}:t.includes("text")||t.includes("label")?{role:"Text label",key:"text"}:t.includes("switch")||t.includes("toggle")||t.includes("checkbox")?{role:"Toggle or checkbox",key:"toggle"}:t.includes("nav")||t.includes("toolbar")||t.includes("tabbar")?{role:"Navigation bar",key:"nav"}:r>0?{role:"Container",key:"container"}:{role:"Element",key:"element"}}const Yi={button:n.jsx($a,{size:13}),input:n.jsx(Xa,{size:13}),image:n.jsx(ha,{size:13}),list:n.jsx(yi,{size:13}),text:n.jsx(so,{size:13}),toggle:n.jsx(eo,{size:13}),nav:n.jsx(Ma,{size:13}),container:n.jsx(li,{size:13}),element:n.jsx(Yr,{size:13})};function Gi(e,t){if(!t)return!0;const s=t.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[u,o]of Object.entries(i))if(s.includes(u)&&o.some(m=>r.includes(m)))return!0;return r.includes(s)||a.includes(s)||c.includes(s)||l.includes(s)}const Ee=e=>typeof e=="string"?e.trim():typeof e=="number"?String(e):"";function id(e){const t=Ee(e),s=t.indexOf(":id/");return s>=0?t.slice(s+4):t}function Zi(e){return(e.type||"").split(".").pop()||""}function tn(e){var t;return[e.type,(t=e.attributes)==null?void 0:t["resource-id"],e.text].filter(s=>typeof s=="string"&&s.trim()!=="").join(`
|
|
233
|
+
`)}function tt(e){const t=e.attributes||{};return Ee(e.text)||Ee(t["content-desc"])||Ee(e.label)||Ee(t.label)||id(t["resource-id"])||Ee(t.name)||Zi(e)||"Element"}const rd=e=>{const t=e.attributes||{};return!!(Ee(e.text)||Ee(t["content-desc"])||Ee(e.label)||Ee(t.label))};function ad(e){var t;return(((t=e.children)==null?void 0:t.length)??0)===1&&!Ki(e)&&!rd(e)}function Ji(e){const t=[e];let s=e;for(;ad(s);)s=s.children[0],t.push(s);return t}function Qi(e,t){const s=new Set;if(!e||!t.trim())return s;const i=r=>{var a;Gi(r,t)&&s.add(r.xpath),(a=r.children)==null||a.forEach(i)};return i(e),s}function od(e,t){const s=new Set;if(!e||!t.trim())return s;const i=r=>{let a=!1;for(const c of r.children||[])i(c)&&(a=!0);return a&&s.add(r.xpath),a||Gi(r,t)};return i(e),s}function cd(e,t,s=""){if(!e)return[];const i=!!s.trim(),r=i?Qi(e,s):null,a=i?od(e,s):null,c=o=>!i||o.some(m=>r.has(m.xpath)||a.has(m.xpath)),l=[],u=(o,m,h)=>{const x=o.map(Ji).filter(c);x.forEach((f,y)=>{var v;const w=f[f.length-1],g=(((v=w.children)==null?void 0:v.length)??0)>0,C=i&&a.has(w.xpath),N=g&&(t.has(w.xpath)||C);l.push({key:w.xpath,nodes:f,level:m,setSize:x.length,posInSet:y+1,hasChildren:g,expanded:N,collapsible:N&&!C,parentKey:h}),N&&u(w.children,m+1,w.xpath)})};return u([e],1,null),l}function ld(e,t=3){const s=new Set,i=(r,a)=>{var u;const c=Ji(r),l=c[c.length-1];a>t||!((u=l.children)!=null&&u.length)||(s.add(l.xpath),l.children.forEach(o=>i(o,a+1)))};return e&&i(e,1),s}function Kt(e,t){if(!e)return null;if(e.xpath===t)return[e];for(const s of e.children||[]){const i=Kt(s,t);if(i)return[e,...i]}return null}function Ks(e,t){return e.findIndex(s=>s.nodes.some(i=>i.xpath===t))}function dd(e,t,s){var r;const i=e[t];if(!i)return null;switch(s){case"ArrowDown":return t<e.length-1?{focus:t+1}:null;case"ArrowUp":return t>0?{focus:t-1}:null;case"ArrowRight":return i.hasChildren?i.expanded?((r=e[t+1])==null?void 0:r.parentKey)===i.key?{focus:t+1}:null:{toggle:i.key}:null;case"ArrowLeft":{if(i.collapsible)return{toggle:i.key};const a=e.findIndex(c=>c.key===i.parentKey);return a>=0?{focus:a}:null}case"Home":return{focus:0};case"End":return{focus:e.length-1};case"Enter":case" ":return{select:i.nodes[i.nodes.length-1]};default:return null}}const ud=10;function md({rows:e,selectedXpath:t,hoveredXpath:s,matches:i,onToggle:r,onSelect:a,onHover:c,revealSeq:l=0}){const u=d.useRef(null),[o,m]=d.useState(null),h=d.useRef(0),x=d.useRef(null),f=t?Ks(e,t):-1,y=o?e.findIndex(j=>j.key===o):-1,w=y>=0?y:Math.max(f,0),g=j=>{var k;return((k=u.current)==null?void 0:k.querySelector(`[data-row="${j}"]`))??null},C=j=>j.nodes[j.nodes.length-1],N=j=>{var T;const k=e[j];if(!k)return;m(k.key),h.current=j;const A=g(j);A==null||A.focus({preventScroll:!0}),(T=A==null?void 0:A.scrollIntoView)==null||T.call(A,{block:"nearest"})};d.useEffect(()=>{x.current=t},[t,l]),d.useEffect(()=>{var A,T;const j=x.current;if(!j)return;const k=Ks(e,j);k<0||((T=(A=g(k))==null?void 0:A.scrollIntoView)==null||T.call(A,{block:"nearest"}),x.current=null)}),d.useEffect(()=>{var A,T;if(!o||e.some(z=>z.key===o))return;const j=Math.min(h.current,e.length-1),k=!document.activeElement||document.activeElement===document.body;m(((A=e[j])==null?void 0:A.key)??null),k&&j>=0&&((T=g(j))==null||T.focus({preventScroll:!0}))});const v=j=>{const k=j.target;if(k.getAttribute("role")!=="treeitem")return;const A=dd(e,Number(k.dataset.row),j.key);A&&(j.preventDefault(),"focus"in A?N(A.focus):"toggle"in A?r(A.toggle):a(A.select))},p=j=>{var k;(k=u.current)!=null&&k.contains(j.relatedTarget)||(c(null),m(null))};return n.jsx("div",{ref:u,role:"tree","aria-label":"Element tree",className:"omni-tree",onKeyDown:v,onBlur:p,children:e.map((j,k)=>{const A=C(j),T=R=>!!R&&j.nodes.some(K=>K.xpath===R),z=T(t),M=!z&&T(s),O=tt(A),Y=Zi(A),S=!!Y&&Y!==O,q=j.nodes.map(R=>tt(R)).join(", "),G=S?`${q}, ${Y}`:q,B=j.expanded&&!j.collapsible,D=(R,K)=>`omni-tree-row__part${K?" is-target":""}${i.has(R.xpath)?" is-match":""}${R.xpath===t?" is-current":""}`;return n.jsxs("div",{"data-row":k,role:"treeitem","aria-level":j.level,"aria-setsize":j.setSize,"aria-posinset":j.posInSet,"aria-selected":z,"aria-expanded":j.hasChildren?j.expanded:void 0,"aria-label":G,tabIndex:k===w?0:-1,className:`omni-tree-row${z?" is-selected":""}${M?" is-hovered":""}`,onClick:()=>a(A),onFocus:R=>{R.target===R.currentTarget&&(m(j.key),h.current=k,c(A))},onMouseEnter:()=>c(A),onMouseLeave:()=>c(null),children:[n.jsxs("span",{className:"omni-tree-row__lead","aria-hidden":"true",children:[n.jsx("span",{className:"omni-tree-row__indent",style:{width:(j.level-1)*ud}}),n.jsx("span",{className:`omni-tree-row__caret${B?" is-locked":""}`,onClick:j.hasChildren?R=>{R.stopPropagation(),B||r(j.key)}:void 0,children:j.hasChildren&&(j.expanded?n.jsx(xr,{size:12}):n.jsx($r,{size:12}))}),n.jsx("span",{className:"omni-tree-row__icon",children:Yi[Xi(A).key]})]}),n.jsxs("span",{className:"omni-tree-row__label",children:[j.nodes.length>1&&n.jsx("span",{className:"omni-tree-row__head",children:j.nodes.slice(0,-1).map((R,K)=>n.jsxs(je.Fragment,{children:[K>0&&n.jsx("span",{className:"omni-tree-row__sep","aria-hidden":"true",children:"›"}),n.jsx("span",{className:D(R,!1),title:tn(R),onClick:Q=>{Q.stopPropagation(),a(R)},onMouseEnter:()=>c(R),onMouseLeave:()=>c(A),children:tt(R)})]},R.xpath))}),n.jsxs("span",{className:"omni-tree-row__tail",children:[j.nodes.length>1&&n.jsx("span",{className:"omni-tree-row__sep","aria-hidden":"true",children:"›"}),n.jsxs("span",{className:"omni-tree-row__name",children:[n.jsx("span",{className:D(A,!0),title:tn(A),children:tt(A)}),S&&n.jsx("span",{className:"omni-tree-row__type",children:Y})]})]})]}),j.hasChildren&&!j.expanded&&n.jsx("span",{className:"omni-tree-row__count","aria-hidden":"true",children:A.children.length})]},j.key)})})}const Xs=4;function fd({path:e,onSelect:t,focusCurrent:s=!1}){const[i,r]=d.useState(!1),a=d.useRef(null),c=d.useRef(null);if(d.useEffect(()=>{var m;s&&((m=c.current)==null||m.focus())},[]),d.useEffect(()=>{var m;i&&((m=a.current)==null||m.focus())},[i]),!e.length)return null;const l=e[e.length-1],u=e.slice(0,-1),o=!i&&u.length>Xs?u.length-Xs:0;return n.jsx("nav",{"aria-label":"Element path",className:"omni-crumbs",children:n.jsxs("ol",{children:[o>0&&n.jsx("li",{children:n.jsx("button",{type:"button",className:"omni-crumb","aria-label":`Show all ${u.length} ancestors`,onClick:()=>r(!0),children:"…"})}),u.slice(o).map((m,h)=>n.jsx("li",{children:n.jsx("button",{ref:h===0?a:void 0,type:"button",className:"omni-crumb",title:tn(m),"aria-label":tt(m),onClick:()=>t(m),children:tt(m)})},m.xpath)),n.jsx("li",{children:n.jsx("span",{ref:c,tabIndex:-1,className:"omni-crumb is-current","aria-current":"location",title:tn(l),children:tt(l)})})]})})}const nn=.4,hd=240,pd=340,Ys=.02,sn=12,er="xenon.omni.split";function tr(e){if(!(e>0))return{min:0,max:1};const t=Math.min(1,hd/e);return{min:t,max:Math.max(t,(e-pd)/e)}}function yd(e,t){const{min:s,max:i}=tr(t),r=Number.isFinite(e)?e:nn;return Math.min(i,Math.max(s,r))}function xd(e){try{const t=Number.parseFloat((e==null?void 0:e.getItem(er))??"");return t>0&&t<1?t:nn}catch{return nn}}function gd(e,t){try{e==null||e.setItem(er,String(Math.round(t*1e3)/1e3))}catch{}}function Gs(){try{return window.localStorage}catch{return null}}const vd=3;function bd({share:e,limits:t,containerRef:s,onChange:i,onCommit:r,onReset:a}){const[c,l]=d.useState(!1),u=d.useRef(e);u.current=e;const o=d.useRef(!0),m=d.useRef(!1),h=d.useRef(0),x=d.useRef(e),f=N=>Math.min(t.max,Math.max(t.min,N)),y=N=>Math.round(N*100),w=()=>{o.current||(o.current=!0,l(!1),m.current&&r(u.current))},g=N=>{var p;const v=(p=s.current)==null?void 0:p.getBoundingClientRect();return!v||v.width<=sn?u.current:f(x.current+(N-h.current)/(v.width-sn))},C=N=>{const v=N.key==="ArrowLeft"?e-Ys:N.key==="ArrowRight"?e+Ys:N.key==="Home"?t.min:N.key==="End"?t.max:null;v!==null&&(N.preventDefault(),r(f(Math.round(v*1e3)/1e3)))};return n.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":"Resize element tree","aria-valuenow":y(e),"aria-valuemin":y(t.min),"aria-valuemax":y(t.max),tabIndex:0,className:`omni-split-divider${c?" is-dragging":""}`,onKeyDown:C,onDoubleClick:a,onPointerDown:N=>{var v,p;(p=(v=N.currentTarget).setPointerCapture)==null||p.call(v,N.pointerId),o.current=!1,m.current=!1,h.current=N.clientX,x.current=u.current,l(!0)},onPointerMove:N=>{if(!c||!m.current&&Math.abs(N.clientX-h.current)<vd)return;const v=g(N.clientX);v!==u.current&&(m.current=!0,i(v))},onPointerUp:N=>{var v,p;(p=(v=N.currentTarget).releasePointerCapture)==null||p.call(v,N.pointerId),w()},onPointerCancel:N=>{var v,p;(p=(v=N.currentTarget).releasePointerCapture)==null||p.call(v,N.pointerId),w()},onLostPointerCapture:w,children:n.jsx("span",{className:"omni-split-divider__grip","aria-hidden":"true"})})}function Zs(e,t,s,i){var N,v,p,j,k,A,T;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),u=((v=e.type)==null?void 0:v.toLowerCase().includes("edit"))||((p=e.type)==null?void 0:p.toLowerCase().includes("input"))||((j=e.type)==null?void 0:j.toLowerCase().includes("field"))||((k=e.type)==null?void 0:k.toLowerCase().includes("textfield")),o=((A=e.attributes)==null?void 0:A.scrollable)==="true"||((T=e.attributes)==null?void 0:T.scrollable)===!0,m=r.toLowerCase().startsWith("-ios")&&t!=="ios"?`// ⚠️ -ios predicate/class chain ONLY work with XCUITest (iOS)
|
|
234
|
+
`:r.toLowerCase().startsWith("-android")&&t!=="android"?`// ⚠️ -android uiautomator ONLY works with UIAutomator2 (Android)
|
|
235
|
+
`:"",h={"accessibility id":`~${a}`,id:t==="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}`},x={"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}")`},f={"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}"`},y=x[r.toLowerCase()],w=f[r.toLowerCase()],g=h[r.toLowerCase()];return s==="java"?y?`${m}// Appium Java Client 9.x + Selenium 4 + TestNG
|
|
236
|
+
import io.appium.java_client.AppiumBy;
|
|
237
|
+
import io.appium.java_client.${t==="android"?"AndroidDriver":t==="ios"?"IOSDriver":"AppiumDriver"};
|
|
238
|
+
import org.openqa.selenium.WebElement;
|
|
239
|
+
import org.testng.annotations.Test;
|
|
240
|
+
|
|
241
|
+
@Test
|
|
242
|
+
public void test_${l}() {
|
|
243
|
+
WebElement element = driver.findElement(${y});
|
|
244
|
+
${o?'((Scrollable) element).scrollTo("target text");':u?`element.clear();
|
|
245
|
+
element.sendKeys("your text here");`:"element.click();"}
|
|
246
|
+
// Add assertions here via TestNG Assert or Hamcrest
|
|
247
|
+
}`:`// Strategy "${r}" not supported in Appium Java Client`:s==="python"?w?`${m}# Appium Python Client 4.x + pytest
|
|
248
|
+
from appium.webdriver.common.appiumby import AppiumBy
|
|
249
|
+
import pytest
|
|
250
|
+
|
|
251
|
+
def test_${l}(self):
|
|
252
|
+
element = self.driver.find_element(${w})
|
|
253
|
+
${u?`element.clear()
|
|
254
|
+
element.send_keys("your text here")`:"element.click()"}
|
|
255
|
+
# Add assertions here via assert or pytest.assert`:`# Strategy "${r}" not supported in Appium Python Client`:s==="javascript"?g?`${m}// WebdriverIO 9.x + @wdio/appium-service
|
|
256
|
+
describe('${l} test', () => {
|
|
257
|
+
it('should interact with ${l}', async () => {
|
|
258
|
+
const element = await $('${g}');
|
|
259
|
+
await element.waitForDisplayed({ timeout: 5000 });
|
|
260
|
+
${u?`await element.clearValue();
|
|
261
|
+
await element.addValue("your text here");`:"await element.click();"}
|
|
262
|
+
// Add assertions here via expect(element)
|
|
263
|
+
});
|
|
264
|
+
});`:`// Strategy "${r}" not supported in WebdriverIO mobile`:g?`${m}// WebdriverIO 9.x standalone
|
|
265
|
+
const element = await driver.$('${g}');
|
|
266
|
+
await element.waitForExist({ timeout: 5000 });
|
|
267
|
+
${u?`await driver.$('target').clearValue();
|
|
268
|
+
await element.addValue("your text here");`:"await element.click();"}
|
|
269
|
+
// Assert with expect(element).toBeDisplayed()`:`// Strategy "${r}" not supported in WebdriverIO mobile`}const wd={pass:n.jsx(ui,{size:13}),warn:n.jsx(Le,{size:13}),fail:n.jsx(mi,{size:13}),info:n.jsx(ri,{size:13})},jd={pass:"passed",warn:"warning",fail:"failed",info:"note"},Nd={java:"Java",python:"Python",javascript:"JavaScript",wdio:"WebdriverIO"},Cd=({sessionId:e,udid:t,streamUrl:s,embedded:i=!1,overlayTarget:r=null,onModeChange:a,deviceActionAt:c=0})=>{var xs,gs,vs,bs,ws,js;const[l,u]=d.useState(!0),[o,m]=d.useState(null),[h,x]=d.useState(null),[f,y]=d.useState(null),[w,g]=d.useState(0),C=d.useRef(!1),[N,v]=d.useState(null),[p,j]=d.useState(()=>new Set),[k,A]=d.useState(""),[T,z]=d.useState(null),[M,O]=d.useState("info"),[Y,S]=d.useState(0),[q,G]=d.useState(0),[B,D]=d.useState(()=>Date.now()),R=d.useRef(0),K=d.useRef(null),[Q,re]=d.useState("java"),[le,he]=d.useState(null),[ie,ge]=d.useState({width:0,height:0}),[ve,P]=d.useState({width:0,height:0}),[E,Z]=d.useState(!1),[W,J]=d.useState("inspect");d.useEffect(()=>{a==null||a(W)},[W,a]);const[be,Ne]=d.useState({}),[rt,Ye]=d.useState({}),[Ue,Ge]=d.useState(null),[te,me]=d.useState(null),[He,Ze]=d.useState(null),at=d.useRef(null),dn=d.useRef(null),Tt=d.useRef(null),De=d.useRef(null),ot=d.useRef(null),[un,It]=d.useState(()=>xd(Gs())),[Dt,mn]=d.useState(0);d.useEffect(()=>{const b=ot.current;if(!b||typeof ResizeObserver>"u")return;const $=new ResizeObserver(([I])=>mn(Math.max(0,I.contentRect.width-sn)));return $.observe(b),()=>$.disconnect()},[]);const bt=yd(un,Dt),Mt=b=>{It(b),gd(Gs(),b)},ct=d.useCallback(()=>{var Me,_e,qe;if(!at.current)return;const b=at.current.getBoundingClientRect(),$=b.width,I=b.height,_=(Me=o==null?void 0:o.hierarchy)==null?void 0:Me.rect;let H=((_e=o==null?void 0:o.metadata)==null?void 0:_e.screenWidth)||ie.width||1,L=((qe=o==null?void 0:o.metadata)==null?void 0:qe.screenHeight)||ie.height||1;_&&_.width>0&&_.height>0&&(H=_.width,L=_.height);const ee=H/L;let ke,we;$/I>ee?(we=I,ke=we*ee):(ke=$,we=ke/ee),P({width:ke,height:we})},[o,ie]);d.useEffect(()=>(ct(),window.addEventListener("resize",ct),()=>window.removeEventListener("resize",ct)),[ct]),d.useEffect(()=>{t&&Ve()},[t]);const _t=d.useCallback(async(b,$,I)=>{if(te!=null&&te.sessionId){Ge(b);try{const _=await U.verifyLocator(te.basePath,te.sessionId,{strategy:b,selector:$,action:I});Ye(H=>({...H,[b]:_})),I==="tap"&&G(Date.now())}catch(_){Ye(H=>({...H,[b]:{found:!1,count:0,error:(_==null?void 0:_.message)||String(_)}}))}finally{Ge(null)}}},[te]),wt=d.useRef(null);d.useEffect(()=>{const b=!!f&&f.xpath===wt.current;wt.current=(f==null?void 0:f.xpath)??null;const $=(f==null?void 0:f.suggestedLocators)??[];he(I=>{const _=b&&I?$.find(L=>L.strategy===I.strategy):null,H=$.find(L=>L.strategy==="accessibility id"||L.strategy==="id");return _||H||$[0]||null}),Ne({}),Ye({}),Ze(null)},[f]);const fn=d.useCallback((b,$)=>{if(!(o!=null&&o.hierarchy))return;const I=Wn(o.hierarchy,b,$);Ne(_=>({..._,[b]:I})),Ze(b)},[o]),Ve=async()=>{if(!t)return;const b=++R.current,$=()=>b===R.current;u(!0),x(null),U.getAppiumSession(t).then(I=>{$()&&me({sessionId:(I==null?void 0:I.sessionId)??null,basePath:(I==null?void 0:I.basePath)??""})}).catch(()=>{$()&&me({sessionId:null,basePath:""})});try{const I=await U.getInspectorSnapshot(t);if(!$())return;if(!(I!=null&&I.hierarchy)){m(null),x((I==null?void 0:I.error)||"Failed to capture snapshot");return}const _=I.udid||t,H=_===K.current;K.current=_,Mn.unstable_batchedUpdates(()=>{m(I),S(Date.now()),j(ld(I.hierarchy)),y(L=>{var ee;return L&&H?((ee=Kt(I.hierarchy,L.xpath))==null?void 0:ee.pop())??null:null}),g(L=>L+1)})}catch(I){if(!$())return;m(null),x(I.message||"Failed to capture snapshot")}finally{$()&&u(!1)}};d.useEffect(()=>{const b=setInterval(()=>D(Date.now()),1e4);return()=>clearInterval(b)},[]);const hn=b=>{const{naturalWidth:$,naturalHeight:I}=b.currentTarget;ge({width:$,height:I})},pn=()=>Z(!0),F=b=>{Z(!1);const{naturalWidth:$,naturalHeight:I}=b.currentTarget;$>0&&I>0&&ge({width:$,height:I})},X=s&&!E,ne=b=>{if(W!=="interact"||!t)return;const $=b.currentTarget.getBoundingClientRect();De.current={x:b.clientX-$.left,y:b.clientY-$.top,time:Date.now()}},ae=async b=>{var Cs,Ss,ks;if(W!=="interact"||!t||!De.current)return;const $=De.current,I=b.currentTarget.getBoundingClientRect(),_=b.clientX-I.left,H=b.clientY-I.top,L=Date.now()-$.time,ee=ve.width,ke=ve.height,we=(Cs=o==null?void 0:o.hierarchy)==null?void 0:Cs.rect;let Me=((Ss=o==null?void 0:o.metadata)==null?void 0:Ss.screenWidth)||ie.width,_e=((ks=o==null?void 0:o.metadata)==null?void 0:ks.screenHeight)||ie.height;if(we&&we.width>0&&we.height>0&&(Me=we.width,_e=we.height),!Me||!_e||ee===0||ke===0)return;const qe=(zt,As)=>({x:Math.round(zt/ee*Me),y:Math.round(As/ke*_e),px:zt/ee,py:As/ke}),fe=qe($.x,$.y),Ns=qe(_,H),wn=Math.sqrt(Math.pow(_-$.x,2)+Math.pow(H-$.y,2));if(!(fe.px<0||fe.px>1||fe.py<0||fe.py>1)){try{L<500&&wn<10?await U.tap(t,fe.x,fe.y):L>=500&&wn<10?await U.touchAndHold(t,fe.x,fe.y,L):wn>=10&&await U.swipe(t,fe.x,fe.y,Ns.x,Ns.y),G(Date.now())}catch(zt){console.error("Interaction failed:",zt)}De.current=null}},Ce=b=>{j($=>{const I=new Set($);return I.has(b)?I.delete(b):I.add(b),I})},de=()=>{const b=new Set,$=I=>{var _;b.add(I.xpath),(_=I.children)==null||_.forEach($)};o!=null&&o.hierarchy&&$(o.hierarchy),j(b)},Se=()=>j(new Set),oe=(b,$)=>{navigator.clipboard.writeText(b),z($),setTimeout(()=>z(null),2e3)},ce=b=>{var I;let $=1;return(I=b.children)==null||I.forEach(_=>$+=ce(_)),$},lt=b=>{if(!b)return[];const $={},I=_=>{var L;const H=Xi(_);$[H.role]||($[H.role]={key:H.key,count:0}),$[H.role].count+=1,(L=_.children)==null||L.forEach(I)};return I(b),Object.entries($).map(([_,H])=>({role:_,key:H.key,count:H.count})).sort((_,H)=>H.count-_.count)},dt=d.useMemo(()=>cd(o==null?void 0:o.hierarchy,p,k),[o,p,k]),Je=d.useMemo(()=>Qi(o==null?void 0:o.hierarchy,k),[o,k]),jt=Je.size===0?"No matches":Je.size===1?"1 match":`${Je.size} matches`;d.useEffect(()=>{if(!f||!(o!=null&&o.hierarchy))return;const b=Kt(o.hierarchy,f.xpath);!b||b.length<2||j($=>{const I=b.slice(0,-1).filter(H=>!$.has(H.xpath));if(!I.length)return $;const _=new Set($);return I.forEach(H=>_.add(H.xpath)),_})},[w]),d.useEffect(()=>{C.current=!1});const ut=b=>{y(b),g($=>$+1),O("info")},yn=b=>{C.current=!0,ut(b)},fs=b=>{k.trim()&&!b.trim()&&g($=>$+1),A(b)},xn=()=>{var _,H,L;const b=(_=o==null?void 0:o.hierarchy)==null?void 0:_.rect;if(b&&b.width>0&&b.height>0)return{w:b.width,h:b.height};const $=((H=o==null?void 0:o.metadata)==null?void 0:H.screenWidth)||ie.width,I=((L=o==null?void 0:o.metadata)==null?void 0:L.screenHeight)||ie.height;return $>0&&I>0?{w:$,h:I}:null},hs=b=>{const $=xn();if(!$)return[];const I=[],{w:_,h:H}=$,L=(ee,ke)=>{var Me,_e,qe;const we=!ee.children||ee.children.length===0;((Me=ee.rect)==null?void 0:Me.width)>0&&((_e=ee.rect)==null?void 0:_e.height)>0&&we&&I.push(n.jsx("div",{className:"omni-hit-area",style:{left:`${ee.rect.x/_*100}%`,top:`${ee.rect.y/H*100}%`,width:`${ee.rect.width/_*100}%`,height:`${ee.rect.height/H*100}%`,zIndex:ke},onClick:fe=>{fe.stopPropagation(),ut(ee)},onMouseEnter:()=>v(ee),onMouseLeave:()=>v(null)},ee.xpath)),(qe=ee.children)==null||qe.forEach(fe=>L(fe,ke+1))};return o!=null&&o.hierarchy&&L(o.hierarchy,1),I},ps=()=>{const b=xn();if(!He||!b)return[];const $=be[He];if(!$||$.kind!=="matched"||$.nodes.length===0)return[];const{w:I,h:_}=b,H=$.nodes.length===1?"omni-frame-match unique":"omni-frame-match multi";return $.nodes.filter(L=>L.rect&&L.rect.width>0&&L.rect.height>0).map((L,ee)=>n.jsx("div",{className:H,style:{left:`${L.rect.x/I*100}%`,top:`${L.rect.y/_*100}%`,width:`${L.rect.width/I*100}%`,height:`${L.rect.height/_*100}%`}},`match-${He}-${ee}`))},Lt=(b,$)=>{const I=xn();if(!(b!=null&&b.rect)||!I)return null;const{w:_,h:H}=I;return n.jsx("div",{className:`omni-frame-${$}`,style:{left:`${b.rect.x/_*100}%`,top:`${b.rect.y/H*100}%`,width:`${b.rect.width/_*100}%`,height:`${b.rect.height/H*100}%`}})},gn=o!=null&&o.hierarchy?ce(o.hierarchy):0,Ot=f&&(o!=null&&o.hierarchy)?ed(f,o):null,Qe=Ot?td(Ot):null,vn=sd(Y,Math.max(c,q)),bn=o!=null&&o.hierarchy&&W==="inspect"?n.jsxs("div",{className:`omni-overlay${vn?" is-stale":""}`,children:[hs(o.hierarchy),ps(),Lt(N,"hover"),Lt(f,"select")]}):null,ur={stable:{icon:n.jsx(Pt,{size:10}),cls:"stable"},moderate:{icon:n.jsx(Le,{size:10}),cls:"moderate"},fragile:{icon:n.jsx(mt,{size:10}),cls:"fragile"},"very-fragile":{icon:n.jsx(mt,{size:10}),cls:"very-fragile"}},ys=i&&(o!=null&&o.hierarchy)?lt(o.hierarchy):[];return n.jsxs("div",{className:`omni-inspector-container ${i?"omni-embedded":""}`,children:[i&&r&&bn?Mn.createPortal(bn,r):null,n.jsxs("div",{className:"omni-main-content",children:[!i&&n.jsxs("div",{className:"omni-screenshot-panel",children:[n.jsxs("div",{className:"omni-screenshot-header",children:[n.jsxs("div",{className:"omni-header-left",children:[n.jsx("span",{className:"omni-screenshot-title",children:"Device preview"}),n.jsxs("div",{className:"omni-mode-toggle",children:[n.jsxs("button",{className:`omni-mode-btn ${W==="inspect"?"active":""}`,onClick:()=>J("inspect"),title:"Inspection mode (highlight elements)",children:[n.jsx($s,{size:12}),n.jsx("span",{children:"Inspect"})]}),n.jsxs("button",{className:`omni-mode-btn ${W==="interact"?"active":""}`,onClick:()=>J("interact"),title:"Interaction mode (direct control)",children:[n.jsx(Ds,{size:12}),n.jsx("span",{children:"Interact"})]})]})]}),n.jsxs("button",{className:"omni-refresh-btn",onClick:Ve,disabled:l,children:[n.jsx(St,{size:12,className:l?"animate-spin":""}),l?"Capturing...":"Refresh"]})]}),n.jsxs("div",{className:"omni-screenshot-container",ref:at,children:[l&&!X&&n.jsxs("div",{className:"omni-loading-overlay",children:[n.jsx("div",{className:"omni-spinner"}),n.jsx("span",{children:"Capturing screen..."})]}),!o&&!l&&!X&&n.jsxs("div",{className:"omni-empty-state",children:[n.jsx(Cn,{size:40}),n.jsx("span",{children:"Click Refresh to capture"})]}),X&&n.jsxs("div",{className:`omni-screenshot-wrapper ${W==="interact"?"interactable":""}`,onMouseDown:ne,onMouseUp:ae,children:[n.jsx("img",{ref:Tt,src:s,onLoad:F,onError:pn,className:"omni-screenshot-img",style:W==="interact"?{pointerEvents:"none"}:{},draggable:!1,alt:"Live Device Stream"}),bn]}),!X&&(o==null?void 0:o.screenshot)&&n.jsxs("div",{className:`omni-screenshot-wrapper ${W==="interact"?"interactable":""}`,onMouseDown:ne,onMouseUp:ae,children:[n.jsx("img",{ref:dn,src:`data:image/png;base64,${o.screenshot}`,onLoad:hn,className:"omni-screenshot-img",style:W==="interact"?{pointerEvents:"none"}:{},draggable:!1}),W==="inspect"&&n.jsxs("div",{className:`omni-overlay${vn?" is-stale":""}`,children:[hs(o.hierarchy),ps(),Lt(N,"hover"),Lt(f,"select")]})]})]})]}),n.jsxs("div",{className:"omni-split",ref:ot,children:[n.jsxs("div",{className:"omni-tree-panel",style:{flexBasis:`calc(${bt*100}% - ${bt*sn}px)`},children:[n.jsxs("div",{className:"omni-tree-header",children:[n.jsxs("div",{className:"omni-tree-title",children:[n.jsx(li,{size:14}),n.jsx("span",{children:"Source"})]}),n.jsxs("div",{className:"omni-tree-actions",children:[n.jsx("button",{onClick:de,className:"omni-action-btn",title:"Expand all","aria-label":"Expand all",children:n.jsx(sa,{size:12})}),n.jsx("button",{onClick:Se,className:"omni-action-btn",title:"Collapse all","aria-label":"Collapse all",children:n.jsx(ta,{size:12})}),i&&n.jsxs(n.Fragment,{children:[n.jsx("button",{onClick:()=>J(W==="inspect"?"interact":"inspect"),className:`omni-action-btn ${W==="inspect"?"active":""}`,title:W==="inspect"?"Inspect mode — click the device to select an element":"Interact mode — clicks control the device","aria-label":W==="inspect"?"Inspect mode":"Interact mode","aria-pressed":W==="inspect",children:W==="inspect"?n.jsx($s,{size:12}):n.jsx(Ds,{size:12})}),n.jsx("button",{onClick:Ve,className:"omni-action-btn",title:l?"Capturing…":"Refresh snapshot","aria-label":"Refresh snapshot",disabled:l,children:n.jsx(St,{size:12,className:l?"animate-spin":""})})]})]})]}),h&&!l&&n.jsxs("div",{className:"omni-tree-error",role:"alert",children:[n.jsx(mt,{size:12}),n.jsx("span",{children:h}),n.jsx("button",{type:"button",onClick:Ve,className:"omni-tree-error-retry",children:"Retry"})]}),o&&!l&&!h&&(vn?n.jsxs("div",{className:"omni-capture-meta is-stale",role:"status",children:[n.jsx(Le,{size:12,"aria-hidden":"true"}),n.jsx("span",{children:"The screen may have changed since this capture."}),n.jsx("button",{type:"button",onClick:Ve,className:"omni-capture-refresh",children:"Refresh"})]}):n.jsxs("div",{className:"omni-capture-meta",children:[n.jsxs("span",{children:[gn," ",gn===1?"element":"elements"]}),o.hierarchySource&&n.jsxs(n.Fragment,{children:[n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("span",{className:"omni-capture-source",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"})]}),n.jsx("span",{"aria-hidden":"true",children:"·"}),n.jsx("span",{children:nd(Y,B)})]})),n.jsxs("div",{className:"omni-tree-search",children:[n.jsx(Xn,{size:14}),n.jsx("input",{type:"text",placeholder:"Search elements",value:k,onChange:b=>fs(b.target.value),"aria-label":"Search elements"}),k&&n.jsx("button",{onClick:()=>fs(""),className:"omni-clear-btn","aria-label":"Clear search",children:"×"})]}),n.jsx("div",{role:"status",className:"sr-only",children:k.trim()?jt:""}),k.trim()&&n.jsxs("div",{className:"omni-search-hint",children:[jt," · try a role: button, input, image"]}),n.jsx("div",{className:"omni-tree-content",children:o!=null&&o.hierarchy?n.jsx(md,{rows:dt,selectedXpath:(f==null?void 0:f.xpath)??null,hoveredXpath:(N==null?void 0:N.xpath)??null,matches:Je,onToggle:Ce,onSelect:ut,onHover:v,revealSeq:w}):n.jsx("div",{className:"omni-empty-state small",children:n.jsx("span",{children:"No hierarchy loaded"})})})]}),n.jsx(bd,{share:bt,limits:tr(Dt),containerRef:ot,onChange:It,onCommit:Mt,onReset:()=>Mt(nn)}),n.jsxs("div",{className:"omni-details-panel",children:[n.jsxs("div",{className:"omni-details-tabs",role:"tablist",children:[n.jsxs("button",{className:`omni-details-tab ${M==="info"?"active":""}`,onClick:()=>O("info"),role:"tab","aria-selected":M==="info",children:[n.jsx(Ca,{size:12})," ",n.jsx("span",{children:"Info"})]}),n.jsxs("button",{className:`omni-details-tab ${M==="checks"?"active":""}`,onClick:()=>O("checks"),disabled:!f,title:"Checks for this element","aria-label":"Checks",role:"tab","aria-selected":M==="checks",children:[n.jsx(ba,{size:12})," ",n.jsx("span",{children:"Checks"})]}),n.jsxs("button",{className:`omni-details-tab ${M==="code"?"active":""}`,onClick:()=>O("code"),disabled:!f,title:"Generate test code","aria-label":"Code gen",role:"tab","aria-selected":M==="code",children:[n.jsx(Is,{size:12})," ",n.jsx("span",{children:"Code gen"})]})]}),n.jsx("div",{className:"omni-details-content",children:f?n.jsxs(n.Fragment,{children:[M==="info"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"omni-section",children:[n.jsx("div",{className:"omni-section-header",children:"Element info"}),n.jsxs("div",{className:"omni-info-table",children:[n.jsxs("div",{className:"omni-info-row",children:[n.jsx("span",{className:"omni-info-key",children:"Type"}),n.jsx("span",{className:"omni-info-value mono",children:f.type})]}),f.text&&n.jsxs("div",{className:"omni-info-row",children:[n.jsx("span",{className:"omni-info-key",children:"Text"}),n.jsx("span",{className:"omni-info-value",children:f.text})]}),n.jsxs("div",{className:"omni-info-row omni-info-row--path",children:[n.jsx("span",{className:"omni-info-key",children:"Path"}),n.jsx(fd,{path:(o==null?void 0:o.hierarchy)&&Kt(o.hierarchy,f.xpath)||[f],onSelect:yn,focusCurrent:C.current},f.xpath)]})]})]}),n.jsxs("div",{className:"omni-section",children:[n.jsx("div",{className:"omni-section-header",children:"Layout"}),n.jsx("div",{className:"omni-layout-grid",children:["x","y","width","height"].map(b=>n.jsxs("div",{className:"omni-layout-item",children:[n.jsx("span",{className:"omni-layout-label",children:b.toUpperCase()}),n.jsx("span",{className:"omni-layout-value",children:f.rect[b]})]},b))})]}),n.jsxs("div",{className:"omni-section",children:[n.jsxs("div",{className:"omni-section-header",children:["Locators",n.jsx("span",{className:"omni-section-badge",children:"Stability scored"})]}),!(te!=null&&te.sessionId)&&((vs=f.suggestedLocators)==null?void 0:vs.length)>0&&n.jsxs("p",{className:"omni-locators-note",children:[n.jsx(ri,{size:12,"aria-hidden":"true"}),"Verify and Tap need an Appium test running on this device. Start the test first, then open this page: while it’s open, the live preview holds the device and a new test can’t start."]}),n.jsxs("div",{className:"omni-locators-list",children:[!((bs=f.suggestedLocators)!=null&&bs.length)&&n.jsx("div",{className:"omni-locators-empty",children:f===(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."}),(ws=f.suggestedLocators)==null?void 0:ws.map(b=>{const $=Un(b.strategy,b.value),I=ur[$.level],_=be[b.strategy];let H=null;return _&&(_.kind==="unsupported"?H=n.jsxs("span",{className:"omni-match-badge unsupported",title:_.reason||"Cannot evaluate without a real driver",children:[n.jsx(ra,{size:10})," preview unavailable"]}):_.nodes.length===0?H=n.jsxs("span",{className:"omni-match-badge zero",title:"No element matches this selector in the current snapshot",children:[n.jsx(mt,{size:10})," 0 matches"]}):_.nodes.length===1?H=n.jsxs("span",{className:"omni-match-badge unique",title:"Selector is unique in the current snapshot",children:[n.jsx(Pt,{size:10})," unique"]}):H=n.jsxs("span",{className:"omni-match-badge multi",title:`${_.nodes.length} elements match — selector is not unique`,children:[n.jsx(Le,{size:10})," ",_.nodes.length," matches"]})),n.jsx("div",{className:`omni-locator-row ${(le==null?void 0:le.strategy)===b.strategy?"selected-for-code":""}`,onClick:()=>he(b),title:"Click to use in Code gen",children:n.jsxs("div",{className:"omni-locator-left",children:[n.jsxs("div",{className:"omni-locator-top",children:[n.jsx("span",{className:"omni-locator-strategy",children:b.strategy}),n.jsxs("span",{className:`omni-stability-badge ${I.cls}`,title:$.reason,children:[I.icon,$.level]}),H]}),n.jsx("code",{className:"omni-locator-value",children:b.value}),n.jsx("span",{className:"omni-stability-reason",children:$.reason}),(()=>{const L=rt[b.strategy];return L?L.error?n.jsxs("span",{className:"omni-verify-line is-error",children:[n.jsx(mt,{size:10})," Appium error: ",L.error]}):L.found?L.count>1?n.jsxs("span",{className:"omni-verify-line is-warn",children:[n.jsx(Le,{size:10})," Ambiguous — Appium found"," ",L.count," elements",L.actionError?` · ${L.actionError}`:""]}):n.jsxs("span",{className:"omni-verify-line is-ok",children:[n.jsx(Pt,{size:10})," Appium found 1 element",L.elapsedMs!=null?` in ${L.elapsedMs}ms`:"",L.actionPerformed&&L.actionPerformed!=="none"?` · ${L.actionPerformed} ok`:"",L.actionError?` · action failed: ${L.actionError}`:""]}):n.jsxs("span",{className:"omni-verify-line is-error",children:[n.jsx(mt,{size:10})," Appium found 0 elements"]}):null})(),n.jsxs("div",{className:"omni-locator-actions",children:[n.jsxs(se,{type:"button",variant:He===b.strategy?"tonal":"secondary",size:"sm",onClick:L=>{L.stopPropagation(),fn(b.strategy,b.value)},title:"Match against this capture and outline the result on the phone","aria-label":"Test locator",children:[n.jsx(ca,{size:12,"aria-hidden":"true"}),"Test"]}),n.jsxs(se,{type:"button",variant:"secondary",size:"sm",disabled:!(te!=null&&te.sessionId)||Ue===b.strategy,onClick:L=>{L.stopPropagation(),_t(b.strategy,b.value,"none")},title:"Ask the Appium driver whether it finds this element","aria-label":"Verify with Appium",children:[Ue===b.strategy?n.jsx(St,{size:12,className:"animate-spin","aria-hidden":"true"}):n.jsx(Pt,{size:12,"aria-hidden":"true"}),"Verify"]}),n.jsxs(se,{type:"button",variant:"secondary",size:"sm",disabled:!(te!=null&&te.sessionId)||Ue===b.strategy,onClick:L=>{L.stopPropagation(),_t(b.strategy,b.value,"tap")},title:"Find it with Appium and tap it on the phone","aria-label":"Find and tap with Appium",children:[n.jsx(di,{size:12,"aria-hidden":"true"}),"Tap"]}),n.jsxs(se,{type:"button",variant:"secondary",size:"sm",onClick:L=>{L.stopPropagation(),oe(b.value,b.strategy)},title:"Copy the locator's value","aria-label":T===b.strategy?"Copied":"Copy locator",children:[T===b.strategy?n.jsx(pt,{size:12,"aria-hidden":"true"}):n.jsx(Oe,{size:12,"aria-hidden":"true"}),T===b.strategy?"Copied":"Copy"]})]})]})},b.strategy)})]})]}),n.jsxs("div",{className:"omni-section",children:[n.jsx("div",{className:"omni-section-header",children:"Attributes"}),n.jsx("div",{className:"omni-attributes-table",children:Object.entries(f.attributes||{}).filter(([b,$])=>$!=null&&$!=="").map(([b,$])=>n.jsxs("div",{className:"omni-attr-row",children:[n.jsx("span",{className:"omni-attr-key",children:b}),n.jsx("span",{className:"omni-attr-value",children:String($)})]},b))})]})]}),M==="checks"&&Ot&&Qe&&n.jsxs("div",{className:"omni-checks-panel",children:[n.jsxs("p",{className:"omni-checks-summary",children:[n.jsxs("span",{className:"is-pass",children:[n.jsx(ui,{size:12,"aria-hidden":"true"})," ",Qe.pass," passed"]}),Qe.warn>0&&n.jsxs("span",{className:"is-warn",children:[n.jsx(Le,{size:12,"aria-hidden":"true"})," ",Qe.warn," ",Qe.warn===1?"warning":"warnings"]}),Qe.fail>0&&n.jsxs("span",{className:"is-fail",children:[n.jsx(mi,{size:12,"aria-hidden":"true"})," ",Qe.fail," failed"]})]}),n.jsx("ul",{className:"omni-checks-list",children:Ot.map(b=>n.jsxs("li",{className:`omni-check is-${b.status}`,children:[n.jsx("span",{className:"omni-check-icon","aria-hidden":"true",children:wd[b.status]}),n.jsxs("div",{className:"omni-check-body",children:[n.jsxs("div",{className:"omni-check-label",children:[b.label,n.jsxs("span",{className:"sr-only",children:[": ",jd[b.status]]})]}),n.jsx("div",{className:"omni-check-detail",children:b.detail})]})]},b.id))})]}),M==="code"&&n.jsxs("div",{className:"omni-codegen-panel",children:[n.jsx("div",{className:"omni-codegen-frameworks",children:["java","python","javascript","wdio"].map(b=>n.jsx("button",{className:`omni-fw-btn ${Q===b?"active":""}`,onClick:()=>re(b),children:Nd[b]},b))}),le?n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"omni-codegen-locator-selector",children:[n.jsx("span",{className:"omni-codegen-label",children:"Locator:"}),n.jsx(Yn,{selectSize:"sm",value:le.strategy,onChange:b=>{var I;const $=(I=f.suggestedLocators)==null?void 0:I.find(_=>_.strategy===b.target.value);$&&he($)},className:"flex-1",children:(js=f.suggestedLocators)==null?void 0:js.map(b=>n.jsxs("option",{value:b.strategy,children:[b.strategy," — ",Un(b.strategy,b.value).level]},b.strategy))})]}),n.jsxs("div",{className:"omni-codegen-output",children:[n.jsxs("div",{className:"omni-codegen-header",children:[n.jsx("span",{className:"omni-codegen-lang",children:Q==="java"?"Java / TestNG":Q==="python"?"Python / unittest":Q==="javascript"?"JavaScript / Mocha":"WebdriverIO"}),n.jsx("button",{className:"omni-copy-btn",onClick:()=>oe(Zs(f,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",Q,le),"code"),children:T==="code"?n.jsx(pt,{size:12}):n.jsx(Oe,{size:12})})]}),n.jsx("pre",{className:"omni-codegen-pre theme-dark",children:n.jsx("code",{children:Zs(f,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",Q,le)})})]})]}):n.jsxs("div",{className:"omni-empty-state small",children:[n.jsx(Is,{size:24}),n.jsx("span",{children:"No locators available for this element"})]})]})]}):o!=null&&o.hierarchy?n.jsxs("div",{className:"omni-summary-panel",children:[n.jsxs("div",{className:"omni-summary-hero",children:[n.jsx(Cn,{size:28}),n.jsxs("div",{children:[n.jsx("div",{className:"omni-summary-title",children:"No element selected"}),n.jsx("div",{className:"omni-summary-subtitle",children:"Click any node in the tree (or use Inspect mode on the device) to drill in."})]})]}),n.jsxs("div",{className:"omni-section",children:[n.jsx("div",{className:"omni-section-header",children:"Snapshot stats"}),n.jsxs("div",{className:"omni-summary-stats",children:[n.jsxs("div",{className:"omni-summary-stat",children:[n.jsx("span",{className:"omni-summary-stat__label",children:"Elements"}),n.jsx("span",{className:"omni-summary-stat__value",children:gn})]}),n.jsxs("div",{className:"omni-summary-stat",children:[n.jsx("span",{className:"omni-summary-stat__label",children:"Width"}),n.jsx("span",{className:"omni-summary-stat__value",children:((xs=o.metadata)==null?void 0:xs.screenWidth)??ie.width??"—"})]}),n.jsxs("div",{className:"omni-summary-stat",children:[n.jsx("span",{className:"omni-summary-stat__label",children:"Height"}),n.jsx("span",{className:"omni-summary-stat__value",children:((gs=o.metadata)==null?void 0:gs.screenHeight)??ie.height??"—"})]}),n.jsxs("div",{className:"omni-summary-stat",children:[n.jsx("span",{className:"omni-summary-stat__label",children:"Platform"}),n.jsx("span",{className:"omni-summary-stat__value",children:o.platform||"—"})]})]})]}),ys.length>0&&n.jsxs("div",{className:"omni-section",children:[n.jsx("div",{className:"omni-section-header",children:"By role"}),n.jsx("div",{className:"omni-summary-roles",children:ys.slice(0,8).map(b=>n.jsxs("div",{className:"omni-summary-role",children:[n.jsx("span",{className:"omni-summary-role__icon","aria-hidden":"true",children:Yi[b.key]}),n.jsx("span",{className:"omni-summary-role__name",children:b.role}),n.jsx("span",{className:"omni-summary-role__count",children:b.count})]},b.role))})]})]}):n.jsxs("div",{className:"omni-empty-state",children:[n.jsx(Cn,{size:32}),n.jsx("span",{children:l?"Capturing snapshot…":"Select an element from the tree or screenshot"})]})})]})]})]})]})},Js=5e3;function Sd(e,t=!0){const[s,i]=d.useState("unknown"),r=d.useRef("unknown");return d.useEffect(()=>{if(!e||!t){i("unknown"),r.current="unknown";return}let a=!1,c;const l=m=>{a||m===r.current||(r.current=m,i(m))},u=async()=>{if(!a){if(c&&(clearTimeout(c),c=void 0),typeof document<"u"&&document.visibilityState==="hidden"){c=setTimeout(u,Js);return}try{const m=await U.getDisplayState(e);l((m==null?void 0:m.state)??"unknown")}catch{}a||(c=setTimeout(u,Js))}};u();const o=()=>{document.visibilityState==="visible"&&u()};return document.addEventListener("visibilitychange",o),()=>{a=!0,c&&clearTimeout(c),document.removeEventListener("visibilitychange",o)}},[e,t]),s}function kd(e,t){const s=d.useRef(e),i=d.useRef(t);s.current=e,i.current=t,d.useEffect(()=>{const r=()=>s.current(),a=c=>{var l;c.persisted&&((l=i.current)==null||l.call(i))};return window.addEventListener("pagehide",r),window.addEventListener("pageshow",a),()=>{window.removeEventListener("pagehide",r),window.removeEventListener("pageshow",a)}},[])}const Qs=5e3,Ad=500,Rd=1e4,Ed=10,$d=50;function Td(e,t,s){const i=`${((s==null?void 0:s.levels)??[]).join(",")}|${(s==null?void 0:s.process)??""}`,[r,a]=d.useState([]),[c,l]=d.useState(!1),[u,o]=d.useState(null),[m,h]=d.useState(!1),x=d.useRef(null),f=d.useRef(0),y=d.useRef(void 0),w=d.useRef(()=>{}),g=d.useRef([]),C=d.useRef(void 0),N=d.useRef(0),v=d.useRef(void 0),p=d.useCallback(()=>{if(g.current.length===0)return;const T=g.current;g.current=[],a(z=>{const M=z.concat(T);return M.length>Qs?M.slice(-Qs):M})},[]),j=d.useCallback(()=>{C.current===void 0&&(C.current=window.setTimeout(()=>{C.current=void 0,p()},$d))},[p]),k=d.useCallback(()=>{g.current=[],a([])},[]);d.useEffect(()=>{if(!t){l(!1),o(null),h(!1);return}o(null),h(!1),f.current=0;const T={cancelled:!1},z=()=>{if(T.cancelled)return;if(f.current>=Ed){h(!0);return}const O=Math.min(Ad*2**f.current,Rd);f.current+=1,y.current=window.setTimeout(M,O)},M=async()=>{if(!T.cancelled)try{const O=await fetch(`/xenon/api/control/${encodeURIComponent(e)}/stream/ticket`,{method:"POST",credentials:"include"});if(T.cancelled)return;if(!O.ok){z();return}const{ticket:Y}=await O.json();if(T.cancelled)return;if(!Y){z();return}const S=window.location.protocol==="https:"?"wss":"ws",[q,G]=i.split("|"),B=(q?`&levels=${encodeURIComponent(q)}`:"")+(G?`&process=${encodeURIComponent(G)}`:""),D=new WebSocket(`${S}://${window.location.host}/xenon/api/control/${encodeURIComponent(e)}/logcat?ticket=${encodeURIComponent(Y)}${B}`);x.current=D,D.onopen=()=>{f.current=0,v.current!==1012&&(g.current=[],a([])),v.current=void 0,l(!0)},D.onmessage=R=>{try{const K=JSON.parse(R.data);g.current.push({...K,seq:N.current++}),j()}catch{}},D.onclose=R=>{if(l(!1),v.current=R.code,p(),R.code===1008){T.cancelled=!0,o(R.reason||"access denied");return}if(R.code===1012){z();return}console.warn(`[logcat] WS closed unexpectedly (code ${R.code}) — retrying`),z()},D.onerror=()=>D.close()}catch{z()}};return w.current=()=>{T.cancelled=!1,f.current=0,o(null),h(!1),M()},M(),()=>{var O;T.cancelled=!0,y.current!==void 0&&window.clearTimeout(y.current),C.current!==void 0&&(window.clearTimeout(C.current),C.current=void 0),p(),(O=x.current)==null||O.close(),x.current=null}},[e,t,i,p,j]);const A=d.useCallback(()=>{w.current()},[]);return{records:r,connected:c,clear:k,deniedReason:u,exhausted:m,retry:A}}const Hn=["V","D","I","W","E","F"];function Id(e){const t=[];let s="",i=!1,r=!1;for(const a of e){if(a==='"'){i=!i,r=!0;continue}if(!i&&/\s/.test(a)){(r||s)&&t.push(s),s="",r=!1;continue}s+=a,r=!0}return(r||s)&&t.push(s),t.filter(a=>a.length>0)}function nr(e,t={}){const s=t.caseSensitive===!0,i=c=>s?c:c.toLowerCase(),r=s?{caseSensitive:!0}:{},a=[];for(const c of Id(e)){const[l,...u]=c.split(":"),o=u.join(":");o&&l.toLowerCase()==="level"?r.minLevel=o.toUpperCase():o&&l.toLowerCase()==="tag"?r.tag=i(o):o&&l.toLowerCase()==="package"?r.pkg=i(o):a.push(c)}return a.length&&(r.text=i(a.join(" "))),r}function Dd(e,t){if(e.synthetic)return!0;if(t.minLevel){const i=Hn.indexOf(t.minLevel),r=Hn.indexOf(e.level);if(i>=0&&r>=0&&r<i)return!1}const s=i=>t.caseSensitive?i:i.toLowerCase();return!(t.tag&&!s(e.tag).includes(t.tag)||t.pkg&&!s(e.pkg??"").includes(t.pkg)||t.text&&!s(e.message).includes(t.text))}function Md(e,t){const s=e.trim().split(/\s+/).filter(Boolean).filter(i=>{const[r,...a]=i.split(":");return!(a.join(":")&&r.toLowerCase()==="level")});return t?["level:"+t.toUpperCase(),...s].join(" "):s.join(" ")}const Tn=[{ios:"Debug",android:"D"},{ios:"Info",android:"I"},{ios:"Default",android:"I"},{ios:"Error",android:"E"},{ios:"Fault",android:"F"}],ei=["V","D","I","W","E","F"];function _d(e){if(!e)return Tn.filter(s=>s.ios!=="Debug").map(s=>s.ios);const t=ei.indexOf(e.toUpperCase());return t<0?Tn.map(s=>s.ios):Tn.filter(s=>ei.indexOf(s.android)>=t).map(s=>s.ios)}function Ld(e){const t=nr(e,{caseSensitive:!0});return{levels:_d(t.minLevel),process:t.pkg||void 0}}const ti=["#7dd3fc","#c4b5fd","#5eead4","#f0abfc","#93c5fd","#a5b4fc","#67e8f9","#d8b4fe","#f9a8d4","#99f6e4","#bae6fd","#e9d5ff"];function Od(e){let t=2166136261;for(let s=0;s<e.length;s++)t^=e.charCodeAt(s),t=Math.imul(t,16777619)>>>0;return t>>>0}function zd(e){return e?ti[Od(e)%ti.length]:"var(--text-muted)"}const Vn=5e5;function sr(e){return`${new Date(e.ts).toISOString()} ${e.pid} ${e.level}/${e.tag}: ${e.message}`}function Pd(e){return{lines:[],startedAt:e,dropped:0}}function Fd(e,t){for(const s of t){if(e.lines.length>=Vn){e.dropped+=1;continue}e.lines.push(sr(s))}return e}function Bd(e,t,s){const i=["# Xenon logcat recording",`# device: ${s}`,`# started: ${new Date(e.startedAt).toISOString()}`,`# stopped: ${new Date(t).toISOString()}`,`# duration: ${((t-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 ${Vn}-line cap. This capture is INCOMPLETE.`);const r=e.lines.join(`
|
|
270
|
+
`),a=e.dropped>0?`
|
|
271
|
+
# --- TRUNCATED: ${e.dropped} line(s) not captured (cap ${Vn}) ---`:"";return`${i.join(`
|
|
272
|
+
`)}
|
|
273
|
+
|
|
274
|
+
${r}${a}
|
|
275
|
+
`}function Wd(e,t){const s=new Date(t).toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");return`logcat-${e}-${s}.txt`}const ni=Hn.filter(e=>e!=="V").map(e=>({value:e,label:e==="F"?"F only":`${e} and above`})),Ud=new Intl.DateTimeFormat([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function si(e,t){const s=URL.createObjectURL(new Blob([e],{type:"text/plain"})),i=document.createElement("a");i.href=s,i.download=t,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(s),0)}const Hd=d.memo(function({record:t,index:s,isHit:i,isActiveHit:r}){return n.jsxs("div",{"data-row-index":s,className:`logcat-row ${t.synthetic?"is-synthetic":""} ${i?"is-hit":""} ${r?"is-active-hit":""}`,children:[n.jsx("span",{className:"logcat-time",children:Ud.format(t.ts)}),n.jsxs("span",{className:"logcat-pid",children:[t.pid,"-",t.tid]}),n.jsx("span",{className:"logcat-tag",title:t.tag,style:{color:zd(t.tag)},children:t.tag}),n.jsx("span",{className:"logcat-pkg",title:t.pkg,children:t.pkg??""}),n.jsx("span",{className:`logcat-level lvl-${t.level}`,children:t.level}),n.jsx("span",{className:"logcat-msg",children:t.message})]})});function Vd({udid:e,platform:t}){const s=(t||"").toLowerCase(),i=s==="ios",r=s==="android"||i,[a,c]=d.useState(""),l=d.useMemo(()=>i?Ld(a):void 0,[i,a]),{records:u,connected:o,clear:m,deniedReason:h,exhausted:x,retry:f}=Td(e,r,l),[y,w]=d.useState(!0),[g,C]=d.useState(!1),[N,v]=d.useState(!0),[p,j]=d.useState(""),[k,A]=d.useState(0),T=d.useRef(null),z=d.useRef(null),M=d.useRef(null),[O,Y]=d.useState(!1),[S,q]=d.useState(0),G=d.useRef(-1),B=d.useMemo(()=>nr(a,{caseSensitive:g}),[a,g]),D=d.useMemo(()=>u.filter(P=>Dd(P,B)),[u,B]),R=d.useMemo(()=>{if(!p)return[];const P=g?p:p.toLowerCase(),E=[];return D.forEach((Z,W)=>{(g?`${Z.tag} ${Z.message}`:`${Z.tag} ${Z.message}`.toLowerCase()).includes(P)&&E.push(W)}),E},[D,p,g]),K=R.length?Math.min(k,R.length-1):0,Q=d.useMemo(()=>new Set(R),[R]),re=d.useCallback(P=>{var Z,W;if(!R.length)return;const E=(K+P+R.length)%R.length;A(E),w(!1),(W=(Z=z.current)==null?void 0:Z.querySelector(`[data-row-index="${R[E]}"]`))==null||W.scrollIntoView({block:"center"})},[R,K]),le=ni.some(P=>P.value===B.minLevel)?B.minLevel:"",he=d.useCallback(()=>{si(D.map(sr).join(`
|
|
276
|
+
`),`logcat-${e}-${Date.now()}.txt`)},[D,e]);d.useEffect(()=>{const P=M.current;if(!P||!u.length)return;const E=u.filter(W=>W.seq>G.current);if(!E.length)return;const Z=G.current+1;G.current>=0&&E[0].seq>Z&&(P.dropped+=E[0].seq-Z),Fd(P,E),G.current=E[E.length-1].seq,q(P.lines.length)},[u]);const ie=d.useCallback(()=>{const P=M.current;if(!P){G.current=u.length?u[u.length-1].seq:-1,M.current=Pd(Date.now()),q(0),Y(!0);return}const E=Bd(P,Date.now(),e);M.current=null,Y(!1),q(0),si(E,Wd(e,P.startedAt))},[u,e]);if(d.useEffect(()=>{var P;y&&((P=T.current)==null||P.scrollIntoView({block:"end"}))},[D.length,y]),!r)return n.jsxs("div",{className:"log-empty-state",children:[n.jsx("p",{className:"log-empty-title",children:"Live logs are not available here"}),n.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 ge=h?"Denied":x?"Offline":o?"Live":"Connecting",ve=!o&&(!!h||x);return n.jsxs("div",{className:"logcat-root",children:[n.jsxs("div",{className:"log-toolbar",children:[n.jsxs("div",{className:"log-filter-group",children:[n.jsxs("div",{className:"log-stat-pill",title:h??void 0,children:[n.jsx("span",{className:`log-live-dot ${o?"active":""} ${ve?"is-error":""}`}),ge]}),n.jsxs("div",{className:"log-stat-pill logcat-count",children:[D.length," / ",u.length]}),n.jsxs(Yn,{selectSize:"sm",value:le,onChange:P=>c(Md(a,P.target.value)),"aria-label":"Minimum log level",children:[n.jsx("option",{value:"",children:"All levels"}),ni.map(P=>n.jsx("option",{value:P.value,children:P.label},P.value))]}),n.jsxs("div",{className:"logcat-input-wrap",children:[n.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&&n.jsx("button",{type:"button",className:"logcat-input-btn",onClick:()=>c(""),"aria-label":"Clear filter",title:"Clear filter",children:n.jsx(qn,{size:12})})]}),n.jsxs("div",{className:"logcat-input-wrap",children:[n.jsx("input",{type:"text",className:"type-input-field tiny logcat-find",placeholder:"Find…",value:p,onChange:P=>{j(P.target.value),A(0)},onKeyDown:P=>{P.key==="Enter"&&(P.preventDefault(),re(P.shiftKey?-1:1))},"aria-label":"Find in logs"}),p&&n.jsx("span",{className:"logcat-hit-count","aria-live":"polite",children:R.length?`${K+1}/${R.length}`:"0/0"})]}),n.jsx("button",{type:"button",className:"dc-btn-secondary btn-sm logcat-icon-btn",onClick:()=>re(-1),disabled:!R.length,"aria-label":"Previous match",title:"Previous match (Shift+Enter)",children:n.jsx(pi,{size:14})}),n.jsx("button",{type:"button",className:"dc-btn-secondary btn-sm logcat-icon-btn",onClick:()=>re(1),disabled:!R.length,"aria-label":"Next match",title:"Next match (Enter)",children:n.jsx(hi,{size:14})}),n.jsx("button",{type:"button",className:`dc-btn-secondary btn-sm logcat-icon-btn ${g?"active":""}`,onClick:()=>C(!g),"aria-pressed":g,"aria-label":"Match case",title:"Match case",children:n.jsx(Qr,{size:15})}),n.jsx("button",{type:"button",className:`dc-btn-secondary btn-sm logcat-icon-btn ${N?"active":""}`,onClick:()=>v(!N),"aria-pressed":N,"aria-label":"Soft wrap",title:"Soft wrap long messages",children:n.jsx(Ga,{size:14})})]}),n.jsxs("div",{className:"log-actions-group",children:[(h||x)&&n.jsxs("button",{className:"dc-btn-secondary btn-sm",onClick:f,children:[n.jsx(St,{size:14})," RECONNECT"]}),n.jsxs("button",{className:`dc-btn-secondary btn-sm ${y?"active":""}`,onClick:()=>w(!y),children:[n.jsx(lo,{size:14})," ",y?"FREEZE":"FOLLOW"]}),n.jsxs("button",{className:`dc-btn-secondary btn-sm ${O?"is-recording":""}`,onClick:ie,"aria-pressed":O,title:O?"Stop recording and download the capture":"Record the raw log stream to a file",children:[O?n.jsx(fi,{size:12}):n.jsx(Tr,{size:12})," ",O?`STOP · ${S.toLocaleString()}`:"RECORD"]}),n.jsxs("button",{className:"btn-premium btn-sm",disabled:D.length===0,onClick:he,children:[n.jsx(Dr,{size:14})," EXPORT"]}),n.jsxs("button",{className:"dc-btn-secondary btn-sm",onClick:m,children:[n.jsx(Ln,{size:14})," CLEAR"]})]})]}),n.jsxs("div",{className:`logcat-rows theme-dark ${N?"":"no-wrap"}`,ref:z,children:[h&&n.jsxs("div",{className:"logcat-status-banner is-denied",role:"alert",children:[n.jsx(Le,{size:14}),n.jsxs("span",{children:["Access denied — ",h]})]}),!h&&x&&n.jsxs("div",{className:"logcat-status-banner is-exhausted",role:"alert",children:[n.jsx(Le,{size:14}),n.jsx("span",{children:"Connection lost after repeated attempts. Use Reconnect above to try again."})]}),D.map((P,E)=>n.jsx(Hd,{record:P,index:E,isHit:Q.has(E),isActiveHit:R.length>0&&R[K]===E},P.seq)),n.jsx("div",{ref:T})]})]})}function ir(e){const t=e==null?void 0:e.message;return typeof t=="string"?t.trim():""}function nt(e,t){const s=ir(t);return s?`Couldn’t ${e}: ${s}`:`Couldn’t ${e}.`}function qd(e,t){return e==="android"?"Couldn’t read the clipboard. Check that the Appium Settings app is installed on the device.":nt("read the clipboard",t)}function Kd(e,t){const s=t.trim().toLowerCase();return[...e].sort((i,r)=>i.localeCompare(r)).filter(i=>!s||i.toLowerCase().includes(s))}const Xd=/^[A-Za-z][A-Za-z0-9_-]*(?:\.[A-Za-z0-9_-]+)+$/;function Yd(e){return Xd.test(e.trim())}function us(e){const t=(e||"").toLowerCase();return t==="android"?"android":t==="ios"||t==="tvos"?"ios":null}function Gd(e,t){const s=us(t);return s?e.filter(i=>(i.platform||"").toLowerCase()===s):[]}function Zd(e){return[e.version,e.packageName].filter(Boolean).join(" · ")}function Jd(e){return us(e)==="android"?"Android":"iOS"}function Qd(e){return us(e)==="android"?".apk":".ipa,.app"}const rr="Your browser blocked copying here. The text is selected, so press ⌘C or Ctrl+C.";async function ar(e){var t;try{return(t=navigator.clipboard)!=null&&t.writeText?(await navigator.clipboard.writeText(e),!0):!1}catch{return!1}}function eu({udid:e,platform:t,deviceName:s}){const{toast:i,removeToast:r}=it(),a=rn(),[c,l]=d.useState([]),[u,o]=d.useState("loading"),[m,h]=d.useState(""),[x,f]=d.useState(""),[y,w]=d.useState(!1),[g,C]=d.useState(!1),[N,v]=d.useState([]),[p,j]=d.useState("loading"),[k,A]=d.useState(null),[T,z]=d.useState(null),M=d.useRef(null),O=d.useRef(null),Y=d.useRef(null),S=d.useCallback(async()=>{o("loading");try{const E=await U.listApps(e);l(Array.isArray(E)?E:[]),o("ready")}catch(E){h(ir(E)),o("error")}},[e]);d.useEffect(()=>{S()},[S]);const q=E=>setTimeout(S,E);d.useEffect(()=>{if(!T)return;const E=setTimeout(()=>z(null),1500);return()=>clearTimeout(E)},[T]);const G=async()=>{j("loading");try{const E=await U.getApps();v(Array.isArray(E)?E:[]),j("ready")}catch{j("error")}},B=()=>{y||(C(!0),G())},D=()=>{var E;C(!1),(E=M.current)==null||E.focus()};d.useEffect(()=>{var Z;if(!g||p==="loading")return;const E=(Z=O.current)==null?void 0:Z.querySelector('[role="menuitem"]:not(:disabled)');E==null||E.focus()},[g,p]);const R=async(E,Z)=>{w(!0);const W=i(`Installing ${E} on ${s}…`,"loading",0);try{const J=await Z();J!=null&&J.success?(i(`Installed ${E} on ${s}`,"success"),q(5e3)):i(nt(`install ${E}`,{message:J==null?void 0:J.error}),"error")}catch(J){i(nt(`install ${E}`,J),"error")}finally{r(W),w(!1)}},K=E=>{D(),R(E.name,()=>U.installRepositoryApp(e,E.id))},Q=E=>{var W;const Z=(W=E.target.files)==null?void 0:W[0];E.target.value="",Z&&R(Z.name,()=>U.uploadAndInstallApp(e,Z))},re=async()=>{const E=k;if(A(null),!E)return;const Z=i(`Uninstalling ${E} from ${s}…`,"loading",0);try{await U.uninstallApp(e,E),i(`Uninstalled ${E} from ${s}`,"success"),q(3e3)}catch(W){i(nt(`uninstall ${E}`,W),"error")}finally{r(Z)}},le=async(E,Z)=>{var J,be;if(await ar(E)){z(E);return}const W=(J=Z.closest("li"))==null?void 0:J.querySelector(".actions-app-id");W&&((be=window.getSelection())==null||be.selectAllChildren(W)),i(rr,"info")},he=Kd(c,x),ie=x.trim(),ge=u==="ready"&&he.length===0&&Yd(ie)&&!c.includes(ie),ve=Gd(N,t),P=(E,Z)=>n.jsxs("li",{className:"actions-app-row",children:[n.jsx("span",{className:"actions-app-id",children:E}),Z&&n.jsx("span",{className:"actions-app-note",children:Z}),n.jsxs("span",{className:"actions-app-tools",children:[n.jsx(se,{variant:"ghost",size:"icon","aria-label":T===E?"Copied":`Copy ${E}`,title:T===E?"Copied":"Copy package ID",onClick:W=>le(E,W.currentTarget),children:T===E?n.jsx(pt,{size:13,"aria-hidden":"true"}):n.jsx(Oe,{size:13,"aria-hidden":"true"})}),n.jsx(se,{variant:"ghost",size:"sm",className:"actions-app-uninstall","aria-label":`Uninstall ${E}`,onClick:()=>A(E),children:"Uninstall"})]})]},E);return n.jsxs("section",{className:"actions-section","aria-labelledby":"actions-apps-title",children:[n.jsxs("div",{className:"actions-section-head",children:[n.jsxs("h4",{id:"actions-apps-title",className:"actions-section-title",children:[n.jsx(Ia,{size:15,"aria-hidden":"true"})," Apps"]}),n.jsxs("div",{className:"actions-section-tools",children:[n.jsxs(se,{ref:M,variant:"tonal",size:"sm","aria-haspopup":"menu","aria-expanded":g,"aria-disabled":y||void 0,onClick:B,children:[y?n.jsx(Ct,{className:"animate-spin",size:13,"aria-hidden":"true"}):n.jsx(ga,{size:13,"aria-hidden":"true"}),"Install from library"]}),n.jsxs(se,{variant:"secondary",size:"sm","aria-disabled":y||void 0,onClick:()=>{var E;return!y&&((E=Y.current)==null?void 0:E.click())},children:[n.jsx(Mr,{size:13,"aria-hidden":"true"})," Upload file"]}),n.jsx("input",{ref:Y,type:"file",hidden:!0,"aria-label":"App file to upload",accept:Qd(t),onChange:Q})]})]}),n.jsx(os,{open:g,onClose:D,anchorRef:M,placement:"bottom-end",children:n.jsx("div",{ref:O,className:"actions-library-menu",children:n.jsxs(cs,{children:[p==="loading"&&n.jsx(pe,{disabled:!0,onClick:()=>{},children:"Loading…"}),p==="error"&&n.jsx(pe,{onClick:G,children:"Couldn’t load the library. Retry"}),p==="ready"&&ve.length===0&&n.jsxs(n.Fragment,{children:[n.jsxs(pe,{disabled:!0,onClick:()=>{},children:["No ",Jd(t)," apps in the library yet"]}),n.jsx(pe,{onClick:()=>a("/apps"),children:"Open the Apps library"})]}),p==="ready"&&ve.map(E=>n.jsx(pe,{note:Zd(E)||void 0,onClick:()=>K(E),children:E.name},E.id))]})})}),n.jsxs("div",{className:"actions-apps-tools",children:[n.jsxs("div",{className:"actions-search",children:[n.jsx(Xn,{size:13,className:"actions-search-icon","aria-hidden":"true"}),n.jsx("input",{type:"search",className:"type-input-field compact","aria-label":"Search installed apps",placeholder:`Search ${c.length} installed apps`,value:x,onChange:E=>f(E.target.value)})]}),n.jsx(se,{variant:"ghost",size:"icon","aria-label":"Refresh installed apps",title:"Refresh",onClick:S,children:n.jsx(Ut,{size:13,"aria-hidden":"true"})})]}),u==="loading"&&c.length===0&&n.jsx("p",{className:"actions-list-note",children:"Loading apps…"}),u==="error"&&n.jsxs("div",{className:"actions-list-note",role:"alert",children:["Couldn’t load the apps",m?`: ${m}`:".",n.jsx(se,{variant:"secondary",size:"sm",onClick:S,children:"Retry"})]}),u==="ready"&&c.length===0&&n.jsx("p",{className:"actions-list-note",children:"No apps installed"}),u==="ready"&&c.length>0&&he.length===0&&!ge&&n.jsxs("p",{className:"actions-list-note",children:["No apps match “",ie,"”"]}),n.jsxs("ul",{className:"actions-apps-list","aria-label":"Installed apps",children:[he.map(E=>P(E)),ge&&P(ie,"Not in the list")]}),n.jsx(Zn,{open:k!==null,title:"Uninstall app?",onClose:()=>A(null),footer:n.jsxs(n.Fragment,{children:[n.jsx(se,{variant:"secondary",onClick:()=>A(null),children:"Cancel"}),n.jsx(se,{variant:"danger",onClick:re,children:"Uninstall"})]}),children:n.jsxs("p",{className:"actions-confirm-text",children:["Uninstall ",n.jsx("code",{children:k})," from"," ",n.jsx("span",{className:"actions-confirm-device",children:s}),"? The app and its data are removed from the device."]})})]})}const tu=[{direction:"up",Icon:pi},{direction:"down",Icon:hi},{direction:"left",Icon:Lr},{direction:"right",Icon:Or}];function nu({onSwipe:e}){return n.jsxs("section",{className:"actions-section actions-swipe","aria-labelledby":"actions-swipe-title",children:[n.jsxs("h4",{id:"actions-swipe-title",className:"actions-section-title",children:[n.jsx(ma,{size:15,"aria-hidden":"true"})," Swipe"]}),n.jsx("div",{className:"actions-swipe-buttons",children:tu.map(({direction:t,Icon:s})=>n.jsx(se,{variant:"secondary",size:"icon","aria-label":`Swipe ${t}`,title:`Swipe ${t}`,onClick:()=>e(t),children:n.jsx(s,{size:14,"aria-hidden":"true"})},t))})]})}function su(e,t,s){const i=t/2,r=s/2,a=t*.4,c=s*.4,[l,u,o,m]={up:[i,r+c,i,r-c],down:[i,r-c,i,r+c],left:[i+a,r,i-a,r],right:[i-a,r,i+a,r]}[e].map(Math.round);return{startX:l,startY:u,endX:o,endY:m}}function iu({udid:e,platform:t}){const{toast:s}=it(),[i,r]=d.useState(""),[a,c]=d.useState(!1),[l,u]=d.useState(""),[o,m]=d.useState(null),[h,x]=d.useState(""),[f,y]=d.useState(!1),w=d.useRef(null);d.useEffect(()=>{if(!h)return;const p=setTimeout(()=>x(""),2e3);return()=>clearTimeout(p)},[h]),d.useEffect(()=>{if(!f)return;const p=setTimeout(()=>y(!1),1500);return()=>clearTimeout(p)},[f]);const g=async()=>{if(!(!i.trim()||a)){c(!0);try{await U.typeText(e,i),r(""),x("Sent")}catch(p){s(nt("send the text",p),"error")}finally{c(!1)}}},C=async()=>{m("read");try{const p=await U.getClipboard(e),j=typeof(p==null?void 0:p.content)=="string"?p.content:"";u(j),j||x("The device clipboard is empty")}catch(p){s(qd(t,p),"error")}finally{m(null)}},N=async()=>{if(l){m("write");try{await U.setClipboard(e,l),x("Written to the device")}catch(p){s(nt("write the clipboard",p),"error")}finally{m(null)}}},v=async()=>{var p;if(await ar(l)){y(!0);return}(p=w.current)==null||p.select(),s(rr,"info")};return n.jsxs("section",{className:"actions-section","aria-labelledby":"actions-text-title",children:[n.jsxs("h4",{id:"actions-text-title",className:"actions-section-title",children:[n.jsx(ya,{size:15,"aria-hidden":"true"})," Text and clipboard"]}),n.jsxs("div",{className:"actions-field-row",children:[n.jsx("label",{className:"actions-field-label",htmlFor:"actions-send-text",children:"Send text"}),n.jsx("input",{id:"actions-send-text",type:"text",className:"type-input-field compact",placeholder:"Type text for the focused field…",value:i,onChange:p=>r(p.target.value),onKeyDown:p=>p.key==="Enter"&&g()}),n.jsxs(se,{variant:"secondary",size:"md",onClick:g,disabled:!i.trim()||a,children:[a&&n.jsx(Ct,{className:"animate-spin",size:13,"aria-hidden":"true"}),"Send"]})]}),n.jsxs("div",{className:"actions-field-row",children:[n.jsx("label",{className:"actions-field-label",htmlFor:"actions-clipboard",children:"Clipboard"}),n.jsx("input",{id:"actions-clipboard",ref:w,type:"text",className:"type-input-field compact",placeholder:"Read the device clipboard, or type text to write",value:l,onChange:p=>u(p.target.value)}),n.jsxs(se,{variant:"secondary",size:"md",onClick:C,disabled:o!==null,children:[o==="read"&&n.jsx(Ct,{className:"animate-spin",size:13,"aria-hidden":"true"}),"Read"]}),n.jsxs(se,{variant:"secondary",size:"md",onClick:N,disabled:!l||o!==null,children:[o==="write"&&n.jsx(Ct,{className:"animate-spin",size:13,"aria-hidden":"true"}),"Write to device"]}),n.jsx(se,{variant:"ghost",size:"icon","aria-label":f?"Copied":"Copy clipboard text",title:f?"Copied":"Copy to your clipboard",onClick:v,disabled:!l,children:f?n.jsx(pt,{size:14,"aria-hidden":"true"}):n.jsx(Oe,{size:14,"aria-hidden":"true"})})]}),n.jsx("p",{className:"actions-status",role:"status",children:h})]})}function ru({udid:e,platform:t,deviceName:s,screenWidth:i,screenHeight:r}){const{toast:a}=it(),c=async l=>{const u=su(l,i,r);try{await U.swipe(e,u.startX,u.startY,u.endX,u.endY)}catch(o){a(nt(`swipe ${l}`,o),"error")}};return n.jsxs("div",{className:"actions-panel",children:[n.jsx(eu,{udid:e,platform:t,deviceName:s}),n.jsx(iu,{udid:e,platform:t}),n.jsx(nu,{onSwipe:c})]})}function au({device:e,onClose:t,titleId:s}){const{toast:i}=it(),r=rn(),{tab:a}=ai(),c=Kn(),l=d.useRef(null),[u,o]=d.useState({width:0,height:0}),[m,h]=d.useState("inspect"),[x,f]=d.useState(null),[y,w]=d.useState(a||"actions"),g=y==="omni"&&m==="inspect",[C,N]=d.useState(!0),[v,p]=d.useState([]),[j,k]=d.useState(null),[A,T]=d.useState(!1),[z,M]=d.useState(!1),[O,Y]=d.useState(0),[S,q]=d.useState(e),[G,B]=d.useState(0),D=d.useCallback(()=>B(Date.now()),[]),R=ds(S),[K,Q]=d.useState(!1),[re,le]=d.useState(!1),he=10,[ie,ge]=d.useState(!1),[ve,P]=d.useState(!1),E=Sd(S==null?void 0:S.udid,!re),Z=()=>{navigator.clipboard.writeText(S.udid).catch(()=>{}),ge(!0),setTimeout(()=>ge(!1),1500)},W=d.useRef(""),J=d.useRef(null),[be,Ne]=d.useState(!1);d.useEffect(()=>{y&&(!a||a!==y)&&r(`/devices/${e.udid}/control/${y}${c.search}`,{replace:!0})},[y,a,e.udid,r,c.search]);const[rt,Ye]=d.useState(0);kd(()=>{U.stopStream(S.udid).catch(()=>{})},()=>Ye(F=>F+1)),d.useEffect(()=>((async()=>{try{M(!0),await U.startStream(S.udid);const ne=(await U.getDevices()).find(ae=>ae.udid===S.udid);ne&&q(ne)}catch(X){console.error("Auto-start stream failed:",X)}finally{M(!1)}})(),()=>{U.stopStream(S.udid).catch(()=>{})}),[e.udid,rt]);const Ue=parseInt(S.screenWidth||"1080",10),Ge=parseInt(S.screenHeight||"1920",10),te=Math.min(Ue,Ge),me=Math.max(Ue,Ge),He=te/me,Ze=d.useCallback(()=>{const F=!C,X=F?window.innerHeight*.55:window.innerHeight*.7,ne=620,Ce=window.innerWidth>900;let de;F?de=Ce?Math.min(window.innerWidth*.8,window.innerWidth-ne):window.innerWidth*.8:de=window.innerWidth*.45;const Se=C?He:1/He;let oe,ce;C?(oe=X,ce=oe*Se,ce>de&&(ce=de,oe=ce/Se)):(ce=de,oe=ce/Se,oe>X&&(oe=X,ce=oe*Se)),o({width:ce,height:oe})},[He,C]);d.useEffect(()=>(Ze(),window.addEventListener("resize",Ze),()=>window.removeEventListener("resize",Ze)),[Ze]),d.useEffect(()=>{const F=async()=>{if(W.current.length>0){const ne=W.current;W.current="";try{await U.typeText(S.udid,ne)}catch(ae){console.error("Keyboard buffering flush failed:",ae)}finally{D()}}},X=ne=>{const ae=document.activeElement;if(ae&&(ae.tagName==="INPUT"||ae.tagName==="TEXTAREA"||ae.isContentEditable)||!be&&y!=="terminal")return;const de=ne.key;de==="Enter"?(J.current&&clearTimeout(J.current),F(),U.pressKey(S.udid,S.platform==="android"?66:"enter").finally(D)):de==="Backspace"?(J.current&&clearTimeout(J.current),F(),U.pressKey(S.udid,S.platform==="android"?67:"backspace").finally(D)):de.length===1&&(W.current+=de,J.current&&clearTimeout(J.current),J.current=setTimeout(()=>{F()},50))};return window.addEventListener("keydown",X),()=>{window.removeEventListener("keydown",X),J.current&&clearTimeout(J.current)}},[S.udid,S.platform,be,y,D]);const[at,dn]=d.useState(Date.now()),Tt=()=>{const F=O>0?`r=${O}&`:"";return S.session_id&&!String(S.session_id).startsWith("manual_")?`/xenon/api/session/${S.session_id}/live_video?${F}t=${at}`:`/xenon/api/control/${S.udid}/stream?${F}t=${at}`};d.useEffect(()=>{O>0&&dn(Date.now())},[O]),d.useEffect(()=>{if(K||re)return;const F=setTimeout(()=>le(!0),3e4);return()=>clearTimeout(F)},[K,re,O]);const De=d.useRef(null),ot=F=>{const X=F.currentTarget.getBoundingClientRect();return{x:F.clientX-X.left,y:F.clientY-X.top}},un=F=>{const X=ot(F);De.current={x:X.x,y:X.y,time:Date.now()}},It=async F=>{var ut;if(!De.current)return;const X=De.current,ne=ot(F),ae=Date.now()-X.time,Ce=(ut=l.current)==null?void 0:ut.getBoundingClientRect(),de=(Ce==null?void 0:Ce.width)||u.width,Se=(Ce==null?void 0:Ce.height)||u.height;let oe,ce,lt,dt;C?(oe=X.x/de*te,ce=X.y/Se*me,lt=ne.x/de*te,dt=ne.y/Se*me):(oe=X.x/de*me,ce=X.y/Se*te,lt=ne.x/de*me,dt=ne.y/Se*te);const Je=Math.abs(lt-oe),jt=Math.abs(dt-ce);try{ae<500&&Je<10&&jt<10?await U.tap(S.udid,Math.round(oe),Math.round(ce)):ae>=500&&Je<10&&jt<10?await U.touchAndHold(S.udid,Math.round(oe),Math.round(ce),ae):await U.swipe(S.udid,Math.round(oe),Math.round(ce),Math.round(lt),Math.round(dt))}catch(yn){console.error("Action failed:",yn)}finally{D()}De.current=null},Dt=()=>U.pressKey(S.udid,S.platform==="android"?Nt.HOME:Nn.HOME).finally(D),mn=()=>U.pressKey(S.udid,Nt.BACK).finally(D),bt=()=>U.pressKey(S.udid,Nt.APP_SWITCH).finally(D),Mt=()=>U.pressKey(S.udid,S.platform==="android"?Nt.VOLUME_UP:Nn.VOLUME_UP).finally(D),ct=()=>U.pressKey(S.udid,S.platform==="android"?Nt.VOLUME_DOWN:Nn.VOLUME_DOWN).finally(D),_t=()=>U.lock(S.udid).finally(D),wt=async()=>{P(!0);try{await U.unlock(S.udid)}finally{D(),setTimeout(()=>P(!1),2500)}},fn=async()=>{T(!0);try{const F=await U.getScreenshot(S.udid);if(F!=null&&F.screenshot){const X={id:zl(),base64:F.screenshot,timestamp:Date.now()};p(ne=>[X,...ne]),k(0)}}catch(F){console.error("Failed to take screenshot:",F)}finally{T(!1)}},Ve=F=>{p(X=>{const ne=X.filter(ae=>ae.id!==F);return ne.length===0?k(null):j!==null&&j>=ne.length&&k(0),ne})},hn=()=>{p([]),k(null),i("Cleared all captured evidence.","success")},pn=F=>{const X=document.createElement("a");X.href=`data:image/png;base64,${F}`,X.download=`screenshot-${S.udid}-${Date.now()}.png`,X.click()};return n.jsxs("div",{className:"device-control-view",children:[n.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),n.jsxs("header",{className:"control-view-top-bar",children:[n.jsxs("button",{className:"back-to-devices-btn",onClick:t,children:[n.jsx(Ts,{size:18})," DEVICES"]}),n.jsxs("div",{className:"device-info-mini",children:[n.jsx("span",{className:`device-pill platform-pill ${S.platform}`,children:S.platform==="ios"?"Apple":"Android"}),n.jsxs("span",{className:"device-pill version-pill",children:["v",S.sdk]}),S.reservedUntil&&Date.now()<S.reservedUntil&&n.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${S.reservedBy}${S.reservationReason?`: ${S.reservationReason}`:""}`,children:["Reserved by ",S.reservedBy||"someone"]}),n.jsx("h2",{id:s,className:"device-name-text",children:R}),n.jsxs("span",{className:"udid-chip",title:S.udid,children:[n.jsx("span",{className:"udid-chip__value",children:S.udid}),n.jsx("button",{type:"button",className:"udid-chip__copy",onClick:Z,"aria-label":"Copy UDID",title:ie?"Copied!":"Copy UDID",children:ie?n.jsx(pt,{size:12}):n.jsx(Oe,{size:12})})]})]})]}),n.jsxs("div",{className:`control-view-main ${C?"":"is-landscape"} ${y==="omni"?"omni-mode":""}`,children:[n.jsxs("div",{className:"device-preview-column",children:[n.jsx("div",{className:"device-screen-wrapper",children:n.jsxs("div",{ref:F=>{l.current=F,f(F)},className:`device-stream-canvas ${C?"":"landscape"} ${be?"focused":""} ${g?"is-inspecting":""}`,style:{width:u.width,height:u.height,background:"var(--black)"},tabIndex:0,onFocus:()=>Ne(!0),onBlur:()=>Ne(!1),onMouseDown:g?void 0:un,onMouseUp:g?void 0:It,children:[re?n.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[n.jsx(Le,{size:40,color:"var(--red, #f87171)"}),n.jsx("p",{style:{marginTop:16},children:"Stream unavailable"}),n.jsx("button",{className:"btn-premium btn-sm",style:{marginTop:12},onClick:()=>{le(!1),Y(0)},children:"Retry"})]}):(z||!K)&&n.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[n.jsx(St,{size:40,className:"animate-spin",color:"var(--color-accent)"}),n.jsx("p",{style:{marginTop:16},children:z?"ESTABLISHING TRACE...":"Waiting for stream…"})]}),!re&&n.jsx("img",{src:Tt(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onLoad:()=>Q(!0),onError:()=>{if(console.warn("Stream failed to load, retrying..."),Q(!1),O>=he){le(!0);return}setTimeout(()=>Y(F=>F+1),2e3)}}),E==="off"&&!re&&n.jsxs("div",{className:"device-screen-off",role:"status",children:[n.jsx(Ra,{size:32}),n.jsx("p",{children:"Display is off"}),n.jsx("span",{children:"The stream is fine — the device is asleep."}),n.jsx("button",{type:"button",className:"btn-premium btn-sm",onClick:wt,disabled:ve,children:ve?"Waking…":"Wake device"})]})]})}),n.jsxs("aside",{className:"device-footer-actions",role:"toolbar","aria-label":"Device controls","aria-orientation":C?"vertical":"horizontal",children:[n.jsx("button",{className:`footer-action-btn ${C?"active":""}`,onClick:()=>N(!0),title:"Portrait","aria-label":"Portrait orientation","aria-pressed":C,children:n.jsx(za,{size:18})}),n.jsx("button",{className:`footer-action-btn ${C?"":"active"}`,onClick:()=>N(!1),title:"Landscape","aria-label":"Landscape orientation","aria-pressed":!C,children:n.jsx(La,{size:18})}),n.jsx("div",{className:"footer-divider"}),n.jsx("button",{className:"footer-action-btn",onClick:Dt,title:"Home","aria-label":"Home",children:n.jsx(Ir,{size:18})}),S.platform==="android"&&n.jsxs(n.Fragment,{children:[n.jsx("button",{className:"footer-action-btn",onClick:mn,title:"Back","aria-label":"Back",children:n.jsx(Ts,{size:18})}),n.jsx("button",{className:"footer-action-btn",onClick:bt,title:"App switcher","aria-label":"App switcher",children:n.jsx(fi,{size:18})})]}),n.jsx("div",{className:"footer-divider"}),n.jsx("button",{className:"footer-action-btn",onClick:Mt,title:"Volume up","aria-label":"Volume up",children:n.jsx(oo,{size:18})}),n.jsx("button",{className:"footer-action-btn",onClick:ct,title:"Volume down","aria-label":"Volume down",children:n.jsx(ro,{size:18})}),n.jsx("button",{className:"footer-action-btn",onClick:_t,title:"Lock device","aria-label":"Lock device",children:n.jsx(zr,{size:18})}),n.jsx("button",{className:"footer-action-btn",onClick:wt,title:"Unlock device","aria-label":"Unlock device",children:n.jsx(ja,{size:18})})]})]}),n.jsxs("div",{className:"device-interactions-column",children:[n.jsxs("div",{className:"interaction-tabs",role:"tablist",children:[n.jsxs("button",{className:`tab-btn ${y==="actions"?"active":""}`,onClick:()=>w("actions"),role:"tab","aria-selected":y==="actions",children:[n.jsx(di,{size:13}),n.jsx("span",{children:"Actions"})]}),n.jsxs("button",{className:`tab-btn ${y==="screenshot"?"active":""}`,onClick:()=>w("screenshot"),role:"tab","aria-selected":y==="screenshot",children:[n.jsx(jn,{size:13}),n.jsx("span",{children:"Screenshot"})]}),n.jsxs("button",{className:`tab-btn ${y==="logs"?"active":""}`,onClick:()=>w("logs"),role:"tab","aria-selected":y==="logs",children:[n.jsx(yi,{size:13}),n.jsx("span",{children:"Logs"})]}),n.jsxs("button",{className:`tab-btn ${y==="terminal"?"active":""}`,onClick:()=>w("terminal"),role:"tab","aria-selected":y==="terminal",children:[n.jsx(_r,{size:13}),n.jsx("span",{children:"Shell"})]}),n.jsxs("button",{className:`tab-btn ${y==="omni"?"active":""}`,onClick:()=>w("omni"),role:"tab","aria-selected":y==="omni",children:[n.jsx(Ua,{size:13}),n.jsx("span",{children:"Omni-Vision"})]})]}),n.jsx("div",{className:`interactions-scroll-area ${y==="terminal"?"terminal-mode":""} ${y==="screenshot"||y==="logs"?"screenshot-mode":""}`,children:n.jsxs("div",{className:"tab-content",children:[y==="omni"&&n.jsx("div",{className:"omni-inspector-tab-wrapper animate-fade-in",children:n.jsx(Cd,{sessionId:S.session_id?String(S.session_id):null,udid:S.udid,streamUrl:Tt(),embedded:!0,overlayTarget:x,onModeChange:h,deviceActionAt:G})}),y==="actions"&&n.jsx(ru,{udid:S.udid,platform:S.platform,deviceName:R,screenWidth:te,screenHeight:me}),y==="screenshot"&&n.jsxs("div",{className:"action-card screenshot-card",children:[v.length>0&&n.jsx("header",{className:"action-card-header",children:n.jsx("button",{className:"btn-text-only",onClick:hn,children:"CLEAR ALL"})}),n.jsxs("div",{className:`screenshot-workspace ${v.length===0?"is-empty":""}`,children:[n.jsxs("div",{className:"screenshot-gallery-sidebar",children:[n.jsxs("button",{className:"btn-premium take-screenshot-btn",onClick:fn,disabled:A,children:[A?n.jsx(Ct,{className:"animate-spin",size:16}):n.jsx(jn,{size:16}),n.jsx("span",{children:A?"CAPTURING...":"NEW CAPTURE"})]}),n.jsxs("div",{className:"screenshot-thumbnails-list",children:[v.length===0&&!A&&n.jsxs("div",{className:"empty-gallery-state",children:[n.jsx(jn,{size:20,className:"empty-gallery-icon"}),n.jsx("p",{className:"empty-gallery-title",children:"No captures yet"}),n.jsx("p",{className:"empty-gallery-hint",children:"Grab a screenshot of the device to begin analysis."})]}),v.map((F,X)=>n.jsxs("div",{className:`screenshot-thumb-item ${j===X?"active":""}`,onClick:()=>k(X),children:[n.jsx("img",{src:`data:image/png;base64,${F.base64}`,alt:"Thumb"}),n.jsx("span",{className:"thumb-time",children:new Date(F.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),n.jsx("button",{className:"thumb-delete-btn",onClick:ne=>{ne.stopPropagation(),Ve(F.id)},children:n.jsx(Ln,{size:12})})]},F.id))]})]}),n.jsx("div",{className:"screenshot-main-preview",children:j!==null&&v[j]?n.jsxs("div",{className:"preview-container",children:[n.jsx("div",{className:"preview-image-wrapper",children:n.jsx("img",{src:`data:image/png;base64,${v[j].base64}`,alt:"Selected Evidence"})}),n.jsxs("footer",{className:"preview-footer",children:[n.jsxs("div",{className:"preview-meta",children:[n.jsx("span",{className:"meta-label",children:"ID:"}),n.jsx("span",{className:"meta-value",children:v[j].id.substring(0,8)}),n.jsx("span",{className:"meta-divider",children:"|"}),n.jsx("span",{className:"meta-value",children:Er(v[j].timestamp)})]}),n.jsxs("div",{className:"preview-actions",children:[n.jsx("button",{className:"btn-premium btn-sm",onClick:()=>pn(v[j].base64),children:"DOWNLOAD PNG"}),n.jsxs("button",{className:"btn-destructive btn-sm",onClick:()=>Ve(v[j].id),children:[n.jsx(Ln,{size:14})," DELETE"]})]})]})]}):null})]})]}),y==="logs"&&n.jsx("div",{className:"action-card screenshot-card",children:n.jsx(Vd,{udid:S.udid,platform:S.platform})}),y==="terminal"&&n.jsx("div",{className:"action-card full-height",children:n.jsx(Pl,{platform:(S.platform||"").toLowerCase(),prompt:`${(S.platform||"").toLowerCase()==="ios"?"ios":"adb"} $`,welcomeMessage:`Connected to ${R} (${S.udid}).
|
|
277
|
+
Internal Shell Environment.`,onCommand:async F=>{const X=await U.executeShell(S.udid,F);if(X.error)throw new Error(X.error);return X.output}})})]})})]})]}),S.session_id&&!String(S.session_id).startsWith("manual_")&&n.jsx(wr,{sessionId:String(S.session_id),mode:"slice",windowSec:60,variant:"floating"})]})}const ou=/^(INPUT|TEXTAREA|SELECT)$/;function cu({labelledBy:e,onClose:t,children:s,style:i,...r}){const a=d.useRef(null),c=d.useRef(t);return c.current=t,d.useEffect(()=>{const l=a.current;if(!l)return;const u=document.activeElement,o=[];for(let h=l;h.parentElement&&h!==document.body;h=h.parentElement)for(const x of Array.from(h.parentElement.children))x===h||x.hasAttribute("inert")||x.matches("[aria-live], script, style, link, template")||(x.setAttribute("inert",""),o.push(x));l.contains(document.activeElement)||l.focus();const m=h=>{if(h.key!=="Escape"||h.defaultPrevented)return;const x=h.target;ou.test(x.tagName)||x.isContentEditable||(h.preventDefault(),c.current())};return l.addEventListener("keydown",m),()=>{l.removeEventListener("keydown",m),o.forEach(h=>h.removeAttribute("inert")),u&&u.isConnected&&u!==document.body&&u.focus()}},[]),n.jsx("div",{ref:a,role:"dialog","aria-modal":"true","aria-labelledby":e,tabIndex:-1,style:{outline:"none",...i},...r,children:s})}const lu={status:"all",platform:"all",type:"all",q:""},or=["all",...jl],cr=["all","android","ios","tvos"],lr=["all","real","virtual"];function In(e,t){return t.includes(e)?e:t[0]}function du(e){const t=e.get("q")??"";return{status:In(e.get("status"),or),platform:In(e.get("platform"),cr),type:In(e.get("type"),lr),q:t.trim()?t:""}}function uu(e){const t=new URLSearchParams;return e.status!=="all"&&t.set("status",e.status),e.platform!=="all"&&t.set("platform",e.platform),e.type!=="all"&&t.set("type",e.type),e.q.trim()&&t.set("q",e.q),t}function dr(e){return e.deviceType==="simulator"||e.deviceType==="emulator"?!0:!e.deviceType&&e.realDevice===!1}function ms(e){const t=(e.platform||"").toLowerCase();return t==="android"||t==="ios"||t==="tvos"?t:null}function mu(e){const t=e.deviceType==="emulator"?"Emulator":e.deviceType==="simulator"?"Simulator":"";return[ds(e),e.name,e.manufacturer,e.model,Jn(e.platform),e.sdk,t,e.teamName,e.udid].filter(Boolean).join(" ").toLowerCase()}function Xt(e,t,s,i){if(i!=="status"&&t.status!=="all"&&ls(e,s)!==t.status||i!=="platform"&&t.platform!=="all"&&ms(e)!==t.platform||i!=="type"&&t.type!=="all"&&t.type==="virtual"!==dr(e))return!1;const r=t.q.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return!0;const a=mu(e);return r.every(c=>a.includes(c))}const Dn=e=>Object.fromEntries(e.map(t=>[t,0]));function fu(e,t,s){const i=Dn(or),r=Dn(cr),a=Dn(lr);for(const c of e){if(Xt(c,t,s,"status")&&(i.all+=1,i[ls(c,s)]+=1),Xt(c,t,s,"platform")){r.all+=1;const l=ms(c);l&&(r[l]+=1)}Xt(c,t,s,"type")&&(a.all+=1,a[dr(c)?"virtual":"real"]+=1)}return{status:i,platform:r,type:a}}function hu(e){return e.some(t=>ms(t)==="tvos")}function pu(e){return e.status!=="all"||e.platform!=="all"||e.type!=="all"||e.q.trim()!==""}function yu(e,t){const s=i=>i===1?"device":"devices";return e===t?`${t} ${s(t)}`:`${e} of ${t} ${s(t)}`}function ii({name:e,value:t,anyValue:s,options:i,onChange:r}){const[a,c]=d.useState(!1),l=d.useRef(null),u=d.useRef(null),o=t!==s,m=i.find(f=>f.value===t),h=()=>{var f;c(!1),(f=u.current)==null||f.focus()},x=d.useCallback(f=>{const y=(f==null?void 0:f.querySelector('[aria-checked="true"]'))??(f==null?void 0:f.querySelector('[role="menuitemradio"]'));y==null||y.focus()},[]);return n.jsxs("span",{ref:l,className:`fm${o?" fm-set":""}`,children:[n.jsx("button",{ref:u,type:"button",className:"fm-trigger","aria-haspopup":"menu","aria-expanded":a,onClick:()=>c(f=>!f),children:o?n.jsxs(n.Fragment,{children:[n.jsxs("span",{className:"fm-name",children:[e,":"]})," ",(m==null?void 0:m.label)??t]}):n.jsxs(n.Fragment,{children:[n.jsx(ci,{size:12,"aria-hidden":"true"}),e]})}),o&&n.jsx("button",{type:"button",className:"fm-clear","aria-label":`Clear ${e.toLowerCase()} filter`,onClick:()=>{r(s),h()},children:n.jsx(qn,{size:12,"aria-hidden":"true"})}),n.jsx(os,{open:a,onClose:h,anchorRef:l,placement:"bottom-start",children:n.jsx("div",{ref:x,children:n.jsx(cs,{children:i.map(f=>n.jsx(pe,{checked:f.value===t,note:f.note,trailing:n.jsx("span",{className:"fm-count",children:f.count}),onClick:()=>{r(f.value),h()},children:f.label},f.value))})})})]})}class xu extends je.Component{constructor(t){super(t),this.socketCleanups=[],this.refreshTimeout=null,this.searchRef=je.createRef(),this.onSlash=s=>{var a,c;if(s.key!=="/"||s.ctrlKey||s.altKey||s.metaKey||this.props.params.udid)return;const i=s.target;(a=i==null?void 0:i.closest)!=null&&a.call(i,'input, textarea, select, [contenteditable]:not([contenteditable="false"])')||(s.preventDefault(),(c=this.searchRef.current)==null||c.focus())},this.clearFilters=()=>{var s;this.props.onFiltersChange(lu),(s=this.searchRef.current)==null||s.focus()},this.state={devices:[],activeSessionsCount:0,pendingSessionsCount:0,queueSummary:null,loaded:!1}}componentDidMount(){this.fetchDevices(),this.devicePolling=setInterval(()=>{this.fetchDevices()},1e4);const t=this.props.onSocketEvent("device_unblocked",()=>{this.fetchDevicesDebounced()}),s=this.props.onSocketEvent("device_blocked",()=>{this.fetchDevicesDebounced()});this.socketCleanups.push(t,s),document.addEventListener("keydown",this.onSlash)}componentWillUnmount(){this.devicePolling&&(clearInterval(this.devicePolling),this.devicePolling=void 0),this.refreshTimeout&&(clearTimeout(this.refreshTimeout),this.refreshTimeout=null),this.socketCleanups.forEach(t=>t()),document.removeEventListener("keydown",this.onSlash)}fetchDevicesDebounced(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>{this.refreshTimeout=null,this.fetchDevices()},500)}getBusyDevicesCount(t){return t.filter(s=>s.busy).length}async fetchDevices(){try{const t=await U.getDevices(),s=this.getBusyDevicesCount(t),i=await U.getPendingSessionsCount(),r=await U.getQueueSummary();this.setState({devices:t,activeSessionsCount:s,pendingSessionsCount:i,queueSummary:r,loaded:!0})}catch(t){console.log(t),this.setState({loaded:!0})}}setFilters(t){this.props.onFiltersChange({...this.props.filters,...t})}getFiltered(){const t=Date.now();return this.state.devices.filter(s=>Xt(s,this.props.filters,t))}render(){const t=this.getFiltered(),{udid:s}=this.props.params,i=s?this.state.devices.find(o=>o.udid===s):null,{filters:r}=this.props,a=fu(this.state.devices,r,Date.now()),c=[{value:"all",label:"Any platform",count:a.platform.all},{value:"android",label:"Android",count:a.platform.android},{value:"ios",label:"iOS",count:a.platform.ios}];(hu(this.state.devices)||r.platform==="tvos")&&c.push({value:"tvos",label:"tvOS",count:a.platform.tvos});const l=[{value:"all",label:"Any type",count:a.type.all},{value:"real",label:"Real devices",count:a.type.real},{value:"virtual",label:"Virtual",note:"Simulators and emulators",count:a.type.virtual}],u=`/devices${this.props.locationSearch}`;return n.jsxs("div",{className:"device-explorer-container",children:[n.jsxs("div",{className:"de2-sticky-group",children:[n.jsx(br,{icon:_n,title:"Devices",subtitle:`${this.state.devices.length} device${this.state.devices.length===1?"":"s"} registered across the global pool.`}),n.jsxs("div",{className:"de2-toolbar",children:[n.jsx(Pr,{size:"sm",label:"Status",value:r.status,onChange:o=>this.setFilters({status:o}),segments:[{value:"all",label:"All",count:a.status.all},{value:"ready",label:"Ready",tone:"ready",count:a.status.ready},{value:"busy",label:"Busy",tone:"busy",count:a.status.busy},{value:"reserved",label:"Reserved",tone:"reserved",count:a.status.reserved},{value:"maintenance",label:"Maintenance",tone:"maintenance",count:a.status.maintenance},{value:"offline",label:"Offline",tone:"offline",count:a.status.offline}]}),n.jsxs("div",{className:"de2-toolbar-row",children:[n.jsxs("div",{className:"de2-search-wrap",children:[n.jsx(Xn,{size:13,className:"de2-search-icon","aria-hidden":"true"}),n.jsx("input",{ref:this.searchRef,type:"text",className:"de2-search","aria-label":"Search devices",placeholder:"Search name, model or UDID…",value:r.q,onChange:o=>this.setFilters({q:o.target.value})}),n.jsx("kbd",{className:"de2-key","aria-hidden":"true",children:"/"})]}),n.jsx(ii,{name:"Platform",value:r.platform,anyValue:"all",options:c,onChange:o=>this.setFilters({platform:o})}),n.jsx(ii,{name:"Type",value:r.type,anyValue:"all",options:l,onChange:o=>this.setFilters({type:o})}),pu(r)&&n.jsx(se,{variant:"ghost",size:"sm",onClick:this.clearFilters,children:"Clear"}),n.jsxs("div",{className:"de2-result",children:[this.state.loaded&&n.jsx("span",{"aria-live":"polite",children:yu(t.length,this.state.devices.length)}),n.jsx(se,{variant:"secondary",size:"icon","aria-label":"Refresh devices",title:"Refresh",onClick:()=>this.fetchDevices(),children:n.jsx(Ut,{size:13,"aria-hidden":"true"})})]})]})]})]}),t.length>0?n.jsx(Il,{devices:t,reloadDevices:()=>this.fetchDevices()}):n.jsxs("div",{className:"device-explorer-empty stagger-1",children:[n.jsx("div",{className:"device-explorer-empty-icon",children:this.state.loaded?n.jsx(_n,{size:32}):n.jsx(Ut,{size:32,className:"animate-spin"})}),this.state.loaded?this.state.devices.length===0?n.jsxs(n.Fragment,{children:[n.jsx("h3",{children:"Global Device Registry Empty"}),n.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."}),n.jsxs(se,{variant:"primary",onClick:()=>this.fetchDevices(),children:[n.jsx(Ut,{size:14}),"Manual sync"]})]}):n.jsxs(n.Fragment,{children:[n.jsx("h3",{children:"No devices match these filters"}),n.jsx("p",{children:"Try another filter or search, or clear them to see every device."}),n.jsx(se,{variant:"secondary",onClick:this.clearFilters,children:"Clear filters"})]}):n.jsxs(n.Fragment,{children:[n.jsx("h3",{children:"Loading devices…"}),n.jsx("p",{children:"Syncing the global device registry."})]})]}),i&&n.jsx(cu,{className:"device-control-modal-overlay",labelledBy:"device-control-title",onClose:()=>this.props.navigate(u),children:n.jsx("div",{className:"device-control-modal",children:n.jsx(au,{device:i,titleId:"device-control-title",onClose:()=>this.props.navigate(u)})})})]})}}function Yu(){const e=ai(),t=rn(),s=Kn(),[i,r]=gr(),{on:a}=vr();return n.jsx(xu,{params:e,navigate:t,onSocketEvent:a,filters:du(i),onFiltersChange:c=>r(uu(c),{replace:!0}),locationSearch:s.search})}export{xu as DeviceExplorer,Yu as default};
|