@tapflowio/relay 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/RelayServer.d.ts +75 -0
  2. package/dist/RelayServer.d.ts.map +1 -1
  3. package/dist/RelayServer.js +496 -49
  4. package/dist/RelayServer.js.map +1 -1
  5. package/dist/SessionManager.d.ts +41 -2
  6. package/dist/SessionManager.d.ts.map +1 -1
  7. package/dist/SessionManager.js +31 -1
  8. package/dist/SessionManager.js.map +1 -1
  9. package/dist/admission/HostBootGate.d.ts +181 -0
  10. package/dist/admission/HostBootGate.d.ts.map +1 -0
  11. package/dist/admission/HostBootGate.js +388 -0
  12. package/dist/admission/HostBootGate.js.map +1 -0
  13. package/dist/admission/capacity.d.ts +51 -0
  14. package/dist/admission/capacity.d.ts.map +1 -0
  15. package/dist/admission/capacity.js +49 -0
  16. package/dist/admission/capacity.js.map +1 -0
  17. package/dist/admission/classifyBoot.d.ts +17 -0
  18. package/dist/admission/classifyBoot.d.ts.map +1 -0
  19. package/dist/admission/classifyBoot.js +23 -0
  20. package/dist/admission/classifyBoot.js.map +1 -0
  21. package/dist/admission/hostKey.d.ts +10 -0
  22. package/dist/admission/hostKey.d.ts.map +1 -0
  23. package/dist/admission/hostKey.js +13 -0
  24. package/dist/admission/hostKey.js.map +1 -0
  25. package/dist/admission/leaseChoice.d.ts +38 -0
  26. package/dist/admission/leaseChoice.d.ts.map +1 -0
  27. package/dist/admission/leaseChoice.js +40 -0
  28. package/dist/admission/leaseChoice.js.map +1 -0
  29. package/dist/admission/settle.d.ts +35 -0
  30. package/dist/admission/settle.d.ts.map +1 -0
  31. package/dist/admission/settle.js +41 -0
  32. package/dist/admission/settle.js.map +1 -0
  33. package/dist/api/builds.d.ts.map +1 -1
  34. package/dist/api/builds.js +3 -2
  35. package/dist/api/builds.js.map +1 -1
  36. package/dist/api/profile.d.ts.map +1 -1
  37. package/dist/api/profile.js +3 -1
  38. package/dist/api/profile.js.map +1 -1
  39. package/dist/api/runs.d.ts +21 -2
  40. package/dist/api/runs.d.ts.map +1 -1
  41. package/dist/api/runs.js +181 -26
  42. package/dist/api/runs.js.map +1 -1
  43. package/dist/api/settings.d.ts.map +1 -1
  44. package/dist/api/settings.js +4 -2
  45. package/dist/api/settings.js.map +1 -1
  46. package/dist/migrations/017_flow_run_skipped.sql +34 -0
  47. package/dist/migrations/018_flow_run_service_tier.sql +6 -0
  48. package/dist/migrations/019_flow_run_device_reset.sql +7 -0
  49. package/package.json +4 -4
  50. package/public/assets/{AISessionWatch-Bxew762e.js → AISessionWatch-BSBkpTom.js} +13 -18
  51. package/public/assets/AISessionWatch-BSBkpTom.js.br +0 -0
  52. package/public/assets/AISessionWatch-BSBkpTom.js.gz +0 -0
  53. package/public/assets/{AppCenter-93hnrrdy.js → AppCenter-DD_6LQx-.js} +6 -6
  54. package/public/assets/AppCenter-DD_6LQx-.js.br +0 -0
  55. package/public/assets/AppCenter-DD_6LQx-.js.gz +0 -0
  56. package/public/assets/Default-CQ3Ae2mK.js +6 -0
  57. package/public/assets/Default-CQ3Ae2mK.js.br +0 -0
  58. package/public/assets/Default-CQ3Ae2mK.js.gz +0 -0
  59. package/public/assets/{Invite-DQBwLaOl.js → Invite-D1uNMm0-.js} +1 -1
  60. package/public/assets/Invite-D1uNMm0-.js.br +0 -0
  61. package/public/assets/Invite-D1uNMm0-.js.gz +0 -0
  62. package/public/assets/{MacResources-D4LMGxgV.js → MacResources-D2UeRbKL.js} +1 -1
  63. package/public/assets/MacResources-D2UeRbKL.js.br +0 -0
  64. package/public/assets/MacResources-D2UeRbKL.js.gz +0 -0
  65. package/public/assets/QASession-d0eOjXXo.js +81 -0
  66. package/public/assets/QASession-d0eOjXXo.js.br +0 -0
  67. package/public/assets/QASession-d0eOjXXo.js.gz +0 -0
  68. package/public/assets/{ResetPassword-inTbbral.js → ResetPassword-B-4Uyfwr.js} +1 -1
  69. package/public/assets/ResetPassword-B-4Uyfwr.js.br +0 -0
  70. package/public/assets/ResetPassword-B-4Uyfwr.js.gz +0 -0
  71. package/public/assets/RunDetail-C50RjsuM.js +16 -0
  72. package/public/assets/RunDetail-C50RjsuM.js.br +0 -0
  73. package/public/assets/RunDetail-C50RjsuM.js.gz +0 -0
  74. package/public/assets/Runs-A7RcDLgO.js +6 -0
  75. package/public/assets/Runs-A7RcDLgO.js.br +0 -0
  76. package/public/assets/Runs-A7RcDLgO.js.gz +0 -0
  77. package/public/assets/{Setup-CPa_UWpa.js → Setup-DK6TZbwh.js} +1 -1
  78. package/public/assets/Setup-DK6TZbwh.js.br +0 -0
  79. package/public/assets/Setup-DK6TZbwh.js.gz +0 -0
  80. package/public/assets/{Team-DZie8W7R.js → Team-VoGput2p.js} +3 -3
  81. package/public/assets/Team-VoGput2p.js.br +0 -0
  82. package/public/assets/Team-VoGput2p.js.gz +0 -0
  83. package/public/assets/{Tokens-u3-uRAwd.js → Tokens-qkcJgunR.js} +1 -1
  84. package/public/assets/Tokens-qkcJgunR.js.br +0 -0
  85. package/public/assets/Tokens-qkcJgunR.js.gz +0 -0
  86. package/public/assets/{aiSession-BsmDnyV1.js → aiSession-U7UqgdSb.js} +11 -16
  87. package/public/assets/aiSession-U7UqgdSb.js.br +0 -0
  88. package/public/assets/aiSession-U7UqgdSb.js.gz +0 -0
  89. package/public/assets/{alert-dialog-Bq_Ln5bp.js → alert-dialog-C0mRms8g.js} +1 -1
  90. package/public/assets/alert-dialog-C0mRms8g.js.br +0 -0
  91. package/public/assets/alert-dialog-C0mRms8g.js.gz +0 -0
  92. package/public/assets/{badge-D-bt97WR.js → badge-BjEnOmb0.js} +1 -1
  93. package/public/assets/badge-BjEnOmb0.js.br +0 -0
  94. package/public/assets/badge-BjEnOmb0.js.gz +0 -0
  95. package/public/assets/{dialog-CtzPkg0O.js → dialog-Cugbp1C4.js} +1 -1
  96. package/public/assets/dialog-Cugbp1C4.js.br +0 -0
  97. package/public/assets/dialog-Cugbp1C4.js.gz +0 -0
  98. package/public/assets/{field-hint-B774BIWK.js → field-hint-qmBa0qqN.js} +1 -1
  99. package/public/assets/field-hint-qmBa0qqN.js.br +0 -0
  100. package/public/assets/field-hint-qmBa0qqN.js.gz +0 -0
  101. package/public/assets/index-C_3Q51YJ.js +248 -0
  102. package/public/assets/index-C_3Q51YJ.js.br +0 -0
  103. package/public/assets/index-C_3Q51YJ.js.gz +0 -0
  104. package/public/assets/{index-EPyP3g9A.css → index-h2hiZ2OM.css} +1 -1
  105. package/public/assets/index-h2hiZ2OM.css.br +0 -0
  106. package/public/assets/index-h2hiZ2OM.css.gz +0 -0
  107. package/public/assets/list-view-CyM0QUaH.js +1 -0
  108. package/public/assets/list-view-CyM0QUaH.js.br +0 -0
  109. package/public/assets/list-view-CyM0QUaH.js.gz +0 -0
  110. package/public/assets/{pencil-1XSs32nb.js → pencil-DUZRZB3S.js} +2 -2
  111. package/public/assets/pencil-DUZRZB3S.js.br +0 -0
  112. package/public/assets/pencil-DUZRZB3S.js.gz +0 -0
  113. package/public/assets/{play-DCvrorIC.js → play-Z1L2Eb91.js} +2 -2
  114. package/public/assets/play-Z1L2Eb91.js.br +0 -0
  115. package/public/assets/play-Z1L2Eb91.js.gz +0 -0
  116. package/public/assets/{runs-CInQb6v1.js → runs-CFQ6M4rx.js} +1 -1
  117. package/public/assets/runs-CFQ6M4rx.js.br +0 -0
  118. package/public/assets/runs-CFQ6M4rx.js.gz +0 -0
  119. package/public/assets/{search-input-CFWgLcKA.js → search-input-B0s9mzRt.js} +2 -2
  120. package/public/assets/search-input-B0s9mzRt.js.br +0 -0
  121. package/public/assets/search-input-B0s9mzRt.js.gz +0 -0
  122. package/public/assets/{select-5ZtzWRYG.js → select-CHbE6M4S.js} +3 -3
  123. package/public/assets/select-CHbE6M4S.js.br +0 -0
  124. package/public/assets/select-CHbE6M4S.js.gz +0 -0
  125. package/public/assets/{slider-DHuMDXcP.js → slider-tyb3JvL2.js} +1 -1
  126. package/public/assets/slider-tyb3JvL2.js.br +0 -0
  127. package/public/assets/slider-tyb3JvL2.js.gz +0 -0
  128. package/public/assets/{tabs-CmgV_sSI.js → tabs-Bf7ou-eS.js} +1 -1
  129. package/public/assets/tabs-Bf7ou-eS.js.br +0 -0
  130. package/public/assets/tabs-Bf7ou-eS.js.gz +0 -0
  131. package/public/assets/{tech-label-qLodPeUI.js → tech-label-KAwM5qZ_.js} +1 -1
  132. package/public/assets/tech-label-KAwM5qZ_.js.br +0 -0
  133. package/public/assets/tech-label-KAwM5qZ_.js.gz +0 -0
  134. package/public/assets/{trash-CXjB9oU1.js → trash-HEJmY7DQ.js} +3 -3
  135. package/public/assets/trash-HEJmY7DQ.js.br +0 -0
  136. package/public/assets/trash-HEJmY7DQ.js.gz +0 -0
  137. package/public/assets/{video-CK2q3-0B.js → video-DdHH0Q0l.js} +2 -2
  138. package/public/assets/video-DdHH0Q0l.js.br +0 -0
  139. package/public/assets/video-DdHH0Q0l.js.gz +0 -0
  140. package/public/index.html +14 -2
  141. package/public/index.html.br +0 -0
  142. package/public/index.html.gz +0 -0
  143. package/public/og-image.jpg +0 -0
  144. package/public/assets/AISessionWatch-Bxew762e.js.br +0 -0
  145. package/public/assets/AISessionWatch-Bxew762e.js.gz +0 -0
  146. package/public/assets/AppCenter-93hnrrdy.js.br +0 -0
  147. package/public/assets/AppCenter-93hnrrdy.js.gz +0 -0
  148. package/public/assets/Default-BhgcUKBm.js +0 -6
  149. package/public/assets/Default-BhgcUKBm.js.br +0 -0
  150. package/public/assets/Default-BhgcUKBm.js.gz +0 -0
  151. package/public/assets/Invite-DQBwLaOl.js.br +0 -0
  152. package/public/assets/Invite-DQBwLaOl.js.gz +0 -0
  153. package/public/assets/MacResources-D4LMGxgV.js.br +0 -0
  154. package/public/assets/MacResources-D4LMGxgV.js.gz +0 -0
  155. package/public/assets/QASession-Dnuq0yrN.js +0 -81
  156. package/public/assets/QASession-Dnuq0yrN.js.br +0 -0
  157. package/public/assets/QASession-Dnuq0yrN.js.gz +0 -0
  158. package/public/assets/ResetPassword-inTbbral.js.br +0 -0
  159. package/public/assets/ResetPassword-inTbbral.js.gz +0 -0
  160. package/public/assets/RunDetail-B3dw8_U0.js +0 -16
  161. package/public/assets/RunDetail-B3dw8_U0.js.br +0 -0
  162. package/public/assets/RunDetail-B3dw8_U0.js.gz +0 -0
  163. package/public/assets/Runs-DqZl9Y6M.js +0 -6
  164. package/public/assets/Runs-DqZl9Y6M.js.br +0 -0
  165. package/public/assets/Runs-DqZl9Y6M.js.gz +0 -0
  166. package/public/assets/Setup-CPa_UWpa.js.br +0 -0
  167. package/public/assets/Setup-CPa_UWpa.js.gz +0 -0
  168. package/public/assets/Team-DZie8W7R.js.br +0 -0
  169. package/public/assets/Team-DZie8W7R.js.gz +0 -0
  170. package/public/assets/Tokens-u3-uRAwd.js.br +0 -0
  171. package/public/assets/Tokens-u3-uRAwd.js.gz +0 -0
  172. package/public/assets/aiSession-BsmDnyV1.js.br +0 -0
  173. package/public/assets/aiSession-BsmDnyV1.js.gz +0 -0
  174. package/public/assets/alert-dialog-Bq_Ln5bp.js.br +0 -0
  175. package/public/assets/alert-dialog-Bq_Ln5bp.js.gz +0 -0
  176. package/public/assets/badge-D-bt97WR.js.br +0 -0
  177. package/public/assets/badge-D-bt97WR.js.gz +0 -0
  178. package/public/assets/dialog-CtzPkg0O.js.br +0 -0
  179. package/public/assets/dialog-CtzPkg0O.js.gz +0 -0
  180. package/public/assets/field-hint-B774BIWK.js.br +0 -1
  181. package/public/assets/field-hint-B774BIWK.js.gz +0 -0
  182. package/public/assets/index-EPyP3g9A.css.br +0 -0
  183. package/public/assets/index-EPyP3g9A.css.gz +0 -0
  184. package/public/assets/index-cgl1yEKu.js +0 -223
  185. package/public/assets/index-cgl1yEKu.js.br +0 -0
  186. package/public/assets/index-cgl1yEKu.js.gz +0 -0
  187. package/public/assets/list-view-BcjDCJy5.js +0 -1
  188. package/public/assets/list-view-BcjDCJy5.js.br +0 -0
  189. package/public/assets/list-view-BcjDCJy5.js.gz +0 -0
  190. package/public/assets/pencil-1XSs32nb.js.br +0 -0
  191. package/public/assets/pencil-1XSs32nb.js.gz +0 -0
  192. package/public/assets/play-DCvrorIC.js.br +0 -0
  193. package/public/assets/play-DCvrorIC.js.gz +0 -0
  194. package/public/assets/runs-CInQb6v1.js.br +0 -0
  195. package/public/assets/runs-CInQb6v1.js.gz +0 -0
  196. package/public/assets/search-input-CFWgLcKA.js.br +0 -0
  197. package/public/assets/search-input-CFWgLcKA.js.gz +0 -0
  198. package/public/assets/select-5ZtzWRYG.js.br +0 -0
  199. package/public/assets/select-5ZtzWRYG.js.gz +0 -0
  200. package/public/assets/slider-DHuMDXcP.js.br +0 -0
  201. package/public/assets/slider-DHuMDXcP.js.gz +0 -0
  202. package/public/assets/tabs-CmgV_sSI.js.br +0 -0
  203. package/public/assets/tabs-CmgV_sSI.js.gz +0 -0
  204. package/public/assets/tech-label-qLodPeUI.js.br +0 -0
  205. package/public/assets/tech-label-qLodPeUI.js.gz +0 -0
  206. package/public/assets/trash-CXjB9oU1.js.br +0 -0
  207. package/public/assets/trash-CXjB9oU1.js.gz +0 -0
  208. package/public/assets/video-CK2q3-0B.js.br +0 -0
  209. package/public/assets/video-CK2q3-0B.js.gz +0 -0
