@xenon-device-management/xenon 1.1.21 → 1.1.23
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/{Layouts-7IT8aFLI.js → Layouts-DyOOhYtz.js} +1 -1
- package/lib/public/assets/{ai-settings-BbnfgdEx.js → ai-settings-UTOAls44.js} +1 -1
- package/lib/public/assets/{apps-CRMrI4_p.js → apps-iWYKDaHG.js} +1 -1
- package/lib/public/assets/{badge-CSvl5xIU.js → badge-DPsMqugr.js} +1 -1
- package/lib/public/assets/{button-CvLaGFYj.js → button-C2nVUsus.js} +1 -1
- package/lib/public/assets/{calendar-6w-D6Oaw.js → calendar-ufCcAAd0.js} +1 -1
- package/lib/public/assets/{clock-DcdeWBPr.js → clock-D9Y3wV_k.js} +1 -1
- package/lib/public/assets/{cpu-DiSoXT9n.js → cpu-HdPsjamK.js} +1 -1
- package/lib/public/assets/device-explorer-QINnmim7.js +195 -0
- package/lib/public/assets/{device-explorer-CxdUAoTL.css → device-explorer-vr8x2iik.css} +1 -1
- package/lib/public/assets/{index-ByQwMN5T.js → index-W_MoQvsw.js} +2 -2
- package/lib/public/assets/{lock-B23ibZmo.js → lock-CJ90SvYX.js} +1 -1
- package/lib/public/assets/{maintenance-settings-CirzA6yG.js → maintenance-settings-CLGqmciU.js} +1 -1
- package/lib/public/assets/{mouse-pointer-2-Cz76SHFb.js → mouse-pointer-2-HkRMqHAy.js} +1 -1
- package/lib/public/assets/{plus-BBwlIevt.js → plus-8iOMg9nw.js} +1 -1
- package/lib/public/assets/{session-dashboard-HPDtwPOZ.js → session-dashboard-FUCdTLJc.js} +1 -1
- package/lib/public/assets/{settings-DrZsZwdc.js → settings-DsABv9a7.js} +1 -1
- package/lib/public/assets/{trash-2-DQpvzJec.js → trash-2-g4zyDinF.js} +1 -1
- package/lib/public/assets/{useSocket-Dxsqae2a.js → useSocket-9D3E9Hwl.js} +1 -1
- package/lib/public/assets/{webhook-settings-Cp-B4Nrw.js → webhook-settings-DiEIokQy.js} +1 -1
- package/lib/public/assets/{zap-DovP6iow.js → zap-Dr4fY5UZ.js} +1 -1
- package/lib/public/index.html +1 -1
- package/lib/src/device-managers/ios/WDAClient.js +148 -94
- package/package.json +1 -1
- package/lib/public/assets/device-explorer-CajM63OJ.js +0 -193
package/lib/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as j,r as l,j as e,B as u,d as f,g as C,i as A,T as z}from"./index-
|
|
1
|
+
import{c as j,r as l,j as e,B as u,d as f,g as C,i as A,T as z}from"./index-W_MoQvsw.js";import{X as x}from"./index-C1DBaoSh.js";import{A as P}from"./Layouts-DyOOhYtz.js";import{C as w}from"./cpu-HdPsjamK.js";import{L as v}from"./lock-CJ90SvYX.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as g,u as X,r,j as e,S as z,g as q,X as V}from"./index-
|
|
1
|
+
import{c as g,u as X,r,j as e,S as z,g as q,X as V}from"./index-W_MoQvsw.js";import{X as c}from"./index-C1DBaoSh.js";import{S as H,B as S,D as K}from"./badge-DPsMqugr.js";import{A as D,B as T,U as Z,C as J,a as Q,T as ee}from"./button-C2nVUsus.js";import{Z as se}from"./zap-Dr4fY5UZ.js";import{T as ae}from"./trash-2-g4zyDinF.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as t,r as c,j as i}from"./index-
|
|
1
|
+
import{c as t,r as c,j as i}from"./index-W_MoQvsw.js";import{c as r,a as u}from"./badge-DPsMqugr.js";/**
|
|
2
2
|
* @license lucide-react v0.555.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import{c as E,r,a as At,j as e,X as tt,C as Lt,u as ft,b as nt,R as qe,S as st,d as it,e as yt,T as Tt,f as jt,L as Pe,g as rt}from"./index-W_MoQvsw.js";import{p as lt,H as zt,C as bt,a as Ke,u as Et}from"./useSocket-9D3E9Hwl.js";import{X as D}from"./index-C1DBaoSh.js";import{C as Nt}from"./clock-D9Y3wV_k.js";import{P as wt}from"./plus-8iOMg9nw.js";import{A as kt,T as at,C as Je,a as Ze,U as It,B as Qe}from"./button-C2nVUsus.js";import{M as Rt}from"./mouse-pointer-2-HkRMqHAy.js";import{S as Xe,D as Mt,B as He}from"./badge-DPsMqugr.js";import{Z as _t}from"./zap-Dr4fY5UZ.js";import{L as Ut}from"./lock-CJ90SvYX.js";import{T as Be}from"./trash-2-g4zyDinF.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 Ft=[["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"}]],Ot=E("box",Ft);/**
|
|
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 Pt=[["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"}]],Ct=E("calendar-plus",Pt);/**
|
|
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 Ht=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],ct=E("chevron-left",Ht);/**
|
|
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 Bt=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],Wt=E("chevron-up",Bt);/**
|
|
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 Vt=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],qt=E("clipboard",Vt);/**
|
|
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 Xt=[["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"}]],ot=E("code-xml",Xt);/**
|
|
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 Gt=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Yt=E("file-text",Gt);/**
|
|
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 Kt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],Jt=E("grid-3x3",Kt);/**
|
|
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 Zt=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Qt=E("house",Zt);/**
|
|
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 es=[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],ts=E("layers",es);/**
|
|
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 ss=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],is=E("lightbulb",ss);/**
|
|
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 as=[["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"}]],St=E("lock-open",as);/**
|
|
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 ns=[["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"}]],rs=E("map-pin",ns);/**
|
|
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 ls=[["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"}]],cs=E("message-square",ls);/**
|
|
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 os=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],dt=E("monitor",os);/**
|
|
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 ds=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],hs=E("move",ds);/**
|
|
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 ms=[["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"}]],us=E("package",ms);/**
|
|
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 ps=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],vs=E("panels-top-left",ps);/**
|
|
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 xs=[["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"}]],Ve=E("rotate-cw",xs);/**
|
|
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 gs=[["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"}]],ht=E("shield-alert",gs);/**
|
|
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 fs=[["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"}]],mt=E("sparkles",fs);/**
|
|
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 ys=[["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"}]],js=E("tag",ys);/**
|
|
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 bs=[["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"}]],ut=E("target",bs);/**
|
|
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 Ns=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],ws=E("thermometer",Ns);/**
|
|
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 ks=[["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"}]],Cs=E("touchpad",ks);/**
|
|
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 Ss=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],$s=E("user",Ss);/**
|
|
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 Ds=[["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"}]],$t=E("wifi",Ds);/**
|
|
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 As=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Ls=E("wrench",As),Ts=[{label:"1 Hour",value:"1h"},{label:"2 Hours",value:"2h"},{label:"4 Hours",value:"4h"},{label:"8 Hours",value:"8h"}],zs=({device:n,onClose:t,onReserved:l})=>{const[u,p]=r.useState(""),[s,L]=r.useState("1h"),[v,x]=r.useState(""),[h,m]=r.useState(!1),[A,S]=r.useState(null),U=async()=>{if(!u.trim()){S("Please enter your name/ID");return}m(!0),S(null);try{const w=await D.reserveDevice(n.udid,n.host,u,s,v);w.success?(l(),t()):S(w.error||"Failed to reserve device")}catch(w){S(w.message||"An unexpected error occurred")}finally{m(!1)}};return At.createPortal(e.jsx("div",{className:"reservation-modal-overlay",onClick:t,children:e.jsxs("div",{className:"reservation-modal",onClick:w=>w.stopPropagation(),children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("div",{className:"reservation-modal-header",children:[e.jsxs("div",{className:"reservation-modal-title",children:[e.jsx(Ct,{size:18,className:"title-icon"}),"Reserve Device"]}),e.jsx("button",{className:"close-btn",onClick:t,children:e.jsx(tt,{size:20})})]}),e.jsxs("div",{className:"reservation-modal-body",children:[e.jsxs("div",{className:"device-id-badge",children:[e.jsx("span",{className:"label",children:"Device:"}),e.jsx("span",{className:"value",children:n.udid})]}),e.jsxs("p",{children:["Reserve ",e.jsx("strong",{children:n.name||n.udid})," for exclusive use. This will prevent CI sessions from using this device."]}),e.jsxs("div",{className:"reservation-form-group",children:[e.jsxs("label",{children:[e.jsx($s,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-primary)"}}),"Reserved By"]}),e.jsx("input",{type:"text",className:"reservation-input",placeholder:"Enter your name or ID",value:u,onChange:w=>p(w.target.value),disabled:h})]}),e.jsxs("div",{className:"reservation-form-group",children:[e.jsxs("label",{children:[e.jsx(Nt,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-primary)"}}),"Duration"]}),e.jsx("div",{className:"duration-selector",children:Ts.map(w=>e.jsx("div",{className:`duration-option ${s===w.value?"active":""}`,onClick:()=>L(w.value),children:w.label},w.value))})]}),e.jsxs("div",{className:"reservation-form-group",children:[e.jsxs("label",{children:[e.jsx(cs,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-primary)"}}),"Reason (Optional)"]}),e.jsx("input",{type:"text",className:"reservation-input",placeholder:"e.g., Debugging flaky login test",value:v,onChange:w=>x(w.target.value),disabled:h})]}),A&&e.jsxs("div",{className:"error-message",children:[e.jsx(Lt,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),A]})]}),e.jsxs("div",{className:"reservation-actions",children:[e.jsx("button",{className:"btn-cancel",onClick:t,disabled:h,children:"Cancel"}),e.jsx("button",{className:"btn-reserve",onClick:U,disabled:h||!u.trim(),children:h?"Reserving...":"Confirm Reservation"})]})]})}),document.body)},Es=({device:n,onClose:t,onUpdated:l})=>{const{toast:u}=ft(),[p,s]=r.useState(n.tags||[]),[L,v]=r.useState(""),[x,h]=r.useState(!1),m=r.useRef(null);r.useEffect(()=>{m.current&&m.current.focus()},[]);const A=()=>{const j=L.trim();j&&!p.includes(j)&&(s([...p,j]),v(""))},S=j=>{s(p.filter(T=>T!==j))},U=j=>{j.key==="Enter"?A():j.key==="Escape"&&t()},w=async()=>{h(!0);try{await D.updateDeviceTags(n.udid,n.host,p),l(),t()}catch(j){console.error("Failed to update tags",j),u("Error saving tags. Please try again.","error")}finally{h(!1)}};return e.jsx("div",{className:"tag-modal-overlay",onClick:t,children:e.jsxs("div",{className:"tag-modal-container",onClick:j=>j.stopPropagation(),children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("div",{className:"tag-modal-header",children:[e.jsxs("div",{className:"tag-modal-title",children:[e.jsx(js,{size:18,className:"title-icon"}),"Manage Device Tags"]}),e.jsx("button",{className:"close-btn",onClick:t,children:e.jsx(tt,{size:20})})]}),e.jsxs("div",{className:"tag-modal-body",children:[e.jsxs("div",{className:"device-id-badge",children:[e.jsx("span",{className:"label",children:"Device:"}),e.jsx("span",{className:"value",children:n.udid})]}),e.jsxs("div",{className:"tag-input-section",children:[e.jsx("label",{htmlFor:"tag-input",children:"Add New Tag"}),e.jsxs("div",{className:"input-with-button",children:[e.jsx("input",{ref:m,id:"tag-input",type:"text",placeholder:"e.g. stable, team-a, ios-17",value:L,onChange:j=>v(j.target.value),onKeyDown:U}),e.jsx("button",{className:"add-inline-btn",onClick:A,disabled:!L.trim(),children:e.jsx(wt,{size:16})})]}),e.jsx("p",{className:"input-hint",children:"Press Enter to add multiple tags"})]}),e.jsxs("div",{className:"tags-display-section",children:[e.jsx("label",{children:"Current Tags"}),e.jsx("div",{className:"tags-list",children:p.length>0?p.map(j=>e.jsxs("div",{className:"tag-pill-editable",children:[j,e.jsx("button",{className:"remove-tag",onClick:()=>S(j),children:e.jsx(tt,{size:12})})]},j)):e.jsx("div",{className:"empty-tags",children:"No tags assigned to this device."})})]})]}),e.jsxs("div",{className:"tag-modal-footer",children:[e.jsx("button",{className:"btn-cancel",onClick:t,children:"Cancel"}),e.jsx("button",{className:"btn-save",onClick:w,disabled:x,children:x?"Saving...":"Apply Changes"})]})]})})};class Is extends qe.Component{constructor(t){super(t),this.state={showReservation:!1,showTagManager:!1,showControl:!1}}getStatusClassName(){return this.props.device.offline?"disabled":this.props.device.busy?"busy":this.isReserved()?"reserved":""}getDeviceState(){return this.props.device.offline?"offline":this.props.device.userBlocked?"maintenance":this.props.device.busy?"busy":this.isReserved()?"reserved":"ready"}isReserved(){const{reservedUntil:t}=this.props.device;return t?Date.now()<t:!1}getRemainingReservationTime(){const{reservedUntil:t}=this.props.device;if(!t)return"";const l=t-Date.now();return l<=0?"":lt(l,{compact:!0})}async releaseReservation(t,l){await D.releaseReservation(t,l),this.props.reloadDevices()}async blockDevice(t,l){await D.blockDevice(t,l),this.props.reloadDevices()}async unblockDevice(t,l){await D.unblockDevice(t,l),this.props.reloadDevices()}async manageTags(){this.setState({showTagManager:!0})}render(){var P;const{name:t,sdk:l,deviceType:u,platform:p,udid:s,dashboard_link:L,total_session_count:v,host:x,totalUtilizationTimeMilliSec:h,userBlocked:m,busy:A,session_id:S,reservedBy:U,reservedUntil:w,reservationReason:j,batteryLevel:T,thermalStatus:F,storageFree:b,tags:k,sessionProgress:y,totalHealedCount:R}=this.props.device,M=this.getDeviceState();let _="";try{_=new URL(x).hostname}catch{_=x.split(":")[1].replace("//","")}const q=()=>A?null:this.isReserved()?e.jsx("button",{className:"tactical-btn reserved",onClick:()=>this.releaseReservation(s,x),title:`Reserved by ${U}${j?`: ${j}`:""}. Expires: ${w?new Date(w).toLocaleString():"Never"}`,children:e.jsx(St,{size:14,color:"#38bdf8"})}):m?e.jsx("button",{className:"tactical-btn exit-maintenance",onClick:()=>this.unblockDevice(s,x),title:"Exit Maintenance",children:e.jsx(it,{size:14})}):e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"tactical-btn reserve",onClick:()=>this.setState({showReservation:!0}),title:"Reserve Device",children:e.jsx(Ct,{size:14,color:"#38bdf8"})}),e.jsx("button",{className:"tactical-btn maintenance",onClick:()=>this.blockDevice(s,x),title:"Enter Maintenance",children:e.jsx(Ls,{size:14,color:"#fbbf24"})})]});return e.jsxs("div",{className:`device-info-card-container ${this.getStatusClassName()} group`,children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.1,zIndex:0}}),e.jsxs("div",{className:"card-header relative z-10",children:[e.jsxs("div",{className:"header-left",children:[e.jsx("div",{className:`platform-icon-wrapper ${p}`,children:["ios","tvos"].includes(p)?e.jsx(kt,{size:14}):e.jsx(st,{size:14})}),e.jsx("div",{className:"device-id-mono",title:s,children:s})]}),e.jsx("div",{className:`device-status-badge ${M} ${M==="busy"&&y&&y!=="Session Active"?"pulse":""}`,children:M==="busy"&&y&&y!=="Session Active"?y:M})]}),e.jsxs("div",{className:"device-info-main relative z-10",children:[e.jsx("h3",{className:"device-name",title:t,children:t}),e.jsxs("p",{className:"device-subtext",children:[u.toUpperCase()," • ",l]}),this.props.device.tags&&this.props.device.tags.length>0&&e.jsxs("div",{className:"device-tags-inline",children:[this.props.device.tags.slice(0,3).map(te=>e.jsx("span",{className:"inline-tag",title:te,children:te},te)),this.props.device.tags.length>3&&e.jsxs("span",{className:"inline-tag-overflow",children:["+",this.props.device.tags.length-3]})]})]}),e.jsxs("div",{className:"metrics-grid relative z-10",children:[e.jsxs("div",{className:"metric-item",title:`Location: ${_}`,children:[e.jsx(dt,{size:10,className:"text-dim"}),e.jsx("span",{className:"truncate",children:_})]}),this.props.device.ip&&e.jsxs("div",{className:"metric-item",title:`IP: ${this.props.device.ip}`,children:[e.jsx($t,{size:10,className:"text-dim"}),e.jsx("span",{className:"truncate",children:this.props.device.ip})]}),e.jsxs("div",{className:`metric-item health ${((P=this.props.device.healthStatus)==null?void 0:P.toLowerCase())||"healthy"}`,title:this.props.device.healthCheckError||"Device is healthy",children:[e.jsx("div",{className:"health-dot"}),e.jsx("span",{children:this.props.device.healthStatus||"Healthy"}),R&&R>0&&e.jsxs("span",{className:"heal-badge",children:[e.jsx(it,{size:8})," ",R]})]}),F&&F!=="Unknown"&&e.jsxs("div",{className:"metric-item thermal",title:`Thermal: ${F}`,children:[e.jsx(ws,{size:10,style:{color:F==="Nominal"?"var(--color-primary)":"var(--color-amber)"}}),e.jsx("span",{children:F})]}),T!==void 0&&e.jsxs("div",{className:"metric-item battery",title:`Battery: ${T}%`,children:[e.jsx("div",{className:`mini-battery ${T<20?"low":""}`,children:e.jsx("div",{className:"battery-fill",style:{width:`${T}%`}})}),e.jsxs("span",{children:[T,"%"]})]}),b&&b!=="Unknown"&&e.jsxs("div",{className:"metric-item storage",title:`Free Space: ${b}`,children:[e.jsx(zt,{size:10,style:{color:"var(--color-sky)"}}),e.jsx("span",{children:b})]})]}),e.jsx("div",{className:"dynamic-data-layer relative z-10",children:this.isReserved()?e.jsxs("div",{className:"reservation-micro-banner",children:[e.jsx(Nt,{size:10}),e.jsxs("span",{children:["RES: ",U||"Anon"," (",this.getRemainingReservationTime(),")"]})]}):S?e.jsxs("div",{className:"session-micro-banner",children:[e.jsx(at,{size:10}),e.jsxs("span",{children:["SID: ",S]})]}):e.jsx("div",{className:"utilization-micro-info",children:e.jsxs("span",{children:["UTIL: ",lt(h||0,{compact:!0})]})})}),e.jsxs("div",{className:"action-row relative z-10",children:[e.jsx("button",{className:"tactical-btn add-tag",onClick:()=>this.manageTags(),title:"Manage Tags",children:e.jsx(wt,{size:14})}),q(),e.jsxs("button",{className:`tactical-btn control-btn ${A&&S&&!S.toString().startsWith("manual_")?"disabled":""}`,onClick:()=>!(A&&S&&!S.toString().startsWith("manual_"))&&this.props.navigate(`/devices/${s}/control`),disabled:A&&!!S&&!S.toString().startsWith("manual_"),title:A&&S&&!S.toString().startsWith("manual_")?"Locked: Appium Session":"Take Control",children:[e.jsx(dt,{size:14}),e.jsx("span",{style:{fontSize:"10px",fontWeight:800,letterSpacing:"0.05em",fontFamily:"Outfit, sans-serif"},children:"CTRL"})]})]}),this.state.showReservation&&e.jsx(zs,{device:this.props.device,onClose:()=>this.setState({showReservation:!1}),onReserved:()=>this.props.reloadDevices()}),this.state.showTagManager&&e.jsx(Es,{device:this.props.device,onClose:()=>this.setState({showTagManager:!1}),onUpdated:()=>this.props.reloadDevices()})]})}}function Rs(n){const t=nt();return e.jsx(Is,{...n,navigate:t})}class Ms extends qe.Component{render(){return e.jsx("div",{className:"device-explorer-card-container",children:qe.Children.toArray(this.props.devices.map(t=>e.jsx(Rs,{device:t,reloadDevices:this.props.reloadDevices})))})}}var We,_s=new Uint8Array(16);function Us(){if(!We&&(We=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!We))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return We(_s)}const Fs=/^(?:[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 Os(n){return typeof n=="string"&&Fs.test(n)}var X=[];for(var et=0;et<256;++et)X.push((et+256).toString(16).substr(1));function Ps(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,l=(X[n[t+0]]+X[n[t+1]]+X[n[t+2]]+X[n[t+3]]+"-"+X[n[t+4]]+X[n[t+5]]+"-"+X[n[t+6]]+X[n[t+7]]+"-"+X[n[t+8]]+X[n[t+9]]+"-"+X[n[t+10]]+X[n[t+11]]+X[n[t+12]]+X[n[t+13]]+X[n[t+14]]+X[n[t+15]]).toLowerCase();if(!Os(l))throw TypeError("Stringified UUID is invalid");return l}function Hs(n,t,l){n=n||{};var u=n.random||(n.rng||Us)();return u[6]=u[6]&15|64,u[8]=u[8]&63|128,Ps(u)}const Bs=({onCommand:n,prompt:t="$",welcomeMessage:l="Interactive Shell (Restricted Mode)",platform:u})=>{const[p,s]=r.useState([{type:"system",content:l,timestamp:Date.now()},{type:"system",content:'Type "help" for allowed commands.',timestamp:Date.now()}]),[L,v]=r.useState(""),[x,h]=r.useState([]),[m,A]=r.useState(-1),[S,U]=r.useState(!1),w=r.useRef(null),j=r.useRef(null);r.useEffect(()=>{w.current&&(w.current.scrollTop=w.current.scrollHeight)},[p]);const T=b=>{const k=b.trim();if((k.startsWith("{")||k.startsWith("["))&&(k.endsWith("}")||k.endsWith("]")))try{const y=JSON.parse(k);return JSON.stringify(y,null,2)}catch{}return b},F=async b=>{if(b.key==="Enter"&&!S){const k=L.trim();if(!k)return;if(v(""),s(y=>[...y,{type:"command",content:`${t} ${k}`,timestamp:Date.now()}]),h(y=>[...y,k]),A(-1),U(!0),k==="clear"){s([]),U(!1);return}if(k==="help"){let y="";u==="android"?y=`
|
|
142
|
+
Android Allowed Commands:
|
|
143
|
+
• System Info: getprop, ip addr, date, uptime, cat /proc/meminfo, cat /proc/cpuinfo
|
|
144
|
+
• Process Mgmt: ps, top
|
|
145
|
+
• File System: ls
|
|
146
|
+
• Diagnostics: dumpsys [battery|wifi|power]
|
|
147
|
+
• Packages: pm list packages
|
|
148
|
+
`:(u==="ios"||u==="tvos")&&(y=`
|
|
149
|
+
iOS Allowed Commands:
|
|
150
|
+
• Real Device (go-ios):
|
|
151
|
+
apps, info, list, syslog, deviceinfo, diagnostics
|
|
152
|
+
• Simulator (xcrun simctl):
|
|
153
|
+
listapps, get_app_container, list, getenv
|
|
154
|
+
• Simulator System:
|
|
155
|
+
ls, ps, top, date, uptime, whoami
|
|
156
|
+
`),s(R=>[...R,{type:"output",content:y.trim(),timestamp:Date.now()}]),U(!1);return}try{const y=await n(k),R=T(y||"(No output)");s(M=>[...M,{type:"output",content:R,timestamp:Date.now()}])}catch(y){s(R=>[...R,{type:"error",content:y.message||"Unknown error",timestamp:Date.now()}])}finally{U(!1),setTimeout(()=>{var y;return(y=j.current)==null?void 0:y.focus()},10)}}else if(b.key==="ArrowUp"){if(b.preventDefault(),x.length>0){const k=m===-1?x.length-1:Math.max(0,m-1);A(k),v(x[k])}}else if(b.key==="ArrowDown"&&(b.preventDefault(),m!==-1)){const k=m+1;k>=x.length?(A(-1),v("")):(A(k),v(x[k]))}};return e.jsxs("div",{className:"terminal-container",children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("header",{className:"terminal-header",children:[e.jsxs("div",{className:"terminal-controls",children:[e.jsx("div",{className:"dot red"}),e.jsx("div",{className:"dot yellow"}),e.jsx("div",{className:"dot green"})]}),e.jsxs("div",{className:"terminal-title",children:[u.toUpperCase()," INTERNAL SHELL"]}),e.jsx("div",{className:"terminal-actions",children:e.jsx("button",{className:"terminal-action-btn",onClick:()=>s([]),title:"Clear Terminal",children:"CLEAR"})})]}),e.jsxs("div",{className:"terminal-history",ref:w,onClick:()=>{var b;return(b=j.current)==null?void 0:b.focus()},children:[p.map((b,k)=>e.jsx("div",{className:`terminal-line ${b.type}`,children:b.content},k)),S&&e.jsx("div",{className:"terminal-line system animate-pulse",children:"Executing command..."})]}),e.jsxs("div",{className:"terminal-input-area",children:[e.jsx("span",{className:"terminal-prompt",children:t}),e.jsx("input",{ref:j,className:"terminal-input",value:L,onChange:b=>v(b.target.value),onKeyDown:F,disabled:S,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"Type a command..."})]})]})};function pt(n,t){const l=n.toLowerCase();if(l==="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(l==="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(l==="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 u=(t.match(/\//g)||[]).length;return u>7?{level:"fragile",reason:`${u}-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 l==="-ios predicate string"?{level:"stable",reason:"iOS NSPredicate — native engine, excellent performance on iOS"}:l==="-ios class chain"?{level:"stable",reason:"iOS Class Chain — native iOS, faster than XPath"}:l==="-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"}:l==="class name"?{level:"fragile",reason:"Class name alone is almost never unique — use with explicit index or prefer accessibility id"}:l==="name"?{level:"fragile",reason:"⚠️ Deprecated in Appium 2.x — replace with accessibility id or id"}:l==="link text"?{level:"moderate",reason:"Text-based locator — breaks if copy/label changes"}:{level:"moderate",reason:"Verify reliability for your target platform"}}function vt(n,t,l,u){var b,k,y,R,M,_,q;const{strategy:p,value:s}=u,L=(n.text||n.name||((b=n.type)==null?void 0:b.split(".").pop())||"element").replace(/[^a-zA-Z0-9]/g,"_").replace(/^_+/,"").slice(0,24)||"element",v=L.charAt(0).toLowerCase()+L.slice(1),x=((k=n.type)==null?void 0:k.toLowerCase().includes("edit"))||((y=n.type)==null?void 0:y.toLowerCase().includes("input"))||((R=n.type)==null?void 0:R.toLowerCase().includes("field"))||((M=n.type)==null?void 0:M.toLowerCase().includes("textfield")),h=((_=n.attributes)==null?void 0:_.scrollable)==="true"||((q=n.attributes)==null?void 0:q.scrollable)===!0,m=p.toLowerCase().startsWith("-ios")&&t!=="ios"?`// ⚠️ -ios predicate/class chain ONLY work with XCUITest (iOS)
|
|
157
|
+
`:p.toLowerCase().startsWith("-android")&&t!=="android"?`// ⚠️ -android uiautomator ONLY works with UIAutomator2 (Android)
|
|
158
|
+
`:"",A={"accessibility id":`~${s}`,id:t==="ios"?`-ios predicate string:label == "${s}"`:`android=new UiSelector().resourceId("${s}")`,xpath:`${s}`,"-ios predicate string":`-ios predicate string:${s}`,"-ios class chain":`-ios class chain:${s}`,"-android uiautomator":`android=${s}`},S={"accessibility id":`AppiumBy.accessibilityId("${s}")`,id:`AppiumBy.id("${s}")`,xpath:`AppiumBy.xpath("${s}")`,"-ios predicate string":`AppiumBy.iOSNsPredicateString("${s}")`,"-ios class chain":`AppiumBy.iOSClassChain("${s}")`,"-android uiautomator":`AppiumBy.androidUIAutomator("${s}")`,"class name":`AppiumBy.className("${s}")`},U={"accessibility id":`AppiumBy.ACCESSIBILITY_ID, "${s}"`,id:`AppiumBy.ID, "${s}"`,xpath:`AppiumBy.XPATH, "${s}"`,"-ios predicate string":`AppiumBy.IOS_PREDICATE, "${s}"`,"-ios class chain":`AppiumBy.IOS_CLASS_CHAIN, "${s}"`,"-android uiautomator":`AppiumBy.ANDROID_UIAUTOMATOR, '${s}'`,"class name":`AppiumBy.CLASS_NAME, "${s}"`},w=S[p.toLowerCase()],j=U[p.toLowerCase()],T=A[p.toLowerCase()];return l==="java"?w?`${m}// Appium Java Client 9.x + Selenium 4 + TestNG
|
|
159
|
+
import io.appium.java_client.AppiumBy;
|
|
160
|
+
import io.appium.java_client.${t==="android"?"AndroidDriver":t==="ios"?"IOSDriver":"AppiumDriver"};
|
|
161
|
+
import org.openqa.selenium.WebElement;
|
|
162
|
+
import org.testng.annotations.Test;
|
|
163
|
+
|
|
164
|
+
@Test
|
|
165
|
+
public void test_${v}() {
|
|
166
|
+
WebElement element = driver.findElement(${w});
|
|
167
|
+
${h?'((Scrollable) element).scrollTo("target text");':x?`element.clear();
|
|
168
|
+
element.sendKeys("your text here");`:"element.click();"}
|
|
169
|
+
// Add assertions here via TestNG Assert or Hamcrest
|
|
170
|
+
}`:`// Strategy "${p}" not supported in Appium Java Client`:l==="python"?j?`${m}# Appium Python Client 4.x + pytest
|
|
171
|
+
from appium.webdriver.common.appiumby import AppiumBy
|
|
172
|
+
import pytest
|
|
173
|
+
|
|
174
|
+
def test_${v}(self):
|
|
175
|
+
element = self.driver.find_element(${j})
|
|
176
|
+
${x?`element.clear()
|
|
177
|
+
element.send_keys("your text here")`:"element.click()"}
|
|
178
|
+
# Add assertions here via assert or pytest.assert`:`# Strategy "${p}" not supported in Appium Python Client`:l==="javascript"?T?`${m}// WebdriverIO 9.x + @wdio/appium-service
|
|
179
|
+
describe('${v} test', () => {
|
|
180
|
+
it('should interact with ${v}', async () => {
|
|
181
|
+
const element = await $('${T}');
|
|
182
|
+
await element.waitForDisplayed({ timeout: 5000 });
|
|
183
|
+
${x?`await element.clearValue();
|
|
184
|
+
await element.addValue("your text here");`:"await element.click();"}
|
|
185
|
+
// Add assertions here via expect(element)
|
|
186
|
+
});
|
|
187
|
+
});`:`// Strategy "${p}" not supported in WebdriverIO mobile`:T?`${m}// WebdriverIO 9.x standalone
|
|
188
|
+
const element = await driver.$('${T}');
|
|
189
|
+
await element.waitForExist({ timeout: 5000 });
|
|
190
|
+
${x?`await driver.$('target').clearValue();
|
|
191
|
+
await element.addValue("your text here");`:"await element.click();"}
|
|
192
|
+
// Assert with expect(element).toBeDisplayed()`:`// Strategy "${p}" not supported in WebdriverIO mobile`}function Ws(n){var U,w,j,T,F,b,k,y,R,M,_;const t=(n.type||"").toLowerCase(),l=((U=n.attributes)==null?void 0:U.clickable)==="true"||((w=n.attributes)==null?void 0:w.clickable)===!0,u=((j=n.attributes)==null?void 0:j.enabled)!=="false"&&((T=n.attributes)==null?void 0:T.enabled)!==!1,p=((F=n.attributes)==null?void 0:F.scrollable)==="true"||((b=n.attributes)==null?void 0:b.scrollable)===!0,s=n.text||n.label||n.value||"",L=((k=n.children)==null?void 0:k.length)||0;let v="Element",x="📦";t.includes("button")||t.includes("btn")||l&&L===0?(v="Button",x="🔘"):t.includes("edit")||t.includes("input")||t.includes("field")?(v="Text Input",x="✏️"):t.includes("image")||t.includes("img")||t.includes("imageview")?(v="Image",x="🖼️"):t.includes("scroll")||t.includes("recyclerview")||t.includes("listview")||p?(v="Scrollable List",x="📜"):t.includes("text")||t.includes("label")?(v="Text Label",x="📝"):t.includes("switch")||t.includes("toggle")||t.includes("checkbox")?(v="Toggle / Checkbox",x="☑️"):t.includes("nav")||t.includes("toolbar")||t.includes("tabbar")?(v="Navigation Bar",x="🧭"):L>0&&(v=`Container (${L} children)`,x="🗂️");const h=((y=n.suggestedLocators)==null?void 0:y.find(q=>q.strategy==="accessibility id"||q.strategy==="id"))||((R=n.suggestedLocators)==null?void 0:R[0]),m=u?((M=n.rect)==null?void 0:M.width)===0||((_=n.rect)==null?void 0:_.height)===0?"⚠️ Zero-size element — may not be interactable":void 0:"⚠️ Element is disabled",A=s?` with text "${s.slice(0,30)}"`:"",S=`This is a ${v.toLowerCase()}${A}. ${l?"It can be tapped/clicked.":p?"It supports scrolling.":"It is a visual container."}${L>0?` Contains ${L} child element${L>1?"s":""}.`:""}`;return{role:v,description:S,interactable:l||u,bestLocator:h,warning:m,emoji:x}}function xt(n,t){if(!t)return!0;const l=t.toLowerCase().trim(),u={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"]},p=(n.type||"").toLowerCase(),s=(n.text||n.label||n.value||"").toLowerCase(),L=(n.name||"").toLowerCase(),v=Object.values(n.attributes||{}).join(" ").toLowerCase();for(const[x,h]of Object.entries(u))if(l.includes(x)&&h.some(m=>p.includes(m)))return!0;return p.includes(l)||s.includes(l)||L.includes(l)||v.includes(l)}const Vs=({sessionId:n,udid:t,streamUrl:l})=>{var De,ie,ae,ke,xe,Ae,Ue;const[u,p]=r.useState(!0),[s,L]=r.useState(null),[v,x]=r.useState(null),[h,m]=r.useState(null),[A,S]=r.useState(null),[U,w]=r.useState(new Set(["/"])),[j,T]=r.useState(""),[F,b]=r.useState(null),[k,y]=r.useState("info"),[R,M]=r.useState("java"),[_,q]=r.useState(null),[P,te]=r.useState({width:0,height:0}),[Ce,fe]=r.useState({width:0,height:0}),[Ge,d]=r.useState(!1),[Z,Te]=r.useState("inspect"),Se=r.useRef(null),ye=r.useRef(null),je=r.useRef(null),me=r.useRef(null),ue=r.useCallback(()=>{var z,K,J;if(!Se.current)return;const i=Se.current.getBoundingClientRect(),o=i.width,g=i.height,C=(z=s==null?void 0:s.hierarchy)==null?void 0:z.rect;let O=((K=s==null?void 0:s.metadata)==null?void 0:K.screenWidth)||P.width||1,H=((J=s==null?void 0:s.metadata)==null?void 0:J.screenHeight)||P.height||1;C&&C.width>0&&C.height>0&&(O=C.width,H=C.height);const B=O/H;let W,V;o/g>B?(V=g,W=V*B):(W=o,V=W/B),fe({width:W,height:V})},[s,P]);r.useEffect(()=>(ue(),window.addEventListener("resize",ue),()=>window.removeEventListener("resize",ue)),[ue]),r.useEffect(()=>{t&&ce()},[t]),r.useEffect(()=>{var i;if((i=h==null?void 0:h.suggestedLocators)!=null&&i.length){const o=h.suggestedLocators.find(g=>g.strategy==="accessibility id"||g.strategy==="id")||h.suggestedLocators[0];q(o)}else q(null)},[h]);const ce=async()=>{if(t){p(!0),x(null);try{const i=await D.getInspectorSnapshot(t);L(i);const o=new Set(["/"]),g=(C,O)=>{var H;O<2&&(o.add(C.xpath),(H=C.children)==null||H.forEach(B=>g(B,O+1)))};i.hierarchy&&g(i.hierarchy,0),w(o)}catch(i){x(i.message||"Failed to capture snapshot")}finally{p(!1)}}},ze=i=>{const{naturalWidth:o,naturalHeight:g}=i.currentTarget;te({width:o,height:g})},le=()=>d(!0),Ee=i=>{d(!1);const{naturalWidth:o,naturalHeight:g}=i.currentTarget;o>0&&g>0&&te({width:o,height:g})},Q=l&&!Ge,Ie=i=>{if(Z!=="interact"||!t)return;const o=i.currentTarget.getBoundingClientRect();me.current={x:i.clientX-o.left,y:i.clientY-o.top,time:Date.now()}},oe=async i=>{var de,Fe,Le;if(Z!=="interact"||!t||!me.current)return;const o=me.current,g=i.currentTarget.getBoundingClientRect(),C=i.clientX-g.left,O=i.clientY-g.top,H=Date.now()-o.time,B=Ce.width,W=Ce.height,V=(de=s==null?void 0:s.hierarchy)==null?void 0:de.rect;let z=((Fe=s==null?void 0:s.metadata)==null?void 0:Fe.screenWidth)||P.width,K=((Le=s==null?void 0:s.metadata)==null?void 0:Le.screenHeight)||P.height;if(V&&V.width>0&&V.height>0&&(z=V.width,K=V.height),!z||!K||B===0||W===0)return;const J=(a,c)=>({x:Math.round(a/B*z),y:Math.round(c/W*K),px:a/B,py:c/W}),Y=J(o.x,o.y),ge=J(C,O),se=Math.sqrt(Math.pow(C-o.x,2)+Math.pow(O-o.y,2));if(!(Y.px<0||Y.px>1||Y.py<0||Y.py>1)){try{H<500&&se<10?await D.tap(t,Y.x,Y.y):H>=500&&se<10?await D.touchAndHold(t,Y.x,Y.y,H):se>=10&&await D.swipe(t,Y.x,Y.y,ge.x,ge.y)}catch(a){console.error("Interaction failed:",a)}me.current=null}},Ye=i=>{const o=new Set(U);o.has(i)?o.delete(i):o.add(i),w(o)},$e=()=>{const i=new Set,o=g=>{var C;i.add(g.xpath),(C=g.children)==null||C.forEach(o)};s!=null&&s.hierarchy&&o(s.hierarchy),w(i)},be=()=>w(new Set(["/"])),Re=(i,o)=>{navigator.clipboard.writeText(i),b(o),setTimeout(()=>b(null),2e3)},pe=i=>{var g;let o=1;return(g=i.children)==null||g.forEach(C=>o+=pe(C)),o},Ne=i=>i.xpath.split("/").filter(Boolean).slice(-3),ee=(i,o=0)=>{var V;if(!i)return null;const g=U.has(i.xpath),C=((V=i.children)==null?void 0:V.length)>0,O=(h==null?void 0:h.xpath)===i.xpath,H=(A==null?void 0:A.xpath)===i.xpath,B=i.name||i.type.split(".").pop()||"Element",W=!j||xt(i,j);if(!W&&!C)return null;if(j&&!W){const z=K=>{var J;return xt(K,j)?!0:((J=K.children)==null?void 0:J.some(z))||!1};if(!z(i))return null}return e.jsxs("div",{className:"tree-node",children:[e.jsxs("div",{className:`tree-item ${O?"selected":""} ${H&&!O?"hovered":""}`,onClick:()=>{m(i),y("info")},onMouseEnter:()=>S(i),onMouseLeave:()=>S(null),children:[e.jsx("div",{className:"tree-item-indent",style:{width:`${o*14}px`}}),C?e.jsx("button",{onClick:z=>{z.stopPropagation(),Ye(i.xpath)},className:"tree-toggle",children:g?e.jsx(yt,{size:11}):e.jsx(bt,{size:11})}):e.jsx("span",{className:"tree-toggle-spacer"}),e.jsx(Ot,{size:11,className:"tree-icon"}),e.jsx("span",{className:"tree-label",children:B}),i.text&&e.jsxs("span",{className:"tree-text-preview",children:['"',i.text.slice(0,20),'"']}),C&&e.jsx("span",{className:"tree-badge",children:i.children.length})]}),g&&C&&e.jsx("div",{className:"tree-children",children:i.children.map(z=>ee(z,o+1))})]},i.xpath)},we=i=>{var B,W,V;if(!P.width)return[];const o=[],g=(B=s==null?void 0:s.hierarchy)==null?void 0:B.rect;let C=((W=s==null?void 0:s.metadata)==null?void 0:W.screenWidth)||P.width,O=((V=s==null?void 0:s.metadata)==null?void 0:V.screenHeight)||P.height;g&&g.width>0&&g.height>0&&(C=g.width,O=g.height);const H=(z,K)=>{var Y,ge,se;const J=!z.children||z.children.length===0;((Y=z.rect)==null?void 0:Y.width)>0&&((ge=z.rect)==null?void 0:ge.height)>0&&J&&o.push(e.jsx("div",{className:"omni-hit-area",style:{left:`${z.rect.x/C*100}%`,top:`${z.rect.y/O*100}%`,width:`${z.rect.width/C*100}%`,height:`${z.rect.height/O*100}%`,zIndex:K},onClick:de=>{de.stopPropagation(),m(z),y("info")},onMouseEnter:()=>S(z),onMouseLeave:()=>S(null)},z.xpath)),(se=z.children)==null||se.forEach(de=>H(de,K+1))};return s!=null&&s.hierarchy&&H(s.hierarchy,1),o},ve=(i,o)=>{var H,B,W;if(!(i!=null&&i.rect)||!P.width)return null;const g=(H=s==null?void 0:s.hierarchy)==null?void 0:H.rect;let C=((B=s==null?void 0:s.metadata)==null?void 0:B.screenWidth)||P.width,O=((W=s==null?void 0:s.metadata)==null?void 0:W.screenHeight)||P.height;return g&&g.width>0&&g.height>0&&(C=g.width,O=g.height),e.jsx("div",{className:`omni-frame-${o}`,style:{left:`${i.rect.x/C*100}%`,top:`${i.rect.y/O*100}%`,width:`${i.rect.width/C*100}%`,height:`${i.rect.height/O*100}%`}})},Me=s!=null&&s.hierarchy?pe(s.hierarchy):0,G=h?Ws(h):null,_e={stable:{icon:e.jsx(it,{size:10}),cls:"stable"},moderate:{icon:e.jsx(Tt,{size:10}),cls:"moderate"},fragile:{icon:e.jsx(ht,{size:10}),cls:"fragile"},"very-fragile":{icon:e.jsx(ht,{size:10}),cls:"very-fragile"}};return e.jsx("div",{className:"omni-inspector-container",children:e.jsxs("div",{className:"omni-main-content",children:[e.jsxs("div",{className:"omni-screenshot-panel",children:[e.jsxs("div",{className:"omni-screenshot-header",children:[e.jsxs("div",{className:"omni-header-left",children:[e.jsx("span",{className:"omni-screenshot-title",children:"Device Preview"}),e.jsxs("div",{className:"omni-mode-toggle",children:[e.jsxs("button",{className:`omni-mode-btn ${Z==="inspect"?"active":""}`,onClick:()=>Te("inspect"),title:"Inspection Mode (Highlight Elements)",children:[e.jsx(Rt,{size:12}),e.jsx("span",{children:"Inspect"})]}),e.jsxs("button",{className:`omni-mode-btn ${Z==="interact"?"active":""}`,onClick:()=>Te("interact"),title:"Interaction Mode (Direct Control)",children:[e.jsx(Cs,{size:12}),e.jsx("span",{children:"Interact"})]})]})]}),e.jsxs("button",{className:"omni-refresh-btn",onClick:ce,disabled:u,children:[e.jsx(Ve,{size:12,className:u?"animate-spin":""}),u?"Capturing...":"Refresh"]})]}),e.jsxs("div",{className:"omni-screenshot-container",ref:Se,children:[u&&!Q&&e.jsxs("div",{className:"omni-loading-overlay",children:[e.jsx("div",{className:"omni-spinner"}),e.jsx("span",{children:"Capturing screen..."})]}),!s&&!u&&!Q&&e.jsxs("div",{className:"omni-empty-state",children:[e.jsx(ut,{size:40}),e.jsx("span",{children:"Click Refresh to capture"})]}),Q&&e.jsxs("div",{className:`omni-screenshot-wrapper ${Z==="interact"?"interactable":""}`,onMouseDown:Ie,onMouseUp:oe,children:[e.jsx("img",{ref:je,src:l,onLoad:Ee,onError:le,className:"omni-screenshot-img",style:Z==="interact"?{pointerEvents:"none"}:{},draggable:!1,alt:"Live Device Stream"}),(s==null?void 0:s.hierarchy)&&Z==="inspect"&&e.jsxs("div",{className:"omni-overlay",children:[we(s.hierarchy),ve(A,"hover"),ve(h,"select")]})]}),!Q&&(s==null?void 0:s.screenshot)&&e.jsxs("div",{className:`omni-screenshot-wrapper ${Z==="interact"?"interactable":""}`,onMouseDown:Ie,onMouseUp:oe,children:[e.jsx("img",{ref:ye,src:`data:image/png;base64,${s.screenshot}`,onLoad:ze,className:"omni-screenshot-img",style:Z==="interact"?{pointerEvents:"none"}:{},draggable:!1}),Z==="inspect"&&e.jsxs("div",{className:"omni-overlay",children:[we(s.hierarchy),ve(A,"hover"),ve(h,"select")]})]})]})]}),e.jsxs("div",{className:"omni-tree-panel",children:[e.jsxs("div",{className:"omni-tree-header",children:[e.jsxs("div",{className:"omni-tree-title",children:[e.jsx(ts,{size:14}),e.jsx("span",{children:"Source"}),Me>0&&e.jsxs("span",{className:"omni-count-badge",children:[Me," elements"]})]}),e.jsxs("div",{className:"omni-tree-actions",children:[e.jsx("button",{onClick:$e,className:"omni-action-btn",title:"Expand All",children:e.jsx(Jt,{size:12})}),e.jsx("button",{onClick:be,className:"omni-action-btn",title:"Collapse All",children:e.jsx(vs,{size:12})})]})]}),e.jsxs("div",{className:"omni-tree-search",children:[e.jsx(Xe,{size:14}),e.jsx("input",{type:"text",placeholder:"Search elements... (try 'login button' or 'text field')",value:j,onChange:i=>T(i.target.value)}),j&&e.jsx("button",{onClick:()=>T(""),className:"omni-clear-btn",children:"×"})]}),j&&e.jsxs("div",{className:"omni-search-hint",children:[e.jsx(mt,{size:10}),' Smart search active — try "button", "input", "image"']}),e.jsx("div",{className:"omni-tree-content",children:s!=null&&s.hierarchy?ee(s.hierarchy):e.jsx("div",{className:"omni-empty-state small",children:e.jsx("span",{children:"No hierarchy loaded"})})})]}),e.jsxs("div",{className:"omni-details-panel",children:[e.jsxs("div",{className:"omni-details-tabs",children:[e.jsxs("button",{className:`omni-details-tab ${k==="info"?"active":""}`,onClick:()=>y("info"),children:[e.jsx(rs,{size:12})," Info"]}),e.jsxs("button",{className:`omni-details-tab ${k==="insight"?"active":""}`,onClick:()=>y("insight"),disabled:!h,title:"AI Element Analysis",children:[e.jsx(is,{size:12})," AI Insight"]}),e.jsxs("button",{className:`omni-details-tab ${k==="code"?"active":""}`,onClick:()=>y("code"),disabled:!h,title:"Generate Test Code",children:[e.jsx(ot,{size:12})," Code Gen"]})]}),e.jsx("div",{className:"omni-details-content",children:h?e.jsxs(e.Fragment,{children:[k==="info"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"omni-section",children:[e.jsx("div",{className:"omni-section-header",children:"Element Info"}),e.jsxs("div",{className:"omni-info-table",children:[e.jsxs("div",{className:"omni-info-row",children:[e.jsx("span",{className:"omni-info-key",children:"Type"}),e.jsx("span",{className:"omni-info-value mono",children:h.type})]}),h.text&&e.jsxs("div",{className:"omni-info-row",children:[e.jsx("span",{className:"omni-info-key",children:"Text"}),e.jsx("span",{className:"omni-info-value",children:h.text})]}),e.jsxs("div",{className:"omni-info-row",children:[e.jsx("span",{className:"omni-info-key",children:"Path"}),e.jsx("span",{className:"omni-info-value mono small",children:Ne(h).join(" › ")})]})]})]}),e.jsxs("div",{className:"omni-section",children:[e.jsx("div",{className:"omni-section-header",children:"Layout"}),e.jsx("div",{className:"omni-layout-grid",children:["x","y","width","height"].map(i=>e.jsxs("div",{className:"omni-layout-item",children:[e.jsx("span",{className:"omni-layout-label",children:i.toUpperCase()}),e.jsx("span",{className:"omni-layout-value",children:h.rect[i]})]},i))})]}),e.jsxs("div",{className:"omni-section",children:[e.jsxs("div",{className:"omni-section-header",children:["Locators",e.jsx("span",{className:"omni-section-badge",children:"Stability Scored"})]}),e.jsx("div",{className:"omni-locators-list",children:(De=h.suggestedLocators)==null?void 0:De.map(i=>{const o=pt(i.strategy,i.value),g=_e[o.level];return e.jsxs("div",{className:`omni-locator-row ${(_==null?void 0:_.strategy)===i.strategy?"selected-for-code":""}`,onClick:()=>q(i),title:"Click to use in Code Generator",children:[e.jsxs("div",{className:"omni-locator-left",children:[e.jsxs("div",{className:"omni-locator-top",children:[e.jsx("span",{className:"omni-locator-strategy",children:i.strategy}),e.jsxs("span",{className:`omni-stability-badge ${g.cls}`,title:o.reason,children:[g.icon,o.level]})]}),e.jsx("code",{className:"omni-locator-value",children:i.value}),e.jsx("span",{className:"omni-stability-reason",children:o.reason})]}),e.jsx("button",{onClick:C=>{C.stopPropagation(),Re(i.value,i.strategy)},className:`omni-copy-btn ${F===i.strategy?"copied":""}`,children:F===i.strategy?e.jsx(Je,{size:12}):e.jsx(Ze,{size:12})})]},i.strategy)})})]}),e.jsxs("div",{className:"omni-section",children:[e.jsx("div",{className:"omni-section-header",children:"Attributes"}),e.jsx("div",{className:"omni-attributes-table",children:Object.entries(h.attributes||{}).filter(([i,o])=>o!=null&&o!=="").map(([i,o])=>e.jsxs("div",{className:"omni-attr-row",children:[e.jsx("span",{className:"omni-attr-key",children:i}),e.jsx("span",{className:"omni-attr-value",children:String(o)})]},i))})]})]}),k==="insight"&&G&&e.jsxs("div",{className:"omni-insight-panel",children:[e.jsxs("div",{className:"omni-insight-role",children:[e.jsx("span",{className:"omni-insight-emoji",children:G.emoji}),e.jsxs("div",{children:[e.jsx("div",{className:"omni-insight-role-name",children:G.role}),e.jsx("div",{className:"omni-insight-interactable",children:G.interactable?e.jsxs("span",{className:"omni-badge-green",children:[e.jsx(_t,{size:10})," Interactable"]}):e.jsx("span",{className:"omni-badge-gray",children:"Visual Only"})})]})]}),G.warning&&e.jsx("div",{className:"omni-insight-warning",children:G.warning}),e.jsxs("div",{className:"omni-insight-description",children:[e.jsx(mt,{size:12,className:"omni-insight-icon"}),e.jsx("p",{children:G.description})]}),G.bestLocator&&e.jsxs("div",{className:"omni-insight-best-locator",children:[e.jsx("div",{className:"omni-section-header",children:"Recommended Locator"}),e.jsxs("div",{className:"omni-locator-row",children:[e.jsxs("div",{className:"omni-locator-left",children:[e.jsx("span",{className:"omni-locator-strategy",children:G.bestLocator.strategy}),e.jsx("code",{className:"omni-locator-value",children:G.bestLocator.value})]}),e.jsx("button",{onClick:()=>Re(G.bestLocator.value,"best"),className:`omni-copy-btn ${F==="best"?"copied":""}`,children:F==="best"?e.jsx(Je,{size:12}):e.jsx(Ze,{size:12})})]})]}),e.jsxs("div",{className:"omni-insight-attributes",children:[e.jsx("div",{className:"omni-section-header",children:"Quick Facts"}),e.jsx("div",{className:"omni-quick-facts",children:[{label:"Clickable",value:(ie=h.attributes)==null?void 0:ie.clickable},{label:"Enabled",value:(ae=h.attributes)==null?void 0:ae.enabled},{label:"Scrollable",value:(ke=h.attributes)==null?void 0:ke.scrollable},{label:"Focusable",value:(xe=h.attributes)==null?void 0:xe.focusable},{label:"Children",value:((Ae=h.children)==null?void 0:Ae.length)||0}].map(({label:i,value:o})=>e.jsxs("div",{className:"omni-quick-fact-row",children:[e.jsx("span",{className:"omni-quick-fact-label",children:i}),e.jsx("span",{className:`omni-quick-fact-value ${o==="true"||o===!0?"true":""}`,children:String(o??"—")})]},i))})]})]}),k==="code"&&e.jsxs("div",{className:"omni-codegen-panel",children:[e.jsx("div",{className:"omni-codegen-frameworks",children:["java","python","javascript","wdio"].map(i=>e.jsx("button",{className:`omni-fw-btn ${R===i?"active":""}`,onClick:()=>M(i),children:i==="java"?"☕ Java":i==="python"?"🐍 Python":i==="javascript"?"🟨 JS":"🔷 WD.io"},i))}),_?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"omni-codegen-locator-selector",children:[e.jsx("span",{className:"omni-codegen-label",children:"Locator:"}),e.jsx("select",{value:_.strategy,onChange:i=>{var g;const o=(g=h.suggestedLocators)==null?void 0:g.find(C=>C.strategy===i.target.value);o&&q(o)},className:"omni-fw-select",children:(Ue=h.suggestedLocators)==null?void 0:Ue.map(i=>e.jsxs("option",{value:i.strategy,children:[i.strategy," — ",pt(i.strategy,i.value).level]},i.strategy))})]}),e.jsxs("div",{className:"omni-codegen-output",children:[e.jsxs("div",{className:"omni-codegen-header",children:[e.jsx("span",{className:"omni-codegen-lang",children:R==="java"?"Java / TestNG":R==="python"?"Python / unittest":R==="javascript"?"JavaScript / Mocha":"WebdriverIO"}),e.jsx("button",{className:"omni-copy-btn",onClick:()=>Re(vt(h,(s==null?void 0:s.platform)==="android"?"android":(s==null?void 0:s.platform)==="ios"?"ios":"unknown",R,_),"code"),children:F==="code"?e.jsx(Je,{size:12}):e.jsx(Ze,{size:12})})]}),e.jsx("pre",{className:"omni-codegen-pre",children:e.jsx("code",{children:vt(h,(s==null?void 0:s.platform)==="android"?"android":(s==null?void 0:s.platform)==="ios"?"ios":"unknown",R,_)})})]})]}):e.jsxs("div",{className:"omni-empty-state small",children:[e.jsx(ot,{size:24}),e.jsx("span",{children:"No locators available for this element"})]})]})]}):e.jsxs("div",{className:"omni-empty-state",children:[e.jsx(ut,{size:32}),e.jsx("span",{children:"Select an element from the tree or screenshot"})]})})]})]})})};function qs({device:n,onClose:t}){var Le;const{toast:l,removeToast:u}=ft(),p=nt(),{tab:s}=jt(),L=r.useRef(null),v=r.useRef(null),[x,h]=r.useState({width:0,height:0}),[m,A]=r.useState(s||"actions"),[S,U]=r.useState(""),[w,j]=r.useState(""),[T,F]=r.useState(""),[b,k]=r.useState(!0),[y,R]=r.useState([]),[M,_]=r.useState(null),[q,P]=r.useState(!1),[te,Ce]=r.useState(!1),[fe,Ge]=r.useState(0),[d,Z]=r.useState(n),[Te,Se]=r.useState([]),[ye,je]=r.useState(!1),[me,ue]=r.useState(!1),[ce,ze]=r.useState(null),[le,Ee]=r.useState([]),[Q,Ie]=r.useState(!0),[oe,Ye]=r.useState(""),[$e,be]=r.useState(!1),[Re,pe]=r.useState(0),Ne=r.useRef(""),ee=r.useRef(null),[we,ve]=r.useState(!1);r.useEffect(()=>{m&&(!s||s!==m)&&p(`/devices/${n.udid}/control/${m}`,{replace:!0})},[m,s,n.udid,p]),r.useEffect(()=>{let a;if(m==="logs"){be(!1),pe(0);const c=async()=>{try{const f=await D.getLogs(d.udid);if(pe(N=>N+1),f&&f.logs&&f.logs.trim().length>0){be(!0);const N=f.logs.replace(/\\u[0-9a-fA-F]{4}/g,$=>JSON.parse(`"${$}"`)).replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"").split(`
|
|
193
|
+
`).filter($=>$.trim().length>0);N.length>0&&Ee($=>[...$,...N].slice(-1e3))}else pe(N=>(N>=3&&be(!0),N))}catch(f){console.error("Failed to fetch logs:",f),pe(N=>(N>=3&&be(!0),N))}};c(),a=setInterval(c,3e3)}return()=>clearInterval(a)},[m,d.udid]);const Me=()=>{if(le.length===0)return e.jsx("div",{className:"log-empty-state",children:$e?e.jsxs(e.Fragment,{children:[e.jsx(at,{size:28,style:{color:"var(--text-muted)",marginBottom:12,opacity:.4}}),e.jsx("p",{className:"log-empty-title",children:"No log output yet"}),e.jsx("p",{className:"log-empty-subtitle",children:"The log stream is active but the device is quiet. Interact with the device to generate logs."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Pe,{size:28,className:"animate-spin",style:{color:"var(--primary)",marginBottom:12}}),e.jsx("p",{className:"log-empty-title",children:"Connecting to device syslog..."}),e.jsxs("p",{className:"log-empty-subtitle",children:["Initializing persistent log stream for ",d.name]})]})});const a=le.filter(c=>!oe||c.toLowerCase().includes(oe.toLowerCase()));return a.length===0&&oe?e.jsxs("div",{className:"log-empty-state",children:[e.jsx(Xe,{size:28,style:{color:"var(--text-muted)",marginBottom:12,opacity:.4}}),e.jsxs("p",{className:"log-empty-title",children:['No matches for "',oe,'"']}),e.jsxs("p",{className:"log-empty-subtitle",children:[le.length," lines in buffer. Try a different search term."]})]}):a.map((c,f)=>{let N="log-debug";const $=c.toLowerCase();return $.includes("error")||$.includes("fail")?N="log-error":$.includes("warning")||$.includes("warn")?N="log-warn":($.includes("notice")||$.includes("info"))&&(N="log-notice"),e.jsxs("div",{className:`log-line ${N}`,children:[e.jsx("span",{className:"log-index",children:f+1}),e.jsx("span",{className:"log-content",children:c})]},`${f}-${c.substring(0,10)}`)})};r.useEffect(()=>{m==="logs"&&Q&&v.current&&(v.current.scrollTop=v.current.scrollHeight)},[le,m,Q]),r.useEffect(()=>((async()=>{try{Ce(!0),await D.startStream(d.udid);const f=(await D.getDevices()).find(N=>N.udid===d.udid);f&&Z(f)}catch(c){console.error("Auto-start stream failed:",c)}finally{Ce(!1)}})(),()=>{D.stopStream(d.udid).catch(()=>{})}),[n.udid]);const G=r.useCallback(async()=>{try{je(!0);const a=await D.listApps(d.udid);Array.isArray(a)&&Se(a)}catch(a){console.error("Failed to load apps:",a)}finally{je(!1)}},[d.udid]);r.useEffect(()=>{m==="actions"&&G()},[m,G]);const _e=parseInt(d.screenWidth||"1080",10),De=parseInt(d.screenHeight||"1920",10),ie=Math.min(_e,De),ae=Math.max(_e,De),ke=ie/ae,xe=r.useCallback(()=>{const a=!b,c=a?window.innerHeight*.55:window.innerHeight*.7,f=a?window.innerWidth*.8:window.innerWidth*.45,N=b?ke:1/ke;let $,I;b?($=c,I=$*N,I>f&&(I=f,$=I/N)):(I=f,$=I/N,$>c&&($=c,I=$*N)),h({width:I,height:$})},[ke,b]);r.useEffect(()=>(xe(),window.addEventListener("resize",xe),()=>window.removeEventListener("resize",xe)),[xe]),r.useEffect(()=>{const a=async()=>{if(Ne.current.length>0){const f=Ne.current;Ne.current="";try{await D.typeText(d.udid,f)}catch(N){console.error("Keyboard buffering flush failed:",N)}}},c=f=>{const N=document.activeElement;if(N&&(N.tagName==="INPUT"||N.tagName==="TEXTAREA"||N.isContentEditable)||!we&&m!=="terminal")return;const I=f.key;I==="Enter"?(ee.current&&clearTimeout(ee.current),a(),D.pressKey(d.udid,d.platform==="android"?66:"enter")):I==="Backspace"?(ee.current&&clearTimeout(ee.current),a(),D.pressKey(d.udid,d.platform==="android"?67:"backspace")):I.length===1&&(Ne.current+=I,ee.current&&clearTimeout(ee.current),ee.current=setTimeout(()=>{a()},50))};return window.addEventListener("keydown",c),()=>{window.removeEventListener("keydown",c),ee.current&&clearTimeout(ee.current)}},[d.udid,d.platform,we,m]);const[Ae,Ue]=r.useState(Date.now()),i=()=>{const a=fe>0?`r=${fe}&`:"";return d.session_id&&!String(d.session_id).startsWith("manual_")?`/xenon/api/session/${d.session_id}/live_video?${a}t=${Ae}`:`/xenon/api/control/${d.udid}/stream?${a}t=${Ae}`};r.useEffect(()=>{fe>0&&Ue(Date.now())},[fe]);const o=r.useRef(null),g=a=>{const c=a.currentTarget.getBoundingClientRect();return{x:a.clientX-c.left,y:a.clientY-c.top}},C=a=>{const c=g(a);o.current={x:c.x,y:c.y,time:Date.now()}},O=async a=>{if(!o.current)return;const c=o.current,f=g(a),N=Date.now()-c.time;let $,I,ne,re;b?($=c.x/x.width*ie,I=c.y/x.height*ae,ne=f.x/x.width*ie,re=f.y/x.height*ae):($=c.x/x.width*ae,I=c.y/x.height*ie,ne=f.x/x.width*ae,re=f.y/x.height*ie);const he=Math.abs(ne-$),Oe=Math.abs(re-I);try{N<500&&he<10&&Oe<10?await D.tap(d.udid,Math.round($),Math.round(I)):N>=500&&he<10&&Oe<10?await D.touchAndHold(d.udid,Math.round($),Math.round(I),N):await D.swipe(d.udid,Math.round($),Math.round(I),Math.round(ne),Math.round(re))}catch(Dt){console.error("Action failed:",Dt)}o.current=null},H=()=>D.pressKey(d.udid,d.platform==="android"?3:"home"),B=()=>D.lock(d.udid),W=()=>D.unlock(d.udid),V=async()=>{S.trim()&&(await D.typeText(d.udid,S),U(""))},z=async()=>{try{j("Fetching...");const a=await D.getClipboard(d.udid);a&&a.content!==void 0?j(a.content||"(Clipboard is empty)"):j("No content received")}catch{j("Error: Check Appium Settings app")}},K=async()=>{P(!0);try{const a=await D.getScreenshot(d.udid);if(a!=null&&a.screenshot){const c={id:Hs(),base64:a.screenshot,timestamp:Date.now()};R(f=>[c,...f]),_(0)}}catch(a){console.error("Failed to take screenshot:",a)}finally{P(!1)}},J=a=>{R(c=>{const f=c.filter(N=>N.id!==a);return f.length===0?_(null):M!==null&&M>=f.length&&_(0),f})},Y=()=>{R([]),_(null),l("Cleared all captured evidence.","success")},ge=a=>{const c=document.createElement("a");c.href=`data:image/png;base64,${a}`,c.download=`screenshot-${d.udid}-${Date.now()}.png`,c.click()},se=async a=>{const c=ie/2,f=ae/2,N=ie*.4,$=ae*.4;let I,ne,re,he;switch(a){case"left":I=c+N,ne=f,re=c-N,he=f;break;case"right":I=c-N,ne=f,re=c+N,he=f;break;case"up":I=c,ne=f+$,re=c,he=f-$;break;case"down":I=c,ne=f-$,re=c,he=f+$;break}try{await D.swipe(d.udid,Math.round(I),Math.round(ne),Math.round(re),Math.round(he))}catch(Oe){console.error(`Quick swipe ${a} failed:`,Oe)}},de=async()=>{if(T.trim()){const a=l(`Uninstalling ${T}...`,"loading",0);try{je(!0),await D.uninstallApp(d.udid,T),F(""),l(`Request sent for ${T}`,"success"),setTimeout(G,3e3)}catch{l("Uninstall failed. Check logs.","error")}finally{je(!1),u(a)}}},Fe=async()=>{if(!ce)return;let a;try{ue(!0),a=l(`Installing app to ${d.udid}...`,"loading",0);const c=await D.uploadAndInstallApp(d.udid,ce);c.success?(l(c.message||"App installed successfully","success"),ze(null),setTimeout(G,5e3)):l("Installation failed: "+(c.error||"Unknown error"),"error")}catch(c){l("Installation failed: "+c.message,"error")}finally{a&&u(a),ue(!1)}};return e.jsxs("div",{className:"device-control-view",children:[e.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),e.jsxs("header",{className:"control-view-top-bar",children:[e.jsxs("button",{className:"back-to-devices-btn",onClick:t,children:[e.jsx(ct,{size:18})," DEVICES"]}),e.jsxs("div",{className:"device-info-mini",children:[e.jsx("span",{className:`device-pill platform-pill ${d.platform}`,children:d.platform==="ios"?"Apple":"Android"}),e.jsxs("span",{className:"device-pill version-pill",children:["v",d.sdk]}),d.reservedUntil&&Date.now()<d.reservedUntil&&e.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${d.reservedBy}${d.reservationReason?`: ${d.reservationReason}`:""}`,children:["RESERVED BY ",((Le=d.reservedBy)==null?void 0:Le.toUpperCase())||"ANONYMOUS"]}),e.jsx("h2",{className:"device-name-text",children:d.name}),e.jsx("span",{className:"code-font",style:{opacity:.5},children:d.udid})]})]}),e.jsxs("div",{className:`control-view-main ${b?"":"is-landscape"} ${m==="omni"?"omni-mode":""}`,children:[e.jsxs("div",{className:"device-preview-column",children:[e.jsx("div",{className:"device-screen-wrapper",children:e.jsxs("div",{ref:L,className:`device-stream-canvas ${b?"":"landscape"} ${we?"focused":""}`,style:{width:x.width,height:x.height,background:"#000"},tabIndex:0,onFocus:()=>ve(!0),onBlur:()=>ve(!1),onMouseDown:C,onMouseUp:O,children:[te&&e.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[e.jsx(Ve,{size:40,className:"animate-spin",color:"var(--primary)"}),e.jsx("p",{style:{marginTop:16},children:"ESTABLISHING TRACE..."})]}),e.jsx("img",{src:i(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onError:()=>{console.warn("Stream failed to load, retrying..."),setTimeout(()=>Ge(a=>a+1),2e3)}})]})}),e.jsxs("aside",{className:"device-footer-actions",children:[e.jsxs("button",{className:`footer-action-btn ${b?"active":""}`,onClick:()=>k(!0),children:[e.jsx(Ve,{size:14,style:{transform:b?"none":"rotate(-90deg)"}})," ","PORTRAIT"]}),e.jsxs("button",{className:`footer-action-btn ${b?"":"active"}`,onClick:()=>k(!1),children:[e.jsx(Ve,{size:14,style:{transform:"rotate(90deg)"}})," LANDSCAPE"]}),e.jsx("div",{className:"footer-divider"}),e.jsxs("button",{className:"footer-action-btn",onClick:H,children:[e.jsx(Qt,{size:20})," HOME"]}),e.jsx("button",{className:"footer-action-btn",onClick:B,title:"Lock Device",children:e.jsx(Ut,{size:20})}),e.jsx("button",{className:"footer-action-btn",onClick:W,title:"Unlock Device",children:e.jsx(St,{size:20})})]})]}),e.jsxs("div",{className:"device-interactions-column",children:[e.jsxs("div",{className:"interaction-tabs",children:[e.jsx("button",{className:`tab-btn ${m==="actions"?"active":""}`,onClick:()=>A("actions"),children:"ACTIONS"}),e.jsx("button",{className:`tab-btn ${m==="screenshot"?"active":""}`,onClick:()=>A("screenshot"),children:"SCREENSHOT"}),e.jsx("button",{className:`tab-btn ${m==="logs"?"active":""}`,onClick:()=>A("logs"),children:"DEBUG LOGS"}),e.jsxs("button",{className:`tab-btn ${m==="terminal"?"active":""}`,onClick:()=>A("terminal"),children:[e.jsx(at,{size:14,style:{marginRight:6}})," SHELL"]}),e.jsx("button",{className:`tab-btn ${m==="omni"?"active":""}`,onClick:()=>A("omni"),children:"OMNI-VISION"})]}),e.jsx("div",{className:`interactions-scroll-area ${m==="terminal"?"terminal-mode":""} ${m==="screenshot"||m==="logs"?"screenshot-mode":""}`,children:e.jsxs("div",{className:"tab-content",children:[m==="omni"&&e.jsx("div",{className:"omni-inspector-tab-wrapper animate-fade-in",style:{height:"calc(100vh - 266px)"},children:e.jsx(Vs,{sessionId:d.session_id?String(d.session_id):null,udid:d.udid,streamUrl:i()})}),m==="actions"&&e.jsxs("div",{className:"actions-grid",children:[e.jsxs("div",{className:"action-card",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(hs,{size:18,color:"var(--primary)"})," Directional Gestures"]}),e.jsxs("div",{className:"gestures-grid-container",children:[e.jsxs("div",{className:"gestures-dpad",children:[e.jsx("div",{}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("up"),children:e.jsx(Wt,{size:24})}),e.jsx("div",{}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("left"),children:e.jsx(ct,{size:24})}),e.jsx("div",{className:"dpad-center"}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("right"),children:e.jsx(bt,{size:24})}),e.jsx("div",{}),e.jsx("button",{className:"dpad-btn",onClick:()=>se("down"),children:e.jsx(yt,{size:24})}),e.jsx("div",{})]}),e.jsx("p",{className:"compact-label",style:{opacity:.5},children:"Directional Glide"})]})]}),e.jsxs("div",{className:"action-card",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(Yt,{size:18,color:"var(--primary)"})," Smart Input"]}),e.jsx("input",{type:"text",className:"type-input-field compact",placeholder:"Relay keystrokes...",value:S,onChange:a=>U(a.target.value),onKeyDown:a=>a.key==="Enter"&&V()})]}),e.jsxs("div",{className:"action-card full-width",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(us,{size:18,color:"var(--primary)"})," App Management"]}),e.jsxs("div",{className:"app-mgmt-content",children:[e.jsxs("div",{className:"install-section",children:[e.jsx("p",{className:"compact-label",children:"Install Package (.apk, .ipa, .app)"}),e.jsxs("div",{className:"upload-box-row",children:[e.jsxs("label",{className:"file-upload-launcher",children:[e.jsx(It,{size:14}),e.jsx("span",{children:ce?ce.name:"Select File"}),e.jsx("input",{type:"file",accept:".apk,.ipa,.app",onChange:a=>{var c;return ze(((c=a.target.files)==null?void 0:c[0])||null)},hidden:!0})]}),e.jsx("button",{className:"btn-premium btn-sm",disabled:!ce||me,onClick:Fe,children:me?e.jsx(Pe,{className:"animate-spin",size:14}):"INSTALL"})]})]}),e.jsx("div",{className:"divider-v"}),e.jsxs("div",{className:"uninstall-section",children:[e.jsx("p",{className:"compact-label",children:"Quick Uninstall"}),e.jsxs("div",{className:"uninstall-controls-row",children:[e.jsxs("div",{className:"select-wrapper",children:[e.jsxs("select",{className:"app-select-dropdown compact",value:T,onChange:a=>F(a.target.value),disabled:ye,children:[e.jsx("option",{value:"",children:ye?"Loading apps...":"-- Select App to Remove --"}),Te.map(a=>e.jsx("option",{value:a,children:a},a))]}),ye&&e.jsx(Pe,{className:"animate-spin select-loader",size:12})]}),e.jsxs("button",{className:"btn-destructive btn-sm",onClick:de,disabled:!T||ye,children:[e.jsx(Be,{size:14})," UNINSTALL"]})]}),e.jsxs("div",{className:"manual-input-box",children:[e.jsx("p",{className:"hint-text",children:"Or enter manually:"}),e.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"com.example.app",value:T,onChange:a=>F(a.target.value)})]})]})]})]}),e.jsxs("div",{className:"action-card full-width",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(qt,{size:18,color:"var(--primary)"})," Clipboard"]}),e.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"flex-start"},children:[e.jsx("button",{className:"btn-premium btn-sm",style:{width:"140px",flexShrink:0},onClick:z,children:"FETCH VALUE"}),e.jsx("div",{className:"clipboard-display compact",style:{marginTop:0,flex:1},children:w})]})]})]}),m==="screenshot"&&e.jsxs("div",{className:"action-card screenshot-card",children:[e.jsxs("header",{className:"action-card-header",children:[e.jsxs("div",{className:"title-group",children:[e.jsxs("h4",{className:"action-card-title",children:[e.jsx(Ke,{size:20,color:"var(--primary)"})," Captured Evidence"]}),e.jsx("p",{className:"hint-text",children:"Relay screenshots from device to host."})]}),y.length>0&&e.jsx("button",{className:"btn-text-only",onClick:Y,children:"CLEAR ALL"})]}),e.jsxs("div",{className:"screenshot-workspace",children:[e.jsxs("div",{className:"screenshot-gallery-sidebar",children:[e.jsxs("button",{className:"btn-premium take-screenshot-btn",onClick:K,disabled:q,children:[q?e.jsx(Pe,{className:"animate-spin",size:16}):e.jsx(Ke,{size:16}),e.jsx("span",{children:q?"CAPTURING...":"NEW CAPTURE"})]}),e.jsxs("div",{className:"screenshot-thumbnails-list",children:[y.length===0&&!q&&e.jsx("div",{className:"empty-gallery-state",children:e.jsx("p",{children:"No captures yet"})}),y.map((a,c)=>e.jsxs("div",{className:`screenshot-thumb-item ${M===c?"active":""}`,onClick:()=>_(c),children:[e.jsx("img",{src:`data:image/png;base64,${a.base64}`,alt:"Thumb"}),e.jsx("span",{className:"thumb-time",children:new Date(a.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),e.jsx("button",{className:"thumb-delete-btn",onClick:f=>{f.stopPropagation(),J(a.id)},children:e.jsx(Be,{size:12})})]},a.id))]})]}),e.jsx("div",{className:"screenshot-main-preview",children:M!==null&&y[M]?e.jsxs("div",{className:"preview-container",children:[e.jsx("div",{className:"preview-image-wrapper",children:e.jsx("img",{src:`data:image/png;base64,${y[M].base64}`,alt:"Selected Evidence"})}),e.jsxs("footer",{className:"preview-footer",children:[e.jsxs("div",{className:"preview-meta",children:[e.jsx("span",{className:"meta-label",children:"ID:"}),e.jsx("span",{className:"meta-value",children:y[M].id.substring(0,8)}),e.jsx("span",{className:"meta-divider",children:"|"}),e.jsx("span",{className:"meta-value",children:new Date(y[M].timestamp).toLocaleString()})]}),e.jsxs("div",{className:"preview-actions",children:[e.jsx("button",{className:"btn-premium btn-sm",onClick:()=>ge(y[M].base64),children:"DOWNLOAD PNG"}),e.jsxs("button",{className:"btn-destructive btn-sm",onClick:()=>J(y[M].id),children:[e.jsx(Be,{size:14})," DELETE"]})]})]})]}):e.jsxs("div",{className:"preview-empty-placeholder",children:[e.jsx(Ke,{size:48,style:{opacity:.1,marginBottom:16}}),e.jsx("p",{children:"Capture a screenshot to begin analysis"})]})})]})]}),m==="logs"&&e.jsxs("div",{className:"action-card screenshot-card",style:{padding:0,gap:0},children:[e.jsxs("div",{className:"log-toolbar",children:[e.jsxs("div",{className:"log-filter-group",children:[e.jsxs("div",{className:"log-stat-pill",children:[e.jsx("span",{className:`log-live-dot ${$e?"active":""}`}),$e?"LIVE":"CONNECTING"]}),e.jsxs("div",{className:"log-stat-pill",style:{opacity:.6},children:[le.length," LINES"]}),e.jsxs("div",{className:"log-search-box",children:[e.jsx(Xe,{size:14,className:"search-icon-inline"}),e.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"Filter trace...",value:oe,onChange:a=>Ye(a.target.value)})]})]}),e.jsxs("div",{className:"log-actions-group",children:[e.jsxs("button",{className:`btn-secondary btn-sm ${Q?"active":""}`,onClick:()=>Ie(!Q),title:Q?"Freeze Logs":"Follow Logs",children:[e.jsx($t,{size:14,className:Q?"animate-pulse":""}),Q?"FREEZE":"FOLLOW"]}),e.jsxs("button",{className:"btn-premium btn-sm",onClick:()=>{const a=new Blob([le.join(`
|
|
194
|
+
`)],{type:"text/plain"}),c=URL.createObjectURL(a),f=document.createElement("a");f.href=c,f.download=`logs-${d.udid}-${Date.now()}.txt`,f.click(),URL.revokeObjectURL(c)},disabled:le.length===0,children:[e.jsx(Mt,{size:14}),"EXPORT"]}),e.jsxs("button",{className:"btn-secondary btn-sm",onClick:()=>Ee([]),title:"Clear Logs",children:[e.jsx(Be,{size:14}),"CLEAR"]})]})]}),e.jsx("div",{className:"log-display-area",ref:v,style:{flex:1},children:Me()})]}),m==="terminal"&&e.jsx("div",{className:"action-card full-height",children:e.jsx(Bs,{platform:(d.platform||"").toLowerCase(),prompt:`${(d.platform||"").toLowerCase()==="ios"?"ios":"adb"} $`,welcomeMessage:`Connected to ${d.name} (${d.udid}).
|
|
195
|
+
Internal Shell Environment.`,onCommand:async a=>{const c=await D.executeShell(d.udid,a);if(c.error)throw new Error(c.error);return c.output}})})]})})]})]})]})}const gt={platform:{ios:!0,android:!0},state:{ready:!0,offline:!0,busy:!0},name:""};class Xs extends qe.Component{constructor(t){super(t),this.socketCleanups=[],this.refreshTimeout=null,this.state={devices:[],activeSessionsCount:0,pendingSessionsCount:0,queueSummary:null,filter:gt}}componentDidMount(){this.fetchDevices(),this.devicePolling=setInterval(()=>{this.fetchDevices()},1e4);const t=this.props.onSocketEvent("device_unblocked",()=>{console.info("Real-time: Device unblocked, triggering debounced refresh"),this.fetchDevicesDebounced()}),l=this.props.onSocketEvent("device_blocked",()=>{console.info("Real-time: Device blocked, triggering debounced refresh"),this.fetchDevicesDebounced()});this.socketCleanups.push(t,l)}componentWillUnmount(){this.devicePolling&&(clearInterval(this.devicePolling),this.devicePolling=void 0),this.refreshTimeout&&(clearTimeout(this.refreshTimeout),this.refreshTimeout=null),this.socketCleanups.forEach(t=>t())}fetchDevicesDebounced(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>{this.refreshTimeout=null,this.fetchDevices()},500)}getBusyDevicesCount(t){return[u=>u.busy].reduce((u,p)=>u.filter(p),t).length}async fetchDevices(){try{const t=await D.getDevices(),l=this.getBusyDevicesCount(t),u=await D.getPendingSessionsCount(),p=await D.getQueueSummary();console.log(t),this.setState({devices:t,activeSessionsCount:l,pendingSessionsCount:u,queueSummary:p})}catch(t){console.log(t)}}getFilteredDevice(){const{ready:t,busy:l,offline:u}=this.state.filter.state,{ios:p,android:s}=this.state.filter.platform,L=[v=>p&&(v.platform=="ios"||v.platform=="tvos")||s&&v.platform=="android",v=>t&&!v.busy&&!v.offline||l&&v.busy||u&&v.offline];return this.state.filter.name!=""&&L.push(v=>v.name.toLowerCase().includes(this.state.filter.name.toLowerCase())||v.udid.toLowerCase().includes(this.state.filter.name.toLowerCase())),L.reduce((v,x)=>v.filter(x),this.state.devices)}setFilter(t){this.setState({filter:{...this.state.filter,...t}})}getPlatformFilterComponent(){const{ios:t,android:l}=this.state.filter.platform;return e.jsxs("div",{className:"device-explorer-header-value",children:[e.jsxs("button",{className:`device-explorer-header__platform-btn ${l&&"selected"}`,onClick:()=>this.setFilter({platform:{...this.state.filter.platform,android:!this.state.filter.platform.android}}),children:[e.jsx(st,{size:20,color:"currentColor"}),"Android"]}),e.jsxs("button",{className:`device-explorer-header__platform-btn ${t&&"selected"}`,onClick:()=>this.setFilter({platform:{...this.state.filter.platform,ios:!this.state.filter.platform.ios}}),children:[e.jsx(kt,{size:20,color:"currentColor"}),"iOS"]})]})}getDeviceStateFilterComponent(){const{ready:t,busy:l,offline:u}=this.state.filter.state;return e.jsxs("div",{className:"device-explorer-header-value",children:[e.jsx("div",{className:`device-explorer-header__device-state ready ${t&&"selected"}`,onClick:()=>this.setFilter({state:{...this.state.filter.state,ready:!this.state.filter.state.ready}}),children:"Ready"}),e.jsx("div",{className:`device-explorer-header__device-state busy ${l&&"selected"}`,onClick:()=>this.setFilter({state:{...this.state.filter.state,busy:!this.state.filter.state.busy}}),children:"Busy"}),e.jsx("div",{className:`device-explorer-header__device-state offline ${u&&"selected"}`,onClick:()=>this.setFilter({state:{...this.state.filter.state,offline:!this.state.filter.state.offline}}),children:"Offline"})]})}render(){const t=this.getFilteredDevice(),{udid:l}=this.props.params,u=l?this.state.devices.find(p=>p.udid===l):null;return e.jsxs("div",{className:"device-explorer-container",children:[e.jsxs("div",{className:"device-explorer-header-container",children:[e.jsxs("div",{className:"device-explorer-header-left-container",children:[e.jsxs("div",{className:"device-explorer-header-entry",children:[e.jsx("div",{className:"device-explorer-header-entry-header",children:"Platform"}),this.getPlatformFilterComponent()]}),e.jsxs("div",{className:"device-explorer-header-entry",children:[e.jsx("div",{className:"device-explorer-header-entry-header",children:"Device state"}),this.getDeviceStateFilterComponent()]}),e.jsxs("div",{className:"device-explorer-header-entry search-entry",children:[e.jsx("div",{className:"device-explorer-header-entry-header",children:"Search by name or udid"}),e.jsx("div",{className:"device-explorer-header-value",children:e.jsxs("div",{className:"device-explorer-search-wrapper",children:[e.jsx(Xe,{size:16,color:"#94a3b8",className:"device-explorer-search-icon"}),e.jsx("input",{type:"text",className:"device-explorer-header-text-filter",placeholder:"Search devices...",onChange:p=>{this.setState({filter:{...this.state.filter,name:p.target.value}})}})]})})]})]}),e.jsx("div",{className:"device-explorer-header-filter-count",children:e.jsxs(He,{variant:"secondary",children:[e.jsx("span",{className:"font-bold",children:t.length})," of"," ",e.jsx("span",{className:"font-bold",children:this.state.devices.length})," ",this.state.devices.length===1?"device":"devices"]})}),e.jsxs("div",{className:"device-explorer-header-right-container",children:[this.state.queueSummary&&this.state.pendingSessionsCount>0&&e.jsxs(He,{variant:"secondary",className:"mr-2",children:[e.jsx("span",{className:"font-bold",children:"Queue Insights:"})," ",Object.entries(this.state.queueSummary.byPlatform).map(([p,s])=>e.jsxs("span",{className:"ml-1",children:[p==="any"?"Mixed":p.toUpperCase(),":"," ",Math.ceil(s.avgDurationMs/6e4),"m ETA"]},p))]}),e.jsxs(He,{variant:"success",children:[e.jsx("span",{className:"font-bold",children:this.state.activeSessionsCount})," Active session",this.state.activeSessionsCount!==1?"s":""]}),e.jsxs(He,{variant:"warning",children:[e.jsx("span",{className:"font-bold",children:this.state.pendingSessionsCount})," Pending session",this.state.pendingSessionsCount!==1?"s":""]}),e.jsxs(Qe,{size:"sm",variant:"default",onClick:()=>this.fetchDevices(),children:[e.jsx(rt,{size:14,color:"currentColor",className:"mr-1"}),"Refresh"]})]})]}),t.length>0?e.jsx(Ms,{devices:t,reloadDevices:()=>this.fetchDevices()}):e.jsxs("div",{className:"device-explorer-empty stagger-1",children:[e.jsx("div",{className:"device-explorer-empty-icon",children:e.jsx(st,{size:32})}),this.state.devices.length===0?e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"brand-font",children:"Global Device Registry Empty"}),e.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."}),e.jsxs(Qe,{variant:"default",onClick:()=>this.fetchDevices(),children:[e.jsx(rt,{size:14,className:"mr-2"}),"Manual Sync"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"brand-font",children:"No Devices Found"}),e.jsx("p",{children:"Deployment configuration mismatch. Adjust your platform or state filters to find the appropriate testing target."}),e.jsx(Qe,{variant:"outline",onClick:()=>this.setState({filter:gt}),children:"Reset All Filters"})]})]}),u&&e.jsx("div",{className:"device-control-modal-overlay",children:e.jsx("div",{className:"device-control-modal",children:e.jsx(qs,{device:u,onClose:()=>this.props.navigate("/devices")})})})]})}}function ni(){const n=jt(),t=nt(),{on:l}=Et();return e.jsx(Xs,{params:n,navigate:t,onSocketEvent:l})}export{Xs as DeviceExplorer,ni as default};
|