@xenon-device-management/xenon 1.10.2 → 1.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/lib/package.json +1 -1
  2. package/lib/public/assets/{ApiKeyGate-CXcUY254.js → ApiKeyGate-ClHpKj6k.js} +1 -1
  3. package/lib/public/assets/{BugReportButton-BVbG4wRS.js → BugReportButton-ts9jrr8-.js} +1 -1
  4. package/lib/public/assets/{DeviceMosaicView-DvOvcEUe.js → DeviceMosaicView-DCkGEbXo.js} +1 -1
  5. package/lib/public/assets/{EmptyState-CqX5c5qk.js → EmptyState-CcLCk9jp.js} +1 -1
  6. package/lib/public/assets/{FieldGroup-BnW6ht3P.js → FieldGroup-D_hw5Ydc.js} +1 -1
  7. package/lib/public/assets/{Modal-pjenMvja.js → Modal-cMvXSpaq.js} +1 -1
  8. package/lib/public/assets/{SegmentedControl-D3_AIG1S.js → SegmentedControl-R5fjQSgQ.js} +1 -1
  9. package/lib/public/assets/{SettingCard-phWFdBPL.js → SettingCard-CywVNsha.js} +1 -1
  10. package/lib/public/assets/{Table-Cz8lNfAc.js → Table-DzOMPEhi.js} +1 -1
  11. package/lib/public/assets/{activity-ChjRgvT_.js → activity-DhGrAj8r.js} +1 -1
  12. package/lib/public/assets/{ai-settings-T-u5zCIe.js → ai-settings-mdRgRD6V.js} +1 -1
  13. package/lib/public/assets/{api-keys-DBZxQlHq.js → api-keys-CRJiYJaE.js} +1 -1
  14. package/lib/public/assets/{apps-DB8RjeUE.js → apps-it4FdRBJ.js} +1 -1
  15. package/lib/public/assets/{arrow-left-BgGhlDhq.js → arrow-left-CTK1o68m.js} +1 -1
  16. package/lib/public/assets/{arrow-up-right-DETmJpoU.js → arrow-up-right-CALnC_-F.js} +1 -1
  17. package/lib/public/assets/{auth-shell-DsSp7ZTz.js → auth-shell-KiS3doQY.js} +1 -1
  18. package/lib/public/assets/{builds-page-BxGG34QS.js → builds-page-DnTK34Ak.js} +1 -1
  19. package/lib/public/assets/{button-CNFdqqf7.js → button-Dok0EqDE.js} +1 -1
  20. package/lib/public/assets/{check-DEvFsY-4.js → check-zI4DbEBJ.js} +1 -1
  21. package/lib/public/assets/{chevron-right-C4Gv398N.js → chevron-right-Bu_jQ3TF.js} +1 -1
  22. package/lib/public/assets/{circle-check-DmMPKhe_.js → circle-check-q1QeUD1V.js} +1 -1
  23. package/lib/public/assets/{circle-x-Di-h1uvK.js → circle-x-CqwwCvwq.js} +1 -1
  24. package/lib/public/assets/{clock-BHNYeJMe.js → clock-D02eArqp.js} +1 -1
  25. package/lib/public/assets/{copy-BUpDU4Zv.js → copy-C835_0WB.js} +1 -1
  26. package/lib/public/assets/device-explorer-Dd9oPUsh.js +210 -0
  27. package/lib/public/assets/device-explorer-DzwdMrwk.css +1 -0
  28. package/lib/public/assets/{download-BHNx8WOh.js → download-CuSvhG6c.js} +1 -1
  29. package/lib/public/assets/{forgot-password-CJyu0w-b.js → forgot-password-BRMjtMOz.js} +1 -1
  30. package/lib/public/assets/{funnel-gYkdYeV2.js → funnel-BtR_Be-p.js} +1 -1
  31. package/lib/public/assets/{index-BGXymwQN.js → index-kSDyEaKf.js} +2 -2
  32. package/lib/public/assets/{input-3rtpb2vc.js → input-DehSMhZO.js} +1 -1
  33. package/lib/public/assets/{layers-ChmHNplE.js → layers-CvnL7iUD.js} +1 -1
  34. package/lib/public/assets/{lock-KV6fvO_O.js → lock-C89YcFr6.js} +1 -1
  35. package/lib/public/assets/{login-yi_p515F.js → login-BWOgMnCI.js} +1 -1
  36. package/lib/public/assets/{maintenance-settings-CyiBXvUh.js → maintenance-settings-B4PREufN.js} +1 -1
  37. package/lib/public/assets/{mouse-pointer-2-JbCQp9wt.js → mouse-pointer-2-Bq5fPvHD.js} +1 -1
  38. package/lib/public/assets/{overview-Cnnlor4O.js → overview-61aWVAJw.js} +1 -1
  39. package/lib/public/assets/{page-header-XQWbaNyo.js → page-header-MmKtrI07.js} +1 -1
  40. package/lib/public/assets/{plus-E-UR7k1p.js → plus-DPRDZsZs.js} +1 -1
  41. package/lib/public/assets/{profile-page-DK9b6xif.js → profile-page-DL5UIco8.js} +1 -1
  42. package/lib/public/assets/{reset-password-BZKwfJrk.js → reset-password-Ba54ic8I.js} +1 -1
  43. package/lib/public/assets/{runbook-page-D6AmGHZV.js → runbook-page-mgYRTt1i.js} +1 -1
  44. package/lib/public/assets/{select-DpXD9Y7C.js → select-B3KM9PHd.js} +1 -1
  45. package/lib/public/assets/{selector-detail-page-BqvoORfB.js → selector-detail-page-Cg2FZj1V.js} +1 -1
  46. package/lib/public/assets/{selector-health-Da50xW1k.js → selector-health-BW2CgDxK.js} +1 -1
  47. package/lib/public/assets/{selector-health-page-CS6eAM1m.js → selector-health-page-Z4qXuoZa.js} +1 -1
  48. package/lib/public/assets/{session-detail-page-D-iiraNb.js → session-detail-page-COwMCabv.js} +1 -1
  49. package/lib/public/assets/{settings-R0pZk3Sf.js → settings-DaoUla2H.js} +1 -1
  50. package/lib/public/assets/{shield-B0uX5jCt.js → shield-BmfVDLEc.js} +1 -1
  51. package/lib/public/assets/{shield-alert-CuJAr6HJ.js → shield-alert-8INRsGKB.js} +1 -1
  52. package/lib/public/assets/{status-pill-outline-r3TIoZDx.js → status-pill-outline-C39kAZC1.js} +1 -1
  53. package/lib/public/assets/{tablet-pqMtSKN2.js → tablet-DQDGGBh4.js} +1 -1
  54. package/lib/public/assets/{teams-CcBOR-Yy.js → teams-vtEttIqP.js} +1 -1
  55. package/lib/public/assets/{trash-2-lZA3lY6H.js → trash-2-DevmpTQ7.js} +1 -1
  56. package/lib/public/assets/{upload-BDIpnevH.js → upload-C9wn8l4h.js} +1 -1
  57. package/lib/public/assets/{useSocket-Bf8djy40.js → useSocket--VkIM1dx.js} +1 -1
  58. package/lib/public/assets/{users-DQhnhcR0.js → users-xqBggb5a.js} +1 -1
  59. package/lib/public/assets/{webhook-settings-D2P60svA.js → webhook-settings-CHsPMPES.js} +1 -1
  60. package/lib/public/assets/{zap-DB7knkWE.js → zap-Bf19JpzM.js} +1 -1
  61. package/lib/public/index.html +1 -1
  62. package/lib/schema.json +2 -2
  63. package/lib/src/app/routers/grid.js +7 -3
  64. package/lib/src/data-service/device-service.js +21 -0
  65. package/lib/src/device-managers/android/ScrcpyServerSession.js +11 -1
  66. package/lib/src/device-managers/ios/IOSDiscoveryService.js +59 -26
  67. package/lib/src/helpers/networkAddresses.js +99 -0
  68. package/lib/src/interfaces/IPluginArgs.js +1 -11
  69. package/lib/src/plugin.js +3 -3
  70. package/lib/src/services/ServerManager.js +12 -3
  71. package/lib/test/unit/enrich-devices-team-names.test.js +52 -0
  72. package/lib/test/unit/network-addresses.test.js +38 -0
  73. package/lib/test/unit/scrcpy-server-session.spec.js +9 -0
  74. package/lib/tsconfig.tsbuildinfo +1 -1
  75. package/package.json +1 -1
  76. package/schema.json +2 -2
  77. package/scripts/generate-types-from-schema.js +1 -1
  78. package/lib/public/assets/device-explorer-6UtOrpTY.js +0 -210
  79. package/lib/public/assets/device-explorer-CVx1f1y3.css +0 -1
