@xenon-device-management/xenon 1.26.0 → 1.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/lib/package.json +1 -1
  2. package/lib/public/assets/{ApiKeyGate-DJ7e-uHp.js → ApiKeyGate-vELAdQLu.js} +1 -1
  3. package/lib/public/assets/{BugReportButton-CRByOTXm.js → BugReportButton-ySiZDywe.js} +1 -1
  4. package/lib/public/assets/{DeviceMosaicView-DUlCwfkZ.js → DeviceMosaicView-Chtp0wAI.js} +1 -1
  5. package/lib/public/assets/{EmptyState-CXb-ftNt.js → EmptyState-CYQYScPo.js} +1 -1
  6. package/lib/public/assets/{FieldGroup-CkgSdVnT.js → FieldGroup-Dea68RfI.js} +1 -1
  7. package/lib/public/assets/{Modal-jpvRi2Hs.js → Modal-BgzTzImP.js} +1 -1
  8. package/lib/public/assets/{SegmentedControl-C7gZCiLf.js → SegmentedControl-DyRq9blY.js} +1 -1
  9. package/lib/public/assets/{SettingCard-DXSl62Or.js → SettingCard-CardwBu3.js} +1 -1
  10. package/lib/public/assets/{Table-CX97HoR-.js → Table-BczCxsDm.js} +1 -1
  11. package/lib/public/assets/{activity-Boj_HvMZ.js → activity-CS-Op-T6.js} +1 -1
  12. package/lib/public/assets/{ai-settings-BB83UY7K.js → ai-settings-CIvB7rNM.js} +1 -1
  13. package/lib/public/assets/{api-keys-Dlm8YMn6.js → api-keys-peJzllzQ.js} +1 -1
  14. package/lib/public/assets/{apps-CMZ_W17Z.js → apps-__WvcJaP.js} +1 -1
  15. package/lib/public/assets/{arrow-left-D6gOwAGu.js → arrow-left-Dx-cXFLT.js} +1 -1
  16. package/lib/public/assets/{arrow-right-CbBu0GWO.js → arrow-right-Ax_FfBMv.js} +1 -1
  17. package/lib/public/assets/{arrow-up-right-R45CSoO8.js → arrow-up-right-B6uJmGeA.js} +1 -1
  18. package/lib/public/assets/{auth-shell-BL9cMUwX.js → auth-shell-BQqcjjC9.js} +2 -2
  19. package/lib/public/assets/{builds-page-Dhmu7Vbv.js → builds-page-BA-_iEjx.js} +1 -1
  20. package/lib/public/assets/{button-CYDb9Orf.js → button-DcbnByKB.js} +1 -1
  21. package/lib/public/assets/{calendar-BIs8_hZW.js → calendar-C3pYg1V7.js} +1 -1
  22. package/lib/public/assets/{check-CBqCzXqq.js → check-DKdLfzhJ.js} +1 -1
  23. package/lib/public/assets/{chevron-left-B39R3gLJ.js → chevron-left-Bb9PBLG5.js} +1 -1
  24. package/lib/public/assets/{chevron-right-9Hw6sbXB.js → chevron-right-DJcpeY_o.js} +1 -1
  25. package/lib/public/assets/{circle-check-C1JIxWz-.js → circle-check-DY6ntqp3.js} +1 -1
  26. package/lib/public/assets/{circle-x-CtpnRhl0.js → circle-x-DgK9drRH.js} +1 -1
  27. package/lib/public/assets/{clock-CDLlRyIO.js → clock-I9zEVPan.js} +1 -1
  28. package/lib/public/assets/{copy-BTs3mIiX.js → copy-Dy3oRuWT.js} +1 -1
  29. package/lib/public/assets/device-explorer-BPyGYs0c.js +246 -0
  30. package/lib/public/assets/device-explorer-C9qg30Jn.css +1 -0
  31. package/lib/public/assets/{download-B6dN3V7k.js → download-BotTmDty.js} +1 -1
  32. package/lib/public/assets/{forgot-password-BObOfKOb.js → forgot-password-BaWiD2U2.js} +1 -1
  33. package/lib/public/assets/{funnel-D0Vl2mj-.js → funnel-D2Qw4nTX.js} +1 -1
  34. package/lib/public/assets/{index-CsOuZa5J.js → index-CI9Nz3HY.js} +2 -2
  35. package/lib/public/assets/{input-BCvn04w7.js → input-cBBGau4X.js} +1 -1
  36. package/lib/public/assets/{keycodes-C2eSDBF4.js → keycodes-CY4uwulo.js} +1 -1
  37. package/lib/public/assets/{layers-YHoIbeXC.js → layers-MHwJM2Ll.js} +1 -1
  38. package/lib/public/assets/{lock-BkSWvHaq.js → lock-Bpc8rJFu.js} +1 -1
  39. package/lib/public/assets/{login-DmwN3Oiq.js → login-BmcyszP5.js} +1 -1
  40. package/lib/public/assets/{maintenance-settings-DNxjSZN3.js → maintenance-settings-DMFVuToe.js} +1 -1
  41. package/lib/public/assets/{monitor-1B8G-Qsg.js → monitor-irjK6PRV.js} +1 -1
  42. package/lib/public/assets/{mouse-pointer-2-D_nJmn_S.js → mouse-pointer-2-CYkC-Dyq.js} +1 -1
  43. package/lib/public/assets/{network-C1TkeEVT.js → network-CVZ32MhH.js} +1 -1
  44. package/lib/public/assets/{overview-zyv8wW9T.js → overview-DRRSIpnD.js} +1 -1
  45. package/lib/public/assets/{page-header-wb7FvdLY.js → page-header-Bl7uTiQF.js} +1 -1
  46. package/lib/public/assets/{plus-BkguZ6lZ.js → plus-C3lvaMcL.js} +1 -1
  47. package/lib/public/assets/{profile-page-C9dWe1GN.js → profile-page-B3wsnR1n.js} +1 -1
  48. package/lib/public/assets/{reset-password-C6lIfkUv.js → reset-password-BIGj_ULj.js} +1 -1
  49. package/lib/public/assets/{runbook-page-BbPNTinH.js → runbook-page-DEznNZhc.js} +1 -1
  50. package/lib/public/assets/{select-4puNl_of.js → select-BpuZWZuE.js} +1 -1
  51. package/lib/public/assets/{selector-detail-page-C6fXdhpS.js → selector-detail-page-ZCvmtQ5Y.js} +1 -1
  52. package/lib/public/assets/{selector-health-Dtp0mM2V.js → selector-health-D-hvfY2E.js} +1 -1
  53. package/lib/public/assets/{selector-health-page-DKEGj-Kl.js → selector-health-page-C0ZqZ_VT.js} +1 -1
  54. package/lib/public/assets/{session-detail-page-CqFOmHdS.js → session-detail-page-Bv7IwFTQ.js} +1 -1
  55. package/lib/public/assets/{settings-CaIJEsSM.js → settings-DCR9vnQ5.js} +1 -1
  56. package/lib/public/assets/{status-pill-outline-_zOEXXFr.js → status-pill-outline-B5dWsaer.js} +1 -1
  57. package/lib/public/assets/{tablet-BDyvY8gn.js → tablet-DxwkBlhd.js} +1 -1
  58. package/lib/public/assets/{teams-y4sxVHc3.js → teams-D3s8GhkG.js} +1 -1
  59. package/lib/public/assets/{trash-2-CmEXtFhj.js → trash-2-Dyf4Jcyk.js} +1 -1
  60. package/lib/public/assets/{upload-wYEKh77e.js → upload-B6ZJ1_f1.js} +1 -1
  61. package/lib/public/assets/{use-password-reset-mode-pSi7-_eA.js → use-password-reset-mode-B-oOrt1d.js} +1 -1
  62. package/lib/public/assets/{users-tYsVZwy2.js → users-BfvPE2wX.js} +1 -1
  63. package/lib/public/assets/{users-UlMfevNJ.js → users-QfiFclLn.js} +1 -1
  64. package/lib/public/assets/{video-off-BNnAtI1a.js → video-off-C2quR4KF.js} +1 -1
  65. package/lib/public/assets/{webhook-settings-BQHWKlf0.js → webhook-settings-BjbGi-Pi.js} +1 -1
  66. package/lib/public/assets/{zap-yoeNa_1n.js → zap-C2lxP7TK.js} +1 -1
  67. package/lib/public/index.html +1 -1
  68. package/package.json +1 -1
  69. package/lib/public/assets/device-explorer-CibdPgEj.js +0 -246
  70. package/lib/public/assets/device-explorer-DGm8XH4R.css +0 -1