@@ -1,36 +1,31 @@
1
- import{c as T,r as x,j as n}from"./vendor-react-DTSdA8m-.js";import{G as C,a2 as ie,O as le,aj as re,S as ce,B as de}from"./index-cgl1yEKu.js";import{u as fe}from"./useRelay-CES3I1Mt.js";import{k as ue,C as he,H as me}from"./AndroidDeviceScreen-C55msKfh.js";import{N as pe,M as xe,i as ye,t as ke,a as ge,b as je,W as be}from"./WatchedDevice-CpaKHa1x.js";import{a as ve,D as we,K as _e,H as Se,L as Ne,h as U,w as Ae,b as Re,A as Me}from"./aiSession-BsmDnyV1.js";import{P as Le}from"./play-DCvrorIC.js";import{d as ze,L as De}from"./vendor-router-B1pQim9Z.js";/**
2
- * @license lucide-react v1.58.0 - ISC
1
+ import{c as H,r as x,j as n}from"./vendor-react-DTSdA8m-.js";import{G as T,a2 as oe,a3 as ie,ax as le,O as re,ak as ce,S as de,B as fe}from"./index-C_3Q51YJ.js";import{u as ue}from"./useRelay-CES3I1Mt.js";import{k as he,C as me,H as pe}from"./AndroidDeviceScreen-C55msKfh.js";import{N as xe,M as ye,i as ke,t as ge,a as je,b as be,W as ve}from"./WatchedDevice-CpaKHa1x.js";import{L as we,D as _e,K as Se,H as Ne,h as U,w as Ae,a as Re,A as Me}from"./aiSession-U7UqgdSb.js";import{P as Le}from"./play-Z1L2Eb91.js";import{d as ze,L as Ce}from"./vendor-router-B1pQim9Z.js";/**
2
+ * @license lucide-react v1.59.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const X={name:"circle-check",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 9-5.5 5.5L8 12",key:"xofnsj"}]],aliases:["check-circle-2"]};X.node;const Ce=C(X);/**
7
- * @license lucide-react v1.58.0 - ISC
6
+ */const X={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};X.node;const De=T(X);/**
7
+ * @license lucide-react v1.59.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const Z={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};Z.node;const He=C(Z);/**
12
- * @license lucide-react v1.58.0 - ISC
11
+ */const Z={name:"eraser",size:24,node:[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]};Z.node;const He=T(Z);/**
12
+ * @license lucide-react v1.59.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const J={name:"eraser",size:24,node:[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]]};J.node;const Te=C(J);/**
17
- * @license lucide-react v1.58.0 - ISC
16
+ */const J={name:"mouse-pointer-click",size:24,node:[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]};J.node;const Te=T(J);/**
17
+ * @license lucide-react v1.59.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const Q={name:"mouse-pointer-click",size:24,node:[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]};Q.node;const $e=C(Q);/**
22
- * @license lucide-react v1.58.0 - ISC
21
+ */const Q={name:"move-horizontal",size:24,node:[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}]]};Q.node;const Ee=T(Q);/**
22
+ * @license lucide-react v1.59.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const Y={name:"move-horizontal",size:24,node:[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}]]};Y.node;const Ee=C(Y);/**
27
- * @license lucide-react v1.58.0 - ISC
26
+ */const Y={name:"move-vertical",size:24,node:[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]};Y.node;const $e=T(Y);/**
27
+ * @license lucide-react v1.59.0 - ISC
28
28
  *
29
29
  * This source code is licensed under the ISC license.
30
30
  * See the LICENSE file in the root directory of this source tree.
31
- */const ee={name:"move-vertical",size:24,node:[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]};ee.node;const Fe=C(ee);/**
32
- * @license lucide-react v1.58.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 te={name:"scaling",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M14 15H9v-5",key:"pi4jk9"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M21 3 9 15",key:"15kdhq"}]]};te.node;const Ie=C(te);function We(o){const e=T.c(28);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={kind:"connecting"},e[0]=a):a=e[0];const[s,i]=x.useState(a),[t,c]=x.useState(null),[r,g]=x.useState(void 0),[b,u]=x.useState(!1),[y,_]=x.useState(!1),[h,j]=x.useState(!1),[S,k]=x.useState(null),m=x.useRef(void 0);let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];const[v,M]=x.useState(f),[w,A]=x.useState(pe),R=x.useRef(0);let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=new Set,e[2]=d):d=e[2];const N=x.useRef(d);let $,E;e[3]===Symbol.for("react.memo_cache_sentinel")?($=()=>{const l=N.current;return()=>{for(const p of l)clearTimeout(p)}},E=[],e[3]=$,e[4]=E):($=e[3],E=e[4]),x.useEffect($,E);let F;e[5]!==o?(F=l=>{if(l.type==="agents:listed"){const p=l.sessions.flatMap(Oe).find(L=>L.sessionId===o);p&&k(p),p!=null&&p.holder&&_(!1);return}if(!("sessionId"in l&&l.sessionId!==void 0&&l.sessionId!==o)){if(l.type==="watch:started")i({kind:"watching"});else if(l.type==="watch:refused")i({kind:"refused",reason:l.reason});else if(l.type==="watch:ended")i({kind:"ended",reason:l.reason});else if(l.type==="watch:holder-left")_(!0);else if(l.type==="session:agent-away")j(!0);else if(l.type==="session:rebound")j(!1),u(!1);else if(l.type==="session:chrome")c(l.payload);else if(l.type==="device:postures")g(l.payload);else if(l.type==="device:booting")c(null),g(void 0),u(!1),j(!1);else if(l.type==="device:ready")u(!0),j(!1);else if(l.type==="watch:action"){R.current=R.current+1;const p={id:R.current,at:l.at,action:l.action};if(M(L=>[p,...L].slice(0,xe)),ye(l.action)){const L=l.action;A(z=>({cursor:L.kind==="tap"?{x:L.x,y:L.y}:{x:L.to[0],y:L.to[1]},trails:[...z.trails,ke(p.id,L,z.cursor)]}));const q=setTimeout(()=>{N.current.delete(q),A(z=>({...z,trails:z.trails.filter(oe=>oe.id!==p.id)}))},ge);N.current.add(q)}}}},e[5]=o,e[6]=F):F=e[6];const ne=F;let I;e[7]===Symbol.for("react.memo_cache_sentinel")?(I=l=>{var z;const p=ue(l);if((p==null?void 0:p.codec)===he)return;const L=p?l.slice(me):l,q=p?{codec:p.codec,keyframe:p.keyframe,capturedAt:p.capturedAt,relayedAt:p.relayedAt}:void 0;(z=m.current)==null||z.call(m,L,q)},e[7]=I):I=e[7];const ae=I,{send:H,connected:D}=fe(ne,ae),G=x.useRef(!1);let W;e[8]!==s.kind?(W=()=>{G.current=s.kind==="ended"||s.kind==="refused"},e[8]=s.kind,e[9]=W):W=e[9];let O;e[10]!==s?(O=[s],e[10]=s,e[11]=O):O=e[11],x.useEffect(W,O);let B,P;e[12]!==D||e[13]!==H||e[14]!==o?(P=()=>{if(!D)return;H({type:"agents:list"}),G.current||H({type:"watch:start",sessionId:o});const l=setInterval(()=>H({type:"agents:list"}),1e4);return()=>clearInterval(l)},B=[D,H,o],e[12]=D,e[13]=H,e[14]=o,e[15]=B,e[16]=P):(B=e[15],P=e[16]),x.useEffect(P,B);let K;return e[17]!==v||e[18]!==h||e[19]!==t||e[20]!==D||e[21]!==S||e[22]!==b||e[23]!==y||e[24]!==w||e[25]!==s||e[26]!==r?(K={phase:s,device:S,chrome:t,postures:r,deviceReady:b,holderLeft:y,agentAway:h,connected:D,binaryFrameHandlerRef:m,actions:v,marks:w},e[17]=v,e[18]=h,e[19]=t,e[20]=D,e[21]=S,e[22]=b,e[23]=y,e[24]=w,e[25]=s,e[26]=r,e[27]=K):K=e[27],K}function Oe(o){return o.devices}function Be(o){var R;const e=T.c(14),{actions:a,driver:s,live:i}=o,t=Ve(a),c=(R=t.at(-1))==null?void 0:R.id;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];const[g,b]=x.useState(r),u=x.useRef(null),y=x.useRef(!0);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{const d=u.current;d&&y.current&&(d.scrollTop=d.scrollHeight)},e[1]=_):_=e[1];let h;e[2]!==a?(h=[a],e[2]=a,e[3]=h):h=e[3],x.useLayoutEffect(_,h);const j="agent-activity-title",S="flex min-h-0 min-w-0 flex-1 flex-col gap-3";let k;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx("h2",{id:"agent-activity-title",className:"text-sm font-medium",children:"Agent activity"}),e[4]=k):k=e[4];let m,f;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=d=>{const N=d.currentTarget;y.current=N.scrollHeight-N.scrollTop-N.clientHeight<24},f={overflowAnchor:"none"},e[5]=m,e[6]=f):(m=e[5],f=e[6]);const v="h-96 overflow-y-auto rounded-xl border bg-background px-5 py-4 lg:h-auto lg:min-h-48 lg:flex-1",M=t.length===0?n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Nothing yet. What the ",s," does appears here as it happens."]}):n.jsx("ol",{"aria-label":"Steps and actions",className:"flex flex-col gap-2 text-sm",children:t.map(d=>d.label===null?d.actions.map(Pe):n.jsx("li",{children:n.jsx(Ke,{group:d,running:i&&d.id===c,open:g[d.id]??!0,onToggle:()=>b(N=>({...N,[d.id]:!(N[d.id]??!0)}))})},d.id))});let w;e[7]!==M||e[8]!==m||e[9]!==f?(w=n.jsx("div",{ref:u,onScroll:m,style:f,className:v,children:M}),e[7]=M,e[8]=m,e[9]=f,e[10]=w):w=e[10];let A;return e[11]!==w||e[12]!==k?(A=n.jsxs("section",{"aria-labelledby":j,className:S,children:[k,w]}),e[11]=w,e[12]=k,e[13]=A):A=e[13],A}function Pe(o){return n.jsx("li",{children:n.jsx(se,{...o})},o.id)}function Ke(o){const e=T.c(32),{group:a,running:s,open:i,onToggle:t}=o;let c;e[0]!==s?(c=s?n.jsx(Ne,{"aria-hidden":"true",className:"size-4 shrink-0 motion-safe:animate-spin"}):n.jsx(Ce,{"aria-hidden":"true",className:"size-4 shrink-0"}),e[0]=s,e[1]=c):c=e[1];let r;e[2]!==a.label?(r=n.jsx("span",{className:"truncate",children:a.label}),e[2]=a.label,e[3]=r):r=e[3];let g;e[4]!==c||e[5]!==r?(g=n.jsxs(n.Fragment,{children:[c,r]}),e[4]=c,e[5]=r,e[6]=g):g=e[6];const b=g;if(a.actions.length===0){let f;e[7]!==a.at?(f=V(a.at),e[7]=a.at,e[8]=f):f=e[8];let v;return e[9]!==b||e[10]!==f?(v=n.jsx("div",{title:f,className:"flex min-w-0 items-center gap-2.5 text-muted-foreground",children:b}),e[9]=b,e[10]=f,e[11]=v):v=e[11],v}const u=`agent-step-${a.id}`;let y;e[12]!==a.at?(y=V(a.at),e[12]=a.at,e[13]=y):y=e[13];const _=i&&"rotate-90";let h;e[14]!==_?(h=ie("size-4 shrink-0 transition-transform",_),e[14]=_,e[15]=h):h=e[15];let j;e[16]!==h?(j=n.jsx(le,{"aria-hidden":"true",className:h}),e[16]=h,e[17]=j):j=e[17];let S;e[18]!==u||e[19]!==b||e[20]!==t||e[21]!==i||e[22]!==y||e[23]!==j?(S=n.jsxs("button",{type:"button",title:y,"aria-expanded":i,"aria-controls":u,onClick:t,className:"flex min-w-0 items-center gap-2.5 rounded-sm text-left text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[b,j]}),e[18]=u,e[19]=b,e[20]=t,e[21]=i,e[22]=y,e[23]=j,e[24]=S):S=e[24];let k;e[25]!==u||e[26]!==a.actions||e[27]!==i?(k=i&&n.jsx("ul",{id:u,className:"ml-2 flex flex-col gap-1.5 border-l pl-4",children:a.actions.map(qe)}),e[25]=u,e[26]=a.actions,e[27]=i,e[28]=k):k=e[28];let m;return e[29]!==S||e[30]!==k?(m=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[S,k]}),e[29]=S,e[30]=k,e[31]=m):m=e[31],m}function qe(o){return n.jsx("li",{children:n.jsx(se,{...o})},o.id)}function se(o){const e=T.c(12),{at:a,action:s}=o;let i;e[0]!==a?(i=V(a),e[0]=a,e[1]=i):i=e[1];let t;e[2]!==s?(t=Ge(s),e[2]=s,e[3]=t):t=e[3];let c;e[4]!==s?(c=je(s),e[4]=s,e[5]=c):c=e[5];let r;e[6]!==c?(r=n.jsx("span",{className:"truncate",children:c}),e[6]=c,e[7]=r):r=e[7];let g;return e[8]!==i||e[9]!==t||e[10]!==r?(g=n.jsxs("span",{title:i,className:"flex min-w-0 items-center gap-2.5",children:[t,r]}),e[8]=i,e[9]=t,e[10]=r,e[11]=g):g=e[11],g}function Ve(o){const e=[];for(const{id:a,at:s,action:i}of[...o].reverse())if(i.kind==="label")e.push({id:a,at:s,label:i.label,actions:[]});else{const t=e.at(-1);t?t.actions.push({id:a,at:s,action:i}):e.push({id:a,at:s,label:null,actions:[{id:a,at:s,action:i}]})}return e}const V=o=>new Date(o).toLocaleTimeString();function Ge(o){const e={"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"};switch(o.kind){case"tap":return n.jsx($e,{...e});case"swipe":return Math.abs(o.to[0]-o.from[0])>Math.abs(o.to[1]-o.from[1])?n.jsx(Ee,{...e}):n.jsx(Fe,{...e});case"key":return n.jsx(He,{...e});case"button":return n.jsx(Se,{...e});case"type":return n.jsx(_e,{...e});case"pinch":return n.jsx(Ie,{...e});case"launch":return n.jsx(Le,{...e});case"install":return n.jsx(we,{...e});case"clear-state":return n.jsx(Te,{...e});case"open-url":return n.jsx(ve,{...e})}}function nt(){const o=T.c(2),{sessionId:e}=ze(),a=e===void 0?"":e;let s;return o[0]!==a?(s=n.jsx(Ue,{sessionId:a},a),o[0]=a,o[1]=s):s=o[1],s}function Ue(o){const e=T.c(49),{sessionId:a}=o,s=We(a),{phase:i,device:t}=s,{setNode:c}=re();let r;e[0]!==(t==null?void 0:t.name)||e[1]!==c?(r=()=>(c(n.jsxs("span",{className:"text-sm font-medium",children:["Watching ",(t==null?void 0:t.name)??"a device"]})),()=>c(null)),e[0]=t==null?void 0:t.name,e[1]=c,e[2]=r):r=e[2];const g=t==null?void 0:t.name;let b;e[3]!==c||e[4]!==g?(b=[c,g],e[3]=c,e[4]=g,e[5]=b):b=e[5],x.useEffect(r,b);const u=i.kind==="ended"||i.kind==="refused",y=i.kind==="refused";let _;e[6]!==t?(_=t!=null&&t.holder?U(t.holder.kind).toLowerCase():"AI client",e[6]=t,e[7]=_):_=e[7];const h=_;let j;e[8]!==h||e[9]!==i.kind||e[10]!==i.reason||e[11]!==s.agentAway||e[12]!==s.connected||e[13]!==s.deviceReady||e[14]!==s.holderLeft?(j=i.kind==="refused"?Ae(i.reason):i.kind==="ended"?Re(i.reason):s.connected?i.kind==="connecting"?"Connecting…":s.agentAway?"The Mac running this device went away. Waiting for it to come back.":s.holderLeft?`The ${h} disconnected. The device stays as it was until it comes back.`:s.deviceReady?"Watching. Nothing you do here reaches the device.":`Waiting for the ${h} to start the device.`:i.kind==="connecting"?"Connecting to the relay…":"Reconnecting to the relay…",e[8]=h,e[9]=i.kind,e[10]=i.reason,e[11]=s.agentAway,e[12]=s.connected,e[13]=s.deviceReady,e[14]=s.holderLeft,e[15]=j):j=e[15];const S=j,k=(t==null?void 0:t.name)??"AI session";let m;e[16]!==k?(m=n.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:k}),e[16]=k,e[17]=m):m=e[17];let f;e[18]!==t?(f=(t==null?void 0:t.holder)&&n.jsxs("p",{className:"text-sm text-muted-foreground",children:[U(t.holder.kind)," · ",t.holder.user]}),e[18]=t,e[19]=f):f=e[19];let v;e[20]!==m||e[21]!==f?(v=n.jsxs("div",{className:"flex flex-col gap-1",children:[m,f]}),e[20]=m,e[21]=f,e[22]=v):v=e[22];let M;e[23]!==S?(M=n.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:S}),e[23]=S,e[24]=M):M=e[24];let w;e[25]!==u?(w=u&&n.jsx("div",{children:n.jsx(de,{asChild:!0,variant:"outline",size:"sm",children:n.jsxs(De,{to:"/app-center",children:[n.jsx(Me,{className:"h-4 w-4","aria-hidden":"true"}),"Back to App Center"]})})}),e[25]=u,e[26]=w):w=e[26];let A;e[27]!==(t==null?void 0:t.formFactor)||e[28]!==(t==null?void 0:t.platform)||e[29]!==u||e[30]!==y||e[31]!==s.binaryFrameHandlerRef||e[32]!==s.chrome||e[33]!==s.deviceReady||e[34]!==s.marks?(A=!y&&n.jsx("div",{role:"region","aria-label":"Device screen",className:"flex justify-center px-8",children:n.jsx(be,{chrome:s.chrome,deviceReady:s.deviceReady,platform:(t==null?void 0:t.platform)??"ios",formFactor:t==null?void 0:t.formFactor,binaryFrameHandlerRef:s.binaryFrameHandlerRef,marks:s.marks,replay:u})}),e[27]=t==null?void 0:t.formFactor,e[28]=t==null?void 0:t.platform,e[29]=u,e[30]=y,e[31]=s.binaryFrameHandlerRef,e[32]=s.chrome,e[33]=s.deviceReady,e[34]=s.marks,e[35]=A):A=e[35];let R;e[36]!==M||e[37]!==w||e[38]!==A||e[39]!==v?(R=n.jsxs("div",{className:"flex min-w-0 flex-col gap-5",children:[v,M,w,A]}),e[36]=M,e[37]=w,e[38]=A,e[39]=v,e[40]=R):R=e[40];let d;e[41]!==h||e[42]!==u||e[43]!==y||e[44]!==s.actions?(d=!y&&n.jsxs(n.Fragment,{children:[n.jsx(ce,{orientation:"vertical",className:"hidden h-auto lg:block"}),n.jsx(Be,{actions:s.actions,driver:h,live:!u})]}),e[41]=h,e[42]=u,e[43]=y,e[44]=s.actions,e[45]=d):d=e[45];let N;return e[46]!==R||e[47]!==d?(N=n.jsxs("div",{className:"flex min-h-0 flex-col gap-6 p-6 lg:h-full lg:flex-row",children:[R,d]}),e[46]=R,e[47]=d,e[48]=N):N=e[48],N}export{nt as AISessionWatch};
31
+ */const ee={name:"scaling",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M14 15H9v-5",key:"pi4jk9"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M21 3 9 15",key:"15kdhq"}]]};ee.node;const Fe=T(ee);function Ie(o){const e=H.c(28);let a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a={kind:"connecting"},e[0]=a):a=e[0];const[s,i]=x.useState(a),[t,c]=x.useState(null),[r,g]=x.useState(void 0),[b,u]=x.useState(!1),[y,_]=x.useState(!1),[h,j]=x.useState(!1),[S,k]=x.useState(null),m=x.useRef(void 0);let f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];const[v,M]=x.useState(f),[w,A]=x.useState(xe),R=x.useRef(0);let d;e[2]===Symbol.for("react.memo_cache_sentinel")?(d=new Set,e[2]=d):d=e[2];const N=x.useRef(d);let E,$;e[3]===Symbol.for("react.memo_cache_sentinel")?(E=()=>{const l=N.current;return()=>{for(const p of l)clearTimeout(p)}},$=[],e[3]=E,e[4]=$):(E=e[3],$=e[4]),x.useEffect(E,$);let F;e[5]!==o?(F=l=>{if(l.type==="agents:listed"){const p=l.sessions.flatMap(We).find(L=>L.sessionId===o);p&&k(p),p!=null&&p.holder&&_(!1);return}if(!("sessionId"in l&&l.sessionId!==void 0&&l.sessionId!==o)){if(l.type==="watch:started")i({kind:"watching"});else if(l.type==="watch:refused")i({kind:"refused",reason:l.reason});else if(l.type==="watch:ended")i({kind:"ended",reason:l.reason});else if(l.type==="watch:holder-left")_(!0);else if(l.type==="session:agent-away")j(!0);else if(l.type==="session:rebound")j(!1),u(!1);else if(l.type==="session:chrome")c(l.payload);else if(l.type==="device:postures")g(l.payload);else if(l.type==="device:booting")c(null),g(void 0),u(!1),j(!1);else if(l.type==="device:ready")u(!0),j(!1);else if(l.type==="watch:action"){R.current=R.current+1;const p={id:R.current,at:l.at,action:l.action};if(M(L=>[p,...L].slice(0,ye)),ke(l.action)){const L=l.action;A(z=>({cursor:L.kind==="tap"?{x:L.x,y:L.y}:{x:L.to[0],y:L.to[1]},trails:[...z.trails,ge(p.id,L,z.cursor)]}));const q=setTimeout(()=>{N.current.delete(q),A(z=>({...z,trails:z.trails.filter(ae=>ae.id!==p.id)}))},je);N.current.add(q)}}}},e[5]=o,e[6]=F):F=e[6];const se=F;let I;e[7]===Symbol.for("react.memo_cache_sentinel")?(I=l=>{var z;const p=he(l);if((p==null?void 0:p.codec)===me)return;const L=p?l.slice(pe):l,q=p?{codec:p.codec,keyframe:p.keyframe,capturedAt:p.capturedAt,relayedAt:p.relayedAt}:void 0;(z=m.current)==null||z.call(m,L,q)},e[7]=I):I=e[7];const ne=I,{send:D,connected:C}=ue(se,ne),G=x.useRef(!1);let W;e[8]!==s.kind?(W=()=>{G.current=s.kind==="ended"||s.kind==="refused"},e[8]=s.kind,e[9]=W):W=e[9];let O;e[10]!==s?(O=[s],e[10]=s,e[11]=O):O=e[11],x.useEffect(W,O);let B,P;e[12]!==C||e[13]!==D||e[14]!==o?(P=()=>{if(!C)return;D({type:"agents:list"}),G.current||D({type:"watch:start",sessionId:o});const l=setInterval(()=>D({type:"agents:list"}),1e4);return()=>clearInterval(l)},B=[C,D,o],e[12]=C,e[13]=D,e[14]=o,e[15]=B,e[16]=P):(B=e[15],P=e[16]),x.useEffect(P,B);let K;return e[17]!==v||e[18]!==h||e[19]!==t||e[20]!==C||e[21]!==S||e[22]!==b||e[23]!==y||e[24]!==w||e[25]!==s||e[26]!==r?(K={phase:s,device:S,chrome:t,postures:r,deviceReady:b,holderLeft:y,agentAway:h,connected:C,binaryFrameHandlerRef:m,actions:v,marks:w},e[17]=v,e[18]=h,e[19]=t,e[20]=C,e[21]=S,e[22]=b,e[23]=y,e[24]=w,e[25]=s,e[26]=r,e[27]=K):K=e[27],K}function We(o){return o.devices}function Oe(o){var R;const e=H.c(14),{actions:a,driver:s,live:i}=o,t=qe(a),c=(R=t.at(-1))==null?void 0:R.id;let r;e[0]===Symbol.for("react.memo_cache_sentinel")?(r={},e[0]=r):r=e[0];const[g,b]=x.useState(r),u=x.useRef(null),y=x.useRef(!0);let _;e[1]===Symbol.for("react.memo_cache_sentinel")?(_=()=>{const d=u.current;d&&y.current&&(d.scrollTop=d.scrollHeight)},e[1]=_):_=e[1];let h;e[2]!==a?(h=[a],e[2]=a,e[3]=h):h=e[3],x.useLayoutEffect(_,h);const j="agent-activity-title",S="flex min-h-0 min-w-0 flex-1 flex-col gap-3";let k;e[4]===Symbol.for("react.memo_cache_sentinel")?(k=n.jsx("h2",{id:"agent-activity-title",className:"text-sm font-medium",children:"Agent activity"}),e[4]=k):k=e[4];let m,f;e[5]===Symbol.for("react.memo_cache_sentinel")?(m=d=>{const N=d.currentTarget;y.current=N.scrollHeight-N.scrollTop-N.clientHeight<24},f={overflowAnchor:"none"},e[5]=m,e[6]=f):(m=e[5],f=e[6]);const v="h-96 overflow-y-auto rounded-xl border bg-background px-5 py-4 lg:h-auto lg:min-h-48 lg:flex-1",M=t.length===0?n.jsxs("p",{className:"text-sm text-muted-foreground",children:["Nothing yet. What the ",s," does appears here as it happens."]}):n.jsx("ol",{"aria-label":"Steps and actions",className:"flex flex-col gap-2 text-sm",children:t.map(d=>d.label===null?d.actions.map(Be):n.jsx("li",{children:n.jsx(Pe,{group:d,running:i&&d.id===c,open:g[d.id]??!0,onToggle:()=>b(N=>({...N,[d.id]:!(N[d.id]??!0)}))})},d.id))});let w;e[7]!==M||e[8]!==m||e[9]!==f?(w=n.jsx("div",{ref:u,onScroll:m,style:f,className:v,children:M}),e[7]=M,e[8]=m,e[9]=f,e[10]=w):w=e[10];let A;return e[11]!==w||e[12]!==k?(A=n.jsxs("section",{"aria-labelledby":j,className:S,children:[k,w]}),e[11]=w,e[12]=k,e[13]=A):A=e[13],A}function Be(o){return n.jsx("li",{children:n.jsx(te,{...o})},o.id)}function Pe(o){const e=H.c(32),{group:a,running:s,open:i,onToggle:t}=o;let c;e[0]!==s?(c=s?n.jsx(ie,{"aria-hidden":"true",className:"size-4 shrink-0 motion-safe:animate-spin"}):n.jsx(le,{"aria-hidden":"true",className:"size-4 shrink-0"}),e[0]=s,e[1]=c):c=e[1];let r;e[2]!==a.label?(r=n.jsx("span",{className:"truncate",children:a.label}),e[2]=a.label,e[3]=r):r=e[3];let g;e[4]!==c||e[5]!==r?(g=n.jsxs(n.Fragment,{children:[c,r]}),e[4]=c,e[5]=r,e[6]=g):g=e[6];const b=g;if(a.actions.length===0){let f;e[7]!==a.at?(f=V(a.at),e[7]=a.at,e[8]=f):f=e[8];let v;return e[9]!==b||e[10]!==f?(v=n.jsx("div",{title:f,className:"flex min-w-0 items-center gap-2.5 text-muted-foreground",children:b}),e[9]=b,e[10]=f,e[11]=v):v=e[11],v}const u=`agent-step-${a.id}`;let y;e[12]!==a.at?(y=V(a.at),e[12]=a.at,e[13]=y):y=e[13];const _=i&&"rotate-90";let h;e[14]!==_?(h=oe("size-4 shrink-0 transition-transform",_),e[14]=_,e[15]=h):h=e[15];let j;e[16]!==h?(j=n.jsx(re,{"aria-hidden":"true",className:h}),e[16]=h,e[17]=j):j=e[17];let S;e[18]!==u||e[19]!==b||e[20]!==t||e[21]!==i||e[22]!==y||e[23]!==j?(S=n.jsxs("button",{type:"button",title:y,"aria-expanded":i,"aria-controls":u,onClick:t,className:"flex min-w-0 items-center gap-2.5 rounded-sm text-left text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[b,j]}),e[18]=u,e[19]=b,e[20]=t,e[21]=i,e[22]=y,e[23]=j,e[24]=S):S=e[24];let k;e[25]!==u||e[26]!==a.actions||e[27]!==i?(k=i&&n.jsx("ul",{id:u,className:"ml-2 flex flex-col gap-1.5 border-l pl-4",children:a.actions.map(Ke)}),e[25]=u,e[26]=a.actions,e[27]=i,e[28]=k):k=e[28];let m;return e[29]!==S||e[30]!==k?(m=n.jsxs("div",{className:"flex flex-col gap-1.5",children:[S,k]}),e[29]=S,e[30]=k,e[31]=m):m=e[31],m}function Ke(o){return n.jsx("li",{children:n.jsx(te,{...o})},o.id)}function te(o){const e=H.c(12),{at:a,action:s}=o;let i;e[0]!==a?(i=V(a),e[0]=a,e[1]=i):i=e[1];let t;e[2]!==s?(t=Ve(s),e[2]=s,e[3]=t):t=e[3];let c;e[4]!==s?(c=be(s),e[4]=s,e[5]=c):c=e[5];let r;e[6]!==c?(r=n.jsx("span",{className:"truncate",children:c}),e[6]=c,e[7]=r):r=e[7];let g;return e[8]!==i||e[9]!==t||e[10]!==r?(g=n.jsxs("span",{title:i,className:"flex min-w-0 items-center gap-2.5",children:[t,r]}),e[8]=i,e[9]=t,e[10]=r,e[11]=g):g=e[11],g}function qe(o){const e=[];for(const{id:a,at:s,action:i}of[...o].reverse())if(i.kind==="label")e.push({id:a,at:s,label:i.label,actions:[]});else{const t=e.at(-1);t?t.actions.push({id:a,at:s,action:i}):e.push({id:a,at:s,label:null,actions:[{id:a,at:s,action:i}]})}return e}const V=o=>new Date(o).toLocaleTimeString();function Ve(o){const e={"aria-hidden":!0,className:"size-4 shrink-0 text-muted-foreground"};switch(o.kind){case"tap":return n.jsx(Te,{...e});case"swipe":return Math.abs(o.to[0]-o.from[0])>Math.abs(o.to[1]-o.from[1])?n.jsx(Ee,{...e}):n.jsx($e,{...e});case"key":return n.jsx(De,{...e});case"button":return n.jsx(Ne,{...e});case"type":return n.jsx(Se,{...e});case"pinch":return n.jsx(Fe,{...e});case"launch":return n.jsx(Le,{...e});case"install":return n.jsx(_e,{...e});case"clear-state":return n.jsx(He,{...e});case"open-url":return n.jsx(we,{...e})}}function st(){const o=H.c(2),{sessionId:e}=ze(),a=e===void 0?"":e;let s;return o[0]!==a?(s=n.jsx(Ge,{sessionId:a},a),o[0]=a,o[1]=s):s=o[1],s}function Ge(o){const e=H.c(49),{sessionId:a}=o,s=Ie(a),{phase:i,device:t}=s,{setNode:c}=ce();let r;e[0]!==(t==null?void 0:t.name)||e[1]!==c?(r=()=>(c(n.jsxs("span",{className:"text-sm font-medium",children:["Watching ",(t==null?void 0:t.name)??"a device"]})),()=>c(null)),e[0]=t==null?void 0:t.name,e[1]=c,e[2]=r):r=e[2];const g=t==null?void 0:t.name;let b;e[3]!==c||e[4]!==g?(b=[c,g],e[3]=c,e[4]=g,e[5]=b):b=e[5],x.useEffect(r,b);const u=i.kind==="ended"||i.kind==="refused",y=i.kind==="refused";let _;e[6]!==t?(_=t!=null&&t.holder?U(t.holder.kind).toLowerCase():"AI client",e[6]=t,e[7]=_):_=e[7];const h=_;let j;e[8]!==h||e[9]!==i.kind||e[10]!==i.reason||e[11]!==s.agentAway||e[12]!==s.connected||e[13]!==s.deviceReady||e[14]!==s.holderLeft?(j=i.kind==="refused"?Ae(i.reason):i.kind==="ended"?Re(i.reason):s.connected?i.kind==="connecting"?"Connecting…":s.agentAway?"The Mac running this device went away. Waiting for it to come back.":s.holderLeft?`The ${h} disconnected. The device stays as it was until it comes back.`:s.deviceReady?"Watching. Nothing you do here reaches the device.":`Waiting for the ${h} to start the device.`:i.kind==="connecting"?"Connecting to the relay…":"Reconnecting to the relay…",e[8]=h,e[9]=i.kind,e[10]=i.reason,e[11]=s.agentAway,e[12]=s.connected,e[13]=s.deviceReady,e[14]=s.holderLeft,e[15]=j):j=e[15];const S=j,k=(t==null?void 0:t.name)??"AI session";let m;e[16]!==k?(m=n.jsx("h1",{className:"text-xl font-semibold tracking-tight",children:k}),e[16]=k,e[17]=m):m=e[17];let f;e[18]!==t?(f=(t==null?void 0:t.holder)&&n.jsxs("p",{className:"text-sm text-muted-foreground",children:[U(t.holder.kind)," · ",t.holder.user]}),e[18]=t,e[19]=f):f=e[19];let v;e[20]!==m||e[21]!==f?(v=n.jsxs("div",{className:"flex flex-col gap-1",children:[m,f]}),e[20]=m,e[21]=f,e[22]=v):v=e[22];let M;e[23]!==S?(M=n.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:S}),e[23]=S,e[24]=M):M=e[24];let w;e[25]!==u?(w=u&&n.jsx("div",{children:n.jsx(fe,{asChild:!0,variant:"outline",size:"sm",children:n.jsxs(Ce,{to:"/app-center",children:[n.jsx(Me,{className:"h-4 w-4","aria-hidden":"true"}),"Back to App Center"]})})}),e[25]=u,e[26]=w):w=e[26];let A;e[27]!==(t==null?void 0:t.formFactor)||e[28]!==(t==null?void 0:t.platform)||e[29]!==u||e[30]!==y||e[31]!==s.binaryFrameHandlerRef||e[32]!==s.chrome||e[33]!==s.deviceReady||e[34]!==s.marks?(A=!y&&n.jsx("div",{role:"region","aria-label":"Device screen",className:"flex justify-center px-8",children:n.jsx(ve,{chrome:s.chrome,deviceReady:s.deviceReady,platform:(t==null?void 0:t.platform)??"ios",formFactor:t==null?void 0:t.formFactor,binaryFrameHandlerRef:s.binaryFrameHandlerRef,marks:s.marks,replay:u})}),e[27]=t==null?void 0:t.formFactor,e[28]=t==null?void 0:t.platform,e[29]=u,e[30]=y,e[31]=s.binaryFrameHandlerRef,e[32]=s.chrome,e[33]=s.deviceReady,e[34]=s.marks,e[35]=A):A=e[35];let R;e[36]!==M||e[37]!==w||e[38]!==A||e[39]!==v?(R=n.jsxs("div",{className:"flex min-w-0 flex-col gap-5",children:[v,M,w,A]}),e[36]=M,e[37]=w,e[38]=A,e[39]=v,e[40]=R):R=e[40];let d;e[41]!==h||e[42]!==u||e[43]!==y||e[44]!==s.actions?(d=!y&&n.jsxs(n.Fragment,{children:[n.jsx(de,{orientation:"vertical",className:"hidden h-auto lg:block"}),n.jsx(Oe,{actions:s.actions,driver:h,live:!u})]}),e[41]=h,e[42]=u,e[43]=y,e[44]=s.actions,e[45]=d):d=e[45];let N;return e[46]!==R||e[47]!==d?(N=n.jsxs("div",{className:"flex min-h-0 flex-col gap-6 p-6 lg:h-full lg:flex-row",children:[R,d]}),e[46]=R,e[47]=d,e[48]=N):N=e[48],N}export{st as AISessionWatch};
@@ -1,25 +1,25 @@
1
- var Ve=l=>{throw TypeError(l)};var Re=(l,e,s)=>e.has(l)||Ve("Cannot "+s);var A=(l,e,s)=>(Re(l,e,"read from private field"),s?s.call(l):e.get(l)),fe=(l,e,s)=>e.has(l)?Ve("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,s),me=(l,e,s,a)=>(Re(l,e,"write to private field"),a?a.call(l,s):e.set(l,s),s),ue=(l,e,s)=>(Re(l,e,"access private method"),s);import{r as o,c as xe,j as t}from"./vendor-react-DTSdA8m-.js";import{t as jt,w as yt,x as He,y as vt,A as tt,b as st,D as St,E as Nt,G as Ne,H as J,B as ie,L as ve,I as We,F as wt,J as Dt,S as _t,T as kt,K as Ct,M as At,N as Et,O as It,Q as pe,R as Rt,c as Je,U as Tt,V as Ft,W as Ot,X as $t,Y as Mt,q as Pt,Z as Lt,$ as Bt,a0 as zt}from"./index-cgl1yEKu.js";import{S as qt}from"./search-input-CFWgLcKA.js";import{S as ke,a as Ce,b as Ae,c as F,d as Ee,C as Kt}from"./select-5ZtzWRYG.js";import{D as lt,a as at,b as nt,c as rt,d as it}from"./dialog-CtzPkg0O.js";import{T as _e}from"./tech-label-qLodPeUI.js";import{P as Qt,T as Ut}from"./trash-CXjB9oU1.js";import{B as Te}from"./badge-D-bt97WR.js";import{A as Vt,a as Ht,b as Wt,c as Jt,d as Gt,e as Yt,f as Xt,g as Zt}from"./alert-dialog-Bq_Ln5bp.js";import{f as es,b as Oe,P as ts,S as ss,d as ls}from"./build-format-ofd2iIzf.js";import{P as as}from"./play-DCvrorIC.js";import{u as ns}from"./useFocusAfterSwap-BdItkQCu.js";import{u as rs,S as is}from"./useShownAfter-By1Yxysz.js";import{a as os,c as cs}from"./vendor-router-B1pQim9Z.js";import"./index-D17hSi50.js";var re,oe,$,Se,ae,ye,$e,et,ds=(et=class extends jt{constructor(e,s){super();fe(this,ae);fe(this,re);fe(this,oe);fe(this,$);fe(this,Se);me(this,re,e),this.setOptions(s),this.bindMethods(),ue(this,ae,ye).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var a;const s=this.options;this.options=A(this,re).defaultMutationOptions(e),yt(this.options,s)||A(this,re).getMutationCache().notify({type:"observerOptionsUpdated",mutation:A(this,$),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&He(s.mutationKey)!==He(this.options.mutationKey)?this.reset():((a=A(this,$))==null?void 0:a.state.status)==="pending"&&A(this,$).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&A(this,$)&&(A(this,$).addObserver(this),ue(this,ae,ye).call(this))}onUnsubscribe(){var e;this.hasListeners()||(e=A(this,$))==null||e.removeObserver(this)}onMutationUpdate(e){ue(this,ae,ye).call(this),ue(this,ae,$e).call(this,e)}getCurrentResult(){return A(this,oe)}reset(){var e;(e=A(this,$))==null||e.removeObserver(this),me(this,$,void 0),ue(this,ae,ye).call(this),ue(this,ae,$e).call(this)}mutate(e,s){var a;return me(this,Se,s),(a=A(this,$))==null||a.removeObserver(this),me(this,$,A(this,re).getMutationCache().build(A(this,re),this.options)),A(this,$).addObserver(this),A(this,$).execute(e)}},re=new WeakMap,oe=new WeakMap,$=new WeakMap,Se=new WeakMap,ae=new WeakSet,ye=function(){var s;const e=((s=A(this,$))==null?void 0:s.state)??vt();me(this,oe,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},$e=function(e){tt.batch(()=>{var a,c,b,f;const s=A(this,Se);if(s&&this.hasListeners()){const p=A(this,oe).variables,g=A(this,oe).context,u={client:A(this,re),meta:this.options.meta,mutationKey:this.options.mutationKey};if((e==null?void 0:e.type)==="success"){try{(a=s.onSuccess)==null||a.call(s,e.data,p,g,u)}catch(d){Promise.reject(d)}try{(c=s.onSettled)==null||c.call(s,e.data,null,p,g,u)}catch(d){Promise.reject(d)}}else if((e==null?void 0:e.type)==="error"){try{(b=s.onError)==null||b.call(s,e.error,p,g,u)}catch(d){Promise.reject(d)}try{(f=s.onSettled)==null||f.call(s,void 0,e.error,p,g,u)}catch(d){Promise.reject(d)}}}this.listeners.forEach(p=>{p(A(this,oe))})})},et);function Fe(l,e){const s=st(),[a]=o.useState(()=>new ds(s,l));o.useEffect(()=>{a.setOptions(l)},[a,l]);const c=o.useSyncExternalStore(o.useCallback(f=>a.subscribe(tt.batchCalls(f)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),b=o.useCallback((...f)=>{a.mutate(f[0],f[1]).catch(St)},[a]);if(c.error&&Nt(a.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:b,mutateAsync:c.mutate}}/**
2
- * @license lucide-react v1.58.0 - ISC
1
+ var Ve=l=>{throw TypeError(l)};var Re=(l,e,s)=>e.has(l)||Ve("Cannot "+s);var A=(l,e,s)=>(Re(l,e,"read from private field"),s?s.call(l):e.get(l)),fe=(l,e,s)=>e.has(l)?Ve("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(l):e.set(l,s),me=(l,e,s,a)=>(Re(l,e,"write to private field"),a?a.call(l,s):e.set(l,s),s),ue=(l,e,s)=>(Re(l,e,"access private method"),s);import{r as o,c as xe,j as t}from"./vendor-react-DTSdA8m-.js";import{t as jt,w as yt,x as He,y as vt,A as tt,b as st,D as St,E as Nt,G as Ne,H as J,B as ie,L as ve,I as We,F as wt,J as Dt,S as _t,T as kt,K as Ct,M as At,N as Et,O as It,Q as pe,R as Rt,c as Je,U as Tt,V as Ft,W as Ot,X as $t,Y as Mt,q as Pt,Z as Lt,$ as Bt,a0 as zt}from"./index-C_3Q51YJ.js";import{S as qt}from"./search-input-B0s9mzRt.js";import{S as ke,a as Ce,b as Ae,c as F,d as Ee,C as Kt}from"./select-CHbE6M4S.js";import{D as lt,a as at,b as nt,c as rt,d as it}from"./dialog-Cugbp1C4.js";import{T as _e}from"./tech-label-KAwM5qZ_.js";import{P as Qt,T as Ut}from"./trash-HEJmY7DQ.js";import{B as Te}from"./badge-BjEnOmb0.js";import{A as Vt,a as Ht,b as Wt,c as Jt,d as Gt,e as Yt,f as Xt,g as Zt}from"./alert-dialog-C0mRms8g.js";import{f as es,b as Oe,P as ts,S as ss,d as ls}from"./build-format-ofd2iIzf.js";import{P as as}from"./play-Z1L2Eb91.js";import{u as ns}from"./useFocusAfterSwap-BdItkQCu.js";import{u as rs,S as is}from"./useShownAfter-By1Yxysz.js";import{a as os,c as cs}from"./vendor-router-B1pQim9Z.js";import"./index-D17hSi50.js";var re,oe,$,Se,ae,ye,$e,et,ds=(et=class extends jt{constructor(e,s){super();fe(this,ae);fe(this,re);fe(this,oe);fe(this,$);fe(this,Se);me(this,re,e),this.setOptions(s),this.bindMethods(),ue(this,ae,ye).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){var a;const s=this.options;this.options=A(this,re).defaultMutationOptions(e),yt(this.options,s)||A(this,re).getMutationCache().notify({type:"observerOptionsUpdated",mutation:A(this,$),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&He(s.mutationKey)!==He(this.options.mutationKey)?this.reset():((a=A(this,$))==null?void 0:a.state.status)==="pending"&&A(this,$).setOptions(this.options)}onSubscribe(){this.listeners.size===1&&A(this,$)&&(A(this,$).addObserver(this),ue(this,ae,ye).call(this))}onUnsubscribe(){var e;this.hasListeners()||(e=A(this,$))==null||e.removeObserver(this)}onMutationUpdate(e){ue(this,ae,ye).call(this),ue(this,ae,$e).call(this,e)}getCurrentResult(){return A(this,oe)}reset(){var e;(e=A(this,$))==null||e.removeObserver(this),me(this,$,void 0),ue(this,ae,ye).call(this),ue(this,ae,$e).call(this)}mutate(e,s){var a;return me(this,Se,s),(a=A(this,$))==null||a.removeObserver(this),me(this,$,A(this,re).getMutationCache().build(A(this,re),this.options)),A(this,$).addObserver(this),A(this,$).execute(e)}},re=new WeakMap,oe=new WeakMap,$=new WeakMap,Se=new WeakMap,ae=new WeakSet,ye=function(){var s;const e=((s=A(this,$))==null?void 0:s.state)??vt();me(this,oe,{...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset})},$e=function(e){tt.batch(()=>{var a,c,b,f;const s=A(this,Se);if(s&&this.hasListeners()){const p=A(this,oe).variables,g=A(this,oe).context,u={client:A(this,re),meta:this.options.meta,mutationKey:this.options.mutationKey};if((e==null?void 0:e.type)==="success"){try{(a=s.onSuccess)==null||a.call(s,e.data,p,g,u)}catch(d){Promise.reject(d)}try{(c=s.onSettled)==null||c.call(s,e.data,null,p,g,u)}catch(d){Promise.reject(d)}}else if((e==null?void 0:e.type)==="error"){try{(b=s.onError)==null||b.call(s,e.error,p,g,u)}catch(d){Promise.reject(d)}try{(f=s.onSettled)==null||f.call(s,void 0,e.error,p,g,u)}catch(d){Promise.reject(d)}}}this.listeners.forEach(p=>{p(A(this,oe))})})},et);function Fe(l,e){const s=st(),[a]=o.useState(()=>new ds(s,l));o.useEffect(()=>{a.setOptions(l)},[a,l]);const c=o.useSyncExternalStore(o.useCallback(f=>a.subscribe(tt.batchCalls(f)),[a]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),b=o.useCallback((...f)=>{a.mutate(f[0],f[1]).catch(St)},[a]);if(c.error&&Nt(a.options.throwOnError,[c.error]))throw c.error;return{...c,mutate:b,mutateAsync:c.mutate}}/**
2
+ * @license lucide-react v1.59.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
6
  */const ot={name:"ban",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]};ot.node;const us=Ne(ot);/**
7
- * @license lucide-react v1.58.0 - ISC
7
+ * @license lucide-react v1.59.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
11
  */const ct={name:"layers",size:24,node:[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]],aliases:["layers-3"]};ct.node;const hs=Ne(ct);/**
12
- * @license lucide-react v1.58.0 - ISC
12
+ * @license lucide-react v1.59.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
16
  */const dt={name:"package",size:24,node:[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]};dt.node;const fs=Ne(dt);/**
17
- * @license lucide-react v1.58.0 - ISC
17
+ * @license lucide-react v1.59.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
21
  */const ut={name:"timer-off",size:24,node:[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]]};ut.node;const ms=Ne(ut);/**
22
- * @license lucide-react v1.58.0 - ISC
22
+ * @license lucide-react v1.59.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
@@ -0,0 +1,6 @@
1
+ import{r as y,j as e,c as Ve}from"./vendor-react-DTSdA8m-.js";import{a6 as ve,a8 as Ee,a2 as be,b as je,u as R,a as $,C as F,d as D,e as k,f as V,n as L,L as j,B as C,h as q,o as O,aF as ue,H as f,q as S,z as Me,R as Te,c as pe,l as Ge,I as N,F as P,S as fe,p as Re,g as $e,P as qe,aG as Le,_ as ye,s as E,i as Oe,j as Be,aH as He,Z as Ie}from"./index-C_3Q51YJ.js";import{F as z}from"./field-hint-qmBa0qqN.js";import{B as Qe}from"./badge-BjEnOmb0.js";import{P as ze}from"./build-format-ofd2iIzf.js";import{g as Ke,h as Ue,d as We,A as Xe,a as Je,b as Ye,e as Ze,c as er,f as rr}from"./alert-dialog-C0mRms8g.js";import{S as ge}from"./slider-tyb3JvL2.js";import{P as he}from"./pencil-DUZRZB3S.js";import"./vendor-router-B1pQim9Z.js";import"./index-D17hSi50.js";var sr=Object.defineProperty,w=(a,i)=>sr(a,"name",{value:i,configurable:!0}),we="Progress",X=100,[ar,Cr]=Ee(we),[tr,or]=ar(we),Se=y.forwardRef(w(function(i,r){const{__scopeProgress:g,value:t=null,max:n,getValueLabel:p=Ne,...x}=i;(n||n===0)&&!K(n)&&console.error(Pe(`${n}`,"Progress"));const m=K(n)?n:X;t!==null&&!U(t,m)&&console.error(Ce(`${t}`,"Progress"));const h=U(t,m)?t:null,u=M(h)?p(h,m):void 0;return e.jsx(tr,{scope:g,value:h,max:m,children:e.jsx(ve.div,{"aria-valuemax":m,"aria-valuemin":0,"aria-valuenow":M(h)?h:void 0,"aria-valuetext":u,role:"progressbar","data-state":J(h,m),"data-value":h??void 0,"data-max":m,...x,ref:r})})},"Progress")),ir="ProgressIndicator",nr=y.forwardRef(w(function(i,r){const{__scopeProgress:g,...t}=i,n=or(ir,g);return e.jsx(ve.div,{"data-state":J(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...t,ref:r})},"ProgressIndicator"));function Ne(a,i){return`${Math.round(a/i*100)}%`}w(Ne,"defaultGetValueLabel");function J(a,i){return a==null?"indeterminate":a===i?"complete":"loading"}w(J,"getProgressState");function M(a){return typeof a=="number"}w(M,"isNumber");function K(a){return M(a)&&!isNaN(a)&&a>0}w(K,"isValidMaxNumber");function U(a,i){return M(a)&&!isNaN(a)&&a<=i&&a>=0}w(U,"isValidValueNumber");function Pe(a,i){return`Invalid prop \`max\` of value \`${a}\` supplied to \`${i}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${X}\`.`}w(Pe,"getInvalidMaxError");function Ce(a,i){return`Invalid prop \`value\` of value \`${a}\` supplied to \`${i}\`. The \`value\` prop must be:
2
+ - a positive number
3
+ - less than the value passed to \`max\` (or ${X} if no \`max\` prop is set)
4
+ - \`null\` or \`undefined\` if the progress is indeterminate.
5
+
6
+ Defaulting to \`null\`.`}w(Ce,"getInvalidValueError");const _e=y.forwardRef((a,i)=>{const r=Ve.c(14);let g,t,n;r[0]!==a?({className:g,value:n,...t}=a,r[0]=a,r[1]=g,r[2]=t,r[3]=n):(g=r[1],t=r[2],n=r[3]);let p;r[4]!==g?(p=be("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",g),r[4]=g,r[5]=p):p=r[5];const x=`translateX(-${100-(n||0)}%)`;let m;r[6]!==x?(m=e.jsx(nr,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:x}}),r[6]=x,r[7]=m):m=r[7];let h;return r[8]!==t||r[9]!==i||r[10]!==p||r[11]!==m||r[12]!==n?(h=e.jsx(Se,{ref:i,className:p,value:n,...t,children:m}),r[8]=t,r[9]=i,r[10]=p,r[11]=m,r[12]=n,r[13]=h):h=r[13],h});_e.displayName=Se.displayName;const xe=1024*1024*1024,lr=14,W=1,dr=100,cr=O({retentionDays:ue().int().min(0).max(365),capGb:ue().int().min(W).max(10240)});function A(a){if(a<xe)return`${Math.round(a/(1024*1024))} MB`;const i=a/xe;return`${i>=10?i.toFixed(0):i.toFixed(1)} GB`}function mr({settings:a}){const i=je(),r=a.video_pass_retention_days??3,g=Math.max(W,Math.round((a.video_storage_cap_mb??20480)/1024)),t=R({shouldFocusError:!1,resolver:$(cr),values:{retentionDays:r,capGb:g},resetOptions:{keepDirtyValues:!0}});async function n(u){const d=t.formState.dirtyFields;if(!d.retentionDays&&!d.capGb)return;const _=new FormData;d.retentionDays&&_.append("video_pass_retention_days",String(u.retentionDays)),d.capGb&&_.append("video_storage_cap_mb",String(u.capGb*1024));const B=d.retentionDays===!0,H=d.capGb===!0;try{if(!(await fetch("/api/v1/settings",{method:"PATCH",credentials:"include",body:_})).ok){f.error("Failed to update video storage");return}B&&t.getValues("retentionDays")===u.retentionDays&&t.resetField("retentionDays",{defaultValue:u.retentionDays}),H&&t.getValues("capGb")===u.capGb&&t.resetField("capGb",{defaultValue:u.capGb}),f.success("Video storage updated"),i.invalidateQueries({queryKey:S.settings})}catch{f.error("Failed to update video storage")}}if(a.video_storage_cap_mb===void 0)return null;const p=a.video_storage_cap_mb*1024*1024,x=a.video_effective_cap_bytes??p,m=a.video_usage_bytes??0,h=x>0?Math.min(100,m/x*100):0;return e.jsxs(F,{children:[e.jsx(D,{children:e.jsx(k,{children:"Flow run videos"})}),e.jsx(V,{children:e.jsxs("form",{onSubmit:t.handleSubmit(n),className:"flex flex-col gap-6",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(_e,{value:h,"aria-label":"Storage used by videos","aria-valuetext":`${A(m)} of ${A(x)}`}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-foreground",children:A(m)})," of ",A(x)," used",x<p&&" — the disk has less room than the limit below, so that is the limit in effect"]})]}),e.jsx(L,{name:"retentionDays",control:t.control,render:({field:u})=>e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx(j,{id:"video-retention-label",children:"Keep passed flows' videos for"}),e.jsx("span",{className:"text-sm tabular-nums",children:u.value===1?"1 day":`${u.value} days`})]}),e.jsx(ge,{min:0,max:Math.max(lr,r),step:1,value:[u.value],onValueChange:([d])=>u.onChange(d),"aria-labelledby":"video-retention-label","aria-describedby":"video-retention-hint"}),e.jsx(z,{id:"video-retention-hint",children:"A failed flow's video is kept as long as its run, unless storage runs out."})]})}),e.jsx(L,{name:"capGb",control:t.control,render:({field:u})=>e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between",children:[e.jsx(j,{id:"video-cap-label",children:"Storage for videos"}),e.jsx("span",{className:"text-sm tabular-nums",children:t.formState.dirtyFields.capGb?`${u.value} GB`:A(p)})]}),e.jsx(ge,{min:W,max:Math.max(dr,g),step:1,value:[u.value],onValueChange:([d])=>u.onChange(d),"aria-labelledby":"video-cap-label","aria-describedby":"video-cap-hint"}),e.jsx(z,{id:"video-cap-hint",children:"When full, the oldest passed flows' videos go first."})]})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(C,{type:"submit",size:"sm",disabled:t.formState.isSubmitting,children:t.formState.isSubmitting?"Saving…":"Save changes"})}),e.jsx(q,{errors:t.formState.errors,submitCount:t.formState.submitCount})]})})]})}const ur=O({teamName:E().trim().min(1,"Team name is required"),logo:ye(File).nullable().optional()}),pr=O({displayName:E().trim().min(1,"Display name is required"),avatar:ye(File).nullable().optional()}),fr=O({currentPassword:E().min(1,"Enter your current password"),newPassword:E().min(Oe,Be),confirmPassword:E()}).refine(a=>a.newPassword===a.confirmPassword,{message:"Passwords do not match",path:["confirmPassword"]});function _r(){var oe,ie,ne,le,de,ce,me;const{resolvedTheme:a}=Me(),i=a==="dark"?"/logo-dark.svg":"/logo.svg",{user:r}=Te(),g=(r==null?void 0:r.role)==="Admin",t=(r==null?void 0:r.role)==="Admin"||(r==null?void 0:r.role)==="Developer"||(r==null?void 0:r.role)==="QA",n=je(),p=pe({queryKey:S.settings,queryFn:He,enabled:g}),[x,m]=y.useState(null),h=x??((oe=p.data)==null?void 0:oe.logo_url)??null,u=y.useRef(null),d=R({shouldFocusError:!1,resolver:$(ur),defaultValues:{teamName:"",logo:null},values:p.data?{teamName:p.data.team_name,logo:null}:void 0,resetOptions:{keepDirtyValues:!0}});async function _(s){d.setValue("teamName",s.teamName);const o=new FormData;o.append("team_name",s.teamName),s.logo&&o.append("logo",s.logo);try{if(!(await fetch("/api/v1/settings",{method:"PATCH",credentials:"include",body:o})).ok){f.error("Failed to update workspace");return}f.success("Workspace updated"),n.invalidateQueries({queryKey:S.settings})}catch{f.error("Failed to update workspace")}}const[B,H]=y.useState(null),I=B??(r==null?void 0:r.avatarUrl)??null,Y=y.useRef(null),v=R({shouldFocusError:!1,resolver:$(pr),defaultValues:{displayName:"",avatar:null},values:r?{displayName:r.displayName??"",avatar:null}:void 0,resetOptions:{keepDirtyValues:!0}});async function Ae(s){v.setValue("displayName",s.displayName);const o=new FormData;o.append("display_name",s.displayName),s.avatar&&o.append("avatar",s.avatar);try{if(!(await fetch("/api/v1/profile",{method:"PATCH",credentials:"include",body:o})).ok){f.error("Failed to update profile");return}f.success("Profile updated"),n.invalidateQueries({queryKey:S.me})}catch{f.error("Failed to update profile")}}const c=R({shouldFocusError:!1,resolver:$(fr)});async function Fe(s){try{const o=await fetch("/api/v1/auth/change-password",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentPassword:s.currentPassword,newPassword:s.newPassword})});if(!o.ok){const l=await o.json();c.setError("root",{message:l.error??"Failed to change password"});return}c.reset(),f.success("Password changed")}catch{c.setError("root",{message:"Network error"})}}const Q=pe({queryKey:S.apps,queryFn:Ie,enabled:t}).data??[],[Z,ee]=y.useState({}),[re,se]=y.useState({}),[ae,te]=y.useState({});async function De(s){te(o=>({...o,[s]:!0}));try{if(!(await fetch(`/api/v1/apps/${s}`,{method:"DELETE",credentials:"include"})).ok){f.error("Failed to delete app");return}n.invalidateQueries({queryKey:S.apps}),f.success("App deleted")}catch{f.error("Failed to delete app")}finally{te(o=>({...o,[s]:!1}))}}async function ke(s){var o;se(l=>({...l,[s]:!0}));try{if(!(await fetch(`/api/v1/apps/${s}`,{method:"PATCH",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:Z[s]??((o=Q.find(b=>b.id===s))==null?void 0:o.name)})})).ok){f.error("Failed to update app");return}f.success("App updated"),ee(({[s]:b,...G})=>G),n.invalidateQueries({queryKey:S.apps})}catch{f.error("Failed to update app")}finally{se(l=>({...l,[s]:!1}))}}const T=Ge({control:v.control,name:"displayName"});return e.jsxs("div",{className:"flex flex-col gap-6 max-w-[900px] mx-auto w-full p-6",children:[e.jsx("h1",{className:"text-xl font-semibold tracking-display-sm",children:"Settings"}),g&&e.jsxs(F,{children:[e.jsx(D,{children:e.jsx(k,{children:"Workspace"})}),e.jsx(V,{children:e.jsxs("form",{onSubmit:d.handleSubmit(_),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(j,{htmlFor:"team-name",children:"Team name"}),e.jsx(N,{id:"team-name",placeholder:"My QA Team","aria-required":"true","aria-invalid":!!d.formState.errors.teamName,"aria-describedby":d.formState.errors.teamName?"teamName-error":void 0,...d.register("teamName")}),e.jsx(P,{id:"teamName-error",message:(ie=d.formState.errors.teamName)==null?void 0:ie.message})]}),e.jsx(fe,{}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(j,{children:["Logo ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(png · jpg, max 2MB)"})]}),e.jsx(L,{name:"logo",control:d.control,render:({field:s})=>e.jsxs("div",{className:"relative w-16 h-16",children:[e.jsx("img",{src:h??i,alt:"Workspace logo",className:"w-16 h-16 rounded-lg object-contain"}),e.jsx("button",{type:"button","aria-label":"Change logo",onClick:()=>{var o;return(o=u.current)==null?void 0:o.click()},className:"absolute bottom-0 right-0 w-6 h-6 rounded-full bg-background border border-border shadow-sm flex items-center justify-center hover:bg-accent transition-colors",children:e.jsx(he,{className:"w-3 h-3","aria-hidden":"true"})}),e.jsx("input",{ref:u,type:"file",accept:".png,.jpg,.jpeg",className:"hidden",onChange:o=>{var b;const l=(b=o.target.files)==null?void 0:b[0];if(l&&l.size>2*1024*1024){f.error("Image must be 2MB or less");return}l&&(s.onChange(l),m(URL.createObjectURL(l)))}})]})})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(C,{type:"submit",size:"sm",disabled:d.formState.isSubmitting,children:d.formState.isSubmitting?"Saving…":"Save changes"})}),e.jsx(q,{errors:d.formState.errors,submitCount:d.formState.submitCount})]})})]}),g&&p.data&&e.jsx(mr,{settings:p.data}),e.jsxs(F,{children:[e.jsx(D,{children:e.jsx(k,{children:"Profile"})}),e.jsx(V,{children:e.jsxs("form",{onSubmit:v.handleSubmit(Ae),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(j,{htmlFor:"display-name",children:"Nickname"}),e.jsx(N,{id:"display-name",placeholder:"Your name","aria-required":"true","aria-invalid":!!v.formState.errors.displayName,"aria-describedby":v.formState.errors.displayName?"displayName-error":void 0,...v.register("displayName")}),e.jsx(P,{id:"displayName-error",message:(ne=v.formState.errors.displayName)==null?void 0:ne.message})]}),e.jsx(fe,{}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(j,{children:["Avatar ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(png · jpg, max 2MB)"})]}),e.jsx(L,{name:"avatar",control:v.control,render:({field:s})=>{var o;return e.jsxs("div",{className:"relative w-14 h-14",children:[I?e.jsx("img",{src:I,alt:"Profile avatar",className:"w-14 h-14 rounded-full object-cover border"}):e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center text-lg font-medium",style:(()=>{const l=Re(T||(r==null?void 0:r.email)||"");return{backgroundColor:l.bg,color:l.fg}})(),children:((o=T==null?void 0:T[0])==null?void 0:o.toUpperCase())??"?"}),e.jsx("button",{type:"button","aria-label":"Change avatar",onClick:()=>{var l;return(l=Y.current)==null?void 0:l.click()},className:"absolute bottom-0 right-0 w-6 h-6 rounded-full bg-background border border-border shadow-sm flex items-center justify-center hover:bg-accent transition-colors",children:e.jsx(he,{className:"w-3 h-3","aria-hidden":"true"})}),e.jsx("input",{ref:Y,type:"file",accept:".png,.jpg,.jpeg",className:"hidden",onChange:l=>{var G;const b=(G=l.target.files)==null?void 0:G[0];if(b&&b.size>2*1024*1024){f.error("Image must be 2MB or less");return}b&&(s.onChange(b),H(URL.createObjectURL(b)))}})]})}})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(C,{type:"submit",size:"sm",disabled:v.formState.isSubmitting,children:v.formState.isSubmitting?"Saving…":"Save changes"})}),e.jsx(q,{errors:v.formState.errors,submitCount:v.formState.submitCount})]})})]}),e.jsxs(F,{children:[e.jsx(D,{children:e.jsx(k,{children:"Password"})}),e.jsx(V,{children:e.jsxs("form",{onSubmit:c.handleSubmit(Fe),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(j,{htmlFor:"current-password",children:"Current password"}),e.jsx(N,{id:"current-password",type:"password","aria-required":"true",autoComplete:"current-password","aria-invalid":!!c.formState.errors.currentPassword,"aria-describedby":c.formState.errors.currentPassword?"currentPassword-error":void 0,...c.register("currentPassword")}),e.jsx(P,{id:"currentPassword-error",message:(le=c.formState.errors.currentPassword)==null?void 0:le.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(j,{htmlFor:"new-password",children:"New password"}),e.jsx(N,{id:"new-password",type:"password","aria-required":"true",autoComplete:"new-password","aria-invalid":!!c.formState.errors.newPassword,"aria-describedby":$e("newPassword-hint","newPassword-error",!!c.formState.errors.newPassword),...c.register("newPassword")}),!c.formState.errors.newPassword&&e.jsx(z,{id:"newPassword-hint",children:qe}),e.jsx(P,{id:"newPassword-error",message:(de=c.formState.errors.newPassword)==null?void 0:de.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(j,{htmlFor:"confirm-password",children:"Confirm new password"}),e.jsx(N,{id:"confirm-password",type:"password","aria-required":"true",autoComplete:"new-password","aria-invalid":!!c.formState.errors.confirmPassword,"aria-describedby":c.formState.errors.confirmPassword?"confirmPassword-error":void 0,...c.register("confirmPassword")}),e.jsx(P,{id:"confirmPassword-error",message:(ce=c.formState.errors.confirmPassword)==null?void 0:ce.message})]}),e.jsx(P,{assertive:!0,id:"default-error",message:(me=c.formState.errors.root)==null?void 0:me.message}),e.jsx("div",{className:"flex justify-end",children:e.jsx(C,{type:"submit",size:"sm",disabled:c.formState.isSubmitting,children:c.formState.isSubmitting?"Saving…":"Change password"})}),e.jsx(q,{errors:c.formState.errors,submitCount:c.formState.submitCount})]})})]}),t&&Q.length>0&&e.jsxs(F,{children:[e.jsx(D,{children:e.jsx(k,{children:"Apps"})}),e.jsx(V,{children:e.jsx("div",{className:"flex flex-col divide-y divide-border",children:Q.map(s=>e.jsxs("div",{className:"flex flex-col gap-2 py-4 first:pt-0 last:pb-0",children:[e.jsx(j,{htmlFor:`app-${s.id}`,children:"App Name"}),e.jsx(N,{id:`app-${s.id}`,value:Z[s.id]??s.name,onChange:o=>ee(l=>({...l,[s.id]:o.target.value}))}),e.jsxs("div",{className:"flex flex-col gap-1.5 mt-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:s.bundle_id_key}),e.jsx(Qe,{tone:s.platform==="ios"?"ios":s.platform==="android"?"android":void 0,variant:s.platform==="both"?"secondary":void 0,children:ze[s.platform]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(C,{size:"sm",variant:"outline",disabled:re[s.id],onClick:()=>ke(s.id),children:re[s.id]?"Saving…":"Save"}),e.jsxs(Ke,{children:[e.jsx(Ue,{asChild:!0,children:e.jsx(C,{size:"sm",variant:"destructive",disabled:ae[s.id],children:ae[s.id]?"Deleting…":"Delete"})}),e.jsxs(We,{children:[e.jsxs(Xe,{children:[e.jsx(Je,{children:"Delete app?"}),e.jsxs(Ye,{children:["This will permanently delete ",e.jsx("strong",{children:s.name})," and all its builds. This action cannot be undone."]})]}),e.jsxs(Ze,{children:[e.jsx(er,{className:"w-24",children:"Cancel"}),e.jsx(rr,{className:be(Le({variant:"destructive"}),"w-24"),onClick:()=>De(s.id),children:"Delete"})]})]})]})]})]})]},s.id))})})]})]})}export{_r as DefaultSettings};
@@ -1 +1 @@
1
- import{r as F,j as e}from"./vendor-react-DTSdA8m-.js";import{u as M,a as W,l as K,b as Q,c as U,C as T,d as R,e as q,m as E,f as G,L as m,I as h,n as Y,p as z,F as u,S as V,g as J,P as X,B as Z,h as $,q as I,o as ee,s as v,i as ae,j as se,_ as re,v as te}from"./index-cgl1yEKu.js";import{F as ie}from"./field-hint-B774BIWK.js";import{a as ne,c as oe,L as le}from"./vendor-router-B1pQim9Z.js";import{P as de}from"./pencil-1XSs32nb.js";const ce=ee({displayName:v().optional(),avatar:re(File).nullable().optional(),password:v().min(ae,se),confirm:v()}).refine(o=>o.password===o.confirm,{message:"Passwords do not match",path:["confirm"]});function ve(){var b,N,C,S,k,P;const o=ne(),[O]=oe(),i=O.get("token")??"",[x,_]=F.useState(null),g=F.useRef(null),{register:p,handleSubmit:A,control:j,setError:l,formState:{errors:a,isSubmitting:y,submitCount:L}}=M({shouldFocusError:!1,resolver:W(ce),defaultValues:{displayName:"",avatar:null}}),d=K({control:j,name:"displayName"})??"",B=Q(),f=U({queryKey:I.inviteToken(i),queryFn:()=>te(i),enabled:i!=="",staleTime:1/0}),w=!i||f.isError?"invalid":f.isPending?"loading":"valid",D=((b=f.data)==null?void 0:b.role)??"";async function H(t){var n;try{const s=new FormData;s.append("token",i),s.append("password",t.password),(n=t.displayName)!=null&&n.trim()&&s.append("display_name",t.displayName.trim()),t.avatar&&s.append("avatar",t.avatar);const r=await fetch("/api/v1/invitations/accept",{method:"POST",body:s});if(r.status===409){l("root",{type:"already-member",message:"This email already has an account. Sign in instead, or ask your admin for a password reset link."});return}if(!r.ok){const c=await r.json().catch(()=>({}));l("root",{message:c.error??"Failed to accept invitation"});return}B.removeQueries({queryKey:I.inviteToken(i)}),o("/app-center",{replace:!0})}catch{l("root",{message:"Network error. Please try again."})}}return w==="loading"?e.jsx("div",{className:"flex min-h-svh items-center justify-center"}):w==="invalid"?e.jsx("div",{className:"flex min-h-svh items-center justify-center overflow-hidden p-4",children:e.jsx(T,{level:4,className:"w-full max-w-sm text-center",children:e.jsxs(R,{children:[e.jsx(q,{children:"Invitation expired"}),e.jsx(E,{children:"This invite link is invalid or has expired. Ask your admin for a new one."})]})})}):e.jsx("div",{className:"flex min-h-svh items-center justify-center overflow-hidden p-4",children:e.jsxs(T,{level:4,className:"w-full max-w-sm",children:[e.jsxs(R,{className:"text-center",children:[e.jsx(q,{children:"Set up your account"}),e.jsxs(E,{children:["You're joining as ",e.jsx("strong",{children:D})]})]}),e.jsx(G,{children:e.jsxs("form",{onSubmit:A(H),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(m,{htmlFor:"display-name",children:["Nickname ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),e.jsx(h,{id:"display-name",placeholder:"Your name",...p("displayName")})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(m,{children:["Avatar ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional, png · jpg, max 2MB)"})]}),e.jsx(Y,{name:"avatar",control:j,render:({field:t})=>{var n;return e.jsxs("div",{className:"relative w-14 h-14",children:[x?e.jsx("img",{src:x,alt:"Avatar preview",className:"w-14 h-14 rounded-full object-cover border"}):e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center text-lg font-medium",style:(()=>{const s=z(d);return{backgroundColor:s.bg,color:s.fg}})(),children:((n=d==null?void 0:d[0])==null?void 0:n.toUpperCase())??"?"}),e.jsx("button",{type:"button","aria-label":a.avatar?"Change avatar — the file was rejected":"Change avatar","aria-describedby":a.avatar?"avatar-error":void 0,onClick:()=>{var s;return(s=g.current)==null?void 0:s.click()},className:"absolute bottom-0 right-0 w-6 h-6 rounded-full bg-background border border-border shadow-sm flex items-center justify-center hover:bg-accent transition-colors",children:e.jsx(de,{className:"w-3 h-3","aria-hidden":"true"})}),e.jsx("input",{ref:g,type:"file",accept:"image/png,image/jpeg",className:"hidden",onChange:s=>{var c;const r=(c=s.target.files)==null?void 0:c[0];if(r){if(r.size>2*1024*1024){l("avatar",{message:"Max 2MB for avatar"});return}t.onChange(r),_(URL.createObjectURL(r))}}})]})}}),e.jsx(u,{assertive:!0,id:"avatar-error",message:(N=a.avatar)==null?void 0:N.message})]}),e.jsx(V,{}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"password",children:"Password"}),e.jsx(h,{id:"password",type:"password","aria-required":"true",autoComplete:"new-password","aria-invalid":!!a.password,"aria-describedby":J("password-hint","password-error",!!a.password),...p("password")}),!a.password&&e.jsx(ie,{id:"password-hint",children:X}),e.jsx(u,{id:"password-error",message:(C=a.password)==null?void 0:C.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"confirm",children:"Confirm password"}),e.jsx(h,{id:"confirm",type:"password","aria-required":"true",autoComplete:"new-password","aria-invalid":!!a.confirm,"aria-describedby":a.confirm?"confirm-error":void 0,...p("confirm")}),e.jsx(u,{id:"confirm-error",message:(S=a.confirm)==null?void 0:S.message})]}),e.jsx(u,{assertive:!0,id:"invite-error",message:(k=a.root)==null?void 0:k.message}),((P=a.root)==null?void 0:P.type)==="already-member"&&e.jsx(le,{to:"/login",className:"text-sm text-center underline underline-offset-4",children:"Go to sign in"}),e.jsx(Z,{type:"submit",disabled:y,className:"w-full",children:y?"Creating account…":"Create account"}),e.jsx($,{errors:a,submitCount:L})]})})]})})}export{ve as Invite};
1
+ import{r as F,j as e}from"./vendor-react-DTSdA8m-.js";import{u as M,a as W,l as K,b as Q,c as U,C as T,d as R,e as q,m as E,f as G,L as m,I as h,n as Y,p as z,F as u,S as V,g as J,P as X,B as Z,h as $,q as I,o as ee,s as v,i as ae,j as se,_ as re,v as te}from"./index-C_3Q51YJ.js";import{F as ie}from"./field-hint-qmBa0qqN.js";import{a as ne,c as oe,L as le}from"./vendor-router-B1pQim9Z.js";import{P as de}from"./pencil-DUZRZB3S.js";const ce=ee({displayName:v().optional(),avatar:re(File).nullable().optional(),password:v().min(ae,se),confirm:v()}).refine(o=>o.password===o.confirm,{message:"Passwords do not match",path:["confirm"]});function ve(){var b,N,C,S,k,P;const o=ne(),[O]=oe(),i=O.get("token")??"",[x,_]=F.useState(null),g=F.useRef(null),{register:p,handleSubmit:A,control:j,setError:l,formState:{errors:a,isSubmitting:y,submitCount:L}}=M({shouldFocusError:!1,resolver:W(ce),defaultValues:{displayName:"",avatar:null}}),d=K({control:j,name:"displayName"})??"",B=Q(),f=U({queryKey:I.inviteToken(i),queryFn:()=>te(i),enabled:i!=="",staleTime:1/0}),w=!i||f.isError?"invalid":f.isPending?"loading":"valid",D=((b=f.data)==null?void 0:b.role)??"";async function H(t){var n;try{const s=new FormData;s.append("token",i),s.append("password",t.password),(n=t.displayName)!=null&&n.trim()&&s.append("display_name",t.displayName.trim()),t.avatar&&s.append("avatar",t.avatar);const r=await fetch("/api/v1/invitations/accept",{method:"POST",body:s});if(r.status===409){l("root",{type:"already-member",message:"This email already has an account. Sign in instead, or ask your admin for a password reset link."});return}if(!r.ok){const c=await r.json().catch(()=>({}));l("root",{message:c.error??"Failed to accept invitation"});return}B.removeQueries({queryKey:I.inviteToken(i)}),o("/app-center",{replace:!0})}catch{l("root",{message:"Network error. Please try again."})}}return w==="loading"?e.jsx("div",{className:"flex min-h-svh items-center justify-center"}):w==="invalid"?e.jsx("div",{className:"flex min-h-svh items-center justify-center overflow-hidden p-4",children:e.jsx(T,{level:4,className:"w-full max-w-sm text-center",children:e.jsxs(R,{children:[e.jsx(q,{children:"Invitation expired"}),e.jsx(E,{children:"This invite link is invalid or has expired. Ask your admin for a new one."})]})})}):e.jsx("div",{className:"flex min-h-svh items-center justify-center overflow-hidden p-4",children:e.jsxs(T,{level:4,className:"w-full max-w-sm",children:[e.jsxs(R,{className:"text-center",children:[e.jsx(q,{children:"Set up your account"}),e.jsxs(E,{children:["You're joining as ",e.jsx("strong",{children:D})]})]}),e.jsx(G,{children:e.jsxs("form",{onSubmit:A(H),className:"flex flex-col gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(m,{htmlFor:"display-name",children:["Nickname ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),e.jsx(h,{id:"display-name",placeholder:"Your name",...p("displayName")})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(m,{children:["Avatar ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional, png · jpg, max 2MB)"})]}),e.jsx(Y,{name:"avatar",control:j,render:({field:t})=>{var n;return e.jsxs("div",{className:"relative w-14 h-14",children:[x?e.jsx("img",{src:x,alt:"Avatar preview",className:"w-14 h-14 rounded-full object-cover border"}):e.jsx("div",{className:"w-14 h-14 rounded-full flex items-center justify-center text-lg font-medium",style:(()=>{const s=z(d);return{backgroundColor:s.bg,color:s.fg}})(),children:((n=d==null?void 0:d[0])==null?void 0:n.toUpperCase())??"?"}),e.jsx("button",{type:"button","aria-label":a.avatar?"Change avatar — the file was rejected":"Change avatar","aria-describedby":a.avatar?"avatar-error":void 0,onClick:()=>{var s;return(s=g.current)==null?void 0:s.click()},className:"absolute bottom-0 right-0 w-6 h-6 rounded-full bg-background border border-border shadow-sm flex items-center justify-center hover:bg-accent transition-colors",children:e.jsx(de,{className:"w-3 h-3","aria-hidden":"true"})}),e.jsx("input",{ref:g,type:"file",accept:"image/png,image/jpeg",className:"hidden",onChange:s=>{var c;const r=(c=s.target.files)==null?void 0:c[0];if(r){if(r.size>2*1024*1024){l("avatar",{message:"Max 2MB for avatar"});return}t.onChange(r),_(URL.createObjectURL(r))}}})]})}}),e.jsx(u,{assertive:!0,id:"avatar-error",message:(N=a.avatar)==null?void 0:N.message})]}),e.jsx(V,{}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"password",children:"Password"}),e.jsx(h,{id:"password",type:"password","aria-required":"true",autoComplete:"new-password","aria-invalid":!!a.password,"aria-describedby":J("password-hint","password-error",!!a.password),...p("password")}),!a.password&&e.jsx(ie,{id:"password-hint",children:X}),e.jsx(u,{id:"password-error",message:(C=a.password)==null?void 0:C.message})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(m,{htmlFor:"confirm",children:"Confirm password"}),e.jsx(h,{id:"confirm",type:"password","aria-required":"true",autoComplete:"new-password","aria-invalid":!!a.confirm,"aria-describedby":a.confirm?"confirm-error":void 0,...p("confirm")}),e.jsx(u,{id:"confirm-error",message:(S=a.confirm)==null?void 0:S.message})]}),e.jsx(u,{assertive:!0,id:"invite-error",message:(k=a.root)==null?void 0:k.message}),((P=a.root)==null?void 0:P.type)==="already-member"&&e.jsx(le,{to:"/login",className:"text-sm text-center underline underline-offset-4",children:"Go to sign in"}),e.jsx(Z,{type:"submit",disabled:y,className:"w-full",children:y?"Creating account…":"Create account"}),e.jsx($,{errors:a,submitCount:L})]})})]})})}export{ve as Invite};
@@ -1 +1 @@
1
- import{r as M,c as He,j as s}from"./vendor-react-DTSdA8m-.js";import{aj as Tt,c as bt,b as Ot,aw as Rt,ax as Ct,q as Xe,ay as Dt,Q as xt}from"./index-cgl1yEKu.js";import{u as It}from"./useRelay-CES3I1Mt.js";import{u as Pt,S as Kt}from"./useShownAfter-By1Yxysz.js";import{c as Ft,a as Ht,T as Ut}from"./tabs-CmgV_sSI.js";import{R as Bt}from"./resource-health-oWJ8hy9X.js";import{t as qt,a as wt,b as Gt,c as Qt,d as Wt,e as At,l as Xt,P as Vt,L as Yt,G as zt,A as Jt,m as St,f as Zt,g as es,h as ts,i as ss,B as ns,j as ls}from"./vendor-charts-BE7R_8yA.js";import"./vendor-router-B1pQim9Z.js";const os=t=>(document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t));function as(){return M.useSyncExternalStore(os,is,rs)}function rs(){return!0}function is(){return document.visibilityState!=="hidden"}function cs(t,e){const o=He.c(4),[m,g]=M.useState(ds);let i,n;return o[0]!==e||o[1]!==t?(i=()=>{if(!e)return;g(Date.now());const h=setInterval(()=>g(Date.now()),t);return()=>clearInterval(h)},n=[t,e],o[0]=e,o[1]=t,o[2]=i,o[3]=n):(i=o[2],n=o[3]),M.useEffect(i,n),m}function ds(){return Date.now()}const pt={"1h":36e5,"6h":216e5,"24h":864e5,"7d":6048e5},us={"1h":Gt.every(10),"6h":wt,"24h":wt.every(3),"7d":qt};function fs(t,e,o){return us[o].range(new Date(t),new Date(e+1))}function ms(t,e){const o=new Date(t);return e==="7d"?`${o.getMonth()+1}/${o.getDate()}`:`${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}`}const hs=2e3;function xs(t){return Math.min(1e4,Math.max(1e3,pt[t]/hs))}const ps={"1h":6e4,"6h":6e4,"24h":3e5,"7d":9e5},gt=t=>Math.round(t*10)/10;function gs(t,e,o){let m;for(const i of t){const n=i.agentName===e?i.resources:void 0;n&&(!m||n.reportedAt>m.reportedAt)&&(m=n)}if(!m||o-m.reportedAt>Bt)return null;const g=i=>Number.isFinite(i)?gt(i):null;return{cpu:g(m.cpuPercent),mem:g(m.memUsedMB/m.memTotalMB*100)}}const Et={cpu:{label:"CPU",color:"#60a5fa"},mem:{label:"RAM",color:"#a78bfa"}},Lt={"1h":"1h","6h":"6h","24h":"24h","7d":"7d"};function Is(){const t=He.c(66);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[o,m]=M.useState(e),[g,i]=M.useState(null),[n,h]=M.useState("24h"),R=as();let S;t[1]!==n?(S=xs(n),t[1]=n,t[2]=S):S=t[2];const x=cs(S,R),{setNode:v}=Tt();let p,j;t[3]!==v?(p=()=>(v(s.jsx("span",{className:"text-sm font-medium",children:"Mac Resources"})),()=>v(null)),j=[v],t[3]=v,t[4]=p,t[5]=j):(p=t[4],j=t[5]),M.useEffect(p,j);let C;t[6]===Symbol.for("react.memo_cache_sentinel")?(C=u=>{u.type==="agents:listed"&&m(u.sessions??[])},t[6]=C):C=t[6];const X=C,{send:A,connected:E}=It(X);let ce,de;t[7]!==E||t[8]!==A?(ce=()=>{if(!E)return;A({type:"agents:list"});const u=setInterval(()=>A({type:"agents:list"}),1e4);return()=>clearInterval(u)},de=[E,A],t[7]=E,t[8]=A,t[9]=ce,t[10]=de):(ce=t[9],de=t[10]),M.useEffect(ce,de);let se;t[11]===Symbol.for("react.memo_cache_sentinel")?(se={queryKey:Xe.agents,queryFn:Ct,refetchOnWindowFocus:!1},t[11]=se):se=t[11];const V=bt(se);let d,f,B,ne;t[12]!==V.data||t[13]!==o?(B=V.data??[],f=o.map(js).filter(Boolean),d=[...new Set([...f,...B])],ne=new Set(f),t[12]=V.data,t[13]=o,t[14]=d,t[15]=f,t[16]=B,t[17]=ne):(d=t[14],f=t[15],B=t[16],ne=t[17]);const b=ne,l=g??(V.isPending?null:B[0]??f[0]??null),q=Ot();let ee;t[18]!==n||t[19]!==l?(ee=l?Xe.resourceHistory(l,n):null,t[18]=n,t[19]=l,t[20]=ee):ee=t[20];const te=ee;let D;t[21]!==te||t[22]!==n?(D=te??Xe.resourceHistory("",n),t[21]=te,t[22]=n,t[23]=D):D=t[23];let G;t[24]!==n||t[25]!==l?(G=u=>{const{signal:T}=u;return Dt(l,n,T)},t[24]=n,t[25]=l,t[26]=G):G=t[26];let Y;t[27]!==D||t[28]!==G?(Y={queryKey:D,queryFn:G,enabled:!1},t[27]=D,t[28]=G,t[29]=Y):Y=t[29];const I=bt(Y),Q=I.refetch;let P,z;t[30]!==q||t[31]!==n||t[32]!==Q||t[33]!==l||t[34]!==R?(P=()=>{if(!l||!R)return;const u=Xe.resourceHistory(l,n),T=ps[n],N=()=>{const H=q.getQueryState(u);(H==null?void 0:H.fetchStatus)==="fetching"&&H.data===void 0?q.cancelQueries({queryKey:u,exact:!0}).then(()=>Q()):Q({cancelRefetch:!0})},k=q.getQueryState(u),ae=Math.max((k==null?void 0:k.dataUpdatedAt)??0,(k==null?void 0:k.errorUpdatedAt)??0),re=(k==null?void 0:k.data)!==void 0&&ae>0?Math.max(0,T-(Date.now()-ae)):0;let ie;const Ue=()=>{N(),ie=setInterval(N,T)},Fe=re>0?setTimeout(Ue,re):void 0;return re===0&&Ue(),()=>{clearTimeout(Fe),clearInterval(ie),q.cancelQueries({queryKey:u,exact:!0})}},z=[l,n,R,Q,q],t[30]=q,t[31]=n,t[32]=Q,t[33]=l,t[34]=R,t[35]=P,t[36]=z):(P=t[35],z=t[36]),M.useEffect(P,z);const w=I.data!==void 0||I.isError,J=te!==null&&!w,c=Pt(J,Kt);let K;t[37]!==I.data?(K=I.data??[],t[37]=I.data,t[38]=K):K=t[38];let Z;t[39]!==K?(Z=K.map(vs),t[39]=K,t[40]=Z):Z=t[40];const W=Z;let le;t[41]!==x||t[42]!==l||t[43]!==o?(le=l?gs(o,l,x):null,t[41]=x,t[42]=l,t[43]=o,t[44]=le):le=t[44];const r=le;let y;t[45]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("h1",{className:"sr-only",children:"Mac Resources"}),t[45]=y):y=t[45];let L;t[46]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("h2",{id:"macs-heading",className:"px-2 pb-1 font-mono text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Macs"}),t[46]=L):L=t[46];let _;t[47]!==d||t[48]!==E||t[49]!==b||t[50]!==l?(_=d.length===0?s.jsx("span",{className:"px-2 text-sm text-muted-foreground",children:E?"No agents yet.":"Connecting…"}):d.map(u=>{const T=b.has(u),N=l===u;return s.jsxs("button",{onClick:()=>i(u),"aria-current":N?"true":void 0,className:["flex items-center gap-2 rounded-md px-2 py-2 text-left text-sm hover:bg-accent transition-colors",N?"bg-accent font-medium":""].join(" "),children:[s.jsx("span",{className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full ${T?"bg-emerald-400":"bg-muted-foreground/40"}`,"aria-hidden":"true"}),s.jsx("span",{className:"truncate min-w-0",children:u}),s.jsx("span",{className:"sr-only",children:T?"Online":"Offline"})]},u)}),t[47]=d,t[48]=E,t[49]=b,t[50]=l,t[51]=_):_=t[51];let $;t[52]!==_?($=s.jsxs("aside",{"aria-labelledby":"macs-heading",className:"w-64 shrink-0 border-r flex flex-col gap-1 p-3 overflow-y-auto",children:[L,_]}),t[52]=_,t[53]=$):$=t[53];let F;t[54]!==W||t[55]!==(r==null?void 0:r.cpu)||t[56]!==(r==null?void 0:r.mem)||t[57]!==J||t[58]!==x||t[59]!==n||t[60]!==l||t[61]!==c?(F=s.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:l?s.jsxs("div",{className:"flex flex-col gap-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h2",{className:"text-base font-semibold",children:l}),s.jsx(Ft,{value:n,onValueChange:u=>h(u),children:s.jsx(Ht,{children:Object.keys(Lt).map(ys)})})]}),J?s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx("p",{className:"sr-only",children:"Loading…"}),s.jsxs("div",{className:c?"flex flex-col gap-6":"flex flex-col gap-6 invisible",children:[s.jsx(_t,{}),s.jsx(_t,{})]})]}):W.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-sm text-muted-foreground",children:"No data yet for this range. Data is collected every minute while the agent is connected."}):s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx($t,{title:"CPU %",color:"cpu",data:W,dataKey:"cpu",range:n,now:x,live:(r==null?void 0:r.cpu)??null}),s.jsx($t,{title:"RAM %",color:"mem",data:W,dataKey:"mem",range:n,now:x,live:(r==null?void 0:r.mem)??null})]})]}):s.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-muted-foreground",children:[s.jsx(Rt,{className:"h-8 w-8"}),s.jsx("p",{className:"text-sm",children:"Select a Mac to view resource history."})]})}),t[54]=W,t[55]=r==null?void 0:r.cpu,t[56]=r==null?void 0:r.mem,t[57]=J,t[58]=x,t[59]=n,t[60]=l,t[61]=c,t[62]=F):F=t[62];let oe;return t[63]!==$||t[64]!==F?(oe=s.jsxs("div",{className:"flex h-full min-h-0",children:[y,$,F]}),t[63]=$,t[64]=F,t[65]=oe):oe=t[65],oe}function ys(t){return s.jsx(Ut,{value:t,children:Lt[t]},t)}function vs(t){return{time:t.recorded_at,cpu:gt(t.cpu_percent),mem:gt(t.mem_percent)}}function js(t){return t.agentName}const yt=t=>new Date(t.time).getTime(),Nt=t=>new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),Ve=t=>`${Math.round(t*10)/10}%`,bs=At(yt).left,ws=At(t=>t.t).left,U={top:8,right:24,bottom:24,left:40},kt=16,Mt=6,Ss=20,Ns=40;function _t(){const t=He.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"rounded-lg border p-4 flex flex-col gap-3","aria-hidden":!0,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xt,{className:"h-2.5 w-2.5 rounded-full"}),s.jsx(xt,{className:"h-5 w-12"})]}),s.jsx(xt,{className:"h-[220px] w-full"})]}),t[0]=e):e=t[0],e}function $t(t){const e=He.c(18),{title:o,color:m,data:g,dataKey:i,range:n,now:h,live:R}=t,S=Et[m].color;let x;e[0]!==S?(x=s.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full",style:{background:S}}),e[0]=S,e[1]=x):x=e[1];let v;e[2]!==o?(v=s.jsx("h2",{className:"text-sm font-medium",children:o}),e[2]=o,e[3]=v):v=e[3];let p;e[4]!==x||e[5]!==v?(p=s.jsxs("div",{className:"flex items-center gap-2",children:[x,v]}),e[4]=x,e[5]=v,e[6]=p):p=e[6];let j;e[7]!==g||e[8]!==i||e[9]!==S||e[10]!==R||e[11]!==h||e[12]!==n||e[13]!==o?(j=s.jsx("div",{className:"relative h-[220px] w-full",children:s.jsx(Vt,{children:X=>{const{width:A,height:E}=X;return A>0&&E>0?s.jsx(ks,{width:A,height:E,data:g,dataKey:i,hex:S,range:n,now:h,live:R,label:o}):null}})}),e[7]=g,e[8]=i,e[9]=S,e[10]=R,e[11]=h,e[12]=n,e[13]=o,e[14]=j):j=e[14];let C;return e[15]!==p||e[16]!==j?(C=s.jsxs("div",{className:"rounded-lg border p-4 flex flex-col gap-3",children:[p,j]}),e[15]=p,e[16]=j,e[17]=C):C=e[17],C}function ks(t){const e=He.c(139),{width:o,height:m,data:g,dataKey:i,hex:n,range:h,now:R,live:S,label:x}=t,v=S===void 0?null:S,p=`chart-hint-${i}`,[j,C]=M.useState(null),[X,A]=M.useState(!1),[E,ce]=M.useState(null),[de,se]=M.useState(!1),V=de?E:null,d=o-U.left-U.right,f=m-U.top-U.bottom,B=R,ne=B-pt[h],b=Qt({domain:[ne,B],range:[0,Math.max(0,d)]}),l=Wt({domain:[0,100],range:[f,kt]}),q=d>0?Ss/d*pt[h]:0,ee=ne-q,te=B+q;let D;e[0]!==h||e[1]!==ee||e[2]!==te?(D=fs(ee,te,h),e[0]=h,e[1]=ee,e[2]=te,e[3]=D):D=e[3];const G=D,Y=d>0?Math.min(.5,Ns/d):0,I=`fill-${i}`,Q=`plot-${i}`,P=`axis-fade-${i}`,z=g[g.length-1],w=v!==null&&z?{t:Math.max(B,yt(z)+1),v,live:!0}:null;let J;e[4]!==i?(J=a=>({t:yt(a),v:a[i]}),e[4]=i,e[5]=J):J=e[5];const c=g.map(J);w&&c.push(w);const K=a=>Math.min(b(a),d),Z=w?K(w.t):0,W=w?l(w.v):0,le=Math.max(0,g.length-1),r=j===null?Math.max(0,c.length-1):j==="live"?w?c.length-1:le:Math.min(bs(g,j),le),y=X?c[r]:void 0,L=y?K(y.t):0,_=y?l(y.v):0,$=Et[i].label;let F;e[6]!==$?(F=a=>`${$}, ${Nt(a.t)}, ${a.live?"latest, ":""}${Ve(a.v)}`,e[6]=$,e[7]=F):F=e[7];const oe=F,u=a=>{const O=c[a];O&&(C(O.live?"live":O.t),A(!0),ce({now:a,text:oe(O)}))};let T;e[8]===Symbol.for("react.memo_cache_sentinel")?(T=()=>A(!1),e[8]=T):T=e[8];const N=T;let k,ae;e[9]!==X?(k=()=>{if(!X)return;const a=O=>{O.key==="Escape"&&A(!1)};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},ae=[X],e[9]=X,e[10]=k,e[11]=ae):(k=e[10],ae=e[11]),M.useEffect(k,ae);const re=a=>{if(c.length===0)return;const O=r,Ke=a.key==="ArrowLeft"||a.key==="ArrowDown"?Math.max(0,O-1):a.key==="ArrowRight"||a.key==="ArrowUp"?Math.min(c.length-1,O+1):a.key==="Home"?0:a.key==="End"?c.length-1:null;Ke!==null&&(a.preventDefault(),u(Ke))},ie=a=>{const O=Xt(a);if(!O)return;const Ke=O.x-U.left,vt=ws(c,b.invert(Ke).getTime()),jt=[c[vt-1],c[vt],w].reduce((mt,ht)=>ht&&(!mt||Math.abs(K(ht.t)-Ke)<=Math.abs(K(mt.t)-Ke))?ht:mt,void 0);jt&&u(c.indexOf(jt))},Ue="group",Fe=w?`${x}, last ${h}. Now ${Ve(w.v)}.`:z?`${x}, last ${h}. Latest ${Ve(z[i])}.`:`${x}, last ${h}. No samples.`;let H;e[12]!==I||e[13]!==n?(H=s.jsx(Yt,{id:I,from:n,to:n,fromOpacity:.3,toOpacity:0,fromOffset:"5%",toOffset:"95%"}),e[12]=I,e[13]=n,e[14]=H):H=e[14];const Ye=Math.max(0,d),ze=Math.max(0,f);let ue;e[15]!==Ye||e[16]!==ze?(ue=s.jsx("rect",{x:0,y:0,width:Ye,height:ze}),e[15]=Ye,e[16]=ze,e[17]=ue):ue=e[17];let fe;e[18]!==Q||e[19]!==ue?(fe=s.jsx("clipPath",{id:Q,children:ue}),e[18]=Q,e[19]=ue,e[20]=fe):fe=e[20];const Je=`${P}-grad`,Ze=Math.max(0,d);let Be;e[21]===Symbol.for("react.memo_cache_sentinel")?(Be=s.jsx("stop",{offset:0,stopColor:"white",stopOpacity:0}),e[21]=Be):Be=e[21];let me;e[22]!==Y?(me=s.jsx("stop",{offset:Y,stopColor:"white",stopOpacity:1}),e[22]=Y,e[23]=me):me=e[23];const et=1-Y;let he;e[24]!==et?(he=s.jsx("stop",{offset:et,stopColor:"white",stopOpacity:1}),e[24]=et,e[25]=he):he=e[25];let qe;e[26]===Symbol.for("react.memo_cache_sentinel")?(qe=s.jsx("stop",{offset:1,stopColor:"white",stopOpacity:0}),e[26]=qe):qe=e[26];let xe;e[27]!==Je||e[28]!==Ze||e[29]!==me||e[30]!==he?(xe=s.jsxs("linearGradient",{id:Je,gradientUnits:"userSpaceOnUse",x1:0,y1:0,x2:Ze,y2:0,children:[Be,me,he,qe]}),e[27]=Je,e[28]=Ze,e[29]=me,e[30]=he,e[31]=xe):xe=e[31];const tt=Math.max(0,d),st=Math.max(0,d),nt=`url(#${P}-grad)`;let pe;e[32]!==f||e[33]!==st||e[34]!==nt?(pe=s.jsx("rect",{x:0,y:f,width:st,height:U.bottom*2,fill:nt}),e[32]=f,e[33]=st,e[34]=nt,e[35]=pe):pe=e[35];let ge;e[36]!==P||e[37]!==f||e[38]!==tt||e[39]!==pe?(ge=s.jsx("mask",{id:P,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse",x:0,y:f,width:tt,height:U.bottom*2,children:pe}),e[36]=P,e[37]=f,e[38]=tt,e[39]=pe,e[40]=ge):ge=e[40];let Ge;e[41]===Symbol.for("react.memo_cache_sentinel")?(Ge=[0,25,50,75,100],e[41]=Ge):Ge=e[41];let ye;e[42]!==d||e[43]!==l?(ye=s.jsx(zt,{scale:l,width:d,tickValues:Ge,strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),e[42]=d,e[43]=l,e[44]=ye):ye=e[44];const lt=`url(#${Q})`;let ve;e[45]!==b?(ve=a=>b(a.t),e[45]=b,e[46]=ve):ve=e[46];let je;e[47]!==l?(je=a=>l(a.v),e[47]=l,e[48]=je):je=e[48];const ot=`url(#${I})`;let be;e[49]!==c||e[50]!==ve||e[51]!==je||e[52]!==ot||e[53]!==l?(be=s.jsx(Jt,{data:c,x:ve,y:je,yScale:l,curve:St,fill:ot}),e[49]=c,e[50]=ve,e[51]=je,e[52]=ot,e[53]=l,e[54]=be):be=e[54];let we;e[55]!==b?(we=a=>b(a.t),e[55]=b,e[56]=we):we=e[56];let Se;e[57]!==l?(Se=a=>l(a.v),e[57]=l,e[58]=Se):Se=e[58];let Ne;e[59]!==n||e[60]!==c||e[61]!==we||e[62]!==Se?(Ne=s.jsx(Zt,{data:c,x:we,y:Se,curve:St,stroke:n,strokeWidth:1.5}),e[59]=n,e[60]=c,e[61]=we,e[62]=Se,e[63]=Ne):Ne=e[63];let ke;e[64]!==lt||e[65]!==be||e[66]!==Ne?(ke=s.jsxs("g",{clipPath:lt,children:[be,Ne]}),e[64]=lt,e[65]=be,e[66]=Ne,e[67]=ke):ke=e[67];const at=`url(#${P})`;let Me;e[68]!==h?(Me=a=>ms(+a,h),e[68]=h,e[69]=Me):Me=e[69];let _e;e[70]!==f||e[71]!==Me||e[72]!==G||e[73]!==b?(_e=s.jsx(es,{top:f,scale:b,tickValues:G,tickFormat:Me,hideAxisLine:!0,hideTicks:!0,tickLength:0,tickLabelProps:$s}),e[70]=f,e[71]=Me,e[72]=G,e[73]=b,e[74]=_e):_e=e[74];let $e;e[75]!==at||e[76]!==_e?($e=s.jsx("g",{mask:at,children:_e}),e[75]=at,e[76]=_e,e[77]=$e):$e=e[77];let Qe;e[78]===Symbol.for("react.memo_cache_sentinel")?(Qe=[0,25,50,75,100],e[78]=Qe):Qe=e[78];let Ae;e[79]!==l?(Ae=s.jsx(ts,{scale:l,tickValues:Qe,tickFormat:_s,hideAxisLine:!0,hideTicks:!0,tickLabelProps:Ms}),e[79]=l,e[80]=Ae):Ae=e[80];let Ee;e[81]!==Z||e[82]!==W||e[83]!==n||e[84]!==w?(Ee=w&&s.jsxs("g",{className:"live-head","aria-hidden":"true",pointerEvents:"none",children:[s.jsx("circle",{cx:Z,cy:W,r:Mt,fill:n,fillOpacity:.2}),s.jsx("circle",{cx:Z,cy:W,r:3,fill:n,stroke:"hsl(var(--background))",strokeWidth:1.5})]}),e[81]=Z,e[82]=W,e[83]=n,e[84]=w,e[85]=Ee):Ee=e[85];let Le;e[86]!==n||e[87]!==f||e[88]!==y||e[89]!==L||e[90]!==_?(Le=y&&s.jsxs("g",{style:{transition:"transform 0.25s ease-out",transform:`translateX(${L}px)`},pointerEvents:"none",children:[s.jsx(ss,{from:{x:0,y:kt},to:{x:0,y:f},stroke:"hsl(var(--border))",strokeWidth:1}),s.jsx("circle",{cx:0,cy:0,r:3,fill:n,stroke:"hsl(var(--background))",strokeWidth:1.5,style:{transition:"transform 0.25s ease-out",transform:`translateY(${_}px)`}})]}),e[86]=n,e[87]=f,e[88]=y,e[89]=L,e[90]=_,e[91]=Le):Le=e[91];const rt=Math.max(0,d)+Mt,it=Math.max(0,f),ct=`${x} samples`,dt=Math.max(0,c.length-1),ut=V?Math.min(V.now,Math.max(0,c.length-1)):r,ft=V?V.text:c[r]?oe(c[r]):void 0;let Te;e[92]!==r||e[93]!==u?(Te=()=>{se(!0),u(r)},e[92]=r,e[93]=u,e[94]=Te):Te=e[94];let Oe;e[95]!==N?(Oe=()=>{N(),se(!1)},e[95]=N,e[96]=Oe):Oe=e[96];let Re;e[97]!==re||e[98]!==ie||e[99]!==N||e[100]!==p||e[101]!==rt||e[102]!==it||e[103]!==ct||e[104]!==dt||e[105]!==ut||e[106]!==ft||e[107]!==Te||e[108]!==Oe?(Re=s.jsx(ns,{x:0,y:0,width:rt,height:it,fill:"transparent",tabIndex:0,role:"slider","aria-label":ct,"aria-valuemin":0,"aria-valuemax":dt,"aria-valuenow":ut,"aria-valuetext":ft,"aria-describedby":p,className:"outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",onFocus:Te,onBlur:Oe,onKeyDown:re,onMouseMove:ie,onMouseLeave:N,onTouchMove:ie,onTouchEnd:N,onTouchCancel:N}),e[97]=re,e[98]=ie,e[99]=N,e[100]=p,e[101]=rt,e[102]=it,e[103]=ct,e[104]=dt,e[105]=ut,e[106]=ft,e[107]=Te,e[108]=Oe,e[109]=Re):Re=e[109];let Ce;e[110]!==ye||e[111]!==ke||e[112]!==$e||e[113]!==Ae||e[114]!==Ee||e[115]!==Le||e[116]!==Re?(Ce=s.jsxs(ls,{left:U.left,top:U.top,children:[ye,ke,$e,Ae,Ee,Le,Re]}),e[110]=ye,e[111]=ke,e[112]=$e,e[113]=Ae,e[114]=Ee,e[115]=Le,e[116]=Re,e[117]=Ce):Ce=e[117];let De;e[118]!==m||e[119]!==Fe||e[120]!==H||e[121]!==fe||e[122]!==xe||e[123]!==ge||e[124]!==Ce||e[125]!==o?(De=s.jsxs("svg",{width:o,height:m,role:Ue,"aria-label":Fe,children:[H,fe,xe,ge,Ce]}),e[118]=m,e[119]=Fe,e[120]=H,e[121]=fe,e[122]=xe,e[123]=ge,e[124]=Ce,e[125]=o,e[126]=De):De=e[126];let Ie;e[127]!==p?(Ie=s.jsx("p",{id:p,className:"sr-only",children:"Use the arrow keys to read individual samples, and End for the latest value. Escape hides the reading."}),e[127]=p,e[128]=Ie):Ie=e[128];let Pe;e[129]!==d||e[130]!==$||e[131]!==y||e[132]!==L||e[133]!==_?(Pe=y&&s.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none absolute top-0 left-0 whitespace-nowrap rounded-lg border bg-background px-3 py-2 text-xs text-foreground shadow-md",style:{transform:`translate(${L+U.left}px, ${_+U.top}px) translate(${L>d*.6?"calc(-100% - 12px)":"12px"}, -50%)`,transition:"transform 0.25s ease-out"},children:[s.jsxs("p",{className:"mb-1",children:["Date: ",Nt(y.t)]}),s.jsxs("p",{children:[$,": ",Ve(y.v)]})]}),e[129]=d,e[130]=$,e[131]=y,e[132]=L,e[133]=_,e[134]=Pe):Pe=e[134];let We;return e[135]!==De||e[136]!==Ie||e[137]!==Pe?(We=s.jsxs(s.Fragment,{children:[De,Ie,Pe]}),e[135]=De,e[136]=Ie,e[137]=Pe,e[138]=We):We=e[138],We}function Ms(){return{fontSize:11,fill:"currentColor",textAnchor:"end",dx:-4,dy:3,className:"fill-muted-foreground"}}function _s(t){return`${t}%`}function $s(){return{fontSize:11,fill:"currentColor",textAnchor:"middle",dy:6,className:"fill-muted-foreground"}}export{ks as AreaChartInner,Is as MacResources};
1
+ import{r as M,c as He,j as s}from"./vendor-react-DTSdA8m-.js";import{ak as Tt,c as bt,b as Ot,ay as Rt,az as Ct,q as Xe,aA as Dt,Q as xt}from"./index-C_3Q51YJ.js";import{u as It}from"./useRelay-CES3I1Mt.js";import{u as Pt,S as Kt}from"./useShownAfter-By1Yxysz.js";import{c as Ft,a as Ht,T as Ut}from"./tabs-Bf7ou-eS.js";import{R as Bt}from"./resource-health-oWJ8hy9X.js";import{t as qt,a as wt,b as Gt,c as Qt,d as Wt,e as $t,l as Xt,P as Vt,L as zt,G as Yt,A as Jt,m as St,f as Zt,g as es,h as ts,i as ss,B as ns,j as ls}from"./vendor-charts-BE7R_8yA.js";import"./vendor-router-B1pQim9Z.js";const os=t=>(document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t));function as(){return M.useSyncExternalStore(os,is,rs)}function rs(){return!0}function is(){return document.visibilityState!=="hidden"}function cs(t,e){const o=He.c(4),[m,g]=M.useState(ds);let i,n;return o[0]!==e||o[1]!==t?(i=()=>{if(!e)return;g(Date.now());const h=setInterval(()=>g(Date.now()),t);return()=>clearInterval(h)},n=[t,e],o[0]=e,o[1]=t,o[2]=i,o[3]=n):(i=o[2],n=o[3]),M.useEffect(i,n),m}function ds(){return Date.now()}const pt={"1h":36e5,"6h":216e5,"24h":864e5,"7d":6048e5},us={"1h":Gt.every(10),"6h":wt,"24h":wt.every(3),"7d":qt};function fs(t,e,o){return us[o].range(new Date(t),new Date(e+1))}function ms(t,e){const o=new Date(t);return e==="7d"?`${o.getMonth()+1}/${o.getDate()}`:`${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}`}const hs=2e3;function xs(t){return Math.min(1e4,Math.max(1e3,pt[t]/hs))}const ps={"1h":6e4,"6h":6e4,"24h":3e5,"7d":9e5},gt=t=>Math.round(t*10)/10;function gs(t,e,o){let m;for(const i of t){const n=i.agentName===e?i.resources:void 0;n&&(!m||n.reportedAt>m.reportedAt)&&(m=n)}if(!m||o-m.reportedAt>Bt)return null;const g=i=>Number.isFinite(i)?gt(i):null;return{cpu:g(m.cpuPercent),mem:g(m.memUsedMB/m.memTotalMB*100)}}const Et={cpu:{label:"CPU",color:"#60a5fa"},mem:{label:"RAM",color:"#a78bfa"}},Lt={"1h":"1h","6h":"6h","24h":"24h","7d":"7d"};function Is(){const t=He.c(66);let e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0];const[o,m]=M.useState(e),[g,i]=M.useState(null),[n,h]=M.useState("24h"),R=as();let S;t[1]!==n?(S=xs(n),t[1]=n,t[2]=S):S=t[2];const x=cs(S,R),{setNode:v}=Tt();let p,j;t[3]!==v?(p=()=>(v(s.jsx("span",{className:"text-sm font-medium",children:"Mac Resources"})),()=>v(null)),j=[v],t[3]=v,t[4]=p,t[5]=j):(p=t[4],j=t[5]),M.useEffect(p,j);let C;t[6]===Symbol.for("react.memo_cache_sentinel")?(C=u=>{u.type==="agents:listed"&&m(u.sessions??[])},t[6]=C):C=t[6];const X=C,{send:$,connected:E}=It(X);let ce,de;t[7]!==E||t[8]!==$?(ce=()=>{if(!E)return;$({type:"agents:list"});const u=setInterval(()=>$({type:"agents:list"}),1e4);return()=>clearInterval(u)},de=[E,$],t[7]=E,t[8]=$,t[9]=ce,t[10]=de):(ce=t[9],de=t[10]),M.useEffect(ce,de);let se;t[11]===Symbol.for("react.memo_cache_sentinel")?(se={queryKey:Xe.agents,queryFn:Ct,refetchOnWindowFocus:!1},t[11]=se):se=t[11];const V=bt(se);let d,f,B,ne;t[12]!==V.data||t[13]!==o?(B=V.data??[],f=o.map(js).filter(Boolean),d=[...new Set([...f,...B])],ne=new Set(f),t[12]=V.data,t[13]=o,t[14]=d,t[15]=f,t[16]=B,t[17]=ne):(d=t[14],f=t[15],B=t[16],ne=t[17]);const b=ne,l=g??(V.isPending?null:B[0]??f[0]??null),q=Ot();let ee;t[18]!==n||t[19]!==l?(ee=l?Xe.resourceHistory(l,n):null,t[18]=n,t[19]=l,t[20]=ee):ee=t[20];const te=ee;let D;t[21]!==te||t[22]!==n?(D=te??Xe.resourceHistory("",n),t[21]=te,t[22]=n,t[23]=D):D=t[23];let G;t[24]!==n||t[25]!==l?(G=u=>{const{signal:T}=u;return Dt(l,n,T)},t[24]=n,t[25]=l,t[26]=G):G=t[26];let z;t[27]!==D||t[28]!==G?(z={queryKey:D,queryFn:G,enabled:!1},t[27]=D,t[28]=G,t[29]=z):z=t[29];const I=bt(z),Q=I.refetch;let P,Y;t[30]!==q||t[31]!==n||t[32]!==Q||t[33]!==l||t[34]!==R?(P=()=>{if(!l||!R)return;const u=Xe.resourceHistory(l,n),T=ps[n],N=()=>{const H=q.getQueryState(u);(H==null?void 0:H.fetchStatus)==="fetching"&&H.data===void 0?q.cancelQueries({queryKey:u,exact:!0}).then(()=>Q()):Q({cancelRefetch:!0})},k=q.getQueryState(u),ae=Math.max((k==null?void 0:k.dataUpdatedAt)??0,(k==null?void 0:k.errorUpdatedAt)??0),re=(k==null?void 0:k.data)!==void 0&&ae>0?Math.max(0,T-(Date.now()-ae)):0;let ie;const Ue=()=>{N(),ie=setInterval(N,T)},Fe=re>0?setTimeout(Ue,re):void 0;return re===0&&Ue(),()=>{clearTimeout(Fe),clearInterval(ie),q.cancelQueries({queryKey:u,exact:!0})}},Y=[l,n,R,Q,q],t[30]=q,t[31]=n,t[32]=Q,t[33]=l,t[34]=R,t[35]=P,t[36]=Y):(P=t[35],Y=t[36]),M.useEffect(P,Y);const w=I.data!==void 0||I.isError,J=te!==null&&!w,c=Pt(J,Kt);let K;t[37]!==I.data?(K=I.data??[],t[37]=I.data,t[38]=K):K=t[38];let Z;t[39]!==K?(Z=K.map(vs),t[39]=K,t[40]=Z):Z=t[40];const W=Z;let le;t[41]!==x||t[42]!==l||t[43]!==o?(le=l?gs(o,l,x):null,t[41]=x,t[42]=l,t[43]=o,t[44]=le):le=t[44];const r=le;let y;t[45]===Symbol.for("react.memo_cache_sentinel")?(y=s.jsx("h1",{className:"sr-only",children:"Mac Resources"}),t[45]=y):y=t[45];let L;t[46]===Symbol.for("react.memo_cache_sentinel")?(L=s.jsx("h2",{id:"macs-heading",className:"px-2 pb-1 font-mono text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Macs"}),t[46]=L):L=t[46];let _;t[47]!==d||t[48]!==E||t[49]!==b||t[50]!==l?(_=d.length===0?s.jsx("span",{className:"px-2 text-sm text-muted-foreground",children:E?"No agents yet.":"Connecting…"}):d.map(u=>{const T=b.has(u),N=l===u;return s.jsxs("button",{onClick:()=>i(u),"aria-current":N?"true":void 0,className:["flex items-center gap-2 rounded-md px-2 py-2 text-left text-sm hover:bg-accent transition-colors",N?"bg-accent font-medium":""].join(" "),children:[s.jsx("span",{className:`inline-block h-1.5 w-1.5 shrink-0 rounded-full ${T?"bg-emerald-400":"bg-muted-foreground/40"}`,"aria-hidden":"true"}),s.jsx("span",{className:"truncate min-w-0",children:u}),s.jsx("span",{className:"sr-only",children:T?"Online":"Offline"})]},u)}),t[47]=d,t[48]=E,t[49]=b,t[50]=l,t[51]=_):_=t[51];let A;t[52]!==_?(A=s.jsxs("aside",{"aria-labelledby":"macs-heading",className:"w-64 shrink-0 border-r flex flex-col gap-1 p-3 overflow-y-auto",children:[L,_]}),t[52]=_,t[53]=A):A=t[53];let F;t[54]!==W||t[55]!==(r==null?void 0:r.cpu)||t[56]!==(r==null?void 0:r.mem)||t[57]!==J||t[58]!==x||t[59]!==n||t[60]!==l||t[61]!==c?(F=s.jsx("div",{className:"flex-1 min-w-0 overflow-auto",children:l?s.jsxs("div",{className:"flex flex-col gap-6 p-6",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("h2",{className:"text-base font-semibold",children:l}),s.jsx(Ft,{value:n,onValueChange:u=>h(u),children:s.jsx(Ht,{children:Object.keys(Lt).map(ys)})})]}),J?s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx("p",{className:"sr-only",children:"Loading…"}),s.jsxs("div",{className:c?"flex flex-col gap-6":"flex flex-col gap-6 invisible",children:[s.jsx(_t,{}),s.jsx(_t,{})]})]}):W.length===0?s.jsx("div",{className:"flex h-40 items-center justify-center text-sm text-muted-foreground",children:"No data yet for this range. Data is collected every minute while the agent is connected."}):s.jsxs("div",{className:"flex flex-col gap-6",children:[s.jsx(At,{title:"CPU %",color:"cpu",data:W,dataKey:"cpu",range:n,now:x,live:(r==null?void 0:r.cpu)??null}),s.jsx(At,{title:"RAM %",color:"mem",data:W,dataKey:"mem",range:n,now:x,live:(r==null?void 0:r.mem)??null})]})]}):s.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-muted-foreground",children:[s.jsx(Rt,{className:"h-8 w-8"}),s.jsx("p",{className:"text-sm",children:"Select a Mac to view resource history."})]})}),t[54]=W,t[55]=r==null?void 0:r.cpu,t[56]=r==null?void 0:r.mem,t[57]=J,t[58]=x,t[59]=n,t[60]=l,t[61]=c,t[62]=F):F=t[62];let oe;return t[63]!==A||t[64]!==F?(oe=s.jsxs("div",{className:"flex h-full min-h-0",children:[y,A,F]}),t[63]=A,t[64]=F,t[65]=oe):oe=t[65],oe}function ys(t){return s.jsx(Ut,{value:t,children:Lt[t]},t)}function vs(t){return{time:t.recorded_at,cpu:gt(t.cpu_percent),mem:gt(t.mem_percent)}}function js(t){return t.agentName}const yt=t=>new Date(t.time).getTime(),Nt=t=>new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),Ve=t=>`${Math.round(t*10)/10}%`,bs=$t(yt).left,ws=$t(t=>t.t).left,U={top:8,right:24,bottom:24,left:40},kt=16,Mt=6,Ss=20,Ns=40;function _t(){const t=He.c(1);let e;return t[0]===Symbol.for("react.memo_cache_sentinel")?(e=s.jsxs("div",{className:"rounded-lg border p-4 flex flex-col gap-3","aria-hidden":!0,children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(xt,{className:"h-2.5 w-2.5 rounded-full"}),s.jsx(xt,{className:"h-5 w-12"})]}),s.jsx(xt,{className:"h-[220px] w-full"})]}),t[0]=e):e=t[0],e}function At(t){const e=He.c(18),{title:o,color:m,data:g,dataKey:i,range:n,now:h,live:R}=t,S=Et[m].color;let x;e[0]!==S?(x=s.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full",style:{background:S}}),e[0]=S,e[1]=x):x=e[1];let v;e[2]!==o?(v=s.jsx("h2",{className:"text-sm font-medium",children:o}),e[2]=o,e[3]=v):v=e[3];let p;e[4]!==x||e[5]!==v?(p=s.jsxs("div",{className:"flex items-center gap-2",children:[x,v]}),e[4]=x,e[5]=v,e[6]=p):p=e[6];let j;e[7]!==g||e[8]!==i||e[9]!==S||e[10]!==R||e[11]!==h||e[12]!==n||e[13]!==o?(j=s.jsx("div",{className:"relative h-[220px] w-full",children:s.jsx(Vt,{children:X=>{const{width:$,height:E}=X;return $>0&&E>0?s.jsx(ks,{width:$,height:E,data:g,dataKey:i,hex:S,range:n,now:h,live:R,label:o}):null}})}),e[7]=g,e[8]=i,e[9]=S,e[10]=R,e[11]=h,e[12]=n,e[13]=o,e[14]=j):j=e[14];let C;return e[15]!==p||e[16]!==j?(C=s.jsxs("div",{className:"rounded-lg border p-4 flex flex-col gap-3",children:[p,j]}),e[15]=p,e[16]=j,e[17]=C):C=e[17],C}function ks(t){const e=He.c(139),{width:o,height:m,data:g,dataKey:i,hex:n,range:h,now:R,live:S,label:x}=t,v=S===void 0?null:S,p=`chart-hint-${i}`,[j,C]=M.useState(null),[X,$]=M.useState(!1),[E,ce]=M.useState(null),[de,se]=M.useState(!1),V=de?E:null,d=o-U.left-U.right,f=m-U.top-U.bottom,B=R,ne=B-pt[h],b=Qt({domain:[ne,B],range:[0,Math.max(0,d)]}),l=Wt({domain:[0,100],range:[f,kt]}),q=d>0?Ss/d*pt[h]:0,ee=ne-q,te=B+q;let D;e[0]!==h||e[1]!==ee||e[2]!==te?(D=fs(ee,te,h),e[0]=h,e[1]=ee,e[2]=te,e[3]=D):D=e[3];const G=D,z=d>0?Math.min(.5,Ns/d):0,I=`fill-${i}`,Q=`plot-${i}`,P=`axis-fade-${i}`,Y=g[g.length-1],w=v!==null&&Y?{t:Math.max(B,yt(Y)+1),v,live:!0}:null;let J;e[4]!==i?(J=a=>({t:yt(a),v:a[i]}),e[4]=i,e[5]=J):J=e[5];const c=g.map(J);w&&c.push(w);const K=a=>Math.min(b(a),d),Z=w?K(w.t):0,W=w?l(w.v):0,le=Math.max(0,g.length-1),r=j===null?Math.max(0,c.length-1):j==="live"?w?c.length-1:le:Math.min(bs(g,j),le),y=X?c[r]:void 0,L=y?K(y.t):0,_=y?l(y.v):0,A=Et[i].label;let F;e[6]!==A?(F=a=>`${A}, ${Nt(a.t)}, ${a.live?"latest, ":""}${Ve(a.v)}`,e[6]=A,e[7]=F):F=e[7];const oe=F,u=a=>{const O=c[a];O&&(C(O.live?"live":O.t),$(!0),ce({now:a,text:oe(O)}))};let T;e[8]===Symbol.for("react.memo_cache_sentinel")?(T=()=>$(!1),e[8]=T):T=e[8];const N=T;let k,ae;e[9]!==X?(k=()=>{if(!X)return;const a=O=>{O.key==="Escape"&&$(!1)};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},ae=[X],e[9]=X,e[10]=k,e[11]=ae):(k=e[10],ae=e[11]),M.useEffect(k,ae);const re=a=>{if(c.length===0)return;const O=r,Ke=a.key==="ArrowLeft"||a.key==="ArrowDown"?Math.max(0,O-1):a.key==="ArrowRight"||a.key==="ArrowUp"?Math.min(c.length-1,O+1):a.key==="Home"?0:a.key==="End"?c.length-1:null;Ke!==null&&(a.preventDefault(),u(Ke))},ie=a=>{const O=Xt(a);if(!O)return;const Ke=O.x-U.left,vt=ws(c,b.invert(Ke).getTime()),jt=[c[vt-1],c[vt],w].reduce((mt,ht)=>ht&&(!mt||Math.abs(K(ht.t)-Ke)<=Math.abs(K(mt.t)-Ke))?ht:mt,void 0);jt&&u(c.indexOf(jt))},Ue="group",Fe=w?`${x}, last ${h}. Now ${Ve(w.v)}.`:Y?`${x}, last ${h}. Latest ${Ve(Y[i])}.`:`${x}, last ${h}. No samples.`;let H;e[12]!==I||e[13]!==n?(H=s.jsx(zt,{id:I,from:n,to:n,fromOpacity:.3,toOpacity:0,fromOffset:"5%",toOffset:"95%"}),e[12]=I,e[13]=n,e[14]=H):H=e[14];const ze=Math.max(0,d),Ye=Math.max(0,f);let ue;e[15]!==ze||e[16]!==Ye?(ue=s.jsx("rect",{x:0,y:0,width:ze,height:Ye}),e[15]=ze,e[16]=Ye,e[17]=ue):ue=e[17];let fe;e[18]!==Q||e[19]!==ue?(fe=s.jsx("clipPath",{id:Q,children:ue}),e[18]=Q,e[19]=ue,e[20]=fe):fe=e[20];const Je=`${P}-grad`,Ze=Math.max(0,d);let Be;e[21]===Symbol.for("react.memo_cache_sentinel")?(Be=s.jsx("stop",{offset:0,stopColor:"white",stopOpacity:0}),e[21]=Be):Be=e[21];let me;e[22]!==z?(me=s.jsx("stop",{offset:z,stopColor:"white",stopOpacity:1}),e[22]=z,e[23]=me):me=e[23];const et=1-z;let he;e[24]!==et?(he=s.jsx("stop",{offset:et,stopColor:"white",stopOpacity:1}),e[24]=et,e[25]=he):he=e[25];let qe;e[26]===Symbol.for("react.memo_cache_sentinel")?(qe=s.jsx("stop",{offset:1,stopColor:"white",stopOpacity:0}),e[26]=qe):qe=e[26];let xe;e[27]!==Je||e[28]!==Ze||e[29]!==me||e[30]!==he?(xe=s.jsxs("linearGradient",{id:Je,gradientUnits:"userSpaceOnUse",x1:0,y1:0,x2:Ze,y2:0,children:[Be,me,he,qe]}),e[27]=Je,e[28]=Ze,e[29]=me,e[30]=he,e[31]=xe):xe=e[31];const tt=Math.max(0,d),st=Math.max(0,d),nt=`url(#${P}-grad)`;let pe;e[32]!==f||e[33]!==st||e[34]!==nt?(pe=s.jsx("rect",{x:0,y:f,width:st,height:U.bottom*2,fill:nt}),e[32]=f,e[33]=st,e[34]=nt,e[35]=pe):pe=e[35];let ge;e[36]!==P||e[37]!==f||e[38]!==tt||e[39]!==pe?(ge=s.jsx("mask",{id:P,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse",x:0,y:f,width:tt,height:U.bottom*2,children:pe}),e[36]=P,e[37]=f,e[38]=tt,e[39]=pe,e[40]=ge):ge=e[40];let Ge;e[41]===Symbol.for("react.memo_cache_sentinel")?(Ge=[0,25,50,75,100],e[41]=Ge):Ge=e[41];let ye;e[42]!==d||e[43]!==l?(ye=s.jsx(Yt,{scale:l,width:d,tickValues:Ge,strokeDasharray:"3 3",stroke:"hsl(var(--border))"}),e[42]=d,e[43]=l,e[44]=ye):ye=e[44];const lt=`url(#${Q})`;let ve;e[45]!==b?(ve=a=>b(a.t),e[45]=b,e[46]=ve):ve=e[46];let je;e[47]!==l?(je=a=>l(a.v),e[47]=l,e[48]=je):je=e[48];const ot=`url(#${I})`;let be;e[49]!==c||e[50]!==ve||e[51]!==je||e[52]!==ot||e[53]!==l?(be=s.jsx(Jt,{data:c,x:ve,y:je,yScale:l,curve:St,fill:ot}),e[49]=c,e[50]=ve,e[51]=je,e[52]=ot,e[53]=l,e[54]=be):be=e[54];let we;e[55]!==b?(we=a=>b(a.t),e[55]=b,e[56]=we):we=e[56];let Se;e[57]!==l?(Se=a=>l(a.v),e[57]=l,e[58]=Se):Se=e[58];let Ne;e[59]!==n||e[60]!==c||e[61]!==we||e[62]!==Se?(Ne=s.jsx(Zt,{data:c,x:we,y:Se,curve:St,stroke:n,strokeWidth:1.5}),e[59]=n,e[60]=c,e[61]=we,e[62]=Se,e[63]=Ne):Ne=e[63];let ke;e[64]!==lt||e[65]!==be||e[66]!==Ne?(ke=s.jsxs("g",{clipPath:lt,children:[be,Ne]}),e[64]=lt,e[65]=be,e[66]=Ne,e[67]=ke):ke=e[67];const at=`url(#${P})`;let Me;e[68]!==h?(Me=a=>ms(+a,h),e[68]=h,e[69]=Me):Me=e[69];let _e;e[70]!==f||e[71]!==Me||e[72]!==G||e[73]!==b?(_e=s.jsx(es,{top:f,scale:b,tickValues:G,tickFormat:Me,hideAxisLine:!0,hideTicks:!0,tickLength:0,tickLabelProps:As}),e[70]=f,e[71]=Me,e[72]=G,e[73]=b,e[74]=_e):_e=e[74];let Ae;e[75]!==at||e[76]!==_e?(Ae=s.jsx("g",{mask:at,children:_e}),e[75]=at,e[76]=_e,e[77]=Ae):Ae=e[77];let Qe;e[78]===Symbol.for("react.memo_cache_sentinel")?(Qe=[0,25,50,75,100],e[78]=Qe):Qe=e[78];let $e;e[79]!==l?($e=s.jsx(ts,{scale:l,tickValues:Qe,tickFormat:_s,hideAxisLine:!0,hideTicks:!0,tickLabelProps:Ms}),e[79]=l,e[80]=$e):$e=e[80];let Ee;e[81]!==Z||e[82]!==W||e[83]!==n||e[84]!==w?(Ee=w&&s.jsxs("g",{className:"live-head","aria-hidden":"true",pointerEvents:"none",children:[s.jsx("circle",{cx:Z,cy:W,r:Mt,fill:n,fillOpacity:.2}),s.jsx("circle",{cx:Z,cy:W,r:3,fill:n,stroke:"hsl(var(--background))",strokeWidth:1.5})]}),e[81]=Z,e[82]=W,e[83]=n,e[84]=w,e[85]=Ee):Ee=e[85];let Le;e[86]!==n||e[87]!==f||e[88]!==y||e[89]!==L||e[90]!==_?(Le=y&&s.jsxs("g",{style:{transition:"transform 0.25s ease-out",transform:`translateX(${L}px)`},pointerEvents:"none",children:[s.jsx(ss,{from:{x:0,y:kt},to:{x:0,y:f},stroke:"hsl(var(--border))",strokeWidth:1}),s.jsx("circle",{cx:0,cy:0,r:3,fill:n,stroke:"hsl(var(--background))",strokeWidth:1.5,style:{transition:"transform 0.25s ease-out",transform:`translateY(${_}px)`}})]}),e[86]=n,e[87]=f,e[88]=y,e[89]=L,e[90]=_,e[91]=Le):Le=e[91];const rt=Math.max(0,d)+Mt,it=Math.max(0,f),ct=`${x} samples`,dt=Math.max(0,c.length-1),ut=V?Math.min(V.now,Math.max(0,c.length-1)):r,ft=V?V.text:c[r]?oe(c[r]):void 0;let Te;e[92]!==r||e[93]!==u?(Te=()=>{se(!0),u(r)},e[92]=r,e[93]=u,e[94]=Te):Te=e[94];let Oe;e[95]!==N?(Oe=()=>{N(),se(!1)},e[95]=N,e[96]=Oe):Oe=e[96];let Re;e[97]!==re||e[98]!==ie||e[99]!==N||e[100]!==p||e[101]!==rt||e[102]!==it||e[103]!==ct||e[104]!==dt||e[105]!==ut||e[106]!==ft||e[107]!==Te||e[108]!==Oe?(Re=s.jsx(ns,{x:0,y:0,width:rt,height:it,fill:"transparent",tabIndex:0,role:"slider","aria-label":ct,"aria-valuemin":0,"aria-valuemax":dt,"aria-valuenow":ut,"aria-valuetext":ft,"aria-describedby":p,className:"outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",onFocus:Te,onBlur:Oe,onKeyDown:re,onMouseMove:ie,onMouseLeave:N,onTouchMove:ie,onTouchEnd:N,onTouchCancel:N}),e[97]=re,e[98]=ie,e[99]=N,e[100]=p,e[101]=rt,e[102]=it,e[103]=ct,e[104]=dt,e[105]=ut,e[106]=ft,e[107]=Te,e[108]=Oe,e[109]=Re):Re=e[109];let Ce;e[110]!==ye||e[111]!==ke||e[112]!==Ae||e[113]!==$e||e[114]!==Ee||e[115]!==Le||e[116]!==Re?(Ce=s.jsxs(ls,{left:U.left,top:U.top,children:[ye,ke,Ae,$e,Ee,Le,Re]}),e[110]=ye,e[111]=ke,e[112]=Ae,e[113]=$e,e[114]=Ee,e[115]=Le,e[116]=Re,e[117]=Ce):Ce=e[117];let De;e[118]!==m||e[119]!==Fe||e[120]!==H||e[121]!==fe||e[122]!==xe||e[123]!==ge||e[124]!==Ce||e[125]!==o?(De=s.jsxs("svg",{width:o,height:m,role:Ue,"aria-label":Fe,children:[H,fe,xe,ge,Ce]}),e[118]=m,e[119]=Fe,e[120]=H,e[121]=fe,e[122]=xe,e[123]=ge,e[124]=Ce,e[125]=o,e[126]=De):De=e[126];let Ie;e[127]!==p?(Ie=s.jsx("p",{id:p,className:"sr-only",children:"Use the arrow keys to read individual samples, and End for the latest value. Escape hides the reading."}),e[127]=p,e[128]=Ie):Ie=e[128];let Pe;e[129]!==d||e[130]!==A||e[131]!==y||e[132]!==L||e[133]!==_?(Pe=y&&s.jsxs("div",{"aria-hidden":"true",className:"pointer-events-none absolute top-0 left-0 whitespace-nowrap rounded-lg border bg-background px-3 py-2 text-xs text-foreground shadow-md",style:{transform:`translate(${L+U.left}px, ${_+U.top}px) translate(${L>d*.6?"calc(-100% - 12px)":"12px"}, -50%)`,transition:"transform 0.25s ease-out"},children:[s.jsxs("p",{className:"mb-1",children:["Date: ",Nt(y.t)]}),s.jsxs("p",{children:[A,": ",Ve(y.v)]})]}),e[129]=d,e[130]=A,e[131]=y,e[132]=L,e[133]=_,e[134]=Pe):Pe=e[134];let We;return e[135]!==De||e[136]!==Ie||e[137]!==Pe?(We=s.jsxs(s.Fragment,{children:[De,Ie,Pe]}),e[135]=De,e[136]=Ie,e[137]=Pe,e[138]=We):We=e[138],We}function Ms(){return{fontSize:11,fill:"currentColor",textAnchor:"end",dx:-4,dy:3,className:"fill-muted-foreground"}}function _s(t){return`${t}%`}function As(){return{fontSize:11,fill:"currentColor",textAnchor:"middle",dy:6,className:"fill-muted-foreground"}}export{ks as AreaChartInner,Is as MacResources};