@@ -0,0 +1,210 @@
1
+ import{g as B,j as t,r as m,h as zn,R as Fn,i as Bn,k as Re,C as Ms,U as Hn,X as P,m as Kt,n as Un,u as bs,b as Wn,o as us,p as ms,q as nn,s as Is,c as rn,t as It,S as _s,v as es}from"./index-kSDyEaKf.js";import{P as Vn}from"./page-header-MmKtrI07.js";import{B as dt}from"./button-Dok0EqDE.js";import{S as ws}from"./select-B3KM9PHd.js";import{P as tt,B as qn}from"./BugReportButton-ts9jrr8-.js";import{P as Rt,u as Ht,a as kt,b as an,c as js,d as Xn,D as Kn,e as Os,f as Yn,g as ut,h as Gn,M as on}from"./Modal-cMvXSpaq.js";import{F as zt}from"./FieldGroup-D_hw5Ydc.js";import{C as cn}from"./clock-D02eArqp.js";import{P as Zn}from"./plus-DPRDZsZs.js";import{A as Jn}from"./activity-DhGrAj8r.js";import{C as Ct}from"./copy-C835_0WB.js";import{T as hs,P as Qn,U as ei}from"./upload-C9wn8l4h.js";import{f as ti}from"./time-B8FIgwPE.js";import{M as si,F as ni}from"./mouse-pointer-2-Bq5fPvHD.js";import{L as ii,C as ts}from"./layers-CvnL7iUD.js";import{C as Ft}from"./check-zI4DbEBJ.js";import{Z as ln}from"./zap-Bf19JpzM.js";import{C as dn}from"./chevron-right-Bu_jQ3TF.js";import{S as ss}from"./shield-alert-8INRsGKB.js";import{A as jt,I as ns}from"./keycodes-bIEJfQzr.js";import{L as ri}from"./lock-C89YcFr6.js";import{T as _t}from"./trash-2-DevmpTQ7.js";import{D as ai}from"./download-CuSvhG6c.js";import{S as oi}from"./SegmentedControl-R5fjQSgQ.js";import{u as ci}from"./useSocket--VkIM1dx.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 li=[["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"}]],di=B("battery-low",li);/**
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 ui=[["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"}]],mi=B("battery-warning",ui);/**
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 hi=[["path",{d:"M 22 14 L 22 10",key:"nqc4tb"}],["rect",{x:"2",y:"6",width:"16",height:"12",rx:"2",key:"13zb55"}]],fi=B("battery",hi);/**
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 pi=[["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"}]],gi=B("box",pi);/**
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 xi=[["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"}]],yi=B("calendar-plus",xi);/**
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 vi=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],Nt=B("camera",vi);/**
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 bi=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],wi=B("chevron-up",bi);/**
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 ji=[["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"}]],Ni=B("circle-question-mark",ji);/**
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 Ci=[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]],Si=B("clipboard",Ci);/**
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 ki=[["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"}]],Ps=B("code-xml",ki);/**
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 Ai=[["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"}]],Ri=B("crosshair",Ai);/**
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 Ei=[["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"}]],Di=B("ellipsis",Ei);/**
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 $i=[["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"}]],Ti=B("grid-3x3",$i);/**
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 Li=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Mi=B("house",Li);/**
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 Ii=[["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"}]],_i=B("lightbulb",Ii);/**
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 Oi=[["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"}]],Pi=B("lock-open",Oi);/**
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 zi=[["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"}]],Fi=B("map-pin",zi);/**
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 Bi=[["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"}]],Hi=B("message-square",Bi);/**
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 Ui=[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]],Wi=B("move",Ui);/**
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 Vi=[["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"}]],qi=B("panels-top-left",Vi);/**
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 Xi=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],St=B("rotate-cw",Xi);/**
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 Ki=[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]],Yi=B("scroll-text",Ki);/**
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 Gi=[["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"}]],fs=B("sparkles",Gi);/**
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 Zi=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Ji=B("square",Zi);/**
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 Qi=[["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"}]],er=B("tag",Qi);/**
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 tr=[["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"}]],is=B("target",tr);/**
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 sr=[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]],nr=B("thermometer",sr);/**
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 ir=[["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"}]],rr=B("touchpad",ir);/**
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 ar=[["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"}]],or=B("volume-1",ar);/**
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 cr=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],lr=B("volume-2",cr);/**
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 dr=[["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"}]],ur=B("wifi",dr);function mr(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 hr=(e,s)=>s===1?e:`${e}s`,fr=1e-7;function zs(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=(r,l)=>{const d=Math.floor(r*10**l+fr);return(Math.round(d)/10**l).toFixed(l)},a=(r,l,d,u)=>{if((n.length===0||!s.colonNotation)&&r===0&&!(s.colonNotation&&d==="m"))return;u=(u||r||"0").toString();let c,h;if(s.colonNotation){c=n.length>0?":":"",h="";const y=u.includes(".")?u.split(".")[0].length:u.length,p=n.length>0?2:1;u="0".repeat(Math.max(0,p-y))+u}else c="",h=s.verbose?" "+hr(l,r):d;n.push(c+u+h)},o=mr(e);if(a(Math.trunc(o.days/365),"year","y"),a(o.days%365,"day","d"),a(o.hours,"hour","h"),a(o.minutes,"minute","m"),s.separateMilliseconds||s.formatSubMilliseconds||!s.colonNotation&&e<1e3)if(a(o.seconds,"second","s"),s.formatSubMilliseconds)a(o.milliseconds,"millisecond","ms"),a(o.microseconds,"microsecond","µs"),a(o.nanoseconds,"nanosecond","ns");else{const r=o.milliseconds+o.microseconds/1e3+o.nanoseconds/1e6,l=typeof s.millisecondsDecimalDigits=="number"?s.millisecondsDecimalDigits:0,d=r>=1?Math.round(r):Math.ceil(r),u=l?r.toFixed(l):d;a(Number.parseFloat(u),"millisecond","ms",u)}else{const r=e/1e3%60,l=typeof s.secondsDecimalDigits=="number"?s.secondsDecimalDigits:1,d=i(r,l),u=s.keepDecimalsOnWholeSeconds?d:d.replace(/\.0+$/,"");a(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 r=s.colonNotation?"":" ";return n.slice(0,Math.max(s.unitCount,1)).join(r)}return s.colonNotation?n.join(""):n.join(" ")}const pr=({kind:e,size:s=6,className:n})=>t.jsx("span",{className:`status-dot status-dot-${e}${n?" "+n:""}`,style:{width:s,height:s},"aria-hidden":!0}),gr=({kind:e,showDot:s,children:n})=>t.jsxs("span",{className:`status-code status-code-${e}`,children:[s&&t.jsx(pr,{kind:e}),t.jsx("span",{className:"status-code-label",children:String(n).toUpperCase()})]}),Fs=({label:e,value:s,mono:n,valueClassName:i})=>t.jsxs("div",{className:"kv-row",children:[t.jsx("span",{className:"kv-label",children:e}),t.jsx("span",{className:`kv-value${n?" kv-value-mono":""}${i?" "+i:""}`,children:s})]}),xr=["top","right","bottom","left"],Ue=Math.min,he=Math.max,Ut=Math.round,Ot=Math.floor,De=e=>({x:e,y:e}),yr={left:"right",right:"left",bottom:"top",top:"bottom"};function ps(e,s,n){return he(e,Ue(s,n))}function _e(e,s){return typeof e=="function"?e(s):e}function Oe(e){return e.split("-")[0]}function pt(e){return e.split("-")[1]}function Ns(e){return e==="x"?"y":"x"}function Cs(e){return e==="y"?"height":"width"}function Ee(e){const s=e[0];return s==="t"||s==="b"?"y":"x"}function Ss(e){return Ns(Ee(e))}function vr(e,s,n){n===void 0&&(n=!1);const i=pt(e),a=Ss(e),o=Cs(a);let r=a==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return s.reference[o]>s.floating[o]&&(r=Wt(r)),[r,Wt(r)]}function br(e){const s=Wt(e);return[gs(e),s,gs(s)]}function gs(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Bs=["left","right"],Hs=["right","left"],wr=["top","bottom"],jr=["bottom","top"];function Nr(e,s,n){switch(e){case"top":case"bottom":return n?s?Hs:Bs:s?Bs:Hs;case"left":case"right":return s?wr:jr;default:return[]}}function Cr(e,s,n,i){const a=pt(e);let o=Nr(Oe(e),n==="start",i);return a&&(o=o.map(r=>r+"-"+a),s&&(o=o.concat(o.map(gs)))),o}function Wt(e){const s=Oe(e);return yr[s]+e.slice(s.length)}function Sr(e){return{top:0,right:0,bottom:0,left:0,...e}}function un(e){return typeof e!="number"?Sr(e):{top:e,right:e,bottom:e,left:e}}function Vt(e){const{x:s,y:n,width:i,height:a}=e;return{width:i,height:a,top:n,left:s,right:s+i,bottom:n+a,x:s,y:n}}function Us(e,s,n){let{reference:i,floating:a}=e;const o=Ee(s),r=Ss(s),l=Cs(r),d=Oe(s),u=o==="y",c=i.x+i.width/2-a.width/2,h=i.y+i.height/2-a.height/2,y=i[l]/2-a[l]/2;let p;switch(d){case"top":p={x:c,y:i.y-a.height};break;case"bottom":p={x:c,y:i.y+i.height};break;case"right":p={x:i.x+i.width,y:h};break;case"left":p={x:i.x-a.width,y:h};break;default:p={x:i.x,y:i.y}}switch(pt(s)){case"start":p[r]-=y*(n&&u?-1:1);break;case"end":p[r]+=y*(n&&u?-1:1);break}return p}async function kr(e,s){var n;s===void 0&&(s={});const{x:i,y:a,platform:o,rects:r,elements:l,strategy:d}=e,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:h="floating",altBoundary:y=!1,padding:p=0}=_e(s,e),b=un(p),g=l[y?h==="floating"?"reference":"floating":h],S=Vt(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(l.floating)),boundary:u,rootBoundary:c,strategy:d})),j=h==="floating"?{x:i,y:a,width:r.floating.width,height:r.floating.height}:r.reference,w=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l.floating)),v=await(o.isElement==null?void 0:o.isElement(w))?await(o.getScale==null?void 0:o.getScale(w))||{x:1,y:1}:{x:1,y:1},E=Vt(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:j,offsetParent:w,strategy:d}):j);return{top:(S.top-E.top+b.top)/v.y,bottom:(E.bottom-S.bottom+b.bottom)/v.y,left:(S.left-E.left+b.left)/v.x,right:(E.right-S.right+b.right)/v.x}}const Ar=50,Rr=async(e,s,n)=>{const{placement:i="bottom",strategy:a="absolute",middleware:o=[],platform:r}=n,l=r.detectOverflow?r:{...r,detectOverflow:kr},d=await(r.isRTL==null?void 0:r.isRTL(s));let u=await r.getElementRects({reference:e,floating:s,strategy:a}),{x:c,y:h}=Us(u,i,d),y=i,p=0;const b={};for(let x=0;x<o.length;x++){const g=o[x];if(!g)continue;const{name:S,fn:j}=g,{x:w,y:v,data:E,reset:A}=await j({x:c,y:h,initialPlacement:i,placement:y,strategy:a,middlewareData:b,rects:u,platform:l,elements:{reference:e,floating:s}});c=w??c,h=v??h,b[S]={...b[S],...E},A&&p<Ar&&(p++,typeof A=="object"&&(A.placement&&(y=A.placement),A.rects&&(u=A.rects===!0?await r.getElementRects({reference:e,floating:s,strategy:a}):A.rects),{x:c,y:h}=Us(u,y,d)),x=-1)}return{x:c,y:h,placement:y,strategy:a,middlewareData:b}},Er=e=>({name:"arrow",options:e,async fn(s){const{x:n,y:i,placement:a,rects:o,platform:r,elements:l,middlewareData:d}=s,{element:u,padding:c=0}=_e(e,s)||{};if(u==null)return{};const h=un(c),y={x:n,y:i},p=Ss(a),b=Cs(p),x=await r.getDimensions(u),g=p==="y",S=g?"top":"left",j=g?"bottom":"right",w=g?"clientHeight":"clientWidth",v=o.reference[b]+o.reference[p]-y[p]-o.floating[b],E=y[p]-o.reference[p],A=await(r.getOffsetParent==null?void 0:r.getOffsetParent(u));let L=A?A[w]:0;(!L||!await(r.isElement==null?void 0:r.isElement(A)))&&(L=l.floating[w]||o.floating[b]);const D=v/2-E/2,V=L/2-x[b]/2-1,I=Ue(h[S],V),Y=Ue(h[j],V),q=I,K=L-x[b]-Y,N=L/2-x[b]/2+D,ne=ps(q,N,K),O=!d.arrow&&pt(a)!=null&&N!==ne&&o.reference[b]/2-(N<q?I:Y)-x[b]/2<0,J=O?N<q?N-q:N-K:0;return{[p]:y[p]+J,data:{[p]:ne,centerOffset:N-ne-J,...O&&{alignmentOffset:J}},reset:O}}}),Dr=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(s){var n,i;const{placement:a,middlewareData:o,rects:r,initialPlacement:l,platform:d,elements:u}=s,{mainAxis:c=!0,crossAxis:h=!0,fallbackPlacements:y,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:x=!0,...g}=_e(e,s);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const S=Oe(a),j=Ee(l),w=Oe(l)===l,v=await(d.isRTL==null?void 0:d.isRTL(u.floating)),E=y||(w||!x?[Wt(l)]:br(l)),A=b!=="none";!y&&A&&E.push(...Cr(l,x,b,v));const L=[l,...E],D=await d.detectOverflow(s,g),V=[];let I=((i=o.flip)==null?void 0:i.overflows)||[];if(c&&V.push(D[S]),h){const N=vr(a,r,v);V.push(D[N[0]],D[N[1]])}if(I=[...I,{placement:a,overflows:V}],!V.every(N=>N<=0)){var Y,q;const N=(((Y=o.flip)==null?void 0:Y.index)||0)+1,ne=L[N];if(ne&&(!(h==="alignment"?j!==Ee(ne):!1)||I.every(_=>Ee(_.placement)===j?_.overflows[0]>0:!0)))return{data:{index:N,overflows:I},reset:{placement:ne}};let O=(q=I.filter(J=>J.overflows[0]<=0).sort((J,_)=>J.overflows[1]-_.overflows[1])[0])==null?void 0:q.placement;if(!O)switch(p){case"bestFit":{var K;const J=(K=I.filter(_=>{if(A){const Q=Ee(_.placement);return Q===j||Q==="y"}return!0}).map(_=>[_.placement,_.overflows.filter(Q=>Q>0).reduce((Q,re)=>Q+re,0)]).sort((_,Q)=>_[1]-Q[1])[0])==null?void 0:K[0];J&&(O=J);break}case"initialPlacement":O=l;break}if(a!==O)return{reset:{placement:O}}}return{}}}};function Ws(e,s){return{top:e.top-s.height,right:e.right-s.width,bottom:e.bottom-s.height,left:e.left-s.width}}function Vs(e){return xr.some(s=>e[s]>=0)}const $r=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(s){const{rects:n,platform:i}=s,{strategy:a="referenceHidden",...o}=_e(e,s);switch(a){case"referenceHidden":{const r=await i.detectOverflow(s,{...o,elementContext:"reference"}),l=Ws(r,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Vs(l)}}}case"escaped":{const r=await i.detectOverflow(s,{...o,altBoundary:!0}),l=Ws(r,n.floating);return{data:{escapedOffsets:l,escaped:Vs(l)}}}default:return{}}}}},mn=new Set(["left","top"]);async function Tr(e,s){const{placement:n,platform:i,elements:a}=e,o=await(i.isRTL==null?void 0:i.isRTL(a.floating)),r=Oe(n),l=pt(n),d=Ee(n)==="y",u=mn.has(r)?-1:1,c=o&&d?-1:1,h=_e(s,e);let{mainAxis:y,crossAxis:p,alignmentAxis:b}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof b=="number"&&(p=l==="end"?b*-1:b),d?{x:p*c,y:y*u}:{x:y*u,y:p*c}}const Lr=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(s){var n,i;const{x:a,y:o,placement:r,middlewareData:l}=s,d=await Tr(s,e);return r===((n=l.offset)==null?void 0:n.placement)&&(i=l.arrow)!=null&&i.alignmentOffset?{}:{x:a+d.x,y:o+d.y,data:{...d,placement:r}}}}},Mr=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(s){const{x:n,y:i,placement:a,platform:o}=s,{mainAxis:r=!0,crossAxis:l=!1,limiter:d={fn:S=>{let{x:j,y:w}=S;return{x:j,y:w}}},...u}=_e(e,s),c={x:n,y:i},h=await o.detectOverflow(s,u),y=Ee(Oe(a)),p=Ns(y);let b=c[p],x=c[y];if(r){const S=p==="y"?"top":"left",j=p==="y"?"bottom":"right",w=b+h[S],v=b-h[j];b=ps(w,b,v)}if(l){const S=y==="y"?"top":"left",j=y==="y"?"bottom":"right",w=x+h[S],v=x-h[j];x=ps(w,x,v)}const g=d.fn({...s,[p]:b,[y]:x});return{...g,data:{x:g.x-n,y:g.y-i,enabled:{[p]:r,[y]:l}}}}}},Ir=function(e){return e===void 0&&(e={}),{options:e,fn(s){const{x:n,y:i,placement:a,rects:o,middlewareData:r}=s,{offset:l=0,mainAxis:d=!0,crossAxis:u=!0}=_e(e,s),c={x:n,y:i},h=Ee(a),y=Ns(h);let p=c[y],b=c[h];const x=_e(l,s),g=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(d){const w=y==="y"?"height":"width",v=o.reference[y]-o.floating[w]+g.mainAxis,E=o.reference[y]+o.reference[w]-g.mainAxis;p<v?p=v:p>E&&(p=E)}if(u){var S,j;const w=y==="y"?"width":"height",v=mn.has(Oe(a)),E=o.reference[h]-o.floating[w]+(v&&((S=r.offset)==null?void 0:S[h])||0)+(v?0:g.crossAxis),A=o.reference[h]+o.reference[w]+(v?0:((j=r.offset)==null?void 0:j[h])||0)-(v?g.crossAxis:0);b<E?b=E:b>A&&(b=A)}return{[y]:p,[h]:b}}}},_r=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(s){var n,i;const{placement:a,rects:o,platform:r,elements:l}=s,{apply:d=()=>{},...u}=_e(e,s),c=await r.detectOverflow(s,u),h=Oe(a),y=pt(a),p=Ee(a)==="y",{width:b,height:x}=o.floating;let g,S;h==="top"||h==="bottom"?(g=h,S=y===(await(r.isRTL==null?void 0:r.isRTL(l.floating))?"start":"end")?"left":"right"):(S=h,g=y==="end"?"top":"bottom");const j=x-c.top-c.bottom,w=b-c.left-c.right,v=Ue(x-c[g],j),E=Ue(b-c[S],w),A=!s.middlewareData.shift;let L=v,D=E;if((n=s.middlewareData.shift)!=null&&n.enabled.x&&(D=w),(i=s.middlewareData.shift)!=null&&i.enabled.y&&(L=j),A&&!y){const I=he(c.left,0),Y=he(c.right,0),q=he(c.top,0),K=he(c.bottom,0);p?D=b-2*(I!==0||Y!==0?I+Y:he(c.left,c.right)):L=x-2*(q!==0||K!==0?q+K:he(c.top,c.bottom))}await d({...s,availableWidth:D,availableHeight:L});const V=await r.getDimensions(l.floating);return b!==V.width||x!==V.height?{reset:{rects:!0}}:{}}}};function Yt(){return typeof window<"u"}function gt(e){return hn(e)?(e.nodeName||"").toLowerCase():"#document"}function fe(e){var s;return(e==null||(s=e.ownerDocument)==null?void 0:s.defaultView)||window}function $e(e){var s;return(s=(hn(e)?e.ownerDocument:e.document)||window.document)==null?void 0:s.documentElement}function hn(e){return Yt()?e instanceof Node||e instanceof fe(e).Node:!1}function we(e){return Yt()?e instanceof Element||e instanceof fe(e).Element:!1}function ze(e){return Yt()?e instanceof HTMLElement||e instanceof fe(e).HTMLElement:!1}function qs(e){return!Yt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof fe(e).ShadowRoot}function Et(e){const{overflow:s,overflowX:n,overflowY:i,display:a}=je(e);return/auto|scroll|overlay|hidden|clip/.test(s+i+n)&&a!=="inline"&&a!=="contents"}function Or(e){return/^(table|td|th)$/.test(gt(e))}function Gt(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Pr=/transform|translate|scale|rotate|perspective|filter/,zr=/paint|layout|strict|content/,et=e=>!!e&&e!=="none";let rs;function ks(e){const s=we(e)?je(e):e;return et(s.transform)||et(s.translate)||et(s.scale)||et(s.rotate)||et(s.perspective)||!As()&&(et(s.backdropFilter)||et(s.filter))||Pr.test(s.willChange||"")||zr.test(s.contain||"")}function Fr(e){let s=We(e);for(;ze(s)&&!ht(s);){if(ks(s))return s;if(Gt(s))return null;s=We(s)}return null}function As(){return rs==null&&(rs=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),rs}function ht(e){return/^(html|body|#document)$/.test(gt(e))}function je(e){return fe(e).getComputedStyle(e)}function Zt(e){return we(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function We(e){if(gt(e)==="html")return e;const s=e.assignedSlot||e.parentNode||qs(e)&&e.host||$e(e);return qs(s)?s.host:s}function fn(e){const s=We(e);return ht(s)?e.ownerDocument?e.ownerDocument.body:e.body:ze(s)&&Et(s)?s:fn(s)}function At(e,s,n){var i;s===void 0&&(s=[]),n===void 0&&(n=!0);const a=fn(e),o=a===((i=e.ownerDocument)==null?void 0:i.body),r=fe(a);if(o){const l=xs(r);return s.concat(r,r.visualViewport||[],Et(a)?a:[],l&&n?At(l):[])}else return s.concat(a,At(a,[],n))}function xs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function pn(e){const s=je(e);let n=parseFloat(s.width)||0,i=parseFloat(s.height)||0;const a=ze(e),o=a?e.offsetWidth:n,r=a?e.offsetHeight:i,l=Ut(n)!==o||Ut(i)!==r;return l&&(n=o,i=r),{width:n,height:i,$:l}}function Rs(e){return we(e)?e:e.contextElement}function mt(e){const s=Rs(e);if(!ze(s))return De(1);const n=s.getBoundingClientRect(),{width:i,height:a,$:o}=pn(s);let r=(o?Ut(n.width):n.width)/i,l=(o?Ut(n.height):n.height)/a;return(!r||!Number.isFinite(r))&&(r=1),(!l||!Number.isFinite(l))&&(l=1),{x:r,y:l}}const Br=De(0);function gn(e){const s=fe(e);return!As()||!s.visualViewport?Br:{x:s.visualViewport.offsetLeft,y:s.visualViewport.offsetTop}}function Hr(e,s,n){return s===void 0&&(s=!1),!n||s&&n!==fe(e)?!1:s}function st(e,s,n,i){s===void 0&&(s=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),o=Rs(e);let r=De(1);s&&(i?we(i)&&(r=mt(i)):r=mt(e));const l=Hr(o,n,i)?gn(o):De(0);let d=(a.left+l.x)/r.x,u=(a.top+l.y)/r.y,c=a.width/r.x,h=a.height/r.y;if(o){const y=fe(o),p=i&&we(i)?fe(i):i;let b=y,x=xs(b);for(;x&&i&&p!==b;){const g=mt(x),S=x.getBoundingClientRect(),j=je(x),w=S.left+(x.clientLeft+parseFloat(j.paddingLeft))*g.x,v=S.top+(x.clientTop+parseFloat(j.paddingTop))*g.y;d*=g.x,u*=g.y,c*=g.x,h*=g.y,d+=w,u+=v,b=fe(x),x=xs(b)}}return Vt({width:c,height:h,x:d,y:u})}function Jt(e,s){const n=Zt(e).scrollLeft;return s?s.left+n:st($e(e)).left+n}function xn(e,s){const n=e.getBoundingClientRect(),i=n.left+s.scrollLeft-Jt(e,n),a=n.top+s.scrollTop;return{x:i,y:a}}function Ur(e){let{elements:s,rect:n,offsetParent:i,strategy:a}=e;const o=a==="fixed",r=$e(i),l=s?Gt(s.floating):!1;if(i===r||l&&o)return n;let d={scrollLeft:0,scrollTop:0},u=De(1);const c=De(0),h=ze(i);if((h||!h&&!o)&&((gt(i)!=="body"||Et(r))&&(d=Zt(i)),h)){const p=st(i);u=mt(i),c.x=p.x+i.clientLeft,c.y=p.y+i.clientTop}const y=r&&!h&&!o?xn(r,d):De(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-d.scrollLeft*u.x+c.x+y.x,y:n.y*u.y-d.scrollTop*u.y+c.y+y.y}}function Wr(e){return Array.from(e.getClientRects())}function Vr(e){const s=$e(e),n=Zt(e),i=e.ownerDocument.body,a=he(s.scrollWidth,s.clientWidth,i.scrollWidth,i.clientWidth),o=he(s.scrollHeight,s.clientHeight,i.scrollHeight,i.clientHeight);let r=-n.scrollLeft+Jt(e);const l=-n.scrollTop;return je(i).direction==="rtl"&&(r+=he(s.clientWidth,i.clientWidth)-a),{width:a,height:o,x:r,y:l}}const Xs=25;function qr(e,s){const n=fe(e),i=$e(e),a=n.visualViewport;let o=i.clientWidth,r=i.clientHeight,l=0,d=0;if(a){o=a.width,r=a.height;const c=As();(!c||c&&s==="fixed")&&(l=a.offsetLeft,d=a.offsetTop)}const u=Jt(i);if(u<=0){const c=i.ownerDocument,h=c.body,y=getComputedStyle(h),p=c.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,b=Math.abs(i.clientWidth-h.clientWidth-p);b<=Xs&&(o-=b)}else u<=Xs&&(o+=u);return{width:o,height:r,x:l,y:d}}function Xr(e,s){const n=st(e,!0,s==="fixed"),i=n.top+e.clientTop,a=n.left+e.clientLeft,o=ze(e)?mt(e):De(1),r=e.clientWidth*o.x,l=e.clientHeight*o.y,d=a*o.x,u=i*o.y;return{width:r,height:l,x:d,y:u}}function Ks(e,s,n){let i;if(s==="viewport")i=qr(e,n);else if(s==="document")i=Vr($e(e));else if(we(s))i=Xr(s,n);else{const a=gn(e);i={x:s.x-a.x,y:s.y-a.y,width:s.width,height:s.height}}return Vt(i)}function yn(e,s){const n=We(e);return n===s||!we(n)||ht(n)?!1:je(n).position==="fixed"||yn(n,s)}function Kr(e,s){const n=s.get(e);if(n)return n;let i=At(e,[],!1).filter(l=>we(l)&&gt(l)!=="body"),a=null;const o=je(e).position==="fixed";let r=o?We(e):e;for(;we(r)&&!ht(r);){const l=je(r),d=ks(r);!d&&l.position==="fixed"&&(a=null),(o?!d&&!a:!d&&l.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||Et(r)&&!d&&yn(e,r))?i=i.filter(c=>c!==r):a=l,r=We(r)}return s.set(e,i),i}function Yr(e){let{element:s,boundary:n,rootBoundary:i,strategy:a}=e;const r=[...n==="clippingAncestors"?Gt(s)?[]:Kr(s,this._c):[].concat(n),i],l=Ks(s,r[0],a);let d=l.top,u=l.right,c=l.bottom,h=l.left;for(let y=1;y<r.length;y++){const p=Ks(s,r[y],a);d=he(p.top,d),u=Ue(p.right,u),c=Ue(p.bottom,c),h=he(p.left,h)}return{width:u-h,height:c-d,x:h,y:d}}function Gr(e){const{width:s,height:n}=pn(e);return{width:s,height:n}}function Zr(e,s,n){const i=ze(s),a=$e(s),o=n==="fixed",r=st(e,!0,o,s);let l={scrollLeft:0,scrollTop:0};const d=De(0);function u(){d.x=Jt(a)}if(i||!i&&!o)if((gt(s)!=="body"||Et(a))&&(l=Zt(s)),i){const p=st(s,!0,o,s);d.x=p.x+s.clientLeft,d.y=p.y+s.clientTop}else a&&u();o&&!i&&a&&u();const c=a&&!i&&!o?xn(a,l):De(0),h=r.left+l.scrollLeft-d.x-c.x,y=r.top+l.scrollTop-d.y-c.y;return{x:h,y,width:r.width,height:r.height}}function as(e){return je(e).position==="static"}function Ys(e,s){if(!ze(e)||je(e).position==="fixed")return null;if(s)return s(e);let n=e.offsetParent;return $e(e)===n&&(n=n.ownerDocument.body),n}function vn(e,s){const n=fe(e);if(Gt(e))return n;if(!ze(e)){let a=We(e);for(;a&&!ht(a);){if(we(a)&&!as(a))return a;a=We(a)}return n}let i=Ys(e,s);for(;i&&Or(i)&&as(i);)i=Ys(i,s);return i&&ht(i)&&as(i)&&!ks(i)?n:i||Fr(e)||n}const Jr=async function(e){const s=this.getOffsetParent||vn,n=this.getDimensions,i=await n(e.floating);return{reference:Zr(e.reference,await s(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Qr(e){return je(e).direction==="rtl"}const ea={convertOffsetParentRelativeRectToViewportRelativeRect:Ur,getDocumentElement:$e,getClippingRect:Yr,getOffsetParent:vn,getElementRects:Jr,getClientRects:Wr,getDimensions:Gr,getScale:mt,isElement:we,isRTL:Qr};function bn(e,s){return e.x===s.x&&e.y===s.y&&e.width===s.width&&e.height===s.height}function ta(e,s){let n=null,i;const a=$e(e);function o(){var l;clearTimeout(i),(l=n)==null||l.disconnect(),n=null}function r(l,d){l===void 0&&(l=!1),d===void 0&&(d=1),o();const u=e.getBoundingClientRect(),{left:c,top:h,width:y,height:p}=u;if(l||s(),!y||!p)return;const b=Ot(h),x=Ot(a.clientWidth-(c+y)),g=Ot(a.clientHeight-(h+p)),S=Ot(c),w={rootMargin:-b+"px "+-x+"px "+-g+"px "+-S+"px",threshold:he(0,Ue(1,d))||1};let v=!0;function E(A){const L=A[0].intersectionRatio;if(L!==d){if(!v)return r();L?r(!1,L):i=setTimeout(()=>{r(!1,1e-7)},1e3)}L===1&&!bn(u,e.getBoundingClientRect())&&r(),v=!1}try{n=new IntersectionObserver(E,{...w,root:a.ownerDocument})}catch{n=new IntersectionObserver(E,w)}n.observe(e)}return r(!0),o}function sa(e,s,n,i){i===void 0&&(i={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:r=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:d=!1}=i,u=Rs(e),c=a||o?[...u?At(u):[],...s?At(s):[]]:[];c.forEach(S=>{a&&S.addEventListener("scroll",n,{passive:!0}),o&&S.addEventListener("resize",n)});const h=u&&l?ta(u,n):null;let y=-1,p=null;r&&(p=new ResizeObserver(S=>{let[j]=S;j&&j.target===u&&p&&s&&(p.unobserve(s),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(s)})),n()}),u&&!d&&p.observe(u),s&&p.observe(s));let b,x=d?st(e):null;d&&g();function g(){const S=st(e);x&&!bn(x,S)&&n(),x=S,b=requestAnimationFrame(g)}return n(),()=>{var S;c.forEach(j=>{a&&j.removeEventListener("scroll",n),o&&j.removeEventListener("resize",n)}),h==null||h(),(S=p)==null||S.disconnect(),p=null,d&&cancelAnimationFrame(b)}}const na=Lr,ia=Mr,ra=Dr,aa=_r,oa=$r,Gs=Er,ca=Ir,la=(e,s,n)=>{const i=new Map,a={platform:ea,...n},o={...a.platform,_c:i};return Rr(e,s,{...a,platform:o})};var da=typeof document<"u",ua=function(){},Bt=da?m.useLayoutEffect:ua;function qt(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,a;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(!qt(e[i],s[i]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(s).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(s,a[i]))return!1;for(i=n;i--!==0;){const o=a[i];if(!(o==="_owner"&&e.$$typeof)&&!qt(e[o],s[o]))return!1}return!0}return e!==e&&s!==s}function wn(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Zs(e,s){const n=wn(e);return Math.round(s*n)/n}function os(e){const s=m.useRef(e);return Bt(()=>{s.current=e}),s}function ma(e){e===void 0&&(e={});const{placement:s="bottom",strategy:n="absolute",middleware:i=[],platform:a,elements:{reference:o,floating:r}={},transform:l=!0,whileElementsMounted:d,open:u}=e,[c,h]=m.useState({x:0,y:0,strategy:n,placement:s,middlewareData:{},isPositioned:!1}),[y,p]=m.useState(i);qt(y,i)||p(i);const[b,x]=m.useState(null),[g,S]=m.useState(null),j=m.useCallback(_=>{_!==A.current&&(A.current=_,x(_))},[]),w=m.useCallback(_=>{_!==L.current&&(L.current=_,S(_))},[]),v=o||b,E=r||g,A=m.useRef(null),L=m.useRef(null),D=m.useRef(c),V=d!=null,I=os(d),Y=os(a),q=os(u),K=m.useCallback(()=>{if(!A.current||!L.current)return;const _={placement:s,strategy:n,middleware:y};Y.current&&(_.platform=Y.current),la(A.current,L.current,_).then(Q=>{const re={...Q,isPositioned:q.current!==!1};N.current&&!qt(D.current,re)&&(D.current=re,zn.flushSync(()=>{h(re)}))})},[y,s,n,Y,q]);Bt(()=>{u===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,h(_=>({..._,isPositioned:!1})))},[u]);const N=m.useRef(!1);Bt(()=>(N.current=!0,()=>{N.current=!1}),[]),Bt(()=>{if(v&&(A.current=v),E&&(L.current=E),v&&E){if(I.current)return I.current(v,E,K);K()}},[v,E,K,I,V]);const ne=m.useMemo(()=>({reference:A,floating:L,setReference:j,setFloating:w}),[j,w]),O=m.useMemo(()=>({reference:v,floating:E}),[v,E]),J=m.useMemo(()=>{const _={position:n,left:0,top:0};if(!O.floating)return _;const Q=Zs(O.floating,c.x),re=Zs(O.floating,c.y);return l?{..._,transform:"translate("+Q+"px, "+re+"px)",...wn(O.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Q,top:re}},[n,l,O.floating,c.x,c.y]);return m.useMemo(()=>({...c,update:K,refs:ne,elements:O,floatingStyles:J}),[c,K,ne,O,J])}const ha=e=>{function s(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:i,padding:a}=typeof e=="function"?e(n):e;return i&&s(i)?i.current!=null?Gs({element:i.current,padding:a}).fn(n):{}:i?Gs({element:i,padding:a}).fn(n):{}}}},fa=(e,s)=>{const n=na(e);return{name:n.name,fn:n.fn,options:[e,s]}},pa=(e,s)=>{const n=ia(e);return{name:n.name,fn:n.fn,options:[e,s]}},ga=(e,s)=>({fn:ca(e).fn,options:[e,s]}),xa=(e,s)=>{const n=ra(e);return{name:n.name,fn:n.fn,options:[e,s]}},ya=(e,s)=>{const n=aa(e);return{name:n.name,fn:n.fn,options:[e,s]}},va=(e,s)=>{const n=oa(e);return{name:n.name,fn:n.fn,options:[e,s]}},ba=(e,s)=>{const n=ha(e);return{name:n.name,fn:n.fn,options:[e,s]}};var wa="Arrow",jn=m.forwardRef((e,s)=>{const{children:n,width:i=10,height:a=5,...o}=e;return t.jsx(Rt.svg,{...o,ref:s,width:i,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:t.jsx("polygon",{points:"0,0 30,0 15,10"})})});jn.displayName=wa;var ja=jn;function Na(e){const[s,n]=m.useState(void 0);return Ht(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const o=a[0];let r,l;if("borderBoxSize"in o){const d=o.borderBoxSize,u=Array.isArray(d)?d[0]:d;r=u.inlineSize,l=u.blockSize}else r=e.offsetWidth,l=e.offsetHeight;n({width:r,height:l})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else n(void 0)},[e]),s}var Es="Popper",[Nn]=js(Es),[Ca,Cn]=Nn(Es),Sn=e=>{const{__scopePopper:s,children:n}=e,[i,a]=m.useState(null);return t.jsx(Ca,{scope:s,anchor:i,onAnchorChange:a,children:n})};Sn.displayName=Es;var kn="PopperAnchor",An=m.forwardRef((e,s)=>{const{__scopePopper:n,virtualRef:i,...a}=e,o=Cn(kn,n),r=m.useRef(null),l=kt(s,r),d=m.useRef(null);return m.useEffect(()=>{const u=d.current;d.current=(i==null?void 0:i.current)||r.current,u!==d.current&&o.onAnchorChange(d.current)}),i?null:t.jsx(Rt.div,{...a,ref:l})});An.displayName=kn;var Ds="PopperContent",[Sa,ka]=Nn(Ds),Rn=m.forwardRef((e,s)=>{var it,pe,rt,Fe,Le,Be;const{__scopePopper:n,side:i="bottom",sideOffset:a=0,align:o="center",alignOffset:r=0,arrowPadding:l=0,avoidCollisions:d=!0,collisionBoundary:u=[],collisionPadding:c=0,sticky:h="partial",hideWhenDetached:y=!1,updatePositionStrategy:p="optimized",onPlaced:b,...x}=e,g=Cn(Ds,n),[S,j]=m.useState(null),w=kt(s,me=>j(me)),[v,E]=m.useState(null),A=Na(v),L=(A==null?void 0:A.width)??0,D=(A==null?void 0:A.height)??0,V=i+(o!=="center"?"-"+o:""),I=typeof c=="number"?c:{top:0,right:0,bottom:0,left:0,...c},Y=Array.isArray(u)?u:[u],q=Y.length>0,K={padding:I,boundary:Y.filter(Ea),altBoundary:q},{refs:N,floatingStyles:ne,placement:O,isPositioned:J,middlewareData:_}=ma({strategy:"fixed",placement:V,whileElementsMounted:(...me)=>sa(...me,{animationFrame:p==="always"}),elements:{reference:g.anchor},middleware:[fa({mainAxis:a+D,alignmentAxis:r}),d&&pa({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?ga():void 0,...K}),d&&xa({...K}),ya({...K,apply:({elements:me,rects:Me,availableWidth:at,availableHeight:He})=>{const{width:Ve,height:qe}=Me.reference,Ce=me.floating.style;Ce.setProperty("--radix-popper-available-width",`${at}px`),Ce.setProperty("--radix-popper-available-height",`${He}px`),Ce.setProperty("--radix-popper-anchor-width",`${Ve}px`),Ce.setProperty("--radix-popper-anchor-height",`${qe}px`)}}),v&&ba({element:v,padding:l}),Da({arrowWidth:L,arrowHeight:D}),y&&va({strategy:"referenceHidden",...K})]}),[Q,re]=Dn(O),Ne=an(b);Ht(()=>{J&&(Ne==null||Ne())},[J,Ne]);const ye=(it=_.arrow)==null?void 0:it.x,nt=(pe=_.arrow)==null?void 0:pe.y,ve=((rt=_.arrow)==null?void 0:rt.centerOffset)!==0,[Te,de]=m.useState();return Ht(()=>{S&&de(window.getComputedStyle(S).zIndex)},[S]),t.jsx("div",{ref:N.setFloating,"data-radix-popper-content-wrapper":"",style:{...ne,transform:J?ne.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Te,"--radix-popper-transform-origin":[(Fe=_.transformOrigin)==null?void 0:Fe.x,(Le=_.transformOrigin)==null?void 0:Le.y].join(" "),...((Be=_.hide)==null?void 0:Be.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:t.jsx(Sa,{scope:n,placedSide:Q,onArrowChange:E,arrowX:ye,arrowY:nt,shouldHideArrow:ve,children:t.jsx(Rt.div,{"data-side":Q,"data-align":re,...x,ref:w,style:{...x.style,animation:J?void 0:"none"}})})})});Rn.displayName=Ds;var En="PopperArrow",Aa={top:"bottom",right:"left",bottom:"top",left:"right"},Ra=m.forwardRef(function(s,n){const{__scopePopper:i,...a}=s,o=ka(En,i),r=Aa[o.placedSide];return t.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[r]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:t.jsx(ja,{...a,ref:n,style:{...a.style,display:"block"}})})});Ra.displayName=En;function Ea(e){return e!==null}var Da=e=>({name:"transformOrigin",options:e,fn(s){var g,S,j;const{placement:n,rects:i,middlewareData:a}=s,r=((g=a.arrow)==null?void 0:g.centerOffset)!==0,l=r?0:e.arrowWidth,d=r?0:e.arrowHeight,[u,c]=Dn(n),h={start:"0%",center:"50%",end:"100%"}[c],y=(((S=a.arrow)==null?void 0:S.x)??0)+l/2,p=(((j=a.arrow)==null?void 0:j.y)??0)+d/2;let b="",x="";return u==="bottom"?(b=r?h:`${y}px`,x=`${-d}px`):u==="top"?(b=r?h:`${y}px`,x=`${i.floating.height+d}px`):u==="right"?(b=`${-d}px`,x=r?h:`${p}px`):u==="left"&&(b=`${i.floating.width+d}px`,x=r?h:`${p}px`),{data:{x:b,y:x}}}});function Dn(e){const[s,n="center"]=e.split("-");return[s,n]}var $a=Sn,Ta=An,La=Rn,Ma=Symbol.for("react.lazy"),Xt=Fn[" use ".trim().toString()];function Ia(e){return typeof e=="object"&&e!==null&&"then"in e}function $n(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Ma&&"_payload"in e&&Ia(e._payload)}function _a(e){const s=Oa(e),n=m.forwardRef((i,a)=>{let{children:o,...r}=i;$n(o)&&typeof Xt=="function"&&(o=Xt(o._payload));const l=m.Children.toArray(o),d=l.find(za);if(d){const u=d.props.children,c=l.map(h=>h===d?m.Children.count(u)>1?m.Children.only(null):m.isValidElement(u)?u.props.children:null:h);return t.jsx(s,{...r,ref:a,children:m.isValidElement(u)?m.cloneElement(u,void 0,c):null})}return t.jsx(s,{...r,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}function Oa(e){const s=m.forwardRef((n,i)=>{let{children:a,...o}=n;if($n(a)&&typeof Xt=="function"&&(a=Xt(a._payload)),m.isValidElement(a)){const r=Ba(a),l=Fa(o,a.props);return a.type!==m.Fragment&&(l.ref=i?Xn(i,r):r),m.cloneElement(a,l)}return m.Children.count(a)>1?m.Children.only(null):null});return s.displayName=`${e}.SlotClone`,s}var Pa=Symbol("radix.slottable");function za(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Pa}function Fa(e,s){const n={...s};for(const i in s){const a=e[i],o=s[i];/^on[A-Z]/.test(i)?a&&o?n[i]=(...l)=>{const d=o(...l);return a(...l),d}:a&&(n[i]=a):i==="style"?n[i]={...a,...o}:i==="className"&&(n[i]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function Ba(e){var i,a;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=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=s&&"isReactWarning"in s&&s.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ha=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ua=Ha.reduce((e,s)=>{const n=_a(`Primitive.${s}`),i=m.forwardRef((a,o)=>{const{asChild:r,...l}=a,d=r?n:s;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),t.jsx(d,{...l,ref:o})});return i.displayName=`Primitive.${s}`,{...e,[s]:i}},{}),Wa="Portal",Tn=m.forwardRef((e,s)=>{var l;const{container:n,...i}=e,[a,o]=m.useState(!1);Ht(()=>o(!0),[]);const r=n||a&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return r?Bn.createPortal(t.jsx(Ua.div,{...i,ref:s}),r):null});Tn.displayName=Wa;const Va=({open:e,onClose:s,anchorRef:n,placement:i="bottom-end",children:a})=>{const o=m.useRef(null);if(m.useEffect(()=>{if(!e)return;const u=c=>{var h,y;e&&((h=o.current)!=null&&h.contains(c.target)||(y=n.current)!=null&&y.contains(c.target)||s())};return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[e,s,n]),!e)return null;const r=i.startsWith("top")?"top":"bottom",l=i.endsWith("end")?"end":"start",d=i.startsWith("top")?8:4;return t.jsxs($a,{children:[t.jsx(Ta,{virtualRef:n}),t.jsx(Tn,{children:t.jsx(Kn,{onEscapeKeyDown:u=>{u.preventDefault(),s()},onPointerDownOutside:u=>{var c;if((c=n.current)!=null&&c.contains(u.target)){u.preventDefault();return}s()},children:t.jsx(La,{ref:o,side:r,align:l,sideOffset:d,className:`popover popover-${i}`,role:"dialog",children:a})})})]})};function qa(e){const s=e+"CollectionProvider",[n,i]=js(s),[a,o]=n(s,{collectionRef:{current:null},itemMap:new Map}),r=x=>{const{scope:g,children:S}=x,j=Re.useRef(null),w=Re.useRef(new Map).current;return t.jsx(a,{scope:g,itemMap:w,collectionRef:j,children:S})};r.displayName=s;const l=e+"CollectionSlot",d=Os(l),u=Re.forwardRef((x,g)=>{const{scope:S,children:j}=x,w=o(l,S),v=kt(g,w.collectionRef);return t.jsx(d,{ref:v,children:j})});u.displayName=l;const c=e+"CollectionItemSlot",h="data-radix-collection-item",y=Os(c),p=Re.forwardRef((x,g)=>{const{scope:S,children:j,...w}=x,v=Re.useRef(null),E=kt(g,v),A=o(c,S);return Re.useEffect(()=>(A.itemMap.set(v,{ref:v,...w}),()=>void A.itemMap.delete(v))),t.jsx(y,{[h]:"",ref:E,children:j})});p.displayName=c;function b(x){const g=o(e+"CollectionConsumer",x);return Re.useCallback(()=>{const j=g.collectionRef.current;if(!j)return[];const w=Array.from(j.querySelectorAll(`[${h}]`));return Array.from(g.itemMap.values()).sort((A,L)=>w.indexOf(A.ref.current)-w.indexOf(L.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:r,Slot:u,ItemSlot:p},b,i]}var Xa=m.createContext(void 0);function Ka(e){const s=m.useContext(Xa);return e||s||"ltr"}var cs="rovingFocusGroup.onEntryFocus",Ya={bubbles:!1,cancelable:!0},Dt="RovingFocusGroup",[ys,Ln,Ga]=qa(Dt),[Za]=js(Dt,[Ga]),[Ja,Qa]=Za(Dt),Mn=m.forwardRef((e,s)=>t.jsx(ys.Provider,{scope:e.__scopeRovingFocusGroup,children:t.jsx(ys.Slot,{scope:e.__scopeRovingFocusGroup,children:t.jsx(eo,{...e,ref:s})})}));Mn.displayName=Dt;var eo=m.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:n,orientation:i,loop:a=!1,dir:o,currentTabStopId:r,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:d,onEntryFocus:u,preventScrollOnEntryFocus:c=!1,...h}=e,y=m.useRef(null),p=kt(s,y),b=Ka(o),[x,g]=Gn({prop:r,defaultProp:l??null,onChange:d,caller:Dt}),[S,j]=m.useState(!1),w=an(u),v=Ln(n),E=m.useRef(!1),[A,L]=m.useState(0);return m.useEffect(()=>{const D=y.current;if(D)return D.addEventListener(cs,w),()=>D.removeEventListener(cs,w)},[w]),t.jsx(Ja,{scope:n,orientation:i,dir:b,loop:a,currentTabStopId:x,onItemFocus:m.useCallback(D=>g(D),[g]),onItemShiftTab:m.useCallback(()=>j(!0),[]),onFocusableItemAdd:m.useCallback(()=>L(D=>D+1),[]),onFocusableItemRemove:m.useCallback(()=>L(D=>D-1),[]),children:t.jsx(Rt.div,{tabIndex:S||A===0?-1:0,"data-orientation":i,...h,ref:p,style:{outline:"none",...e.style},onMouseDown:ut(e.onMouseDown,()=>{E.current=!0}),onFocus:ut(e.onFocus,D=>{const V=!E.current;if(D.target===D.currentTarget&&V&&!S){const I=new CustomEvent(cs,Ya);if(D.currentTarget.dispatchEvent(I),!I.defaultPrevented){const Y=v().filter(O=>O.focusable),q=Y.find(O=>O.active),K=Y.find(O=>O.id===x),ne=[q,K,...Y].filter(Boolean).map(O=>O.ref.current);On(ne,c)}}E.current=!1}),onBlur:ut(e.onBlur,()=>j(!1))})})}),In="RovingFocusGroupItem",_n=m.forwardRef((e,s)=>{const{__scopeRovingFocusGroup:n,focusable:i=!0,active:a=!1,tabStopId:o,children:r,...l}=e,d=Yn(),u=o||d,c=Qa(In,n),h=c.currentTabStopId===u,y=Ln(n),{onFocusableItemAdd:p,onFocusableItemRemove:b,currentTabStopId:x}=c;return m.useEffect(()=>{if(i)return p(),()=>b()},[i,p,b]),t.jsx(ys.ItemSlot,{scope:n,id:u,focusable:i,active:a,children:t.jsx(Rt.span,{tabIndex:h?0:-1,"data-orientation":c.orientation,...l,ref:s,onMouseDown:ut(e.onMouseDown,g=>{i?c.onItemFocus(u):g.preventDefault()}),onFocus:ut(e.onFocus,()=>c.onItemFocus(u)),onKeyDown:ut(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){c.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const S=no(g,c.orientation,c.dir);if(S!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=y().filter(v=>v.focusable).map(v=>v.ref.current);if(S==="last")w.reverse();else if(S==="prev"||S==="next"){S==="prev"&&w.reverse();const v=w.indexOf(g.currentTarget);w=c.loop?io(w,v+1):w.slice(v+1)}setTimeout(()=>On(w))}}),children:typeof r=="function"?r({isCurrentTabStop:h,hasTabStop:x!=null}):r})})});_n.displayName=In;var to={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function so(e,s){return s!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function no(e,s,n){const i=so(e.key,n);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return to[i]}function On(e,s=!1){const n=document.activeElement;for(const i of e)if(i===n||(i.focus({preventScroll:s}),document.activeElement!==n))return}function io(e,s){return e.map((n,i)=>e[(s+i)%e.length])}var ro=Mn,ao=_n;const ls=({icon:e,children:s,onClick:n,danger:i,disabled:a})=>t.jsx(ao,{asChild:!0,focusable:!a,active:!1,children:t.jsxs("button",{type:"button",role:"menuitem",className:`menu-item${i?" menu-item-danger":""}`,onClick:n,disabled:a,children:[e&&t.jsx("span",{className:"menu-item-icon",children:e}),t.jsx("span",{className:"menu-item-label",children:s})]})}),oo=({children:e})=>t.jsx(ro,{asChild:!0,orientation:"vertical",loop:!0,children:t.jsx("div",{className:"menu",role:"menu",children:e})}),co=[{label:"1 Hour",value:"1h"},{label:"2 Hours",value:"2h"},{label:"4 Hours",value:"4h"},{label:"8 Hours",value:"8h"}],lo=({device:e,onClose:s,onReserved:n})=>{const[i,a]=m.useState(""),[o,r]=m.useState("1h"),[l,d]=m.useState(""),[u,c]=m.useState(!1),[h,y]=m.useState(null),[p,b]=m.useState(null),x=async()=>{if(!i.trim()){y("Please enter your name/ID");return}c(!0),y(null),b(null);try{const g=await P.reserveDevice(e.udid,e.host,i,o,l);g.success?(n(),s()):b(g.error||"Failed to reserve device")}catch(g){b(g.message||"An unexpected error occurred")}finally{c(!1)}};return t.jsx(on,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(yi,{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:x,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(zt,{label:t.jsxs(t.Fragment,{children:[t.jsx(Hn,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--green)"}}),"Reserved By"]}),htmlFor:"reservation-reserved-by",error:h?t.jsxs(t.Fragment,{children:[t.jsx(Ms,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),h]}):void 0,children:t.jsx("input",{id:"reservation-reserved-by",type:"text",className:"reservation-input",placeholder:"Enter your name or ID",value:i,onChange:g=>{a(g.target.value),h&&y(null)},disabled:u})}),t.jsx(zt,{label:t.jsxs(t.Fragment,{children:[t.jsx(cn,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--green)"}}),"Duration"]}),children:t.jsx("div",{className:"duration-selector",children:co.map(g=>t.jsx("div",{className:`duration-option ${o===g.value?"active":""}`,onClick:()=>r(g.value),children:g.label},g.value))})}),t.jsx(zt,{label:t.jsxs(t.Fragment,{children:[t.jsx(Hi,{size:14,style:{marginRight:6,verticalAlign:"middle",color:"var(--green)"}}),"Reason (Optional)"]}),htmlFor:"reservation-reason",error:p?t.jsxs(t.Fragment,{children:[t.jsx(Ms,{size:14,style:{marginRight:6,verticalAlign:"middle"}}),p]}):void 0,children:t.jsx("input",{id:"reservation-reason",type:"text",className:"reservation-input",placeholder:"e.g., Debugging flaky login test",value:l,onChange:g=>d(g.target.value),disabled:u})})]})})},uo=({device:e,onClose:s,onUpdated:n})=>{const{toast:i}=Kt(),[a,o]=m.useState(e.tags||[]),[r,l]=m.useState(""),[d,u]=m.useState(!1),c=m.useRef(null);m.useEffect(()=>{c.current&&c.current.focus()},[]);const h=()=>{const x=r.trim();x&&!a.includes(x)&&(o([...a,x]),l(""))},y=x=>{o(a.filter(g=>g!==x))},p=x=>{x.key==="Enter"&&h()},b=async()=>{u(!0);try{await P.updateDeviceTags(e.udid,e.host,a),n(),s()}catch(x){console.error("Failed to update tags",x),i("Error saving tags. Please try again.","error")}finally{u(!1)}};return t.jsx(on,{open:!0,onClose:s,width:520,title:t.jsxs(t.Fragment,{children:[t.jsx(er,{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:b,disabled:d,children:d?"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(zt,{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:c,id:"tag-input",type:"text",placeholder:"e.g. stable, team-a, ios-17",value:r,onChange:x=>l(x.target.value),onKeyDown:p}),t.jsx("button",{className:"add-inline-btn",onClick:h,disabled:!r.trim(),children:t.jsx(Zn,{size:16})})]})}),t.jsxs("div",{className:"tags-display-section",children:[t.jsx("label",{children:"Current Tags"}),t.jsx("div",{className:"tags-list",children:a.length>0?a.map(x=>t.jsxs("div",{className:"tag-pill-editable",children:[x,t.jsx("button",{className:"remove-tag",onClick:()=>y(x),children:t.jsx(Un,{size:12})})]},x)):t.jsx("div",{className:"empty-tags",children:"No tags assigned to this device."})})]})]})})};function mo(e){return e>=50?"ready":e>=20?"reserved":"error"}function ho(e){return e>=50?t.jsx(fi,{size:10}):e>=20?t.jsx(di,{size:10}):t.jsx(mi,{size:10})}function fo(e){return e==="Normal"?"ready":e==="Critical"?"error":"reserved"}const po=({device:e})=>{const s=typeof e.batteryLevel=="number",n=typeof e.thermalStatus=="string"&&e.thermalStatus.length>0&&e.thermalStatus!=="Unknown";return!s&&!n?t.jsx("div",{className:"dc2-health",children:t.jsxs(tt,{tone:"neutral",title:"Device does not report battery or thermal data",children:[t.jsx(Jn,{size:10}),"No telemetry"]})}):t.jsxs("div",{className:"dc2-health",children:[s&&t.jsxs(tt,{tone:mo(e.batteryLevel),title:`Battery ${e.batteryLevel}%`,children:[ho(e.batteryLevel),e.batteryLevel,"%"]}),n&&t.jsxs(tt,{tone:fo(e.thermalStatus),title:`Thermal: ${e.thermalStatus}`,children:[t.jsx(nr,{size:10}),e.thermalStatus]})]})};function go(e){return e==="127.0.0.1"||e==="localhost"||e==="0.0.0.0"}function xo(e){if(!e)return null;try{const s=new URL(e.includes("://")?e:`http://${e}`);return s.port?`${s.hostname}:${s.port}`:s.hostname}catch{return e}}function yo(e){if(e.ip)return e.ip;const s=xo(e.host);if(!s)return"—";const n=s.split(":")[0];return go(n)?"—":s}const Js="Shared",vo="Shared pool — visible to all authenticated users",bo=({udid:e,currentTeamId:s,resolvedTeamName:n,teams:i,canEdit:a,onChanged:o})=>{const{toast:r}=Kt(),[l,d]=m.useState(!1),[u,c]=m.useState(!1),h=s?i.get(s)??n??`Team ${s.slice(0,6)}`:Js;async function y(p){c(!0);try{await P.setDeviceTeam(e,p),r(p?"Device assigned":"Device returned to shared pool","success"),o(),d(!1)}catch(b){r((b==null?void 0:b.message)||"Failed to update team","error")}finally{c(!1)}}return a?l?t.jsxs(ws,{selectSize:"sm",autoFocus:!0,disabled:u,defaultValue:s??"",onBlur:()=>d(!1),onChange:p=>y(p.target.value||null),children:[t.jsx("option",{value:"",children:"(Shared pool)"}),Array.from(i.entries()).map(([p,b])=>t.jsx("option",{value:p,children:b},p))]}):t.jsx("button",{type:"button",onClick:()=>d(!0),className:"dc2-team-pill",title:s?"Click to change team":"Click to assign to a team",children:h}):s?t.jsx(tt,{tone:"accent",title:`Team: ${h}`,children:h}):t.jsx(tt,{tone:"neutral",title:vo,children:Js})};function wo(e){return e.offline?"offline":e.userBlocked?"error":e.busy?"busy":e.reservedUntil&&Date.now()<e.reservedUntil?"reserved":"ready"}function jo(e,s=10,n=4){return!e||e.length<=s+n+1?e:`${e.slice(0,s)}…${e.slice(-n)}`}const No=({device:e,reloadDevices:s,navigate:n,teams:i})=>{var E,A,L;const[a,o]=m.useState(!1),[r,l]=m.useState(!1),[d,u]=m.useState(!1),c=m.useRef(null),{me:h}=Wn(),{toast:y}=Kt(),p=(h==null?void 0:h.role)==="ADMIN"||(h==null?void 0:h.role)==="SUPER_ADMIN",b=wo(e),x=b==="reserved",g=!!(e.busy&&e.session_id&&!String(e.session_id).startsWith("manual_")),S=async()=>{var D;try{await((D=navigator.clipboard)==null?void 0:D.writeText(e.udid)),y("UDID copied","success")}catch{y("Failed to copy UDID","error")}},j=async()=>{await P.releaseReservation(e.udid,e.host),s()},w=async()=>{await P.blockDevice(e.udid,e.host),s()},v=async()=>{await P.unblockDevice(e.udid,e.host),s()};return t.jsxs("div",{className:`dc2 dc2-${b}`,children:[t.jsx("div",{className:"dc2-stripe"}),t.jsxs("div",{className:"dc2-header",children:[t.jsxs("span",{className:"dc2-platform",children:[e.platform.toUpperCase()," · ",e.sdk]}),t.jsx(gr,{kind:b,showDot:!0,children:b})]}),t.jsx("div",{className:"dc2-name",title:e.name,children:e.name}),t.jsxs("div",{className:"dc2-udid-row",children:[t.jsx("div",{className:"dc2-udid",title:e.udid,children:jo(e.udid)}),t.jsx("button",{type:"button",className:"dc2-udid-copy",onClick:S,"aria-label":"Copy UDID",title:"Copy UDID",children:t.jsx(Ct,{size:12})})]}),t.jsx(po,{device:e}),t.jsxs("div",{className:"dc2-tags",children:[t.jsx(bo,{udid:e.udid,currentTeamId:e.teamId??null,resolvedTeamName:e.teamName??null,teams:i??new Map,canEdit:p,onChanged:s}),(E=e.tags)==null?void 0:E.slice(0,3).map(D=>t.jsx(tt,{tone:"neutral",title:D,children:D},D)),(((A=e.tags)==null?void 0:A.length)||0)>3&&t.jsxs(tt,{tone:"neutral",children:["+",(((L=e.tags)==null?void 0:L.length)||0)-3]})]}),t.jsxs("div",{className:"dc2-metrics",children:[x?t.jsxs("div",{className:"dc2-banner dc2-banner-reserved",children:[t.jsx(cn,{size:12}),t.jsxs("span",{children:["RES · ",e.reservedBy||"anon",e.reservedUntil?` (${zs(e.reservedUntil-Date.now(),{compact:!0})})`:""]})]}):e.session_id?t.jsxs("div",{className:"dc2-banner dc2-banner-session",children:[t.jsx(hs,{size:12}),t.jsxs("span",{children:["SID · ",String(e.session_id).slice(0,10)]})]}):t.jsx(Fs,{label:"Time in use",value:e.totalUtilizationTimeMilliSec?zs(e.totalUtilizationTimeMilliSec,{compact:!0}):"—"}),t.jsx(Fs,{label:"Host",value:yo(e),mono:!0})]}),t.jsxs("div",{className:"dc2-actions",children:[t.jsx(dt,{variant:"primary",size:"sm",disabled:g,onClick:()=>{g||n(`/devices/${e.udid}/control`)},title:g?"Locked: Appium session running":"Take control",className:"dc2-primary",children:"Control"}),x?t.jsx(dt,{variant:"secondary",size:"sm",onClick:j,children:"Release"}):!e.userBlocked&&!e.busy?t.jsx(dt,{variant:"secondary",size:"sm",onClick:()=>o(!0),children:"Reserve"}):null,t.jsx("button",{ref:c,type:"button",className:"dc2-more",onClick:()=>u(D=>!D),"aria-label":"More actions",children:t.jsx(Di,{size:14})}),t.jsx(Va,{open:d,onClose:()=>u(!1),anchorRef:c,children:t.jsxs(oo,{children:[t.jsx(ls,{onClick:()=>{u(!1),l(!0)},children:"Manage tags…"}),e.userBlocked?t.jsx(ls,{onClick:()=>{u(!1),v()},children:"Exit maintenance"}):t.jsx(ls,{onClick:()=>{u(!1),w()},children:"Enter maintenance"})]})})]}),a&&t.jsx(lo,{device:e,onClose:()=>o(!1),onReserved:()=>s()}),r&&t.jsx(uo,{device:e,onClose:()=>l(!1),onUpdated:()=>s()})]})};function Co(e){const s=bs();return t.jsx(No,{device:e.device,reloadDevices:e.reloadDevices,navigate:s,teams:e.teams})}class So extends Re.Component{constructor(){super(...arguments),this.state={teamsMap:new Map}}componentDidMount(){P.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:Re.Children.toArray(this.props.devices.map(s=>t.jsx(Co,{device:s,reloadDevices:this.props.reloadDevices,teams:this.state.teamsMap})))})}}var Pt,ko=new Uint8Array(16);function Ao(){if(!Pt&&(Pt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Pt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Pt(ko)}const Ro=/^(?:[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 Eo(e){return typeof e=="string"&&Ro.test(e)}var oe=[];for(var ds=0;ds<256;++ds)oe.push((ds+256).toString(16).substr(1));function Do(e){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(oe[e[s+0]]+oe[e[s+1]]+oe[e[s+2]]+oe[e[s+3]]+"-"+oe[e[s+4]]+oe[e[s+5]]+"-"+oe[e[s+6]]+oe[e[s+7]]+"-"+oe[e[s+8]]+oe[e[s+9]]+"-"+oe[e[s+10]]+oe[e[s+11]]+oe[e[s+12]]+oe[e[s+13]]+oe[e[s+14]]+oe[e[s+15]]).toLowerCase();if(!Eo(n))throw TypeError("Stringified UUID is invalid");return n}function $o(e,s,n){e=e||{};var i=e.random||(e.rng||Ao)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,Do(i)}const To=({onCommand:e,prompt:s="$",welcomeMessage:n="Interactive Shell (Restricted Mode)",platform:i})=>{const[a,o]=m.useState([{type:"system",content:n,timestamp:Date.now()},{type:"system",content:'Type "help" for allowed commands.',timestamp:Date.now()}]),[r,l]=m.useState(""),[d,u]=m.useState([]),[c,h]=m.useState(-1),[y,p]=m.useState(!1),b=m.useRef(null),x=m.useRef(null);m.useEffect(()=>{b.current&&(b.current.scrollTop=b.current.scrollHeight)},[a]);const g=j=>{const w=j.trim();if((w.startsWith("{")||w.startsWith("["))&&(w.endsWith("}")||w.endsWith("]")))try{const v=JSON.parse(w);return JSON.stringify(v,null,2)}catch{}return j},S=async j=>{if(j.key==="Enter"&&!y){const w=r.trim();if(!w)return;if(l(""),o(v=>[...v,{type:"command",content:`${s} ${w}`,timestamp:Date.now()}]),u(v=>[...v,w]),h(-1),p(!0),w==="clear"){o([]),p(!1);return}if(w==="help"){let v="";i==="android"?v=`
157
+ Android Allowed Commands:
158
+ • System Info: getprop, ip addr, date, uptime, cat /proc/meminfo, cat /proc/cpuinfo
159
+ • Process Mgmt: ps, top
160
+ • File System: ls
161
+ • Diagnostics: dumpsys [battery|wifi|power]
162
+ • Packages: pm list packages
163
+ `:(i==="ios"||i==="tvos")&&(v=`
164
+ iOS Allowed Commands:
165
+ • Real Device (go-ios):
166
+ apps, info, list, syslog, deviceinfo, diagnostics
167
+ • Simulator (xcrun simctl):
168
+ listapps, get_app_container, list, getenv
169
+ • Simulator System:
170
+ ls, ps, top, date, uptime, whoami
171
+ `),o(E=>[...E,{type:"output",content:v.trim(),timestamp:Date.now()}]),p(!1);return}try{const v=await e(w),E=g(v||"(No output)");o(A=>[...A,{type:"output",content:E,timestamp:Date.now()}])}catch(v){o(E=>[...E,{type:"error",content:v.message||"Unknown error",timestamp:Date.now()}])}finally{p(!1),setTimeout(()=>{var v;return(v=x.current)==null?void 0:v.focus()},10)}}else if(j.key==="ArrowUp"){if(j.preventDefault(),d.length>0){const w=c===-1?d.length-1:Math.max(0,c-1);h(w),l(d[w])}}else if(j.key==="ArrowDown"&&(j.preventDefault(),c!==-1)){const w=c+1;w>=d.length?(h(-1),l("")):(h(w),l(d[w]))}};return t.jsxs("div",{className:"terminal-container",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:[i.toUpperCase()," INTERNAL SHELL"]}),t.jsx("div",{className:"terminal-actions",children:t.jsx("button",{className:"terminal-action-btn",onClick:()=>o([]),title:"Clear Terminal",children:"CLEAR"})})]}),t.jsxs("div",{className:"terminal-history",ref:b,onClick:()=>{var j;return(j=x.current)==null?void 0:j.focus()},children:[a.map((j,w)=>t.jsx("div",{className:`terminal-line ${j.type}`,children:j.content},w)),y&&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:x,className:"terminal-input",value:r,onChange:j=>l(j.target.value),onKeyDown:S,disabled:y,autoFocus:!0,spellCheck:!1,autoComplete:"off",placeholder:"Type a command..."})]})]})};function Pe(e,s){var n;s(e),(n=e.children)==null||n.forEach(i=>Pe(i,s))}function Ie(e,...s){var n;for(const i of s){const a=(n=e.attributes)==null?void 0:n[i];if(a!=null&&a!=="")return String(a)}}function ft(e){var s;return((s=e.type)==null?void 0:s.split(".").pop())||e.type||""}function Lo(e,s){const n=[];return Pe(e,i=>{Ie(i,"content-desc","contentDescription","accessibilityId","name","label")===s&&n.push(i)}),n}function Mo(e,s){const n=[];return Pe(e,i=>{Ie(i,"resource-id","resourceId","identifier")===s&&n.push(i)}),n}function vs(e,s){const n=[];return Pe(e,i=>{(i.type===s||ft(i)===s)&&n.push(i)}),n}function Io(e,s){const n=[];return Pe(e,i=>{Ie(i,"name")===s&&n.push(i)}),n}function _o(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 Oo(e,s){const n=s.split("/").filter(Boolean);if(n.length===0)return null;const i=[];for(const o of n){const r=/^([A-Za-z_][\w.-]*)\[(\d+)\]$/.exec(o);if(!r)return null;i.push({type:r[1],index:parseInt(r[2],10)})}if(i[0].type!==e.type&&i[0].type!==ft(e)||i[0].index!==1)return null;let a=e;for(let o=1;o<i.length&&a;o++){const{type:r,index:l}=i[o];let d=0,u;for(const c of a.children||[])if((c.type===r||ft(c)===r)&&(d+=1,d===l)){u=c;break}a=u}return a?[a]:[]}function Po(e,s){const n=Oo(e,s);if(n!==null)return{kind:"matched",nodes:n};const i=_o(s);if(i){const a=[];return Pe(e,o=>{if(i.tag&&o.type!==i.tag&&ft(o)!==i.tag)return;Ie(o,i.attrKey)===i.attrValue&&a.push(o)}),{kind:"matched",nodes:a}}return{kind:"unsupported",nodes:[],reason:"Complex XPath (axes, multiple predicates, functions) — use a real driver to verify"}}function zo(e,s){const n=s.trim(),i=/^\*\*\/([A-Za-z_]\w*)\[`(\w+)\s*==\s*"([^"]*)"`\]$/.exec(n);if(i){const[,r,l,d]=i,u=[];return Pe(e,c=>{if(c.type!==r&&ft(c)!==r)return;Ie(c,l)===d&&u.push(c)}),{kind:"matched",nodes:u}}const a=/^\*\*\/([A-Za-z_]\w*)\[(\d+)\]$/.exec(n);if(a){const[,r,l]=a,d=parseInt(l,10),u=[];return Pe(e,c=>{(c.type===r||ft(c)===r)&&u.push(c)}),{kind:"matched",nodes:u[d-1]?[u[d-1]]:[]}}const o=/^\*\*\/([A-Za-z_]\w*)$/.exec(n);return o?vs(e,o[1]).length>0?{kind:"matched",nodes:vs(e,o[1])}:{kind:"matched",nodes:[]}:{kind:"unsupported",nodes:[],reason:"Multi-segment class chain — use a real driver to verify"}}function Fo(e,s){const i=s.trim().split(/\s+AND\s+/i).map(r=>r.trim()),a=[];for(const r of i){const l=/^(\w+)\s*==\s*"([^"]*)"$/.exec(r);if(!l)return{kind:"unsupported",nodes:[],reason:"Predicate uses unsupported operator (only ==, AND) — use a real driver"};a.push({key:l[1],value:l[2]})}const o=[];return Pe(e,r=>{for(const l of a){let d;if(l.key==="type"?d=r.type:l.key==="label"?d=Ie(r,"label")??r.label:l.key==="name"?d=Ie(r,"name")??r.name:l.key==="value"?d=Ie(r,"value")??r.value:d=Ie(r,l.key),d!==l.value)return}o.push(r)}),{kind:"matched",nodes:o}}function Bo(e,s,n){const i=s.toLowerCase();if(!n)return{kind:"matched",nodes:[]};switch(i){case"accessibility id":return{kind:"matched",nodes:Lo(e,n)};case"id":return{kind:"matched",nodes:Mo(e,n)};case"class name":return{kind:"matched",nodes:vs(e,n)};case"name":return{kind:"matched",nodes:Io(e,n)};case"xpath":return Po(e,n);case"-ios class chain":return zo(e,n);case"-ios predicate string":return Fo(e,n);default:return{kind:"unsupported",nodes:[],reason:`Strategy "${s}" not yet supported by snapshot matcher`}}}function Qs(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 en(e,s,n,i){var j,w,v,E,A,L,D;const{strategy:a,value:o}=i,r=(e.text||e.name||((j=e.type)==null?void 0:j.split(".").pop())||"element").replace(/[^a-zA-Z0-9]/g,"_").replace(/^_+/,"").slice(0,24)||"element",l=r.charAt(0).toLowerCase()+r.slice(1),d=((w=e.type)==null?void 0:w.toLowerCase().includes("edit"))||((v=e.type)==null?void 0:v.toLowerCase().includes("input"))||((E=e.type)==null?void 0:E.toLowerCase().includes("field"))||((A=e.type)==null?void 0:A.toLowerCase().includes("textfield")),u=((L=e.attributes)==null?void 0:L.scrollable)==="true"||((D=e.attributes)==null?void 0:D.scrollable)===!0,c=a.toLowerCase().startsWith("-ios")&&s!=="ios"?`// ⚠️ -ios predicate/class chain ONLY work with XCUITest (iOS)
172
+ `:a.toLowerCase().startsWith("-android")&&s!=="android"?`// ⚠️ -android uiautomator ONLY works with UIAutomator2 (Android)
173
+ `:"",h={"accessibility id":`~${o}`,id:s==="ios"?`-ios predicate string:label == "${o}"`:`android=new UiSelector().resourceId("${o}")`,xpath:`${o}`,"-ios predicate string":`-ios predicate string:${o}`,"-ios class chain":`-ios class chain:${o}`,"-android uiautomator":`android=${o}`},y={"accessibility id":`AppiumBy.accessibilityId("${o}")`,id:`AppiumBy.id("${o}")`,xpath:`AppiumBy.xpath("${o}")`,"-ios predicate string":`AppiumBy.iOSNsPredicateString("${o}")`,"-ios class chain":`AppiumBy.iOSClassChain("${o}")`,"-android uiautomator":`AppiumBy.androidUIAutomator("${o}")`,"class name":`AppiumBy.className("${o}")`},p={"accessibility id":`AppiumBy.ACCESSIBILITY_ID, "${o}"`,id:`AppiumBy.ID, "${o}"`,xpath:`AppiumBy.XPATH, "${o}"`,"-ios predicate string":`AppiumBy.IOS_PREDICATE, "${o}"`,"-ios class chain":`AppiumBy.IOS_CLASS_CHAIN, "${o}"`,"-android uiautomator":`AppiumBy.ANDROID_UIAUTOMATOR, '${o}'`,"class name":`AppiumBy.CLASS_NAME, "${o}"`},b=y[a.toLowerCase()],x=p[a.toLowerCase()],g=h[a.toLowerCase()];return n==="java"?b?`${c}// Appium Java Client 9.x + Selenium 4 + TestNG
174
+ import io.appium.java_client.AppiumBy;
175
+ import io.appium.java_client.${s==="android"?"AndroidDriver":s==="ios"?"IOSDriver":"AppiumDriver"};
176
+ import org.openqa.selenium.WebElement;
177
+ import org.testng.annotations.Test;
178
+
179
+ @Test
180
+ public void test_${l}() {
181
+ WebElement element = driver.findElement(${b});
182
+ ${u?'((Scrollable) element).scrollTo("target text");':d?`element.clear();
183
+ element.sendKeys("your text here");`:"element.click();"}
184
+ // Add assertions here via TestNG Assert or Hamcrest
185
+ }`:`// Strategy "${a}" not supported in Appium Java Client`:n==="python"?x?`${c}# Appium Python Client 4.x + pytest
186
+ from appium.webdriver.common.appiumby import AppiumBy
187
+ import pytest
188
+
189
+ def test_${l}(self):
190
+ element = self.driver.find_element(${x})
191
+ ${d?`element.clear()
192
+ element.send_keys("your text here")`:"element.click()"}
193
+ # Add assertions here via assert or pytest.assert`:`# Strategy "${a}" not supported in Appium Python Client`:n==="javascript"?g?`${c}// WebdriverIO 9.x + @wdio/appium-service
194
+ describe('${l} test', () => {
195
+ it('should interact with ${l}', async () => {
196
+ const element = await $('${g}');
197
+ await element.waitForDisplayed({ timeout: 5000 });
198
+ ${d?`await element.clearValue();
199
+ await element.addValue("your text here");`:"await element.click();"}
200
+ // Add assertions here via expect(element)
201
+ });
202
+ });`:`// Strategy "${a}" not supported in WebdriverIO mobile`:g?`${c}// WebdriverIO 9.x standalone
203
+ const element = await driver.$('${g}');
204
+ await element.waitForExist({ timeout: 5000 });
205
+ ${d?`await driver.$('target').clearValue();
206
+ await element.addValue("your text here");`:"await element.click();"}
207
+ // Assert with expect(element).toBeDisplayed()`:`// Strategy "${a}" not supported in WebdriverIO mobile`}function tn(e){var p,b,x,g,S,j,w,v,E,A,L;const s=(e.type||"").toLowerCase(),n=((p=e.attributes)==null?void 0:p.clickable)==="true"||((b=e.attributes)==null?void 0:b.clickable)===!0,i=((x=e.attributes)==null?void 0:x.enabled)!=="false"&&((g=e.attributes)==null?void 0:g.enabled)!==!1,a=((S=e.attributes)==null?void 0:S.scrollable)==="true"||((j=e.attributes)==null?void 0:j.scrollable)===!0,o=e.text||e.label||e.value||"",r=((w=e.children)==null?void 0:w.length)||0;let l="Element",d="📦";s.includes("button")||s.includes("btn")||n&&r===0?(l="Button",d="🔘"):s.includes("edit")||s.includes("input")||s.includes("field")?(l="Text Input",d="✏️"):s.includes("image")||s.includes("img")||s.includes("imageview")?(l="Image",d="🖼️"):s.includes("scroll")||s.includes("recyclerview")||s.includes("listview")||a?(l="Scrollable List",d="📜"):s.includes("text")||s.includes("label")?(l="Text Label",d="📝"):s.includes("switch")||s.includes("toggle")||s.includes("checkbox")?(l="Toggle / Checkbox",d="☑️"):s.includes("nav")||s.includes("toolbar")||s.includes("tabbar")?(l="Navigation Bar",d="🧭"):r>0&&(l=`Container (${r} children)`,d="🗂️");const u=((v=e.suggestedLocators)==null?void 0:v.find(D=>D.strategy==="accessibility id"||D.strategy==="id"))||((E=e.suggestedLocators)==null?void 0:E[0]),c=i?((A=e.rect)==null?void 0:A.width)===0||((L=e.rect)==null?void 0:L.height)===0?"⚠️ Zero-size element — may not be interactable":void 0:"⚠️ Element is disabled",h=o?` with text "${o.slice(0,30)}"`:"",y=`This is a ${l.toLowerCase()}${h}. ${n?"It can be tapped/clicked.":a?"It supports scrolling.":"It is a visual container."}${r>0?` Contains ${r} child element${r>1?"s":""}.`:""}`;return{role:l,description:y,interactable:n||i,bestLocator:u,warning:c,emoji:d}}function sn(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"]},a=(e.type||"").toLowerCase(),o=(e.text||e.label||e.value||"").toLowerCase(),r=(e.name||"").toLowerCase(),l=Object.values(e.attributes||{}).join(" ").toLowerCase();for(const[d,u]of Object.entries(i))if(n.includes(d)&&u.some(c=>a.includes(c)))return!0;return a.includes(n)||o.includes(n)||r.includes(n)||l.includes(n)}const Ho=({sessionId:e,udid:s,streamUrl:n,embedded:i=!1})=>{var Se,ke,ct,Ye,vt,Lt,bt,Ge,wt;const[a,o]=m.useState(!0),[r,l]=m.useState(null),[d,u]=m.useState(null),[c,h]=m.useState(null),[y,p]=m.useState(null),[b,x]=m.useState(new Set(["/"])),[g,S]=m.useState(""),[j,w]=m.useState(null),[v,E]=m.useState("info"),[A,L]=m.useState("java"),[D,V]=m.useState(null),[I,Y]=m.useState({width:0,height:0}),[q,K]=m.useState({width:0,height:0}),[N,ne]=m.useState(!1),[O,J]=m.useState("inspect"),[_,Q]=m.useState({}),[re,Ne]=m.useState(null),ye=m.useRef(null),nt=m.useRef(null),ve=m.useRef(null),Te=m.useRef(null),de=m.useCallback(()=>{var Z,ue,xe;if(!ye.current)return;const f=ye.current.getBoundingClientRect(),k=f.width,$=f.height,T=(Z=r==null?void 0:r.hierarchy)==null?void 0:Z.rect;let z=((ue=r==null?void 0:r.metadata)==null?void 0:ue.screenWidth)||I.width||1,H=((xe=r==null?void 0:r.metadata)==null?void 0:xe.screenHeight)||I.height||1;T&&T.width>0&&T.height>0&&(z=T.width,H=T.height);const U=z/H;let G,W;k/$>U?(W=$,G=W*U):(G=k,W=G/U),K({width:G,height:W})},[r,I]);m.useEffect(()=>(de(),window.addEventListener("resize",de),()=>window.removeEventListener("resize",de)),[de]),m.useEffect(()=>{s&&pe()},[s]),m.useEffect(()=>{var f;if((f=c==null?void 0:c.suggestedLocators)!=null&&f.length){const k=c.suggestedLocators.find($=>$.strategy==="accessibility id"||$.strategy==="id")||c.suggestedLocators[0];V(k)}else V(null);Q({}),Ne(null)},[c]);const it=m.useCallback((f,k)=>{if(!(r!=null&&r.hierarchy))return;const $=Bo(r.hierarchy,f,k);Q(T=>({...T,[f]:$})),Ne(f)},[r]),pe=async()=>{if(s){o(!0),u(null);try{const f=await P.getInspectorSnapshot(s);l(f);const k=new Set(["/"]),$=(T,z)=>{var H;z<2&&(k.add(T.xpath),(H=T.children)==null||H.forEach(U=>$(U,z+1)))};f.hierarchy&&$(f.hierarchy,0),x(k)}catch(f){u(f.message||"Failed to capture snapshot")}finally{o(!1)}}},rt=f=>{const{naturalWidth:k,naturalHeight:$}=f.currentTarget;Y({width:k,height:$})},Fe=()=>ne(!0),Le=f=>{ne(!1);const{naturalWidth:k,naturalHeight:$}=f.currentTarget;k>0&&$>0&&Y({width:k,height:$})},Be=n&&!N,me=f=>{if(O!=="interact"||!s)return;const k=f.currentTarget.getBoundingClientRect();Te.current={x:f.clientX-k.left,y:f.clientY-k.top,time:Date.now()}},Me=async f=>{var ae,Ze,Je;if(O!=="interact"||!s||!Te.current)return;const k=Te.current,$=f.currentTarget.getBoundingClientRect(),T=f.clientX-$.left,z=f.clientY-$.top,H=Date.now()-k.time,U=q.width,G=q.height,W=(ae=r==null?void 0:r.hierarchy)==null?void 0:ae.rect;let Z=((Ze=r==null?void 0:r.metadata)==null?void 0:Ze.screenWidth)||I.width,ue=((Je=r==null?void 0:r.metadata)==null?void 0:Je.screenHeight)||I.height;if(W&&W.width>0&&W.height>0&&(Z=W.width,ue=W.height),!Z||!ue||U===0||G===0)return;const xe=(Qe,C)=>({x:Math.round(Qe/U*Z),y:Math.round(C/G*ue),px:Qe/U,py:C/G}),ie=xe(k.x,k.y),Ae=xe(T,z),be=Math.sqrt(Math.pow(T-k.x,2)+Math.pow(z-k.y,2));if(!(ie.px<0||ie.px>1||ie.py<0||ie.py>1)){try{H<500&&be<10?await P.tap(s,ie.x,ie.y):H>=500&&be<10?await P.touchAndHold(s,ie.x,ie.y,H):be>=10&&await P.swipe(s,ie.x,ie.y,Ae.x,Ae.y)}catch(Qe){console.error("Interaction failed:",Qe)}Te.current=null}},at=f=>{const k=new Set(b);k.has(f)?k.delete(f):k.add(f),x(k)},He=()=>{const f=new Set,k=$=>{var T;f.add($.xpath),(T=$.children)==null||T.forEach(k)};r!=null&&r.hierarchy&&k(r.hierarchy),x(f)},Ve=()=>x(new Set(["/"])),qe=(f,k)=>{navigator.clipboard.writeText(f),w(k),setTimeout(()=>w(null),2e3)},Ce=f=>{var $;let k=1;return($=f.children)==null||$.forEach(T=>k+=Ce(T)),k},$t=f=>{if(!f)return[];const k={},$=T=>{var U;const z=tn(T),H=z.role.replace(/\s*\(.*?\)\s*/,"");k[H]||(k[H]={emoji:z.emoji,count:0}),k[H].count+=1,(U=T.children)==null||U.forEach($)};return $(f),Object.entries(k).map(([T,z])=>({role:T,emoji:z.emoji,count:z.count})).sort((T,z)=>z.count-T.count)},Qt=f=>f.xpath.split("/").filter(Boolean).slice(-3),Xe=(f,k=0)=>{var xe,ie,Ae,be;if(!f)return null;const $=b.has(f.xpath),T=((xe=f.children)==null?void 0:xe.length)>0,z=(c==null?void 0:c.xpath)===f.xpath,H=(y==null?void 0:y.xpath)===f.xpath,U=((ie=f.type)==null?void 0:ie.split(".").pop())||"Element",G=f.label||((Ae=f.attributes)==null?void 0:Ae["content-desc"])||((be=f.attributes)==null?void 0:be["resource-id"])||f.name,W=typeof G=="string"&&G&&G!==U&&G!==f.type?G:null,Z=W||U,ue=!g||sn(f,g);if(!ue&&!T)return null;if(g&&!ue){const ae=Ze=>{var Je;return sn(Ze,g)?!0:((Je=Ze.children)==null?void 0:Je.some(ae))||!1};if(!ae(f))return null}return t.jsxs("div",{className:"tree-node",children:[t.jsxs("div",{className:`tree-item ${z?"selected":""} ${H&&!z?"hovered":""}`,onClick:()=>{h(f),E("info")},onMouseEnter:()=>p(f),onMouseLeave:()=>p(null),children:[t.jsx("div",{className:"tree-item-indent",style:{width:`${k*14}px`}}),T?t.jsx("button",{onClick:ae=>{ae.stopPropagation(),at(f.xpath)},className:"tree-toggle",children:$?t.jsx(nn,{size:11}):t.jsx(dn,{size:11})}):t.jsx("span",{className:"tree-toggle-spacer"}),t.jsx(gi,{size:11,className:"tree-icon"}),t.jsx("span",{className:"tree-label",title:`${U}${W?` — ${W}`:""}`,children:Z}),W&&t.jsx("span",{className:"tree-type-tag",title:U,children:U}),f.text&&t.jsxs("span",{className:"tree-text-preview",children:['"',f.text.slice(0,20),'"']}),T&&t.jsx("span",{className:"tree-badge",children:f.children.length})]}),$&&T&&t.jsx("div",{className:"tree-children",children:f.children.map(ae=>Xe(ae,k+1))})]},f.xpath)},ge=f=>{var U,G,W;if(!I.width)return[];const k=[],$=(U=r==null?void 0:r.hierarchy)==null?void 0:U.rect;let T=((G=r==null?void 0:r.metadata)==null?void 0:G.screenWidth)||I.width,z=((W=r==null?void 0:r.metadata)==null?void 0:W.screenHeight)||I.height;$&&$.width>0&&$.height>0&&(T=$.width,z=$.height);const H=(Z,ue)=>{var ie,Ae,be;const xe=!Z.children||Z.children.length===0;((ie=Z.rect)==null?void 0:ie.width)>0&&((Ae=Z.rect)==null?void 0:Ae.height)>0&&xe&&k.push(t.jsx("div",{className:"omni-hit-area",style:{left:`${Z.rect.x/T*100}%`,top:`${Z.rect.y/z*100}%`,width:`${Z.rect.width/T*100}%`,height:`${Z.rect.height/z*100}%`,zIndex:ue},onClick:ae=>{ae.stopPropagation(),h(Z),E("info")},onMouseEnter:()=>p(Z),onMouseLeave:()=>p(null)},Z.xpath)),(be=Z.children)==null||be.forEach(ae=>H(ae,ue+1))};return r!=null&&r.hierarchy&&H(r.hierarchy,1),k},ot=()=>{var H,U,G;if(!re||!I.width)return[];const f=_[re];if(!f||f.kind!=="matched"||f.nodes.length===0)return[];const k=(H=r==null?void 0:r.hierarchy)==null?void 0:H.rect;let $=((U=r==null?void 0:r.metadata)==null?void 0:U.screenWidth)||I.width,T=((G=r==null?void 0:r.metadata)==null?void 0:G.screenHeight)||I.height;k&&k.width>0&&k.height>0&&($=k.width,T=k.height);const z=f.nodes.length===1?"omni-frame-match unique":"omni-frame-match multi";return f.nodes.filter(W=>W.rect&&W.rect.width>0&&W.rect.height>0).map((W,Z)=>t.jsx("div",{className:z,style:{left:`${W.rect.x/$*100}%`,top:`${W.rect.y/T*100}%`,width:`${W.rect.width/$*100}%`,height:`${W.rect.height/T*100}%`}},`match-${re}-${Z}`))},Ke=(f,k)=>{var H,U,G;if(!(f!=null&&f.rect)||!I.width)return null;const $=(H=r==null?void 0:r.hierarchy)==null?void 0:H.rect;let T=((U=r==null?void 0:r.metadata)==null?void 0:U.screenWidth)||I.width,z=((G=r==null?void 0:r.metadata)==null?void 0:G.screenHeight)||I.height;return $&&$.width>0&&$.height>0&&(T=$.width,z=$.height),t.jsx("div",{className:`omni-frame-${k}`,style:{left:`${f.rect.x/T*100}%`,top:`${f.rect.y/z*100}%`,width:`${f.rect.width/T*100}%`,height:`${f.rect.height/z*100}%`}})},xt=r!=null&&r.hierarchy?Ce(r.hierarchy):0,ce=c?tn(c):null,Tt={stable:{icon:t.jsx(Is,{size:10}),cls:"stable"},moderate:{icon:t.jsx(ms,{size:10}),cls:"moderate"},fragile:{icon:t.jsx(ss,{size:10}),cls:"fragile"},"very-fragile":{icon:t.jsx(ss,{size:10}),cls:"very-fragile"}},yt=i&&(r!=null&&r.hierarchy)?$t(r.hierarchy):[];return t.jsx("div",{className:`omni-inspector-container ${i?"omni-embedded":""}`,children: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 ${O==="inspect"?"active":""}`,onClick:()=>J("inspect"),title:"Inspection Mode (Highlight Elements)",children:[t.jsx(si,{size:12}),t.jsx("span",{children:"Inspect"})]}),t.jsxs("button",{className:`omni-mode-btn ${O==="interact"?"active":""}`,onClick:()=>J("interact"),title:"Interaction Mode (Direct Control)",children:[t.jsx(rr,{size:12}),t.jsx("span",{children:"Interact"})]})]})]}),t.jsxs("button",{className:"omni-refresh-btn",onClick:pe,disabled:a,children:[t.jsx(St,{size:12,className:a?"animate-spin":""}),a?"Capturing...":"Refresh"]})]}),t.jsxs("div",{className:"omni-screenshot-container",ref:ye,children:[a&&!Be&&t.jsxs("div",{className:"omni-loading-overlay",children:[t.jsx("div",{className:"omni-spinner"}),t.jsx("span",{children:"Capturing screen..."})]}),!r&&!a&&!Be&&t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(is,{size:40}),t.jsx("span",{children:"Click Refresh to capture"})]}),Be&&t.jsxs("div",{className:`omni-screenshot-wrapper ${O==="interact"?"interactable":""}`,onMouseDown:me,onMouseUp:Me,children:[t.jsx("img",{ref:ve,src:n,onLoad:Le,onError:Fe,className:"omni-screenshot-img",style:O==="interact"?{pointerEvents:"none"}:{},draggable:!1,alt:"Live Device Stream"}),(r==null?void 0:r.hierarchy)&&O==="inspect"&&t.jsxs("div",{className:"omni-overlay",children:[ge(r.hierarchy),ot(),Ke(y,"hover"),Ke(c,"select")]})]}),!Be&&(r==null?void 0:r.screenshot)&&t.jsxs("div",{className:`omni-screenshot-wrapper ${O==="interact"?"interactable":""}`,onMouseDown:me,onMouseUp:Me,children:[t.jsx("img",{ref:nt,src:`data:image/png;base64,${r.screenshot}`,onLoad:rt,className:"omni-screenshot-img",style:O==="interact"?{pointerEvents:"none"}:{},draggable:!1}),O==="inspect"&&t.jsxs("div",{className:"omni-overlay",children:[ge(r.hierarchy),ot(),Ke(y,"hover"),Ke(c,"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(ii,{size:14}),t.jsx("span",{children:"Source"}),xt>0&&t.jsxs("span",{className:"omni-count-badge",children:[xt," elements"]})]}),t.jsxs("div",{className:"omni-tree-actions",children:[t.jsx("button",{onClick:He,className:"omni-action-btn",title:"Expand All",children:t.jsx(Ti,{size:12})}),t.jsx("button",{onClick:Ve,className:"omni-action-btn",title:"Collapse All",children:t.jsx(qi,{size:12})}),i&&t.jsx("button",{onClick:pe,className:"omni-action-btn",title:a?"Capturing…":"Refresh snapshot",disabled:a,children:t.jsx(St,{size:12,className:a?"animate-spin":""})})]})]}),t.jsxs("div",{className:"omni-tree-search",children:[t.jsx(us,{size:14}),t.jsx("input",{type:"text",placeholder:"Search elements... (try 'login button' or 'text field')",value:g,onChange:f=>S(f.target.value),"aria-label":"Search elements"}),g&&t.jsx("button",{onClick:()=>S(""),className:"omni-clear-btn",children:"×"})]}),g&&t.jsxs("div",{className:"omni-search-hint",children:[t.jsx(fs,{size:10}),' Smart search active — try "button", "input", "image"']}),t.jsx("div",{className:"omni-tree-content",children:r!=null&&r.hierarchy?Xe(r.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 ${v==="info"?"active":""}`,onClick:()=>E("info"),role:"tab","aria-selected":v==="info",children:[t.jsx(Fi,{size:12})," ",t.jsx("span",{children:"Info"})]}),t.jsxs("button",{className:`omni-details-tab ${v==="insight"?"active":""}`,onClick:()=>E("insight"),disabled:!c,title:"AI Element Analysis",role:"tab","aria-selected":v==="insight",children:[t.jsx(_i,{size:12})," ",t.jsx("span",{children:"AI Insight"})]}),t.jsxs("button",{className:`omni-details-tab ${v==="code"?"active":""}`,onClick:()=>E("code"),disabled:!c,title:"Generate Test Code",role:"tab","aria-selected":v==="code",children:[t.jsx(Ps,{size:12})," ",t.jsx("span",{children:"Code Gen"})]})]}),t.jsx("div",{className:"omni-details-content",children:c?t.jsxs(t.Fragment,{children:[v==="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:c.type})]}),c.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:c.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:Qt(c).join(" › ")})]})]})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Layout"}),t.jsx("div",{className:"omni-layout-grid",children:["x","y","width","height"].map(f=>t.jsxs("div",{className:"omni-layout-item",children:[t.jsx("span",{className:"omni-layout-label",children:f.toUpperCase()}),t.jsx("span",{className:"omni-layout-value",children:c.rect[f]})]},f))})]}),t.jsxs("div",{className:"omni-section",children:[t.jsxs("div",{className:"omni-section-header",children:["Locators",t.jsx("span",{className:"omni-section-badge",children:"Stability Scored"})]}),t.jsx("div",{className:"omni-locators-list",children:(ct=c.suggestedLocators)==null?void 0:ct.map(f=>{const k=Qs(f.strategy,f.value),$=Tt[k.level],T=_[f.strategy];let z=null;return T&&(T.kind==="unsupported"?z=t.jsxs("span",{className:"omni-match-badge unsupported",title:T.reason||"Cannot evaluate without a real driver",children:[t.jsx(Ni,{size:10})," preview unavailable"]}):T.nodes.length===0?z=t.jsxs("span",{className:"omni-match-badge zero",title:"No element matches this selector in the current snapshot",children:[t.jsx(ss,{size:10})," 0 matches"]}):T.nodes.length===1?z=t.jsxs("span",{className:"omni-match-badge unique",title:"Selector is unique in the current snapshot",children:[t.jsx(Is,{size:10})," unique"]}):z=t.jsxs("span",{className:"omni-match-badge multi",title:`${T.nodes.length} elements match — selector is not unique`,children:[t.jsx(ms,{size:10})," ",T.nodes.length," matches"]})),t.jsxs("div",{className:`omni-locator-row ${(D==null?void 0:D.strategy)===f.strategy?"selected-for-code":""}`,onClick:()=>V(f),title:"Click to use in Code Generator",children:[t.jsxs("div",{className:"omni-locator-left",children:[t.jsxs("div",{className:"omni-locator-top",children:[t.jsx("span",{className:"omni-locator-strategy",children:f.strategy}),t.jsxs("span",{className:`omni-stability-badge ${$.cls}`,title:k.reason,children:[$.icon,k.level]}),z]}),t.jsx("code",{className:"omni-locator-value",children:f.value}),t.jsx("span",{className:"omni-stability-reason",children:k.reason})]}),t.jsxs("div",{className:"omni-locator-actions",children:[t.jsx("button",{type:"button",onClick:H=>{H.stopPropagation(),it(f.strategy,f.value)},className:`omni-test-btn ${re===f.strategy?"active":""}`,title:"Test this locator against the current snapshot",children:t.jsx(Ri,{size:12})}),t.jsx("button",{onClick:H=>{H.stopPropagation(),qe(f.value,f.strategy)},className:`omni-copy-btn ${j===f.strategy?"copied":""}`,children:j===f.strategy?t.jsx(Ft,{size:12}):t.jsx(Ct,{size:12})})]})]},f.strategy)})})]}),t.jsxs("div",{className:"omni-section",children:[t.jsx("div",{className:"omni-section-header",children:"Attributes"}),t.jsx("div",{className:"omni-attributes-table",children:Object.entries(c.attributes||{}).filter(([f,k])=>k!=null&&k!=="").map(([f,k])=>t.jsxs("div",{className:"omni-attr-row",children:[t.jsx("span",{className:"omni-attr-key",children:f}),t.jsx("span",{className:"omni-attr-value",children:String(k)})]},f))})]})]}),v==="insight"&&ce&&t.jsxs("div",{className:"omni-insight-panel",children:[t.jsxs("div",{className:"omni-insight-role",children:[t.jsx("span",{className:"omni-insight-emoji",children:ce.emoji}),t.jsxs("div",{children:[t.jsx("div",{className:"omni-insight-role-name",children:ce.role}),t.jsx("div",{className:"omni-insight-interactable",children:ce.interactable?t.jsxs("span",{className:"omni-badge-green",children:[t.jsx(ln,{size:10})," Interactable"]}):t.jsx("span",{className:"omni-badge-gray",children:"Visual Only"})})]})]}),ce.warning&&t.jsx("div",{className:"omni-insight-warning",children:ce.warning}),t.jsxs("div",{className:"omni-insight-description",children:[t.jsx(fs,{size:12,className:"omni-insight-icon"}),t.jsx("p",{children:ce.description})]}),ce.bestLocator&&t.jsxs("div",{className:"omni-insight-best-locator",children:[t.jsx("div",{className:"omni-section-header",children:"Recommended Locator"}),t.jsxs("div",{className:"omni-locator-row",children:[t.jsxs("div",{className:"omni-locator-left",children:[t.jsx("span",{className:"omni-locator-strategy",children:ce.bestLocator.strategy}),t.jsx("code",{className:"omni-locator-value",children:ce.bestLocator.value})]}),t.jsx("button",{onClick:()=>qe(ce.bestLocator.value,"best"),className:`omni-copy-btn ${j==="best"?"copied":""}`,children:j==="best"?t.jsx(Ft,{size:12}):t.jsx(Ct,{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=c.attributes)==null?void 0:Ye.clickable},{label:"Enabled",value:(vt=c.attributes)==null?void 0:vt.enabled},{label:"Scrollable",value:(Lt=c.attributes)==null?void 0:Lt.scrollable},{label:"Focusable",value:(bt=c.attributes)==null?void 0:bt.focusable},{label:"Children",value:((Ge=c.children)==null?void 0:Ge.length)||0}].map(({label:f,value:k})=>t.jsxs("div",{className:"omni-quick-fact-row",children:[t.jsx("span",{className:"omni-quick-fact-label",children:f}),t.jsx("span",{className:`omni-quick-fact-value ${k==="true"||k===!0?"true":""}`,children:String(k??"—")})]},f))})]})]}),v==="code"&&t.jsxs("div",{className:"omni-codegen-panel",children:[t.jsx("div",{className:"omni-codegen-frameworks",children:["java","python","javascript","wdio"].map(f=>t.jsx("button",{className:`omni-fw-btn ${A===f?"active":""}`,onClick:()=>L(f),children:f==="java"?"☕ Java":f==="python"?"🐍 Python":f==="javascript"?"🟨 JS":"🔷 WD.io"},f))}),D?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(ws,{selectSize:"sm",value:D.strategy,onChange:f=>{var $;const k=($=c.suggestedLocators)==null?void 0:$.find(T=>T.strategy===f.target.value);k&&V(k)},className:"flex-1",children:(wt=c.suggestedLocators)==null?void 0:wt.map(f=>t.jsxs("option",{value:f.strategy,children:[f.strategy," — ",Qs(f.strategy,f.value).level]},f.strategy))})]}),t.jsxs("div",{className:"omni-codegen-output",children:[t.jsxs("div",{className:"omni-codegen-header",children:[t.jsx("span",{className:"omni-codegen-lang",children:A==="java"?"Java / TestNG":A==="python"?"Python / unittest":A==="javascript"?"JavaScript / Mocha":"WebdriverIO"}),t.jsx("button",{className:"omni-copy-btn",onClick:()=>qe(en(c,(r==null?void 0:r.platform)==="android"?"android":(r==null?void 0:r.platform)==="ios"?"ios":"unknown",A,D),"code"),children:j==="code"?t.jsx(Ft,{size:12}):t.jsx(Ct,{size:12})})]}),t.jsx("pre",{className:"omni-codegen-pre",children:t.jsx("code",{children:en(c,(r==null?void 0:r.platform)==="android"?"android":(r==null?void 0:r.platform)==="ios"?"ios":"unknown",A,D)})})]})]}):t.jsxs("div",{className:"omni-empty-state small",children:[t.jsx(Ps,{size:24}),t.jsx("span",{children:"No locators available for this element"})]})]})]}):r!=null&&r.hierarchy?t.jsxs("div",{className:"omni-summary-panel",children:[t.jsxs("div",{className:"omni-summary-hero",children:[t.jsx(is,{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:xt})]}),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:((Se=r.metadata)==null?void 0:Se.screenWidth)??I.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:((ke=r.metadata)==null?void 0:ke.screenHeight)??I.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:r.platform||"—"})]})]})]}),yt.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:yt.slice(0,8).map(f=>t.jsxs("div",{className:"omni-summary-role",children:[t.jsx("span",{className:"omni-summary-role__emoji",children:f.emoji}),t.jsx("span",{className:"omni-summary-role__name",children:f.role}),t.jsx("span",{className:"omni-summary-role__count",children:f.count})]},f.role))})]})]}):t.jsxs("div",{className:"omni-empty-state",children:[t.jsx(is,{size:32}),t.jsx("span",{children:a?"Capturing snapshot…":"Select an element from the tree or screenshot"})]})})]})]})})};function Uo({device:e,onClose:s}){var Qe;const{toast:n,removeToast:i}=Kt(),a=bs(),{tab:o}=rn(),r=m.useRef(null),l=m.useRef(null),[d,u]=m.useState({width:0,height:0}),[c,h]=m.useState(o||"actions"),[y,p]=m.useState(""),[b,x]=m.useState(""),[g,S]=m.useState(""),[j,w]=m.useState(!0),[v,E]=m.useState([]),[A,L]=m.useState(null),[D,V]=m.useState(!1),[I,Y]=m.useState(!1),[q,K]=m.useState(0),[N,ne]=m.useState(e),[O,J]=m.useState([]),[_,Q]=m.useState(!1),[re,Ne]=m.useState(!1),[ye,nt]=m.useState(null),[ve,Te]=m.useState([]),[de,it]=m.useState(!0),[pe,rt]=m.useState(""),[Fe,Le]=m.useState(!1),[Be,me]=m.useState(0),[Me,at]=m.useState(!1),[He,Ve]=m.useState(!1),qe=10,[Ce,$t]=m.useState(!1),Qt=()=>{navigator.clipboard.writeText(N.udid).catch(()=>{}),$t(!0),setTimeout(()=>$t(!1),1500)},Xe=m.useRef(""),ge=m.useRef(null),[ot,Ke]=m.useState(!1);m.useEffect(()=>{c&&(!o||o!==c)&&a(`/devices/${e.udid}/control/${c}`,{replace:!0})},[c,o,e.udid,a]),m.useEffect(()=>{let C;if(c==="logs"){Le(!1),me(0);const R=async()=>{try{const M=await P.getLogs(N.udid);if(me(F=>F+1),M&&M.logs&&M.logs.trim().length>0){Le(!0);const F=M.logs.replace(/\\u[0-9a-fA-F]{4}/g,X=>JSON.parse(`"${X}"`)).replace(/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,"").split(`
208
+ `).filter(X=>X.trim().length>0);F.length>0&&Te(X=>[...X,...F].slice(-1e3))}else me(F=>(F>=3&&Le(!0),F))}catch(M){console.error("Failed to fetch logs:",M),me(F=>(F>=3&&Le(!0),F))}};R(),C=setInterval(R,3e3)}return()=>clearInterval(C)},[c,N.udid]);const xt=()=>{if(ve.length===0)return t.jsx("div",{className:"log-empty-state",children:Fe?t.jsxs(t.Fragment,{children:[t.jsx(hs,{size:28,style:{color:"var(--text-muted)",marginBottom:12,opacity:.4}}),t.jsx("p",{className:"log-empty-title",children:"No log output yet"}),t.jsx("p",{className:"log-empty-subtitle",children:"The log stream is active but the device is quiet. Interact with the device to generate logs."})]}):t.jsxs(t.Fragment,{children:[t.jsx(It,{size:28,className:"animate-spin",style:{color:"var(--green)",marginBottom:12}}),t.jsx("p",{className:"log-empty-title",children:"Connecting to device syslog..."}),t.jsxs("p",{className:"log-empty-subtitle",children:["Initializing persistent log stream for ",N.name]})]})});const C=ve.filter(R=>!pe||R.toLowerCase().includes(pe.toLowerCase()));return C.length===0&&pe?t.jsxs("div",{className:"log-empty-state",children:[t.jsx(us,{size:28,style:{color:"var(--text-muted)",marginBottom:12,opacity:.4}}),t.jsxs("p",{className:"log-empty-title",children:['No matches for "',pe,'"']}),t.jsxs("p",{className:"log-empty-subtitle",children:[ve.length," lines in buffer. Try a different search term."]})]}):C.map((R,M)=>{let F="log-debug";const X=R.toLowerCase();return X.includes("error")||X.includes("fail")?F="log-error":X.includes("warning")||X.includes("warn")?F="log-warn":(X.includes("notice")||X.includes("info"))&&(F="log-notice"),t.jsxs("div",{className:`log-line ${F}`,children:[t.jsx("span",{className:"log-index",children:M+1}),t.jsx("span",{className:"log-content",children:R})]},`${M}-${R.substring(0,10)}`)})};m.useEffect(()=>{c==="logs"&&de&&l.current&&(l.current.scrollTop=l.current.scrollHeight)},[ve,c,de]),m.useEffect(()=>((async()=>{try{Y(!0),await P.startStream(N.udid);const M=(await P.getDevices()).find(F=>F.udid===N.udid);M&&ne(M)}catch(R){console.error("Auto-start stream failed:",R)}finally{Y(!1)}})(),()=>{P.stopStream(N.udid).catch(()=>{})}),[e.udid]);const ce=m.useCallback(async()=>{try{Q(!0);const C=await P.listApps(N.udid);Array.isArray(C)&&J(C)}catch(C){console.error("Failed to load apps:",C)}finally{Q(!1)}},[N.udid]);m.useEffect(()=>{c==="actions"&&ce()},[c,ce]);const Tt=parseInt(N.screenWidth||"1080",10),yt=parseInt(N.screenHeight||"1920",10),Se=Math.min(Tt,yt),ke=Math.max(Tt,yt),ct=Se/ke,Ye=m.useCallback(()=>{const C=!j,R=C?window.innerHeight*.55:window.innerHeight*.7,M=620,X=window.innerWidth>900;let ee;C?ee=X?Math.min(window.innerWidth*.8,window.innerWidth-M):window.innerWidth*.8:ee=window.innerWidth*.45;const le=j?ct:1/ct;let te,se;j?(te=R,se=te*le,se>ee&&(se=ee,te=se/le)):(se=ee,te=se/le,te>R&&(te=R,se=te*le)),u({width:se,height:te})},[ct,j]);m.useEffect(()=>(Ye(),window.addEventListener("resize",Ye),()=>window.removeEventListener("resize",Ye)),[Ye]),m.useEffect(()=>{const C=async()=>{if(Xe.current.length>0){const M=Xe.current;Xe.current="";try{await P.typeText(N.udid,M)}catch(F){console.error("Keyboard buffering flush failed:",F)}}},R=M=>{const F=document.activeElement;if(F&&(F.tagName==="INPUT"||F.tagName==="TEXTAREA"||F.isContentEditable)||!ot&&c!=="terminal")return;const ee=M.key;ee==="Enter"?(ge.current&&clearTimeout(ge.current),C(),P.pressKey(N.udid,N.platform==="android"?66:"enter")):ee==="Backspace"?(ge.current&&clearTimeout(ge.current),C(),P.pressKey(N.udid,N.platform==="android"?67:"backspace")):ee.length===1&&(Xe.current+=ee,ge.current&&clearTimeout(ge.current),ge.current=setTimeout(()=>{C()},50))};return window.addEventListener("keydown",R),()=>{window.removeEventListener("keydown",R),ge.current&&clearTimeout(ge.current)}},[N.udid,N.platform,ot,c]);const[vt,Lt]=m.useState(Date.now()),bt=()=>{const C=q>0?`r=${q}&`:"";return N.session_id&&!String(N.session_id).startsWith("manual_")?`/xenon/api/session/${N.session_id}/live_video?${C}t=${vt}`:`/xenon/api/control/${N.udid}/stream?${C}t=${vt}`};m.useEffect(()=>{q>0&&Lt(Date.now())},[q]),m.useEffect(()=>{if(Me||He)return;const C=setTimeout(()=>Ve(!0),3e4);return()=>clearTimeout(C)},[Me,He,q]);const Ge=m.useRef(null),wt=C=>{const R=C.currentTarget.getBoundingClientRect();return{x:C.clientX-R.left,y:C.clientY-R.top}},f=C=>{const R=wt(C);Ge.current={x:R.x,y:R.y,time:Date.now()}},k=async C=>{var Ls;if(!Ge.current)return;const R=Ge.current,M=wt(C),F=Date.now()-R.time,X=(Ls=r.current)==null?void 0:Ls.getBoundingClientRect(),ee=(X==null?void 0:X.width)||d.width,le=(X==null?void 0:X.height)||d.height;let te,se,lt,Mt;j?(te=R.x/ee*Se,se=R.y/le*ke,lt=M.x/ee*Se,Mt=M.y/le*ke):(te=R.x/ee*ke,se=R.y/le*Se,lt=M.x/ee*ke,Mt=M.y/le*Se);const $s=Math.abs(lt-te),Ts=Math.abs(Mt-se);try{F<500&&$s<10&&Ts<10?await P.tap(N.udid,Math.round(te),Math.round(se)):F>=500&&$s<10&&Ts<10?await P.touchAndHold(N.udid,Math.round(te),Math.round(se),F):await P.swipe(N.udid,Math.round(te),Math.round(se),Math.round(lt),Math.round(Mt))}catch(Pn){console.error("Action failed:",Pn)}Ge.current=null},$=()=>P.pressKey(N.udid,N.platform==="android"?jt.HOME:ns.HOME),T=()=>P.pressKey(N.udid,jt.BACK),z=()=>P.pressKey(N.udid,jt.APP_SWITCH),H=()=>P.pressKey(N.udid,N.platform==="android"?jt.VOLUME_UP:ns.VOLUME_UP),U=()=>P.pressKey(N.udid,N.platform==="android"?jt.VOLUME_DOWN:ns.VOLUME_DOWN),G=()=>P.lock(N.udid),W=()=>P.unlock(N.udid),Z=async()=>{y.trim()&&(await P.typeText(N.udid,y),p(""))},ue=async()=>{try{x("Fetching...");const C=await P.getClipboard(N.udid);C&&C.content!==void 0?x(C.content||"(Clipboard is empty)"):x("No content received")}catch{x("Error: Check Appium Settings app")}},xe=async()=>{V(!0);try{const C=await P.getScreenshot(N.udid);if(C!=null&&C.screenshot){const R={id:$o(),base64:C.screenshot,timestamp:Date.now()};E(M=>[R,...M]),L(0)}}catch(C){console.error("Failed to take screenshot:",C)}finally{V(!1)}},ie=C=>{E(R=>{const M=R.filter(F=>F.id!==C);return M.length===0?L(null):A!==null&&A>=M.length&&L(0),M})},Ae=()=>{E([]),L(null),n("Cleared all captured evidence.","success")},be=C=>{const R=document.createElement("a");R.href=`data:image/png;base64,${C}`,R.download=`screenshot-${N.udid}-${Date.now()}.png`,R.click()},ae=async C=>{const R=Se/2,M=ke/2,F=Se*.4,X=ke*.4;let ee,le,te,se;switch(C){case"left":ee=R+F,le=M,te=R-F,se=M;break;case"right":ee=R-F,le=M,te=R+F,se=M;break;case"up":ee=R,le=M+X,te=R,se=M-X;break;case"down":ee=R,le=M-X,te=R,se=M+X;break}try{await P.swipe(N.udid,Math.round(ee),Math.round(le),Math.round(te),Math.round(se))}catch(lt){console.error(`Quick swipe ${C} failed:`,lt)}},Ze=async()=>{if(g.trim()){const C=n(`Uninstalling ${g}...`,"loading",0);try{Q(!0),await P.uninstallApp(N.udid,g),S(""),n(`Request sent for ${g}`,"success"),setTimeout(ce,3e3)}catch{n("Uninstall failed. Check logs.","error")}finally{Q(!1),i(C)}}},Je=async()=>{if(!ye)return;let C;try{Ne(!0),C=n(`Installing app to ${N.udid}...`,"loading",0);const R=await P.uploadAndInstallApp(N.udid,ye);R.success?(n(R.message||"App installed successfully","success"),nt(null),setTimeout(ce,5e3)):n("Installation failed: "+(R.error||"Unknown error"),"error")}catch(R){n("Installation failed: "+R.message,"error")}finally{C&&i(C),Ne(!1)}};return t.jsxs("div",{className:"device-control-view",children:[t.jsx("div",{className:"scanline",style:{position:"absolute",inset:0,pointerEvents:"none",opacity:.05,zIndex:1001}}),t.jsxs("header",{className:"control-view-top-bar",children:[t.jsxs("button",{className:"back-to-devices-btn",onClick:s,children:[t.jsx(ts,{size:18})," DEVICES"]}),t.jsxs("div",{className:"device-info-mini",children:[t.jsx("span",{className:`device-pill platform-pill ${N.platform}`,children:N.platform==="ios"?"Apple":"Android"}),t.jsxs("span",{className:"device-pill version-pill",children:["v",N.sdk]}),N.reservedUntil&&Date.now()<N.reservedUntil&&t.jsxs("span",{className:"device-pill reserved-pill",title:`Reserved by ${N.reservedBy}${N.reservationReason?`: ${N.reservationReason}`:""}`,children:["RESERVED BY ",((Qe=N.reservedBy)==null?void 0:Qe.toUpperCase())||"ANONYMOUS"]}),t.jsx("h2",{className:"device-name-text",children:N.name}),t.jsxs("span",{className:"udid-chip",title:N.udid,children:[t.jsx("span",{className:"udid-chip__value",children:N.udid}),t.jsx("button",{type:"button",className:"udid-chip__copy",onClick:Qt,"aria-label":"Copy UDID",title:Ce?"Copied!":"Copy UDID",children:Ce?t.jsx(Ft,{size:12}):t.jsx(Ct,{size:12})})]})]})]}),t.jsxs("div",{className:`control-view-main ${j?"":"is-landscape"} ${c==="omni"?"omni-mode":""}`,children:[t.jsxs("div",{className:"device-preview-column",children:[t.jsx("div",{className:"device-screen-wrapper",children:t.jsxs("div",{ref:r,className:`device-stream-canvas ${j?"":"landscape"} ${ot?"focused":""}`,style:{width:d.width,height:d.height,background:"#000"},tabIndex:0,onFocus:()=>Ke(!0),onBlur:()=>Ke(!1),onMouseDown:f,onMouseUp:k,children:[He?t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(ms,{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:()=>{Ve(!1),K(0)},children:"Retry"})]}):(I||!Me)&&t.jsxs("div",{className:"device-stream-placeholder",style:{position:"absolute",zIndex:10},children:[t.jsx(St,{size:40,className:"animate-spin",color:"var(--green)"}),t.jsx("p",{style:{marginTop:16},children:I?"ESTABLISHING TRACE...":"Waiting for stream…"})]}),!He&&t.jsx("img",{src:bt(),alt:"Device Stream",className:"device-stream-image",style:{width:"100%",height:"100%",objectFit:"contain"},onLoad:()=>at(!0),onError:()=>{if(console.warn("Stream failed to load, retrying..."),at(!1),q>=qe){Ve(!0);return}setTimeout(()=>K(C=>C+1),2e3)}})]})}),t.jsxs("aside",{className:"device-footer-actions",children:[t.jsxs("button",{className:`footer-action-btn ${j?"active":""}`,onClick:()=>w(!0),children:[t.jsx(St,{size:14,style:{transform:j?"none":"rotate(-90deg)"}})," ","PORTRAIT"]}),t.jsxs("button",{className:`footer-action-btn ${j?"":"active"}`,onClick:()=>w(!1),children:[t.jsx(St,{size:14,style:{transform:"rotate(90deg)"}})," LANDSCAPE"]}),t.jsx("div",{className:"footer-divider"}),t.jsxs("button",{className:"footer-action-btn",onClick:$,children:[t.jsx(Mi,{size:20})," HOME"]}),N.platform==="android"&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{className:"footer-action-btn",onClick:T,title:"Back",children:[t.jsx(ts,{size:20})," BACK"]}),t.jsxs("button",{className:"footer-action-btn",onClick:z,title:"App Switcher",children:[t.jsx(Ji,{size:20})," APPS"]})]}),t.jsx("div",{className:"footer-divider"}),t.jsxs("button",{className:"footer-action-btn",onClick:H,title:"Volume Up",children:[t.jsx(lr,{size:20})," VOL+"]}),t.jsxs("button",{className:"footer-action-btn",onClick:U,title:"Volume Down",children:[t.jsx(or,{size:20})," VOL−"]}),t.jsx("button",{className:"footer-action-btn",onClick:G,title:"Lock Device","aria-label":"Lock device",children:t.jsx(ri,{size:20})}),t.jsx("button",{className:"footer-action-btn",onClick:W,title:"Unlock Device","aria-label":"Unlock device",children:t.jsx(Pi,{size:20})})]})]}),t.jsxs("div",{className:"device-interactions-column",children:[t.jsxs("div",{className:"interaction-tabs",role:"tablist",children:[t.jsxs("button",{className:`tab-btn ${c==="actions"?"active":""}`,onClick:()=>h("actions"),role:"tab","aria-selected":c==="actions",children:[t.jsx(ln,{size:13}),t.jsx("span",{children:"Actions"})]}),t.jsxs("button",{className:`tab-btn ${c==="screenshot"?"active":""}`,onClick:()=>h("screenshot"),role:"tab","aria-selected":c==="screenshot",children:[t.jsx(Nt,{size:13}),t.jsx("span",{children:"Screenshot"})]}),t.jsxs("button",{className:`tab-btn ${c==="logs"?"active":""}`,onClick:()=>h("logs"),role:"tab","aria-selected":c==="logs",children:[t.jsx(Yi,{size:13}),t.jsx("span",{children:"Debug Logs"})]}),t.jsxs("button",{className:`tab-btn ${c==="terminal"?"active":""}`,onClick:()=>h("terminal"),role:"tab","aria-selected":c==="terminal",children:[t.jsx(hs,{size:13}),t.jsx("span",{children:"Shell"})]}),t.jsxs("button",{className:`tab-btn ${c==="omni"?"active":""}`,onClick:()=>h("omni"),role:"tab","aria-selected":c==="omni",children:[t.jsx(fs,{size:13}),t.jsx("span",{children:"Omni-Vision"})]})]}),t.jsx("div",{className:`interactions-scroll-area ${c==="terminal"?"terminal-mode":""} ${c==="screenshot"||c==="logs"?"screenshot-mode":""}`,children:t.jsxs("div",{className:"tab-content",children:[c==="omni"&&t.jsx("div",{className:"omni-inspector-tab-wrapper animate-fade-in",children:t.jsx(Ho,{sessionId:N.session_id?String(N.session_id):null,udid:N.udid,streamUrl:bt(),embedded:!0})}),c==="actions"&&t.jsxs("div",{className:"actions-grid",children:[t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(ni,{size:18,color:"var(--green)"})," Smart Input"]}),t.jsx("p",{className:"action-card-hint",children:"Relay keystrokes to the focused element on the device."}),t.jsx("input",{type:"text",className:"type-input-field compact",placeholder:"Type and press Enter to send…",value:y,onChange:C=>p(C.target.value),onKeyDown:C=>C.key==="Enter"&&Z()})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(Qn,{size:18,color:"var(--green)"})," App Management"]}),t.jsxs("div",{className:"app-mgmt-content",children:[t.jsxs("div",{className:"install-section",children:[t.jsx("p",{className:"compact-label",children:"Install Package (.apk, .ipa, .app)"}),t.jsxs("div",{className:"upload-box-row",children:[t.jsxs("label",{className:"file-upload-launcher",children:[t.jsx(ei,{size:14}),t.jsx("span",{children:ye?ye.name:"Select File"}),t.jsx("input",{type:"file",accept:".apk,.ipa,.app",onChange:C=>{var R;return nt(((R=C.target.files)==null?void 0:R[0])||null)},hidden:!0})]}),t.jsx("button",{className:"btn-premium btn-sm",disabled:!ye||re,onClick:Je,children:re?t.jsx(It,{className:"animate-spin",size:14}):"INSTALL"})]})]}),t.jsx("div",{className:"divider-v"}),t.jsxs("div",{className:"uninstall-section",children:[t.jsx("p",{className:"compact-label",children:"Quick Uninstall"}),t.jsxs("div",{className:"uninstall-controls-row",children:[t.jsxs("div",{className:"select-wrapper",children:[t.jsxs(ws,{selectSize:"sm",className:"w-full",value:g,onChange:C=>S(C.target.value),disabled:_,children:[t.jsx("option",{value:"",children:_?"Loading apps...":"-- Select App to Remove --"}),O.map(C=>t.jsx("option",{value:C,children:C},C))]}),_&&t.jsx(It,{className:"animate-spin select-loader",size:12})]}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:Ze,disabled:!g||_,children:[t.jsx(_t,{size:14})," UNINSTALL"]})]}),t.jsxs("div",{className:"manual-input-box",children:[t.jsx("p",{className:"hint-text",children:"Or enter manually:"}),t.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"com.example.app",value:g,onChange:C=>S(C.target.value)})]})]})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(Si,{size:18,color:"var(--green)"})," Clipboard"]}),t.jsxs("div",{style:{display:"flex",gap:"12px",alignItems:"flex-start"},children:[t.jsx("button",{className:"btn-premium btn-sm",style:{width:"140px",flexShrink:0},onClick:ue,children:"FETCH VALUE"}),t.jsx("div",{className:"clipboard-display compact",style:{marginTop:0,flex:1},children:b})]})]}),t.jsxs("div",{className:"action-card full-width",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(Wi,{size:18,color:"var(--green)"})," Directional Gestures"]}),t.jsxs("div",{className:"gestures-grid-container",children:[t.jsxs("div",{className:"gestures-dpad",children:[t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>ae("up"),children:t.jsx(wi,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>ae("left"),children:t.jsx(ts,{size:24})}),t.jsx("div",{className:"dpad-center"}),t.jsx("button",{className:"dpad-btn",onClick:()=>ae("right"),children:t.jsx(dn,{size:24})}),t.jsx("div",{}),t.jsx("button",{className:"dpad-btn",onClick:()=>ae("down"),children:t.jsx(nn,{size:24})}),t.jsx("div",{})]}),t.jsx("p",{className:"compact-label",style:{opacity:.5},children:"Quick swipe in a direction"})]})]})]}),c==="screenshot"&&t.jsxs("div",{className:"action-card screenshot-card",children:[t.jsxs("header",{className:"action-card-header",children:[t.jsxs("div",{className:"title-group",children:[t.jsxs("h4",{className:"action-card-title",children:[t.jsx(Nt,{size:20,color:"var(--green)"})," Captured Evidence"]}),t.jsx("p",{className:"hint-text",children:"Relay screenshots from device to host."})]}),v.length>0&&t.jsx("button",{className:"btn-text-only",onClick:Ae,children:"CLEAR ALL"})]}),t.jsxs("div",{className:"screenshot-workspace",children:[t.jsxs("div",{className:"screenshot-gallery-sidebar",children:[t.jsxs("button",{className:"btn-premium take-screenshot-btn",onClick:xe,disabled:D,children:[D?t.jsx(It,{className:"animate-spin",size:16}):t.jsx(Nt,{size:16}),t.jsx("span",{children:D?"CAPTURING...":"NEW CAPTURE"})]}),t.jsxs("div",{className:"screenshot-thumbnails-list",children:[v.length===0&&!D&&t.jsxs("div",{className:"empty-gallery-state",children:[t.jsx(Nt,{size:20,className:"empty-gallery-icon"}),t.jsx("p",{className:"empty-gallery-title",children:"No captures yet"}),t.jsxs("p",{className:"empty-gallery-hint",children:["Click ",t.jsx("strong",{children:"New Capture"})," above to grab a screenshot."]})]}),v.map((C,R)=>t.jsxs("div",{className:`screenshot-thumb-item ${A===R?"active":""}`,onClick:()=>L(R),children:[t.jsx("img",{src:`data:image/png;base64,${C.base64}`,alt:"Thumb"}),t.jsx("span",{className:"thumb-time",children:new Date(C.timestamp).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}),t.jsx("button",{className:"thumb-delete-btn",onClick:M=>{M.stopPropagation(),ie(C.id)},children:t.jsx(_t,{size:12})})]},C.id))]})]}),t.jsx("div",{className:"screenshot-main-preview",children:A!==null&&v[A]?t.jsxs("div",{className:"preview-container",children:[t.jsx("div",{className:"preview-image-wrapper",children:t.jsx("img",{src:`data:image/png;base64,${v[A].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:v[A].id.substring(0,8)}),t.jsx("span",{className:"meta-divider",children:"|"}),t.jsx("span",{className:"meta-value",children:ti(v[A].timestamp)})]}),t.jsxs("div",{className:"preview-actions",children:[t.jsx("button",{className:"btn-premium btn-sm",onClick:()=>be(v[A].base64),children:"DOWNLOAD PNG"}),t.jsxs("button",{className:"btn-destructive btn-sm",onClick:()=>ie(v[A].id),children:[t.jsx(_t,{size:14})," DELETE"]})]})]})]}):t.jsxs("div",{className:"preview-empty-placeholder",children:[t.jsx(Nt,{size:48,style:{opacity:.1,marginBottom:16}}),t.jsx("p",{children:"Capture a screenshot to begin analysis"})]})})]})]}),c==="logs"&&t.jsxs("div",{className:"action-card screenshot-card",style:{padding:0,gap:0},children:[t.jsxs("div",{className:"log-toolbar",children:[t.jsxs("div",{className:"log-filter-group",children:[t.jsxs("div",{className:"log-stat-pill",children:[t.jsx("span",{className:`log-live-dot ${Fe?"active":""}`}),Fe?"LIVE":"CONNECTING"]}),t.jsxs("div",{className:"log-stat-pill",style:{opacity:.6},children:[ve.length," LINES"]}),t.jsxs("div",{className:"log-search-box",children:[t.jsx(us,{size:14,className:"search-icon-inline"}),t.jsx("input",{type:"text",className:"type-input-field tiny",placeholder:"Filter trace...",value:pe,onChange:C=>rt(C.target.value),"aria-label":"Filter debug logs"})]})]}),t.jsxs("div",{className:"log-actions-group",children:[t.jsxs("button",{className:`btn-secondary btn-sm ${de?"active":""}`,onClick:()=>it(!de),title:de?"Freeze Logs":"Follow Logs",children:[t.jsx(ur,{size:14,className:de?"animate-pulse":""}),de?"FREEZE":"FOLLOW"]}),t.jsxs("button",{className:"btn-premium btn-sm",onClick:()=>{const C=new Blob([ve.join(`
209
+ `)],{type:"text/plain"}),R=URL.createObjectURL(C),M=document.createElement("a");M.href=R,M.download=`logs-${N.udid}-${Date.now()}.txt`,M.click(),URL.revokeObjectURL(R)},disabled:ve.length===0,children:[t.jsx(ai,{size:14}),"EXPORT"]}),t.jsxs("button",{className:"btn-secondary btn-sm",onClick:()=>Te([]),title:"Clear Logs",children:[t.jsx(_t,{size:14}),"CLEAR"]})]})]}),t.jsx("div",{className:"log-display-area",ref:l,style:{flex:1},children:xt()})]}),c==="terminal"&&t.jsx("div",{className:"action-card full-height",children:t.jsx(To,{platform:(N.platform||"").toLowerCase(),prompt:`${(N.platform||"").toLowerCase()==="ios"?"ios":"adb"} $`,welcomeMessage:`Connected to ${N.name} (${N.udid}).
210
+ Internal Shell Environment.`,onCommand:async C=>{const R=await P.executeShell(N.udid,C);if(R.error)throw new Error(R.error);return R.output}})})]})})]})]}),N.session_id&&!String(N.session_id).startsWith("manual_")&&t.jsx(qn,{sessionId:String(N.session_id),mode:"slice",windowSec:60,variant:"floating"})]})}class Wo extends Re.Component{constructor(s){super(s),this.socketCleanups=[],this.refreshTimeout=null,this.state={devices:[],activeSessionsCount:0,pendingSessionsCount:0,queueSummary:null,statusFilter:"all",search:"",loaded:!1}}componentDidMount(){this.fetchDevices(),this.devicePolling=setInterval(()=>{this.fetchDevices()},1e4);const s=this.props.onSocketEvent("device_unblocked",()=>{this.fetchDevicesDebounced()}),n=this.props.onSocketEvent("device_blocked",()=>{this.fetchDevicesDebounced()});this.socketCleanups.push(s,n)}componentWillUnmount(){this.devicePolling&&(clearInterval(this.devicePolling),this.devicePolling=void 0),this.refreshTimeout&&(clearTimeout(this.refreshTimeout),this.refreshTimeout=null),this.socketCleanups.forEach(s=>s())}fetchDevicesDebounced(){this.refreshTimeout&&clearTimeout(this.refreshTimeout),this.refreshTimeout=setTimeout(()=>{this.refreshTimeout=null,this.fetchDevices()},500)}getBusyDevicesCount(s){return s.filter(n=>n.busy).length}async fetchDevices(){try{const s=await P.getDevices(),n=this.getBusyDevicesCount(s),i=await P.getPendingSessionsCount(),a=await P.getQueueSummary();this.setState({devices:s,activeSessionsCount:n,pendingSessionsCount:i,queueSummary:a,loaded:!0})}catch(s){console.log(s),this.setState({loaded:!0})}}getFiltered(){const s=Date.now(),n=a=>!!(a.reservedUntil&&s<a.reservedUntil),i=this.state.search.trim().toLowerCase();return this.state.devices.filter(a=>{if(i&&!`${a.name} ${a.udid}`.toLowerCase().includes(i))return!1;switch(this.state.statusFilter){case"all":return!0;case"offline":return a.offline;case"busy":return a.busy&&!a.offline;case"reserved":return n(a)&&!a.busy&&!a.offline;case"ready":return!a.offline&&!a.busy&&!n(a)&&!a.userBlocked;default:return!0}})}statusCount(s){const n=Date.now(),i=a=>!!(a.reservedUntil&&n<a.reservedUntil);switch(s){case"all":return this.state.devices.length;case"offline":return this.state.devices.filter(a=>a.offline).length;case"busy":return this.state.devices.filter(a=>a.busy&&!a.offline).length;case"reserved":return this.state.devices.filter(a=>i(a)&&!a.busy&&!a.offline).length;case"ready":return this.state.devices.filter(a=>!a.offline&&!a.busy&&!i(a)&&!a.userBlocked).length}}render(){const s=this.getFiltered(),{udid:n}=this.props.params,i=n?this.state.devices.find(a=>a.udid===n):null;return t.jsxs("div",{className:"device-explorer-container",children:[t.jsxs("div",{className:"de2-sticky-group",children:[t.jsx(Vn,{icon:_s,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(oi,{size:"sm",value:this.state.statusFilter,onChange:a=>this.setState({statusFilter:a}),segments:[{value:"all",label:"All",count:this.statusCount("all")},{value:"ready",label:"Ready",count:this.statusCount("ready")},{value:"busy",label:"Busy",count:this.statusCount("busy")},{value:"reserved",label:"Reserved",count:this.statusCount("reserved")},{value:"offline",label:"Offline",count:this.statusCount("offline")}]}),t.jsx("input",{type:"text",className:"de2-search",placeholder:"Search by name or UDID…",value:this.state.search,onChange:a=>this.setState({search:a.target.value})}),t.jsxs(dt,{variant:"secondary",size:"sm",onClick:()=>this.fetchDevices(),children:[t.jsx(es,{size:12})," Refresh"]})]})]}),s.length>0?t.jsx(So,{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(_s,{size:32}):t.jsx(es,{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(dt,{variant:"primary",onClick:()=>this.fetchDevices(),children:[t.jsx(es,{size:14}),"Manual Sync"]})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"No Devices Found"}),t.jsx("p",{children:"Deployment configuration mismatch. Adjust your platform or state filters to find the appropriate testing target."}),t.jsx(dt,{variant:"secondary",onClick:()=>this.setState({statusFilter:"all",search:""}),children:"Reset filters"})]}):t.jsxs(t.Fragment,{children:[t.jsx("h3",{children:"Loading devices…"}),t.jsx("p",{children:"Syncing the global device registry."})]})]}),i&&t.jsx("div",{className:"device-control-modal-overlay",children:t.jsx("div",{className:"device-control-modal",children:t.jsx(Uo,{device:i,onClose:()=>this.props.navigate("/devices")})})})]})}}function xc(){const e=rn(),s=bs(),{on:n}=ci();return t.jsx(Wo,{params:e,navigate:s,onSocketEvent:n})}export{Wo as DeviceExplorer,xc as default};