@@ -0,0 +1,246 @@
1
+ import{c as X,r as d,t as En,j as t,R as wi,v as Ni,w as Se,C as tn,U as Ci,X as V,x as is,y as Ls,u as _s,a as Os,b as Si,T as ki,q as Ss,z as Tn,A as at,S as Wt,B as Dn,i as In,f as Ht,D as Ai,p as Ri,E as us}from"./index-CI9Nz3HY.js";import{P as $i}from"./page-header-Bl7uTiQF.js";import{B as Oe}from"./button-DcbnByKB.js";import{S as rs}from"./select-BpuZWZuE.js";import{P as Xt,B as Ei}from"./BugReportButton-ySiZDywe.js";import{P as Rt,u as Jt,a as kt,b as Mn,c as Ps,d as Ti,D as Di,e as sn,f as Ii,g as ot,h as Mi,M as zs}from"./Modal-BgzTzImP.js";import{C as ct}from"./check-DKdLfzhJ.js";import{F as Kt}from"./FieldGroup-Dea68RfI.js";import{C as Li}from"./clock-I9zEVPan.js";import{P as Ln}from"./plus-C3lvaMcL.js";import{A as _i}from"./activity-CS-Op-T6.js";import{p as Fs}from"./labels-C21SA4JG.js";import{C as qe}from"./copy-Dy3oRuWT.js";import{T as Oi}from"./tablet-DxwkBlhd.js";import{f as Pi}from"./time-B8FIgwPE.js";import{M as nn,F as zi}from"./mouse-pointer-2-CYkC-Dyq.js";import{L as Fi}from"./layers-MHwJM2Ll.js";import{Z as ks}from"./zap-C2lxP7TK.js";import{C as _n}from"./chevron-right-DJcpeY_o.js";import{S as On,C as Bi,H as Ui,a as ms,A as Ct,I as fs}from"./keycodes-CY4uwulo.js";import{D as Wi}from"./download-BotTmDty.js";import{T as Gt}from"./trash-2-Dyf4Jcyk.js";import{C as hs}from"./chevron-left-Bb9PBLG5.js";import{L as Hi}from"./lock-Bpc8rJFu.js";import{T as Vi,U as qi}from"./upload-B6ZJ1_f1.js";import{S as Xi}from"./SegmentedControl-DyRq9blY.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 Ki=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],Gi=X("arrow-down",Ki);/**
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 Yi=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],Zi=X("arrow-up",Yi);/**
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 Ji=[["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"}]],Qi=X("battery-low",Ji);/**
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 er=[["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"}]],tr=X("battery-warning",er);/**
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 sr=[["path",{d:"M 22 14 L 22 10",key:"nqc4tb"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],nr=X("battery",sr);/**
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 ir=[["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"}]],rr=X("box",ir);/**
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 ar=[["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"}]],or=X("calendar-plus",ar);/**
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 cr=[["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"}]],lr=X("case-sensitive",cr);/**
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 dr=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],ur=X("chevron-up",dr);/**
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 mr=[["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"}]],fr=X("circle-question-mark",mr);/**
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 hr=[["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"}]],pr=X("clipboard",hr);/**
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 xr=[["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"}]],rn=X("code-xml",xr);/**
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 gr=[["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"}]],yr=X("crosshair",gr);/**
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 vr=[["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"}]],br=X("ellipsis",vr);/**
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 jr=[["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"}]],wr=X("grid-3x3",jr);/**
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 Nr=[["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"}]],Cr=X("lightbulb",Nr);/**
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 Sr=[["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"}]],kr=X("lock-open",Sr);/**
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 Ar=[["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"}]],Rr=X("map-pin",Ar);/**
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 $r=[["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"}]],Er=X("message-square",$r);/**
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 Tr=[["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"}]],Dr=X("moon-star",Tr);/**
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 Ir=[["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"}]],Mr=X("move",Ir);/**
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 Lr=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],_r=X("package",Lr);/**
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 Or=[["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"}]],Pr=X("panels-top-left",Or);/**
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 zr=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]],Fr=X("rectangle-horizontal",zr);/**
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 Br=[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]],Ur=X("rectangle-vertical",Br);/**
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 Wr=[["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=X("rotate-cw",Wr);/**
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 Hr=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],Vr=X("scroll-text",Hr);/**
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 qr=[["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"}]],it=X("shield-alert",qr);/**
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 Xr=[["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"}]],As=X("sparkles",Xr);/**
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 Kr=[["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"}]],Gr=X("tag",Kr);/**
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 Yr=[["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"}]],ps=X("target",Yr);/**
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 Zr=[["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"}]],Jr=X("text-wrap",Zr);/**
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 Qr=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],ea=X("thermometer",Qr);/**
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 ta=[["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"}]],an=X("touchpad",ta);/**
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 sa=[["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"}]],na=X("volume-1",sa);/**
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 ia=[["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"}]],ra=X("volume-2",ia);/**
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 aa=[["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"}]],oa=X("wifi",aa),ca=["top","right","bottom","left"],Xe=Math.min,be=Math.max,Qt=Math.round,Vt=Math.floor,Ie=e=>({x:e,y:e}),la={left:"right",right:"left",bottom:"top",top:"bottom"};function Rs(e,s,n){return be(e,Xe(s,n))}function ze(e,s){return typeof e=="function"?e(s):e}function Fe(e){return e.split("-")[0]}function mt(e){return e.split("-")[1]}function Bs(e){return e==="x"?"y":"x"}function Us(e){return e==="y"?"height":"width"}function De(e){const s=e[0];return s==="t"||s==="b"?"y":"x"}function Ws(e){return Bs(De(e))}function da(e,s,n){n===void 0&&(n=!1);const i=mt(e),r=Ws(e),a=Us(r);let c=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return s.reference[a]>s.floating[a]&&(c=es(c)),[c,es(c)]}function ua(e){const s=es(e);return[$s(e),s,$s(s)]}function $s(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const on=["left","right"],cn=["right","left"],ma=["top","bottom"],fa=["bottom","top"];function ha(e,s,n){switch(e){case"top":case"bottom":return n?s?cn:on:s?on:cn;case"left":case"right":return s?ma:fa;default:return[]}}function pa(e,s,n,i){const r=mt(e);let a=ha(Fe(e),n==="start",i);return r&&(a=a.map(c=>c+"-"+r),s&&(a=a.concat(a.map($s)))),a}function es(e){const s=Fe(e);return la[s]+e.slice(s.length)}function xa(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pn(e){return typeof e!="number"?xa(e):{top:e,right:e,bottom:e,left:e}}function ts(e){const{x:s,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:s,right:s+i,bottom:n+r,x:s,y:n}}function ln(e,s,n){let{reference:i,floating:r}=e;const a=De(s),c=Ws(s),l=Us(c),o=Fe(s),u=a==="y",m=i.x+i.width/2-r.width/2,h=i.y+i.height/2-r.height/2,p=i[l]/2-r[l]/2;let x;switch(o){case"top":x={x:m,y:i.y-r.height};break;case"bottom":x={x:m,y:i.y+i.height};break;case"right":x={x:i.x+i.width,y:h};break;case"left":x={x:i.x-r.width,y:h};break;default:x={x:i.x,y:i.y}}switch(mt(s)){case"start":x[c]-=p*(n&&u?-1:1);break;case"end":x[c]+=p*(n&&u?-1:1);break}return x}async function ga(e,s){var n;s===void 0&&(s={});const{x:i,y:r,platform:a,rects:c,elements:l,strategy:o}=e,{boundary:u="clippingAncestors",rootBoundary:m="viewport",elementContext:h="floating",altBoundary:p=!1,padding:x=0}=ze(s,e),v=Pn(x),y=l[p?h==="floating"?"reference":"floating":h],C=ts(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(y)))==null||n?y:y.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:u,rootBoundary:m,strategy:o})),N=h==="floating"?{x:i,y:r,width:c.floating.width,height:c.floating.height}:c.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),b=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},$=ts(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:w,strategy:o}):N);return{top:(C.top-$.top+v.top)/b.y,bottom:($.bottom-C.bottom+v.bottom)/b.y,left:(C.left-$.left+v.left)/b.x,right:($.right-C.right+v.right)/b.x}}const ya=50,va=async(e,s,n)=>{const{placement:i="bottom",strategy:r="absolute",middleware:a=[],platform:c}=n,l=c.detectOverflow?c:{...c,detectOverflow:ga},o=await(c.isRTL==null?void 0:c.isRTL(s));let u=await c.getElementRects({reference:e,floating:s,strategy:r}),{x:m,y:h}=ln(u,i,o),p=i,x=0;const v={};for(let g=0;g<a.length;g++){const y=a[g];if(!y)continue;const{name:C,fn:N}=y,{x:w,y:b,data:$,reset:R}=await N({x:m,y:h,initialPlacement:i,placement:p,strategy:r,middlewareData:v,rects:u,platform:l,elements:{reference:e,floating:s}});m=w??m,h=b??h,v[C]={...v[C],...$},R&&x<ya&&(x++,typeof R=="object"&&(R.placement&&(p=R.placement),R.rects&&(u=R.rects===!0?await c.getElementRects({reference:e,floating:s,strategy:r}):R.rects),{x:m,y:h}=ln(u,p,o)),g=-1)}return{x:m,y:h,placement:p,strategy:r,middlewareData:v}},ba=e=>({name:"arrow",options:e,async fn(s){const{x:n,y:i,placement:r,rects:a,platform:c,elements:l,middlewareData:o}=s,{element:u,padding:m=0}=ze(e,s)||{};if(u==null)return{};const h=Pn(m),p={x:n,y:i},x=Ws(r),v=Us(x),g=await c.getDimensions(u),y=x==="y",C=y?"top":"left",N=y?"bottom":"right",w=y?"clientHeight":"clientWidth",b=a.reference[v]+a.reference[x]-p[x]-a.floating[v],$=p[x]-a.reference[x],R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(u));let I=R?R[w]:0;(!I||!await(c.isElement==null?void 0:c.isElement(R)))&&(I=l.floating[w]||a.floating[v]);const E=b/2-$/2,q=I/2-g[v]/2-1,O=Xe(h[C],q),F=Xe(h[N],q),W=O,Y=I-g[v]-F,z=I/2-g[v]/2+E,J=Rs(W,z,Y),P=!o.arrow&&mt(r)!=null&&z!==J&&a.reference[v]/2-(z<W?O:F)-g[v]/2<0,L=P?z<W?z-W:z-Y:0;return{[x]:p[x]+L,data:{[x]:J,centerOffset:z-J-L,...P&&{alignmentOffset:L}},reset:P}}}),ja=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(s){var n,i;const{placement:r,middlewareData:a,rects:c,initialPlacement:l,platform:o,elements:u}=s,{mainAxis:m=!0,crossAxis:h=!0,fallbackPlacements:p,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:g=!0,...y}=ze(e,s);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const C=Fe(r),N=De(l),w=Fe(l)===l,b=await(o.isRTL==null?void 0:o.isRTL(u.floating)),$=p||(w||!g?[es(l)]:ua(l)),R=v!=="none";!p&&R&&$.push(...pa(l,g,v,b));const I=[l,...$],E=await o.detectOverflow(s,y),q=[];let O=((i=a.flip)==null?void 0:i.overflows)||[];if(m&&q.push(E[C]),h){const z=da(r,c,b);q.push(E[z[0]],E[z[1]])}if(O=[...O,{placement:r,overflows:q}],!q.every(z=>z<=0)){var F,W;const z=(((F=a.flip)==null?void 0:F.index)||0)+1,J=I[z];if(J&&(!(h==="alignment"?N!==De(J):!1)||O.every(k=>De(k.placement)===N?k.overflows[0]>0:!0)))return{data:{index:z,overflows:O},reset:{placement:J}};let P=(W=O.filter(L=>L.overflows[0]<=0).sort((L,k)=>L.overflows[1]-k.overflows[1])[0])==null?void 0:W.placement;if(!P)switch(x){case"bestFit":{var Y;const L=(Y=O.filter(k=>{if(R){const K=De(k.placement);return K===N||K==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(K=>K>0).reduce((K,re)=>K+re,0)]).sort((k,K)=>k[1]-K[1])[0])==null?void 0:Y[0];L&&(P=L);break}case"initialPlacement":P=l;break}if(r!==P)return{reset:{placement:P}}}return{}}}};function dn(e,s){return{top:e.top-s.height,right:e.right-s.width,bottom:e.bottom-s.height,left:e.left-s.width}}function un(e){return ca.some(s=>e[s]>=0)}const wa=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(s){const{rects:n,platform:i}=s,{strategy:r="referenceHidden",...a}=ze(e,s);switch(r){case"referenceHidden":{const c=await i.detectOverflow(s,{...a,elementContext:"reference"}),l=dn(c,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:un(l)}}}case"escaped":{const c=await i.detectOverflow(s,{...a,altBoundary:!0}),l=dn(c,n.floating);return{data:{escapedOffsets:l,escaped:un(l)}}}default:return{}}}}},zn=new Set(["left","top"]);async function Na(e,s){const{placement:n,platform:i,elements:r}=e,a=await(i.isRTL==null?void 0:i.isRTL(r.floating)),c=Fe(n),l=mt(n),o=De(n)==="y",u=zn.has(c)?-1:1,m=a&&o?-1:1,h=ze(s,e);let{mainAxis:p,crossAxis:x,alignmentAxis:v}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof v=="number"&&(x=l==="end"?v*-1:v),o?{x:x*m,y:p*u}:{x:p*u,y:x*m}}const Ca=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(s){var n,i;const{x:r,y:a,placement:c,middlewareData:l}=s,o=await Na(s,e);return c===((n=l.offset)==null?void 0:n.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:r+o.x,y:a+o.y,data:{...o,placement:c}}}}},Sa=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(s){const{x:n,y:i,placement:r,platform:a}=s,{mainAxis:c=!0,crossAxis:l=!1,limiter:o={fn:C=>{let{x:N,y:w}=C;return{x:N,y:w}}},...u}=ze(e,s),m={x:n,y:i},h=await a.detectOverflow(s,u),p=De(Fe(r)),x=Bs(p);let v=m[x],g=m[p];if(c){const C=x==="y"?"top":"left",N=x==="y"?"bottom":"right",w=v+h[C],b=v-h[N];v=Rs(w,v,b)}if(l){const C=p==="y"?"top":"left",N=p==="y"?"bottom":"right",w=g+h[C],b=g-h[N];g=Rs(w,g,b)}const y=o.fn({...s,[x]:v,[p]:g});return{...y,data:{x:y.x-n,y:y.y-i,enabled:{[x]:c,[p]:l}}}}}},ka=function(e){return e===void 0&&(e={}),{options:e,fn(s){const{x:n,y:i,placement:r,rects:a,middlewareData:c}=s,{offset:l=0,mainAxis:o=!0,crossAxis:u=!0}=ze(e,s),m={x:n,y:i},h=De(r),p=Bs(h);let x=m[p],v=m[h];const g=ze(l,s),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(o){const w=p==="y"?"height":"width",b=a.reference[p]-a.floating[w]+y.mainAxis,$=a.reference[p]+a.reference[w]-y.mainAxis;x<b?x=b:x>$&&(x=$)}if(u){var C,N;const w=p==="y"?"width":"height",b=zn.has(Fe(r)),$=a.reference[h]-a.floating[w]+(b&&((C=c.offset)==null?void 0:C[h])||0)+(b?0:y.crossAxis),R=a.reference[h]+a.reference[w]+(b?0:((N=c.offset)==null?void 0:N[h])||0)-(b?y.crossAxis:0);v<$?v=$:v>R&&(v=R)}return{[p]:x,[h]:v}}}},Aa=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(s){var n,i;const{placement:r,rects:a,platform:c,elements:l}=s,{apply:o=()=>{},...u}=ze(e,s),m=await c.detectOverflow(s,u),h=Fe(r),p=mt(r),x=De(r)==="y",{width:v,height:g}=a.floating;let y,C;h==="top"||h==="bottom"?(y=h,C=p===(await(c.isRTL==null?void 0:c.isRTL(l.floating))?"start":"end")?"left":"right"):(C=h,y=p==="end"?"top":"bottom");const N=g-m.top-m.bottom,w=v-m.left-m.right,b=Xe(g-m[y],N),$=Xe(v-m[C],w),R=!s.middlewareData.shift;let I=b,E=$;if((n=s.middlewareData.shift)!=null&&n.enabled.x&&(E=w),(i=s.middlewareData.shift)!=null&&i.enabled.y&&(I=N),R&&!p){const O=be(m.left,0),F=be(m.right,0),W=be(m.top,0),Y=be(m.bottom,0);x?E=v-2*(O!==0||F!==0?O+F:be(m.left,m.right)):I=g-2*(W!==0||Y!==0?W+Y:be(m.top,m.bottom))}await o({...s,availableWidth:E,availableHeight:I});const q=await c.getDimensions(l.floating);return v!==q.width||g!==q.height?{reset:{rects:!0}}:{}}}};function as(){return typeof window<"u"}function ft(e){return Fn(e)?(e.nodeName||"").toLowerCase():"#document"}function je(e){var s;return(e==null||(s=e.ownerDocument)==null?void 0:s.defaultView)||window}function Me(e){var s;return(s=(Fn(e)?e.ownerDocument:e.document)||window.document)==null?void 0:s.documentElement}function Fn(e){return as()?e instanceof Node||e instanceof je(e).Node:!1}function ke(e){return as()?e instanceof Element||e instanceof je(e).Element:!1}function Ue(e){return as()?e instanceof HTMLElement||e instanceof je(e).HTMLElement:!1}function mn(e){return!as()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof je(e).ShadowRoot}function $t(e){const{overflow:s,overflowX:n,overflowY:i,display:r}=Ae(e);return/auto|scroll|overlay|hidden|clip/.test(s+i+n)&&r!=="inline"&&r!=="contents"}function Ra(e){return/^(table|td|th)$/.test(ft(e))}function os(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const $a=/transform|translate|scale|rotate|perspective|filter/,Ea=/paint|layout|strict|content/,Je=e=>!!e&&e!=="none";let xs;function Hs(e){const s=ke(e)?Ae(e):e;return Je(s.transform)||Je(s.translate)||Je(s.scale)||Je(s.rotate)||Je(s.perspective)||!Vs()&&(Je(s.backdropFilter)||Je(s.filter))||$a.test(s.willChange||"")||Ea.test(s.contain||"")}function Ta(e){let s=Ke(e);for(;Ue(s)&&!dt(s);){if(Hs(s))return s;if(os(s))return null;s=Ke(s)}return null}function Vs(){return xs==null&&(xs=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),xs}function dt(e){return/^(html|body|#document)$/.test(ft(e))}function Ae(e){return je(e).getComputedStyle(e)}function cs(e){return ke(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ke(e){if(ft(e)==="html")return e;const s=e.assignedSlot||e.parentNode||mn(e)&&e.host||Me(e);return mn(s)?s.host:s}function Bn(e){const s=Ke(e);return dt(s)?e.ownerDocument?e.ownerDocument.body:e.body:Ue(s)&&$t(s)?s:Bn(s)}function At(e,s,n){var i;s===void 0&&(s=[]),n===void 0&&(n=!0);const r=Bn(e),a=r===((i=e.ownerDocument)==null?void 0:i.body),c=je(r);if(a){const l=Es(c);return s.concat(c,c.visualViewport||[],$t(r)?r:[],l&&n?At(l):[])}else return s.concat(r,At(r,[],n))}function Es(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Un(e){const s=Ae(e);let n=parseFloat(s.width)||0,i=parseFloat(s.height)||0;const r=Ue(e),a=r?e.offsetWidth:n,c=r?e.offsetHeight:i,l=Qt(n)!==a||Qt(i)!==c;return l&&(n=a,i=c),{width:n,height:i,$:l}}function qs(e){return ke(e)?e:e.contextElement}function lt(e){const s=qs(e);if(!Ue(s))return Ie(1);const n=s.getBoundingClientRect(),{width:i,height:r,$:a}=Un(s);let c=(a?Qt(n.width):n.width)/i,l=(a?Qt(n.height):n.height)/r;return(!c||!Number.isFinite(c))&&(c=1),(!l||!Number.isFinite(l))&&(l=1),{x:c,y:l}}const Da=Ie(0);function Wn(e){const s=je(e);return!Vs()||!s.visualViewport?Da:{x:s.visualViewport.offsetLeft,y:s.visualViewport.offsetTop}}function Ia(e,s,n){return s===void 0&&(s=!1),!n||s&&n!==je(e)?!1:s}function Qe(e,s,n,i){s===void 0&&(s=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),a=qs(e);let c=Ie(1);s&&(i?ke(i)&&(c=lt(i)):c=lt(e));const l=Ia(a,n,i)?Wn(a):Ie(0);let o=(r.left+l.x)/c.x,u=(r.top+l.y)/c.y,m=r.width/c.x,h=r.height/c.y;if(a){const p=je(a),x=i&&ke(i)?je(i):i;let v=p,g=Es(v);for(;g&&i&&x!==v;){const y=lt(g),C=g.getBoundingClientRect(),N=Ae(g),w=C.left+(g.clientLeft+parseFloat(N.paddingLeft))*y.x,b=C.top+(g.clientTop+parseFloat(N.paddingTop))*y.y;o*=y.x,u*=y.y,m*=y.x,h*=y.y,o+=w,u+=b,v=je(g),g=Es(v)}}return ts({width:m,height:h,x:o,y:u})}function ls(e,s){const n=cs(e).scrollLeft;return s?s.left+n:Qe(Me(e)).left+n}function Hn(e,s){const n=e.getBoundingClientRect(),i=n.left+s.scrollLeft-ls(e,n),r=n.top+s.scrollTop;return{x:i,y:r}}function Ma(e){let{elements:s,rect:n,offsetParent:i,strategy:r}=e;const a=r==="fixed",c=Me(i),l=s?os(s.floating):!1;if(i===c||l&&a)return n;let o={scrollLeft:0,scrollTop:0},u=Ie(1);const m=Ie(0),h=Ue(i);if((h||!h&&!a)&&((ft(i)!=="body"||$t(c))&&(o=cs(i)),h)){const x=Qe(i);u=lt(i),m.x=x.x+i.clientLeft,m.y=x.y+i.clientTop}const p=c&&!h&&!a?Hn(c,o):Ie(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-o.scrollLeft*u.x+m.x+p.x,y:n.y*u.y-o.scrollTop*u.y+m.y+p.y}}function La(e){return Array.from(e.getClientRects())}function _a(e){const s=Me(e),n=cs(e),i=e.ownerDocument.body,r=be(s.scrollWidth,s.clientWidth,i.scrollWidth,i.clientWidth),a=be(s.scrollHeight,s.clientHeight,i.scrollHeight,i.clientHeight);let c=-n.scrollLeft+ls(e);const l=-n.scrollTop;return Ae(i).direction==="rtl"&&(c+=be(s.clientWidth,i.clientWidth)-r),{width:r,height:a,x:c,y:l}}const fn=25;function Oa(e,s){const n=je(e),i=Me(e),r=n.visualViewport;let a=i.clientWidth,c=i.clientHeight,l=0,o=0;if(r){a=r.width,c=r.height;const m=Vs();(!m||m&&s==="fixed")&&(l=r.offsetLeft,o=r.offsetTop)}const u=ls(i);if(u<=0){const m=i.ownerDocument,h=m.body,p=getComputedStyle(h),x=m.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,v=Math.abs(i.clientWidth-h.clientWidth-x);v<=fn&&(a-=v)}else u<=fn&&(a+=u);return{width:a,height:c,x:l,y:o}}function Pa(e,s){const n=Qe(e,!0,s==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,a=Ue(e)?lt(e):Ie(1),c=e.clientWidth*a.x,l=e.clientHeight*a.y,o=r*a.x,u=i*a.y;return{width:c,height:l,x:o,y:u}}function hn(e,s,n){let i;if(s==="viewport")i=Oa(e,n);else if(s==="document")i=_a(Me(e));else if(ke(s))i=Pa(s,n);else{const r=Wn(e);i={x:s.x-r.x,y:s.y-r.y,width:s.width,height:s.height}}return ts(i)}function Vn(e,s){const n=Ke(e);return n===s||!ke(n)||dt(n)?!1:Ae(n).position==="fixed"||Vn(n,s)}function za(e,s){const n=s.get(e);if(n)return n;let i=At(e,[],!1).filter(l=>ke(l)&&ft(l)!=="body"),r=null;const a=Ae(e).position==="fixed";let c=a?Ke(e):e;for(;ke(c)&&!dt(c);){const l=Ae(c),o=Hs(c);!o&&l.position==="fixed"&&(r=null),(a?!o&&!r:!o&&l.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||$t(c)&&!o&&Vn(e,c))?i=i.filter(m=>m!==c):r=l,c=Ke(c)}return s.set(e,i),i}function Fa(e){let{element:s,boundary:n,rootBoundary:i,strategy:r}=e;const c=[...n==="clippingAncestors"?os(s)?[]:za(s,this._c):[].concat(n),i],l=hn(s,c[0],r);let o=l.top,u=l.right,m=l.bottom,h=l.left;for(let p=1;p<c.length;p++){const x=hn(s,c[p],r);o=be(x.top,o),u=Xe(x.right,u),m=Xe(x.bottom,m),h=be(x.left,h)}return{width:u-h,height:m-o,x:h,y:o}}function Ba(e){const{width:s,height:n}=Un(e);return{width:s,height:n}}function Ua(e,s,n){const i=Ue(s),r=Me(s),a=n==="fixed",c=Qe(e,!0,a,s);let l={scrollLeft:0,scrollTop:0};const o=Ie(0);function u(){o.x=ls(r)}if(i||!i&&!a)if((ft(s)!=="body"||$t(r))&&(l=cs(s)),i){const x=Qe(s,!0,a,s);o.x=x.x+s.clientLeft,o.y=x.y+s.clientTop}else r&&u();a&&!i&&r&&u();const m=r&&!i&&!a?Hn(r,l):Ie(0),h=c.left+l.scrollLeft-o.x-m.x,p=c.top+l.scrollTop-o.y-m.y;return{x:h,y:p,width:c.width,height:c.height}}function gs(e){return Ae(e).position==="static"}function pn(e,s){if(!Ue(e)||Ae(e).position==="fixed")return null;if(s)return s(e);let n=e.offsetParent;return Me(e)===n&&(n=n.ownerDocument.body),n}function qn(e,s){const n=je(e);if(os(e))return n;if(!Ue(e)){let r=Ke(e);for(;r&&!dt(r);){if(ke(r)&&!gs(r))return r;r=Ke(r)}return n}let i=pn(e,s);for(;i&&Ra(i)&&gs(i);)i=pn(i,s);return i&&dt(i)&&gs(i)&&!Hs(i)?n:i||Ta(e)||n}const Wa=async function(e){const s=this.getOffsetParent||qn,n=this.getDimensions,i=await n(e.floating);return{reference:Ua(e.reference,await s(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Ha(e){return Ae(e).direction==="rtl"}const Va={convertOffsetParentRelativeRectToViewportRelativeRect:Ma,getDocumentElement:Me,getClippingRect:Fa,getOffsetParent:qn,getElementRects:Wa,getClientRects:La,getDimensions:Ba,getScale:lt,isElement:ke,isRTL:Ha};function Xn(e,s){return e.x===s.x&&e.y===s.y&&e.width===s.width&&e.height===s.height}function qa(e,s){let n=null,i;const r=Me(e);function a(){var l;clearTimeout(i),(l=n)==null||l.disconnect(),n=null}function c(l,o){l===void 0&&(l=!1),o===void 0&&(o=1),a();const u=e.getBoundingClientRect(),{left:m,top:h,width:p,height:x}=u;if(l||s(),!p||!x)return;const v=Vt(h),g=Vt(r.clientWidth-(m+p)),y=Vt(r.clientHeight-(h+x)),C=Vt(m),w={rootMargin:-v+"px "+-g+"px "+-y+"px "+-C+"px",threshold:be(0,Xe(1,o))||1};let b=!0;function $(R){const I=R[0].intersectionRatio;if(I!==o){if(!b)return c();I?c(!1,I):i=setTimeout(()=>{c(!1,1e-7)},1e3)}I===1&&!Xn(u,e.getBoundingClientRect())&&c(),b=!1}try{n=new IntersectionObserver($,{...w,root:r.ownerDocument})}catch{n=new IntersectionObserver($,w)}n.observe(e)}return c(!0),a}function Xa(e,s,n,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:a=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:o=!1}=i,u=qs(e),m=r||a?[...u?At(u):[],...s?At(s):[]]:[];m.forEach(C=>{r&&C.addEventListener("scroll",n,{passive:!0}),a&&C.addEventListener("resize",n)});const h=u&&l?qa(u,n):null;let p=-1,x=null;c&&(x=new ResizeObserver(C=>{let[N]=C;N&&N.target===u&&x&&s&&(x.unobserve(s),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=x)==null||w.observe(s)})),n()}),u&&!o&&x.observe(u),s&&x.observe(s));let v,g=o?Qe(e):null;o&&y();function y(){const C=Qe(e);g&&!Xn(g,C)&&n(),g=C,v=requestAnimationFrame(y)}return n(),()=>{var C;m.forEach(N=>{r&&N.removeEventListener("scroll",n),a&&N.removeEventListener("resize",n)}),h==null||h(),(C=x)==null||C.disconnect(),x=null,o&&cancelAnimationFrame(v)}}const Ka=Ca,Ga=Sa,Ya=ja,Za=Aa,Ja=wa,xn=ba,Qa=ka,eo=(e,s,n)=>{const i=new Map,r={platform:Va,...n},a={...r.platform,_c:i};return va(e,s,{...r,platform:a})};var to=typeof document<"u",so=function(){},Yt=to?d.useLayoutEffect:so;function ss(e,s){if(e===s)return!0;if(typeof e!=typeof s)return!1;if(typeof e=="function"&&e.toString()===s.toString())return!0;let n,i,r;if(e&&s&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==s.length)return!1;for(i=n;i--!==0;)if(!ss(e[i],s[i]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(s).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(s,r[i]))return!1;for(i=n;i--!==0;){const a=r[i];if(!(a==="_owner"&&e.$$typeof)&&!ss(e[a],s[a]))return!1}return!0}return e!==e&&s!==s}function Kn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gn(e,s){const n=Kn(e);return Math.round(s*n)/n}function ys(e){const s=d.useRef(e);return Yt(()=>{s.current=e}),s}function no(e){e===void 0&&(e={});const{placement:s="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:a,floating:c}={},transform:l=!0,whileElementsMounted:o,open:u}=e,[m,h]=d.useState({x:0,y:0,strategy:n,placement:s,middlewareData:{},isPositioned:!1}),[p,x]=d.useState(i);ss(p,i)||x(i);const[v,g]=d.useState(null),[y,C]=d.useState(null),N=d.useCallback(k=>{k!==R.current&&(R.current=k,g(k))},[]),w=d.useCallback(k=>{k!==I.current&&(I.current=k,C(k))},[]),b=a||v,$=c||y,R=d.useRef(null),I=d.useRef(null),E=d.useRef(m),q=o!=null,O=ys(o),F=ys(r),W=ys(u),Y=d.useCallback(()=>{if(!R.current||!I.current)return;const k={placement:s,strategy:n,middleware:p};F.current&&(k.platform=F.current),eo(R.current,I.current,k).then(K=>{const re={...K,isPositioned:W.current!==!1};z.current&&!ss(E.current,re)&&(E.current=re,En.flushSync(()=>{h(re)}))})},[p,s,n,F,W]);Yt(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,h(k=>({...k,isPositioned:!1})))},[u]);const z=d.useRef(!1);Yt(()=>(z.current=!0,()=>{z.current=!1}),[]),Yt(()=>{if(b&&(R.current=b),$&&(I.current=$),b&&$){if(O.current)return O.current(b,$,Y);Y()}},[b,$,Y,O,q]);const J=d.useMemo(()=>({reference:R,floating:I,setReference:N,setFloating:w}),[N,w]),P=d.useMemo(()=>({reference:b,floating:$}),[b,$]),L=d.useMemo(()=>{const k={position:n,left:0,top:0};if(!P.floating)return k;const K=gn(P.floating,m.x),re=gn(P.floating,m.y);return l?{...k,transform:"translate("+K+"px, "+re+"px)",...Kn(P.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:K,top:re}},[n,l,P.floating,m.x,m.y]);return d.useMemo(()=>({...m,update:Y,refs:J,elements:P,floatingStyles:L}),[m,Y,J,P,L])}const io=e=>{function s(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:i,padding:r}=typeof e=="function"?e(n):e;return i&&s(i)?i.current!=null?xn({element:i.current,padding:r}).fn(n):{}:i?xn({element:i,padding:r}).fn(n):{}}}},ro=(e,s)=>{const n=Ka(e);return{name:n.name,fn:n.fn,options:[e,s]}},ao=(e,s)=>{const n=Ga(e);return{name:n.name,fn:n.fn,options:[e,s]}},oo=(e,s)=>({fn:Qa(e).fn,options:[e,s]}),co=(e,s)=>{const n=Ya(e);return{name:n.name,fn:n.fn,options:[e,s]}},lo=(e,s)=>{const n=Za(e);return{name:n.name,fn:n.fn,options:[e,s]}},uo=(e,s)=>{const n=Ja(e);return{name:n.name,fn:n.fn,options:[e,s]}},mo=(e,s)=>{const n=io(e);return{name:n.name,fn:n.fn,options:[e,s]}};var fo="Arrow",Gn=d.forwardRef((e,s)=>{const{children:n,width:i=10,height:r=5,...a}=e;return t.jsx(Rt.svg,{...a,ref:s,width:i,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});Gn.displayName=fo;var ho=Gn;function po(e){const[s,n]=d.useState(void 0);return Jt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const a=r[0];let c,l;if("borderBoxSize"in a){const o=a.borderBoxSize,u=Array.isArray(o)?o[0]:o;c=u.inlineSize,l=u.blockSize}else c=e.offsetWidth,l=e.offsetHeight;n({width:c,height:l})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),s}var Xs="Popper",[Yn]=Ps(Xs),[xo,Zn]=Yn(Xs),Jn=e=>{const{__scopePopper:s,children:n}=e,[i,r]=d.useState(null);return t.jsx(xo,{scope:s,anchor:i,onAnchorChange:r,children:n})};Jn.displayName=Xs;var Qn="PopperAnchor",ei=d.forwardRef((e,s)=>{const{__scopePopper:n,virtualRef:i,...r}=e,a=Zn(Qn,n),c=d.useRef(null),l=kt(s,c),o=d.useRef(null);return d.useEffect(()=>{const u=o.current;o.current=(i==null?void 0:i.current)||c.current,u!==o.current&&a.onAnchorChange(o.current)}),i?null:t.jsx(Rt.div,{...r,ref:l})});ei.displayName=Qn;var Ks="PopperContent",[go,yo]=Yn(Ks),ti=d.forwardRef((e,s)=>{var B,Z,ce,de,$e,_e;const{__scopePopper:n,side:i="bottom",sideOffset:r=0,align:a="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:o=!0,collisionBoundary:u=[],collisionPadding:m=0,sticky:h="partial",hideWhenDetached:p=!1,updatePositionStrategy:x="optimized",onPlaced:v,...g}=e,y=Zn(Ks,n),[C,N]=d.useState(null),w=kt(s,xe=>N(xe)),[b,$]=d.useState(null),R=po(b),I=(R==null?void 0:R.width)??0,E=(R==null?void 0:R.height)??0,q=i+(a!=="center"?"-"+a:""),O=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},F=Array.isArray(u)?u:[u],W=F.length>0,Y={padding:O,boundary:F.filter(jo),altBoundary:W},{refs:z,floatingStyles:J,placement:P,isPositioned:L,middlewareData:k}=no({strategy:"fixed",placement:q,whileElementsMounted:(...xe)=>Xa(...xe,{animationFrame:x==="always"}),elements:{reference:y.anchor},middleware:[ro({mainAxis:r+E,alignmentAxis:c}),o&&ao({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?oo():void 0,...Y}),o&&co({...Y}),lo({...Y,apply:({elements:xe,rects:Ee,availableWidth:ge,availableHeight:et})=>{const{width:Te,height:tt}=Ee.reference,ye=xe.floating.style;ye.setProperty("--radix-popper-available-width",`${ge}px`),ye.setProperty("--radix-popper-available-height",`${et}px`),ye.setProperty("--radix-popper-anchor-width",`${Te}px`),ye.setProperty("--radix-popper-anchor-height",`${tt}px`)}}),b&&mo({element:b,padding:l}),wo({arrowWidth:I,arrowHeight:E}),p&&uo({strategy:"referenceHidden",...Y})]}),[K,re]=ni(P),fe=Mn(v);Jt(()=>{L&&(fe==null||fe())},[L,fe]);const We=(B=k.arrow)==null?void 0:B.x,Re=(Z=k.arrow)==null?void 0:Z.y,he=((ce=k.arrow)==null?void 0:ce.centerOffset)!==0,[Le,S]=d.useState();return Jt(()=>{C&&S(window.getComputedStyle(C).zIndex)},[C]),t.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...J,transform:L?J.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Le,"--radix-popper-transform-origin":[(de=k.transformOrigin)==null?void 0:de.x,($e=k.transformOrigin)==null?void 0:$e.y].join(" "),...((_e=k.hide)==null?void 0:_e.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(go,{scope:n,placedSide:K,onArrowChange:$,arrowX:We,arrowY:Re,shouldHideArrow:he,children:t.jsx(Rt.div,{"data-side":K,"data-align":re,...g,ref:w,style:{...g.style,animation:L?void 0:"none"}})})})});ti.displayName=Ks;var si="PopperArrow",vo={top:"bottom",right:"left",bottom:"top",left:"right"},bo=d.forwardRef(function(s,n){const{__scopePopper:i,...r}=s,a=yo(si,i),c=vo[a.placedSide];return t.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:t.jsx(ho,{...r,ref:n,style:{...r.style,display:"block"}})})});bo.displayName=si;function jo(e){return e!==null}var wo=e=>({name:"transformOrigin",options:e,fn(s){var y,C,N;const{placement:n,rects:i,middlewareData:r}=s,c=((y=r.arrow)==null?void 0:y.centerOffset)!==0,l=c?0:e.arrowWidth,o=c?0:e.arrowHeight,[u,m]=ni(n),h={start:"0%",center:"50%",end:"100%"}[m],p=(((C=r.arrow)==null?void 0:C.x)??0)+l/2,x=(((N=r.arrow)==null?void 0:N.y)??0)+o/2;let v="",g="";return u==="bottom"?(v=c?h:`${p}px`,g=`${-o}px`):u==="top"?(v=c?h:`${p}px`,g=`${i.floating.height+o}px`):u==="right"?(v=`${-o}px`,g=c?h:`${x}px`):u==="left"&&(v=`${i.floating.width+o}px`,g=c?h:`${x}px`),{data:{x:v,y:g}}}});function ni(e){const[s,n="center"]=e.split("-");return[s,n]}var No=Jn,Co=ei,So=ti,ko=Symbol.for("react.lazy"),ns=wi[" use ".trim().toString()];function Ao(e){return typeof e=="object"&&e!==null&&"then"in e}function ii(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ko&&"_payload"in e&&Ao(e._payload)}function Ro(e){const s=$o(e),n=d.forwardRef((i,r)=>{let{children:a,...c}=i;ii(a)&&typeof ns=="function"&&(a=ns(a._payload));const l=d.Children.toArray(a),o=l.find(To);if(o){const u=o.props.children,m=l.map(h=>h===o?d.Children.count(u)>1?d.Children.only(null):d.isValidElement(u)?u.props.children:null:h);return t.jsx(s,{...c,ref:r,children:d.isValidElement(u)?d.cloneElement(u,void 0,m):null})}return t.jsx(s,{...c,ref:r,children:a})});return n.displayName=`${e}.Slot`,n}function $o(e){const s=d.forwardRef((n,i)=>{let{children:r,...a}=n;if(ii(r)&&typeof ns=="function"&&(r=ns(r._payload)),d.isValidElement(r)){const c=Io(r),l=Do(a,r.props);return r.type!==d.Fragment&&(l.ref=i?Ti(i,c):c),d.cloneElement(r,l)}return d.Children.count(r)>1?d.Children.only(null):null});return s.displayName=`${e}.SlotClone`,s}var Eo=Symbol("radix.slottable");function To(e){return d.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Eo}function Do(e,s){const n={...s};for(const i in s){const r=e[i],a=s[i];/^on[A-Z]/.test(i)?r&&a?n[i]=(...l)=>{const o=a(...l);return r(...l),o}:r&&(n[i]=r):i==="style"?n[i]={...r,...a}:i==="className"&&(n[i]=[r,a].filter(Boolean).join(" "))}return{...e,...n}}function Io(e){var i,r;let s=(i=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:i.get,n=s&&"isReactWarning"in s&&s.isReactWarning;return n?e.ref:(s=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Mo=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Lo=Mo.reduce((e,s)=>{const n=Ro(`Primitive.${s}`),i=d.forwardRef((r,a)=>{const{asChild:c,...l}=r,o=c?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(o,{...l,ref:a})});return i.displayName=`Primitive.${s}`,{...e,[s]:i}},{}),_o="Portal",ri=d.forwardRef((e,s)=>{var l;const{container:n,...i}=e,[r,a]=d.useState(!1);Jt(()=>a(!0),[]);const c=n||r&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return c?Ni.createPortal(t.jsx(Lo.div,{...i,ref:s}),c):null});ri.displayName=_o;const ai=({open:e,onClose:s,anchorRef:n,placement:i="bottom-end",children:r})=>{const a=d.useRef(null);if(d.useEffect(()=>{if(!e)return;const u=m=>{var h,p;e&&((h=a.current)!=null&&h.contains(m.target)||(p=n.current)!=null&&p.contains(m.target)||s())};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e,s,n]),!e)return null;const c=i.startsWith("top")?"top":"bottom",l=i.endsWith("end")?"end":"start",o=i.startsWith("top")?8:4;return t.jsxs(No,{children:[t.jsx(Co,{virtualRef:n}),t.jsx(ri,{children:t.jsx(Di,{onEscapeKeyDown:u=>{u.preventDefault(),s()},onPointerDownOutside:u=>{var m;if((m=n.current)!=null&&m.contains(u.target)){u.preventDefault();return}s()},children:t.jsx(So,{ref:a,side:c,align:l,sideOffset:o,className:`popover popover-${i}`,role:"dialog",children:r})})})]})};function Oo(e){const s=e+"CollectionProvider",[n,i]=Ps(s),[r,a]=n(s,{collectionRef:{current:null},itemMap:new Map}),c=g=>{const{scope:y,children:C}=g,N=Se.useRef(null),w=Se.useRef(new Map).current;return t.jsx(r,{scope:y,itemMap:w,collectionRef:N,children:C})};c.displayName=s;const l=e+"CollectionSlot",o=sn(l),u=Se.forwardRef((g,y)=>{const{scope:C,children:N}=g,w=a(l,C),b=kt(y,w.collectionRef);return t.jsx(o,{ref:b,children:N})});u.displayName=l;const m=e+"CollectionItemSlot",h="data-radix-collection-item",p=sn(m),x=Se.forwardRef((g,y)=>{const{scope:C,children:N,...w}=g,b=Se.useRef(null),$=kt(y,b),R=a(m,C);return Se.useEffect(()=>(R.itemMap.set(b,{ref:b,...w}),()=>void R.itemMap.delete(b))),t.jsx(p,{[h]:"",ref:$,children:N})});x.displayName=m;function v(g){const y=a(e+"CollectionConsumer",g);return Se.useCallback(()=>{const N=y.collectionRef.current;if(!N)return[];const w=Array.from(N.querySelectorAll(`[${h}]`));return Array.from(y.itemMap.values()).sort((R,I)=>w.indexOf(R.ref.current)-w.indexOf(I.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:c,Slot:u,ItemSlot:x},v,i]}var Po=d.createContext(void 0);function zo(e){const s=d.useContext(Po);return e||s||"ltr"}var vs="rovingFocusGroup.onEntryFocus",Fo={bubbles:!1,cancelable:!0},Et="RovingFocusGroup",[Ts,oi,Bo]=Oo(Et),[Uo]=Ps(Et,[Bo]),[Wo,Ho]=Uo(Et),ci=d.forwardRef((e,s)=>t.jsx(Ts.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Ts.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Vo,{...e,ref:s})})}));ci.displayName=Et;var Vo=d.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:n,orientation:i,loop:r=!1,dir:a,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:o,onEntryFocus:u,preventScrollOnEntryFocus:m=!1,...h}=e,p=d.useRef(null),x=kt(s,p),v=zo(a),[g,y]=Mi({prop:c,defaultProp:l??null,onChange:o,caller:Et}),[C,N]=d.useState(!1),w=Mn(u),b=oi(n),$=d.useRef(!1),[R,I]=d.useState(0);return d.useEffect(()=>{const E=p.current;if(E)return E.addEventListener(vs,w),()=>E.removeEventListener(vs,w)},[w]),t.jsx(Wo,{scope:n,orientation:i,dir:v,loop:r,currentTabStopId:g,onItemFocus:d.useCallback(E=>y(E),[y]),onItemShiftTab:d.useCallback(()=>N(!0),[]),onFocusableItemAdd:d.useCallback(()=>I(E=>E+1),[]),onFocusableItemRemove:d.useCallback(()=>I(E=>E-1),[]),children:t.jsx(Rt.div,{tabIndex:C||R===0?-1:0,"data-orientation":i,...h,ref:x,style:{outline:"none",...e.style},onMouseDown:ot(e.onMouseDown,()=>{$.current=!0}),onFocus:ot(e.onFocus,E=>{const q=!$.current;if(E.target===E.currentTarget&&q&&!C){const O=new CustomEvent(vs,Fo);if(E.currentTarget.dispatchEvent(O),!O.defaultPrevented){const F=b().filter(P=>P.focusable),W=F.find(P=>P.active),Y=F.find(P=>P.id===g),J=[W,Y,...F].filter(Boolean).map(P=>P.ref.current);ui(J,m)}}$.current=!1}),onBlur:ot(e.onBlur,()=>N(!1))})})}),li="RovingFocusGroupItem",di=d.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:n,focusable:i=!0,active:r=!1,tabStopId:a,children:c,...l}=e,o=Ii(),u=a||o,m=Ho(li,n),h=m.currentTabStopId===u,p=oi(n),{onFocusableItemAdd:x,onFocusableItemRemove:v,currentTabStopId:g}=m;return d.useEffect(()=>{if(i)return x(),()=>v()},[i,x,v]),t.jsx(Ts.ItemSlot,{scope:n,id:u,focusable:i,active:r,children:t.jsx(Rt.span,{tabIndex:h?0:-1,"data-orientation":m.orientation,...l,ref:s,onMouseDown:ot(e.onMouseDown,y=>{i?m.onItemFocus(u):y.preventDefault()}),onFocus:ot(e.onFocus,()=>m.onItemFocus(u)),onKeyDown:ot(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){m.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const C=Ko(y,m.orientation,m.dir);if(C!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let w=p().filter(b=>b.focusable).map(b=>b.ref.current);if(C==="last")w.reverse();else if(C==="prev"||C==="next"){C==="prev"&&w.reverse();const b=w.indexOf(y.currentTarget);w=m.loop?Go(w,b+1):w.slice(b+1)}setTimeout(()=>ui(w))}}),children:typeof c=="function"?c({isCurrentTabStop:h,hasTabStop:g!=null}):c})})});di.displayName=li;var qo={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Xo(e,s){return s!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Ko(e,s,n){const i=Xo(e.key,n);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return qo[i]}function ui(e,s=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:s}),document.activeElement!==n))return}function Go(e,s){return e.map((n,i)=>e[(s+i)%e.length])}var Yo=ci,Zo=di;const Ve=({icon:e,children:s,onClick:n,danger:i,disabled:r,checked:a,note:c,trailing:l})=>t.jsx(Zo,{asChild:!0,focusable:!r,active:!1,children:t.jsxs("button",{type:"button",role:a===void 0?"menuitem":"menuitemradio","aria-checked":a,className:`menu-item${i?" menu-item-danger":""}`,onClick:n,disabled:r,children:[a!==void 0&&t.jsx("span",{className:"menu-item-check","aria-hidden":"true",children:a&&t.jsx(ct,{size:12})}),e&&t.jsx("span",{className:"menu-item-icon",children:e}),t.jsxs("span",{className:"menu-item-label",children:[s,c&&t.jsx("span",{className:"menu-item-note",children:c})]}),l!==void 0&&t.jsx("span",{className:"menu-item-trailing",children:l})]})}),Jo=()=>t.jsx("div",{className:"menu-divider",role:"separator"}),mi=({children:e})=>t.jsx(Yo,{asChild:!0,orientation:"vertical",loop:!0,children:t.jsx("div",{className:"menu",role:"menu",children:e})}),Qo=[{label:"1 Hour",value:"1h"},{label:"2 Hours",value:"2h"},{label:"4 Hours",value:"4h"},{label:"8 Hours",value:"8h"}],ec=({device:e,onClose:s,onReserved:n})=>{const[i,r]=d.useState(""),[a,c]=d.useState("1h"),[l,o]=d.useState(""),[u,m]=d.useState(!1),[h,p]=d.useState(null),[x,v]=d.useState(null),g=async()=>{if(!i.trim()){p("Please enter your name/ID");return}m(!0),p(null),v(null);try{const y=await V.reserveDevice(e.udid,e.host,i,a,l);y.success?(n(),s()):v(y.error||"Failed to reserve device")}catch(y){v(y.message||"An unexpected error occurred")}finally{m(!1)}};return t.jsx(zs,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(or,{size:16,className:"title-icon"}),"Reserve device"]}),footer:t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"btn-cancel",onClick:s,disabled:u,children:"Cancel"}),t.jsx("button",{className:"btn-reserve",onClick:g,disabled:u||!i.trim(),children:u?"Reserving...":"Confirm Reservation"})]}),children:t.jsxs("div",{className:"reservation-modal-body",children:[t.jsxs("div",{className:"device-id-badge",children:[t.jsx("span",{className:"label",children:"Device:"}),t.jsx("span",{className:"value",children:e.udid})]}),t.jsxs("p",{children:["Reserve ",t.jsx("strong",{children:e.name||e.udid})," for exclusive use. This will prevent CI sessions from using this device."]}),t.jsx(Kt,{label:t.jsxs(t.Fragment,{children:[t.jsx(Ci,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Reserved by"]}),htmlFor:"reservation-reserved-by",error:h?t.jsxs(t.Fragment,{children:[t.jsx(tn,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),h]}):void 0,children:t.jsx("input",{id:"reservation-reserved-by",type:"text",className:"reservation-input",placeholder:"Enter your name or ID",value:i,onChange:y=>{r(y.target.value),h&&p(null)},disabled:u})}),t.jsx(Kt,{label:t.jsxs(t.Fragment,{children:[t.jsx(Li,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Duration"]}),children:t.jsx("div",{className:"duration-selector",children:Qo.map(y=>t.jsx("div",{className:`duration-option ${a===y.value?"active":""}`,onClick:()=>c(y.value),children:y.label},y.value))})}),t.jsx(Kt,{label:t.jsxs(t.Fragment,{children:[t.jsx(Er,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Reason (optional)"]}),htmlFor:"reservation-reason",error:x?t.jsxs(t.Fragment,{children:[t.jsx(tn,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),x]}):void 0,children:t.jsx("input",{id:"reservation-reason",type:"text",className:"reservation-input",placeholder:"e.g., Debugging flaky login test",value:l,onChange:y=>o(y.target.value),disabled:u})})]})})},tc=({device:e,onClose:s,onUpdated:n})=>{const{toast:i}=is(),[r,a]=d.useState(e.tags||[]),[c,l]=d.useState(""),[o,u]=d.useState(!1),m=d.useRef(null);d.useEffect(()=>{m.current&&m.current.focus()},[]);const h=()=>{const g=c.trim();g&&!r.includes(g)&&(a([...r,g]),l(""))},p=g=>{a(r.filter(y=>y!==g))},x=g=>{g.key==="Enter"&&h()},v=async()=>{u(!0);try{await V.updateDeviceTags(e.udid,e.host,r),n(),s()}catch(g){console.error("Failed to update tags",g),i("Error saving tags. Please try again.","error")}finally{u(!1)}};return t.jsx(zs,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(Gr,{size:16,className:"title-icon"}),"Manage device tags"]}),footer:t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"btn-cancel",onClick:s,children:"Cancel"}),t.jsx("button",{className:"btn-save",onClick:v,disabled:o,children:o?"Saving...":"Apply Changes"})]}),children:t.jsxs("div",{className:"tag-modal-body",children:[t.jsxs("div",{className:"device-id-badge",children:[t.jsx("span",{className:"label",children:"Device:"}),t.jsx("span",{className:"value",children:e.udid})]}),t.jsx(Kt,{label:"Add new tag",description:"Press Enter to add multiple tags",htmlFor:"tag-input",children:t.jsxs("div",{className:"input-with-button",children:[t.jsx("input",{ref:m,id:"tag-input",type:"text",placeholder:"e.g. stable, team-a, ios-17",value:c,onChange:g=>l(g.target.value),onKeyDown:x}),t.jsx("button",{className:"add-inline-btn",onClick:h,disabled:!c.trim(),children:t.jsx(Ln,{size:16})})]})}),t.jsxs("div",{className:"tags-display-section",children:[t.jsx("label",{children:"Current Tags"}),t.jsx("div",{className:"tags-list",children:r.length>0?r.map(g=>t.jsxs("div",{className:"tag-pill-editable",children:[g,t.jsx("button",{className:"remove-tag",onClick:()=>p(g),children:t.jsx(Ls,{size:12})})]},g)):t.jsx("div",{className:"empty-tags",children:"No tags assigned to this device."})})]})]})})};function sc(e){return e>=50?"ready":e>=20?"warning":"error"}function nc(e){return e>=50?t.jsx(nr,{size:10}):e>=20?t.jsx(Qi,{size:10}):t.jsx(tr,{size:10})}function ic(e){return e==="Normal"?"ready":e==="Critical"?"error":"warning"}const rc=({device:e})=>{if(e.deviceType==="emulator"||e.deviceType==="simulator"||e.offline)return null;const n=typeof e.batteryLevel=="number",i=typeof e.thermalStatus=="string"&&e.thermalStatus.length>0&&e.thermalStatus!=="Unknown";return!n&&!i?t.jsx("div",{className:"dc2-health",children:t.jsxs(Xt,{tone:"neutral",title:"Device does not report battery or thermal data",children:[t.jsx(_i,{size:10}),"No telemetry"]})}):t.jsxs("div",{className:"dc2-health",children:[n&&t.jsxs(Xt,{tone:sc(e.batteryLevel),title:`Battery ${e.batteryLevel}%`,children:[nc(e.batteryLevel),e.batteryLevel,"%"]}),i&&t.jsxs(Xt,{tone:ic(e.thermalStatus),title:`Thermal: ${e.thermalStatus}`,children:[t.jsx(ea,{size:10}),e.thermalStatus]})]})},ac="/wd/hub";function oc(e){return e==="android"?"UiAutomator2":"XCUITest"}function cc(e){return e==="android"?"Android":e==="tvos"?"tvOS":"iOS"}function lc(e,s=ac){if(!e)return"—";try{const n=new URL(e.includes("://")?e:`http://${e}`),i=s.startsWith("/")?s:`/${s}`,r=n.pathname.replace(/\/$/,"");return r===i||r.endsWith(i)?`${n.protocol}//${n.host}${r}`:`${n.protocol}//${n.host}${i}`}catch{return e}}function dc(e){const s={platformName:cc(e.platform),"appium:automationName":oc(e.platform),"appium:udid":e.udid};return e.sdk&&e.sdk!=="Unknown"&&e.sdk!=="unknown"&&(s["appium:platformVersion"]=e.sdk),e.name&&(s["appium:deviceName"]=e.name),s}function uc(e){return JSON.stringify(dc(e),null,2)}const mc=/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i,fc=/^(?:\d{1,3}\.){3}\d{1,3}$/;function hc(e){const s=e.trim();return!s||mc.test(s)||!fc.test(s)?!1:s.split(".").every(n=>{const i=Number(n);return Number.isInteger(i)&&i>=0&&i<=255})}function pc(e){return e.ip&&hc(e.ip)?e.ip.trim():null}function xc(e){if(typeof e!="number")throw new TypeError("Expected a number");const s=e>0?Math.floor:Math.ceil;return{days:s(e/864e5),hours:s(e/36e5)%24,minutes:s(e/6e4)%60,seconds:s(e/1e3)%60,milliseconds:s(e)%1e3,microseconds:s(e*1e3)%1e3,nanoseconds:s(e*1e6)%1e3}}const gc=(e,s)=>s===1?e:`${e}s`,yc=1e-7;function fi(e,s={}){if(!Number.isFinite(e))throw new TypeError("Expected a finite number");s.colonNotation&&(s.compact=!1,s.formatSubMilliseconds=!1,s.separateMilliseconds=!1,s.verbose=!1),s.compact&&(s.secondsDecimalDigits=0,s.millisecondsDecimalDigits=0);const n=[],i=(c,l)=>{const o=Math.floor(c*10**l+yc);return(Math.round(o)/10**l).toFixed(l)},r=(c,l,o,u)=>{if((n.length===0||!s.colonNotation)&&c===0&&!(s.colonNotation&&o==="m"))return;u=(u||c||"0").toString();let m,h;if(s.colonNotation){m=n.length>0?":":"",h="";const p=u.includes(".")?u.split(".")[0].length:u.length,x=n.length>0?2:1;u="0".repeat(Math.max(0,x-p))+u}else m="",h=s.verbose?" "+gc(l,c):o;n.push(m+u+h)},a=xc(e);if(r(Math.trunc(a.days/365),"year","y"),r(a.days%365,"day","d"),r(a.hours,"hour","h"),r(a.minutes,"minute","m"),s.separateMilliseconds||s.formatSubMilliseconds||!s.colonNotation&&e<1e3)if(r(a.seconds,"second","s"),s.formatSubMilliseconds)r(a.milliseconds,"millisecond","ms"),r(a.microseconds,"microsecond","µs"),r(a.nanoseconds,"nanosecond","ns");else{const c=a.milliseconds+a.microseconds/1e3+a.nanoseconds/1e6,l=typeof s.millisecondsDecimalDigits=="number"?s.millisecondsDecimalDigits:0,o=c>=1?Math.round(c):Math.ceil(c),u=l?c.toFixed(l):o;r(Number.parseFloat(u),"millisecond","ms",u)}else{const c=e/1e3%60,l=typeof s.secondsDecimalDigits=="number"?s.secondsDecimalDigits:1,o=i(c,l),u=s.keepDecimalsOnWholeSeconds?o:o.replace(/\.0+$/,"");r(Number.parseFloat(u),"second","s",u)}if(n.length===0)return"0"+(s.verbose?" milliseconds":"ms");if(s.compact)return n[0];if(typeof s.unitCount=="number"){const c=s.colonNotation?"":" ";return n.slice(0,Math.max(s.unitCount,1)).join(c)}return s.colonNotation?n.join(""):n.join(" ")}const bs=6e4;function vc(e){return!Number.isFinite(e)||e<=0?"expiring":e<bs?"under 1m":fi(Math.floor(e/bs)*bs,{unitCount:2})}const bc=["ready","busy","reserved","maintenance","offline"];function Gs(e,s){return e.offline?"offline":e.userBlocked?"maintenance":e.busy?"busy":e.reservedUntil&&s<e.reservedUntil?"reserved":"ready"}function hi(e,s){if(!e.busy||!e.session_id)return null;const n=String(e.session_id);return n.startsWith("manual_")?s!=null&&s.userId&&n===`manual_${s.userId}_${e.udid}`?"self":"other":"session"}const yn=e=>(e==null?void 0:e.role)==="ADMIN"||(e==null?void 0:e.role)==="SUPER_ADMIN";function jc(e,s,n){switch(hi(e,s)){case"session":return e.sessionStartTime&&e.sessionStartTime>0&&n>e.sessionStartTime?`Test session · ${fi(n-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&&n<e.reservedUntil){const r=!!e.reservedBy&&(e.reservedBy===(s==null?void 0:s.email)||e.reservedBy===(s==null?void 0:s.name))?"you":e.reservedBy||"another user";return`${vc(e.reservedUntil-n)} left · by ${r}`}return null}function wc(e,s){if(e.offline)return{enabled:!1,reason:"Device is offline"};if(e.userBlocked&&!yn(s))return{enabled:!1,reason:"In maintenance"};const n=hi(e,s);return n==="session"?{enabled:!1,reason:"A test is running"}:n==="other"&&!yn(s)?{enabled:!1,reason:"Another user has control"}:{enabled:!0}}function Ys(e){var s;return((s=e.marketingName)==null?void 0:s.trim())||e.name}function Nc(e){const s=[Fs(e.platform),e.sdk].filter(Boolean).join(" ");if(e.deviceType==="emulator")return`Emulator · ${s}`;if(e.deviceType==="simulator")return`Simulator · ${s}`;const i=[e.manufacturer?e.manufacturer.charAt(0).toUpperCase()+e.manufacturer.slice(1):"",e.model].filter(Boolean).join(" ");return i?`${i} · ${s}`:s}function Cc(e){return e.formFactor==="tablet"||e.formFactor==="tv"?e.formFactor:"phone"}const Sc={ready:"Ready",busy:"Busy",reserved:"Reserved",maintenance:"Maintenance",offline:"Offline"},kc=({device:e})=>{const s={phone:Ss,tablet:Oi,tv:ki}[Cc(e)],n=e.deviceType==="emulator"||e.deviceType==="simulator";return t.jsx(s,{size:26,strokeWidth:1.5,strokeDasharray:n?"3 2":void 0})},Ac=({udid:e,currentTeamId:s,teams:n,onDone:i})=>{const{toast:r}=is(),[a,c]=d.useState(!1);async function l(o){c(!0);try{await V.setDeviceTeam(e,o),r(o?"Device assigned":"Device returned to shared pool","success"),i(!0)}catch(u){r((u==null?void 0:u.message)||"Failed to update team","error")}finally{c(!1)}}return t.jsxs(rs,{selectSize:"sm",autoFocus:!0,"aria-label":"Team",disabled:a,defaultValue:s??"",onBlur:()=>i(!1),onChange:o=>l(o.target.value||null),children:[t.jsx("option",{value:"",children:"(Shared pool)"}),Array.from(n.entries()).map(([o,u])=>t.jsx("option",{value:o,children:u},o))]})},Rc=({device:e,reloadDevices:s,navigate:n,teams:i})=>{var z,J,P;const[r,a]=d.useState(!1),[c,l]=d.useState(!1),[o,u]=d.useState(!1),[m,h]=d.useState(!1),p=d.useRef(null),{me:x}=Si(),{toast:v}=is(),g=(x==null?void 0:x.role)==="ADMIN"||(x==null?void 0:x.role)==="SUPER_ADMIN",y=Date.now(),C=Gs(e,y),N=C==="reserved",w=jc(e,x,y),b=wc(e,x),$=`dc2-reason-${e.udid}`,R=Ys(e),I=e.teamId?(i==null?void 0:i.get(e.teamId))??e.teamName??`Team ${e.teamId.slice(0,6)}`:null,E=lc(e.host),q=pc(e),O=async(L,k)=>{var K;try{await((K=navigator.clipboard)==null?void 0:K.writeText(L)),v(k,"success")}catch{v("Failed to copy","error")}},F=async()=>{await V.releaseReservation(e.udid,e.host),s()},W=async()=>{await V.blockDevice(e.udid,e.host),s()},Y=async()=>{await V.unblockDevice(e.udid,e.host),s()};return t.jsxs("div",{className:`dc2 dc2-${C}`,children:[t.jsxs("div",{className:`dc2-band dc2-band-${C}`,children:[t.jsxs("span",{className:"dc2-band-label",children:[t.jsx("span",{className:"dc2-band-dot","aria-hidden":!0}),Sc[C]]}),w&&t.jsx("span",{className:"dc2-band-activity",title:w,children:w})]}),t.jsxs("div",{className:`dc2-body${C==="offline"?" dc2-dim":""}`,children:[t.jsxs("div",{className:"dc2-head",children:[t.jsx("div",{className:"dc2-icon","aria-hidden":!0,children:t.jsx(kc,{device:e})}),t.jsxs("div",{className:"dc2-id",children:[t.jsx("div",{className:"dc2-title",title:`${R}
187
+ ${e.udid}`,children:R}),t.jsx("div",{className:"dc2-subtitle",children:Nc(e)})]})]}),t.jsxs("div",{className:"dc2-meta",children:[t.jsx(rc,{device:e}),o?t.jsx(Ac,{udid:e.udid,currentTeamId:e.teamId??null,teams:i??new Map,onDone:L=>{u(!1),L&&s()}}):I&&t.jsx(Xt,{tone:"accent",title:`Team: ${I}`,children:I}),(z=e.tags)==null?void 0:z.slice(0,2).map(L=>t.jsxs("span",{className:"dc2-tag",title:L,children:["#",L]},L)),(((J=e.tags)==null?void 0:J.length)||0)>2&&t.jsxs("span",{className:"dc2-tag",children:["+",(((P=e.tags)==null?void 0:P.length)||0)-2]})]})]}),t.jsxs("div",{className:"dc2-foot",children:[t.jsx(Oe,{variant:"tonal",size:"sm",disabled:!b.enabled,"aria-describedby":b.enabled?void 0:$,onClick:()=>{b.enabled&&n(`/devices/${e.udid}/control`)},children:"Control"}),N?t.jsx(Oe,{variant:"secondary",size:"sm",onClick:F,children:"Release"}):C==="ready"?t.jsx(Oe,{variant:"secondary",size:"sm",onClick:()=>a(!0),children:"Reserve"}):null,!b.enabled&&t.jsx("span",{id:$,className:"dc2-unavailable",title:b.reason,children:b.reason}),t.jsx("span",{className:"dc2-spacer"}),t.jsx("button",{ref:p,type:"button",className:"dc2-more",onClick:()=>h(L=>!L),"aria-label":"More actions",children:t.jsx(br,{size:14})}),t.jsx(ai,{open:m,onClose:()=>h(!1),anchorRef:p,children:t.jsxs(mi,{children:[t.jsx(Ve,{icon:t.jsx(qe,{size:12}),onClick:()=>{h(!1),O(e.udid,"UDID copied")},children:"Copy UDID"}),E!=="—"&&t.jsx(Ve,{icon:t.jsx(qe,{size:12}),onClick:()=>{h(!1),O(E,"Server URL copied")},children:"Copy server URL"}),q&&t.jsx(Ve,{icon:t.jsx(qe,{size:12}),onClick:()=>{h(!1),O(q,"IP address copied")},children:"Copy IP address"}),t.jsx(Ve,{icon:t.jsx(qe,{size:12}),onClick:()=>{h(!1),O(uc(e),"Session capabilities copied")},children:"Copy capabilities"}),g&&t.jsxs(t.Fragment,{children:[t.jsx(Jo,{}),t.jsx(Ve,{onClick:()=>{h(!1),l(!0)},children:"Manage tags…"}),t.jsx(Ve,{onClick:()=>{h(!1),u(!0)},children:"Assign team…"}),t.jsx(Ve,{onClick:()=>{h(!1),e.userBlocked?Y():W()},children:e.userBlocked?"Exit maintenance":"Enter maintenance"})]})]})})]}),r&&t.jsx(ec,{device:e,onClose:()=>a(!1),onReserved:()=>s()}),c&&t.jsx(tc,{device:e,onClose:()=>l(!1),onUpdated:()=>s()})]})};function $c(e){const s=_s(),{search:n}=Os();return t.jsx(Rc,{device:e.device,reloadDevices:e.reloadDevices,navigate:i=>s(`${i}${n}`),teams:e.teams})}class Ec extends Se.Component{constructor(){super(...arguments),this.state={teamsMap:new Map}}componentDidMount(){V.listTeams().then(s=>{this.setState({teamsMap:new Map(s.map(n=>[n.id,n.name]))})}).catch(()=>{})}render(){return t.jsx("div",{className:"device-explorer-card-container",children:Se.Children.toArray(this.props.devices.map(s=>t.jsx($c,{device:s,reloadDevices:this.props.reloadDevices,teams:this.state.teamsMap})))})}}var qt,Tc=new Uint8Array(16);function Dc(){if(!qt&&(qt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!qt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return qt(Tc)}const Ic=/^(?:[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 Mc(e){return typeof e=="string"&&Ic.test(e)}var le=[];for(var js=0;js<256;++js)le.push((js+256).toString(16).substr(1));function Lc(e){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(le[e[s+0]]+le[e[s+1]]+le[e[s+2]]+le[e[s+3]]+"-"+le[e[s+4]]+le[e[s+5]]+"-"+le[e[s+6]]+le[e[s+7]]+"-"+le[e[s+8]]+le[e[s+9]]+"-"+le[e[s+10]]+le[e[s+11]]+le[e[s+12]]+le[e[s+13]]+le[e[s+14]]+le[e[s+15]]).toLowerCase();if(!Mc(n))throw TypeError("Stringified UUID is invalid");return n}function _c(e,s,n){e=e||{};var i=e.random||(e.rng||Dc)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Lc(i)}const Oc=({onCommand:e,prompt:s="$",welcomeMessage:n="Interactive Shell (Restricted Mode)",platform:i})=>{const[r,a]=d.useState([{type:"system",content:n,timestamp:Date.now()},{type:"system",content:'Type "help" for allowed commands.',timestamp:Date.now()}]),[c,l]=d.useState(""),[o,u]=d.useState([]),[m,h]=d.useState(-1),[p,x]=d.useState(!1),v=d.useRef(null),g=d.useRef(null);d.useEffect(()=>{v.current&&(v.current.scrollTop=v.current.scrollHeight)},[r]);const y=N=>{const w=N.trim();if((w.startsWith("{")||w.startsWith("["))&&(w.endsWith("}")||w.endsWith("]")))try{const b=JSON.parse(w);return JSON.stringify(b,null,2)}catch{}return N},C=async N=>{if(N.key==="Enter"&&!p){const w=c.trim();if(!w)return;if(l(""),a(b=>[...b,{type:"command",content:`${s} ${w}`,timestamp:Date.now()}]),u(b=>[...b,w]),h(-1),x(!0),w==="clear"){a([]),x(!1);return}if(w==="help"){let b="";i==="android"?b=`
188
+ Android Allowed Commands:
189
+ • System Info: getprop, ip addr, date, uptime, cat /proc/meminfo, cat /proc/cpuinfo
190
+ • Process Mgmt: ps, top
191
+ • File System: ls
192
+ • Diagnostics: dumpsys [battery|wifi|power]
193
+ • Packages: pm list packages
194
+ `:(i==="ios"||i==="tvos")&&(b=`
195
+ iOS Allowed Commands:
196
+ • Real Device (go-ios):
197
+ apps, info, list, syslog, deviceinfo, diagnostics
198
+ • Simulator (xcrun simctl):
199
+ listapps, get_app_container, list, getenv
200
+ • Simulator System:
201
+ ls, ps, top, date, uptime, whoami
202
+ `),a($=>[...$,{type:"output",content:b.trim(),timestamp:Date.now()}]),x(!1);return}try{const b=await e(w),$=y(b||"(No output)");a(R=>[...R,{type:"output",content:$,timestamp:Date.now()}])}catch(b){a($=>[...$,{type:"error",content:b.message||"Unknown error",timestamp:Date.now()}])}finally{x(!1),setTimeout(()=>{var b;return(b=g.current)==null?void 0:b.focus()},10)}}else if(N.key==="ArrowUp"){if(N.preventDefault(),o.length>0){const w=m===-1?o.length-1:Math.max(0,m-1);h(w),l(o[w])}}else if(N.key==="ArrowDown"&&(N.preventDefault(),m!==-1)){const w=m+1;w>=o.length?(h(-1),l("")):(h(w),l(o[w]))}};return t.jsxs("div",{className:"terminal-container theme-dark",children:[t.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),t.jsxs("header",{className:"terminal-header",children:[t.jsxs("div",{className:"terminal-controls",children:[t.jsx("div",{className:"dot red"}),t.jsx("div",{className:"dot yellow"}),t.jsx("div",{className:"dot green"})]}),t.jsxs("div",{className:"terminal-title",children:[Fs(i)," shell"]}),t.jsx("div",{className:"terminal-actions",children:t.jsx("button",{className:"terminal-action-btn",onClick:()=>a([]),title:"Clear terminal",children:"CLEAR"})})]}),t.jsxs("div",{className:"terminal-history",ref:v,onClick:()=>{var N;return(N=g.current)==null?void 0:N.focus()},children:[r.map((N,w)=>t.jsx("div",{className:`terminal-line ${N.type}`,children:N.content},w)),p&&t.jsx("div",{className:"terminal-line system animate-pulse",children:"Executing command..."})]}),t.jsxs("div",{className:"terminal-input-area",children:[t.jsx("span",{className:"terminal-prompt",children:s}),t.jsx("input",{ref:g,className:"terminal-input",value:c,onChange:N=>l(N.target.value),onKeyDown:C,disabled:p,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"Type a command..."})]})]})};function Be(e,s){var n;s(e),(n=e.children)==null||n.forEach(i=>Be(i,s))}function Pe(e,...s){var n;for(const i of s){const r=(n=e.attributes)==null?void 0:n[i];if(r!=null&&r!=="")return String(r)}}function ut(e){var s;return((s=e.type)==null?void 0:s.split(".").pop())||e.type||""}function Pc(e,s){const n=[];return Be(e,i=>{Pe(i,"content-desc","contentDescription","accessibilityId","name","label")===s&&n.push(i)}),n}function zc(e,s){const n=[];return Be(e,i=>{Pe(i,"resource-id","resourceId","identifier")===s&&n.push(i)}),n}function Ds(e,s){const n=[];return Be(e,i=>{(i.type===s||ut(i)===s)&&n.push(i)}),n}function Fc(e,s){const n=[];return Be(e,i=>{Pe(i,"name")===s&&n.push(i)}),n}function Bc(e){const s=/^\/\/(\*|[A-Za-z_][\w.-]*)\[@([\w-]+)=(["'])(.*?)\3\]$/.exec(e.trim());return s?{tag:s[1]==="*"?null:s[1],attrKey:s[2],attrValue:s[4]}:null}function Uc(e,s){const n=s.split("/").filter(Boolean);if(n.length===0)return null;const i=[];for(const a of n){const c=/^([A-Za-z_][\w.-]*)\[(\d+)\]$/.exec(a);if(!c)return null;i.push({type:c[1],index:parseInt(c[2],10)})}if(i[0].type!==e.type&&i[0].type!==ut(e)||i[0].index!==1)return null;let r=e;for(let a=1;a<i.length&&r;a++){const{type:c,index:l}=i[a];let o=0,u;for(const m of r.children||[])if((m.type===c||ut(m)===c)&&(o+=1,o===l)){u=m;break}r=u}return r?[r]:[]}function Wc(e,s){const n=Uc(e,s);if(n!==null)return{kind:"matched",nodes:n};const i=Bc(s);if(i){const r=[];return Be(e,a=>{if(i.tag&&a.type!==i.tag&&ut(a)!==i.tag)return;Pe(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 Hc(e,s){const n=s.trim(),i=/^\*\*\/([A-Za-z_]\w*)\[`(\w+)\s*==\s*"([^"]*)"`\]$/.exec(n);if(i){const[,c,l,o]=i,u=[];return Be(e,m=>{if(m.type!==c&&ut(m)!==c)return;Pe(m,l)===o&&u.push(m)}),{kind:"matched",nodes:u}}const r=/^\*\*\/([A-Za-z_]\w*)\[(\d+)\]$/.exec(n);if(r){const[,c,l]=r,o=parseInt(l,10),u=[];return Be(e,m=>{(m.type===c||ut(m)===c)&&u.push(m)}),{kind:"matched",nodes:u[o-1]?[u[o-1]]:[]}}const a=/^\*\*\/([A-Za-z_]\w*)$/.exec(n);return a?Ds(e,a[1]).length>0?{kind:"matched",nodes:Ds(e,a[1])}:{kind:"matched",nodes:[]}:{kind:"unsupported",nodes:[],reason:"Multi-segment class chain — use a real driver to verify"}}function Vc(e,s){const i=s.trim().split(/\s+AND\s+/i).map(c=>c.trim()),r=[];for(const c of i){const l=/^(\w+)\s*==\s*"([^"]*)"$/.exec(c);if(!l)return{kind:"unsupported",nodes:[],reason:"Predicate uses unsupported operator (only ==, AND) — use a real driver"};r.push({key:l[1],value:l[2]})}const a=[];return Be(e,c=>{for(const l of r){let o;if(l.key==="type"?o=c.type:l.key==="label"?o=Pe(c,"label")??c.label:l.key==="name"?o=Pe(c,"name")??c.name:l.key==="value"?o=Pe(c,"value")??c.value:o=Pe(c,l.key),o!==l.value)return}a.push(c)}),{kind:"matched",nodes:a}}function qc(e,s,n){const i=s.toLowerCase();if(!n)return{kind:"matched",nodes:[]};switch(i){case"accessibility id":return{kind:"matched",nodes:Pc(e,n)};case"id":return{kind:"matched",nodes:zc(e,n)};case"class name":return{kind:"matched",nodes:Ds(e,n)};case"name":return{kind:"matched",nodes:Fc(e,n)};case"xpath":return Wc(e,n);case"-ios class chain":return Hc(e,n);case"-ios predicate string":return Vc(e,n);default:return{kind:"unsupported",nodes:[],reason:`Strategy "${s}" not yet supported by snapshot matcher`}}}function vn(e,s){const n=e.toLowerCase();if(n==="accessibility id")return/[0-9a-f]{8}-[0-9a-f]{4}/i.test(s)?{level:"fragile",reason:"UUID in accessibility ID — dynamically generated, unreliable"}:{level:"stable",reason:"#1 recommended by Appium — portable across Android & iOS"};if(n==="id")return/[0-9a-f]{8}-[0-9a-f]{4}/i.test(s)?{level:"fragile",reason:"UUID in resource ID — dynamically generated"}:/\d{6,}/.test(s)&&!s.includes(":id/")?{level:"moderate",reason:"Long numeric ID without package prefix — may not be unique"}:/^[a-z][a-z0-9.]+:id\//.test(s)?{level:"stable",reason:"Android resource-id with package prefix — #2 by Appium priority"}:{level:"stable",reason:"Element ID — #2 by Appium 2.x recommended priority"};if(n==="xpath"){if(s.startsWith("/hierarchy")||s.startsWith("/")&&!s.startsWith("//"))return{level:"very-fragile",reason:"ABSOLUTE XPath — breaks on any layout change. Avoid entirely"};if(/\[\d+\]/.test(s))return{level:"very-fragile",reason:"Index-based XPath [n] — breaks when element order changes"};const i=(s.match(/\//g)||[]).length;return i>7?{level:"fragile",reason:`${i}-level deep XPath — brittle to layout changes, 10x slower on iOS`}:s.includes("@content-desc")||s.includes("@resource-id")||s.includes("@text")?{level:"moderate",reason:"XPath with semantic attribute — more stable, but still prefer ID/accessibility id"}:{level:"fragile",reason:"XPath is a LAST RESORT per Appium docs — 10x slower on iOS, breaks on UI changes"}}return n==="-ios predicate string"?{level:"stable",reason:"iOS NSPredicate — native engine, excellent performance on iOS"}:n==="-ios class chain"?{level:"stable",reason:"iOS Class Chain — native iOS, faster than XPath"}:n==="-android uiautomator"?s.includes("resourceId")||s.includes("description")?{level:"stable",reason:"UIAutomator2 with resourceId/description — Android native, very reliable"}:s.includes("textContains")||s.includes("text(")?{level:"moderate",reason:"UIAutomator2 with text matching — breaks if copy changes"}:{level:"stable",reason:"UIAutomator2 — Android native engine, preferred over XPath on Android"}:n==="class name"?{level:"fragile",reason:"Class name alone is almost never unique — use with explicit index or prefer accessibility id"}:n==="name"?{level:"fragile",reason:"⚠️ Deprecated in Appium 2.x — replace with accessibility id or id"}:n==="link text"?{level:"moderate",reason:"Text-based locator — breaks if copy/label changes"}:{level:"moderate",reason:"Verify reliability for your target platform"}}function bn(e,s,n,i){var N,w,b,$,R,I,E;const{strategy:r,value:a}=i,c=(e.text||e.name||((N=e.type)==null?void 0:N.split(".").pop())||"element").replace(/[^a-zA-Z0-9]/g,"_").replace(/^_+/,"").slice(0,24)||"element",l=c.charAt(0).toLowerCase()+c.slice(1),o=((w=e.type)==null?void 0:w.toLowerCase().includes("edit"))||((b=e.type)==null?void 0:b.toLowerCase().includes("input"))||(($=e.type)==null?void 0:$.toLowerCase().includes("field"))||((R=e.type)==null?void 0:R.toLowerCase().includes("textfield")),u=((I=e.attributes)==null?void 0:I.scrollable)==="true"||((E=e.attributes)==null?void 0:E.scrollable)===!0,m=r.toLowerCase().startsWith("-ios")&&s!=="ios"?`// ⚠️ -ios predicate/class chain ONLY work with XCUITest (iOS)
203
+ `:r.toLowerCase().startsWith("-android")&&s!=="android"?`// ⚠️ -android uiautomator ONLY works with UIAutomator2 (Android)
204
+ `:"",h={"accessibility id":`~${a}`,id:s==="ios"?`-ios predicate string:label == "${a}"`:`android=new UiSelector().resourceId("${a}")`,xpath:`${a}`,"-ios predicate string":`-ios predicate string:${a}`,"-ios class chain":`-ios class chain:${a}`,"-android uiautomator":`android=${a}`},p={"accessibility id":`AppiumBy.accessibilityId("${a}")`,id:`AppiumBy.id("${a}")`,xpath:`AppiumBy.xpath("${a}")`,"-ios predicate string":`AppiumBy.iOSNsPredicateString("${a}")`,"-ios class chain":`AppiumBy.iOSClassChain("${a}")`,"-android uiautomator":`AppiumBy.androidUIAutomator("${a}")`,"class name":`AppiumBy.className("${a}")`},x={"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}"`},v=p[r.toLowerCase()],g=x[r.toLowerCase()],y=h[r.toLowerCase()];return n==="java"?v?`${m}// Appium Java Client 9.x + Selenium 4 + TestNG
205
+ import io.appium.java_client.AppiumBy;
206
+ import io.appium.java_client.${s==="android"?"AndroidDriver":s==="ios"?"IOSDriver":"AppiumDriver"};
207
+ import org.openqa.selenium.WebElement;
208
+ import org.testng.annotations.Test;
209
+
210
+ @Test
211
+ public void test_${l}() {
212
+ WebElement element = driver.findElement(${v});
213
+ ${u?'((Scrollable) element).scrollTo("target text");':o?`element.clear();
214
+ element.sendKeys("your text here");`:"element.click();"}
215
+ // Add assertions here via TestNG Assert or Hamcrest
216
+ }`:`// Strategy "${r}" not supported in Appium Java Client`:n==="python"?g?`${m}# Appium Python Client 4.x + pytest
217
+ from appium.webdriver.common.appiumby import AppiumBy
218
+ import pytest
219
+
220
+ def test_${l}(self):
221
+ element = self.driver.find_element(${g})
222
+ ${o?`element.clear()
223
+ element.send_keys("your text here")`:"element.click()"}
224
+ # Add assertions here via assert or pytest.assert`:`# Strategy "${r}" not supported in Appium Python Client`:n==="javascript"?y?`${m}// WebdriverIO 9.x + @wdio/appium-service
225
+ describe('${l} test', () => {
226
+ it('should interact with ${l}', async () => {
227
+ const element = await $('${y}');
228
+ await element.waitForDisplayed({ timeout: 5000 });
229
+ ${o?`await element.clearValue();
230
+ await element.addValue("your text here");`:"await element.click();"}
231
+ // Add assertions here via expect(element)
232
+ });
233
+ });`:`// Strategy "${r}" not supported in WebdriverIO mobile`:y?`${m}// WebdriverIO 9.x standalone
234
+ const element = await driver.$('${y}');
235
+ await element.waitForExist({ timeout: 5000 });
236
+ ${o?`await driver.$('target').clearValue();
237
+ await element.addValue("your text here");`:"await element.click();"}
238
+ // Assert with expect(element).toBeDisplayed()`:`// Strategy "${r}" not supported in WebdriverIO mobile`}function jn(e){var x,v,g,y,C,N,w,b,$,R,I;const s=(e.type||"").toLowerCase(),n=((x=e.attributes)==null?void 0:x.clickable)==="true"||((v=e.attributes)==null?void 0:v.clickable)===!0,i=((g=e.attributes)==null?void 0:g.enabled)!=="false"&&((y=e.attributes)==null?void 0:y.enabled)!==!1,r=((C=e.attributes)==null?void 0:C.scrollable)==="true"||((N=e.attributes)==null?void 0:N.scrollable)===!0,a=e.text||e.label||e.value||"",c=((w=e.children)==null?void 0:w.length)||0;let l="Element",o="📦";s.includes("button")||s.includes("btn")||n&&c===0?(l="Button",o="🔘"):s.includes("edit")||s.includes("input")||s.includes("field")?(l="Text Input",o="✏️"):s.includes("image")||s.includes("img")||s.includes("imageview")?(l="Image",o="🖼️"):s.includes("scroll")||s.includes("recyclerview")||s.includes("listview")||r?(l="Scrollable List",o="📜"):s.includes("text")||s.includes("label")?(l="Text Label",o="📝"):s.includes("switch")||s.includes("toggle")||s.includes("checkbox")?(l="Toggle / Checkbox",o="☑️"):s.includes("nav")||s.includes("toolbar")||s.includes("tabbar")?(l="Navigation Bar",o="🧭"):c>0&&(l=`Container (${c} children)`,o="🗂️");const u=((b=e.suggestedLocators)==null?void 0:b.find(E=>E.strategy==="accessibility id"||E.strategy==="id"))||(($=e.suggestedLocators)==null?void 0:$[0]),m=i?((R=e.rect)==null?void 0:R.width)===0||((I=e.rect)==null?void 0:I.height)===0?"⚠️ Zero-size element — may not be interactable":void 0:"⚠️ Element is disabled",h=a?` with text "${a.slice(0,30)}"`:"",p=`This is a ${l.toLowerCase()}${h}. ${n?"It can be tapped/clicked.":r?"It supports scrolling.":"It is a visual container."}${c>0?` Contains ${c} child element${c>1?"s":""}.`:""}`;return{role:l,description:p,interactable:n||i,bestLocator:u,warning:m,emoji:o}}function wn(e,s){if(!s)return!0;const n=s.toLowerCase().trim(),i={button:["button","btn","clickable","tapable"],input:["edittext","input","field","textfield","textinput","edit"],image:["image","imageview","img","picture","photo","icon"],text:["textview","label","text","statictext"],list:["listview","recyclerview","scrollview","tableview","collectionview","scroll"],toggle:["switch","checkbox","toggle","radiobutton"],nav:["toolbar","navigationbar","tabbar","actionbar","navbar"]},r=(e.type||"").toLowerCase(),a=(e.text||e.label||e.value||"").toLowerCase(),c=(e.name||"").toLowerCase(),l=Object.values(e.attributes||{}).join(" ").toLowerCase();for(const[o,u]of Object.entries(i))if(n.includes(o)&&u.some(m=>r.includes(m)))return!0;return r.includes(n)||a.includes(n)||c.includes(n)||l.includes(n)}const Xc=({sessionId:e,udid:s,streamUrl:n,embedded:i=!1,overlayTarget:r=null,onModeChange:a})=>{var wt,Ze,Nt,Lt,_t,Ot,Pt,zt,Ft,Bt;const[c,l]=d.useState(!0),[o,u]=d.useState(null),[m,h]=d.useState(null),[p,x]=d.useState(null),[v,g]=d.useState(null),[y,C]=d.useState(new Set(["/"])),[N,w]=d.useState(""),[b,$]=d.useState(null),[R,I]=d.useState("info"),[E,q]=d.useState("java"),[O,F]=d.useState(null),[W,Y]=d.useState({width:0,height:0}),[z,J]=d.useState({width:0,height:0}),[P,L]=d.useState(!1),[k,K]=d.useState("inspect");d.useEffect(()=>{a==null||a(k)},[k,a]);const[re,fe]=d.useState({}),[We,Re]=d.useState({}),[he,Le]=d.useState(null),[S,B]=d.useState(null),[Z,ce]=d.useState(null),de=d.useRef(null),$e=d.useRef(null),_e=d.useRef(null),xe=d.useRef(null),Ee=d.useCallback(()=>{var me,pe,ve;if(!de.current)return;const f=de.current.getBoundingClientRect(),A=f.width,M=f.height,T=(me=o==null?void 0:o.hierarchy)==null?void 0:me.rect;let H=((pe=o==null?void 0:o.metadata)==null?void 0:pe.screenWidth)||W.width||1,_=((ve=o==null?void 0:o.metadata)==null?void 0:ve.screenHeight)||W.height||1;T&&T.width>0&&T.height>0&&(H=T.width,_=T.height);const G=H/_;let ne,Q;A/M>G?(Q=M,ne=Q*G):(ne=A,Q=ne/G),J({width:ne,height:Q})},[o,W]);d.useEffect(()=>(Ee(),window.addEventListener("resize",Ee),()=>window.removeEventListener("resize",Ee)),[Ee]),d.useEffect(()=>{s&&Te()},[s]),d.useEffect(()=>{if(!s)return;let f=!1;return V.getAppiumSession(s).then(A=>{f||B({sessionId:(A==null?void 0:A.sessionId)??null,basePath:(A==null?void 0:A.basePath)??""})}).catch(()=>{f||B({sessionId:null,basePath:""})}),()=>{f=!0}},[s]);const ge=d.useCallback(async(f,A,M)=>{if(S!=null&&S.sessionId){Le(f);try{const T=await V.verifyLocator(S.basePath,S.sessionId,{strategy:f,selector:A,action:M});Re(H=>({...H,[f]:T}))}catch(T){Re(H=>({...H,[f]:{found:!1,count:0,error:(T==null?void 0:T.message)||String(T)}}))}finally{Le(null)}}},[S]);d.useEffect(()=>{var f;if((f=p==null?void 0:p.suggestedLocators)!=null&&f.length){const A=p.suggestedLocators.find(M=>M.strategy==="accessibility id"||M.strategy==="id")||p.suggestedLocators[0];F(A)}else F(null);fe({}),Re({}),ce(null)},[p]);const et=d.useCallback((f,A)=>{if(!(o!=null&&o.hierarchy))return;const M=qc(o.hierarchy,f,A);fe(T=>({...T,[f]:M})),ce(f)},[o]),Te=async()=>{if(s){l(!0),h(null);try{const f=await V.getInspectorSnapshot(s);if(!(f!=null&&f.hierarchy)){u(null),h((f==null?void 0:f.error)||"Failed to capture snapshot");return}u(f);const A=new Set(["/"]),M=(T,H)=>{var _;H<3&&(A.add(T.xpath),(_=T.children)==null||_.forEach(G=>M(G,H+1)))};M(f.hierarchy,0),C(A)}catch(f){u(null),h(f.message||"Failed to capture snapshot")}finally{l(!1)}}},tt=f=>{const{naturalWidth:A,naturalHeight:M}=f.currentTarget;Y({width:A,height:M})},ye=()=>L(!0),ht=f=>{L(!1);const{naturalWidth:A,naturalHeight:M}=f.currentTarget;A>0&&M>0&&Y({width:A,height:M})},st=n&&!P,pt=f=>{if(k!=="interact"||!s)return;const A=f.currentTarget.getBoundingClientRect();xe.current={x:f.clientX-A.left,y:f.clientY-A.top,time:Date.now()}},xt=async f=>{var ee,ae,te;if(k!=="interact"||!s||!xe.current)return;const A=xe.current,M=f.currentTarget.getBoundingClientRect(),T=f.clientX-M.left,H=f.clientY-M.top,_=Date.now()-A.time,G=z.width,ne=z.height,Q=(ee=o==null?void 0:o.hierarchy)==null?void 0:ee.rect;let me=((ae=o==null?void 0:o.metadata)==null?void 0:ae.screenWidth)||W.width,pe=((te=o==null?void 0:o.metadata)==null?void 0:te.screenHeight)||W.height;if(Q&&Q.width>0&&Q.height>0&&(me=Q.width,pe=Q.height),!me||!pe||G===0||ne===0)return;const ve=(oe,se)=>({x:Math.round(oe/G*me),y:Math.round(se/ne*pe),px:oe/G,py:se/ne}),j=ve(A.x,A.y),D=ve(T,H),U=Math.sqrt(Math.pow(T-A.x,2)+Math.pow(H-A.y,2));if(!(j.px<0||j.px>1||j.py<0||j.py>1)){try{_<500&&U<10?await V.tap(s,j.x,j.y):_>=500&&U<10?await V.touchAndHold(s,j.x,j.y,_):U>=10&&await V.swipe(s,j.x,j.y,D.x,D.y)}catch(oe){console.error("Interaction failed:",oe)}xe.current=null}},Tt=f=>{const A=new Set(y);A.has(f)?A.delete(f):A.add(f),C(A)},Dt=()=>{const f=new Set,A=M=>{var T;f.add(M.xpath),(T=M.children)==null||T.forEach(A)};o!=null&&o.hierarchy&&A(o.hierarchy),C(f)},ds=()=>C(new Set(["/"])),gt=(f,A)=>{navigator.clipboard.writeText(f),$(A),setTimeout(()=>$(null),2e3)},Ge=f=>{var M;let A=1;return(M=f.children)==null||M.forEach(T=>A+=Ge(T)),A},Ne=f=>{if(!f)return[];const A={},M=T=>{var G;const H=jn(T),_=H.role.replace(/\s*\(.*?\)\s*/,"");A[_]||(A[_]={emoji:H.emoji,count:0}),A[_].count+=1,(G=T.children)==null||G.forEach(M)};return M(f),Object.entries(A).map(([T,H])=>({role:T,emoji:H.emoji,count:H.count})).sort((T,H)=>H.count-T.count)},yt=f=>f.xpath.split("/").filter(Boolean).slice(-3),vt=(f,A=0)=>{var ve,j,D,U;if(!f)return null;const M=y.has(f.xpath),T=((ve=f.children)==null?void 0:ve.length)>0,H=(p==null?void 0:p.xpath)===f.xpath,_=(v==null?void 0:v.xpath)===f.xpath,G=((j=f.type)==null?void 0:j.split(".").pop())||"Element",ne=f.label||((D=f.attributes)==null?void 0:D["content-desc"])||((U=f.attributes)==null?void 0:U["resource-id"])||f.name,Q=typeof ne=="string"&&ne&&ne!==G&&ne!==f.type?ne:null,me=Q||G,pe=!N||wn(f,N);if(!pe&&!T)return null;if(N&&!pe){const ee=ae=>{var te;return wn(ae,N)?!0:((te=ae.children)==null?void 0:te.some(ee))||!1};if(!ee(f))return null}return t.jsxs("div",{className:"tree-node",children:[t.jsxs("div",{className:`tree-item ${H?"selected":""} ${_&&!H?"hovered":""}`,onClick:()=>{x(f),I("info")},onMouseEnter:()=>g(f),onMouseLeave:()=>g(null),children:[t.jsx("div",{className:"tree-item-indent",style:{width:`${A*14}px`}}),T?t.jsx("button",{onClick:ee=>{ee.stopPropagation(),Tt(f.xpath)},className:"tree-toggle",children:M?t.jsx(Dn,{size:11}):t.jsx(_n,{size:11})}):t.jsx("span",{className:"tree-toggle-spacer"}),t.jsx(rr,{size:11,className:"tree-icon"}),t.jsx("span",{className:"tree-label",title:`${G}${Q?` — ${Q}`:""}`,children:me}),Q&&t.jsx("span",{className:"tree-type-tag",title:G,children:G}),f.text&&t.jsxs("span",{className:"tree-text-preview",children:['"',f.text.slice(0,20),'"']}),T&&t.jsx("span",{className:"tree-badge",children:f.children.length})]}),M&&T&&t.jsx("div",{className:"tree-children",children:f.children.map(ee=>vt(ee,A+1))})]},f.xpath)},Ye=()=>{var T,H,_;const f=(T=o==null?void 0:o.hierarchy)==null?void 0:T.rect;if(f&&f.width>0&&f.height>0)return{w:f.width,h:f.height};const A=((H=o==null?void 0:o.metadata)==null?void 0:H.screenWidth)||W.width,M=((_=o==null?void 0:o.metadata)==null?void 0:_.screenHeight)||W.height;return A>0&&M>0?{w:A,h:M}:null},bt=f=>{const A=Ye();if(!A)return[];const M=[],{w:T,h:H}=A,_=(G,ne)=>{var me,pe,ve;const Q=!G.children||G.children.length===0;((me=G.rect)==null?void 0:me.width)>0&&((pe=G.rect)==null?void 0:pe.height)>0&&Q&&M.push(t.jsx("div",{className:"omni-hit-area",style:{left:`${G.rect.x/T*100}%`,top:`${G.rect.y/H*100}%`,width:`${G.rect.width/T*100}%`,height:`${G.rect.height/H*100}%`,zIndex:ne},onClick:j=>{j.stopPropagation(),x(G),I("info")},onMouseEnter:()=>g(G),onMouseLeave:()=>g(null)},G.xpath)),(ve=G.children)==null||ve.forEach(j=>_(j,ne+1))};return o!=null&&o.hierarchy&&_(o.hierarchy,1),M},jt=()=>{var _,G,ne;if(!Z||!W.width)return[];const f=re[Z];if(!f||f.kind!=="matched"||f.nodes.length===0)return[];const A=(_=o==null?void 0:o.hierarchy)==null?void 0:_.rect;let M=((G=o==null?void 0:o.metadata)==null?void 0:G.screenWidth)||W.width,T=((ne=o==null?void 0:o.metadata)==null?void 0:ne.screenHeight)||W.height;A&&A.width>0&&A.height>0&&(M=A.width,T=A.height);const H=f.nodes.length===1?"omni-frame-match unique":"omni-frame-match multi";return f.nodes.filter(Q=>Q.rect&&Q.rect.width>0&&Q.rect.height>0).map((Q,me)=>t.jsx("div",{className:H,style:{left:`${Q.rect.x/M*100}%`,top:`${Q.rect.y/T*100}%`,width:`${Q.rect.width/M*100}%`,height:`${Q.rect.height/T*100}%`}},`match-${Z}-${me}`))},we=(f,A)=>{const M=Ye();if(!(f!=null&&f.rect)||!M)return null;const{w:T,h:H}=M;return t.jsx("div",{className:`omni-frame-${A}`,style:{left:`${f.rect.x/T*100}%`,top:`${f.rect.y/H*100}%`,width:`${f.rect.width/T*100}%`,height:`${f.rect.height/H*100}%`}})},Ce=o!=null&&o.hierarchy?Ge(o.hierarchy):0,ue=p?jn(p):null,He=o!=null&&o.hierarchy&&k==="inspect"?t.jsxs("div",{className:"omni-overlay",children:[bt(o.hierarchy),jt(),we(v,"hover"),we(p,"select")]}):null,It={stable:{icon:t.jsx(Wt,{size:10}),cls:"stable"},moderate:{icon:t.jsx(at,{size:10}),cls:"moderate"},fragile:{icon:t.jsx(it,{size:10}),cls:"fragile"},"very-fragile":{icon:t.jsx(it,{size:10}),cls:"very-fragile"}},Mt=i&&(o!=null&&o.hierarchy)?Ne(o.hierarchy):[];return t.jsxs("div",{className:`omni-inspector-container ${i?"omni-embedded":""}`,children:[i&&r&&He?En.createPortal(He,r):null,t.jsxs("div",{className:"omni-main-content",children:[!i&&t.jsxs("div",{className:"omni-screenshot-panel",children:[t.jsxs("div",{className:"omni-screenshot-header",children:[t.jsxs("div",{className:"omni-header-left",children:[t.jsx("span",{className:"omni-screenshot-title",children:"Device Preview"}),t.jsxs("div",{className:"omni-mode-toggle",children:[t.jsxs("button",{className:`omni-mode-btn ${k==="inspect"?"active":""}`,onClick:()=>K("inspect"),title:"Inspection mode (highlight elements)",children:[t.jsx(nn,{size:12}),t.jsx("span",{children:"Inspect"})]}),t.jsxs("button",{className:`omni-mode-btn ${k==="interact"?"active":""}`,onClick:()=>K("interact"),title:"Interaction mode (direct control)",children:[t.jsx(an,{size:12}),t.jsx("span",{children:"Interact"})]})]})]}),t.jsxs("button",{className:"omni-refresh-btn",onClick:Te,disabled:c,children:[t.jsx(St,{size:12,className:c?"animate-spin":""}),c?"Capturing...":"Refresh"]})]}),t.jsxs("div",{className:"omni-screenshot-container",ref:de,children:[c&&!st&&t.jsxs("div",{className:"omni-loading-overlay",children:[t.jsx("div",{className:"omni-spinner"}),t.jsx("span",{children:"Capturing screen..."})]}),!o&&!c&&!st&&t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(ps,{size:40}),t.jsx("span",{children:"Click Refresh to capture"})]}),st&&t.jsxs("div",{className:`omni-screenshot-wrapper ${k==="interact"?"interactable":""}`,onMouseDown:pt,onMouseUp:xt,children:[t.jsx("img",{ref:_e,src:n,onLoad:ht,onError:ye,className:"omni-screenshot-img",style:k==="interact"?{pointerEvents:"none"}:{},draggable:!1,alt:"Live Device Stream"}),He]}),!st&&(o==null?void 0:o.screenshot)&&t.jsxs("div",{className:`omni-screenshot-wrapper ${k==="interact"?"interactable":""}`,onMouseDown:pt,onMouseUp:xt,children:[t.jsx("img",{ref:$e,src:`data:image/png;base64,${o.screenshot}`,onLoad:tt,className:"omni-screenshot-img",style:k==="interact"?{pointerEvents:"none"}:{},draggable:!1}),k==="inspect"&&t.jsxs("div",{className:"omni-overlay",children:[bt(o.hierarchy),jt(),we(v,"hover"),we(p,"select")]})]})]})]}),t.jsxs("div",{className:"omni-tree-panel",children:[t.jsxs("div",{className:"omni-tree-header",children:[t.jsxs("div",{className:"omni-tree-title",children:[t.jsx(Fi,{size:14}),t.jsx("span",{children:"Source"}),Ce>0&&t.jsxs("span",{className:"omni-count-badge",children:[Ce," elements"]}),(o==null?void 0:o.hierarchySource)&&t.jsx("span",{className:`omni-source-badge ${o.hierarchySource==="appium-session"?"is-session":"is-device"}`,title:o.hierarchySource==="appium-session"?`From Appium session ${o.sessionId} — the same tree the driver resolves locators against`:"Read from the device. No Appium session is driving it.",children:o.hierarchySource==="appium-session"?"Session":"Device"})]}),t.jsxs("div",{className:"omni-tree-actions",children:[t.jsx("button",{onClick:Dt,className:"omni-action-btn",title:"Expand all",children:t.jsx(wr,{size:12})}),t.jsx("button",{onClick:ds,className:"omni-action-btn",title:"Collapse all",children:t.jsx(Pr,{size:12})}),i&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>K(k==="inspect"?"interact":"inspect"),className:`omni-action-btn ${k==="inspect"?"active":""}`,title:k==="inspect"?"Inspect mode — click the device to select an element":"Interact mode — clicks control the device","aria-pressed":k==="inspect",children:k==="inspect"?t.jsx(nn,{size:12}):t.jsx(an,{size:12})}),t.jsx("button",{onClick:Te,className:"omni-action-btn",title:c?"Capturing…":"Refresh snapshot",disabled:c,children:t.jsx(St,{size:12,className:c?"animate-spin":""})})]})]})]}),m&&!c&&t.jsxs("div",{className:"omni-tree-error",role:"alert",children:[t.jsx(it,{size:12}),t.jsx("span",{children:m}),t.jsx("button",{type:"button",onClick:Te,className:"omni-tree-error-retry",children:"Retry"})]}),t.jsxs("div",{className:"omni-tree-search",children:[t.jsx(Tn,{size:14}),t.jsx("input",{type:"text",placeholder:"Search elements... (try 'login button' or 'text field')",value:N,onChange:f=>w(f.target.value),"aria-label":"Search elements"}),N&&t.jsx("button",{onClick:()=>w(""),className:"omni-clear-btn",children:"×"})]}),N&&t.jsxs("div",{className:"omni-search-hint",children:[t.jsx(As,{size:10}),' Smart search active — try "button", "input", "image"']}),t.jsx("div",{className:"omni-tree-content",children:o!=null&&o.hierarchy?vt(o.hierarchy):t.jsx("div",{className:"omni-empty-state small",children:t.jsx("span",{children:"No hierarchy loaded"})})})]}),t.jsxs("div",{className:"omni-details-panel",children:[t.jsxs("div",{className:"omni-details-tabs",role:"tablist",children:[t.jsxs("button",{className:`omni-details-tab ${R==="info"?"active":""}`,onClick:()=>I("info"),role:"tab","aria-selected":R==="info",children:[t.jsx(Rr,{size:12})," ",t.jsx("span",{children:"Info"})]}),t.jsxs("button",{className:`omni-details-tab ${R==="insight"?"active":""}`,onClick:()=>I("insight"),disabled:!p,title:"AI element analysis",role:"tab","aria-selected":R==="insight",children:[t.jsx(Cr,{size:12})," ",t.jsx("span",{children:"AI Insight"})]}),t.jsxs("button",{className:`omni-details-tab ${R==="code"?"active":""}`,onClick:()=>I("code"),disabled:!p,title:"Generate test code",role:"tab","aria-selected":R==="code",children:[t.jsx(rn,{size:12})," ",t.jsx("span",{children:"Code Gen"})]})]}),t.jsx("div",{className:"omni-details-content",children:p?t.jsxs(t.Fragment,{children:[R==="info"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Element Info"}),t.jsxs("div",{className:"omni-info-table",children:[t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Type"}),t.jsx("span",{className:"omni-info-value mono",children:p.type})]}),p.text&&t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Text"}),t.jsx("span",{className:"omni-info-value",children:p.text})]}),t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Path"}),t.jsx("span",{className:"omni-info-value mono small",children:yt(p).join(" › ")})]})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Layout"}),t.jsx("div",{className:"omni-layout-grid",children:["x","y","width","height"].map(f=>t.jsxs("div",{className:"omni-layout-item",children:[t.jsx("span",{className:"omni-layout-label",children:f.toUpperCase()}),t.jsx("span",{className:"omni-layout-value",children:p.rect[f]})]},f))})]}),t.jsxs("div",{className:"omni-section",children:[t.jsxs("div",{className:"omni-section-header",children:["Locators",t.jsx("span",{className:"omni-section-badge",children:"Stability Scored"})]}),t.jsxs("div",{className:"omni-locators-list",children:[!((Nt=p.suggestedLocators)!=null&&Nt.length)&&t.jsx("div",{className:"omni-locators-empty",children:p===(o==null?void 0:o.hierarchy)?"This is the XML document root, not a UI element — no Appium locator can select it. Pick a node beneath it.":"No locator could be derived for this node."}),(Lt=p.suggestedLocators)==null?void 0:Lt.map(f=>{const A=vn(f.strategy,f.value),M=It[A.level],T=re[f.strategy];let H=null;return T&&(T.kind==="unsupported"?H=t.jsxs("span",{className:"omni-match-badge unsupported",title:T.reason||"Cannot evaluate without a real driver",children:[t.jsx(fr,{size:10})," preview unavailable"]}):T.nodes.length===0?H=t.jsxs("span",{className:"omni-match-badge zero",title:"No element matches this selector in the current snapshot",children:[t.jsx(it,{size:10})," 0 matches"]}):T.nodes.length===1?H=t.jsxs("span",{className:"omni-match-badge unique",title:"Selector is unique in the current snapshot",children:[t.jsx(Wt,{size:10})," unique"]}):H=t.jsxs("span",{className:"omni-match-badge multi",title:`${T.nodes.length} elements match — selector is not unique`,children:[t.jsx(at,{size:10})," ",T.nodes.length," matches"]})),t.jsxs("div",{className:`omni-locator-row ${(O==null?void 0:O.strategy)===f.strategy?"selected-for-code":""}`,onClick:()=>F(f),title:"Click to use in Code Generator",children:[t.jsxs("div",{className:"omni-locator-left",children:[t.jsxs("div",{className:"omni-locator-top",children:[t.jsx("span",{className:"omni-locator-strategy",children:f.strategy}),t.jsxs("span",{className:`omni-stability-badge ${M.cls}`,title:A.reason,children:[M.icon,A.level]}),H]}),t.jsx("code",{className:"omni-locator-value",children:f.value}),t.jsx("span",{className:"omni-stability-reason",children:A.reason}),(()=>{const _=We[f.strategy];return _?_.error?t.jsxs("span",{className:"omni-verify-line is-error",children:[t.jsx(it,{size:10})," Appium error: ",_.error]}):_.found?_.count>1?t.jsxs("span",{className:"omni-verify-line is-warn",children:[t.jsx(at,{size:10})," Ambiguous — Appium found"," ",_.count," elements",_.actionError?` · ${_.actionError}`:""]}):t.jsxs("span",{className:"omni-verify-line is-ok",children:[t.jsx(Wt,{size:10})," Appium found 1 element",_.elapsedMs!=null?` in ${_.elapsedMs}ms`:"",_.actionPerformed&&_.actionPerformed!=="none"?` · ${_.actionPerformed} ok`:"",_.actionError?` · action failed: ${_.actionError}`:""]}):t.jsxs("span",{className:"omni-verify-line is-error",children:[t.jsx(it,{size:10})," Appium found 0 elements"]}):null})()]}),t.jsxs("div",{className:"omni-locator-actions",children:[t.jsx("button",{type:"button",onClick:_=>{_.stopPropagation(),et(f.strategy,f.value)},className:`omni-test-btn ${Z===f.strategy?"active":""}`,title:"Test this locator against the current snapshot",children:t.jsx(yr,{size:12})}),t.jsx("button",{type:"button",disabled:!(S!=null&&S.sessionId)||he===f.strategy,onClick:_=>{_.stopPropagation(),ge(f.strategy,f.value,"none")},className:"omni-test-btn",title:S!=null&&S.sessionId?"Verify with Appium — does the driver actually find this?":"Needs an active Appium session on this device",children:he===f.strategy?t.jsx(St,{size:12,className:"animate-spin"}):t.jsx(Wt,{size:12})}),t.jsx("button",{type:"button",disabled:!(S!=null&&S.sessionId)||he===f.strategy,onClick:_=>{_.stopPropagation(),ge(f.strategy,f.value,"tap")},className:"omni-test-btn",title:S!=null&&S.sessionId?"Find with Appium and tap the element it returns":"Needs an active Appium session on this device",children:t.jsx(ks,{size:12})}),t.jsx("button",{onClick:_=>{_.stopPropagation(),gt(f.value,f.strategy)},className:`omni-copy-btn ${b===f.strategy?"copied":""}`,children:b===f.strategy?t.jsx(ct,{size:12}):t.jsx(qe,{size:12})})]})]},f.strategy)})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Attributes"}),t.jsx("div",{className:"omni-attributes-table",children:Object.entries(p.attributes||{}).filter(([f,A])=>A!=null&&A!=="").map(([f,A])=>t.jsxs("div",{className:"omni-attr-row",children:[t.jsx("span",{className:"omni-attr-key",children:f}),t.jsx("span",{className:"omni-attr-value",children:String(A)})]},f))})]})]}),R==="insight"&&ue&&t.jsxs("div",{className:"omni-insight-panel",children:[t.jsxs("div",{className:"omni-insight-role",children:[t.jsx("span",{className:"omni-insight-emoji",children:ue.emoji}),t.jsxs("div",{children:[t.jsx("div",{className:"omni-insight-role-name",children:ue.role}),t.jsx("div",{className:"omni-insight-interactable",children:ue.interactable?t.jsxs("span",{className:"omni-badge-green",children:[t.jsx(ks,{size:10})," Interactable"]}):t.jsx("span",{className:"omni-badge-gray",children:"Visual Only"})})]})]}),ue.warning&&t.jsx("div",{className:"omni-insight-warning",children:ue.warning}),t.jsxs("div",{className:"omni-insight-description",children:[t.jsx(As,{size:12,className:"omni-insight-icon"}),t.jsx("p",{children:ue.description})]}),ue.bestLocator&&t.jsxs("div",{className:"omni-insight-best-locator",children:[t.jsx("div",{className:"omni-section-header",children:"Recommended Locator"}),t.jsxs("div",{className:"omni-locator-row",children:[t.jsxs("div",{className:"omni-locator-left",children:[t.jsx("span",{className:"omni-locator-strategy",children:ue.bestLocator.strategy}),t.jsx("code",{className:"omni-locator-value",children:ue.bestLocator.value})]}),t.jsx("button",{onClick:()=>gt(ue.bestLocator.value,"best"),className:`omni-copy-btn ${b==="best"?"copied":""}`,children:b==="best"?t.jsx(ct,{size:12}):t.jsx(qe,{size:12})})]})]}),t.jsxs("div",{className:"omni-insight-attributes",children:[t.jsx("div",{className:"omni-section-header",children:"Quick Facts"}),t.jsx("div",{className:"omni-quick-facts",children:[{label:"Clickable",value:(_t=p.attributes)==null?void 0:_t.clickable},{label:"Enabled",value:(Ot=p.attributes)==null?void 0:Ot.enabled},{label:"Scrollable",value:(Pt=p.attributes)==null?void 0:Pt.scrollable},{label:"Focusable",value:(zt=p.attributes)==null?void 0:zt.focusable},{label:"Children",value:((Ft=p.children)==null?void 0:Ft.length)||0}].map(({label:f,value:A})=>t.jsxs("div",{className:"omni-quick-fact-row",children:[t.jsx("span",{className:"omni-quick-fact-label",children:f}),t.jsx("span",{className:`omni-quick-fact-value ${A==="true"||A===!0?"true":""}`,children:String(A??"—")})]},f))})]})]}),R==="code"&&t.jsxs("div",{className:"omni-codegen-panel",children:[t.jsx("div",{className:"omni-codegen-frameworks",children:["java","python","javascript","wdio"].map(f=>t.jsx("button",{className:`omni-fw-btn ${E===f?"active":""}`,onClick:()=>q(f),children:f==="java"?"☕ Java":f==="python"?"🐍 Python":f==="javascript"?"🟨 JS":"🔷 WD.io"},f))}),O?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"omni-codegen-locator-selector",children:[t.jsx("span",{className:"omni-codegen-label",children:"Locator:"}),t.jsx(rs,{selectSize:"sm",value:O.strategy,onChange:f=>{var M;const A=(M=p.suggestedLocators)==null?void 0:M.find(T=>T.strategy===f.target.value);A&&F(A)},className:"flex-1",children:(Bt=p.suggestedLocators)==null?void 0:Bt.map(f=>t.jsxs("option",{value:f.strategy,children:[f.strategy," — ",vn(f.strategy,f.value).level]},f.strategy))})]}),t.jsxs("div",{className:"omni-codegen-output",children:[t.jsxs("div",{className:"omni-codegen-header",children:[t.jsx("span",{className:"omni-codegen-lang",children:E==="java"?"Java / TestNG":E==="python"?"Python / unittest":E==="javascript"?"JavaScript / Mocha":"WebdriverIO"}),t.jsx("button",{className:"omni-copy-btn",onClick:()=>gt(bn(p,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",E,O),"code"),children:b==="code"?t.jsx(ct,{size:12}):t.jsx(qe,{size:12})})]}),t.jsx("pre",{className:"omni-codegen-pre theme-dark",children:t.jsx("code",{children:bn(p,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",E,O)})})]})]}):t.jsxs("div",{className:"omni-empty-state small",children:[t.jsx(rn,{size:24}),t.jsx("span",{children:"No locators available for this element"})]})]})]}):o!=null&&o.hierarchy?t.jsxs("div",{className:"omni-summary-panel",children:[t.jsxs("div",{className:"omni-summary-hero",children:[t.jsx(ps,{size:28}),t.jsxs("div",{children:[t.jsx("div",{className:"omni-summary-title",children:"No element selected"}),t.jsx("div",{className:"omni-summary-subtitle",children:"Click any node in the tree (or use Inspect mode on the device) to drill in."})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Snapshot Stats"}),t.jsxs("div",{className:"omni-summary-stats",children:[t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Elements"}),t.jsx("span",{className:"omni-summary-stat__value",children:Ce})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Width"}),t.jsx("span",{className:"omni-summary-stat__value",children:((wt=o.metadata)==null?void 0:wt.screenWidth)??W.width??"—"})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Height"}),t.jsx("span",{className:"omni-summary-stat__value",children:((Ze=o.metadata)==null?void 0:Ze.screenHeight)??W.height??"—"})]}),t.jsxs("div",{className:"omni-summary-stat",children:[t.jsx("span",{className:"omni-summary-stat__label",children:"Platform"}),t.jsx("span",{className:"omni-summary-stat__value",children:o.platform||"—"})]})]})]}),Mt.length>0&&t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"By Role"}),t.jsx("div",{className:"omni-summary-roles",children:Mt.slice(0,8).map(f=>t.jsxs("div",{className:"omni-summary-role",children:[t.jsx("span",{className:"omni-summary-role__emoji",children:f.emoji}),t.jsx("span",{className:"omni-summary-role__name",children:f.role}),t.jsx("span",{className:"omni-summary-role__count",children:f.count})]},f.role))})]})]}):t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(ps,{size:32}),t.jsx("span",{children:c?"Capturing snapshot…":"Select an element from the tree or screenshot"})]})})]})]})]})},Nn=5e3;function Kc(e,s=!0){const[n,i]=d.useState("unknown"),r=d.useRef("unknown");return d.useEffect(()=>{if(!e||!s){i("unknown"),r.current="unknown";return}let a=!1,c;const l=m=>{a||m===r.current||(r.current=m,i(m))},o=async()=>{if(!a){if(c&&(clearTimeout(c),c=void 0),typeof document<"u"&&document.visibilityState==="hidden"){c=setTimeout(o,Nn);return}try{const m=await V.getDisplayState(e);l((m==null?void 0:m.state)??"unknown")}catch{}a||(c=setTimeout(o,Nn))}};o();const u=()=>{document.visibilityState==="visible"&&o()};return document.addEventListener("visibilitychange",u),()=>{a=!0,c&&clearTimeout(c),document.removeEventListener("visibilitychange",u)}},[e,s]),n}const Cn=5e3,Gc=500,Yc=1e4,Zc=10,Jc=50;function Qc(e,s,n){const i=`${((n==null?void 0:n.levels)??[]).join(",")}|${(n==null?void 0:n.process)??""}`,[r,a]=d.useState([]),[c,l]=d.useState(!1),[o,u]=d.useState(null),[m,h]=d.useState(!1),p=d.useRef(null),x=d.useRef(0),v=d.useRef(void 0),g=d.useRef(()=>{}),y=d.useRef([]),C=d.useRef(void 0),N=d.useRef(0),w=d.useRef(void 0),b=d.useCallback(()=>{if(y.current.length===0)return;const E=y.current;y.current=[],a(q=>{const O=q.concat(E);return O.length>Cn?O.slice(-Cn):O})},[]),$=d.useCallback(()=>{C.current===void 0&&(C.current=window.setTimeout(()=>{C.current=void 0,b()},Jc))},[b]),R=d.useCallback(()=>{y.current=[],a([])},[]);d.useEffect(()=>{if(!s){l(!1),u(null),h(!1);return}u(null),h(!1),x.current=0;const E={cancelled:!1},q=()=>{if(E.cancelled)return;if(x.current>=Zc){h(!0);return}const F=Math.min(Gc*2**x.current,Yc);x.current+=1,v.current=window.setTimeout(O,F)},O=async()=>{if(!E.cancelled)try{const F=await fetch(`/xenon/api/control/${encodeURIComponent(e)}/stream/ticket`,{method:"POST",credentials:"include"});if(E.cancelled)return;if(!F.ok){q();return}const{ticket:W}=await F.json();if(E.cancelled)return;if(!W){q();return}const Y=window.location.protocol==="https:"?"wss":"ws",[z,J]=i.split("|"),P=(z?`&levels=${encodeURIComponent(z)}`:"")+(J?`&process=${encodeURIComponent(J)}`:""),L=new WebSocket(`${Y}://${window.location.host}/xenon/api/control/${encodeURIComponent(e)}/logcat?ticket=${encodeURIComponent(W)}${P}`);p.current=L,L.onopen=()=>{x.current=0,w.current!==1012&&(y.current=[],a([])),w.current=void 0,l(!0)},L.onmessage=k=>{try{const K=JSON.parse(k.data);y.current.push({...K,seq:N.current++}),$()}catch{}},L.onclose=k=>{if(l(!1),w.current=k.code,b(),k.code===1008){E.cancelled=!0,u(k.reason||"access denied");return}if(k.code===1012){q();return}console.warn(`[logcat] WS closed unexpectedly (code ${k.code}) — retrying`),q()},L.onerror=()=>L.close()}catch{q()}};return g.current=()=>{E.cancelled=!1,x.current=0,u(null),h(!1),O()},O(),()=>{var F;E.cancelled=!0,v.current!==void 0&&window.clearTimeout(v.current),C.current!==void 0&&(window.clearTimeout(C.current),C.current=void 0),b(),(F=p.current)==null||F.close(),p.current=null}},[e,s,i,b,$]);const I=d.useCallback(()=>{g.current()},[]);return{records:r,connected:c,clear:R,deniedReason:o,exhausted:m,retry:I}}const Is=["V","D","I","W","E","F"];function el(e){const s=[];let n="",i=!1,r=!1;for(const a of e){if(a==='"'){i=!i,r=!0;continue}if(!i&&/\s/.test(a)){(r||n)&&s.push(n),n="",r=!1;continue}n+=a,r=!0}return(r||n)&&s.push(n),s.filter(a=>a.length>0)}function pi(e,s={}){const n=s.caseSensitive===!0,i=c=>n?c:c.toLowerCase(),r=n?{caseSensitive:!0}:{},a=[];for(const c of el(e)){const[l,...o]=c.split(":"),u=o.join(":");u&&l.toLowerCase()==="level"?r.minLevel=u.toUpperCase():u&&l.toLowerCase()==="tag"?r.tag=i(u):u&&l.toLowerCase()==="package"?r.pkg=i(u):a.push(c)}return a.length&&(r.text=i(a.join(" "))),r}function tl(e,s){if(e.synthetic)return!0;if(s.minLevel){const i=Is.indexOf(s.minLevel),r=Is.indexOf(e.level);if(i>=0&&r>=0&&r<i)return!1}const n=i=>s.caseSensitive?i:i.toLowerCase();return!(s.tag&&!n(e.tag).includes(s.tag)||s.pkg&&!n(e.pkg??"").includes(s.pkg)||s.text&&!n(e.message).includes(s.text))}function sl(e,s){const n=e.trim().split(/\s+/).filter(Boolean).filter(i=>{const[r,...a]=i.split(":");return!(a.join(":")&&r.toLowerCase()==="level")});return s?["level:"+s.toUpperCase(),...n].join(" "):n.join(" ")}const ws=[{ios:"Debug",android:"D"},{ios:"Info",android:"I"},{ios:"Default",android:"I"},{ios:"Error",android:"E"},{ios:"Fault",android:"F"}],Sn=["V","D","I","W","E","F"];function nl(e){if(!e)return ws.filter(n=>n.ios!=="Debug").map(n=>n.ios);const s=Sn.indexOf(e.toUpperCase());return s<0?ws.map(n=>n.ios):ws.filter(n=>Sn.indexOf(n.android)>=s).map(n=>n.ios)}function il(e){const s=pi(e,{caseSensitive:!0});return{levels:nl(s.minLevel),process:s.pkg||void 0}}const kn=["#7dd3fc","#c4b5fd","#5eead4","#f0abfc","#93c5fd","#a5b4fc","#67e8f9","#d8b4fe","#f9a8d4","#99f6e4","#bae6fd","#e9d5ff"];function rl(e){let s=2166136261;for(let n=0;n<e.length;n++)s^=e.charCodeAt(n),s=Math.imul(s,16777619)>>>0;return s>>>0}function al(e){return e?kn[rl(e)%kn.length]:"var(--text-muted)"}const Ms=5e5;function xi(e){return`${new Date(e.ts).toISOString()} ${e.pid} ${e.level}/${e.tag}: ${e.message}`}function ol(e){return{lines:[],startedAt:e,dropped:0}}function cl(e,s){for(const n of s){if(e.lines.length>=Ms){e.dropped+=1;continue}e.lines.push(xi(n))}return e}function ll(e,s,n){const i=["# Xenon logcat recording",`# device: ${n}`,`# started: ${new Date(e.startedAt).toISOString()}`,`# stopped: ${new Date(s).toISOString()}`,`# duration: ${((s-e.startedAt)/1e3).toFixed(1)}s`,`# lines: ${e.lines.length}`];e.dropped>0&&i.push(`# TRUNCATED: ${e.dropped} further line(s) were dropped after the ${Ms}-line cap. This capture is INCOMPLETE.`);const r=e.lines.join(`
239
+ `),a=e.dropped>0?`
240
+ # --- TRUNCATED: ${e.dropped} line(s) not captured (cap ${Ms}) ---`:"";return`${i.join(`
241
+ `)}
242
+
243
+ ${r}${a}
244
+ `}function dl(e,s){const n=new Date(s).toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");return`logcat-${e}-${n}.txt`}const An=Is.filter(e=>e!=="V").map(e=>({value:e,label:e==="F"?"F only":`${e} and above`})),ul=new Intl.DateTimeFormat([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function Rn(e,s){const n=URL.createObjectURL(new Blob([e],{type:"text/plain"})),i=document.createElement("a");i.href=n,i.download=s,i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i),setTimeout(()=>URL.revokeObjectURL(n),0)}const ml=d.memo(function({record:s,index:n,isHit:i,isActiveHit:r}){return t.jsxs("div",{"data-row-index":n,className:`logcat-row ${s.synthetic?"is-synthetic":""} ${i?"is-hit":""} ${r?"is-active-hit":""}`,children:[t.jsx("span",{className:"logcat-time",children:ul.format(s.ts)}),t.jsxs("span",{className:"logcat-pid",children:[s.pid,"-",s.tid]}),t.jsx("span",{className:"logcat-tag",title:s.tag,style:{color:al(s.tag)},children:s.tag}),t.jsx("span",{className:"logcat-pkg",title:s.pkg,children:s.pkg??""}),t.jsx("span",{className:`logcat-level lvl-${s.level}`,children:s.level}),t.jsx("span",{className:"logcat-msg",children:s.message})]})});function fl({udid:e,platform:s}){const n=(s||"").toLowerCase(),i=n==="ios",r=n==="android"||i,[a,c]=d.useState(""),l=d.useMemo(()=>i?il(a):void 0,[i,a]),{records:o,connected:u,clear:m,deniedReason:h,exhausted:p,retry:x}=Qc(e,r,l),[v,g]=d.useState(!0),[y,C]=d.useState(!1),[N,w]=d.useState(!0),[b,$]=d.useState(""),[R,I]=d.useState(0),E=d.useRef(null),q=d.useRef(null),O=d.useRef(null),[F,W]=d.useState(!1),[Y,z]=d.useState(0),J=d.useRef(-1),P=d.useMemo(()=>pi(a,{caseSensitive:y}),[a,y]),L=d.useMemo(()=>o.filter(B=>tl(B,P)),[o,P]),k=d.useMemo(()=>{if(!b)return[];const B=y?b:b.toLowerCase(),Z=[];return L.forEach((ce,de)=>{(y?`${ce.tag} ${ce.message}`:`${ce.tag} ${ce.message}`.toLowerCase()).includes(B)&&Z.push(de)}),Z},[L,b,y]),K=k.length?Math.min(R,k.length-1):0,re=d.useMemo(()=>new Set(k),[k]),fe=d.useCallback(B=>{var ce,de;if(!k.length)return;const Z=(K+B+k.length)%k.length;I(Z),g(!1),(de=(ce=q.current)==null?void 0:ce.querySelector(`[data-row-index="${k[Z]}"]`))==null||de.scrollIntoView({block:"center"})},[k,K]),We=An.some(B=>B.value===P.minLevel)?P.minLevel:"",Re=d.useCallback(()=>{Rn(L.map(xi).join(`
245
+ `),`logcat-${e}-${Date.now()}.txt`)},[L,e]);d.useEffect(()=>{const B=O.current;if(!B||!o.length)return;const Z=o.filter(de=>de.seq>J.current);if(!Z.length)return;const ce=J.current+1;J.current>=0&&Z[0].seq>ce&&(B.dropped+=Z[0].seq-ce),cl(B,Z),J.current=Z[Z.length-1].seq,z(B.lines.length)},[o]);const he=d.useCallback(()=>{const B=O.current;if(!B){J.current=o.length?o[o.length-1].seq:-1,O.current=ol(Date.now()),z(0),W(!0);return}const Z=ll(B,Date.now(),e);O.current=null,W(!1),z(0),Rn(Z,dl(e,B.startedAt))},[o,e]);if(d.useEffect(()=>{var B;v&&((B=E.current)==null||B.scrollIntoView({block:"end"}))},[L.length,v]),!r)return t.jsxs("div",{className:"log-empty-state",children:[t.jsx("p",{className:"log-empty-title",children:"Live logs are not available here"}),t.jsx("p",{className:"log-empty-subtitle",children:"Streaming is wired up for Android (logcat) and iOS (os_trace), not for this device's platform."})]});const Le=h?"Denied":p?"Offline":u?"Live":"Connecting",S=!u&&(!!h||p);return t.jsxs("div",{className:"logcat-root",children:[t.jsxs("div",{className:"log-toolbar",children:[t.jsxs("div",{className:"log-filter-group",children:[t.jsxs("div",{className:"log-stat-pill",title:h??void 0,children:[t.jsx("span",{className:`log-live-dot ${u?"active":""} ${S?"is-error":""}`}),Le]}),t.jsxs("div",{className:"log-stat-pill logcat-count",children:[L.length," / ",o.length]}),t.jsxs(rs,{selectSize:"sm",value:We,onChange:B=>c(sl(a,B.target.value)),"aria-label":"Minimum log level",children:[t.jsx("option",{value:"",children:"All levels"}),An.map(B=>t.jsx("option",{value:B.value,children:B.label},B.value))]}),t.jsxs("div",{className:"logcat-input-wrap",children:[t.jsx("input",{type:"text",className:"type-input-field tiny logcat-query",placeholder:"tag:Wifi package:com.android.systemui free text",value:a,onChange:B=>c(B.target.value),"aria-label":"Filter logs"}),a&&t.jsx("button",{type:"button",className:"logcat-input-btn",onClick:()=>c(""),"aria-label":"Clear filter",title:"Clear filter",children:t.jsx(Ls,{size:12})})]}),t.jsxs("div",{className:"logcat-input-wrap",children:[t.jsx("input",{type:"text",className:"type-input-field tiny logcat-find",placeholder:"Find…",value:b,onChange:B=>{$(B.target.value),I(0)},onKeyDown:B=>{B.key==="Enter"&&(B.preventDefault(),fe(B.shiftKey?-1:1))},"aria-label":"Find in logs"}),b&&t.jsx("span",{className:"logcat-hit-count","aria-live":"polite",children:k.length?`${K+1}/${k.length}`:"0/0"})]}),t.jsx("button",{type:"button",className:"dc-btn-secondary btn-sm logcat-icon-btn",onClick:()=>fe(-1),disabled:!k.length,"aria-label":"Previous match",title:"Previous match (Shift+Enter)",children:t.jsx(Zi,{size:14})}),t.jsx("button",{type:"button",className:"dc-btn-secondary btn-sm logcat-icon-btn",onClick:()=>fe(1),disabled:!k.length,"aria-label":"Next match",title:"Next match (Enter)",children:t.jsx(Gi,{size:14})}),t.jsx("button",{type:"button",className:`dc-btn-secondary btn-sm logcat-icon-btn ${y?"active":""}`,onClick:()=>C(!y),"aria-pressed":y,"aria-label":"Match case",title:"Match case",children:t.jsx(lr,{size:15})}),t.jsx("button",{type:"button",className:`dc-btn-secondary btn-sm logcat-icon-btn ${N?"active":""}`,onClick:()=>w(!N),"aria-pressed":N,"aria-label":"Soft wrap",title:"Soft wrap long messages",children:t.jsx(Jr,{size:14})})]}),t.jsxs("div",{className:"log-actions-group",children:[(h||p)&&t.jsxs("button",{className:"dc-btn-secondary btn-sm",onClick:x,children:[t.jsx(St,{size:14})," RECONNECT"]}),t.jsxs("button",{className:`dc-btn-secondary btn-sm ${v?"active":""}`,onClick:()=>g(!v),children:[t.jsx(oa,{size:14})," ",v?"FREEZE":"FOLLOW"]}),t.jsxs("button",{className:`dc-btn-secondary btn-sm ${F?"is-recording":""}`,onClick:he,"aria-pressed":F,title:F?"Stop recording and download the capture":"Record the raw log stream to a file",children:[F?t.jsx(On,{size:12}):t.jsx(Bi,{size:12})," ",F?`STOP · ${Y.toLocaleString()}`:"RECORD"]}),t.jsxs("button",{className:"btn-premium btn-sm",disabled:L.length===0,onClick:Re,children:[t.jsx(Wi,{size:14})," EXPORT"]}),t.jsxs("button",{className:"dc-btn-secondary btn-sm",onClick:m,children:[t.jsx(Gt,{size:14})," CLEAR"]})]})]}),t.jsxs("div",{className:`logcat-rows theme-dark ${N?"":"no-wrap"}`,ref:q,children:[h&&t.jsxs("div",{className:"logcat-status-banner is-denied",role:"alert",children:[t.jsx(at,{size:14}),t.jsxs("span",{children:["Access denied — ",h]})]}),!h&&p&&t.jsxs("div",{className:"logcat-status-banner is-exhausted",role:"alert",children:[t.jsx(at,{size:14}),t.jsx("span",{children:"Connection lost after repeated attempts. Use Reconnect above to try again."})]}),L.map((B,Z)=>t.jsx(ml,{record:B,index:Z,isHit:re.has(Z),isActiveHit:k.length>0&&k[K]===Z},B.seq)),t.jsx("div",{ref:E})]})]})}function hl(e){const s=e==null?void 0:e.message;return typeof s=="string"?s.trim():""}function rt(e,s){const n=hl(s);return n?`Couldn’t ${e}: ${n}`:`Couldn’t ${e}.`}function pl(e,s){return e==="android"?"Couldn’t read the clipboard. Check that the Appium Settings app is installed on the device.":rt("read the clipboard",s)}function xl({device:e,onClose:s,titleId:n}){const{toast:i,removeToast:r}=is(),a=_s(),{tab:c}=In(),l=Os(),o=d.useRef(null),[u,m]=d.useState({width:0,height:0}),[h,p]=d.useState("inspect"),[x,v]=d.useState(null),[g,y]=d.useState(c||"actions"),C=g==="omni"&&h==="inspect",[N,w]=d.useState(""),[b,$]=d.useState(!1),[R,I]=d.useState(!1),[E,q]=d.useState(null),[O,F]=d.useState(""),[W,Y]=d.useState(""),[z,J]=d.useState(!0),[P,L]=d.useState([]),[k,K]=d.useState(null),[re,fe]=d.useState(!1),[We,Re]=d.useState(!1),[he,Le]=d.useState(0),[S,B]=d.useState(e),Z=Ys(S),[ce,de]=d.useState([]),[$e,_e]=d.useState(!1),[xe,Ee]=d.useState(!1),[ge,et]=d.useState(null),[Te,tt]=d.useState(!1),[ye,ht]=d.useState(!1),st=10,[pt,xt]=d.useState(!1),[Tt,Dt]=d.useState(!1),ds=Kc(S==null?void 0:S.udid,!ye),gt=()=>{navigator.clipboard.writeText(S.udid).catch(()=>{}),xt(!0),setTimeout(()=>xt(!1),1500)},Ge=d.useRef(""),Ne=d.useRef(null),[yt,vt]=d.useState(!1);d.useEffect(()=>{g&&(!c||c!==g)&&a(`/devices/${e.udid}/control/${g}${l.search}`,{replace:!0})},[g,c,e.udid,a,l.search]),d.useEffect(()=>((async()=>{try{Re(!0),await V.startStream(S.udid);const U=(await V.getDevices()).find(ee=>ee.udid===S.udid);U&&B(U)}catch(D){console.error("Auto-start stream failed:",D)}finally{Re(!1)}})(),()=>{V.stopStream(S.udid).catch(()=>{})}),[e.udid]);const Ye=d.useCallback(async()=>{try{_e(!0);const j=await V.listApps(S.udid);Array.isArray(j)&&de(j)}catch(j){console.error("Failed to load apps:",j)}finally{_e(!1)}},[S.udid]);d.useEffect(()=>{g==="actions"&&Ye()},[g,Ye]);const bt=parseInt(S.screenWidth||"1080",10),jt=parseInt(S.screenHeight||"1920",10),we=Math.min(bt,jt),Ce=Math.max(bt,jt),ue=we/Ce,He=d.useCallback(()=>{const j=!z,D=j?window.innerHeight*.55:window.innerHeight*.7,U=620,ae=window.innerWidth>900;let te;j?te=ae?Math.min(window.innerWidth*.8,window.innerWidth-U):window.innerWidth*.8:te=window.innerWidth*.45;const oe=z?ue:1/ue;let se,ie;z?(se=D,ie=se*oe,ie>te&&(ie=te,se=ie/oe)):(ie=te,se=ie/oe,se>D&&(se=D,ie=se*oe)),m({width:ie,height:se})},[ue,z]);d.useEffect(()=>(He(),window.addEventListener("resize",He),()=>window.removeEventListener("resize",He)),[He]),d.useEffect(()=>{const j=async()=>{if(Ge.current.length>0){const U=Ge.current;Ge.current="";try{await V.typeText(S.udid,U)}catch(ee){console.error("Keyboard buffering flush failed:",ee)}}},D=U=>{const ee=document.activeElement;if(ee&&(ee.tagName==="INPUT"||ee.tagName==="TEXTAREA"||ee.isContentEditable)||!yt&&g!=="terminal")return;const te=U.key;te==="Enter"?(Ne.current&&clearTimeout(Ne.current),j(),V.pressKey(S.udid,S.platform==="android"?66:"enter")):te==="Backspace"?(Ne.current&&clearTimeout(Ne.current),j(),V.pressKey(S.udid,S.platform==="android"?67:"backspace")):te.length===1&&(Ge.current+=te,Ne.current&&clearTimeout(Ne.current),Ne.current=setTimeout(()=>{j()},50))};return window.addEventListener("keydown",D),()=>{window.removeEventListener("keydown",D),Ne.current&&clearTimeout(Ne.current)}},[S.udid,S.platform,yt,g]);const[It,Mt]=d.useState(Date.now()),wt=()=>{const j=he>0?`r=${he}&`:"";return S.session_id&&!String(S.session_id).startsWith("manual_")?`/xenon/api/session/${S.session_id}/live_video?${j}t=${It}`:`/xenon/api/control/${S.udid}/stream?${j}t=${It}`};d.useEffect(()=>{he>0&&Mt(Date.now())},[he]),d.useEffect(()=>{if(Te||ye)return;const j=setTimeout(()=>ht(!0),3e4);return()=>clearTimeout(j)},[Te,ye,he]);const Ze=d.useRef(null),Nt=j=>{const D=j.currentTarget.getBoundingClientRect();return{x:j.clientX-D.left,y:j.clientY-D.top}},Lt=j=>{const D=Nt(j);Ze.current={x:D.x,y:D.y,time:Date.now()}},_t=async j=>{var en;if(!Ze.current)return;const D=Ze.current,U=Nt(j),ee=Date.now()-D.time,ae=(en=o.current)==null?void 0:en.getBoundingClientRect(),te=(ae==null?void 0:ae.width)||u.width,oe=(ae==null?void 0:ae.height)||u.height;let se,ie,nt,Ut;z?(se=D.x/te*we,ie=D.y/oe*Ce,nt=U.x/te*we,Ut=U.y/oe*Ce):(se=D.x/te*Ce,ie=D.y/oe*we,nt=U.x/te*Ce,Ut=U.y/oe*we);const Js=Math.abs(nt-se),Qs=Math.abs(Ut-ie);try{ee<500&&Js<10&&Qs<10?await V.tap(S.udid,Math.round(se),Math.round(ie)):ee>=500&&Js<10&&Qs<10?await V.touchAndHold(S.udid,Math.round(se),Math.round(ie),ee):await V.swipe(S.udid,Math.round(se),Math.round(ie),Math.round(nt),Math.round(Ut))}catch(ji){console.error("Action failed:",ji)}Ze.current=null},Ot=()=>V.pressKey(S.udid,S.platform==="android"?Ct.HOME:fs.HOME),Pt=()=>V.pressKey(S.udid,Ct.BACK),zt=()=>V.pressKey(S.udid,Ct.APP_SWITCH),Ft=()=>V.pressKey(S.udid,S.platform==="android"?Ct.VOLUME_UP:fs.VOLUME_UP),Bt=()=>V.pressKey(S.udid,S.platform==="android"?Ct.VOLUME_DOWN:fs.VOLUME_DOWN),f=()=>V.lock(S.udid),A=async()=>{Dt(!0);try{await V.unlock(S.udid)}finally{setTimeout(()=>Dt(!1),2500)}},M=async()=>{const j=N;if(!(!j.trim()||b)){$(!0);try{await V.typeText(S.udid,j),w(""),I(!0)}catch(D){i(rt("send the text",D),"error")}finally{$(!1)}}};d.useEffect(()=>{if(!R)return;const j=setTimeout(()=>I(!1),2e3);return()=>clearTimeout(j)},[R]);const T=async()=>{try{F("Fetching...");const j=await V.getClipboard(S.udid);j&&j.content!==void 0?F(j.content||"(Clipboard is empty)"):F("No content received")}catch(j){F(pl(S.platform,j))}},H=async()=>{fe(!0);try{const j=await V.getScreenshot(S.udid);if(j!=null&&j.screenshot){const D={id:_c(),base64:j.screenshot,timestamp:Date.now()};L(U=>[D,...U]),K(0)}}catch(j){console.error("Failed to take screenshot:",j)}finally{fe(!1)}},_=j=>{L(D=>{const U=D.filter(ee=>ee.id!==j);return U.length===0?K(null):k!==null&&k>=U.length&&K(0),U})},G=()=>{L([]),K(null),i("Cleared all captured evidence.","success")},ne=j=>{const D=document.createElement("a");D.href=`data:image/png;base64,${j}`,D.download=`screenshot-${S.udid}-${Date.now()}.png`,D.click()},Q=async j=>{const D=we/2,U=Ce/2,ee=we*.4,ae=Ce*.4;let te,oe,se,ie;switch(j){case"left":te=D+ee,oe=U,se=D-ee,ie=U;break;case"right":te=D-ee,oe=U,se=D+ee,ie=U;break;case"up":te=D,oe=U+ae,se=D,ie=U-ae;break;case"down":te=D,oe=U-ae,se=D,ie=U+ae;break}try{await V.swipe(S.udid,Math.round(te),Math.round(oe),Math.round(se),Math.round(ie))}catch(nt){i(rt(`swipe ${j}`,nt),"error")}},me=()=>{const j=W.trim();j&&q(j)},pe=async()=>{const j=E;if(q(null),!j)return;const D=i(`Uninstalling ${j} from ${Z}…`,"loading",0);try{_e(!0),await V.uninstallApp(S.udid,j),Y(""),i(`Uninstalled ${j} from ${Z}`,"success"),setTimeout(Ye,3e3)}catch(U){i(rt(`uninstall ${j}`,U),"error")}finally{_e(!1),r(D)}},ve=async()=>{if(!ge)return;const j=ge.name;let D;try{Ee(!0),D=i(`Installing ${j} on ${Z}…`,"loading",0);const U=await V.uploadAndInstallApp(S.udid,ge);U.success?(i(`Installed ${j} on ${Z}`,"success"),et(null),setTimeout(Ye,5e3)):i(rt(`install ${j}`,{message:U.error}),"error")}catch(U){i(rt(`install ${j}`,U),"error")}finally{D&&r(D),Ee(!1)}};return t.jsxs("div",{className:"device-control-view",children:[t.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),t.jsxs("header",{className:"control-view-top-bar",children:[t.jsxs("button",{className:"back-to-devices-btn",onClick:s,children:[t.jsx(hs,{size:18})," DEVICES"]}),t.jsxs("div",{className:"device-info-mini",children:[t.jsx("span",{className:`device-pill platform-pill ${S.platform}`,children:S.platform==="ios"?"Apple":"Android"}),t.jsxs("span",{className:"device-pill version-pill",children:["v",S.sdk]}),S.reservedUntil&&Date.now()<S.reservedUntil&&t.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${S.reservedBy}${S.reservationReason?`: ${S.reservationReason}`:""}`,children:["Reserved by ",S.reservedBy||"someone"]}),t.jsx("h2",{id:n,className:"device-name-text",children:Z}),t.jsxs("span",{className:"udid-chip",title:S.udid,children:[t.jsx("span",{className:"udid-chip__value",children:S.udid}),t.jsx("button",{type:"button",className:"udid-chip__copy",onClick:gt,"aria-label":"Copy UDID",title:pt?"Copied!":"Copy UDID",children:pt?t.jsx(ct,{size:12}):t.jsx(qe,{size:12})})]})]})]}),t.jsxs("div",{className:`control-view-main ${z?"":"is-landscape"} ${g==="omni"?"omni-mode":""}`,children:[t.jsxs("div",{className:"device-preview-column",children:[t.jsx("div",{className:"device-screen-wrapper",children:t.jsxs("div",{ref:j=>{o.current=j,v(j)},className:`device-stream-canvas ${z?"":"landscape"} ${yt?"focused":""} ${C?"is-inspecting":""}`,style:{width:u.width,height:u.height,background:"var(--black)"},tabIndex:0,onFocus:()=>vt(!0),onBlur:()=>vt(!1),onMouseDown:C?void 0:Lt,onMouseUp:C?void 0:_t,children:[ye?t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(at,{size:40,color:"var(--red, #f87171)"}),t.jsx("p",{style:{marginTop:16},children:"Stream unavailable"}),t.jsx("button",{className:"btn-premium btn-sm",style:{marginTop:12},onClick:()=>{ht(!1),Le(0)},children:"Retry"})]}):(We||!Te)&&t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(St,{size:40,className:"animate-spin",color:"var(--color-accent)"}),t.jsx("p",{style:{marginTop:16},children:We?"ESTABLISHING TRACE...":"Waiting for stream…"})]}),!ye&&t.jsx("img",{src:wt(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onLoad:()=>tt(!0),onError:()=>{if(console.warn("Stream failed to load, retrying..."),tt(!1),he>=st){ht(!0);return}setTimeout(()=>Le(j=>j+1),2e3)}}),ds==="off"&&!ye&&t.jsxs("div",{className:"device-screen-off",role:"status",children:[t.jsx(Dr,{size:32}),t.jsx("p",{children:"Display is off"}),t.jsx("span",{children:"The stream is fine — the device is asleep."}),t.jsx("button",{type:"button",className:"btn-premium btn-sm",onClick:A,disabled:Tt,children:Tt?"Waking…":"Wake device"})]})]})}),t.jsxs("aside",{className:"device-footer-actions",role:"toolbar","aria-label":"Device controls","aria-orientation":z?"vertical":"horizontal",children:[t.jsx("button",{className:`footer-action-btn ${z?"active":""}`,onClick:()=>J(!0),title:"Portrait","aria-label":"Portrait orientation","aria-pressed":z,children:t.jsx(Ur,{size:18})}),t.jsx("button",{className:`footer-action-btn ${z?"":"active"}`,onClick:()=>J(!1),title:"Landscape","aria-label":"Landscape orientation","aria-pressed":!z,children:t.jsx(Fr,{size:18})}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:Ot,title:"Home","aria-label":"Home",children:t.jsx(Ui,{size:18})}),S.platform==="android"&&t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"footer-action-btn",onClick:Pt,title:"Back","aria-label":"Back",children:t.jsx(hs,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:zt,title:"App switcher","aria-label":"App switcher",children:t.jsx(On,{size:18})})]}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:Ft,title:"Volume up","aria-label":"Volume up",children:t.jsx(ra,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:Bt,title:"Volume down","aria-label":"Volume down",children:t.jsx(na,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:f,title:"Lock device","aria-label":"Lock device",children:t.jsx(Hi,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:A,title:"Unlock device","aria-label":"Unlock device",children:t.jsx(kr,{size:18})})]})]}),t.jsxs("div",{className:"device-interactions-column",children:[t.jsxs("div",{className:"interaction-tabs",role:"tablist",children:[t.jsxs("button",{className:`tab-btn ${g==="actions"?"active":""}`,onClick:()=>y("actions"),role:"tab","aria-selected":g==="actions",children:[t.jsx(ks,{size:13}),t.jsx("span",{children:"Actions"})]}),t.jsxs("button",{className:`tab-btn ${g==="screenshot"?"active":""}`,onClick:()=>y("screenshot"),role:"tab","aria-selected":g==="screenshot",children:[t.jsx(ms,{size:13}),t.jsx("span",{children:"Screenshot"})]}),t.jsxs("button",{className:`tab-btn ${g==="logs"?"active":""}`,onClick:()=>y("logs"),role:"tab","aria-selected":g==="logs",children:[t.jsx(Vr,{size:13}),t.jsx("span",{children:"Logs"})]}),t.jsxs("button",{className:`tab-btn ${g==="terminal"?"active":""}`,onClick:()=>y("terminal"),role:"tab","aria-selected":g==="terminal",children:[t.jsx(Vi,{size:13}),t.jsx("span",{children:"Shell"})]}),t.jsxs("button",{className:`tab-btn ${g==="omni"?"active":""}`,onClick:()=>y("omni"),role:"tab","aria-selected":g==="omni",children:[t.jsx(As,{size:13}),t.jsx("span",{children:"Omni-Vision"})]})]}),t.jsx("div",{className:`interactions-scroll-area ${g==="terminal"?"terminal-mode":""} ${g==="screenshot"||g==="logs"?"screenshot-mode":""}`,children:t.jsxs("div",{className:"tab-content",children:[g==="omni"&&t.jsx("div",{className:"omni-inspector-tab-wrapper animate-fade-in",children:t.jsx(Xc,{sessionId:S.session_id?String(S.session_id):null,udid:S.udid,streamUrl:wt(),embedded:!0,overlayTarget:x,onModeChange:p})}),g==="actions"&&t.jsxs("div",{className:"actions-grid",children:[t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(zi,{size:18,color:"var(--color-accent)"})," Smart Input"]}),t.jsx("p",{className:"action-card-hint",id:"dc-smart-input-hint",children:"Relay keystrokes to the focused element on the device."}),t.jsxs("div",{className:"smart-input-row",children:[t.jsx("input",{type:"text",className:"type-input-field compact","aria-label":"Text to send to the device","aria-describedby":"dc-smart-input-hint",placeholder:"Type and press Enter to send…",value:N,onChange:j=>w(j.target.value),onKeyDown:j=>j.key==="Enter"&&M()}),t.jsxs("button",{className:"dc-btn-secondary btn-sm",onClick:M,disabled:!N.trim()||b,children:[b&&t.jsx(Ht,{className:"animate-spin",size:14}),"SEND"]}),t.jsx("span",{className:"send-status",role:"status",children:R&&t.jsxs(t.Fragment,{children:[t.jsx(ct,{size:12,"aria-hidden":"true"})," Sent"]})})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(_r,{size:18,color:"var(--color-accent)"})," App Management"]}),t.jsxs("div",{className:"app-mgmt-content",children:[t.jsxs("div",{className:"install-section",children:[t.jsx("p",{className:"compact-label",children:"Install Package"}),t.jsxs("div",{className:"upload-box-row",children:[t.jsxs("label",{className:"file-upload-launcher",title:ge?ge.name:"Select an .apk, .ipa or .app file",children:[t.jsx(qi,{size:14}),t.jsx("span",{children:ge?ge.name:"Select File"}),t.jsx("input",{type:"file",className:"sr-only",accept:".apk,.ipa,.app",onChange:j=>{var D;return et(((D=j.target.files)==null?void 0:D[0])||null)}})]}),t.jsx("button",{className:"btn-premium btn-sm",disabled:!ge||xe,onClick:ve,children:xe?t.jsx(Ht,{className:"animate-spin",size:14}):"INSTALL"})]}),t.jsx("p",{className:"hint-text",children:"Accepts .apk, .ipa or .app"})]}),t.jsx("div",{className:"divider-v"}),t.jsxs("div",{className:"uninstall-section",children:[t.jsx("label",{className:"compact-label",htmlFor:"dc-uninstall-app",children:"Quick Uninstall"}),t.jsxs("div",{className:"uninstall-controls-row",children:[t.jsxs("div",{className:"select-wrapper",children:[t.jsxs(rs,{id:"dc-uninstall-app",selectSize:"sm",className:"w-full",value:W,onChange:j=>Y(j.target.value),disabled:$e,children:[t.jsx("option",{value:"",children:$e?"Loading apps...":"-- Select App to Remove --"}),ce.map(j=>t.jsx("option",{value:j,children:j},j))]}),$e&&t.jsx(Ht,{className:"animate-spin select-loader",size:12})]}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:me,disabled:!W||$e,children:[t.jsx(Gt,{size:14})," UNINSTALL"]})]}),t.jsxs("div",{className:"manual-input-box",children:[t.jsx("label",{className:"hint-text",htmlFor:"dc-uninstall-manual",children:"Or enter manually:"}),t.jsx("input",{id:"dc-uninstall-manual",type:"text",className:"type-input-field tiny",placeholder:"com.example.app",value:W,onChange:j=>Y(j.target.value)})]})]})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(pr,{size:18,color:"var(--color-accent)"})," Clipboard"]}),t.jsxs("div",{className:"clipboard-row",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:T,children:"FETCH VALUE"}),t.jsx("div",{className:"clipboard-display compact",children:O})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(Mr,{size:18,color:"var(--color-accent)"})," Directional Gestures"]}),t.jsxs("div",{className:"gestures-grid-container",children:[t.jsxs("div",{className:"gestures-dpad",children:[t.jsx("div",{}),t.jsx("button",{className:"dpad-btn","aria-label":"Swipe up",title:"Swipe up",onClick:()=>Q("up"),children:t.jsx(ur,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn","aria-label":"Swipe left",title:"Swipe left",onClick:()=>Q("left"),children:t.jsx(hs,{size:24})}),t.jsx("div",{className:"dpad-center"}),t.jsx("button",{className:"dpad-btn","aria-label":"Swipe right",title:"Swipe right",onClick:()=>Q("right"),children:t.jsx(_n,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn","aria-label":"Swipe down",title:"Swipe down",onClick:()=>Q("down"),children:t.jsx(Dn,{size:24})}),t.jsx("div",{})]}),t.jsx("p",{className:"compact-label dpad-caption",children:"Quick swipe in a direction"})]})]})]}),g==="screenshot"&&t.jsxs("div",{className:"action-card screenshot-card",children:[P.length>0&&t.jsx("header",{className:"action-card-header",children:t.jsx("button",{className:"btn-text-only",onClick:G,children:"CLEAR ALL"})}),t.jsxs("div",{className:`screenshot-workspace ${P.length===0?"is-empty":""}`,children:[t.jsxs("div",{className:"screenshot-gallery-sidebar",children:[t.jsxs("button",{className:"btn-premium take-screenshot-btn",onClick:H,disabled:re,children:[re?t.jsx(Ht,{className:"animate-spin",size:16}):t.jsx(ms,{size:16}),t.jsx("span",{children:re?"CAPTURING...":"NEW CAPTURE"})]}),t.jsxs("div",{className:"screenshot-thumbnails-list",children:[P.length===0&&!re&&t.jsxs("div",{className:"empty-gallery-state",children:[t.jsx(ms,{size:20,className:"empty-gallery-icon"}),t.jsx("p",{className:"empty-gallery-title",children:"No captures yet"}),t.jsx("p",{className:"empty-gallery-hint",children:"Grab a screenshot of the device to begin analysis."})]}),P.map((j,D)=>t.jsxs("div",{className:`screenshot-thumb-item ${k===D?"active":""}`,onClick:()=>K(D),children:[t.jsx("img",{src:`data:image/png;base64,${j.base64}`,alt:"Thumb"}),t.jsx("span",{className:"thumb-time",children:new Date(j.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),t.jsx("button",{className:"thumb-delete-btn",onClick:U=>{U.stopPropagation(),_(j.id)},children:t.jsx(Gt,{size:12})})]},j.id))]})]}),t.jsx("div",{className:"screenshot-main-preview",children:k!==null&&P[k]?t.jsxs("div",{className:"preview-container",children:[t.jsx("div",{className:"preview-image-wrapper",children:t.jsx("img",{src:`data:image/png;base64,${P[k].base64}`,alt:"Selected Evidence"})}),t.jsxs("footer",{className:"preview-footer",children:[t.jsxs("div",{className:"preview-meta",children:[t.jsx("span",{className:"meta-label",children:"ID:"}),t.jsx("span",{className:"meta-value",children:P[k].id.substring(0,8)}),t.jsx("span",{className:"meta-divider",children:"|"}),t.jsx("span",{className:"meta-value",children:Pi(P[k].timestamp)})]}),t.jsxs("div",{className:"preview-actions",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:()=>ne(P[k].base64),children:"DOWNLOAD PNG"}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:()=>_(P[k].id),children:[t.jsx(Gt,{size:14})," DELETE"]})]})]})]}):null})]})]}),g==="logs"&&t.jsx("div",{className:"action-card screenshot-card",children:t.jsx(fl,{udid:S.udid,platform:S.platform})}),g==="terminal"&&t.jsx("div",{className:"action-card full-height",children:t.jsx(Oc,{platform:(S.platform||"").toLowerCase(),prompt:`${(S.platform||"").toLowerCase()==="ios"?"ios":"adb"} $`,welcomeMessage:`Connected to ${Z} (${S.udid}).
246
+ Internal Shell Environment.`,onCommand:async j=>{const D=await V.executeShell(S.udid,j);if(D.error)throw new Error(D.error);return D.output}})})]})})]})]}),S.session_id&&!String(S.session_id).startsWith("manual_")&&t.jsx(Ei,{sessionId:String(S.session_id),mode:"slice",windowSec:60,variant:"floating"}),t.jsx(zs,{open:E!==null,title:"Uninstall app?",onClose:()=>q(null),footer:t.jsxs(t.Fragment,{children:[t.jsx(Oe,{variant:"secondary",onClick:()=>q(null),children:"Cancel"}),t.jsx(Oe,{variant:"danger",onClick:pe,children:"Uninstall"})]}),children:t.jsxs("p",{className:"uninstall-confirm-text",children:["Uninstall ",t.jsx("code",{children:E})," from"," ",t.jsx("span",{className:"uninstall-confirm-device",children:Z}),"? The app and its data are removed from the device."]})})]})}const gl=/^(INPUT|TEXTAREA|SELECT)$/;function yl({labelledBy:e,onClose:s,children:n,style:i,...r}){const a=d.useRef(null),c=d.useRef(s);return c.current=s,d.useEffect(()=>{const l=a.current;if(!l)return;const o=document.activeElement,u=[];for(let h=l;h.parentElement&&h!==document.body;h=h.parentElement)for(const p of Array.from(h.parentElement.children))p===h||p.hasAttribute("inert")||p.matches("[aria-live], script, style, link, template")||(p.setAttribute("inert",""),u.push(p));l.contains(document.activeElement)||l.focus();const m=h=>{if(h.key!=="Escape"||h.defaultPrevented)return;const p=h.target;gl.test(p.tagName)||p.isContentEditable||(h.preventDefault(),c.current())};return l.addEventListener("keydown",m),()=>{l.removeEventListener("keydown",m),u.forEach(h=>h.removeAttribute("inert")),o&&o.isConnected&&o!==document.body&&o.focus()}},[]),t.jsx("div",{ref:a,role:"dialog","aria-modal":"true","aria-labelledby":e,tabIndex:-1,style:{outline:"none",...i},...r,children:n})}const vl={status:"all",platform:"all",type:"all",q:""},gi=["all",...bc],yi=["all","android","ios","tvos"],vi=["all","real","virtual"];function Ns(e,s){return s.includes(e)?e:s[0]}function bl(e){const s=e.get("q")??"";return{status:Ns(e.get("status"),gi),platform:Ns(e.get("platform"),yi),type:Ns(e.get("type"),vi),q:s.trim()?s:""}}function jl(e){const s=new URLSearchParams;return e.status!=="all"&&s.set("status",e.status),e.platform!=="all"&&s.set("platform",e.platform),e.type!=="all"&&s.set("type",e.type),e.q.trim()&&s.set("q",e.q),s}function bi(e){return e.deviceType==="simulator"||e.deviceType==="emulator"?!0:!e.deviceType&&e.realDevice===!1}function Zs(e){const s=(e.platform||"").toLowerCase();return s==="android"||s==="ios"||s==="tvos"?s:null}function wl(e){const s=e.deviceType==="emulator"?"Emulator":e.deviceType==="simulator"?"Simulator":"";return[Ys(e),e.name,e.manufacturer,e.model,Fs(e.platform),e.sdk,s,e.teamName,e.udid].filter(Boolean).join(" ").toLowerCase()}function Zt(e,s,n,i){if(i!=="status"&&s.status!=="all"&&Gs(e,n)!==s.status||i!=="platform"&&s.platform!=="all"&&Zs(e)!==s.platform||i!=="type"&&s.type!=="all"&&s.type==="virtual"!==bi(e))return!1;const r=s.q.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return!0;const a=wl(e);return r.every(c=>a.includes(c))}const Cs=e=>Object.fromEntries(e.map(s=>[s,0]));function Nl(e,s,n){const i=Cs(gi),r=Cs(yi),a=Cs(vi);for(const c of e){if(Zt(c,s,n,"status")&&(i.all+=1,i[Gs(c,n)]+=1),Zt(c,s,n,"platform")){r.all+=1;const l=Zs(c);l&&(r[l]+=1)}Zt(c,s,n,"type")&&(a.all+=1,a[bi(c)?"virtual":"real"]+=1)}return{status:i,platform:r,type:a}}function Cl(e){return e.some(s=>Zs(s)==="tvos")}function Sl(e){return e.status!=="all"||e.platform!=="all"||e.type!=="all"||e.q.trim()!==""}function kl(e,s){const n=i=>i===1?"device":"devices";return e===s?`${s} ${n(s)}`:`${e} of ${s} ${n(s)}`}function $n({name:e,value:s,anyValue:n,options:i,onChange:r}){const[a,c]=d.useState(!1),l=d.useRef(null),o=d.useRef(null),u=s!==n,m=i.find(x=>x.value===s),h=()=>{var x;c(!1),(x=o.current)==null||x.focus()},p=d.useCallback(x=>{const v=(x==null?void 0:x.querySelector('[aria-checked="true"]'))??(x==null?void 0:x.querySelector('[role="menuitemradio"]'));v==null||v.focus()},[]);return t.jsxs("span",{ref:l,className:`fm${u?" fm-set":""}`,children:[t.jsx("button",{ref:o,type:"button",className:"fm-trigger","aria-haspopup":"menu","aria-expanded":a,onClick:()=>c(x=>!x),children:u?t.jsxs(t.Fragment,{children:[t.jsxs("span",{className:"fm-name",children:[e,":"]})," ",(m==null?void 0:m.label)??s]}):t.jsxs(t.Fragment,{children:[t.jsx(Ln,{size:12,"aria-hidden":"true"}),e]})}),u&&t.jsx("button",{type:"button",className:"fm-clear","aria-label":`Clear ${e.toLowerCase()} filter`,onClick:()=>{r(n),h()},children:t.jsx(Ls,{size:12,"aria-hidden":"true"})}),t.jsx(ai,{open:a,onClose:h,anchorRef:l,placement:"bottom-start",children:t.jsx("div",{ref:p,children:t.jsx(mi,{children:i.map(x=>t.jsx(Ve,{checked:x.value===s,note:x.note,trailing:t.jsx("span",{className:"fm-count",children:x.count}),onClick:()=>{r(x.value),h()},children:x.label},x.value))})})})]})}class Al extends Se.Component{constructor(s){super(s),this.socketCleanups=[],this.refreshTimeout=null,this.searchRef=Se.createRef(),this.onSlash=n=>{var a,c;if(n.key!=="/"||n.ctrlKey||n.altKey||n.metaKey||this.props.params.udid)return;const i=n.target;(a=i==null?void 0:i.closest)!=null&&a.call(i,'input, textarea, select, [contenteditable]:not([contenteditable="false"])')||(n.preventDefault(),(c=this.searchRef.current)==null||c.focus())},this.clearFilters=()=>{var n;this.props.onFiltersChange(vl),(n=this.searchRef.current)==null||n.focus()},this.state={devices:[],activeSessionsCount:0,pendingSessionsCount:0,queueSummary:null,loaded:!1}}componentDidMount(){this.fetchDevices(),this.devicePolling=setInterval(()=>{this.fetchDevices()},1e4);const s=this.props.onSocketEvent("device_unblocked",()=>{this.fetchDevicesDebounced()}),n=this.props.onSocketEvent("device_blocked",()=>{this.fetchDevicesDebounced()});this.socketCleanups.push(s,n),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(s=>s()),document.removeEventListener("keydown",this.onSlash)}fetchDevicesDebounced(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>{this.refreshTimeout=null,this.fetchDevices()},500)}getBusyDevicesCount(s){return s.filter(n=>n.busy).length}async fetchDevices(){try{const s=await V.getDevices(),n=this.getBusyDevicesCount(s),i=await V.getPendingSessionsCount(),r=await V.getQueueSummary();this.setState({devices:s,activeSessionsCount:n,pendingSessionsCount:i,queueSummary:r,loaded:!0})}catch(s){console.log(s),this.setState({loaded:!0})}}setFilters(s){this.props.onFiltersChange({...this.props.filters,...s})}getFiltered(){const s=Date.now();return this.state.devices.filter(n=>Zt(n,this.props.filters,s))}render(){const s=this.getFiltered(),{udid:n}=this.props.params,i=n?this.state.devices.find(u=>u.udid===n):null,{filters:r}=this.props,a=Nl(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}];(Cl(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}],o=`/devices${this.props.locationSearch}`;return t.jsxs("div",{className:"device-explorer-container",children:[t.jsxs("div",{className:"de2-sticky-group",children:[t.jsx($i,{icon:Ss,title:"Devices",subtitle:`${this.state.devices.length} device${this.state.devices.length===1?"":"s"} registered across the global pool.`}),t.jsxs("div",{className:"de2-toolbar",children:[t.jsx(Xi,{size:"sm",label:"Status",value:r.status,onChange:u=>this.setFilters({status:u}),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}]}),t.jsxs("div",{className:"de2-toolbar-row",children:[t.jsxs("div",{className:"de2-search-wrap",children:[t.jsx(Tn,{size:13,className:"de2-search-icon","aria-hidden":"true"}),t.jsx("input",{ref:this.searchRef,type:"text",className:"de2-search","aria-label":"Search devices",placeholder:"Search name, model or UDID…",value:r.q,onChange:u=>this.setFilters({q:u.target.value})}),t.jsx("kbd",{className:"de2-key","aria-hidden":"true",children:"/"})]}),t.jsx($n,{name:"Platform",value:r.platform,anyValue:"all",options:c,onChange:u=>this.setFilters({platform:u})}),t.jsx($n,{name:"Type",value:r.type,anyValue:"all",options:l,onChange:u=>this.setFilters({type:u})}),Sl(r)&&t.jsx(Oe,{variant:"ghost",size:"sm",onClick:this.clearFilters,children:"Clear"}),t.jsxs("div",{className:"de2-result",children:[this.state.loaded&&t.jsx("span",{"aria-live":"polite",children:kl(s.length,this.state.devices.length)}),t.jsx(Oe,{variant:"secondary",size:"icon","aria-label":"Refresh devices",title:"Refresh",onClick:()=>this.fetchDevices(),children:t.jsx(us,{size:13,"aria-hidden":"true"})})]})]})]})]}),s.length>0?t.jsx(Ec,{devices:s,reloadDevices:()=>this.fetchDevices()}):t.jsxs("div",{className:"device-explorer-empty stagger-1",children:[t.jsx("div",{className:"device-explorer-empty-icon",children:this.state.loaded?t.jsx(Ss,{size:32}):t.jsx(us,{size:32,className:"animate-spin"})}),this.state.loaded?this.state.devices.length===0?t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"Global Device Registry Empty"}),t.jsx("p",{children:"Xenon hasn't detected any active device nodes in your infrastructure. Ensure your device farm is connected and heartbeat signals are active."}),t.jsxs(Oe,{variant:"primary",onClick:()=>this.fetchDevices(),children:[t.jsx(us,{size:14}),"Manual sync"]})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"No devices match these filters"}),t.jsx("p",{children:"Try another filter or search, or clear them to see every device."}),t.jsx(Oe,{variant:"secondary",onClick:this.clearFilters,children:"Clear filters"})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"Loading devices…"}),t.jsx("p",{children:"Syncing the global device registry."})]})]}),i&&t.jsx(yl,{className:"device-control-modal-overlay",labelledBy:"device-control-title",onClose:()=>this.props.navigate(o),children:t.jsx("div",{className:"device-control-modal",children:t.jsx(xl,{device:i,titleId:"device-control-title",onClose:()=>this.props.navigate(o)})})})]})}}function td(){const e=In(),s=_s(),n=Os(),[i,r]=Ai(),{on:a}=Ri();return t.jsx(Al,{params:e,navigate:s,onSocketEvent:a,filters:bl(i),onFiltersChange:c=>r(jl(c),{replace:!0}),locationSearch:n.search})}export{Al as DeviceExplorer,td as default};