@xenon-device-management/xenon 1.26.2 → 1.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/lib/package.json +1 -1
  2. package/lib/public/assets/{ApiKeyGate-vELAdQLu.js → ApiKeyGate-CdwAz8U0.js} +1 -1
  3. package/lib/public/assets/{BugReportButton-ySiZDywe.js → BugReportButton-BRpZbizS.js} +1 -1
  4. package/lib/public/assets/{DeviceMosaicView-Chtp0wAI.js → DeviceMosaicView-DIliYF7k.js} +1 -1
  5. package/lib/public/assets/{EmptyState-CYQYScPo.js → EmptyState-DdGslmm0.js} +1 -1
  6. package/lib/public/assets/{FieldGroup-Dea68RfI.js → FieldGroup-Bb3NBVy1.js} +1 -1
  7. package/lib/public/assets/{Modal-BgzTzImP.js → Modal-B1wiaZoC.js} +1 -1
  8. package/lib/public/assets/{SegmentedControl-DyRq9blY.js → SegmentedControl-CSSdDwVG.js} +1 -1
  9. package/lib/public/assets/{SettingCard-CardwBu3.js → SettingCard-B5QGLufn.js} +1 -1
  10. package/lib/public/assets/{Table-BczCxsDm.js → Table-CaLvNt65.js} +1 -1
  11. package/lib/public/assets/{activity-CS-Op-T6.js → activity-BKpt4jQ5.js} +1 -1
  12. package/lib/public/assets/{ai-settings-CIvB7rNM.js → ai-settings-DXab66Uw.js} +3 -3
  13. package/lib/public/assets/{api-keys-peJzllzQ.js → api-keys-BKOBEq40.js} +1 -1
  14. package/lib/public/assets/{apps-__WvcJaP.js → apps-h1-WF2M3.js} +3 -3
  15. package/lib/public/assets/{arrow-left-Dx-cXFLT.js → arrow-left-CsL4cGlx.js} +1 -1
  16. package/lib/public/assets/{arrow-right-Ax_FfBMv.js → arrow-right-ms3VXPTM.js} +1 -1
  17. package/lib/public/assets/{arrow-up-right-B6uJmGeA.js → arrow-up-right-DsPkHtnY.js} +1 -1
  18. package/lib/public/assets/{auth-shell-BQqcjjC9.js → auth-shell-Di20xJer.js} +2 -2
  19. package/lib/public/assets/{builds-page-BA-_iEjx.js → builds-page-B7Ykr6Y7.js} +1 -1
  20. package/lib/public/assets/{button-DcbnByKB.js → button-B4yBI9rz.js} +1 -1
  21. package/lib/public/assets/{calendar-C3pYg1V7.js → calendar-CDhdbn6g.js} +1 -1
  22. package/lib/public/assets/{check-DKdLfzhJ.js → check-CQ6W-pr3.js} +1 -1
  23. package/lib/public/assets/{chevron-left-Bb9PBLG5.js → chevron-left-Brw18ZbJ.js} +1 -1
  24. package/lib/public/assets/{chevron-right-DJcpeY_o.js → chevron-right-_5hhohkO.js} +1 -1
  25. package/lib/public/assets/{circle-check-DY6ntqp3.js → circle-check-DFS84uuw.js} +1 -1
  26. package/lib/public/assets/{circle-x-DgK9drRH.js → circle-x--eZQbJ-L.js} +1 -1
  27. package/lib/public/assets/{clock-I9zEVPan.js → clock-BKQop8v4.js} +1 -1
  28. package/lib/public/assets/{copy-Dy3oRuWT.js → copy-C6MtTTlz.js} +1 -1
  29. package/lib/public/assets/device-explorer-DTHiUDlu.js +246 -0
  30. package/lib/public/assets/device-explorer-ISQgiqG9.css +1 -0
  31. package/lib/public/assets/{download-BotTmDty.js → download-CJQADlfa.js} +1 -1
  32. package/lib/public/assets/{forgot-password-BaWiD2U2.js → forgot-password-BDwj629H.js} +1 -1
  33. package/lib/public/assets/{funnel-D2Qw4nTX.js → funnel-DZ7jzsbh.js} +1 -1
  34. package/lib/public/assets/{index-CI9Nz3HY.js → index-BpueX0rJ.js} +2 -2
  35. package/lib/public/assets/{input-cBBGau4X.js → input-CjSO5fIy.js} +1 -1
  36. package/lib/public/assets/{keycodes-CY4uwulo.js → keycodes-DX_YyhNk.js} +1 -1
  37. package/lib/public/assets/{layers-MHwJM2Ll.js → layers-DeJ98GnJ.js} +1 -1
  38. package/lib/public/assets/{lock-Bpc8rJFu.js → lock-D7AfKT4W.js} +1 -1
  39. package/lib/public/assets/{login-BmcyszP5.js → login-DzvYxcU2.js} +1 -1
  40. package/lib/public/assets/{maintenance-settings-DMFVuToe.js → maintenance-settings-CI8PjeAD.js} +2 -2
  41. package/lib/public/assets/{monitor-irjK6PRV.js → monitor-COjPL4Nw.js} +1 -1
  42. package/lib/public/assets/mouse-pointer-2-JHGsHIlv.js +6 -0
  43. package/lib/public/assets/{network-CVZ32MhH.js → network-CHdKReD2.js} +1 -1
  44. package/lib/public/assets/{overview-DRRSIpnD.js → overview-BFi5MYtk.js} +1 -1
  45. package/lib/public/assets/{page-header-Bl7uTiQF.js → page-header-Dlf-n7I6.js} +1 -1
  46. package/lib/public/assets/{plus-C3lvaMcL.js → plus-BO31f8er.js} +1 -1
  47. package/lib/public/assets/{profile-page-B3wsnR1n.js → profile-page-C2mhKOSp.js} +1 -1
  48. package/lib/public/assets/{reset-password-BIGj_ULj.js → reset-password-D2-nKd2R.js} +1 -1
  49. package/lib/public/assets/{runbook-page-DEznNZhc.js → runbook-page-Dua237ld.js} +1 -1
  50. package/lib/public/assets/{select-BpuZWZuE.js → select-r2t6ViSf.js} +1 -1
  51. package/lib/public/assets/{selector-detail-page-ZCvmtQ5Y.js → selector-detail-page-BADJhfZc.js} +1 -1
  52. package/lib/public/assets/{selector-health-D-hvfY2E.js → selector-health-3LaUwIOS.js} +1 -1
  53. package/lib/public/assets/{selector-health-page-C0ZqZ_VT.js → selector-health-page-hCruYbXz.js} +1 -1
  54. package/lib/public/assets/{session-detail-page-Bv7IwFTQ.js → session-detail-page-ovBT1YRs.js} +1 -1
  55. package/lib/public/assets/settings-CIK56OMn.js +6 -0
  56. package/lib/public/assets/{status-pill-outline-B5dWsaer.js → status-pill-outline-CG_1PTcd.js} +1 -1
  57. package/lib/public/assets/{tablet-DxwkBlhd.js → tablet-mcews5C3.js} +1 -1
  58. package/lib/public/assets/{teams-D3s8GhkG.js → teams-Cf8a8-Uo.js} +1 -1
  59. package/lib/public/assets/{trash-2-Dyf4Jcyk.js → trash-2-CsJaXAJF.js} +1 -1
  60. package/lib/public/assets/{upload-B6ZJ1_f1.js → upload-CL1XK43J.js} +1 -1
  61. package/lib/public/assets/{use-password-reset-mode-B-oOrt1d.js → use-password-reset-mode-gRcAFXVy.js} +1 -1
  62. package/lib/public/assets/{users-QfiFclLn.js → users-24eVEQFo.js} +1 -1
  63. package/lib/public/assets/{users-BfvPE2wX.js → users-CgxBmVs9.js} +1 -1
  64. package/lib/public/assets/{video-off-C2quR4KF.js → video-off-LUd5fEht.js} +1 -1
  65. package/lib/public/assets/{webhook-settings-BjbGi-Pi.js → webhook-settings-KzrG-pNv.js} +1 -1
  66. package/lib/public/assets/{zap-C2lxP7TK.js → zap-BA1OUWAL.js} +1 -1
  67. package/lib/public/index.html +1 -1
  68. package/lib/src/app/routers/control.js +5 -0
  69. package/lib/src/device-managers/AndroidDeviceManager.js +31 -95
  70. package/lib/src/device-managers/android/clipboardBroadcast.js +24 -0
  71. package/lib/src/device-managers/clipboardErrors.js +15 -0
  72. package/lib/test/unit/android-clipboard.spec.js +147 -0
  73. package/lib/test/unit/clipboard-route.spec.js +110 -0
  74. package/lib/tsconfig.tsbuildinfo +1 -1
  75. package/package.json +1 -1
  76. package/lib/public/assets/device-explorer-BPyGYs0c.js +0 -246
  77. package/lib/public/assets/device-explorer-C9qg30Jn.css +0 -1
  78. package/lib/public/assets/mouse-pointer-2-CYkC-Dyq.js +0 -11
  79. package/lib/public/assets/settings-DCR9vnQ5.js +0 -1
@@ -0,0 +1,246 @@
1
+ import{c as X,r as d,t as Rn,j as t,R as vi,v as bi,w as ke,C as Js,U as wi,X as W,x as et,y as $s,u as Zt,a as Es,b as ji,T as Ni,q as xs,z as Ts,A as it,S as Ot,B as Ci,f as wt,D as Ft,i as $n,E as Si,p as ki}from"./index-BpueX0rJ.js";import{P as Ai}from"./page-header-Dlf-n7I6.js";import{B as ie}from"./button-B4yBI9rz.js";import{S as Ds}from"./select-r2t6ViSf.js";import{P as Bt,B as Ri}from"./BugReportButton-BRpZbizS.js";import{P as St,u as Vt,a as Nt,b as En,c as Is,d as $i,D as Ei,e as Qs,f as Ti,g as rt,h as Di,M as Ms}from"./Modal-B1wiaZoC.js";import{C as Ze}from"./check-CQ6W-pr3.js";import{F as Wt}from"./FieldGroup-Bb3NBVy1.js";import{C as Ii}from"./clock-BKQop8v4.js";import{P as Tn}from"./plus-BO31f8er.js";import{A as Mi}from"./activity-BKpt4jQ5.js";import{p as Ls}from"./labels-C21SA4JG.js";import{C as Te}from"./copy-C6MtTTlz.js";import{T as Li}from"./tablet-mcews5C3.js";import{f as _i}from"./time-B8FIgwPE.js";import{M as en}from"./mouse-pointer-2-JHGsHIlv.js";import{L as Oi}from"./layers-DeJ98GnJ.js";import{Z as vs}from"./zap-BA1OUWAL.js";import{C as Pi}from"./chevron-right-_5hhohkO.js";import{S as Dn,C as zi,H as Fi,a as as,A as bt,I as os}from"./keycodes-DX_YyhNk.js";import{D as Bi}from"./download-CJQADlfa.js";import{T as bs}from"./trash-2-CsJaXAJF.js";import{U as Wi,T as Ui}from"./upload-CL1XK43J.js";import{A as Hi}from"./arrow-left-CsL4cGlx.js";import{A as Vi}from"./arrow-right-ms3VXPTM.js";import{C as tn}from"./chevron-left-Brw18ZbJ.js";import{L as qi}from"./lock-D7AfKT4W.js";import{S as Xi}from"./SegmentedControl-CSSdDwVG.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"}]],In=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"}]],Mn=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 Gi=[["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"}]],Zi=X("battery-low",Gi);/**
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 Ji=[["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"}]],Qi=X("battery-warning",Ji);/**
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 er=[["path",{d:"M 22 14 L 22 10",key:"nqc4tb"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],tr=X("battery",er);/**
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 sr=[["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"}]],nr=X("box",sr);/**
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 ir=[["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"}]],rr=X("calendar-plus",ir);/**
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 ar=[["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"}]],or=X("case-sensitive",ar);/**
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 cr=[["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"}]],lr=X("circle-question-mark",cr);/**
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 dr=[["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"}]],sn=X("code-xml",dr);/**
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 ur=[["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"}]],mr=X("crosshair",ur);/**
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 fr=[["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"}]],hr=X("ellipsis",fr);/**
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 pr=[["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"}]],yr=X("grid-3x3",pr);/**
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 gr=[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]],xr=X("hand",gr);/**
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 vr=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],br=X("keyboard",vr);/**
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 wr=[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]],jr=X("library",wr);/**
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 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);/**
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 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);/**
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 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);/**
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 $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);/**
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 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);/**
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 Ir=[["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"}]],Mr=X("package",Ir);/**
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 Lr=[["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"}]],_r=X("panels-top-left",Lr);/**
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 Or=[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]],Pr=X("rectangle-horizontal",Or);/**
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 zr=[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]],Fr=X("rectangle-vertical",zr);/**
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 Br=[["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"}]],jt=X("rotate-cw",Br);/**
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 Wr=[["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"}]],Ur=X("scroll-text",Wr);/**
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 Hr=[["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"}]],nt=X("shield-alert",Hr);/**
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 Vr=[["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"}]],ws=X("sparkles",Vr);/**
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 qr=[["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"}]],Xr=X("tag",qr);/**
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 Kr=[["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"}]],cs=X("target",Kr);/**
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 Yr=[["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"}]],Gr=X("text-wrap",Yr);/**
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 Zr=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],Jr=X("thermometer",Zr);/**
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 Qr=[["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"}]],nn=X("touchpad",Qr);/**
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 ea=[["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"}]],ta=X("volume-1",ea);/**
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 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"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],na=X("volume-2",sa);/**
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 ia=[["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"}]],ra=X("wifi",ia),aa=["top","right","bottom","left"],Ve=Math.min,ve=Math.max,qt=Math.round,Pt=Math.floor,Ie=e=>({x:e,y:e}),oa={left:"right",right:"left",bottom:"top",top:"bottom"};function js(e,s,n){return ve(e,Ve(s,n))}function ze(e,s){return typeof e=="function"?e(s):e}function Fe(e){return e.split("-")[0]}function lt(e){return e.split("-")[1]}function _s(e){return e==="x"?"y":"x"}function Os(e){return e==="y"?"height":"width"}function De(e){const s=e[0];return s==="t"||s==="b"?"y":"x"}function Ps(e){return _s(De(e))}function ca(e,s,n){n===void 0&&(n=!1);const i=lt(e),r=Ps(e),a=Os(r);let c=r==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return s.reference[a]>s.floating[a]&&(c=Xt(c)),[c,Xt(c)]}function la(e){const s=Xt(e);return[Ns(e),s,Ns(s)]}function Ns(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const rn=["left","right"],an=["right","left"],da=["top","bottom"],ua=["bottom","top"];function ma(e,s,n){switch(e){case"top":case"bottom":return n?s?an:rn:s?rn:an;case"left":case"right":return s?da:ua;default:return[]}}function fa(e,s,n,i){const r=lt(e);let a=ma(Fe(e),n==="start",i);return r&&(a=a.map(c=>c+"-"+r),s&&(a=a.concat(a.map(Ns)))),a}function Xt(e){const s=Fe(e);return oa[s]+e.slice(s.length)}function ha(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ln(e){return typeof e!="number"?ha(e):{top:e,right:e,bottom:e,left:e}}function Kt(e){const{x:s,y:n,width:i,height:r}=e;return{width:i,height:r,top:n,left:s,right:s+i,bottom:n+r,x:s,y:n}}function on(e,s,n){let{reference:i,floating:r}=e;const a=De(s),c=Ps(s),l=Os(c),o=Fe(s),u=a==="y",m=i.x+i.width/2-r.width/2,f=i.y+i.height/2-r.height/2,h=i[l]/2-r[l]/2;let y;switch(o){case"top":y={x:m,y:i.y-r.height};break;case"bottom":y={x:m,y:i.y+i.height};break;case"right":y={x:i.x+i.width,y:f};break;case"left":y={x:i.x-r.width,y:f};break;default:y={x:i.x,y:i.y}}switch(lt(s)){case"start":y[c]-=h*(n&&u?-1:1);break;case"end":y[c]+=h*(n&&u?-1:1);break}return y}async function pa(e,s){var n;s===void 0&&(s={});const{x:i,y:r,platform:a,rects:c,elements:l,strategy:o}=e,{boundary:u="clippingAncestors",rootBoundary:m="viewport",elementContext:f="floating",altBoundary:h=!1,padding:y=0}=ze(s,e),g=Ln(y),v=l[h?f==="floating"?"reference":"floating":f],j=Kt(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(v)))==null||n?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:u,rootBoundary:m,strategy:o})),N=f==="floating"?{x:i,y:r,width:c.floating.width,height:c.floating.height}:c.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),x=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},R=Kt(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:N,offsetParent:w,strategy:o}):N);return{top:(j.top-R.top+g.top)/x.y,bottom:(R.bottom-j.bottom+g.bottom)/x.y,left:(j.left-R.left+g.left)/x.x,right:(R.right-j.right+g.right)/x.x}}const ya=50,ga=async(e,s,n)=>{const{placement:i="bottom",strategy:r="absolute",middleware:a=[],platform:c}=n,l=c.detectOverflow?c:{...c,detectOverflow:pa},o=await(c.isRTL==null?void 0:c.isRTL(s));let u=await c.getElementRects({reference:e,floating:s,strategy:r}),{x:m,y:f}=on(u,i,o),h=i,y=0;const g={};for(let b=0;b<a.length;b++){const v=a[b];if(!v)continue;const{name:j,fn:N}=v,{x:w,y:x,data:R,reset:$}=await N({x:m,y:f,initialPlacement:i,placement:h,strategy:r,middlewareData:g,rects:u,platform:l,elements:{reference:e,floating:s}});m=w??m,f=x??f,g[j]={...g[j],...R},$&&y<ya&&(y++,typeof $=="object"&&($.placement&&(h=$.placement),$.rects&&(u=$.rects===!0?await c.getElementRects({reference:e,floating:s,strategy:r}):$.rects),{x:m,y:f}=on(u,h,o)),b=-1)}return{x:m,y:f,placement:h,strategy:r,middlewareData:g}},xa=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 f=Ln(m),h={x:n,y:i},y=Ps(r),g=Os(y),b=await c.getDimensions(u),v=y==="y",j=v?"top":"left",N=v?"bottom":"right",w=v?"clientHeight":"clientWidth",x=a.reference[g]+a.reference[y]-h[y]-a.floating[g],R=h[y]-a.reference[y],$=await(c.getOffsetParent==null?void 0:c.getOffsetParent(u));let T=$?$[w]:0;(!T||!await(c.isElement==null?void 0:c.isElement($)))&&(T=l.floating[w]||a.floating[g]);const E=x/2-R/2,U=T/2-b[g]/2-1,I=Ve(f[j],U),_=Ve(f[N],U),B=I,C=T-b[g]-_,H=T/2-b[g]/2+E,K=js(B,H,C),F=!o.arrow&&lt(r)!=null&&H!==K&&a.reference[g]/2-(H<B?I:_)-b[g]/2<0,M=F?H<B?H-B:H-C:0;return{[y]:h[y]+M,data:{[y]:K,centerOffset:H-K-M,...F&&{alignmentOffset:M}},reset:F}}}),va=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(s){var n,i;const{placement:r,middlewareData:a,rects:c,initialPlacement:l,platform:o,elements:u}=s,{mainAxis:m=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:b=!0,...v}=ze(e,s);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const j=Fe(r),N=De(l),w=Fe(l)===l,x=await(o.isRTL==null?void 0:o.isRTL(u.floating)),R=h||(w||!b?[Xt(l)]:la(l)),$=g!=="none";!h&&$&&R.push(...fa(l,b,g,x));const T=[l,...R],E=await o.detectOverflow(s,v),U=[];let I=((i=a.flip)==null?void 0:i.overflows)||[];if(m&&U.push(E[j]),f){const H=ca(r,c,x);U.push(E[H[0]],E[H[1]])}if(I=[...I,{placement:r,overflows:U}],!U.every(H=>H<=0)){var _,B;const H=(((_=a.flip)==null?void 0:_.index)||0)+1,K=T[H];if(K&&(!(f==="alignment"?N!==De(K):!1)||I.every(k=>De(k.placement)===N?k.overflows[0]>0:!0)))return{data:{index:H,overflows:I},reset:{placement:K}};let F=(B=I.filter(M=>M.overflows[0]<=0).sort((M,k)=>M.overflows[1]-k.overflows[1])[0])==null?void 0:B.placement;if(!F)switch(y){case"bestFit":{var C;const M=(C=I.filter(k=>{if($){const Y=De(k.placement);return Y===N||Y==="y"}return!0}).map(k=>[k.placement,k.overflows.filter(Y=>Y>0).reduce((Y,re)=>Y+re,0)]).sort((k,Y)=>k[1]-Y[1])[0])==null?void 0:C[0];M&&(F=M);break}case"initialPlacement":F=l;break}if(r!==F)return{reset:{placement:F}}}return{}}}};function cn(e,s){return{top:e.top-s.height,right:e.right-s.width,bottom:e.bottom-s.height,left:e.left-s.width}}function ln(e){return aa.some(s=>e[s]>=0)}const ba=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=cn(c,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:ln(l)}}}case"escaped":{const c=await i.detectOverflow(s,{...a,altBoundary:!0}),l=cn(c,n.floating);return{data:{escapedOffsets:l,escaped:ln(l)}}}default:return{}}}}},_n=new Set(["left","top"]);async function wa(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=lt(n),o=De(n)==="y",u=_n.has(c)?-1:1,m=a&&o?-1:1,f=ze(s,e);let{mainAxis:h,crossAxis:y,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof g=="number"&&(y=l==="end"?g*-1:g),o?{x:y*m,y:h*u}:{x:h*u,y:y*m}}const ja=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 wa(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}}}}},Na=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:j=>{let{x:N,y:w}=j;return{x:N,y:w}}},...u}=ze(e,s),m={x:n,y:i},f=await a.detectOverflow(s,u),h=De(Fe(r)),y=_s(h);let g=m[y],b=m[h];if(c){const j=y==="y"?"top":"left",N=y==="y"?"bottom":"right",w=g+f[j],x=g-f[N];g=js(w,g,x)}if(l){const j=h==="y"?"top":"left",N=h==="y"?"bottom":"right",w=b+f[j],x=b-f[N];b=js(w,b,x)}const v=o.fn({...s,[y]:g,[h]:b});return{...v,data:{x:v.x-n,y:v.y-i,enabled:{[y]:c,[h]:l}}}}}},Ca=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},f=De(r),h=_s(f);let y=m[h],g=m[f];const b=ze(l,s),v=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(o){const w=h==="y"?"height":"width",x=a.reference[h]-a.floating[w]+v.mainAxis,R=a.reference[h]+a.reference[w]-v.mainAxis;y<x?y=x:y>R&&(y=R)}if(u){var j,N;const w=h==="y"?"width":"height",x=_n.has(Fe(r)),R=a.reference[f]-a.floating[w]+(x&&((j=c.offset)==null?void 0:j[f])||0)+(x?0:v.crossAxis),$=a.reference[f]+a.reference[w]+(x?0:((N=c.offset)==null?void 0:N[f])||0)-(x?v.crossAxis:0);g<R?g=R:g>$&&(g=$)}return{[h]:y,[f]:g}}}},Sa=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),f=Fe(r),h=lt(r),y=De(r)==="y",{width:g,height:b}=a.floating;let v,j;f==="top"||f==="bottom"?(v=f,j=h===(await(c.isRTL==null?void 0:c.isRTL(l.floating))?"start":"end")?"left":"right"):(j=f,v=h==="end"?"top":"bottom");const N=b-m.top-m.bottom,w=g-m.left-m.right,x=Ve(b-m[v],N),R=Ve(g-m[j],w),$=!s.middlewareData.shift;let T=x,E=R;if((n=s.middlewareData.shift)!=null&&n.enabled.x&&(E=w),(i=s.middlewareData.shift)!=null&&i.enabled.y&&(T=N),$&&!h){const I=ve(m.left,0),_=ve(m.right,0),B=ve(m.top,0),C=ve(m.bottom,0);y?E=g-2*(I!==0||_!==0?I+_:ve(m.left,m.right)):T=b-2*(B!==0||C!==0?B+C:ve(m.top,m.bottom))}await o({...s,availableWidth:E,availableHeight:T});const U=await c.getDimensions(l.floating);return g!==U.width||b!==U.height?{reset:{rects:!0}}:{}}}};function Jt(){return typeof window<"u"}function dt(e){return On(e)?(e.nodeName||"").toLowerCase():"#document"}function be(e){var s;return(e==null||(s=e.ownerDocument)==null?void 0:s.defaultView)||window}function Me(e){var s;return(s=(On(e)?e.ownerDocument:e.document)||window.document)==null?void 0:s.documentElement}function On(e){return Jt()?e instanceof Node||e instanceof be(e).Node:!1}function Ae(e){return Jt()?e instanceof Element||e instanceof be(e).Element:!1}function We(e){return Jt()?e instanceof HTMLElement||e instanceof be(e).HTMLElement:!1}function dn(e){return!Jt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof be(e).ShadowRoot}function kt(e){const{overflow:s,overflowX:n,overflowY:i,display:r}=Re(e);return/auto|scroll|overlay|hidden|clip/.test(s+i+n)&&r!=="inline"&&r!=="contents"}function ka(e){return/^(table|td|th)$/.test(dt(e))}function Qt(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Aa=/transform|translate|scale|rotate|perspective|filter/,Ra=/paint|layout|strict|content/,Ge=e=>!!e&&e!=="none";let ls;function zs(e){const s=Ae(e)?Re(e):e;return Ge(s.transform)||Ge(s.translate)||Ge(s.scale)||Ge(s.rotate)||Ge(s.perspective)||!Fs()&&(Ge(s.backdropFilter)||Ge(s.filter))||Aa.test(s.willChange||"")||Ra.test(s.contain||"")}function $a(e){let s=qe(e);for(;We(s)&&!ot(s);){if(zs(s))return s;if(Qt(s))return null;s=qe(s)}return null}function Fs(){return ls==null&&(ls=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ls}function ot(e){return/^(html|body|#document)$/.test(dt(e))}function Re(e){return be(e).getComputedStyle(e)}function es(e){return Ae(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function qe(e){if(dt(e)==="html")return e;const s=e.assignedSlot||e.parentNode||dn(e)&&e.host||Me(e);return dn(s)?s.host:s}function Pn(e){const s=qe(e);return ot(s)?e.ownerDocument?e.ownerDocument.body:e.body:We(s)&&kt(s)?s:Pn(s)}function Ct(e,s,n){var i;s===void 0&&(s=[]),n===void 0&&(n=!0);const r=Pn(e),a=r===((i=e.ownerDocument)==null?void 0:i.body),c=be(r);if(a){const l=Cs(c);return s.concat(c,c.visualViewport||[],kt(r)?r:[],l&&n?Ct(l):[])}else return s.concat(r,Ct(r,[],n))}function Cs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function zn(e){const s=Re(e);let n=parseFloat(s.width)||0,i=parseFloat(s.height)||0;const r=We(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 Bs(e){return Ae(e)?e:e.contextElement}function at(e){const s=Bs(e);if(!We(s))return Ie(1);const n=s.getBoundingClientRect(),{width:i,height:r,$:a}=zn(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 Ea=Ie(0);function Fn(e){const s=be(e);return!Fs()||!s.visualViewport?Ea:{x:s.visualViewport.offsetLeft,y:s.visualViewport.offsetTop}}function Ta(e,s,n){return s===void 0&&(s=!1),!n||s&&n!==be(e)?!1:s}function Qe(e,s,n,i){s===void 0&&(s=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),a=Bs(e);let c=Ie(1);s&&(i?Ae(i)&&(c=at(i)):c=at(e));const l=Ta(a,n,i)?Fn(a):Ie(0);let o=(r.left+l.x)/c.x,u=(r.top+l.y)/c.y,m=r.width/c.x,f=r.height/c.y;if(a){const h=be(a),y=i&&Ae(i)?be(i):i;let g=h,b=Cs(g);for(;b&&i&&y!==g;){const v=at(b),j=b.getBoundingClientRect(),N=Re(b),w=j.left+(b.clientLeft+parseFloat(N.paddingLeft))*v.x,x=j.top+(b.clientTop+parseFloat(N.paddingTop))*v.y;o*=v.x,u*=v.y,m*=v.x,f*=v.y,o+=w,u+=x,g=be(b),b=Cs(g)}}return Kt({width:m,height:f,x:o,y:u})}function ts(e,s){const n=es(e).scrollLeft;return s?s.left+n:Qe(Me(e)).left+n}function Bn(e,s){const n=e.getBoundingClientRect(),i=n.left+s.scrollLeft-ts(e,n),r=n.top+s.scrollTop;return{x:i,y:r}}function Da(e){let{elements:s,rect:n,offsetParent:i,strategy:r}=e;const a=r==="fixed",c=Me(i),l=s?Qt(s.floating):!1;if(i===c||l&&a)return n;let o={scrollLeft:0,scrollTop:0},u=Ie(1);const m=Ie(0),f=We(i);if((f||!f&&!a)&&((dt(i)!=="body"||kt(c))&&(o=es(i)),f)){const y=Qe(i);u=at(i),m.x=y.x+i.clientLeft,m.y=y.y+i.clientTop}const h=c&&!f&&!a?Bn(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+h.x,y:n.y*u.y-o.scrollTop*u.y+m.y+h.y}}function Ia(e){return Array.from(e.getClientRects())}function Ma(e){const s=Me(e),n=es(e),i=e.ownerDocument.body,r=ve(s.scrollWidth,s.clientWidth,i.scrollWidth,i.clientWidth),a=ve(s.scrollHeight,s.clientHeight,i.scrollHeight,i.clientHeight);let c=-n.scrollLeft+ts(e);const l=-n.scrollTop;return Re(i).direction==="rtl"&&(c+=ve(s.clientWidth,i.clientWidth)-r),{width:r,height:a,x:c,y:l}}const un=25;function La(e,s){const n=be(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=Fs();(!m||m&&s==="fixed")&&(l=r.offsetLeft,o=r.offsetTop)}const u=ts(i);if(u<=0){const m=i.ownerDocument,f=m.body,h=getComputedStyle(f),y=m.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,g=Math.abs(i.clientWidth-f.clientWidth-y);g<=un&&(a-=g)}else u<=un&&(a+=u);return{width:a,height:c,x:l,y:o}}function _a(e,s){const n=Qe(e,!0,s==="fixed"),i=n.top+e.clientTop,r=n.left+e.clientLeft,a=We(e)?at(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 mn(e,s,n){let i;if(s==="viewport")i=La(e,n);else if(s==="document")i=Ma(Me(e));else if(Ae(s))i=_a(s,n);else{const r=Fn(e);i={x:s.x-r.x,y:s.y-r.y,width:s.width,height:s.height}}return Kt(i)}function Wn(e,s){const n=qe(e);return n===s||!Ae(n)||ot(n)?!1:Re(n).position==="fixed"||Wn(n,s)}function Oa(e,s){const n=s.get(e);if(n)return n;let i=Ct(e,[],!1).filter(l=>Ae(l)&&dt(l)!=="body"),r=null;const a=Re(e).position==="fixed";let c=a?qe(e):e;for(;Ae(c)&&!ot(c);){const l=Re(c),o=zs(c);!o&&l.position==="fixed"&&(r=null),(a?!o&&!r:!o&&l.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||kt(c)&&!o&&Wn(e,c))?i=i.filter(m=>m!==c):r=l,c=qe(c)}return s.set(e,i),i}function Pa(e){let{element:s,boundary:n,rootBoundary:i,strategy:r}=e;const c=[...n==="clippingAncestors"?Qt(s)?[]:Oa(s,this._c):[].concat(n),i],l=mn(s,c[0],r);let o=l.top,u=l.right,m=l.bottom,f=l.left;for(let h=1;h<c.length;h++){const y=mn(s,c[h],r);o=ve(y.top,o),u=Ve(y.right,u),m=Ve(y.bottom,m),f=ve(y.left,f)}return{width:u-f,height:m-o,x:f,y:o}}function za(e){const{width:s,height:n}=zn(e);return{width:s,height:n}}function Fa(e,s,n){const i=We(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=ts(r)}if(i||!i&&!a)if((dt(s)!=="body"||kt(r))&&(l=es(s)),i){const y=Qe(s,!0,a,s);o.x=y.x+s.clientLeft,o.y=y.y+s.clientTop}else r&&u();a&&!i&&r&&u();const m=r&&!i&&!a?Bn(r,l):Ie(0),f=c.left+l.scrollLeft-o.x-m.x,h=c.top+l.scrollTop-o.y-m.y;return{x:f,y:h,width:c.width,height:c.height}}function ds(e){return Re(e).position==="static"}function fn(e,s){if(!We(e)||Re(e).position==="fixed")return null;if(s)return s(e);let n=e.offsetParent;return Me(e)===n&&(n=n.ownerDocument.body),n}function Un(e,s){const n=be(e);if(Qt(e))return n;if(!We(e)){let r=qe(e);for(;r&&!ot(r);){if(Ae(r)&&!ds(r))return r;r=qe(r)}return n}let i=fn(e,s);for(;i&&ka(i)&&ds(i);)i=fn(i,s);return i&&ot(i)&&ds(i)&&!zs(i)?n:i||$a(e)||n}const Ba=async function(e){const s=this.getOffsetParent||Un,n=this.getDimensions,i=await n(e.floating);return{reference:Fa(e.reference,await s(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Wa(e){return Re(e).direction==="rtl"}const Ua={convertOffsetParentRelativeRectToViewportRelativeRect:Da,getDocumentElement:Me,getClippingRect:Pa,getOffsetParent:Un,getElementRects:Ba,getClientRects:Ia,getDimensions:za,getScale:at,isElement:Ae,isRTL:Wa};function Hn(e,s){return e.x===s.x&&e.y===s.y&&e.width===s.width&&e.height===s.height}function Ha(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:f,width:h,height:y}=u;if(l||s(),!h||!y)return;const g=Pt(f),b=Pt(r.clientWidth-(m+h)),v=Pt(r.clientHeight-(f+y)),j=Pt(m),w={rootMargin:-g+"px "+-b+"px "+-v+"px "+-j+"px",threshold:ve(0,Ve(1,o))||1};let x=!0;function R($){const T=$[0].intersectionRatio;if(T!==o){if(!x)return c();T?c(!1,T):i=setTimeout(()=>{c(!1,1e-7)},1e3)}T===1&&!Hn(u,e.getBoundingClientRect())&&c(),x=!1}try{n=new IntersectionObserver(R,{...w,root:r.ownerDocument})}catch{n=new IntersectionObserver(R,w)}n.observe(e)}return c(!0),a}function Va(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=Bs(e),m=r||a?[...u?Ct(u):[],...s?Ct(s):[]]:[];m.forEach(j=>{r&&j.addEventListener("scroll",n,{passive:!0}),a&&j.addEventListener("resize",n)});const f=u&&l?Ha(u,n):null;let h=-1,y=null;c&&(y=new ResizeObserver(j=>{let[N]=j;N&&N.target===u&&y&&s&&(y.unobserve(s),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=y)==null||w.observe(s)})),n()}),u&&!o&&y.observe(u),s&&y.observe(s));let g,b=o?Qe(e):null;o&&v();function v(){const j=Qe(e);b&&!Hn(b,j)&&n(),b=j,g=requestAnimationFrame(v)}return n(),()=>{var j;m.forEach(N=>{r&&N.removeEventListener("scroll",n),a&&N.removeEventListener("resize",n)}),f==null||f(),(j=y)==null||j.disconnect(),y=null,o&&cancelAnimationFrame(g)}}const qa=ja,Xa=Na,Ka=va,Ya=Sa,Ga=ba,hn=xa,Za=Ca,Ja=(e,s,n)=>{const i=new Map,r={platform:Ua,...n},a={...r.platform,_c:i};return ga(e,s,{...r,platform:a})};var Qa=typeof document<"u",eo=function(){},Ut=Qa?d.useLayoutEffect:eo;function Yt(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(!Yt(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)&&!Yt(e[a],s[a]))return!1}return!0}return e!==e&&s!==s}function Vn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pn(e,s){const n=Vn(e);return Math.round(s*n)/n}function us(e){const s=d.useRef(e);return Ut(()=>{s.current=e}),s}function to(e){e===void 0&&(e={});const{placement:s="bottom",strategy:n="absolute",middleware:i=[],platform:r,elements:{reference:a,floating:c}={},transform:l=!0,whileElementsMounted:o,open:u}=e,[m,f]=d.useState({x:0,y:0,strategy:n,placement:s,middlewareData:{},isPositioned:!1}),[h,y]=d.useState(i);Yt(h,i)||y(i);const[g,b]=d.useState(null),[v,j]=d.useState(null),N=d.useCallback(k=>{k!==$.current&&($.current=k,b(k))},[]),w=d.useCallback(k=>{k!==T.current&&(T.current=k,j(k))},[]),x=a||g,R=c||v,$=d.useRef(null),T=d.useRef(null),E=d.useRef(m),U=o!=null,I=us(o),_=us(r),B=us(u),C=d.useCallback(()=>{if(!$.current||!T.current)return;const k={placement:s,strategy:n,middleware:h};_.current&&(k.platform=_.current),Ja($.current,T.current,k).then(Y=>{const re={...Y,isPositioned:B.current!==!1};H.current&&!Yt(E.current,re)&&(E.current=re,Rn.flushSync(()=>{f(re)}))})},[h,s,n,_,B]);Ut(()=>{u===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,f(k=>({...k,isPositioned:!1})))},[u]);const H=d.useRef(!1);Ut(()=>(H.current=!0,()=>{H.current=!1}),[]),Ut(()=>{if(x&&($.current=x),R&&(T.current=R),x&&R){if(I.current)return I.current(x,R,C);C()}},[x,R,C,I,U]);const K=d.useMemo(()=>({reference:$,floating:T,setReference:N,setFloating:w}),[N,w]),F=d.useMemo(()=>({reference:x,floating:R}),[x,R]),M=d.useMemo(()=>{const k={position:n,left:0,top:0};if(!F.floating)return k;const Y=pn(F.floating,m.x),re=pn(F.floating,m.y);return l?{...k,transform:"translate("+Y+"px, "+re+"px)",...Vn(F.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:re}},[n,l,F.floating,m.x,m.y]);return d.useMemo(()=>({...m,update:C,refs:K,elements:F,floatingStyles:M}),[m,C,K,F,M])}const so=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?hn({element:i.current,padding:r}).fn(n):{}:i?hn({element:i,padding:r}).fn(n):{}}}},no=(e,s)=>{const n=qa(e);return{name:n.name,fn:n.fn,options:[e,s]}},io=(e,s)=>{const n=Xa(e);return{name:n.name,fn:n.fn,options:[e,s]}},ro=(e,s)=>({fn:Za(e).fn,options:[e,s]}),ao=(e,s)=>{const n=Ka(e);return{name:n.name,fn:n.fn,options:[e,s]}},oo=(e,s)=>{const n=Ya(e);return{name:n.name,fn:n.fn,options:[e,s]}},co=(e,s)=>{const n=Ga(e);return{name:n.name,fn:n.fn,options:[e,s]}},lo=(e,s)=>{const n=so(e);return{name:n.name,fn:n.fn,options:[e,s]}};var uo="Arrow",qn=d.forwardRef((e,s)=>{const{children:n,width:i=10,height:r=5,...a}=e;return t.jsx(St.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"})})});qn.displayName=uo;var mo=qn;function fo(e){const[s,n]=d.useState(void 0);return Vt(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const a=r[0];let c,l;if("borderBoxSize"in a){const o=a.borderBoxSize,u=Array.isArray(o)?o[0]:o;c=u.inlineSize,l=u.blockSize}else c=e.offsetWidth,l=e.offsetHeight;n({width:c,height:l})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),s}var Ws="Popper",[Xn]=Is(Ws),[ho,Kn]=Xn(Ws),Yn=e=>{const{__scopePopper:s,children:n}=e,[i,r]=d.useState(null);return t.jsx(ho,{scope:s,anchor:i,onAnchorChange:r,children:n})};Yn.displayName=Ws;var Gn="PopperAnchor",Zn=d.forwardRef((e,s)=>{const{__scopePopper:n,virtualRef:i,...r}=e,a=Kn(Gn,n),c=d.useRef(null),l=Nt(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(St.div,{...r,ref:l})});Zn.displayName=Gn;var Us="PopperContent",[po,yo]=Xn(Us),Jn=d.forwardRef((e,s)=>{var O,S,G,Q,se,Ee;const{__scopePopper:n,side:i="bottom",sideOffset:r=0,align:a="center",alignOffset:c=0,arrowPadding:l=0,avoidCollisions:o=!0,collisionBoundary:u=[],collisionPadding:m=0,sticky:f="partial",hideWhenDetached:h=!1,updatePositionStrategy:y="optimized",onPlaced:g,...b}=e,v=Kn(Us,n),[j,N]=d.useState(null),w=Nt(s,de=>N(de)),[x,R]=d.useState(null),$=fo(x),T=($==null?void 0:$.width)??0,E=($==null?void 0:$.height)??0,U=i+(a!=="center"?"-"+a:""),I=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},_=Array.isArray(u)?u:[u],B=_.length>0,C={padding:I,boundary:_.filter(vo),altBoundary:B},{refs:H,floatingStyles:K,placement:F,isPositioned:M,middlewareData:k}=to({strategy:"fixed",placement:U,whileElementsMounted:(...de)=>Va(...de,{animationFrame:y==="always"}),elements:{reference:v.anchor},middleware:[no({mainAxis:r+E,alignmentAxis:c}),o&&io({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?ro():void 0,...C}),o&&ao({...C}),oo({...C,apply:({elements:de,rects:ye,availableWidth:Ue,availableHeight:He})=>{const{width:Le,height:ut}=ye.reference,_e=de.floating.style;_e.setProperty("--radix-popper-available-width",`${Ue}px`),_e.setProperty("--radix-popper-available-height",`${He}px`),_e.setProperty("--radix-popper-anchor-width",`${Le}px`),_e.setProperty("--radix-popper-anchor-height",`${ut}px`)}}),x&&lo({element:x,padding:l}),bo({arrowWidth:T,arrowHeight:E}),h&&co({strategy:"referenceHidden",...C})]}),[Y,re]=ei(F),fe=En(g);Vt(()=>{M&&(fe==null||fe())},[M,fe]);const $e=(O=k.arrow)==null?void 0:O.x,pe=(S=k.arrow)==null?void 0:S.y,he=((G=k.arrow)==null?void 0:G.centerOffset)!==0,[Ne,ee]=d.useState();return Vt(()=>{j&&ee(window.getComputedStyle(j).zIndex)},[j]),t.jsx("div",{ref:H.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:M?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ne,"--radix-popper-transform-origin":[(Q=k.transformOrigin)==null?void 0:Q.x,(se=k.transformOrigin)==null?void 0:se.y].join(" "),...((Ee=k.hide)==null?void 0:Ee.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(po,{scope:n,placedSide:Y,onArrowChange:R,arrowX:$e,arrowY:pe,shouldHideArrow:he,children:t.jsx(St.div,{"data-side":Y,"data-align":re,...b,ref:w,style:{...b.style,animation:M?void 0:"none"}})})})});Jn.displayName=Us;var Qn="PopperArrow",go={top:"bottom",right:"left",bottom:"top",left:"right"},xo=d.forwardRef(function(s,n){const{__scopePopper:i,...r}=s,a=yo(Qn,i),c=go[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(mo,{...r,ref:n,style:{...r.style,display:"block"}})})});xo.displayName=Qn;function vo(e){return e!==null}var bo=e=>({name:"transformOrigin",options:e,fn(s){var v,j,N;const{placement:n,rects:i,middlewareData:r}=s,c=((v=r.arrow)==null?void 0:v.centerOffset)!==0,l=c?0:e.arrowWidth,o=c?0:e.arrowHeight,[u,m]=ei(n),f={start:"0%",center:"50%",end:"100%"}[m],h=(((j=r.arrow)==null?void 0:j.x)??0)+l/2,y=(((N=r.arrow)==null?void 0:N.y)??0)+o/2;let g="",b="";return u==="bottom"?(g=c?f:`${h}px`,b=`${-o}px`):u==="top"?(g=c?f:`${h}px`,b=`${i.floating.height+o}px`):u==="right"?(g=`${-o}px`,b=c?f:`${y}px`):u==="left"&&(g=`${i.floating.width+o}px`,b=c?f:`${y}px`),{data:{x:g,y:b}}}});function ei(e){const[s,n="center"]=e.split("-");return[s,n]}var wo=Yn,jo=Zn,No=Jn,Co=Symbol.for("react.lazy"),Gt=vi[" use ".trim().toString()];function So(e){return typeof e=="object"&&e!==null&&"then"in e}function ti(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Co&&"_payload"in e&&So(e._payload)}function ko(e){const s=Ao(e),n=d.forwardRef((i,r)=>{let{children:a,...c}=i;ti(a)&&typeof Gt=="function"&&(a=Gt(a._payload));const l=d.Children.toArray(a),o=l.find($o);if(o){const u=o.props.children,m=l.map(f=>f===o?d.Children.count(u)>1?d.Children.only(null):d.isValidElement(u)?u.props.children:null:f);return t.jsx(s,{...c,ref:r,children:d.isValidElement(u)?d.cloneElement(u,void 0,m):null})}return t.jsx(s,{...c,ref:r,children:a})});return n.displayName=`${e}.Slot`,n}function Ao(e){const s=d.forwardRef((n,i)=>{let{children:r,...a}=n;if(ti(r)&&typeof Gt=="function"&&(r=Gt(r._payload)),d.isValidElement(r)){const c=To(r),l=Eo(a,r.props);return r.type!==d.Fragment&&(l.ref=i?$i(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 Ro=Symbol("radix.slottable");function $o(e){return d.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Ro}function Eo(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 To(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 Do=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Io=Do.reduce((e,s)=>{const n=ko(`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}},{}),Mo="Portal",si=d.forwardRef((e,s)=>{var l;const{container:n,...i}=e,[r,a]=d.useState(!1);Vt(()=>a(!0),[]);const c=n||r&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return c?bi.createPortal(t.jsx(Io.div,{...i,ref:s}),c):null});si.displayName=Mo;const Hs=({open:e,onClose:s,anchorRef:n,placement:i="bottom-end",children:r})=>{const a=d.useRef(null);if(d.useEffect(()=>{if(!e)return;const u=m=>{var f,h;e&&((f=a.current)!=null&&f.contains(m.target)||(h=n.current)!=null&&h.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(wo,{children:[t.jsx(jo,{virtualRef:n}),t.jsx(si,{children:t.jsx(Ei,{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(No,{ref:a,side:c,align:l,sideOffset:o,className:`popover popover-${i}`,role:"dialog",children:r})})})]})};function Lo(e){const s=e+"CollectionProvider",[n,i]=Is(s),[r,a]=n(s,{collectionRef:{current:null},itemMap:new Map}),c=b=>{const{scope:v,children:j}=b,N=ke.useRef(null),w=ke.useRef(new Map).current;return t.jsx(r,{scope:v,itemMap:w,collectionRef:N,children:j})};c.displayName=s;const l=e+"CollectionSlot",o=Qs(l),u=ke.forwardRef((b,v)=>{const{scope:j,children:N}=b,w=a(l,j),x=Nt(v,w.collectionRef);return t.jsx(o,{ref:x,children:N})});u.displayName=l;const m=e+"CollectionItemSlot",f="data-radix-collection-item",h=Qs(m),y=ke.forwardRef((b,v)=>{const{scope:j,children:N,...w}=b,x=ke.useRef(null),R=Nt(v,x),$=a(m,j);return ke.useEffect(()=>($.itemMap.set(x,{ref:x,...w}),()=>void $.itemMap.delete(x))),t.jsx(h,{[f]:"",ref:R,children:N})});y.displayName=m;function g(b){const v=a(e+"CollectionConsumer",b);return ke.useCallback(()=>{const N=v.collectionRef.current;if(!N)return[];const w=Array.from(N.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort(($,T)=>w.indexOf($.ref.current)-w.indexOf(T.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:u,ItemSlot:y},g,i]}var _o=d.createContext(void 0);function Oo(e){const s=d.useContext(_o);return e||s||"ltr"}var ms="rovingFocusGroup.onEntryFocus",Po={bubbles:!1,cancelable:!0},At="RovingFocusGroup",[Ss,ni,zo]=Lo(At),[Fo]=Is(At,[zo]),[Bo,Wo]=Fo(At),ii=d.forwardRef((e,s)=>t.jsx(Ss.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Ss.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(Uo,{...e,ref:s})})}));ii.displayName=At;var Uo=d.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:n,orientation:i,loop:r=!1,dir:a,currentTabStopId:c,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:o,onEntryFocus:u,preventScrollOnEntryFocus:m=!1,...f}=e,h=d.useRef(null),y=Nt(s,h),g=Oo(a),[b,v]=Di({prop:c,defaultProp:l??null,onChange:o,caller:At}),[j,N]=d.useState(!1),w=En(u),x=ni(n),R=d.useRef(!1),[$,T]=d.useState(0);return d.useEffect(()=>{const E=h.current;if(E)return E.addEventListener(ms,w),()=>E.removeEventListener(ms,w)},[w]),t.jsx(Bo,{scope:n,orientation:i,dir:g,loop:r,currentTabStopId:b,onItemFocus:d.useCallback(E=>v(E),[v]),onItemShiftTab:d.useCallback(()=>N(!0),[]),onFocusableItemAdd:d.useCallback(()=>T(E=>E+1),[]),onFocusableItemRemove:d.useCallback(()=>T(E=>E-1),[]),children:t.jsx(St.div,{tabIndex:j||$===0?-1:0,"data-orientation":i,...f,ref:y,style:{outline:"none",...e.style},onMouseDown:rt(e.onMouseDown,()=>{R.current=!0}),onFocus:rt(e.onFocus,E=>{const U=!R.current;if(E.target===E.currentTarget&&U&&!j){const I=new CustomEvent(ms,Po);if(E.currentTarget.dispatchEvent(I),!I.defaultPrevented){const _=x().filter(F=>F.focusable),B=_.find(F=>F.active),C=_.find(F=>F.id===b),K=[B,C,..._].filter(Boolean).map(F=>F.ref.current);oi(K,m)}}R.current=!1}),onBlur:rt(e.onBlur,()=>N(!1))})})}),ri="RovingFocusGroupItem",ai=d.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:n,focusable:i=!0,active:r=!1,tabStopId:a,children:c,...l}=e,o=Ti(),u=a||o,m=Wo(ri,n),f=m.currentTabStopId===u,h=ni(n),{onFocusableItemAdd:y,onFocusableItemRemove:g,currentTabStopId:b}=m;return d.useEffect(()=>{if(i)return y(),()=>g()},[i,y,g]),t.jsx(Ss.ItemSlot,{scope:n,id:u,focusable:i,active:r,children:t.jsx(St.span,{tabIndex:f?0:-1,"data-orientation":m.orientation,...l,ref:s,onMouseDown:rt(e.onMouseDown,v=>{i?m.onItemFocus(u):v.preventDefault()}),onFocus:rt(e.onFocus,()=>m.onItemFocus(u)),onKeyDown:rt(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){m.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const j=qo(v,m.orientation,m.dir);if(j!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=h().filter(x=>x.focusable).map(x=>x.ref.current);if(j==="last")w.reverse();else if(j==="prev"||j==="next"){j==="prev"&&w.reverse();const x=w.indexOf(v.currentTarget);w=m.loop?Xo(w,x+1):w.slice(x+1)}setTimeout(()=>oi(w))}}),children:typeof c=="function"?c({isCurrentTabStop:f,hasTabStop:b!=null}):c})})});ai.displayName=ri;var Ho={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Vo(e,s){return s!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function qo(e,s,n){const i=Vo(e.key,n);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return Ho[i]}function oi(e,s=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:s}),document.activeElement!==n))return}function Xo(e,s){return e.map((n,i)=>e[(s+i)%e.length])}var Ko=ii,Yo=ai;const xe=({icon:e,children:s,onClick:n,danger:i,disabled:r,checked:a,note:c,trailing:l})=>t.jsx(Yo,{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(Ze,{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})]})}),Go=()=>t.jsx("div",{className:"menu-divider",role:"separator"}),Vs=({children:e})=>t.jsx(Ko,{asChild:!0,orientation:"vertical",loop:!0,children:t.jsx("div",{className:"menu",role:"menu",children:e})}),Zo=[{label:"1 Hour",value:"1h"},{label:"2 Hours",value:"2h"},{label:"4 Hours",value:"4h"},{label:"8 Hours",value:"8h"}],Jo=({device:e,onClose:s,onReserved:n})=>{const[i,r]=d.useState(""),[a,c]=d.useState("1h"),[l,o]=d.useState(""),[u,m]=d.useState(!1),[f,h]=d.useState(null),[y,g]=d.useState(null),b=async()=>{if(!i.trim()){h("Please enter your name/ID");return}m(!0),h(null),g(null);try{const v=await W.reserveDevice(e.udid,e.host,i,a,l);v.success?(n(),s()):g(v.error||"Failed to reserve device")}catch(v){g(v.message||"An unexpected error occurred")}finally{m(!1)}};return t.jsx(Ms,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(rr,{size:16,className:"title-icon"}),"Reserve device"]}),footer:t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"btn-cancel",onClick:s,disabled:u,children:"Cancel"}),t.jsx("button",{className:"btn-reserve",onClick:b,disabled:u||!i.trim(),children:u?"Reserving...":"Confirm Reservation"})]}),children:t.jsxs("div",{className:"reservation-modal-body",children:[t.jsxs("div",{className:"device-id-badge",children:[t.jsx("span",{className:"label",children:"Device:"}),t.jsx("span",{className:"value",children:e.udid})]}),t.jsxs("p",{children:["Reserve ",t.jsx("strong",{children:e.name||e.udid})," for exclusive use. This will prevent CI sessions from using this device."]}),t.jsx(Wt,{label:t.jsxs(t.Fragment,{children:[t.jsx(wi,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Reserved by"]}),htmlFor:"reservation-reserved-by",error:f?t.jsxs(t.Fragment,{children:[t.jsx(Js,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),f]}):void 0,children:t.jsx("input",{id:"reservation-reserved-by",type:"text",className:"reservation-input",placeholder:"Enter your name or ID",value:i,onChange:v=>{r(v.target.value),f&&h(null)},disabled:u})}),t.jsx(Wt,{label:t.jsxs(t.Fragment,{children:[t.jsx(Ii,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--color-accent)"}}),"Duration"]}),children:t.jsx("div",{className:"duration-selector",children:Zo.map(v=>t.jsx("div",{className:`duration-option ${a===v.value?"active":""}`,onClick:()=>c(v.value),children:v.label},v.value))})}),t.jsx(Wt,{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:y?t.jsxs(t.Fragment,{children:[t.jsx(Js,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),y]}):void 0,children:t.jsx("input",{id:"reservation-reason",type:"text",className:"reservation-input",placeholder:"e.g., Debugging flaky login test",value:l,onChange:v=>o(v.target.value),disabled:u})})]})})},Qo=({device:e,onClose:s,onUpdated:n})=>{const{toast:i}=et(),[r,a]=d.useState(e.tags||[]),[c,l]=d.useState(""),[o,u]=d.useState(!1),m=d.useRef(null);d.useEffect(()=>{m.current&&m.current.focus()},[]);const f=()=>{const b=c.trim();b&&!r.includes(b)&&(a([...r,b]),l(""))},h=b=>{a(r.filter(v=>v!==b))},y=b=>{b.key==="Enter"&&f()},g=async()=>{u(!0);try{await W.updateDeviceTags(e.udid,e.host,r),n(),s()}catch(b){console.error("Failed to update tags",b),i("Error saving tags. Please try again.","error")}finally{u(!1)}};return t.jsx(Ms,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(Xr,{size:16,className:"title-icon"}),"Manage device tags"]}),footer:t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"btn-cancel",onClick:s,children:"Cancel"}),t.jsx("button",{className:"btn-save",onClick:g,disabled:o,children:o?"Saving...":"Apply Changes"})]}),children:t.jsxs("div",{className:"tag-modal-body",children:[t.jsxs("div",{className:"device-id-badge",children:[t.jsx("span",{className:"label",children:"Device:"}),t.jsx("span",{className:"value",children:e.udid})]}),t.jsx(Wt,{label:"Add new tag",description:"Press Enter to add multiple tags",htmlFor:"tag-input",children:t.jsxs("div",{className:"input-with-button",children:[t.jsx("input",{ref:m,id:"tag-input",type:"text",placeholder:"e.g. stable, team-a, ios-17",value:c,onChange:b=>l(b.target.value),onKeyDown:y}),t.jsx("button",{className:"add-inline-btn",onClick:f,disabled:!c.trim(),children:t.jsx(Tn,{size:16})})]})}),t.jsxs("div",{className:"tags-display-section",children:[t.jsx("label",{children:"Current Tags"}),t.jsx("div",{className:"tags-list",children:r.length>0?r.map(b=>t.jsxs("div",{className:"tag-pill-editable",children:[b,t.jsx("button",{className:"remove-tag",onClick:()=>h(b),children:t.jsx($s,{size:12})})]},b)):t.jsx("div",{className:"empty-tags",children:"No tags assigned to this device."})})]})]})})};function ec(e){return e>=50?"ready":e>=20?"warning":"error"}function tc(e){return e>=50?t.jsx(tr,{size:10}):e>=20?t.jsx(Zi,{size:10}):t.jsx(Qi,{size:10})}function sc(e){return e==="Normal"?"ready":e==="Critical"?"error":"warning"}const nc=({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(Bt,{tone:"neutral",title:"Device does not report battery or thermal data",children:[t.jsx(Mi,{size:10}),"No telemetry"]})}):t.jsxs("div",{className:"dc2-health",children:[n&&t.jsxs(Bt,{tone:ec(e.batteryLevel),title:`Battery ${e.batteryLevel}%`,children:[tc(e.batteryLevel),e.batteryLevel,"%"]}),i&&t.jsxs(Bt,{tone:sc(e.thermalStatus),title:`Thermal: ${e.thermalStatus}`,children:[t.jsx(Jr,{size:10}),e.thermalStatus]})]})},ic="/wd/hub";function rc(e){return e==="android"?"UiAutomator2":"XCUITest"}function ac(e){return e==="android"?"Android":e==="tvos"?"tvOS":"iOS"}function oc(e,s=ic){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 cc(e){const s={platformName:ac(e.platform),"appium:automationName":rc(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 lc(e){return JSON.stringify(cc(e),null,2)}const dc=/^([0-9a-f]{2}:){5}[0-9a-f]{2}$/i,uc=/^(?:\d{1,3}\.){3}\d{1,3}$/;function mc(e){const s=e.trim();return!s||dc.test(s)||!uc.test(s)?!1:s.split(".").every(n=>{const i=Number(n);return Number.isInteger(i)&&i>=0&&i<=255})}function fc(e){return e.ip&&mc(e.ip)?e.ip.trim():null}function hc(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 pc=(e,s)=>s===1?e:`${e}s`,yc=1e-7;function ci(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,f;if(s.colonNotation){m=n.length>0?":":"",f="";const h=u.includes(".")?u.split(".")[0].length:u.length,y=n.length>0?2:1;u="0".repeat(Math.max(0,y-h))+u}else m="",f=s.verbose?" "+pc(l,c):o;n.push(m+u+f)},a=hc(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 fs=6e4;function gc(e){return!Number.isFinite(e)||e<=0?"expiring":e<fs?"under 1m":ci(Math.floor(e/fs)*fs,{unitCount:2})}const xc=["ready","busy","reserved","maintenance","offline"];function qs(e,s){return e.offline?"offline":e.userBlocked?"maintenance":e.busy?"busy":e.reservedUntil&&s<e.reservedUntil?"reserved":"ready"}function li(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 vc(e,s,n){switch(li(e,s)){case"session":return e.sessionStartTime&&e.sessionStartTime>0&&n>e.sessionStartTime?`Test session · ${ci(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`${gc(e.reservedUntil-n)} left · by ${r}`}return null}function bc(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=li(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 Xs(e){var s;return((s=e.marketingName)==null?void 0:s.trim())||e.name}function wc(e){const s=[Ls(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 jc(e){return e.formFactor==="tablet"||e.formFactor==="tv"?e.formFactor:"phone"}const Nc={ready:"Ready",busy:"Busy",reserved:"Reserved",maintenance:"Maintenance",offline:"Offline"},Cc=({device:e})=>{const s={phone:xs,tablet:Li,tv:Ni}[jc(e)],n=e.deviceType==="emulator"||e.deviceType==="simulator";return t.jsx(s,{size:26,strokeWidth:1.5,strokeDasharray:n?"3 2":void 0})},Sc=({udid:e,currentTeamId:s,teams:n,onDone:i})=>{const{toast:r}=et(),[a,c]=d.useState(!1);async function l(o){c(!0);try{await W.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(Ds,{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))]})},kc=({device:e,reloadDevices:s,navigate:n,teams:i})=>{var H,K,F;const[r,a]=d.useState(!1),[c,l]=d.useState(!1),[o,u]=d.useState(!1),[m,f]=d.useState(!1),h=d.useRef(null),{me:y}=ji(),{toast:g}=et(),b=(y==null?void 0:y.role)==="ADMIN"||(y==null?void 0:y.role)==="SUPER_ADMIN",v=Date.now(),j=qs(e,v),N=j==="reserved",w=vc(e,y,v),x=bc(e,y),R=`dc2-reason-${e.udid}`,$=Xs(e),T=e.teamId?(i==null?void 0:i.get(e.teamId))??e.teamName??`Team ${e.teamId.slice(0,6)}`:null,E=oc(e.host),U=fc(e),I=async(M,k)=>{var Y;try{await((Y=navigator.clipboard)==null?void 0:Y.writeText(M)),g(k,"success")}catch{g("Failed to copy","error")}},_=async()=>{await W.releaseReservation(e.udid,e.host),s()},B=async()=>{await W.blockDevice(e.udid,e.host),s()},C=async()=>{await W.unblockDevice(e.udid,e.host),s()};return t.jsxs("div",{className:`dc2 dc2-${j}`,children:[t.jsxs("div",{className:`dc2-band dc2-band-${j}`,children:[t.jsxs("span",{className:"dc2-band-label",children:[t.jsx("span",{className:"dc2-band-dot","aria-hidden":!0}),Nc[j]]}),w&&t.jsx("span",{className:"dc2-band-activity",title:w,children:w})]}),t.jsxs("div",{className:`dc2-body${j==="offline"?" dc2-dim":""}`,children:[t.jsxs("div",{className:"dc2-head",children:[t.jsx("div",{className:"dc2-icon","aria-hidden":!0,children:t.jsx(Cc,{device:e})}),t.jsxs("div",{className:"dc2-id",children:[t.jsx("div",{className:"dc2-title",title:`${$}
187
+ ${e.udid}`,children:$}),t.jsx("div",{className:"dc2-subtitle",children:wc(e)})]})]}),t.jsxs("div",{className:"dc2-meta",children:[t.jsx(nc,{device:e}),o?t.jsx(Sc,{udid:e.udid,currentTeamId:e.teamId??null,teams:i??new Map,onDone:M=>{u(!1),M&&s()}}):T&&t.jsx(Bt,{tone:"accent",title:`Team: ${T}`,children:T}),(H=e.tags)==null?void 0:H.slice(0,2).map(M=>t.jsxs("span",{className:"dc2-tag",title:M,children:["#",M]},M)),(((K=e.tags)==null?void 0:K.length)||0)>2&&t.jsxs("span",{className:"dc2-tag",children:["+",(((F=e.tags)==null?void 0:F.length)||0)-2]})]})]}),t.jsxs("div",{className:"dc2-foot",children:[t.jsx(ie,{variant:"tonal",size:"sm",disabled:!x.enabled,"aria-describedby":x.enabled?void 0:R,onClick:()=>{x.enabled&&n(`/devices/${e.udid}/control`)},children:"Control"}),N?t.jsx(ie,{variant:"secondary",size:"sm",onClick:_,children:"Release"}):j==="ready"?t.jsx(ie,{variant:"secondary",size:"sm",onClick:()=>a(!0),children:"Reserve"}):null,!x.enabled&&t.jsx("span",{id:R,className:"dc2-unavailable",title:x.reason,children:x.reason}),t.jsx("span",{className:"dc2-spacer"}),t.jsx("button",{ref:h,type:"button",className:"dc2-more",onClick:()=>f(M=>!M),"aria-label":"More actions",children:t.jsx(hr,{size:14})}),t.jsx(Hs,{open:m,onClose:()=>f(!1),anchorRef:h,children:t.jsxs(Vs,{children:[t.jsx(xe,{icon:t.jsx(Te,{size:12}),onClick:()=>{f(!1),I(e.udid,"UDID copied")},children:"Copy UDID"}),E!=="—"&&t.jsx(xe,{icon:t.jsx(Te,{size:12}),onClick:()=>{f(!1),I(E,"Server URL copied")},children:"Copy server URL"}),U&&t.jsx(xe,{icon:t.jsx(Te,{size:12}),onClick:()=>{f(!1),I(U,"IP address copied")},children:"Copy IP address"}),t.jsx(xe,{icon:t.jsx(Te,{size:12}),onClick:()=>{f(!1),I(lc(e),"Session capabilities copied")},children:"Copy capabilities"}),b&&t.jsxs(t.Fragment,{children:[t.jsx(Go,{}),t.jsx(xe,{onClick:()=>{f(!1),l(!0)},children:"Manage tags…"}),t.jsx(xe,{onClick:()=>{f(!1),u(!0)},children:"Assign team…"}),t.jsx(xe,{onClick:()=>{f(!1),e.userBlocked?C():B()},children:e.userBlocked?"Exit maintenance":"Enter maintenance"})]})]})})]}),r&&t.jsx(Jo,{device:e,onClose:()=>a(!1),onReserved:()=>s()}),c&&t.jsx(Qo,{device:e,onClose:()=>l(!1),onUpdated:()=>s()})]})};function Ac(e){const s=Zt(),{search:n}=Es();return t.jsx(kc,{device:e.device,reloadDevices:e.reloadDevices,navigate:i=>s(`${i}${n}`),teams:e.teams})}class Rc extends ke.Component{constructor(){super(...arguments),this.state={teamsMap:new Map}}componentDidMount(){W.listTeams().then(s=>{this.setState({teamsMap:new Map(s.map(n=>[n.id,n.name]))})}).catch(()=>{})}render(){return t.jsx("div",{className:"device-explorer-card-container",children:ke.Children.toArray(this.props.devices.map(s=>t.jsx(Ac,{device:s,reloadDevices:this.props.reloadDevices,teams:this.state.teamsMap})))})}}var zt,$c=new Uint8Array(16);function Ec(){if(!zt&&(zt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!zt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return zt($c)}const Tc=/^(?:[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 Dc(e){return typeof e=="string"&&Tc.test(e)}var me=[];for(var hs=0;hs<256;++hs)me.push((hs+256).toString(16).substr(1));function Ic(e){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(me[e[s+0]]+me[e[s+1]]+me[e[s+2]]+me[e[s+3]]+"-"+me[e[s+4]]+me[e[s+5]]+"-"+me[e[s+6]]+me[e[s+7]]+"-"+me[e[s+8]]+me[e[s+9]]+"-"+me[e[s+10]]+me[e[s+11]]+me[e[s+12]]+me[e[s+13]]+me[e[s+14]]+me[e[s+15]]).toLowerCase();if(!Dc(n))throw TypeError("Stringified UUID is invalid");return n}function Mc(e,s,n){e=e||{};var i=e.random||(e.rng||Ec)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Ic(i)}const Lc=({onCommand:e,prompt:s="$",welcomeMessage:n="Interactive Shell (Restricted Mode)",platform:i})=>{const[r,a]=d.useState([{type:"system",content:n,timestamp:Date.now()},{type:"system",content:'Type "help" for allowed commands.',timestamp:Date.now()}]),[c,l]=d.useState(""),[o,u]=d.useState([]),[m,f]=d.useState(-1),[h,y]=d.useState(!1),g=d.useRef(null),b=d.useRef(null);d.useEffect(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[r]);const v=N=>{const w=N.trim();if((w.startsWith("{")||w.startsWith("["))&&(w.endsWith("}")||w.endsWith("]")))try{const x=JSON.parse(w);return JSON.stringify(x,null,2)}catch{}return N},j=async N=>{if(N.key==="Enter"&&!h){const w=c.trim();if(!w)return;if(l(""),a(x=>[...x,{type:"command",content:`${s} ${w}`,timestamp:Date.now()}]),u(x=>[...x,w]),f(-1),y(!0),w==="clear"){a([]),y(!1);return}if(w==="help"){let x="";i==="android"?x=`
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")&&(x=`
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(R=>[...R,{type:"output",content:x.trim(),timestamp:Date.now()}]),y(!1);return}try{const x=await e(w),R=v(x||"(No output)");a($=>[...$,{type:"output",content:R,timestamp:Date.now()}])}catch(x){a(R=>[...R,{type:"error",content:x.message||"Unknown error",timestamp:Date.now()}])}finally{y(!1),setTimeout(()=>{var x;return(x=b.current)==null?void 0:x.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);f(w),l(o[w])}}else if(N.key==="ArrowDown"&&(N.preventDefault(),m!==-1)){const w=m+1;w>=o.length?(f(-1),l("")):(f(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:[Ls(i)," shell"]}),t.jsx("div",{className:"terminal-actions",children:t.jsx("button",{className:"terminal-action-btn",onClick:()=>a([]),title:"Clear terminal",children:"CLEAR"})})]}),t.jsxs("div",{className:"terminal-history",ref:g,onClick:()=>{var N;return(N=b.current)==null?void 0:N.focus()},children:[r.map((N,w)=>t.jsx("div",{className:`terminal-line ${N.type}`,children:N.content},w)),h&&t.jsx("div",{className:"terminal-line system animate-pulse",children:"Executing command..."})]}),t.jsxs("div",{className:"terminal-input-area",children:[t.jsx("span",{className:"terminal-prompt",children:s}),t.jsx("input",{ref:b,className:"terminal-input",value:c,onChange:N=>l(N.target.value),onKeyDown:j,disabled:h,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 ct(e){var s;return((s=e.type)==null?void 0:s.split(".").pop())||e.type||""}function _c(e,s){const n=[];return Be(e,i=>{Pe(i,"content-desc","contentDescription","accessibilityId","name","label")===s&&n.push(i)}),n}function Oc(e,s){const n=[];return Be(e,i=>{Pe(i,"resource-id","resourceId","identifier")===s&&n.push(i)}),n}function ks(e,s){const n=[];return Be(e,i=>{(i.type===s||ct(i)===s)&&n.push(i)}),n}function Pc(e,s){const n=[];return Be(e,i=>{Pe(i,"name")===s&&n.push(i)}),n}function zc(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 Fc(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!==ct(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||ct(m)===c)&&(o+=1,o===l)){u=m;break}r=u}return r?[r]:[]}function Bc(e,s){const n=Fc(e,s);if(n!==null)return{kind:"matched",nodes:n};const i=zc(s);if(i){const r=[];return Be(e,a=>{if(i.tag&&a.type!==i.tag&&ct(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 Wc(e,s){const n=s.trim(),i=/^\*\*\/([A-Za-z_]\w*)\[`(\w+)\s*==\s*"([^"]*)"`\]$/.exec(n);if(i){const[,c,l,o]=i,u=[];return Be(e,m=>{if(m.type!==c&&ct(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||ct(m)===c)&&u.push(m)}),{kind:"matched",nodes:u[o-1]?[u[o-1]]:[]}}const a=/^\*\*\/([A-Za-z_]\w*)$/.exec(n);return a?ks(e,a[1]).length>0?{kind:"matched",nodes:ks(e,a[1])}:{kind:"matched",nodes:[]}:{kind:"unsupported",nodes:[],reason:"Multi-segment class chain — use a real driver to verify"}}function Uc(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 Hc(e,s,n){const i=s.toLowerCase();if(!n)return{kind:"matched",nodes:[]};switch(i){case"accessibility id":return{kind:"matched",nodes:_c(e,n)};case"id":return{kind:"matched",nodes:Oc(e,n)};case"class name":return{kind:"matched",nodes:ks(e,n)};case"name":return{kind:"matched",nodes:Pc(e,n)};case"xpath":return Bc(e,n);case"-ios class chain":return Wc(e,n);case"-ios predicate string":return Uc(e,n);default:return{kind:"unsupported",nodes:[],reason:`Strategy "${s}" not yet supported by snapshot matcher`}}}function gn(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 xn(e,s,n,i){var N,w,x,R,$,T,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"))||((x=e.type)==null?void 0:x.toLowerCase().includes("input"))||((R=e.type)==null?void 0:R.toLowerCase().includes("field"))||(($=e.type)==null?void 0:$.toLowerCase().includes("textfield")),u=((T=e.attributes)==null?void 0:T.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
+ `:"",f={"accessibility id":`~${a}`,id:s==="ios"?`-ios predicate string:label == "${a}"`:`android=new UiSelector().resourceId("${a}")`,xpath:`${a}`,"-ios predicate string":`-ios predicate string:${a}`,"-ios class chain":`-ios class chain:${a}`,"-android uiautomator":`android=${a}`},h={"accessibility id":`AppiumBy.accessibilityId("${a}")`,id:`AppiumBy.id("${a}")`,xpath:`AppiumBy.xpath("${a}")`,"-ios predicate string":`AppiumBy.iOSNsPredicateString("${a}")`,"-ios class chain":`AppiumBy.iOSClassChain("${a}")`,"-android uiautomator":`AppiumBy.androidUIAutomator("${a}")`,"class name":`AppiumBy.className("${a}")`},y={"accessibility id":`AppiumBy.ACCESSIBILITY_ID, "${a}"`,id:`AppiumBy.ID, "${a}"`,xpath:`AppiumBy.XPATH, "${a}"`,"-ios predicate string":`AppiumBy.IOS_PREDICATE, "${a}"`,"-ios class chain":`AppiumBy.IOS_CLASS_CHAIN, "${a}"`,"-android uiautomator":`AppiumBy.ANDROID_UIAUTOMATOR, '${a}'`,"class name":`AppiumBy.CLASS_NAME, "${a}"`},g=h[r.toLowerCase()],b=y[r.toLowerCase()],v=f[r.toLowerCase()];return n==="java"?g?`${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(${g});
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"?b?`${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(${b})
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"?v?`${m}// WebdriverIO 9.x + @wdio/appium-service
225
+ describe('${l} test', () => {
226
+ it('should interact with ${l}', async () => {
227
+ const element = await $('${v}');
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`:v?`${m}// WebdriverIO 9.x standalone
234
+ const element = await driver.$('${v}');
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 vn(e){var y,g,b,v,j,N,w,x,R,$,T;const s=(e.type||"").toLowerCase(),n=((y=e.attributes)==null?void 0:y.clickable)==="true"||((g=e.attributes)==null?void 0:g.clickable)===!0,i=((b=e.attributes)==null?void 0:b.enabled)!=="false"&&((v=e.attributes)==null?void 0:v.enabled)!==!1,r=((j=e.attributes)==null?void 0:j.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=((x=e.suggestedLocators)==null?void 0:x.find(E=>E.strategy==="accessibility id"||E.strategy==="id"))||((R=e.suggestedLocators)==null?void 0:R[0]),m=i?(($=e.rect)==null?void 0:$.width)===0||((T=e.rect)==null?void 0:T.height)===0?"⚠️ Zero-size element — may not be interactable":void 0:"⚠️ Element is disabled",f=a?` with text "${a.slice(0,30)}"`:"",h=`This is a ${l.toLowerCase()}${f}. ${n?"It can be tapped/clicked.":r?"It supports scrolling.":"It is a visual container."}${c>0?` Contains ${c} child element${c>1?"s":""}.`:""}`;return{role:l,description:h,interactable:n||i,bestLocator:u,warning:m,emoji:o}}function bn(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 Vc=({sessionId:e,udid:s,streamUrl:n,embedded:i=!1,overlayTarget:r=null,onModeChange:a})=>{var we,ce,le,Ke,Ye,ht,pt,yt,Lt,Gs;const[c,l]=d.useState(!0),[o,u]=d.useState(null),[m,f]=d.useState(null),[h,y]=d.useState(null),[g,b]=d.useState(null),[v,j]=d.useState(new Set(["/"])),[N,w]=d.useState(""),[x,R]=d.useState(null),[$,T]=d.useState("info"),[E,U]=d.useState("java"),[I,_]=d.useState(null),[B,C]=d.useState({width:0,height:0}),[H,K]=d.useState({width:0,height:0}),[F,M]=d.useState(!1),[k,Y]=d.useState("inspect");d.useEffect(()=>{a==null||a(k)},[k,a]);const[re,fe]=d.useState({}),[$e,pe]=d.useState({}),[he,Ne]=d.useState(null),[ee,O]=d.useState(null),[S,G]=d.useState(null),Q=d.useRef(null),se=d.useRef(null),Ee=d.useRef(null),de=d.useRef(null),ye=d.useCallback(()=>{var ge,je,Se;if(!Q.current)return;const p=Q.current.getBoundingClientRect(),A=p.width,L=p.height,D=(ge=o==null?void 0:o.hierarchy)==null?void 0:ge.rect;let q=((je=o==null?void 0:o.metadata)==null?void 0:je.screenWidth)||B.width||1,z=((Se=o==null?void 0:o.metadata)==null?void 0:Se.screenHeight)||B.height||1;D&&D.width>0&&D.height>0&&(q=D.width,z=D.height);const Z=q/z;let ne,te;A/L>Z?(te=L,ne=te*Z):(ne=A,te=ne/Z),K({width:ne,height:te})},[o,B]);d.useEffect(()=>(ye(),window.addEventListener("resize",ye),()=>window.removeEventListener("resize",ye)),[ye]),d.useEffect(()=>{s&&Le()},[s]),d.useEffect(()=>{if(!s)return;let p=!1;return W.getAppiumSession(s).then(A=>{p||O({sessionId:(A==null?void 0:A.sessionId)??null,basePath:(A==null?void 0:A.basePath)??""})}).catch(()=>{p||O({sessionId:null,basePath:""})}),()=>{p=!0}},[s]);const Ue=d.useCallback(async(p,A,L)=>{if(ee!=null&&ee.sessionId){Ne(p);try{const D=await W.verifyLocator(ee.basePath,ee.sessionId,{strategy:p,selector:A,action:L});pe(q=>({...q,[p]:D}))}catch(D){pe(q=>({...q,[p]:{found:!1,count:0,error:(D==null?void 0:D.message)||String(D)}}))}finally{Ne(null)}}},[ee]);d.useEffect(()=>{var p;if((p=h==null?void 0:h.suggestedLocators)!=null&&p.length){const A=h.suggestedLocators.find(L=>L.strategy==="accessibility id"||L.strategy==="id")||h.suggestedLocators[0];_(A)}else _(null);fe({}),pe({}),G(null)},[h]);const He=d.useCallback((p,A)=>{if(!(o!=null&&o.hierarchy))return;const L=Hc(o.hierarchy,p,A);fe(D=>({...D,[p]:L})),G(p)},[o]),Le=async()=>{if(s){l(!0),f(null);try{const p=await W.getInspectorSnapshot(s);if(!(p!=null&&p.hierarchy)){u(null),f((p==null?void 0:p.error)||"Failed to capture snapshot");return}u(p);const A=new Set(["/"]),L=(D,q)=>{var z;q<3&&(A.add(D.xpath),(z=D.children)==null||z.forEach(Z=>L(Z,q+1)))};L(p.hierarchy,0),j(A)}catch(p){u(null),f(p.message||"Failed to capture snapshot")}finally{l(!1)}}},ut=p=>{const{naturalWidth:A,naturalHeight:L}=p.currentTarget;C({width:A,height:L})},_e=()=>M(!0),tt=p=>{M(!1);const{naturalWidth:A,naturalHeight:L}=p.currentTarget;A>0&&L>0&&C({width:A,height:L})},Xe=n&&!F,Rt=p=>{if(k!=="interact"||!s)return;const A=p.currentTarget.getBoundingClientRect();de.current={x:p.clientX-A.left,y:p.clientY-A.top,time:Date.now()}},$t=async p=>{var Oe,xt,vt;if(k!=="interact"||!s||!de.current)return;const A=de.current,L=p.currentTarget.getBoundingClientRect(),D=p.clientX-L.left,q=p.clientY-L.top,z=Date.now()-A.time,Z=H.width,ne=H.height,te=(Oe=o==null?void 0:o.hierarchy)==null?void 0:Oe.rect;let ge=((xt=o==null?void 0:o.metadata)==null?void 0:xt.screenWidth)||B.width,je=((vt=o==null?void 0:o.metadata)==null?void 0:vt.screenHeight)||B.height;if(te&&te.width>0&&te.height>0&&(ge=te.width,je=te.height),!ge||!je||Z===0||ne===0)return;const Se=(_t,Zs)=>({x:Math.round(_t/Z*ge),y:Math.round(Zs/ne*je),px:_t/Z,py:Zs/ne}),ue=Se(A.x,A.y),gt=Se(D,q),st=Math.sqrt(Math.pow(D-A.x,2)+Math.pow(q-A.y,2));if(!(ue.px<0||ue.px>1||ue.py<0||ue.py>1)){try{z<500&&st<10?await W.tap(s,ue.x,ue.y):z>=500&&st<10?await W.touchAndHold(s,ue.x,ue.y,z):st>=10&&await W.swipe(s,ue.x,ue.y,gt.x,gt.y)}catch(_t){console.error("Interaction failed:",_t)}de.current=null}},ss=p=>{const A=new Set(v);A.has(p)?A.delete(p):A.add(p),j(A)},ns=()=>{const p=new Set,A=L=>{var D;p.add(L.xpath),(D=L.children)==null||D.forEach(A)};o!=null&&o.hierarchy&&A(o.hierarchy),j(p)},is=()=>j(new Set(["/"])),mt=(p,A)=>{navigator.clipboard.writeText(p),R(A),setTimeout(()=>R(null),2e3)},Et=p=>{var L;let A=1;return(L=p.children)==null||L.forEach(D=>A+=Et(D)),A},rs=p=>{if(!p)return[];const A={},L=D=>{var Z;const q=vn(D),z=q.role.replace(/\s*\(.*?\)\s*/,"");A[z]||(A[z]={emoji:q.emoji,count:0}),A[z].count+=1,(Z=D.children)==null||Z.forEach(L)};return L(p),Object.entries(A).map(([D,q])=>({role:D,emoji:q.emoji,count:q.count})).sort((D,q)=>q.count-D.count)},Tt=p=>p.xpath.split("/").filter(Boolean).slice(-3),Dt=(p,A=0)=>{var Se,ue,gt,st;if(!p)return null;const L=v.has(p.xpath),D=((Se=p.children)==null?void 0:Se.length)>0,q=(h==null?void 0:h.xpath)===p.xpath,z=(g==null?void 0:g.xpath)===p.xpath,Z=((ue=p.type)==null?void 0:ue.split(".").pop())||"Element",ne=p.label||((gt=p.attributes)==null?void 0:gt["content-desc"])||((st=p.attributes)==null?void 0:st["resource-id"])||p.name,te=typeof ne=="string"&&ne&&ne!==Z&&ne!==p.type?ne:null,ge=te||Z,je=!N||bn(p,N);if(!je&&!D)return null;if(N&&!je){const Oe=xt=>{var vt;return bn(xt,N)?!0:((vt=xt.children)==null?void 0:vt.some(Oe))||!1};if(!Oe(p))return null}return t.jsxs("div",{className:"tree-node",children:[t.jsxs("div",{className:`tree-item ${q?"selected":""} ${z&&!q?"hovered":""}`,onClick:()=>{y(p),T("info")},onMouseEnter:()=>b(p),onMouseLeave:()=>b(null),children:[t.jsx("div",{className:"tree-item-indent",style:{width:`${A*14}px`}}),D?t.jsx("button",{onClick:Oe=>{Oe.stopPropagation(),ss(p.xpath)},className:"tree-toggle",children:L?t.jsx(Ci,{size:11}):t.jsx(Pi,{size:11})}):t.jsx("span",{className:"tree-toggle-spacer"}),t.jsx(nr,{size:11,className:"tree-icon"}),t.jsx("span",{className:"tree-label",title:`${Z}${te?` — ${te}`:""}`,children:ge}),te&&t.jsx("span",{className:"tree-type-tag",title:Z,children:Z}),p.text&&t.jsxs("span",{className:"tree-text-preview",children:['"',p.text.slice(0,20),'"']}),D&&t.jsx("span",{className:"tree-badge",children:p.children.length})]}),L&&D&&t.jsx("div",{className:"tree-children",children:p.children.map(Oe=>Dt(Oe,A+1))})]},p.xpath)},ft=()=>{var D,q,z;const p=(D=o==null?void 0:o.hierarchy)==null?void 0:D.rect;if(p&&p.width>0&&p.height>0)return{w:p.width,h:p.height};const A=((q=o==null?void 0:o.metadata)==null?void 0:q.screenWidth)||B.width,L=((z=o==null?void 0:o.metadata)==null?void 0:z.screenHeight)||B.height;return A>0&&L>0?{w:A,h:L}:null},It=p=>{const A=ft();if(!A)return[];const L=[],{w:D,h:q}=A,z=(Z,ne)=>{var ge,je,Se;const te=!Z.children||Z.children.length===0;((ge=Z.rect)==null?void 0:ge.width)>0&&((je=Z.rect)==null?void 0:je.height)>0&&te&&L.push(t.jsx("div",{className:"omni-hit-area",style:{left:`${Z.rect.x/D*100}%`,top:`${Z.rect.y/q*100}%`,width:`${Z.rect.width/D*100}%`,height:`${Z.rect.height/q*100}%`,zIndex:ne},onClick:ue=>{ue.stopPropagation(),y(Z),T("info")},onMouseEnter:()=>b(Z),onMouseLeave:()=>b(null)},Z.xpath)),(Se=Z.children)==null||Se.forEach(ue=>z(ue,ne+1))};return o!=null&&o.hierarchy&&z(o.hierarchy,1),L},Mt=()=>{var z,Z,ne;if(!S||!B.width)return[];const p=re[S];if(!p||p.kind!=="matched"||p.nodes.length===0)return[];const A=(z=o==null?void 0:o.hierarchy)==null?void 0:z.rect;let L=((Z=o==null?void 0:o.metadata)==null?void 0:Z.screenWidth)||B.width,D=((ne=o==null?void 0:o.metadata)==null?void 0:ne.screenHeight)||B.height;A&&A.width>0&&A.height>0&&(L=A.width,D=A.height);const q=p.nodes.length===1?"omni-frame-match unique":"omni-frame-match multi";return p.nodes.filter(te=>te.rect&&te.rect.width>0&&te.rect.height>0).map((te,ge)=>t.jsx("div",{className:q,style:{left:`${te.rect.x/L*100}%`,top:`${te.rect.y/D*100}%`,width:`${te.rect.width/L*100}%`,height:`${te.rect.height/D*100}%`}},`match-${S}-${ge}`))},P=(p,A)=>{const L=ft();if(!(p!=null&&p.rect)||!L)return null;const{w:D,h:q}=L;return t.jsx("div",{className:`omni-frame-${A}`,style:{left:`${p.rect.x/D*100}%`,top:`${p.rect.y/q*100}%`,width:`${p.rect.width/D*100}%`,height:`${p.rect.height/q*100}%`}})},V=o!=null&&o.hierarchy?Et(o.hierarchy):0,J=h?vn(h):null,ae=o!=null&&o.hierarchy&&k==="inspect"?t.jsxs("div",{className:"omni-overlay",children:[It(o.hierarchy),Mt(),P(g,"hover"),P(h,"select")]}):null,Ce={stable:{icon:t.jsx(Ot,{size:10}),cls:"stable"},moderate:{icon:t.jsx(it,{size:10}),cls:"moderate"},fragile:{icon:t.jsx(nt,{size:10}),cls:"fragile"},"very-fragile":{icon:t.jsx(nt,{size:10}),cls:"very-fragile"}},oe=i&&(o!=null&&o.hierarchy)?rs(o.hierarchy):[];return t.jsxs("div",{className:`omni-inspector-container ${i?"omni-embedded":""}`,children:[i&&r&&ae?Rn.createPortal(ae,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:()=>Y("inspect"),title:"Inspection mode (highlight elements)",children:[t.jsx(en,{size:12}),t.jsx("span",{children:"Inspect"})]}),t.jsxs("button",{className:`omni-mode-btn ${k==="interact"?"active":""}`,onClick:()=>Y("interact"),title:"Interaction mode (direct control)",children:[t.jsx(nn,{size:12}),t.jsx("span",{children:"Interact"})]})]})]}),t.jsxs("button",{className:"omni-refresh-btn",onClick:Le,disabled:c,children:[t.jsx(jt,{size:12,className:c?"animate-spin":""}),c?"Capturing...":"Refresh"]})]}),t.jsxs("div",{className:"omni-screenshot-container",ref:Q,children:[c&&!Xe&&t.jsxs("div",{className:"omni-loading-overlay",children:[t.jsx("div",{className:"omni-spinner"}),t.jsx("span",{children:"Capturing screen..."})]}),!o&&!c&&!Xe&&t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(cs,{size:40}),t.jsx("span",{children:"Click Refresh to capture"})]}),Xe&&t.jsxs("div",{className:`omni-screenshot-wrapper ${k==="interact"?"interactable":""}`,onMouseDown:Rt,onMouseUp:$t,children:[t.jsx("img",{ref:Ee,src:n,onLoad:tt,onError:_e,className:"omni-screenshot-img",style:k==="interact"?{pointerEvents:"none"}:{},draggable:!1,alt:"Live Device Stream"}),ae]}),!Xe&&(o==null?void 0:o.screenshot)&&t.jsxs("div",{className:`omni-screenshot-wrapper ${k==="interact"?"interactable":""}`,onMouseDown:Rt,onMouseUp:$t,children:[t.jsx("img",{ref:se,src:`data:image/png;base64,${o.screenshot}`,onLoad:ut,className:"omni-screenshot-img",style:k==="interact"?{pointerEvents:"none"}:{},draggable:!1}),k==="inspect"&&t.jsxs("div",{className:"omni-overlay",children:[It(o.hierarchy),Mt(),P(g,"hover"),P(h,"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(Oi,{size:14}),t.jsx("span",{children:"Source"}),V>0&&t.jsxs("span",{className:"omni-count-badge",children:[V," 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:ns,className:"omni-action-btn",title:"Expand all",children:t.jsx(yr,{size:12})}),t.jsx("button",{onClick:is,className:"omni-action-btn",title:"Collapse all",children:t.jsx(_r,{size:12})}),i&&t.jsxs(t.Fragment,{children:[t.jsx("button",{onClick:()=>Y(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(en,{size:12}):t.jsx(nn,{size:12})}),t.jsx("button",{onClick:Le,className:"omni-action-btn",title:c?"Capturing…":"Refresh snapshot",disabled:c,children:t.jsx(jt,{size:12,className:c?"animate-spin":""})})]})]})]}),m&&!c&&t.jsxs("div",{className:"omni-tree-error",role:"alert",children:[t.jsx(nt,{size:12}),t.jsx("span",{children:m}),t.jsx("button",{type:"button",onClick:Le,className:"omni-tree-error-retry",children:"Retry"})]}),t.jsxs("div",{className:"omni-tree-search",children:[t.jsx(Ts,{size:14}),t.jsx("input",{type:"text",placeholder:"Search elements... (try 'login button' or 'text field')",value:N,onChange:p=>w(p.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(ws,{size:10}),' Smart search active — try "button", "input", "image"']}),t.jsx("div",{className:"omni-tree-content",children:o!=null&&o.hierarchy?Dt(o.hierarchy):t.jsx("div",{className:"omni-empty-state small",children:t.jsx("span",{children:"No hierarchy loaded"})})})]}),t.jsxs("div",{className:"omni-details-panel",children:[t.jsxs("div",{className:"omni-details-tabs",role:"tablist",children:[t.jsxs("button",{className:`omni-details-tab ${$==="info"?"active":""}`,onClick:()=>T("info"),role:"tab","aria-selected":$==="info",children:[t.jsx(Rr,{size:12})," ",t.jsx("span",{children:"Info"})]}),t.jsxs("button",{className:`omni-details-tab ${$==="insight"?"active":""}`,onClick:()=>T("insight"),disabled:!h,title:"AI element analysis",role:"tab","aria-selected":$==="insight",children:[t.jsx(Cr,{size:12})," ",t.jsx("span",{children:"AI Insight"})]}),t.jsxs("button",{className:`omni-details-tab ${$==="code"?"active":""}`,onClick:()=>T("code"),disabled:!h,title:"Generate test code",role:"tab","aria-selected":$==="code",children:[t.jsx(sn,{size:12})," ",t.jsx("span",{children:"Code Gen"})]})]}),t.jsx("div",{className:"omni-details-content",children:h?t.jsxs(t.Fragment,{children:[$==="info"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Element Info"}),t.jsxs("div",{className:"omni-info-table",children:[t.jsxs("div",{className:"omni-info-row",children:[t.jsx("span",{className:"omni-info-key",children:"Type"}),t.jsx("span",{className:"omni-info-value mono",children:h.type})]}),h.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:h.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:Tt(h).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(p=>t.jsxs("div",{className:"omni-layout-item",children:[t.jsx("span",{className:"omni-layout-label",children:p.toUpperCase()}),t.jsx("span",{className:"omni-layout-value",children:h.rect[p]})]},p))})]}),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:[!((le=h.suggestedLocators)!=null&&le.length)&&t.jsx("div",{className:"omni-locators-empty",children:h===(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."}),(Ke=h.suggestedLocators)==null?void 0:Ke.map(p=>{const A=gn(p.strategy,p.value),L=Ce[A.level],D=re[p.strategy];let q=null;return D&&(D.kind==="unsupported"?q=t.jsxs("span",{className:"omni-match-badge unsupported",title:D.reason||"Cannot evaluate without a real driver",children:[t.jsx(lr,{size:10})," preview unavailable"]}):D.nodes.length===0?q=t.jsxs("span",{className:"omni-match-badge zero",title:"No element matches this selector in the current snapshot",children:[t.jsx(nt,{size:10})," 0 matches"]}):D.nodes.length===1?q=t.jsxs("span",{className:"omni-match-badge unique",title:"Selector is unique in the current snapshot",children:[t.jsx(Ot,{size:10})," unique"]}):q=t.jsxs("span",{className:"omni-match-badge multi",title:`${D.nodes.length} elements match — selector is not unique`,children:[t.jsx(it,{size:10})," ",D.nodes.length," matches"]})),t.jsxs("div",{className:`omni-locator-row ${(I==null?void 0:I.strategy)===p.strategy?"selected-for-code":""}`,onClick:()=>_(p),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:p.strategy}),t.jsxs("span",{className:`omni-stability-badge ${L.cls}`,title:A.reason,children:[L.icon,A.level]}),q]}),t.jsx("code",{className:"omni-locator-value",children:p.value}),t.jsx("span",{className:"omni-stability-reason",children:A.reason}),(()=>{const z=$e[p.strategy];return z?z.error?t.jsxs("span",{className:"omni-verify-line is-error",children:[t.jsx(nt,{size:10})," Appium error: ",z.error]}):z.found?z.count>1?t.jsxs("span",{className:"omni-verify-line is-warn",children:[t.jsx(it,{size:10})," Ambiguous — Appium found"," ",z.count," elements",z.actionError?` · ${z.actionError}`:""]}):t.jsxs("span",{className:"omni-verify-line is-ok",children:[t.jsx(Ot,{size:10})," Appium found 1 element",z.elapsedMs!=null?` in ${z.elapsedMs}ms`:"",z.actionPerformed&&z.actionPerformed!=="none"?` · ${z.actionPerformed} ok`:"",z.actionError?` · action failed: ${z.actionError}`:""]}):t.jsxs("span",{className:"omni-verify-line is-error",children:[t.jsx(nt,{size:10})," Appium found 0 elements"]}):null})()]}),t.jsxs("div",{className:"omni-locator-actions",children:[t.jsx("button",{type:"button",onClick:z=>{z.stopPropagation(),He(p.strategy,p.value)},className:`omni-test-btn ${S===p.strategy?"active":""}`,title:"Test this locator against the current snapshot",children:t.jsx(mr,{size:12})}),t.jsx("button",{type:"button",disabled:!(ee!=null&&ee.sessionId)||he===p.strategy,onClick:z=>{z.stopPropagation(),Ue(p.strategy,p.value,"none")},className:"omni-test-btn",title:ee!=null&&ee.sessionId?"Verify with Appium — does the driver actually find this?":"Needs an active Appium session on this device",children:he===p.strategy?t.jsx(jt,{size:12,className:"animate-spin"}):t.jsx(Ot,{size:12})}),t.jsx("button",{type:"button",disabled:!(ee!=null&&ee.sessionId)||he===p.strategy,onClick:z=>{z.stopPropagation(),Ue(p.strategy,p.value,"tap")},className:"omni-test-btn",title:ee!=null&&ee.sessionId?"Find with Appium and tap the element it returns":"Needs an active Appium session on this device",children:t.jsx(vs,{size:12})}),t.jsx("button",{onClick:z=>{z.stopPropagation(),mt(p.value,p.strategy)},className:`omni-copy-btn ${x===p.strategy?"copied":""}`,children:x===p.strategy?t.jsx(Ze,{size:12}):t.jsx(Te,{size:12})})]})]},p.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(h.attributes||{}).filter(([p,A])=>A!=null&&A!=="").map(([p,A])=>t.jsxs("div",{className:"omni-attr-row",children:[t.jsx("span",{className:"omni-attr-key",children:p}),t.jsx("span",{className:"omni-attr-value",children:String(A)})]},p))})]})]}),$==="insight"&&J&&t.jsxs("div",{className:"omni-insight-panel",children:[t.jsxs("div",{className:"omni-insight-role",children:[t.jsx("span",{className:"omni-insight-emoji",children:J.emoji}),t.jsxs("div",{children:[t.jsx("div",{className:"omni-insight-role-name",children:J.role}),t.jsx("div",{className:"omni-insight-interactable",children:J.interactable?t.jsxs("span",{className:"omni-badge-green",children:[t.jsx(vs,{size:10})," Interactable"]}):t.jsx("span",{className:"omni-badge-gray",children:"Visual Only"})})]})]}),J.warning&&t.jsx("div",{className:"omni-insight-warning",children:J.warning}),t.jsxs("div",{className:"omni-insight-description",children:[t.jsx(ws,{size:12,className:"omni-insight-icon"}),t.jsx("p",{children:J.description})]}),J.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:J.bestLocator.strategy}),t.jsx("code",{className:"omni-locator-value",children:J.bestLocator.value})]}),t.jsx("button",{onClick:()=>mt(J.bestLocator.value,"best"),className:`omni-copy-btn ${x==="best"?"copied":""}`,children:x==="best"?t.jsx(Ze,{size:12}):t.jsx(Te,{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:(Ye=h.attributes)==null?void 0:Ye.clickable},{label:"Enabled",value:(ht=h.attributes)==null?void 0:ht.enabled},{label:"Scrollable",value:(pt=h.attributes)==null?void 0:pt.scrollable},{label:"Focusable",value:(yt=h.attributes)==null?void 0:yt.focusable},{label:"Children",value:((Lt=h.children)==null?void 0:Lt.length)||0}].map(({label:p,value:A})=>t.jsxs("div",{className:"omni-quick-fact-row",children:[t.jsx("span",{className:"omni-quick-fact-label",children:p}),t.jsx("span",{className:`omni-quick-fact-value ${A==="true"||A===!0?"true":""}`,children:String(A??"—")})]},p))})]})]}),$==="code"&&t.jsxs("div",{className:"omni-codegen-panel",children:[t.jsx("div",{className:"omni-codegen-frameworks",children:["java","python","javascript","wdio"].map(p=>t.jsx("button",{className:`omni-fw-btn ${E===p?"active":""}`,onClick:()=>U(p),children:p==="java"?"☕ Java":p==="python"?"🐍 Python":p==="javascript"?"🟨 JS":"🔷 WD.io"},p))}),I?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(Ds,{selectSize:"sm",value:I.strategy,onChange:p=>{var L;const A=(L=h.suggestedLocators)==null?void 0:L.find(D=>D.strategy===p.target.value);A&&_(A)},className:"flex-1",children:(Gs=h.suggestedLocators)==null?void 0:Gs.map(p=>t.jsxs("option",{value:p.strategy,children:[p.strategy," — ",gn(p.strategy,p.value).level]},p.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:()=>mt(xn(h,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",E,I),"code"),children:x==="code"?t.jsx(Ze,{size:12}):t.jsx(Te,{size:12})})]}),t.jsx("pre",{className:"omni-codegen-pre theme-dark",children:t.jsx("code",{children:xn(h,(o==null?void 0:o.platform)==="android"?"android":(o==null?void 0:o.platform)==="ios"?"ios":"unknown",E,I)})})]})]}):t.jsxs("div",{className:"omni-empty-state small",children:[t.jsx(sn,{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(cs,{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:V})]}),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:((we=o.metadata)==null?void 0:we.screenWidth)??B.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:((ce=o.metadata)==null?void 0:ce.screenHeight)??B.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||"—"})]})]})]}),oe.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:oe.slice(0,8).map(p=>t.jsxs("div",{className:"omni-summary-role",children:[t.jsx("span",{className:"omni-summary-role__emoji",children:p.emoji}),t.jsx("span",{className:"omni-summary-role__name",children:p.role}),t.jsx("span",{className:"omni-summary-role__count",children:p.count})]},p.role))})]})]}):t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(cs,{size:32}),t.jsx("span",{children:c?"Capturing snapshot…":"Select an element from the tree or screenshot"})]})})]})]})]})},wn=5e3;function qc(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,wn);return}try{const m=await W.getDisplayState(e);l((m==null?void 0:m.state)??"unknown")}catch{}a||(c=setTimeout(o,wn))}};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 jn=5e3,Xc=500,Kc=1e4,Yc=10,Gc=50;function Zc(e,s,n){const i=`${((n==null?void 0:n.levels)??[]).join(",")}|${(n==null?void 0:n.process)??""}`,[r,a]=d.useState([]),[c,l]=d.useState(!1),[o,u]=d.useState(null),[m,f]=d.useState(!1),h=d.useRef(null),y=d.useRef(0),g=d.useRef(void 0),b=d.useRef(()=>{}),v=d.useRef([]),j=d.useRef(void 0),N=d.useRef(0),w=d.useRef(void 0),x=d.useCallback(()=>{if(v.current.length===0)return;const E=v.current;v.current=[],a(U=>{const I=U.concat(E);return I.length>jn?I.slice(-jn):I})},[]),R=d.useCallback(()=>{j.current===void 0&&(j.current=window.setTimeout(()=>{j.current=void 0,x()},Gc))},[x]),$=d.useCallback(()=>{v.current=[],a([])},[]);d.useEffect(()=>{if(!s){l(!1),u(null),f(!1);return}u(null),f(!1),y.current=0;const E={cancelled:!1},U=()=>{if(E.cancelled)return;if(y.current>=Yc){f(!0);return}const _=Math.min(Xc*2**y.current,Kc);y.current+=1,g.current=window.setTimeout(I,_)},I=async()=>{if(!E.cancelled)try{const _=await fetch(`/xenon/api/control/${encodeURIComponent(e)}/stream/ticket`,{method:"POST",credentials:"include"});if(E.cancelled)return;if(!_.ok){U();return}const{ticket:B}=await _.json();if(E.cancelled)return;if(!B){U();return}const C=window.location.protocol==="https:"?"wss":"ws",[H,K]=i.split("|"),F=(H?`&levels=${encodeURIComponent(H)}`:"")+(K?`&process=${encodeURIComponent(K)}`:""),M=new WebSocket(`${C}://${window.location.host}/xenon/api/control/${encodeURIComponent(e)}/logcat?ticket=${encodeURIComponent(B)}${F}`);h.current=M,M.onopen=()=>{y.current=0,w.current!==1012&&(v.current=[],a([])),w.current=void 0,l(!0)},M.onmessage=k=>{try{const Y=JSON.parse(k.data);v.current.push({...Y,seq:N.current++}),R()}catch{}},M.onclose=k=>{if(l(!1),w.current=k.code,x(),k.code===1008){E.cancelled=!0,u(k.reason||"access denied");return}if(k.code===1012){U();return}console.warn(`[logcat] WS closed unexpectedly (code ${k.code}) — retrying`),U()},M.onerror=()=>M.close()}catch{U()}};return b.current=()=>{E.cancelled=!1,y.current=0,u(null),f(!1),I()},I(),()=>{var _;E.cancelled=!0,g.current!==void 0&&window.clearTimeout(g.current),j.current!==void 0&&(window.clearTimeout(j.current),j.current=void 0),x(),(_=h.current)==null||_.close(),h.current=null}},[e,s,i,x,R]);const T=d.useCallback(()=>{b.current()},[]);return{records:r,connected:c,clear:$,deniedReason:o,exhausted:m,retry:T}}const As=["V","D","I","W","E","F"];function Jc(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 di(e,s={}){const n=s.caseSensitive===!0,i=c=>n?c:c.toLowerCase(),r=n?{caseSensitive:!0}:{},a=[];for(const c of Jc(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 Qc(e,s){if(e.synthetic)return!0;if(s.minLevel){const i=As.indexOf(s.minLevel),r=As.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 el(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 ps=[{ios:"Debug",android:"D"},{ios:"Info",android:"I"},{ios:"Default",android:"I"},{ios:"Error",android:"E"},{ios:"Fault",android:"F"}],Nn=["V","D","I","W","E","F"];function tl(e){if(!e)return ps.filter(n=>n.ios!=="Debug").map(n=>n.ios);const s=Nn.indexOf(e.toUpperCase());return s<0?ps.map(n=>n.ios):ps.filter(n=>Nn.indexOf(n.android)>=s).map(n=>n.ios)}function sl(e){const s=di(e,{caseSensitive:!0});return{levels:tl(s.minLevel),process:s.pkg||void 0}}const Cn=["#7dd3fc","#c4b5fd","#5eead4","#f0abfc","#93c5fd","#a5b4fc","#67e8f9","#d8b4fe","#f9a8d4","#99f6e4","#bae6fd","#e9d5ff"];function nl(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 il(e){return e?Cn[nl(e)%Cn.length]:"var(--text-muted)"}const Rs=5e5;function ui(e){return`${new Date(e.ts).toISOString()} ${e.pid} ${e.level}/${e.tag}: ${e.message}`}function rl(e){return{lines:[],startedAt:e,dropped:0}}function al(e,s){for(const n of s){if(e.lines.length>=Rs){e.dropped+=1;continue}e.lines.push(ui(n))}return e}function ol(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 ${Rs}-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 ${Rs}) ---`:"";return`${i.join(`
241
+ `)}
242
+
243
+ ${r}${a}
244
+ `}function cl(e,s){const n=new Date(s).toISOString().replace(/[:.]/g,"-").replace(/Z$/,"");return`logcat-${e}-${n}.txt`}const Sn=As.filter(e=>e!=="V").map(e=>({value:e,label:e==="F"?"F only":`${e} and above`})),ll=new Intl.DateTimeFormat([],{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function kn(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 dl=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:ll.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:il(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 ul({udid:e,platform:s}){const n=(s||"").toLowerCase(),i=n==="ios",r=n==="android"||i,[a,c]=d.useState(""),l=d.useMemo(()=>i?sl(a):void 0,[i,a]),{records:o,connected:u,clear:m,deniedReason:f,exhausted:h,retry:y}=Zc(e,r,l),[g,b]=d.useState(!0),[v,j]=d.useState(!1),[N,w]=d.useState(!0),[x,R]=d.useState(""),[$,T]=d.useState(0),E=d.useRef(null),U=d.useRef(null),I=d.useRef(null),[_,B]=d.useState(!1),[C,H]=d.useState(0),K=d.useRef(-1),F=d.useMemo(()=>di(a,{caseSensitive:v}),[a,v]),M=d.useMemo(()=>o.filter(O=>Qc(O,F)),[o,F]),k=d.useMemo(()=>{if(!x)return[];const O=v?x:x.toLowerCase(),S=[];return M.forEach((G,Q)=>{(v?`${G.tag} ${G.message}`:`${G.tag} ${G.message}`.toLowerCase()).includes(O)&&S.push(Q)}),S},[M,x,v]),Y=k.length?Math.min($,k.length-1):0,re=d.useMemo(()=>new Set(k),[k]),fe=d.useCallback(O=>{var G,Q;if(!k.length)return;const S=(Y+O+k.length)%k.length;T(S),b(!1),(Q=(G=U.current)==null?void 0:G.querySelector(`[data-row-index="${k[S]}"]`))==null||Q.scrollIntoView({block:"center"})},[k,Y]),$e=Sn.some(O=>O.value===F.minLevel)?F.minLevel:"",pe=d.useCallback(()=>{kn(M.map(ui).join(`
245
+ `),`logcat-${e}-${Date.now()}.txt`)},[M,e]);d.useEffect(()=>{const O=I.current;if(!O||!o.length)return;const S=o.filter(Q=>Q.seq>K.current);if(!S.length)return;const G=K.current+1;K.current>=0&&S[0].seq>G&&(O.dropped+=S[0].seq-G),al(O,S),K.current=S[S.length-1].seq,H(O.lines.length)},[o]);const he=d.useCallback(()=>{const O=I.current;if(!O){K.current=o.length?o[o.length-1].seq:-1,I.current=rl(Date.now()),H(0),B(!0);return}const S=ol(O,Date.now(),e);I.current=null,B(!1),H(0),kn(S,cl(e,O.startedAt))},[o,e]);if(d.useEffect(()=>{var O;g&&((O=E.current)==null||O.scrollIntoView({block:"end"}))},[M.length,g]),!r)return t.jsxs("div",{className:"log-empty-state",children:[t.jsx("p",{className:"log-empty-title",children:"Live logs are not available here"}),t.jsx("p",{className:"log-empty-subtitle",children:"Streaming is wired up for Android (logcat) and iOS (os_trace), not for this device's platform."})]});const Ne=f?"Denied":h?"Offline":u?"Live":"Connecting",ee=!u&&(!!f||h);return t.jsxs("div",{className:"logcat-root",children:[t.jsxs("div",{className:"log-toolbar",children:[t.jsxs("div",{className:"log-filter-group",children:[t.jsxs("div",{className:"log-stat-pill",title:f??void 0,children:[t.jsx("span",{className:`log-live-dot ${u?"active":""} ${ee?"is-error":""}`}),Ne]}),t.jsxs("div",{className:"log-stat-pill logcat-count",children:[M.length," / ",o.length]}),t.jsxs(Ds,{selectSize:"sm",value:$e,onChange:O=>c(el(a,O.target.value)),"aria-label":"Minimum log level",children:[t.jsx("option",{value:"",children:"All levels"}),Sn.map(O=>t.jsx("option",{value:O.value,children:O.label},O.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:O=>c(O.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($s,{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:x,onChange:O=>{R(O.target.value),T(0)},onKeyDown:O=>{O.key==="Enter"&&(O.preventDefault(),fe(O.shiftKey?-1:1))},"aria-label":"Find in logs"}),x&&t.jsx("span",{className:"logcat-hit-count","aria-live":"polite",children:k.length?`${Y+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(Mn,{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(In,{size:14})}),t.jsx("button",{type:"button",className:`dc-btn-secondary btn-sm logcat-icon-btn ${v?"active":""}`,onClick:()=>j(!v),"aria-pressed":v,"aria-label":"Match case",title:"Match case",children:t.jsx(or,{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(Gr,{size:14})})]}),t.jsxs("div",{className:"log-actions-group",children:[(f||h)&&t.jsxs("button",{className:"dc-btn-secondary btn-sm",onClick:y,children:[t.jsx(jt,{size:14})," RECONNECT"]}),t.jsxs("button",{className:`dc-btn-secondary btn-sm ${g?"active":""}`,onClick:()=>b(!g),children:[t.jsx(ra,{size:14})," ",g?"FREEZE":"FOLLOW"]}),t.jsxs("button",{className:`dc-btn-secondary btn-sm ${_?"is-recording":""}`,onClick:he,"aria-pressed":_,title:_?"Stop recording and download the capture":"Record the raw log stream to a file",children:[_?t.jsx(Dn,{size:12}):t.jsx(zi,{size:12})," ",_?`STOP · ${C.toLocaleString()}`:"RECORD"]}),t.jsxs("button",{className:"btn-premium btn-sm",disabled:M.length===0,onClick:pe,children:[t.jsx(Bi,{size:14})," EXPORT"]}),t.jsxs("button",{className:"dc-btn-secondary btn-sm",onClick:m,children:[t.jsx(bs,{size:14})," CLEAR"]})]})]}),t.jsxs("div",{className:`logcat-rows theme-dark ${N?"":"no-wrap"}`,ref:U,children:[f&&t.jsxs("div",{className:"logcat-status-banner is-denied",role:"alert",children:[t.jsx(it,{size:14}),t.jsxs("span",{children:["Access denied — ",f]})]}),!f&&h&&t.jsxs("div",{className:"logcat-status-banner is-exhausted",role:"alert",children:[t.jsx(it,{size:14}),t.jsx("span",{children:"Connection lost after repeated attempts. Use Reconnect above to try again."})]}),M.map((O,S)=>t.jsx(dl,{record:O,index:S,isHit:re.has(S),isActiveHit:k.length>0&&k[Y]===S},O.seq)),t.jsx("div",{ref:E})]})]})}function mi(e){const s=e==null?void 0:e.message;return typeof s=="string"?s.trim():""}function Je(e,s){const n=mi(s);return n?`Couldn’t ${e}: ${n}`:`Couldn’t ${e}.`}function ml(e,s){return e==="android"?"Couldn’t read the clipboard. Check that the Appium Settings app is installed on the device.":Je("read the clipboard",s)}function fl(e,s){const n=s.trim().toLowerCase();return[...e].sort((i,r)=>i.localeCompare(r)).filter(i=>!n||i.toLowerCase().includes(n))}const hl=/^[A-Za-z][A-Za-z0-9_-]*(?:\.[A-Za-z0-9_-]+)+$/;function pl(e){return hl.test(e.trim())}function Ks(e){const s=(e||"").toLowerCase();return s==="android"?"android":s==="ios"||s==="tvos"?"ios":null}function yl(e,s){const n=Ks(s);return n?e.filter(i=>(i.platform||"").toLowerCase()===n):[]}function gl(e){return[e.version,e.packageName].filter(Boolean).join(" · ")}function xl(e){return Ks(e)==="android"?"Android":"iOS"}function vl(e){return Ks(e)==="android"?".apk":".ipa,.app"}const fi="Your browser blocked copying here. The text is selected, so press ⌘C or Ctrl+C.";async function hi(e){var s;try{return(s=navigator.clipboard)!=null&&s.writeText?(await navigator.clipboard.writeText(e),!0):!1}catch{return!1}}function bl({udid:e,platform:s,deviceName:n}){const{toast:i,removeToast:r}=et(),a=Zt(),[c,l]=d.useState([]),[o,u]=d.useState("loading"),[m,f]=d.useState(""),[h,y]=d.useState(""),[g,b]=d.useState(!1),[v,j]=d.useState(!1),[N,w]=d.useState([]),[x,R]=d.useState("loading"),[$,T]=d.useState(null),[E,U]=d.useState(null),I=d.useRef(null),_=d.useRef(null),B=d.useRef(null),C=d.useCallback(async()=>{u("loading");try{const S=await W.listApps(e);l(Array.isArray(S)?S:[]),u("ready")}catch(S){f(mi(S)),u("error")}},[e]);d.useEffect(()=>{C()},[C]);const H=S=>setTimeout(C,S);d.useEffect(()=>{if(!E)return;const S=setTimeout(()=>U(null),1500);return()=>clearTimeout(S)},[E]);const K=async()=>{R("loading");try{const S=await W.getApps();w(Array.isArray(S)?S:[]),R("ready")}catch{R("error")}},F=()=>{g||(j(!0),K())},M=()=>{var S;j(!1),(S=I.current)==null||S.focus()};d.useEffect(()=>{var G;if(!v||x==="loading")return;const S=(G=_.current)==null?void 0:G.querySelector('[role="menuitem"]:not(:disabled)');S==null||S.focus()},[v,x]);const k=async(S,G)=>{b(!0);const Q=i(`Installing ${S} on ${n}…`,"loading",0);try{const se=await G();se!=null&&se.success?(i(`Installed ${S} on ${n}`,"success"),H(5e3)):i(Je(`install ${S}`,{message:se==null?void 0:se.error}),"error")}catch(se){i(Je(`install ${S}`,se),"error")}finally{r(Q),b(!1)}},Y=S=>{M(),k(S.name,()=>W.installRepositoryApp(e,S.id))},re=S=>{var Q;const G=(Q=S.target.files)==null?void 0:Q[0];S.target.value="",G&&k(G.name,()=>W.uploadAndInstallApp(e,G))},fe=async()=>{const S=$;if(T(null),!S)return;const G=i(`Uninstalling ${S} from ${n}…`,"loading",0);try{await W.uninstallApp(e,S),i(`Uninstalled ${S} from ${n}`,"success"),H(3e3)}catch(Q){i(Je(`uninstall ${S}`,Q),"error")}finally{r(G)}},$e=async(S,G)=>{var se,Ee;if(await hi(S)){U(S);return}const Q=(se=G.closest("li"))==null?void 0:se.querySelector(".actions-app-id");Q&&((Ee=window.getSelection())==null||Ee.selectAllChildren(Q)),i(fi,"info")},pe=fl(c,h),he=h.trim(),Ne=o==="ready"&&pe.length===0&&pl(he)&&!c.includes(he),ee=yl(N,s),O=(S,G)=>t.jsxs("li",{className:"actions-app-row",children:[t.jsx("span",{className:"actions-app-id",children:S}),G&&t.jsx("span",{className:"actions-app-note",children:G}),t.jsxs("span",{className:"actions-app-tools",children:[t.jsx(ie,{variant:"ghost",size:"icon","aria-label":E===S?"Copied":`Copy ${S}`,title:E===S?"Copied":"Copy package ID",onClick:Q=>$e(S,Q.currentTarget),children:E===S?t.jsx(Ze,{size:13,"aria-hidden":"true"}):t.jsx(Te,{size:13,"aria-hidden":"true"})}),t.jsx(ie,{variant:"ghost",size:"sm",className:"actions-app-uninstall","aria-label":`Uninstall ${S}`,onClick:()=>T(S),children:"Uninstall"})]})]},S);return t.jsxs("section",{className:"actions-section","aria-labelledby":"actions-apps-title",children:[t.jsxs("div",{className:"actions-section-head",children:[t.jsxs("h4",{id:"actions-apps-title",className:"actions-section-title",children:[t.jsx(Mr,{size:15,"aria-hidden":"true"})," Apps"]}),t.jsxs("div",{className:"actions-section-tools",children:[t.jsxs(ie,{ref:I,variant:"tonal",size:"sm","aria-haspopup":"menu","aria-expanded":v,"aria-disabled":g||void 0,onClick:F,children:[g?t.jsx(wt,{className:"animate-spin",size:13,"aria-hidden":"true"}):t.jsx(jr,{size:13,"aria-hidden":"true"}),"Install from library"]}),t.jsxs(ie,{variant:"secondary",size:"sm","aria-disabled":g||void 0,onClick:()=>{var S;return!g&&((S=B.current)==null?void 0:S.click())},children:[t.jsx(Wi,{size:13,"aria-hidden":"true"})," Upload file"]}),t.jsx("input",{ref:B,type:"file",hidden:!0,"aria-label":"App file to upload",accept:vl(s),onChange:re})]})]}),t.jsx(Hs,{open:v,onClose:M,anchorRef:I,placement:"bottom-end",children:t.jsx("div",{ref:_,className:"actions-library-menu",children:t.jsxs(Vs,{children:[x==="loading"&&t.jsx(xe,{disabled:!0,onClick:()=>{},children:"Loading…"}),x==="error"&&t.jsx(xe,{onClick:K,children:"Couldn’t load the library. Retry"}),x==="ready"&&ee.length===0&&t.jsxs(t.Fragment,{children:[t.jsxs(xe,{disabled:!0,onClick:()=>{},children:["No ",xl(s)," apps in the library yet"]}),t.jsx(xe,{onClick:()=>a("/apps"),children:"Open the Apps library"})]}),x==="ready"&&ee.map(S=>t.jsx(xe,{note:gl(S)||void 0,onClick:()=>Y(S),children:S.name},S.id))]})})}),t.jsxs("div",{className:"actions-apps-tools",children:[t.jsxs("div",{className:"actions-search",children:[t.jsx(Ts,{size:13,className:"actions-search-icon","aria-hidden":"true"}),t.jsx("input",{type:"search",className:"type-input-field compact","aria-label":"Search installed apps",placeholder:`Search ${c.length} installed apps`,value:h,onChange:S=>y(S.target.value)})]}),t.jsx(ie,{variant:"ghost",size:"icon","aria-label":"Refresh installed apps",title:"Refresh",onClick:C,children:t.jsx(Ft,{size:13,"aria-hidden":"true"})})]}),o==="loading"&&c.length===0&&t.jsx("p",{className:"actions-list-note",children:"Loading apps…"}),o==="error"&&t.jsxs("div",{className:"actions-list-note",role:"alert",children:["Couldn’t load the apps",m?`: ${m}`:".",t.jsx(ie,{variant:"secondary",size:"sm",onClick:C,children:"Retry"})]}),o==="ready"&&c.length===0&&t.jsx("p",{className:"actions-list-note",children:"No apps installed"}),o==="ready"&&c.length>0&&pe.length===0&&!Ne&&t.jsxs("p",{className:"actions-list-note",children:["No apps match “",he,"”"]}),t.jsxs("ul",{className:"actions-apps-list","aria-label":"Installed apps",children:[pe.map(S=>O(S)),Ne&&O(he,"Not in the list")]}),t.jsx(Ms,{open:$!==null,title:"Uninstall app?",onClose:()=>T(null),footer:t.jsxs(t.Fragment,{children:[t.jsx(ie,{variant:"secondary",onClick:()=>T(null),children:"Cancel"}),t.jsx(ie,{variant:"danger",onClick:fe,children:"Uninstall"})]}),children:t.jsxs("p",{className:"actions-confirm-text",children:["Uninstall ",t.jsx("code",{children:$})," from"," ",t.jsx("span",{className:"actions-confirm-device",children:n}),"? The app and its data are removed from the device."]})})]})}const wl=[{direction:"up",Icon:Mn},{direction:"down",Icon:In},{direction:"left",Icon:Hi},{direction:"right",Icon:Vi}];function jl({onSwipe:e}){return t.jsxs("section",{className:"actions-section actions-swipe","aria-labelledby":"actions-swipe-title",children:[t.jsxs("h4",{id:"actions-swipe-title",className:"actions-section-title",children:[t.jsx(xr,{size:15,"aria-hidden":"true"})," Swipe"]}),t.jsx("div",{className:"actions-swipe-buttons",children:wl.map(({direction:s,Icon:n})=>t.jsx(ie,{variant:"secondary",size:"icon","aria-label":`Swipe ${s}`,title:`Swipe ${s}`,onClick:()=>e(s),children:t.jsx(n,{size:14,"aria-hidden":"true"})},s))})]})}function Nl(e,s,n){const i=s/2,r=n/2,a=s*.4,c=n*.4,[l,o,u,m]={up:[i,r+c,i,r-c],down:[i,r-c,i,r+c],left:[i+a,r,i-a,r],right:[i-a,r,i+a,r]}[e].map(Math.round);return{startX:l,startY:o,endX:u,endY:m}}function Cl({udid:e,platform:s}){const{toast:n}=et(),[i,r]=d.useState(""),[a,c]=d.useState(!1),[l,o]=d.useState(""),[u,m]=d.useState(null),[f,h]=d.useState(""),[y,g]=d.useState(!1),b=d.useRef(null);d.useEffect(()=>{if(!f)return;const x=setTimeout(()=>h(""),2e3);return()=>clearTimeout(x)},[f]),d.useEffect(()=>{if(!y)return;const x=setTimeout(()=>g(!1),1500);return()=>clearTimeout(x)},[y]);const v=async()=>{if(!(!i.trim()||a)){c(!0);try{await W.typeText(e,i),r(""),h("Sent")}catch(x){n(Je("send the text",x),"error")}finally{c(!1)}}},j=async()=>{m("read");try{const x=await W.getClipboard(e),R=typeof(x==null?void 0:x.content)=="string"?x.content:"";o(R),R||h("The device clipboard is empty")}catch(x){n(ml(s,x),"error")}finally{m(null)}},N=async()=>{if(l){m("write");try{await W.setClipboard(e,l),h("Written to the device")}catch(x){n(Je("write the clipboard",x),"error")}finally{m(null)}}},w=async()=>{var x;if(await hi(l)){g(!0);return}(x=b.current)==null||x.select(),n(fi,"info")};return t.jsxs("section",{className:"actions-section","aria-labelledby":"actions-text-title",children:[t.jsxs("h4",{id:"actions-text-title",className:"actions-section-title",children:[t.jsx(br,{size:15,"aria-hidden":"true"})," Text and clipboard"]}),t.jsxs("div",{className:"actions-field-row",children:[t.jsx("label",{className:"actions-field-label",htmlFor:"actions-send-text",children:"Send text"}),t.jsx("input",{id:"actions-send-text",type:"text",className:"type-input-field compact",placeholder:"Type text for the focused field…",value:i,onChange:x=>r(x.target.value),onKeyDown:x=>x.key==="Enter"&&v()}),t.jsxs(ie,{variant:"secondary",size:"md",onClick:v,disabled:!i.trim()||a,children:[a&&t.jsx(wt,{className:"animate-spin",size:13,"aria-hidden":"true"}),"Send"]})]}),t.jsxs("div",{className:"actions-field-row",children:[t.jsx("label",{className:"actions-field-label",htmlFor:"actions-clipboard",children:"Clipboard"}),t.jsx("input",{id:"actions-clipboard",ref:b,type:"text",className:"type-input-field compact",placeholder:"Read the device clipboard, or type text to write",value:l,onChange:x=>o(x.target.value)}),t.jsxs(ie,{variant:"secondary",size:"md",onClick:j,disabled:u!==null,children:[u==="read"&&t.jsx(wt,{className:"animate-spin",size:13,"aria-hidden":"true"}),"Read"]}),t.jsxs(ie,{variant:"secondary",size:"md",onClick:N,disabled:!l||u!==null,children:[u==="write"&&t.jsx(wt,{className:"animate-spin",size:13,"aria-hidden":"true"}),"Write to device"]}),t.jsx(ie,{variant:"ghost",size:"icon","aria-label":y?"Copied":"Copy clipboard text",title:y?"Copied":"Copy to your clipboard",onClick:w,disabled:!l,children:y?t.jsx(Ze,{size:14,"aria-hidden":"true"}):t.jsx(Te,{size:14,"aria-hidden":"true"})})]}),t.jsx("p",{className:"actions-status",role:"status",children:f})]})}function Sl({udid:e,platform:s,deviceName:n,screenWidth:i,screenHeight:r}){const{toast:a}=et(),c=async l=>{const o=Nl(l,i,r);try{await W.swipe(e,o.startX,o.startY,o.endX,o.endY)}catch(u){a(Je(`swipe ${l}`,u),"error")}};return t.jsxs("div",{className:"actions-panel",children:[t.jsx(bl,{udid:e,platform:s,deviceName:n}),t.jsx(Cl,{udid:e,platform:s}),t.jsx(jl,{onSwipe:c})]})}function kl({device:e,onClose:s,titleId:n}){const{toast:i}=et(),r=Zt(),{tab:a}=$n(),c=Es(),l=d.useRef(null),[o,u]=d.useState({width:0,height:0}),[m,f]=d.useState("inspect"),[h,y]=d.useState(null),[g,b]=d.useState(a||"actions"),v=g==="omni"&&m==="inspect",[j,N]=d.useState(!0),[w,x]=d.useState([]),[R,$]=d.useState(null),[T,E]=d.useState(!1),[U,I]=d.useState(!1),[_,B]=d.useState(0),[C,H]=d.useState(e),K=Xs(C),[F,M]=d.useState(!1),[k,Y]=d.useState(!1),re=10,[fe,$e]=d.useState(!1),[pe,he]=d.useState(!1),Ne=qc(C==null?void 0:C.udid,!k),ee=()=>{navigator.clipboard.writeText(C.udid).catch(()=>{}),$e(!0),setTimeout(()=>$e(!1),1500)},O=d.useRef(""),S=d.useRef(null),[G,Q]=d.useState(!1);d.useEffect(()=>{g&&(!a||a!==g)&&r(`/devices/${e.udid}/control/${g}${c.search}`,{replace:!0})},[g,a,e.udid,r,c.search]),d.useEffect(()=>((async()=>{try{I(!0),await W.startStream(C.udid);const J=(await W.getDevices()).find(ae=>ae.udid===C.udid);J&&H(J)}catch(V){console.error("Auto-start stream failed:",V)}finally{I(!1)}})(),()=>{W.stopStream(C.udid).catch(()=>{})}),[e.udid]);const se=parseInt(C.screenWidth||"1080",10),Ee=parseInt(C.screenHeight||"1920",10),de=Math.min(se,Ee),ye=Math.max(se,Ee),Ue=de/ye,He=d.useCallback(()=>{const P=!j,V=P?window.innerHeight*.55:window.innerHeight*.7,J=620,Ce=window.innerWidth>900;let oe;P?oe=Ce?Math.min(window.innerWidth*.8,window.innerWidth-J):window.innerWidth*.8:oe=window.innerWidth*.45;const we=j?Ue:1/Ue;let ce,le;j?(ce=V,le=ce*we,le>oe&&(le=oe,ce=le/we)):(le=oe,ce=le/we,ce>V&&(ce=V,le=ce*we)),u({width:le,height:ce})},[Ue,j]);d.useEffect(()=>(He(),window.addEventListener("resize",He),()=>window.removeEventListener("resize",He)),[He]),d.useEffect(()=>{const P=async()=>{if(O.current.length>0){const J=O.current;O.current="";try{await W.typeText(C.udid,J)}catch(ae){console.error("Keyboard buffering flush failed:",ae)}}},V=J=>{const ae=document.activeElement;if(ae&&(ae.tagName==="INPUT"||ae.tagName==="TEXTAREA"||ae.isContentEditable)||!G&&g!=="terminal")return;const oe=J.key;oe==="Enter"?(S.current&&clearTimeout(S.current),P(),W.pressKey(C.udid,C.platform==="android"?66:"enter")):oe==="Backspace"?(S.current&&clearTimeout(S.current),P(),W.pressKey(C.udid,C.platform==="android"?67:"backspace")):oe.length===1&&(O.current+=oe,S.current&&clearTimeout(S.current),S.current=setTimeout(()=>{P()},50))};return window.addEventListener("keydown",V),()=>{window.removeEventListener("keydown",V),S.current&&clearTimeout(S.current)}},[C.udid,C.platform,G,g]);const[Le,ut]=d.useState(Date.now()),_e=()=>{const P=_>0?`r=${_}&`:"";return C.session_id&&!String(C.session_id).startsWith("manual_")?`/xenon/api/session/${C.session_id}/live_video?${P}t=${Le}`:`/xenon/api/control/${C.udid}/stream?${P}t=${Le}`};d.useEffect(()=>{_>0&&ut(Date.now())},[_]),d.useEffect(()=>{if(F||k)return;const P=setTimeout(()=>Y(!0),3e4);return()=>clearTimeout(P)},[F,k,_]);const tt=d.useRef(null),Xe=P=>{const V=P.currentTarget.getBoundingClientRect();return{x:P.clientX-V.left,y:P.clientY-V.top}},Rt=P=>{const V=Xe(P);tt.current={x:V.x,y:V.y,time:Date.now()}},$t=async P=>{var yt;if(!tt.current)return;const V=tt.current,J=Xe(P),ae=Date.now()-V.time,Ce=(yt=l.current)==null?void 0:yt.getBoundingClientRect(),oe=(Ce==null?void 0:Ce.width)||o.width,we=(Ce==null?void 0:Ce.height)||o.height;let ce,le,Ke,Ye;j?(ce=V.x/oe*de,le=V.y/we*ye,Ke=J.x/oe*de,Ye=J.y/we*ye):(ce=V.x/oe*ye,le=V.y/we*de,Ke=J.x/oe*ye,Ye=J.y/we*de);const ht=Math.abs(Ke-ce),pt=Math.abs(Ye-le);try{ae<500&&ht<10&&pt<10?await W.tap(C.udid,Math.round(ce),Math.round(le)):ae>=500&&ht<10&&pt<10?await W.touchAndHold(C.udid,Math.round(ce),Math.round(le),ae):await W.swipe(C.udid,Math.round(ce),Math.round(le),Math.round(Ke),Math.round(Ye))}catch(Lt){console.error("Action failed:",Lt)}tt.current=null},ss=()=>W.pressKey(C.udid,C.platform==="android"?bt.HOME:os.HOME),ns=()=>W.pressKey(C.udid,bt.BACK),is=()=>W.pressKey(C.udid,bt.APP_SWITCH),mt=()=>W.pressKey(C.udid,C.platform==="android"?bt.VOLUME_UP:os.VOLUME_UP),Et=()=>W.pressKey(C.udid,C.platform==="android"?bt.VOLUME_DOWN:os.VOLUME_DOWN),rs=()=>W.lock(C.udid),Tt=async()=>{he(!0);try{await W.unlock(C.udid)}finally{setTimeout(()=>he(!1),2500)}},Dt=async()=>{E(!0);try{const P=await W.getScreenshot(C.udid);if(P!=null&&P.screenshot){const V={id:Mc(),base64:P.screenshot,timestamp:Date.now()};x(J=>[V,...J]),$(0)}}catch(P){console.error("Failed to take screenshot:",P)}finally{E(!1)}},ft=P=>{x(V=>{const J=V.filter(ae=>ae.id!==P);return J.length===0?$(null):R!==null&&R>=J.length&&$(0),J})},It=()=>{x([]),$(null),i("Cleared all captured evidence.","success")},Mt=P=>{const V=document.createElement("a");V.href=`data:image/png;base64,${P}`,V.download=`screenshot-${C.udid}-${Date.now()}.png`,V.click()};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(tn,{size:18})," DEVICES"]}),t.jsxs("div",{className:"device-info-mini",children:[t.jsx("span",{className:`device-pill platform-pill ${C.platform}`,children:C.platform==="ios"?"Apple":"Android"}),t.jsxs("span",{className:"device-pill version-pill",children:["v",C.sdk]}),C.reservedUntil&&Date.now()<C.reservedUntil&&t.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${C.reservedBy}${C.reservationReason?`: ${C.reservationReason}`:""}`,children:["Reserved by ",C.reservedBy||"someone"]}),t.jsx("h2",{id:n,className:"device-name-text",children:K}),t.jsxs("span",{className:"udid-chip",title:C.udid,children:[t.jsx("span",{className:"udid-chip__value",children:C.udid}),t.jsx("button",{type:"button",className:"udid-chip__copy",onClick:ee,"aria-label":"Copy UDID",title:fe?"Copied!":"Copy UDID",children:fe?t.jsx(Ze,{size:12}):t.jsx(Te,{size:12})})]})]})]}),t.jsxs("div",{className:`control-view-main ${j?"":"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:P=>{l.current=P,y(P)},className:`device-stream-canvas ${j?"":"landscape"} ${G?"focused":""} ${v?"is-inspecting":""}`,style:{width:o.width,height:o.height,background:"var(--black)"},tabIndex:0,onFocus:()=>Q(!0),onBlur:()=>Q(!1),onMouseDown:v?void 0:Rt,onMouseUp:v?void 0:$t,children:[k?t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(it,{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:()=>{Y(!1),B(0)},children:"Retry"})]}):(U||!F)&&t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(jt,{size:40,className:"animate-spin",color:"var(--color-accent)"}),t.jsx("p",{style:{marginTop:16},children:U?"ESTABLISHING TRACE...":"Waiting for stream…"})]}),!k&&t.jsx("img",{src:_e(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onLoad:()=>M(!0),onError:()=>{if(console.warn("Stream failed to load, retrying..."),M(!1),_>=re){Y(!0);return}setTimeout(()=>B(P=>P+1),2e3)}}),Ne==="off"&&!k&&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:Tt,disabled:pe,children:pe?"Waking…":"Wake device"})]})]})}),t.jsxs("aside",{className:"device-footer-actions",role:"toolbar","aria-label":"Device controls","aria-orientation":j?"vertical":"horizontal",children:[t.jsx("button",{className:`footer-action-btn ${j?"active":""}`,onClick:()=>N(!0),title:"Portrait","aria-label":"Portrait orientation","aria-pressed":j,children:t.jsx(Fr,{size:18})}),t.jsx("button",{className:`footer-action-btn ${j?"":"active"}`,onClick:()=>N(!1),title:"Landscape","aria-label":"Landscape orientation","aria-pressed":!j,children:t.jsx(Pr,{size:18})}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:ss,title:"Home","aria-label":"Home",children:t.jsx(Fi,{size:18})}),C.platform==="android"&&t.jsxs(t.Fragment,{children:[t.jsx("button",{className:"footer-action-btn",onClick:ns,title:"Back","aria-label":"Back",children:t.jsx(tn,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:is,title:"App switcher","aria-label":"App switcher",children:t.jsx(Dn,{size:18})})]}),t.jsx("div",{className:"footer-divider"}),t.jsx("button",{className:"footer-action-btn",onClick:mt,title:"Volume up","aria-label":"Volume up",children:t.jsx(na,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:Et,title:"Volume down","aria-label":"Volume down",children:t.jsx(ta,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:rs,title:"Lock device","aria-label":"Lock device",children:t.jsx(qi,{size:18})}),t.jsx("button",{className:"footer-action-btn",onClick:Tt,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:()=>b("actions"),role:"tab","aria-selected":g==="actions",children:[t.jsx(vs,{size:13}),t.jsx("span",{children:"Actions"})]}),t.jsxs("button",{className:`tab-btn ${g==="screenshot"?"active":""}`,onClick:()=>b("screenshot"),role:"tab","aria-selected":g==="screenshot",children:[t.jsx(as,{size:13}),t.jsx("span",{children:"Screenshot"})]}),t.jsxs("button",{className:`tab-btn ${g==="logs"?"active":""}`,onClick:()=>b("logs"),role:"tab","aria-selected":g==="logs",children:[t.jsx(Ur,{size:13}),t.jsx("span",{children:"Logs"})]}),t.jsxs("button",{className:`tab-btn ${g==="terminal"?"active":""}`,onClick:()=>b("terminal"),role:"tab","aria-selected":g==="terminal",children:[t.jsx(Ui,{size:13}),t.jsx("span",{children:"Shell"})]}),t.jsxs("button",{className:`tab-btn ${g==="omni"?"active":""}`,onClick:()=>b("omni"),role:"tab","aria-selected":g==="omni",children:[t.jsx(ws,{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(Vc,{sessionId:C.session_id?String(C.session_id):null,udid:C.udid,streamUrl:_e(),embedded:!0,overlayTarget:h,onModeChange:f})}),g==="actions"&&t.jsx(Sl,{udid:C.udid,platform:C.platform,deviceName:K,screenWidth:de,screenHeight:ye}),g==="screenshot"&&t.jsxs("div",{className:"action-card screenshot-card",children:[w.length>0&&t.jsx("header",{className:"action-card-header",children:t.jsx("button",{className:"btn-text-only",onClick:It,children:"CLEAR ALL"})}),t.jsxs("div",{className:`screenshot-workspace ${w.length===0?"is-empty":""}`,children:[t.jsxs("div",{className:"screenshot-gallery-sidebar",children:[t.jsxs("button",{className:"btn-premium take-screenshot-btn",onClick:Dt,disabled:T,children:[T?t.jsx(wt,{className:"animate-spin",size:16}):t.jsx(as,{size:16}),t.jsx("span",{children:T?"CAPTURING...":"NEW CAPTURE"})]}),t.jsxs("div",{className:"screenshot-thumbnails-list",children:[w.length===0&&!T&&t.jsxs("div",{className:"empty-gallery-state",children:[t.jsx(as,{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."})]}),w.map((P,V)=>t.jsxs("div",{className:`screenshot-thumb-item ${R===V?"active":""}`,onClick:()=>$(V),children:[t.jsx("img",{src:`data:image/png;base64,${P.base64}`,alt:"Thumb"}),t.jsx("span",{className:"thumb-time",children:new Date(P.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),t.jsx("button",{className:"thumb-delete-btn",onClick:J=>{J.stopPropagation(),ft(P.id)},children:t.jsx(bs,{size:12})})]},P.id))]})]}),t.jsx("div",{className:"screenshot-main-preview",children:R!==null&&w[R]?t.jsxs("div",{className:"preview-container",children:[t.jsx("div",{className:"preview-image-wrapper",children:t.jsx("img",{src:`data:image/png;base64,${w[R].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:w[R].id.substring(0,8)}),t.jsx("span",{className:"meta-divider",children:"|"}),t.jsx("span",{className:"meta-value",children:_i(w[R].timestamp)})]}),t.jsxs("div",{className:"preview-actions",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:()=>Mt(w[R].base64),children:"DOWNLOAD PNG"}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:()=>ft(w[R].id),children:[t.jsx(bs,{size:14})," DELETE"]})]})]})]}):null})]})]}),g==="logs"&&t.jsx("div",{className:"action-card screenshot-card",children:t.jsx(ul,{udid:C.udid,platform:C.platform})}),g==="terminal"&&t.jsx("div",{className:"action-card full-height",children:t.jsx(Lc,{platform:(C.platform||"").toLowerCase(),prompt:`${(C.platform||"").toLowerCase()==="ios"?"ios":"adb"} $`,welcomeMessage:`Connected to ${K} (${C.udid}).
246
+ Internal Shell Environment.`,onCommand:async P=>{const V=await W.executeShell(C.udid,P);if(V.error)throw new Error(V.error);return V.output}})})]})})]})]}),C.session_id&&!String(C.session_id).startsWith("manual_")&&t.jsx(Ri,{sessionId:String(C.session_id),mode:"slice",windowSec:60,variant:"floating"})]})}const Al=/^(INPUT|TEXTAREA|SELECT)$/;function Rl({labelledBy:e,onClose:s,children:n,style:i,...r}){const a=d.useRef(null),c=d.useRef(s);return c.current=s,d.useEffect(()=>{const l=a.current;if(!l)return;const o=document.activeElement,u=[];for(let f=l;f.parentElement&&f!==document.body;f=f.parentElement)for(const h of Array.from(f.parentElement.children))h===f||h.hasAttribute("inert")||h.matches("[aria-live], script, style, link, template")||(h.setAttribute("inert",""),u.push(h));l.contains(document.activeElement)||l.focus();const m=f=>{if(f.key!=="Escape"||f.defaultPrevented)return;const h=f.target;Al.test(h.tagName)||h.isContentEditable||(f.preventDefault(),c.current())};return l.addEventListener("keydown",m),()=>{l.removeEventListener("keydown",m),u.forEach(f=>f.removeAttribute("inert")),o&&o.isConnected&&o!==document.body&&o.focus()}},[]),t.jsx("div",{ref:a,role:"dialog","aria-modal":"true","aria-labelledby":e,tabIndex:-1,style:{outline:"none",...i},...r,children:n})}const $l={status:"all",platform:"all",type:"all",q:""},pi=["all",...xc],yi=["all","android","ios","tvos"],gi=["all","real","virtual"];function ys(e,s){return s.includes(e)?e:s[0]}function El(e){const s=e.get("q")??"";return{status:ys(e.get("status"),pi),platform:ys(e.get("platform"),yi),type:ys(e.get("type"),gi),q:s.trim()?s:""}}function Tl(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 xi(e){return e.deviceType==="simulator"||e.deviceType==="emulator"?!0:!e.deviceType&&e.realDevice===!1}function Ys(e){const s=(e.platform||"").toLowerCase();return s==="android"||s==="ios"||s==="tvos"?s:null}function Dl(e){const s=e.deviceType==="emulator"?"Emulator":e.deviceType==="simulator"?"Simulator":"";return[Xs(e),e.name,e.manufacturer,e.model,Ls(e.platform),e.sdk,s,e.teamName,e.udid].filter(Boolean).join(" ").toLowerCase()}function Ht(e,s,n,i){if(i!=="status"&&s.status!=="all"&&qs(e,n)!==s.status||i!=="platform"&&s.platform!=="all"&&Ys(e)!==s.platform||i!=="type"&&s.type!=="all"&&s.type==="virtual"!==xi(e))return!1;const r=s.q.toLowerCase().split(/\s+/).filter(Boolean);if(r.length===0)return!0;const a=Dl(e);return r.every(c=>a.includes(c))}const gs=e=>Object.fromEntries(e.map(s=>[s,0]));function Il(e,s,n){const i=gs(pi),r=gs(yi),a=gs(gi);for(const c of e){if(Ht(c,s,n,"status")&&(i.all+=1,i[qs(c,n)]+=1),Ht(c,s,n,"platform")){r.all+=1;const l=Ys(c);l&&(r[l]+=1)}Ht(c,s,n,"type")&&(a.all+=1,a[xi(c)?"virtual":"real"]+=1)}return{status:i,platform:r,type:a}}function Ml(e){return e.some(s=>Ys(s)==="tvos")}function Ll(e){return e.status!=="all"||e.platform!=="all"||e.type!=="all"||e.q.trim()!==""}function _l(e,s){const n=i=>i===1?"device":"devices";return e===s?`${s} ${n(s)}`:`${e} of ${s} ${n(s)}`}function An({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(y=>y.value===s),f=()=>{var y;c(!1),(y=o.current)==null||y.focus()},h=d.useCallback(y=>{const g=(y==null?void 0:y.querySelector('[aria-checked="true"]'))??(y==null?void 0:y.querySelector('[role="menuitemradio"]'));g==null||g.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(y=>!y),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(Tn,{size:12,"aria-hidden":"true"}),e]})}),u&&t.jsx("button",{type:"button",className:"fm-clear","aria-label":`Clear ${e.toLowerCase()} filter`,onClick:()=>{r(n),f()},children:t.jsx($s,{size:12,"aria-hidden":"true"})}),t.jsx(Hs,{open:a,onClose:f,anchorRef:l,placement:"bottom-start",children:t.jsx("div",{ref:h,children:t.jsx(Vs,{children:i.map(y=>t.jsx(xe,{checked:y.value===s,note:y.note,trailing:t.jsx("span",{className:"fm-count",children:y.count}),onClick:()=>{r(y.value),f()},children:y.label},y.value))})})})]})}class Ol extends ke.Component{constructor(s){super(s),this.socketCleanups=[],this.refreshTimeout=null,this.searchRef=ke.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($l),(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 W.getDevices(),n=this.getBusyDevicesCount(s),i=await W.getPendingSessionsCount(),r=await W.getQueueSummary();this.setState({devices:s,activeSessionsCount:n,pendingSessionsCount:i,queueSummary:r,loaded:!0})}catch(s){console.log(s),this.setState({loaded:!0})}}setFilters(s){this.props.onFiltersChange({...this.props.filters,...s})}getFiltered(){const s=Date.now();return this.state.devices.filter(n=>Ht(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=Il(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}];(Ml(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(Ai,{icon:xs,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(Ts,{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(An,{name:"Platform",value:r.platform,anyValue:"all",options:c,onChange:u=>this.setFilters({platform:u})}),t.jsx(An,{name:"Type",value:r.type,anyValue:"all",options:l,onChange:u=>this.setFilters({type:u})}),Ll(r)&&t.jsx(ie,{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:_l(s.length,this.state.devices.length)}),t.jsx(ie,{variant:"secondary",size:"icon","aria-label":"Refresh devices",title:"Refresh",onClick:()=>this.fetchDevices(),children:t.jsx(Ft,{size:13,"aria-hidden":"true"})})]})]})]})]}),s.length>0?t.jsx(Rc,{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(xs,{size:32}):t.jsx(Ft,{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(ie,{variant:"primary",onClick:()=>this.fetchDevices(),children:[t.jsx(Ft,{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(ie,{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(Rl,{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(kl,{device:i,titleId:"device-control-title",onClose:()=>this.props.navigate(o)})})})]})}}function fd(){const e=$n(),s=Zt(),n=Es(),[i,r]=Si(),{on:a}=ki();return t.jsx(Ol,{params:e,navigate:s,onSocketEvent:a,filters:El(i),onFiltersChange:c=>r(Tl(c),{replace:!0}),locationSearch:n.search})}export{Ol as DeviceExplorer,fd as default};