@tapflowio/relay 0.27.1 → 0.28.1

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 (250) hide show
  1. package/dist/RelayServer.d.ts +54 -0
  2. package/dist/RelayServer.d.ts.map +1 -1
  3. package/dist/RelayServer.js +384 -37
  4. package/dist/RelayServer.js.map +1 -1
  5. package/dist/SessionManager.d.ts +63 -2
  6. package/dist/SessionManager.d.ts.map +1 -1
  7. package/dist/SessionManager.js +123 -1
  8. package/dist/SessionManager.js.map +1 -1
  9. package/dist/api/apps.d.ts +2 -1
  10. package/dist/api/apps.d.ts.map +1 -1
  11. package/dist/api/apps.js +20 -7
  12. package/dist/api/apps.js.map +1 -1
  13. package/dist/api/builds.d.ts +2 -1
  14. package/dist/api/builds.d.ts.map +1 -1
  15. package/dist/api/builds.js +13 -39
  16. package/dist/api/builds.js.map +1 -1
  17. package/dist/api/profile.d.ts.map +1 -1
  18. package/dist/api/profile.js +3 -1
  19. package/dist/api/profile.js.map +1 -1
  20. package/dist/api/runVideos.d.ts +85 -0
  21. package/dist/api/runVideos.d.ts.map +1 -0
  22. package/dist/api/runVideos.js +494 -0
  23. package/dist/api/runVideos.js.map +1 -0
  24. package/dist/api/runs.d.ts +77 -0
  25. package/dist/api/runs.d.ts.map +1 -0
  26. package/dist/api/runs.js +579 -0
  27. package/dist/api/runs.js.map +1 -0
  28. package/dist/api/settings.d.ts +1 -1
  29. package/dist/api/settings.d.ts.map +1 -1
  30. package/dist/api/settings.js +43 -3
  31. package/dist/api/settings.js.map +1 -1
  32. package/dist/db.d.ts +2 -0
  33. package/dist/db.d.ts.map +1 -1
  34. package/dist/db.js +4 -0
  35. package/dist/db.js.map +1 -1
  36. package/dist/lib/buildDeletion.d.ts +21 -0
  37. package/dist/lib/buildDeletion.d.ts.map +1 -0
  38. package/dist/lib/buildDeletion.js +58 -0
  39. package/dist/lib/buildDeletion.js.map +1 -0
  40. package/dist/lib/watchActions.d.ts +10 -0
  41. package/dist/lib/watchActions.d.ts.map +1 -0
  42. package/dist/lib/watchActions.js +27 -0
  43. package/dist/lib/watchActions.js.map +1 -0
  44. package/dist/middleware/auth.d.ts +1 -0
  45. package/dist/middleware/auth.d.ts.map +1 -1
  46. package/dist/middleware/auth.js +1 -1
  47. package/dist/middleware/auth.js.map +1 -1
  48. package/dist/migrations/015_flow_runs.sql +59 -0
  49. package/dist/migrations/016_flow_run_videos.sql +51 -0
  50. package/dist/router.d.ts +5 -0
  51. package/dist/router.d.ts.map +1 -1
  52. package/dist/router.js +24 -0
  53. package/dist/router.js.map +1 -1
  54. package/package.json +9 -9
  55. package/public/assets/AISessionWatch-C2h4NZ_I.js +31 -0
  56. package/public/assets/AISessionWatch-C2h4NZ_I.js.br +0 -0
  57. package/public/assets/AISessionWatch-C2h4NZ_I.js.gz +0 -0
  58. package/public/assets/AndroidDeviceScreen-C55msKfh.js +35 -0
  59. package/public/assets/AndroidDeviceScreen-C55msKfh.js.br +0 -0
  60. package/public/assets/AndroidDeviceScreen-C55msKfh.js.gz +0 -0
  61. package/public/assets/AppCenter-S1y-8_7l.js +26 -0
  62. package/public/assets/AppCenter-S1y-8_7l.js.br +0 -0
  63. package/public/assets/AppCenter-S1y-8_7l.js.gz +0 -0
  64. package/public/assets/Default-C-l1O-g9.js +6 -0
  65. package/public/assets/Default-C-l1O-g9.js.br +0 -0
  66. package/public/assets/Default-C-l1O-g9.js.gz +0 -0
  67. package/public/assets/Invite-BCndVxaO.js +1 -0
  68. package/public/assets/Invite-BCndVxaO.js.br +0 -0
  69. package/public/assets/Invite-BCndVxaO.js.gz +0 -0
  70. package/public/assets/MacResources-41cFDgE1.js +1 -0
  71. package/public/assets/MacResources-41cFDgE1.js.br +0 -0
  72. package/public/assets/MacResources-41cFDgE1.js.gz +0 -0
  73. package/public/assets/{NotFound-wHOnT2Fl.js → NotFound-DVq_rCKc.js} +1 -1
  74. package/public/assets/NotFound-DVq_rCKc.js.br +0 -0
  75. package/public/assets/NotFound-DVq_rCKc.js.gz +0 -0
  76. package/public/assets/QASession-B67RsIPm.js +81 -0
  77. package/public/assets/QASession-B67RsIPm.js.br +0 -0
  78. package/public/assets/QASession-B67RsIPm.js.gz +0 -0
  79. package/public/assets/ResetPassword-8rj7ASt1.js +1 -0
  80. package/public/assets/ResetPassword-8rj7ASt1.js.br +0 -0
  81. package/public/assets/ResetPassword-8rj7ASt1.js.gz +0 -0
  82. package/public/assets/RunDetail-BIgq9gJ0.js +16 -0
  83. package/public/assets/RunDetail-BIgq9gJ0.js.br +0 -0
  84. package/public/assets/RunDetail-BIgq9gJ0.js.gz +0 -0
  85. package/public/assets/Runs-DpK5aoBr.js +6 -0
  86. package/public/assets/Runs-DpK5aoBr.js.br +0 -0
  87. package/public/assets/Runs-DpK5aoBr.js.gz +0 -0
  88. package/public/assets/Setup-DZrhA_7b.js +1 -0
  89. package/public/assets/Setup-DZrhA_7b.js.br +0 -0
  90. package/public/assets/Setup-DZrhA_7b.js.gz +0 -0
  91. package/public/assets/Team-CJThCjd3.js +6 -0
  92. package/public/assets/Team-CJThCjd3.js.br +0 -0
  93. package/public/assets/Team-CJThCjd3.js.gz +0 -0
  94. package/public/assets/Tokens-DGURtHWi.js +1 -0
  95. package/public/assets/Tokens-DGURtHWi.js.br +0 -0
  96. package/public/assets/Tokens-DGURtHWi.js.gz +0 -0
  97. package/public/assets/WatchedDevice-CpaKHa1x.js +1 -0
  98. package/public/assets/WatchedDevice-CpaKHa1x.js.br +0 -0
  99. package/public/assets/WatchedDevice-CpaKHa1x.js.gz +0 -0
  100. package/public/assets/aiSession-BW09Jhqz.js +26 -0
  101. package/public/assets/aiSession-BW09Jhqz.js.br +0 -0
  102. package/public/assets/aiSession-BW09Jhqz.js.gz +0 -0
  103. package/public/assets/alert-dialog-t5vlOabq.js +1 -0
  104. package/public/assets/alert-dialog-t5vlOabq.js.br +0 -0
  105. package/public/assets/alert-dialog-t5vlOabq.js.gz +0 -0
  106. package/public/assets/{badge-DNaS0Mu3.js → badge-DrDCTAQQ.js} +1 -1
  107. package/public/assets/badge-DrDCTAQQ.js.br +0 -0
  108. package/public/assets/badge-DrDCTAQQ.js.gz +0 -0
  109. package/public/assets/build-format-ofd2iIzf.js +1 -0
  110. package/public/assets/build-format-ofd2iIzf.js.br +0 -0
  111. package/public/assets/build-format-ofd2iIzf.js.gz +0 -0
  112. package/public/assets/dialog-BOFZkCES.js +1 -0
  113. package/public/assets/dialog-BOFZkCES.js.br +0 -0
  114. package/public/assets/dialog-BOFZkCES.js.gz +0 -0
  115. package/public/assets/field-hint-B9fPUgi7.js +1 -0
  116. package/public/assets/field-hint-B9fPUgi7.js.br +0 -0
  117. package/public/assets/field-hint-B9fPUgi7.js.gz +0 -0
  118. package/public/assets/index-Bixhy5MB.js +248 -0
  119. package/public/assets/index-Bixhy5MB.js.br +0 -0
  120. package/public/assets/index-Bixhy5MB.js.gz +0 -0
  121. package/public/assets/index-D17hSi50.js +1 -0
  122. package/public/assets/index-D17hSi50.js.br +0 -0
  123. package/public/assets/index-D17hSi50.js.gz +0 -0
  124. package/public/assets/index-h2hiZ2OM.css +1 -0
  125. package/public/assets/index-h2hiZ2OM.css.br +0 -0
  126. package/public/assets/index-h2hiZ2OM.css.gz +0 -0
  127. package/public/assets/list-view-BpOY1e-d.js +1 -0
  128. package/public/assets/list-view-BpOY1e-d.js.br +0 -0
  129. package/public/assets/list-view-BpOY1e-d.js.gz +0 -0
  130. package/public/assets/{pencil-BN18R4oa.js → pencil-ZlrAsWuU.js} +2 -2
  131. package/public/assets/pencil-ZlrAsWuU.js.br +0 -0
  132. package/public/assets/pencil-ZlrAsWuU.js.gz +0 -0
  133. package/public/assets/play-4CsGZdQU.js +6 -0
  134. package/public/assets/play-4CsGZdQU.js.br +0 -0
  135. package/public/assets/play-4CsGZdQU.js.gz +0 -0
  136. package/public/assets/resource-health-oWJ8hy9X.js +1 -0
  137. package/public/assets/resource-health-oWJ8hy9X.js.br +0 -0
  138. package/public/assets/resource-health-oWJ8hy9X.js.gz +0 -0
  139. package/public/assets/runs-CInQb6v1.js +1 -0
  140. package/public/assets/runs-CInQb6v1.js.br +0 -0
  141. package/public/assets/runs-CInQb6v1.js.gz +0 -0
  142. package/public/assets/search-input-G_QpBvPM.js +6 -0
  143. package/public/assets/search-input-G_QpBvPM.js.br +0 -0
  144. package/public/assets/search-input-G_QpBvPM.js.gz +0 -0
  145. package/public/assets/select-DDzv2YfY.js +11 -0
  146. package/public/assets/select-DDzv2YfY.js.br +0 -0
  147. package/public/assets/select-DDzv2YfY.js.gz +0 -0
  148. package/public/assets/slider-DE7lQdK4.js +1 -0
  149. package/public/assets/slider-DE7lQdK4.js.br +0 -0
  150. package/public/assets/slider-DE7lQdK4.js.gz +0 -0
  151. package/public/assets/tabs-Co1N3x_X.js +1 -0
  152. package/public/assets/tabs-Co1N3x_X.js.br +0 -0
  153. package/public/assets/tabs-Co1N3x_X.js.gz +0 -0
  154. package/public/assets/tech-label-BMvuJmUf.js +1 -0
  155. package/public/assets/tech-label-BMvuJmUf.js.br +0 -0
  156. package/public/assets/tech-label-BMvuJmUf.js.gz +0 -0
  157. package/public/assets/{trash-D1l1Fm-Z.js → trash-Cwj2dbgB.js} +3 -3
  158. package/public/assets/trash-Cwj2dbgB.js.br +0 -0
  159. package/public/assets/trash-Cwj2dbgB.js.gz +0 -0
  160. package/public/assets/{useFocusAfterSwap-BY3N9f9v.js → useFocusAfterSwap-BdItkQCu.js} +1 -1
  161. package/public/assets/useFocusAfterSwap-BdItkQCu.js.br +0 -0
  162. package/public/assets/useFocusAfterSwap-BdItkQCu.js.gz +0 -0
  163. package/public/assets/useRelay-CES3I1Mt.js +1 -0
  164. package/public/assets/useRelay-CES3I1Mt.js.br +0 -0
  165. package/public/assets/useRelay-CES3I1Mt.js.gz +0 -0
  166. package/public/assets/useShownAfter-By1Yxysz.js +1 -0
  167. package/public/assets/useShownAfter-By1Yxysz.js.br +0 -0
  168. package/public/assets/useShownAfter-By1Yxysz.js.gz +0 -0
  169. package/public/assets/{vendor-charts-BykzUV2D.js → vendor-charts-BE7R_8yA.js} +2 -2
  170. package/public/assets/vendor-charts-BE7R_8yA.js.br +0 -0
  171. package/public/assets/vendor-charts-BE7R_8yA.js.gz +0 -0
  172. package/public/assets/{vendor-react-BlPSzrEe.js → vendor-react-DTSdA8m-.js} +4 -4
  173. package/public/assets/vendor-react-DTSdA8m-.js.br +0 -0
  174. package/public/assets/{vendor-react-BlPSzrEe.js.gz → vendor-react-DTSdA8m-.js.gz} +0 -0
  175. package/public/assets/{vendor-router-B_lVHrKl.js → vendor-router-B1pQim9Z.js} +3 -3
  176. package/public/assets/vendor-router-B1pQim9Z.js.br +0 -0
  177. package/public/assets/vendor-router-B1pQim9Z.js.gz +0 -0
  178. package/public/assets/video-swsaHrfi.js +6 -0
  179. package/public/assets/video-swsaHrfi.js.br +0 -0
  180. package/public/assets/video-swsaHrfi.js.gz +0 -0
  181. package/public/index.html +30 -4
  182. package/public/index.html.br +0 -0
  183. package/public/index.html.gz +0 -0
  184. package/public/og-image.jpg +0 -0
  185. package/public/assets/AppCenter-CeLjUbnR.js +0 -26
  186. package/public/assets/AppCenter-CeLjUbnR.js.br +0 -0
  187. package/public/assets/AppCenter-CeLjUbnR.js.gz +0 -0
  188. package/public/assets/Default-UB0Pa3lN.js +0 -1
  189. package/public/assets/Default-UB0Pa3lN.js.br +0 -0
  190. package/public/assets/Default-UB0Pa3lN.js.gz +0 -0
  191. package/public/assets/Invite-Dv3omu3x.js +0 -1
  192. package/public/assets/Invite-Dv3omu3x.js.br +0 -0
  193. package/public/assets/Invite-Dv3omu3x.js.gz +0 -0
  194. package/public/assets/MacResources-CY4-OdGt.js +0 -1
  195. package/public/assets/MacResources-CY4-OdGt.js.br +0 -0
  196. package/public/assets/MacResources-CY4-OdGt.js.gz +0 -0
  197. package/public/assets/NotFound-wHOnT2Fl.js.br +0 -0
  198. package/public/assets/NotFound-wHOnT2Fl.js.gz +0 -0
  199. package/public/assets/QASession-H5eRSwZv.js +0 -150
  200. package/public/assets/QASession-H5eRSwZv.js.br +0 -0
  201. package/public/assets/QASession-H5eRSwZv.js.gz +0 -0
  202. package/public/assets/ResetPassword-nFTigYt2.js +0 -1
  203. package/public/assets/ResetPassword-nFTigYt2.js.br +0 -0
  204. package/public/assets/ResetPassword-nFTigYt2.js.gz +0 -0
  205. package/public/assets/Setup-UmLtF2PF.js +0 -1
  206. package/public/assets/Setup-UmLtF2PF.js.br +0 -0
  207. package/public/assets/Setup-UmLtF2PF.js.gz +0 -0
  208. package/public/assets/Team-DW40kt3H.js +0 -6
  209. package/public/assets/Team-DW40kt3H.js.br +0 -0
  210. package/public/assets/Team-DW40kt3H.js.gz +0 -0
  211. package/public/assets/Tokens-B1a4ChJK.js +0 -1
  212. package/public/assets/Tokens-B1a4ChJK.js.br +0 -0
  213. package/public/assets/Tokens-B1a4ChJK.js.gz +0 -0
  214. package/public/assets/alert-dialog-aoqYdAwx.js +0 -1
  215. package/public/assets/alert-dialog-aoqYdAwx.js.br +0 -0
  216. package/public/assets/alert-dialog-aoqYdAwx.js.gz +0 -0
  217. package/public/assets/badge-DNaS0Mu3.js.br +0 -0
  218. package/public/assets/badge-DNaS0Mu3.js.gz +0 -0
  219. package/public/assets/build-format-DF5aFcag.js +0 -11
  220. package/public/assets/build-format-DF5aFcag.js.br +0 -0
  221. package/public/assets/build-format-DF5aFcag.js.gz +0 -0
  222. package/public/assets/dialog-DE2WUMuX.js +0 -11
  223. package/public/assets/dialog-DE2WUMuX.js.br +0 -0
  224. package/public/assets/dialog-DE2WUMuX.js.gz +0 -0
  225. package/public/assets/field-hint-Csb40Gzp.js +0 -1
  226. package/public/assets/field-hint-Csb40Gzp.js.br +0 -2
  227. package/public/assets/field-hint-Csb40Gzp.js.gz +0 -0
  228. package/public/assets/index-BbCkTtjO.css +0 -1
  229. package/public/assets/index-BbCkTtjO.css.br +0 -0
  230. package/public/assets/index-BbCkTtjO.css.gz +0 -0
  231. package/public/assets/index-DSW9h8XX.js +0 -218
  232. package/public/assets/index-DSW9h8XX.js.br +0 -0
  233. package/public/assets/index-DSW9h8XX.js.gz +0 -0
  234. package/public/assets/list-view-C0w97ltJ.js +0 -1
  235. package/public/assets/list-view-C0w97ltJ.js.br +0 -0
  236. package/public/assets/list-view-C0w97ltJ.js.gz +0 -0
  237. package/public/assets/pencil-BN18R4oa.js.br +0 -0
  238. package/public/assets/pencil-BN18R4oa.js.gz +0 -0
  239. package/public/assets/resource-health-Bi20EUDs.js +0 -1
  240. package/public/assets/resource-health-Bi20EUDs.js.br +0 -0
  241. package/public/assets/resource-health-Bi20EUDs.js.gz +0 -0
  242. package/public/assets/trash-D1l1Fm-Z.js.br +0 -0
  243. package/public/assets/trash-D1l1Fm-Z.js.gz +0 -0
  244. package/public/assets/useFocusAfterSwap-BY3N9f9v.js.br +0 -0
  245. package/public/assets/useFocusAfterSwap-BY3N9f9v.js.gz +0 -0
  246. package/public/assets/vendor-charts-BykzUV2D.js.br +0 -0
  247. package/public/assets/vendor-charts-BykzUV2D.js.gz +0 -0
  248. package/public/assets/vendor-react-BlPSzrEe.js.br +0 -0
  249. package/public/assets/vendor-router-B_lVHrKl.js.br +0 -0
  250. package/public/assets/vendor-router-B_lVHrKl.js.gz +0 -0
@@ -0,0 +1,31 @@
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-Bixhy5MB.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-BW09Jhqz.js";import{P as Le}from"./play-4CsGZdQU.js";import{d as ze,L as Ce}from"./vendor-router-B1pQim9Z.js";/**
2
+ * @license lucide-react v1.58.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const 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.58.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const 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.58.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const 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.58.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const 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.58.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const 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.58.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const 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};
@@ -0,0 +1,35 @@
1
+ import{c as ne,r as y,j as S}from"./vendor-react-DTSdA8m-.js";const Ae={width:324,height:720},fe={width:540,height:720};function yt(t,e){return t==="foldable"?fe:t!=="tablet"?Ae:e==="android"?{width:720,height:450}:fe}const Ee="iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVR4nGNgAAIAAAUAAXpeqz8AAAAASUVORK5CYII=",ge=1500,pe=new Map,be=new WeakSet;function bt(t,e){const n=ge,s=Math.round(ge*t.width/t.height),i=`${s}x${n}x${e??"guess"}`,r=pe.get(i);if(r)return r;const o={framePng:Ee,bezelWidth:s,bezelHeight:n,compositeWidth:s,compositeHeight:n,padding:{left:0,right:0,top:0,bottom:0},screenRect:{x:0,y:0,width:s,height:n},screenCornerRadius:e??Math.round(s*(s/n>.6?.03:.12)),logicalWidth:Math.round(s/2),logicalHeight:Math.round(n/2),buttons:[]};return pe.set(i,o),be.add(o),o}function xt(t){return be.has(t)}function Rt(){const t=ne.c(4),e=y.useRef(0),[n,s]=y.useState(0);let i,r;t[0]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{const c=setInterval(()=>{s(e.current),e.current=0},1e3);return()=>clearInterval(c)},r=[],t[0]=i,t[1]=r):(i=t[0],r=t[1]),y.useEffect(i,r);let o;return t[2]!==n?(o={fps:n,frameCount:e},t[2]=n,t[3]=o):o=t[3],o}class ce{constructor(e){this.bytes=e,this.bitPos=0}get position(){return this.bitPos}bit(){const e=this.bitPos>>3,n=7-(this.bitPos&7);return this.bitPos++,e>=this.bytes.length?0:this.bytes[e]>>n&1}bits(e){let n=0;for(let s=0;s<e;s++)n=n<<1|this.bit();return n>>>0}flag(){return this.bit()===1}ue(){let e=0;for(;this.bit()===0&&e<32;)e++;return e===0?0:(1<<e)-1+this.bits(e)}se(){const e=this.ue();return e&1?Math.ceil(e/2):-Math.ceil(e/2)}}class _e{constructor(){this.bitsArr=[]}bit(e){this.bitsArr.push(e&1)}ue(e){const n=e+1,s=Math.floor(Math.log2(n));for(let i=0;i<s;i++)this.bit(0);for(let i=s;i>=0;i--)this.bit(n>>i&1)}toBytes(){const e=[];for(let n=0;n<this.bitsArr.length;n+=8){let s=0;for(let i=0;i<8;i++)s=s<<1|(this.bitsArr[n+i]??0);e.push(s)}return new Uint8Array(e)}}function xe(t){const e=[];let n=0;for(let s=1;s<t.length;s++){const i=t[s];if(n>=2&&i===3){n=0;continue}e.push(i),n=i===0?n+1:0}return new Uint8Array(e)}function Se(t){const e=[];let n=0;for(const s of t)n>=2&&s<=3&&(e.push(3),n=0),e.push(s),n=s===0?n+1:0;return new Uint8Array(e)}const Te=new Set([100,110,122,244,44,83,86,118,128,138,139,134,135]);function me(t){const e=t.ue()+1;t.bits(4),t.bits(4);for(let n=0;n<e;n++)t.ue(),t.ue(),t.flag();t.bits(5),t.bits(5),t.bits(5),t.bits(5)}function Re(t){const e=t.bits(8);t.bits(8);const n=t.bits(8);if(t.ue(),Te.has(e)){const l=t.ue();if(l===3&&t.flag(),t.ue(),t.ue(),t.flag(),t.flag()){const g=l!==3?8:12;for(let h=0;h<g;h++)if(t.flag()){const b=h<6?16:64;let m=8,T=8;for(let v=0;v<b;v++)T!==0&&(T=(m+t.se()+256)%256),m=T===0?m:T}}}t.ue();const s=t.ue();if(s===0)t.ue();else if(s===1){t.flag(),t.se(),t.se();const l=t.ue();for(let g=0;g<l;g++)t.se()}const i=t.ue();t.flag(),t.ue(),t.ue(),t.flag()||t.flag(),t.flag(),t.flag()&&(t.ue(),t.ue(),t.ue(),t.ue());const r={profileIdc:e,levelIdc:n,numRefFrames:i,bitstreamRestriction:!1,maxNumReorderFrames:null,maxDecFrameBuffering:null};if(!t.flag())return{...r,vuiPresent:!1,restrictionFlagPos:-1};t.flag()&&t.bits(8)===255&&(t.bits(16),t.bits(16)),t.flag()&&t.flag(),t.flag()&&(t.bits(3),t.flag(),t.flag()&&(t.bits(8),t.bits(8),t.bits(8))),t.flag()&&(t.ue(),t.ue()),t.flag()&&(t.bits(32),t.bits(32),t.flag());const c=t.flag();c&&me(t);const d=t.flag();d&&me(t),(c||d)&&t.flag(),t.flag();const a=t.position;return t.flag()?(t.flag(),t.ue(),t.ue(),t.ue(),t.ue(),{...r,vuiPresent:!0,bitstreamRestriction:!0,maxNumReorderFrames:t.ue(),maxDecFrameBuffering:t.ue(),restrictionFlagPos:a}):{...r,vuiPresent:!0,restrictionFlagPos:a}}function De(t){const e=Re(new ce(xe(t)));return{profileIdc:e.profileIdc,levelIdc:e.levelIdc,vuiPresent:e.vuiPresent,bitstreamRestriction:e.bitstreamRestriction,maxNumReorderFrames:e.maxNumReorderFrames,maxDecFrameBuffering:e.maxDecFrameBuffering}}function Pe(t){const e=xe(t),n=Re(new ce(e));if(!n.vuiPresent||n.restrictionFlagPos<0||n.bitstreamRestriction)return null;const s=new _e,i=new ce(e);for(let r=0;r<n.restrictionFlagPos;r++)s.bit(i.bit());return s.bit(1),s.bit(1),s.ue(0),s.ue(0),s.ue(0),s.ue(0),s.ue(0),s.ue(n.numRefFrames),s.bit(1),Uint8Array.from([t[0],...Se(s.toBytes())])}function Ue(t){const e=[],n=t.length;let s=-1,i=0;for(;i+2<n;){const r=i+3<n&&t[i]===0&&t[i+1]===0&&t[i+2]===0&&t[i+3]===1,o=t[i]===0&&t[i+1]===0&&t[i+2]===1;r||o?(s>=0&&e.push(t.subarray(s,i)),i+=r?4:3,s=i):i++}return s>=0&&e.push(t.subarray(s,n)),e}class Ce{constructor(e){this.onFrame=e,this.decoder=null,this.sps=null,this.pps=null,this.frameCount=0,this.submitAt=new Map,this.spsLogged=!1}setDecodeSampler(e){this.decodeSampler=e}decode(e){const n=[];let s=!1;for(const a of Ue(new Uint8Array(e))){const u=a[0]&31;if(u===7){const l=!this.sps||a.length!==this.sps.length||a.some((g,h)=>g!==this.sps[h]);this.sps=a,l&&this.decoder&&(this.decoder.close(),this.decoder=null)}else u===8?this.pps=a:u>=1&&u<=5&&(u===5&&(s=!0),n.push(a))}if(s&&this.sps&&this.pps&&!this.decoder&&this.initDecoder(this.sps,this.pps),!this.decoder||n.length===0)return;let i=0;for(const a of n)i+=4+a.length;const r=new Uint8Array(i),o=new DataView(r.buffer);let c=0;for(const a of n)o.setUint32(c,a.length,!1),c+=4,r.set(a,c),c+=a.length;const d=Math.round(this.frameCount++*(1e6/30));if(this.decodeSampler&&(this.submitAt.set(d,performance.now()),this.submitAt.size>120)){const a=this.submitAt.keys().next().value;a!==void 0&&this.submitAt.delete(a)}try{this.decoder.decode(new EncodedVideoChunk({type:s?"key":"delta",timestamp:d,data:r}))}catch{}}sampleDecode(e){var s;if(!this.decodeSampler)return;const n=this.submitAt.get(e.timestamp);n!==void 0&&(this.submitAt.delete(e.timestamp),this.decodeSampler({decodeMs:performance.now()-n,queueSize:((s=this.decoder)==null?void 0:s.decodeQueueSize)??0}))}flush(){var e;(e=this.decoder)==null||e.flush().catch(()=>{})}close(){var e;(e=this.decoder)==null||e.close(),this.decoder=null}logSpsVui(e){if(!(this.spsLogged||!this.decodeSampler)){this.spsLogged=!0;try{console.log("[sps-vui]",JSON.stringify(De(e)))}catch(n){console.warn("[sps-vui] parse failed",n)}}}initDecoder(e,n){this.logSpsVui(e);const s=Pe(e)??e,i=s[0]===0?s.subarray(4):s,r=`avc1.${i[1].toString(16).padStart(2,"0")}${i[2].toString(16).padStart(2,"0")}${i[3].toString(16).padStart(2,"0")}`,o=this.buildAVCC(s,n);this.decoder=new VideoDecoder({output:c=>{this.sampleDecode(c),this.onFrame(c)},error:c=>console.error("[WebCodecsCore]",c)}),this.decoder.configure({codec:r,description:o,optimizeForLatency:!0})}buildAVCC(e,n){const s=e[0]===0?e.subarray(4):e,i=n[0]===0?n.subarray(4):n,r=new Uint8Array(8+s.length+1+2+i.length);let o=0;return r[o++]=1,r[o++]=s[1],r[o++]=s[2],r[o++]=s[3],r[o++]=255,r[o++]=225,r[o++]=s.length>>8&255,r[o++]=s.length&255,r.set(s,o),o+=s.length,r[o++]=1,r[o++]=i.length>>8&255,r[o++]=i.length&255,r.set(i,o),r}}const Ie=`#version 300 es
2
+ in vec2 a_pos;
3
+ out vec2 v_uv;
4
+ void main() {
5
+ v_uv = vec2(a_pos.x * 0.5 + 0.5, 0.5 - a_pos.y * 0.5);
6
+ gl_Position = vec4(a_pos, 0.0, 1.0);
7
+ }`,Fe=`#version 300 es
8
+ precision mediump float;
9
+ in vec2 v_uv;
10
+ uniform sampler2D u_tex;
11
+ out vec4 out_color;
12
+ void main() {
13
+ out_color = texture(u_tex, v_uv);
14
+ }`;function He(t){const e=t.getContext("webgl2",{alpha:!1,antialias:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0});if(!e)return null;const n=(u,l)=>{const g=e.createShader(u);return e.shaderSource(g,l),e.compileShader(g),g},s=e.createProgram(),i=n(e.VERTEX_SHADER,Ie),r=n(e.FRAGMENT_SHADER,Fe);e.attachShader(s,i),e.attachShader(s,r),e.linkProgram(s),e.deleteShader(i),e.deleteShader(r),e.useProgram(s);const o=e.createVertexArray();e.bindVertexArray(o);const c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);const d=e.getAttribLocation(s,"a_pos");e.enableVertexAttribArray(d),e.vertexAttribPointer(d,2,e.FLOAT,!1,0,0),e.bindVertexArray(null);const a=e.createTexture();return e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),e.uniform1i(e.getUniformLocation(s,"u_tex"),0),{gl:e,program:s,tex:a,vao:o}}class Le{constructor(e){this.canvas=e,this.state=null}init(){return this.state=He(this.canvas),this.state!==null}drawFrame(e){const n=this.state;if(!n)return e.close(),null;const s=e.displayWidth,i=e.displayHeight;try{return(this.canvas.width!==s||this.canvas.height!==i)&&(this.canvas.width=s,this.canvas.height=i,n.gl.viewport(0,0,s,i)),n.gl.activeTexture(n.gl.TEXTURE0),n.gl.bindTexture(n.gl.TEXTURE_2D,n.tex),n.gl.texImage2D(n.gl.TEXTURE_2D,0,n.gl.RGBA,n.gl.RGBA,n.gl.UNSIGNED_BYTE,e),n.gl.bindVertexArray(n.vao),n.gl.drawArrays(n.gl.TRIANGLES,0,6),n.gl.bindVertexArray(null),n.gl.bindTexture(n.gl.TEXTURE_2D,null),{width:s,height:i}}finally{e.close()}}dispose(){const e=this.state;e&&(e.gl.deleteTexture(e.tex),e.gl.deleteVertexArray(e.vao),e.gl.deleteProgram(e.program),this.state=null)}}function Me(t){const e=new Le(t);return e.init(),e}class We{constructor(e=Me){this._size=null,this.canvas=document.createElement("canvas"),this.renderer=e(this.canvas),this.core=new Ce(n=>this.render(n))}get surface(){return this.canvas}get size(){return this._size}onResize(e){this.resizeCb=e}onDecodedFrame(e){this.decodedCb=e,this.core.setDecodeSampler(n=>{this.lastSample=n})}decode(e){this.core.decode(e)}flush(){this.core.flush()}close(){this.core.close(),this.renderer.dispose()}render(e){var s,i;const n=this.renderer.drawFrame(e);n&&((s=this.decodedCb)==null||s.call(this,performance.now(),this.lastSample),this.lastSample=void 0,(!this._size||this._size.width!==n.width||this._size.height!==n.height)&&(this._size=n,(i=this.resizeCb)==null||i.call(this,n)))}}const Ne=`#version 300 es
15
+ in vec2 a_pos;
16
+ out vec2 v_uv;
17
+ void main() {
18
+ v_uv = vec2(a_pos.x * 0.5 + 0.5, 0.5 - a_pos.y * 0.5);
19
+ gl_Position = vec4(a_pos, 0.0, 1.0);
20
+ }`,ze=`#version 300 es
21
+ precision mediump float;
22
+ in vec2 v_uv;
23
+ uniform sampler2D u_texY;
24
+ uniform sampler2D u_texU;
25
+ uniform sampler2D u_texV;
26
+ out vec4 out_color;
27
+ void main() {
28
+ float Y = (texture(u_texY, v_uv).r - 0.0627451) * 1.1643836; // (y-16/255)*255/219
29
+ float U = (texture(u_texU, v_uv).r - 0.5019608) * 1.1383929; // (u-128/255)*255/224
30
+ float V = (texture(u_texV, v_uv).r - 0.5019608) * 1.1383929;
31
+ float r = Y + 1.5748 * V;
32
+ float g = Y - 0.1873 * U - 0.4681 * V;
33
+ float b = Y + 1.8556 * U;
34
+ out_color = vec4(r, g, b, 1.0);
35
+ }`;function oe(t,e,n,s){const i=t.createTexture();return t.activeTexture(t.TEXTURE0+e),t.bindTexture(t.TEXTURE_2D,i),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),t.uniform1i(t.getUniformLocation(s,n),e),i}function Ve(t){const e=t.getContext("webgl2",{alpha:!1,antialias:!1,powerPreference:"high-performance",preserveDrawingBuffer:!0});if(!e)return null;const n=(g,h)=>{const b=e.createShader(g);return e.shaderSource(b,h),e.compileShader(b),b},s=e.createProgram(),i=n(e.VERTEX_SHADER,Ne),r=n(e.FRAGMENT_SHADER,ze);e.attachShader(s,i),e.attachShader(s,r),e.linkProgram(s),e.deleteShader(i),e.deleteShader(r),e.useProgram(s);const o=e.createVertexArray();e.bindVertexArray(o);const c=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,c),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);const d=e.getAttribLocation(s,"a_pos");e.enableVertexAttribArray(d),e.vertexAttribPointer(d,2,e.FLOAT,!1,0,0),e.bindVertexArray(null),e.pixelStorei(e.UNPACK_ALIGNMENT,1);const a=oe(e,0,"u_texY",s),u=oe(e,1,"u_texU",s),l=oe(e,2,"u_texV",s);return{gl:e,program:s,texY:a,texU:u,texV:l,vao:o}}class ke{constructor(e){this.canvas=e,this.state=null}init(){return this.state=Ve(this.canvas),this.state!==null}drawI420(e,n,s){const i=this.state;if(!i)return null;const{gl:r}=i,o=n+1>>1,c=s+1>>1,d=n*s,a=o*c,u=e.subarray(0,d),l=e.subarray(d,d+a),g=e.subarray(d+a,d+2*a);(this.canvas.width!==n||this.canvas.height!==s)&&(this.canvas.width=n,this.canvas.height=s,r.viewport(0,0,n,s));const h=(b,m,T,v,R)=>{r.activeTexture(r.TEXTURE0+b),r.bindTexture(r.TEXTURE_2D,m),r.texImage2D(r.TEXTURE_2D,0,r.R8,T,v,0,r.RED,r.UNSIGNED_BYTE,R)};return h(0,i.texY,n,s,u),h(1,i.texU,o,c,l),h(2,i.texV,o,c,g),r.bindVertexArray(i.vao),r.drawArrays(r.TRIANGLES,0,6),r.bindVertexArray(null),{width:n,height:s}}dispose(){const e=this.state;e&&(e.gl.deleteTexture(e.texY),e.gl.deleteTexture(e.texU),e.gl.deleteTexture(e.texV),e.gl.deleteVertexArray(e.vao),e.gl.deleteProgram(e.program),this.state=null)}}const $e=0;function Oe(t){const e=new ke(t);return e.init(),e}function je(){return new Worker(new URL("/assets/tinyh264.worker-DiJ50Hai.js",import.meta.url),{type:"module"})}class Ge{constructor(e=Oe,n=je){this.ready=!1,this.pending=[],this._size=null,this.canvas=document.createElement("canvas"),this.renderer=e(this.canvas),this.worker=n(),this.worker.onmessage=s=>this.onMessage(s.data)}get surface(){return this.canvas}get size(){return this._size}onResize(e){this.resizeCb=e}onDecodedFrame(e){this.decodedCb=e}decode(e){if(!this.ready){this.pending.push(e);return}this.post(e)}close(){this.worker.terminate(),this.renderer.dispose()}post(e){this.worker.postMessage({type:"decode",data:e,offset:0,length:e.byteLength,renderStateId:$e},[e])}onMessage(e){var s,i;if(e.type==="decoderReady"){this.ready=!0;for(const r of this.pending)this.post(r);this.pending.length=0;return}const n=this.renderer.drawI420(new Uint8Array(e.data),e.width,e.height);n&&((s=this.decodedCb)==null||s.call(this,performance.now()),(!this._size||this._size.width!==n.width||this._size.height!==n.height)&&(this._size=n,(i=this.resizeCb)==null||i.call(this,n)))}}function le(){const t=typeof window<"u";let e=!1;try{e=!!document.createElement("canvas").getContext("webgl2")}catch{e=!1}return{secureContext:t&&window.isSecureContext===!0,webCodecs:t&&"VideoDecoder"in window,webgl2:e,wasm:typeof WebAssembly<"u"&&typeof Worker<"u"}}function Be(t=le()){return t.secureContext&&t.webCodecs&&t.webgl2?new We:t.wasm&&t.webgl2?new Ge:null}function vt(t=le()){return t.secureContext&&t.webCodecs&&t.webgl2||t.wasm&&t.webgl2}function wt(t=le()){return t.secureContext&&t.webCodecs&&t.webgl2?"high":t.wasm&&t.webgl2?"standard":"unsupported"}function At(t,e,n,s,i,r){const{x:o,y:c,width:d,height:a}=i;let u,l;if(r){const g=(t.x-e.left)/e.width;u=(1-(t.y-e.top)/e.height)*n,l=g*s}else u=(t.x-e.left)*(n/e.width),l=(t.y-e.top)*(s/e.height);return u<o||u>o+d||l<c||l>c+a?null:{x:(u-o)/d,y:(l-c)/a}}function Et(t,e,n){const s=(t.x-e.left)/e.width,i=(t.y-e.top)/e.height;return s<0||s>1||i<0||i>1?null:n?{x:i,y:1-s}:{x:s,y:i}}function _t(t){return{f0:{x:1-t.x,y:1-t.y},f1:t}}function Xe(t,e){return t>0?Math.min(1,e/t):1}function Ye(t,e){return(t+(e?90:0))%360}function ue(t,e,n){const s=n===90||n===270;return{width:s?e:t,height:s?t:e}}function St(t,e,n,s,i){const{width:r,height:o}=ue(n,s,i),c=Math.min(t/r,e/o);return{picW:r,picH:o,scale:c,left:(t-r*c)/2,top:(e-o*c)/2}}function qe(t,e,n){const s=t===90||t===270,i=s?n:e,r=s?e:n;return{width:i,height:r,left:(e-i)/2,top:(n-r)/2}}function Tt(t,e,n,s){const{width:i,height:r}=ue(t,e,s);return{width:i,height:r,turn:(n-s+360)%360}}function Je(t){return!t.ready||t.rotating?!1:t.aspectAgrees||!t.frameIsAhead}function Ke(t,e,n){if(!t||!e)return!0;const{width:s,height:i}=ue(t.width,t.height,n);return Math.abs(s/i-e.width/e.height)<.05}function Dt(t,e){return Math.max(0,t-e)}const Qe=22,ye=[84,70,70,69],Ze=1,et=0,ae=1,tt=2,st=1,nt=2,it=4;function Pt(t){if(t.byteLength<Qe)return null;const e=new DataView(t);for(let i=0;i<ye.length;i++)if(e.getUint8(i)!==ye[i])return null;if(e.getUint8(4)!==Ze)return null;const n=e.getUint8(5),s=n&it?tt:n&st?ae:et;return{capturedAt:Number(e.getBigUint64(6)),relayedAt:Number(e.getBigUint64(14)),codec:s,keyframe:s===ae&&(n&nt)!==0}}function ve(t){const{binaryFrameHandlerRef:e,perfHookRef:n,frameCount:s}=t,i=y.useRef(t);y.useLayoutEffect(()=>{i.current=t},[t]),y.useEffect(()=>{let r=null,o=!1,c=!1,d;const a=()=>{if(r)return r;if(o)return null;const u=Be();return u?(r=u,u.onResize(l=>i.current.onResize(l)),d=i.current.onDecoderReady(u),u):(o=!0,i.current.onUnsupported(),console.warn("[decoder] none available — set up HTTPS or use a supported browser"),null)};return e.current=(u,l)=>{var b;const g=i.current.onJpegFrame;if(g&&(l==null?void 0:l.codec)!==ae){g(u,l);return}const h=a();if(h){if(!c){if(!(l!=null&&l.keyframe))return;c=!0}h.decode(u),l!=null&&l.flush&&((b=h.flush)==null||b.call(h)),s.current+=1}},()=>{e.current=void 0,typeof d=="function"&&d(),r==null||r.close(),r==null||r.surface.remove(),r=null}},[e,n,s])}const rt=2500;function Ut(t){const e=ne.c(26),{chrome:n,binaryFrameHandlerRef:s,perfHookRef:i,fps:r,frameCount:o,onCanvasResize:c}=t,d=y.useRef(null),a=y.useRef(null),u=y.useRef(null),l=y.useRef(0),g=y.useRef(0),[h,b]=y.useState(!1),[m,T]=y.useState(!1);r!==0&&m&&T(!1);let v,R;e[0]!==h||e[1]!==r?(v=()=>{if(r!==0||!h)return;const x=setTimeout(()=>T(!0),rt);return()=>clearTimeout(x)},R=[r,h],e[0]=h,e[1]=r,e[2]=v,e[3]=R):(v=e[2],R=e[3]),y.useEffect(v,R);const[w,U]=y.useState(!1),C=y.useRef(null);let D;e[4]===Symbol.for("react.memo_cache_sentinel")?(D=x=>{const f=d.current;f&&(x.style.left=f.style.left,x.style.top=f.style.top,x.style.width=f.style.width,x.style.height=f.style.height,x.style.borderRadius=f.style.borderRadius,x.style.maskImage=f.style.maskImage)},e[4]=D):D=e[4];const N=D;let $;e[5]===Symbol.for("react.memo_cache_sentinel")?($=()=>{C.current&&N(C.current)},e[5]=$):$=e[5];let O;e[6]!==n?(O=[n],e[6]=n,e[7]=O):O=e[7],y.useLayoutEffect($,O);let H;e[8]===Symbol.for("react.memo_cache_sentinel")?(H=()=>U(!0),e[8]=H):H=e[8];let F;e[9]!==c?(F=x=>{const f=d.current;f&&(f.width!==x.width||f.height!==x.height)&&(f.width=x.width,f.height=x.height,c==null||c({width:x.width,height:x.height})),b(!0)},e[9]=c,e[10]=F):F=e[10];let L;e[11]===Symbol.for("react.memo_cache_sentinel")?(L=x=>{var E;const f=x.surface;f.style.position="absolute",N(f),C.current=f,f.style.objectFit="fill",f.style.zIndex="3",f.style.pointerEvents="none",(E=a.current)==null||E.appendChild(f);let I=null;const A=()=>{const P=d.current,W=P==null?void 0:P.getContext("2d");if(P&&W&&x.size)try{W.drawImage(x.surface,0,0,P.width,P.height)}catch{}I=requestAnimationFrame(A)};return I=requestAnimationFrame(A),()=>{I!==null&&cancelAnimationFrame(I),C.current===f&&(C.current=null)}},e[11]=L):L=e[11];let M;e[12]!==o||e[13]!==c||e[14]!==i?(M=x=>{const f=performance.now();l.current&&f-l.current,l.current=f;const I=g.current;createImageBitmap(new Blob([x],{type:"image/jpeg"})).then(A=>{if(performance.now()-f,g.current!==I){A.close();return}const E=d.current,P=E==null?void 0:E.getContext("2d");if(!E||!P){A.close();return}(E.width!==A.width||E.height!==A.height)&&(E.width=A.width,E.height=A.height,c==null||c({width:A.width,height:A.height}));const W=performance.now();P.drawImage(A,0,0),performance.now()-W,A.close(),b(!0),o.current=o.current+1}).catch(ot)},e[12]=o,e[13]=c,e[14]=i,e[15]=M):M=e[15];let z;e[16]!==s||e[17]!==o||e[18]!==i||e[19]!==F||e[20]!==M?(z={binaryFrameHandlerRef:s,perfHookRef:i,frameCount:o,onUnsupported:H,onResize:F,onDecoderReady:L,onJpegFrame:M},e[16]=s,e[17]=o,e[18]=i,e[19]=F,e[20]=M,e[21]=z):z=e[21],ve(z);let _;return e[22]!==h||e[23]!==w||e[24]!==m?(_={canvasRef:d,containerRef:a,screenAreaRef:u,canvasReady:h,stalled:m,decoderUnsupported:w},e[22]=h,e[23]=w,e[24]=m,e[25]=_):_=e[25],_}function ot(){}function de(t){const e=t.rolloverOffset.x-t.buttonW/2,n=t.anchor==="top"?t.rolloverOffset.y:t.normalOffset.y-t.buttonH/2;return{left:e,top:n,right:e+t.buttonW,bottom:n+t.buttonH}}function ct(t,e){return t.map(n=>{const s=de(n);if(n.onTop)return s;const i=(s.left+s.right)/2,r=(s.top+s.bottom)/2;switch(n.anchor){case"left":return{...s,left:0,right:i};case"right":return{...s,left:i,right:e.width};case"top":return{...s,top:0,bottom:r};case"bottom":return{...s,top:r,bottom:e.height};default:return s}})}const at=12,lt=233,ut=234;function dt(t,e,n,s){const i=t.map(g=>g.accessibilityTitle);if(s!=="tablet")return i;const r=g=>t.findIndex(h=>h.usagePage===at&&h.usage===g),o=r(lt),c=r(ut);if(o<0||c<0)return i;const d=g=>{const h=de(g),b=(h.left+h.right)/2,m=(h.top+h.bottom)/2;return n?{x:m,y:e.width-b}:{x:b,y:m}},a=d(t[o]),u=d(t[c]);return(Math.abs(a.x-u.x)>Math.abs(a.y-u.y)?a.x>u.x:a.y<u.y)||([i[o],i[c]]=[i[c],i[o]]),i}function ht(t){return t.includes("Firefox/")&&t.includes("Macintosh")?"linear-gradient(#fff,#fff)":void 0}const ft=750;function gt(t){const e=t.compositeWidth/2,n=t.compositeHeight/2,s=Xe(n,ft),i=Math.round(e*s),r=Math.round(n*s),o=t.screenRect.x/t.compositeWidth*100,c=t.screenRect.y/t.compositeHeight*100,d=t.screenRect.width/t.compositeWidth*100,a=t.screenRect.height/t.compositeHeight*100,u=Math.round(t.screenCornerRadius/2*s),l=u>0?ht(navigator.userAgent):void 0,g={left:`${o}%`,top:`${c}%`,width:`${d}%`,height:`${a}%`,borderRadius:u>0?`${u}px`:void 0,maskImage:l};return{displayW:i,displayH:r,screenPctLeft:o,screenPctTop:c,screenPctW:d,screenPctH:a,screenBox:g}}function Ct(t){const e=ne.c(66),{screen:n,chrome:s,formFactor:i,isLandscape:r,joined:o,fps:c,containerHandlers:d,buttons:a,overlay:u,areaOverlay:l}=t,{canvasRef:g,containerRef:h,screenAreaRef:b,canvasReady:m,stalled:T}=n;let v;e[0]!==s?(v=gt(s),e[0]=s,e[1]=v):v=e[1];const{displayW:R,displayH:w,screenBox:U}=v;let C,D;if(e[2]!==s.buttons||e[3]!==s.compositeHeight||e[4]!==s.compositeWidth||e[5]!==i||e[6]!==r){const j={width:s.compositeWidth,height:s.compositeHeight};D=ct(s.buttons,j),C=dt(s.buttons,j,r,i),e[2]=s.buttons,e[3]=s.compositeHeight,e[4]=s.compositeWidth,e[5]=i,e[6]=r,e[7]=C,e[8]=D}else C=e[7],D=e[8];const N=C,$=r?w:R,O=r?R:w;let H;e[9]!==$||e[10]!==O?(H={width:$,height:O,position:"relative",flexShrink:0},e[9]=$,e[10]=O,e[11]=H):H=e[11];let F;e[12]!==w||e[13]!==R||e[14]!==r?(F=r?{position:"absolute",top:(R-w)/2,left:(w-R)/2,transform:"rotate(-90deg)",transformOrigin:"center center"}:{},e[12]=w,e[13]=R,e[14]=r,e[15]=F):F=e[15];let L;e[16]!==w||e[17]!==R||e[18]!==F?(L={width:R,height:w,...F},e[16]=w,e[17]=R,e[18]=F,e[19]=L):L=e[19];const M=`data:image/png;base64,${s.framePng}`;let z;e[20]===Symbol.for("react.memo_cache_sentinel")?(z={position:"absolute",top:0,left:0,zIndex:2,width:"100%",height:"100%",display:"block",pointerEvents:"none",userSelect:"none"},e[20]=z):z=e[20];let _;e[21]!==M?(_=S.jsx("img",{src:M,style:z,draggable:!1,alt:""}),e[21]=M,e[22]=_):_=e[22];const x=m?"visible":"hidden";let f;e[23]!==U||e[24]!==x?(f={position:"absolute",zIndex:3,...U,backgroundColor:"#010101",cursor:"none",visibility:x},e[23]=U,e[24]=x,e[25]=f):f=e[25];let I;e[26]!==g||e[27]!==f?(I=S.jsx("canvas",{ref:g,style:f}),e[26]=g,e[27]=f,e[28]=I):I=e[28];let A;e[29]!==m||e[30]!==U?(A=!m&&S.jsx("div",{className:"absolute overflow-hidden",style:{zIndex:3,...U},children:S.jsx("div",{className:"absolute inset-0 animate-pulse bg-zinc-700"})}),e[29]=m,e[30]=U,e[31]=A):A=e[31];let E;e[32]!==m||e[33]!==c||e[34]!==o||e[35]!==U||e[36]!==T?(E=o&&c===0&&(!m||T)&&S.jsxs("div",{"data-testid":"screen-waiting",className:"absolute overflow-hidden pointer-events-none flex items-center justify-center",style:{zIndex:8,...U},children:[m&&S.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 bg-black/60 bg-screen-shimmer bg-[length:200%_100%] animate-screen-shimmer motion-reduce:animate-none"}),S.jsx("span",{className:"relative text-sm text-white",children:m?"Waiting for next frame...":"Waiting for first frame..."})]}),e[32]=m,e[33]=c,e[34]=o,e[35]=U,e[36]=T,e[37]=E):E=e[37];let P;if(e[38]!==a||e[39]!==s.buttons||e[40]!==s.compositeHeight||e[41]!==s.compositeWidth||e[42]!==D||e[43]!==N){let j;e[45]!==a||e[46]!==s.compositeHeight||e[47]!==s.compositeWidth||e[48]!==D||e[49]!==N?(j=(p,J)=>{const ee=(a==null?void 0:a.flashed)===p.name,G=(a==null?void 0:a.hovered)===p.name,V=p.anchor==="top",K=de(p),X=K.top/s.compositeHeight*100,te=p.buttonH/s.compositeHeight*100,Q=p.buttonW/s.compositeWidth*100,se=p.buttonW/2,Y=K.left/s.compositeWidth*100,B=(2*p.rolloverOffset.x-p.normalOffset.x-se)/s.compositeWidth*100,k=p.rolloverOffset.x/s.compositeWidth*100,ie=X,he=V?(2*p.rolloverOffset.y-p.normalOffset.y)/s.compositeHeight*100:0,we=p.onTop?4:1,Z=D[J];return S.jsxs(y.Fragment,{children:[a&&S.jsx("div",{"data-frame-button":p.name,"aria-hidden":"true",onPointerDown:re=>a.onPress(p.name,re),onPointerEnter:()=>a.onHoverChange(p.name),onPointerLeave:()=>a.onHoverChange(re=>re===p.name?null:re),style:{position:"absolute",zIndex:6,cursor:"pointer",left:`${Z.left/s.compositeWidth*100}%`,top:`${Z.top/s.compositeHeight*100}%`,width:`${(Z.right-Z.left)/s.compositeWidth*100}%`,height:`${(Z.bottom-Z.top)/s.compositeHeight*100}%`}}),p.buttonPng&&S.jsx("img",{src:`data:image/png;base64,${p.buttonPng}`,style:{position:"absolute",zIndex:we,top:`${V&&G?he:X}%`,left:`${V?Y:G?B:Y}%`,width:`${Q}%`,height:`${te}%`,transition:V?"top 0.15s ease":"left 0.15s ease",pointerEvents:"none",userSelect:"none"},draggable:!1,alt:""}),ee&&p.pressedPng&&p.pressedRect&&S.jsx("img",{src:`data:image/png;base64,${p.pressedPng}`,style:{position:"absolute",zIndex:p.onTop?3:1,left:`${V?Y:G?B:Y}%`,top:`${V&&G?he:X}%`,width:`${p.pressedRect.width/s.compositeWidth*100}%`,height:`${p.pressedRect.height/s.compositeHeight*100}%`,pointerEvents:"none",userSelect:"none"},draggable:!1,alt:""}),G&&S.jsx("div",{className:"bg-foreground/85 text-background text-[11px] px-[7px] py-1.5 rounded-lg whitespace-nowrap pointer-events-none",style:{position:"absolute",zIndex:5,left:`${k}%`,top:`${ie}%`,transform:"translate(-50%, calc(-100% - 8px))"},children:N[J]})]},p.name)},e[45]=a,e[46]=s.compositeHeight,e[47]=s.compositeWidth,e[48]=D,e[49]=N,e[50]=j):j=e[50],P=s.buttons.map(j),e[38]=a,e[39]=s.buttons,e[40]=s.compositeHeight,e[41]=s.compositeWidth,e[42]=D,e[43]=N,e[44]=P}else P=e[44];let W;e[51]!==d||e[52]!==h||e[53]!==u||e[54]!==_||e[55]!==I||e[56]!==A||e[57]!==E||e[58]!==P||e[59]!==L?(W=S.jsxs("div",{ref:h,className:"relative cursor-default",style:L,...d,children:[_,I,A,u,E,P]}),e[51]=d,e[52]=h,e[53]=u,e[54]=_,e[55]=I,e[56]=A,e[57]=E,e[58]=P,e[59]=L,e[60]=W):W=e[60];let q;return e[61]!==l||e[62]!==b||e[63]!==W||e[64]!==H?(q=S.jsxs("div",{ref:b,style:H,children:[W,l]}),e[61]=l,e[62]=b,e[63]=W,e[64]=H,e[65]=q):q=e[65],q}const pt=720;function It(t){const e=ne.c(23),{binaryFrameHandlerRef:n,perfHookRef:s,frameCount:i,screenWidth:r,screenHeight:o,streamRotation:c,cornerRadius:d,userWantsLandscape:a,rotatePending:u}=t,l=y.useRef(null),g=y.useRef(null),h=y.useRef(null),[b,m]=y.useState(!1),[T,v]=y.useState(!1),R=y.useRef(null),[w,U]=y.useState(null),[C,D]=y.useState(!1),N=`${c}:${r??""}:${o??""}`,[$,O]=y.useState(N);$!==N&&(O(N),D(!1));let H,F,L;e[0]===Symbol.for("react.memo_cache_sentinel")?(H=()=>v(!0),F=B=>{m(!0);const k=R.current;(!k||k.width!==B.width||k.height!==B.height)&&(R.current=B,U(B),D(!0))},L=B=>{var ie;h.current=B;const k=B.surface;k.style.display="block",k.style.width="100%",k.style.height="100%",k.style.objectFit="fill",(ie=l.current)==null||ie.appendChild(k)},e[0]=H,e[1]=F,e[2]=L):(H=e[0],F=e[1],L=e[2]);let M;e[3]!==n||e[4]!==i||e[5]!==s?(M={binaryFrameHandlerRef:n,perfHookRef:s,frameCount:i,onUnsupported:H,onResize:F,onDecoderReady:L},e[3]=n,e[4]=i,e[5]=s,e[6]=M):M=e[6],ve(M);const z=r&&o?{width:r,height:o}:null,_=z??w,x=_?_.width>_.height:!1,f=a&&!x,I=Ye(c,f),A=y.useRef(!1);let E,P;e[7]!==f?(E=()=>{A.current=f},P=[f],e[7]=f,e[8]=E,e[9]=P):(E=e[8],P=e[9]),y.useLayoutEffect(E,P);const W=_?Math.min(1,pt/Math.max(_.width,_.height)):.3,q=_?Math.round(_.width*W):324,j=_?Math.round(_.height*W):720,p=f?j:q,J=f?q:j,ee=d!=null?Math.round(d*q):22,G=Ke(w,z,c),V=Je({ready:b,aspectAgrees:G,frameIsAhead:C,rotating:u}),K=qe(I,p,J),X=`rotate(${I}deg)`,te=V?"visible":"hidden";let Q;e[10]!==K||e[11]!==X||e[12]!==te?(Q={position:"absolute",...K,transform:X,transformOrigin:"center center",visibility:te,cursor:"none"},e[10]=K,e[11]=X,e[12]=te,e[13]=Q):Q=e[13];const se=Q;let Y;return e[14]!==se||e[15]!==J||e[16]!==p||e[17]!==T||e[18]!==G||e[19]!==V||e[20]!==ee||e[21]!==I?(Y={surfaceHostRef:l,containerRef:g,decoderRef:h,videoSizeRef:R,needsCSSRotationRef:A,decoderUnsupported:T,totalTurn:I,containerW:p,containerH:J,screenRadius:ee,frameMatchesScreen:G,pictureVisible:V,canvasStyle:se},e[14]=se,e[15]=J,e[16]=p,e[17]=T,e[18]=G,e[19]=V,e[20]=ee,e[21]=I,e[22]=Y):Y=e[22],Y}function Ft(t){const e=ne.c(23),{screen:n,deviceReady:s,posturePending:i,surfaceHandlers:r,overlay:o}=t,{surfaceHostRef:c,containerRef:d,decoderUnsupported:a,containerW:u,containerH:l,screenRadius:g,frameMatchesScreen:h,pictureVisible:b,canvasStyle:m}=n,T=`${g+12}px`;let v;e[0]!==T?(v={background:"#1c1c1e",borderRadius:T,padding:"12px",flexShrink:0,boxShadow:"0 8px 32px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.06)"},e[0]=T,e[1]=v):v=e[1];const R=`${g}px`;let w;e[2]!==l||e[3]!==u||e[4]!==R?(w={width:u,height:l,backgroundColor:"#010101",borderRadius:R,overflow:"hidden"},e[2]=l,e[3]=u,e[4]=R,e[5]=w):w=e[5];let U;e[6]!==m||e[7]!==a||e[8]!==s||e[9]!==h||e[10]!==o||e[11]!==b||e[12]!==i||e[13]!==r||e[14]!==c?(U=!a&&S.jsxs(S.Fragment,{children:[S.jsx("div",{ref:c,style:m,...r}),!b&&S.jsx("div",{className:"absolute inset-0 animate-pulse bg-zinc-700"}),!b&&s&&S.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:S.jsx("span",{style:{color:"rgba(255,255,255,0.6)",fontSize:"0.875rem"},children:i||!h?"Changing posture…":"Waiting for stream…"})}),o]}),e[6]=m,e[7]=a,e[8]=s,e[9]=h,e[10]=o,e[11]=b,e[12]=i,e[13]=r,e[14]=c,e[15]=U):U=e[15];let C;e[16]!==d||e[17]!==w||e[18]!==U?(C=S.jsx("div",{ref:d,className:"relative",style:w,children:U}),e[16]=d,e[17]=w,e[18]=U,e[19]=C):C=e[19];let D;return e[20]!==v||e[21]!==C?(D=S.jsx("div",{style:v,children:C}),e[20]=v,e[21]=C,e[22]=D):D=e[22],D}export{Ft as A,tt as C,Qe as H,Ct as I,pt as M,Ut as a,xt as b,At as c,It as d,St as e,ue as f,Et as g,bt as h,gt as i,vt as j,Pt as k,ae as l,Tt as o,wt as p,Dt as r,yt as s,_t as t,Rt as u};
@@ -0,0 +1,26 @@
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-Bixhy5MB.js";import{S as qt}from"./search-input-G_QpBvPM.js";import{S as ke,a as Ce,b as Ae,c as F,d as Ee,C as Kt}from"./select-DDzv2YfY.js";import{D as lt,a as at,b as nt,c as rt,d as it}from"./dialog-BOFZkCES.js";import{T as _e}from"./tech-label-BMvuJmUf.js";import{P as Qt,T as Ut}from"./trash-Cwj2dbgB.js";import{B as Te}from"./badge-DrDCTAQQ.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-t5vlOabq.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-4CsGZdQU.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
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const 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
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const 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
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const 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
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const 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
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const ht={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};ht.node;const Ge=Ne(ht);function ps(l){const e=xe.c(37),{onSuccess:s,appId:a,canWrite:c}=l,[b,f]=o.useState(!1),[p,g]=o.useState(null),[u,d]=o.useState("none"),N=o.useRef(null);let j;e[0]!==a||e[1]!==p||e[2]!==s||e[3]!==u?(j=function(D){if(D.preventDefault(),!p)return;const R=new FormData;R.append("file",p),u!=="none"&&R.append("status",u),a&&R.append("app_id",String(a));const Z=fetch("/api/v1/builds",{method:"POST",credentials:"include",body:R}).then(async U=>{if(!U.ok){const le=await U.json().catch(js);throw new Error(le.error??"Upload failed. Check the file format.")}s()});J.promise(Z,{loading:"Uploading build…",success:"Build uploaded",error:bs}),f(!1)},e[0]=a,e[1]=p,e[2]=s,e[3]=u,e[4]=j):j=e[4];const r=j;let S;e[5]===Symbol.for("react.memo_cache_sentinel")?(S=function(D){f(D),D&&(g(null),d("none"))},e[5]=S):S=e[5];const y=S;if(!c){let w;return e[6]===Symbol.for("react.memo_cache_sentinel")?(w=t.jsxs(ie,{size:"sm",onClick:gs,children:[t.jsx(Ge,{className:"mr-2 h-4 w-4"}),"Upload build"]}),e[6]=w):w=e[6],w}let x;e[7]===Symbol.for("react.memo_cache_sentinel")?(x=t.jsx(lt,{asChild:!0,children:t.jsxs(ie,{size:"sm",children:[t.jsx(Ge,{className:"mr-2 h-4 w-4"}),"Upload build"]})}),e[7]=x):x=e[7];let _;e[8]===Symbol.for("react.memo_cache_sentinel")?(_=t.jsx(at,{children:t.jsx(nt,{children:"Upload build"})}),e[8]=_):_=e[8];let I;e[9]===Symbol.for("react.memo_cache_sentinel")?(I=t.jsx(ve,{children:"File"}),e[9]=I):I=e[9];let m;e[10]===Symbol.for("react.memo_cache_sentinel")?(m=()=>{var w;return(w=N.current)==null?void 0:w.click()},e[10]=m):m=e[10];let k;e[11]===Symbol.for("react.memo_cache_sentinel")?(k=w=>{w.preventDefault();const D=w.dataTransfer.files[0];D&&g(D)},e[11]=k):k=e[11];const M=p?p.name:"Click or drag to upload";let O;e[12]!==M?(O=t.jsx("div",{className:"flex h-24 cursor-pointer items-center justify-center rounded-md border-2 border-dashed text-sm text-muted-foreground hover:border-primary",onClick:m,onDragOver:xs,onDrop:k,children:M}),e[12]=M,e[13]=O):O=e[13];let P;e[14]===Symbol.for("react.memo_cache_sentinel")?(P=t.jsx("input",{ref:N,type:"file",accept:".zip,.apk,.tgz,.tar.gz,application/gzip,application/x-gzip",className:"hidden",onChange:w=>{var D;return g(((D=w.target.files)==null?void 0:D[0])??null)}}),e[14]=P):P=e[14];let z;e[15]===Symbol.for("react.memo_cache_sentinel")?(z=t.jsx("code",{children:".app.zip"}),e[15]=z):z=e[15];let G;e[16]===Symbol.for("react.memo_cache_sentinel")?(G=t.jsx("code",{children:".tar.gz"}),e[16]=G):G=e[16];let Y;e[17]===Symbol.for("react.memo_cache_sentinel")?(Y=t.jsx("code",{children:".tgz"}),e[17]=Y):Y=e[17];let V;e[18]===Symbol.for("react.memo_cache_sentinel")?(V=t.jsxs("p",{className:"text-xs text-muted-foreground",children:["iOS: ",z," or ",G," / ",Y," (e.g. an EAS simulator build)  · Android: ",t.jsx("code",{children:".apk"})]}),e[18]=V):V=e[18];let q;e[19]!==O?(q=t.jsxs("div",{className:"grid gap-2",children:[I,O,P,V]}),e[19]=O,e[20]=q):q=e[20];let K;e[21]===Symbol.for("react.memo_cache_sentinel")?(K=t.jsxs(ve,{children:["Status ",t.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),e[21]=K):K=e[21];let X;e[22]===Symbol.for("react.memo_cache_sentinel")?(X=t.jsx(ke,{children:t.jsx(Ce,{})}),e[22]=X):X=e[22];let se;e[23]===Symbol.for("react.memo_cache_sentinel")?(se=t.jsxs(Ae,{children:[t.jsx(F,{value:"none",children:"None"}),t.jsx(F,{value:"Backlog",children:"Backlog"}),t.jsx(F,{value:"In Progress",children:"In Progress"}),t.jsx(F,{value:"Done",children:"Done"}),t.jsx(F,{value:"Rejected",children:"Rejected"})]}),e[23]=se):se=e[23];let L;e[24]!==u?(L=t.jsxs("div",{className:"grid gap-2",children:[K,t.jsxs(Ee,{value:u,onValueChange:d,children:[X,se]})]}),e[24]=u,e[25]=L):L=e[25];let Q;e[26]===Symbol.for("react.memo_cache_sentinel")?(Q=t.jsx(ie,{type:"button",variant:"outline",className:"w-24",onClick:()=>f(!1),children:"Cancel"}),e[26]=Q):Q=e[26];const H=!p;let C;e[27]!==H?(C=t.jsxs("div",{className:"flex justify-end gap-2",children:[Q,t.jsx(ie,{type:"submit",className:"w-24",disabled:H,children:"Upload"})]}),e[27]=H,e[28]=C):C=e[28];let B;e[29]!==r||e[30]!==q||e[31]!==L||e[32]!==C?(B=t.jsxs(rt,{className:"sm:max-w-md",children:[_,t.jsxs("form",{onSubmit:r,className:"flex flex-col gap-4 pt-2",children:[q,L,C]})]}),e[29]=r,e[30]=q,e[31]=L,e[32]=C,e[33]=B):B=e[33];let T;return e[34]!==b||e[35]!==B?(T=t.jsxs(it,{open:b,onOpenChange:y,children:[x,B]}),e[34]=b,e[35]=B,e[36]=T):T=e[36],T}function xs(l){return l.preventDefault()}function gs(){return J.error("Viewers can't upload builds. Ask an Admin for QA or Developer access.")}function bs(l){return l instanceof Error?l.message:"Failed to upload build"}function js(){return{}}function ys({onSuccess:l,canWrite:e}){const[s,a]=o.useState(!1),[c,b]=o.useState(""),[f,p]=o.useState(""),[g,u]=o.useState("ios"),[d,N]=o.useState(""),[j,r]=o.useState(!1);async function S(x){x.preventDefault(),N(""),r(!0);try{const _=await Dt({name:c.trim(),bundle_id_key:f.trim(),platform:g});if(!_){N("Failed to create app");return}if("error"in _){N(_.error);return}a(!1),b(""),p(""),u("ios"),J.success("App created"),l()}catch{N("Failed to create app — check your network"),J.error("Failed to create app — check your network")}finally{r(!1)}}const y=x=>t.jsxs("button",{type:"button",onClick:x,className:"flex w-full items-center gap-1.5 rounded-md px-2 py-1.5 text-left text-sm text-muted-foreground hover:bg-accent hover:text-foreground transition-colors",children:[t.jsx(Qt,{className:"size-3.5 shrink-0"}),t.jsx("span",{children:"Add App"})]});return e?t.jsxs(it,{open:s,onOpenChange:a,children:[t.jsx(lt,{asChild:!0,children:y()}),t.jsxs(rt,{className:"sm:max-w-sm",children:[t.jsx(at,{children:t.jsx(nt,{children:"Add App"})}),t.jsxs("form",{onSubmit:S,className:"flex flex-col gap-4 pt-2",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ve,{htmlFor:"app-name",children:"Name"}),t.jsx(We,{id:"app-name",value:c,onChange:x=>b(x.target.value),placeholder:"My App",required:!0})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ve,{htmlFor:"bundle-id",children:"Bundle ID"}),t.jsx(We,{id:"bundle-id",value:f,onChange:x=>p(x.target.value),placeholder:"com.example.myapp",required:!0})]}),t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx(ve,{htmlFor:"platform",children:"Platform"}),t.jsxs(Ee,{value:g,onValueChange:x=>u(x),children:[t.jsx(ke,{id:"platform",children:t.jsx(Ce,{})}),t.jsxs(Ae,{children:[t.jsx(F,{value:"ios",children:"iOS"}),t.jsx(F,{value:"android",children:"Android"}),t.jsx(F,{value:"both",children:"Both"})]})]})]}),t.jsx(wt,{assertive:!0,id:"add-app-error",message:d||void 0}),t.jsx(ie,{type:"submit",disabled:j,className:"w-full",children:j?"Creating…":"Create App"})]})]})]}):y(()=>J.error("Viewers can't add apps. Ask an Admin for QA or Developer access."))}function vs(l){const e=xe.c(17),{apps:s,selectedAppId:a,onSelect:c,onAdd:b,canWrite:f}=l;let p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=t.jsx("span",{className:"px-2 pb-1 font-mono text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Apps"}),e[0]=p):p=e[0];let g;e[1]!==s.length?(g=s.length===0&&t.jsx("span",{className:"px-2 text-sm text-muted-foreground",children:"No apps yet"}),e[1]=s.length,e[2]=g):g=e[2];let u;if(e[3]!==s||e[4]!==c||e[5]!==a){let j;e[7]!==c||e[8]!==a?(j=r=>t.jsxs("button",{onClick:()=>c(r.id),className:["flex flex-col gap-0.5 rounded-md px-2 py-2 text-left text-sm hover:bg-accent overflow-hidden",r.id===a?"bg-accent font-medium":""].join(" "),children:[t.jsx("span",{className:"truncate",children:r.name}),t.jsx(_e,{className:"text-muted-foreground truncate",children:r.bundle_id_key})]},r.id),e[7]=c,e[8]=a,e[9]=j):j=e[9],u=s.map(j),e[3]=s,e[4]=c,e[5]=a,e[6]=u}else u=e[6];let d;e[10]!==f||e[11]!==b?(d=t.jsx("div",{className:"mt-1 border-t pt-1",children:t.jsx(ys,{onSuccess:b,canWrite:f})}),e[10]=f,e[11]=b,e[12]=d):d=e[12];let N;return e[13]!==g||e[14]!==u||e[15]!==d?(N=t.jsxs("aside",{className:"w-64 shrink-0 border-r flex flex-col gap-1 p-3 overflow-y-auto",children:[p,g,u,d]}),e[13]=g,e[14]=u,e[15]=d,e[16]=N):N=e[16],N}function Ss(l){const e=xe.c(70),{build:s,isLast:a,onNavigate:c,onStatusChange:b,onScheduleDeletion:f,onCancelDeletion:p,canWrite:g,statusDescribedBy:u}=l,[d,N]=o.useState(!1),j=o.useRef(null),r=s.status_label==="Done";let S;e[0]!==s.delete_after?(S=s.delete_after?es(s.delete_after):null,e[0]=s.delete_after,e[1]=S):S=e[1];const y=S;let x;e[2]!==s?(x=Oe(s),e[2]=s,e[3]=x):x=e[3];const _=x;let I;e[4]!==s.id||e[5]!==b?(I=function(ee){b(s.id,ee==="none"?null:ee)},e[4]=s.id,e[5]=b,e[6]=I):I=e[6];const m=I;let k;e[7]===Symbol.for("react.memo_cache_sentinel")?(k=ge=>{var ee;ge.preventDefault(),(ee=j.current)==null||ee.focus()},e[7]=k):k=e[7];let M;e[8]===Symbol.for("react.memo_cache_sentinel")?(M=t.jsxs(Vt,{children:[t.jsx(Ht,{children:"Schedule deletion?"}),t.jsx(Wt,{children:"Build files will be deleted after 7 days. You can cancel the scheduled deletion anytime before then."})]}),e[8]=M):M=e[8];let O;e[9]===Symbol.for("react.memo_cache_sentinel")?(O=t.jsx(Jt,{children:"Cancel"}),e[9]=O):O=e[9];let P;e[10]!==s.id||e[11]!==f?(P=t.jsxs(Gt,{onCloseAutoFocus:k,children:[M,t.jsxs(Yt,{children:[O,t.jsx(Xt,{onClick:()=>{f(s.id),N(!1)},children:"Schedule deletion"})]})]}),e[10]=s.id,e[11]=f,e[12]=P):P=e[12];let z;e[13]!==d||e[14]!==P?(z=t.jsx(Zt,{open:d,onOpenChange:N,children:P}),e[13]=d,e[14]=P,e[15]=z):z=e[15];const G=a?"":"border-b";let Y;e[16]!==G?(Y=["flex items-center gap-3 px-4 py-3",G],e[16]=G,e[17]=Y):Y=e[17];const V=Y.join(" "),q=s.build_number??"—";let K;e[18]!==q?(K=t.jsxs("span",{className:"text-sm font-medium",children:["build ",t.jsx(_e,{children:q})]}),e[18]=q,e[19]=K):K=e[19];const X=s.platform==="ios"?"ios":"android",se=ts[s.platform];let L;e[20]!==X||e[21]!==se?(L=t.jsx(Te,{tone:X,className:"text-xs",children:se}),e[20]=X,e[21]=se,e[22]=L):L=e[22];let Q;e[23]!==s.status_label?(Q=s.status_label&&t.jsx(Te,{tone:ss[s.status_label],className:"text-xs",children:s.status_label}),e[23]=s.status_label,e[24]=Q):Q=e[24];let H;e[25]!==y?(H=y&&t.jsx(Te,{tone:y.urgent?"rejected":"backlog",className:"text-xs",children:y.label}),e[25]=y,e[26]=H):H=e[26];let C;e[27]!==K||e[28]!==L||e[29]!==Q||e[30]!==H?(C=t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[K,L,Q,H]}),e[27]=K,e[28]=L,e[29]=Q,e[30]=H,e[31]=C):C=e[31];let B;e[32]===Symbol.for("react.memo_cache_sentinel")?(B={display:"flex",flexDirection:"row",gap:"14px",marginTop:"0.7rem",alignItems:"center"},e[32]=B):B=e[32];let T;e[33]!==s.uploader?(T=s.uploader&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:s.uploader}),t.jsx(_t,{orientation:"vertical",className:"h-3"})]}),e[33]=s.uploader,e[34]=T):T=e[34];let w;e[35]!==s.uploaded_at?(w=new Date(s.uploaded_at).toLocaleDateString(),e[35]=s.uploaded_at,e[36]=w):w=e[36];let D;e[37]!==w?(D=t.jsx(_e,{children:w}),e[37]=w,e[38]=D):D=e[38];let R;e[39]!==T||e[40]!==D?(R=t.jsxs("div",{style:B,className:"text-xs text-muted-foreground",children:[T,D]}),e[39]=T,e[40]=D,e[41]=R):R=e[41];let Z;e[42]!==C||e[43]!==R?(Z=t.jsxs("div",{className:"flex-1 min-w-0",children:[C,R]}),e[42]=C,e[43]=R,e[44]=Z):Z=e[44];let U;e[45]!==s.id||e[46]!==s.status_label||e[47]!==g||e[48]!==y||e[49]!==m||e[50]!==p||e[51]!==_||e[52]!==u?(U=g&&t.jsxs(t.Fragment,{children:[t.jsxs(Ee,{value:s.status_label??"none",onValueChange:m,children:[t.jsx(ke,{className:"h-9 w-32 text-xs","aria-label":`Status for ${_}`,"aria-describedby":u,"data-status-trigger":s.id,children:t.jsx(Ce,{})}),t.jsxs(Ae,{children:[t.jsx(F,{value:"none",children:t.jsx("span",{className:"text-muted-foreground",children:"—"})}),t.jsx(F,{value:"Backlog",children:"Backlog"}),t.jsx(F,{value:"In Progress",children:"In Progress"}),t.jsx(F,{value:"Done",children:"Done"}),t.jsx(F,{value:"Rejected",children:"Rejected"})]})]}),t.jsx(kt,{delayDuration:400,children:t.jsxs(Ct,{children:[t.jsx(At,{asChild:!0,children:y?t.jsx(ie,{ref:j,size:"icon-sm",variant:"outline",onClick:()=>p(s.id),"aria-label":`Cancel scheduled deletion of ${_}`,children:t.jsx(ms,{className:"h-3.5 w-3.5","aria-hidden":!0})}):t.jsx(ie,{ref:j,size:"icon-sm",variant:"destructive",onClick:()=>N(!0),"aria-label":`Schedule deletion of ${_}`,children:t.jsx(Ut,{className:"h-3.5 w-3.5","aria-hidden":!0})})}),t.jsx(Et,{children:y?"Cancel scheduled deletion":"Schedule deletion"})]})})]}),e[45]=s.id,e[46]=s.status_label,e[47]=g,e[48]=y,e[49]=m,e[50]=p,e[51]=_,e[52]=u,e[53]=U):U=e[53];let le;e[54]!==s.id||e[55]!==c?(le=()=>c(s.id),e[54]=s.id,e[55]=c,e[56]=le):le=e[56];const ce=`Start QA on ${_}`;let he;e[57]===Symbol.for("react.memo_cache_sentinel")?(he=t.jsx(as,{className:"mr-1.5 h-3.5 w-3.5"}),e[57]=he):he=e[57];let ne;e[58]!==r||e[59]!==le||e[60]!==ce?(ne=t.jsxs(ie,{size:"sm",onClick:le,disabled:r,"aria-label":ce,children:[he,"Start QA"]}),e[58]=r,e[59]=le,e[60]=ce,e[61]=ne):ne=e[61];let W;e[62]!==V||e[63]!==Z||e[64]!==U||e[65]!==ne?(W=t.jsxs("div",{className:V,children:[Z,U,ne]}),e[62]=V,e[63]=Z,e[64]=U,e[65]=ne,e[66]=W):W=e[66];let de;return e[67]!==W||e[68]!==z?(de=t.jsxs(t.Fragment,{children:[z,W]}),e[67]=W,e[68]=z,e[69]=de):de=e[69],de}function Ns(l){const e=xe.c(29),{versionName:s,builds:a,isOpen:c,onToggle:b,onNavigate:f,onStatusChange:p,onScheduleDeletion:g,onCancelDeletion:u,canWrite:d,describedBy:N,rowNote:j}=l,r=o.useId(),S=c?r:void 0;let y;e[0]!==c?(y=c?t.jsx(Kt,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):t.jsx(It,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e[0]=c,e[1]=y):y=e[1];let x;e[2]!==s?(x=t.jsx(_e,{className:"font-medium text-sm text-foreground",children:s}),e[2]=s,e[3]=x):x=e[3];const _=a.length>1?"s":"";let I;e[4]!==a.length||e[5]!==_?(I=t.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",a.length," build",_,")"]}),e[4]=a.length,e[5]=_,e[6]=I):I=e[6];let m;e[7]!==N||e[8]!==c||e[9]!==b||e[10]!==S||e[11]!==y||e[12]!==x||e[13]!==I||e[14]!==s?(m=t.jsx("h2",{children:t.jsxs("button",{className:"flex w-full items-center gap-2 px-4 py-3 text-left hover:bg-accent/50 bg-card focus-visible:outline-none focus-visible:outline-offset-[-2px] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring",onClick:b,"aria-expanded":c,"aria-controls":S,"aria-describedby":N,"data-release-header":s,children:[y,x,I]})}),e[7]=N,e[8]=c,e[9]=b,e[10]=S,e[11]=y,e[12]=x,e[13]=I,e[14]=s,e[15]=m):m=e[15];let k;e[16]!==a||e[17]!==d||e[18]!==c||e[19]!==u||e[20]!==f||e[21]!==g||e[22]!==p||e[23]!==r||e[24]!==j?(k=c&&t.jsx("div",{id:r,className:"border-t bg-card",children:a.map((O,P)=>t.jsx(Ss,{build:O,isLast:P===a.length-1,onNavigate:f,onStatusChange:p,onScheduleDeletion:g,onCancelDeletion:u,canWrite:d,statusDescribedBy:(j==null?void 0:j.buildId)===O.id?j.id:void 0},O.id))}),e[16]=a,e[17]=d,e[18]=c,e[19]=u,e[20]=f,e[21]=g,e[22]=p,e[23]=r,e[24]=j,e[25]=k):k=e[25];let M;return e[26]!==m||e[27]!==k?(M=t.jsxs("div",{className:"rounded-lg shadow-card-2 overflow-hidden",children:[m,k]}),e[26]=m,e[27]=k,e[28]=M):M=e[28],M}const ws=3,ft=2;function Ds(){const l=xe.c(1);let e;return l[0]===Symbol.for("react.memo_cache_sentinel")?(e=t.jsx("div",{className:"flex flex-col gap-2","aria-hidden":!0,children:Array.from({length:ws},_s)}),l[0]=e):e=l[0],e}function _s(l,e){return t.jsxs("div",{className:"rounded-lg shadow-card-2 overflow-hidden",children:[t.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 bg-card",children:[t.jsx(pe,{className:"h-4 w-4 shrink-0"}),t.jsx(pe,{className:"h-5 w-16"}),t.jsx(pe,{className:"h-3 w-14"})]}),e===0&&t.jsx("div",{className:"border-t bg-card",children:Array.from({length:ft},ks)})]},e)}function ks(l,e){return t.jsxs("div",{className:["flex items-center gap-3 px-4 py-3",e<ft-1?"border-b":""].join(" "),children:[t.jsxs("div",{className:"flex-1 flex flex-col gap-1.5",children:[t.jsx(pe,{className:"h-5 w-32"}),t.jsx(pe,{className:"h-4 w-48"})]}),t.jsx(pe,{className:"h-9 w-32"})]},e)}const mt="tapflow-app-center-releases:";function Cs(l){try{const e=JSON.parse(localStorage.getItem(mt+l)??"[]");return Array.isArray(e)?e.filter(s=>Array.isArray(s)&&s.length===2&&typeof s[0]=="string"&&typeof s[1]=="boolean"):[]}catch{return[]}}function As(l,e){try{localStorage.setItem(mt+l,JSON.stringify(e))}catch{}}function Es(l,e){const s=xe.c(13),[a,c]=o.useState(Is);let b;s[0]!==l||s[1]!==a?(b=l===null?[]:a.get(l)??Cs(l),s[0]=l,s[1]=a,s[2]=b):b=s[2];const f=b,p=e[0];let g;s[3]!==p||s[4]!==f?(g=r=>{var S;return((S=f.find(y=>{const[x]=y;return x===r}))==null?void 0:S[1])??r===p},s[3]=p,s[4]=f,s[5]=g):g=s[5];const u=g;let d;s[6]!==l||s[7]!==u||s[8]!==f?(d=r=>{if(l===null)return;const S=[...f.filter(y=>{const[x]=y;return x!==r}),[r,!u(r)]].slice(-200);As(l,S),c(y=>new Map(y).set(l,S))},s[6]=l,s[7]=u,s[8]=f,s[9]=d):d=s[9];const N=d;let j;return s[10]!==u||s[11]!==N?(j={isOpen:u,toggle:N},s[10]=u,s[11]=N,s[12]=j):j=s[12],j}function Is(){return new Map}const we=l=>`row:${l}`,De=l=>`release:${l}`;function Ye(l){return l instanceof HTMLElement?l.dataset.statusTrigger!==void 0?we(Number(l.dataset.statusTrigger)):l.dataset.releaseHeader!==void 0?De(l.dataset.releaseHeader):null:null}function Xe(l,e){const s=new Set(JSON.parse(e));return l.find(a=>s.has(a))??null}function Ze(l,e){return l.map((s,a)=>({item:s,d:a>e?2*(a-e)-1:2*(e-a)})).filter(({d:s})=>s>0).sort((s,a)=>s.d-a.d).map(({item:s})=>s)}function Ws(){var Qe;const l=os(),[e,s]=cs(),a=st(),{user:c}=Rt(),b=(c==null?void 0:c.role)!=="Viewer",[f,p]=o.useState(""),[g,u]=o.useState(""),[d,N]=o.useState("all");o.useEffect(()=>{const n=setTimeout(()=>u(f),250);return()=>clearTimeout(n)},[f]);const j=e.get("appId"),r=j!==null&&/^[1-9][0-9]*$/.test(j)?Number(j):null,S=Je({queryKey:["apps"],queryFn:Lt}),y=S.data??[],x=y.find(n=>n.id===r)??null,_=["builds",r,g,d],I=JSON.stringify(_),m=Je({queryKey:_,queryFn:()=>zt({appId:r,search:g,statusFilter:d}),enabled:r!==null,placeholderData:Bt}),k=m.data??[];o.useEffect(()=>{!S.data||e.get("appId")||S.data.length===0||s({appId:String(S.data[0].id)},{replace:!0})},[S.data,e,s]);const[M,O]=o.useState(null),[P,z]=o.useState(!1);o.useEffect(()=>{m.isRefetchError&&J.error("Couldn't refresh builds — showing the last list",{id:"builds:refresh"})},[m.isRefetchError]);const G=o.useRef(null);o.useEffect(()=>{r===null||m.isPlaceholderData||!m.data||G.current!==r&&(G.current=r,O(r))},[r,m.isPlaceholderData,m.data]);function Y(n){s({appId:String(n)})}function V(n,h){return{onMutate:async i=>{const v=_;await a.cancelQueries({queryKey:v});const E=a.getQueryData(v);return a.setQueryData(v,te=>te&&n(te,i)),{previous:E,key:v}},onError:(i,v,E)=>{if(E!=null&&E.previous&&a.setQueryData(E.key,E.previous),i instanceof Mt){a.invalidateQueries({queryKey:Pt.me}),J.error(i.message);return}J.error(h)},onSettled:()=>{a.invalidateQueries({queryKey:["builds"]})}}}const q=V((n,h)=>n.map(i=>i.id===h.buildId?{...i,status_label:h.status}:i),"Failed to update status"),K=Fe({mutationFn:({buildId:n,status:h})=>$t(n,h),...q,onError:(n,h,i)=>{var v;q.onError(n,h,i),((v=T.current)==null?void 0:v.leaving)===h.buildId&&(T.current=null,R(null))}}),X=(n,h)=>{var v;const i=(v=a.getQueryData(n))==null?void 0:v.find(E=>E.id===h);return i?Oe(i):"the build"},se=Fe({mutationFn:n=>Ot(n),...V((n,h)=>n.map(i=>i.id===h?{...i,delete_after:new Date().toISOString()}:i),"Failed to schedule deletion"),onSuccess:(n,h,i)=>{i&&(a.setQueryData(i.key,v=>v==null?void 0:v.map(E=>E.id===h?{...E,delete_after:n}:E)),J.success(`Deletion scheduled for ${X(i.key,h)} — it will be deleted ${ls(n)}`))}}),L=Fe({mutationFn:n=>Ft(n),...V((n,h)=>n.map(i=>i.id===h?{...i,delete_after:null}:i),"Failed to cancel scheduled deletion"),onSuccess:(n,h,i)=>{J.success(`Scheduled deletion cancelled for ${i?X(i.key,h):"the build"}`)}}),Q=n=>se.mutate(n),H=n=>L.mutate(n),C=Tt(k),B=Es(((Qe=k[0])==null?void 0:Qe.app_id)??null,C.map(n=>n.versionName)),T=o.useRef(null),w=o.useRef(null),[D,R]=o.useState(null),Z=o.useRef(null),U=o.useId();function le(n){const h=C.findIndex(v=>v.builds.some(E=>E.id===n));if(h<0)return[];const i=C[h].builds;return[...Ze(i,i.findIndex(v=>v.id===n)).map(v=>we(v.id)),...Ze(C,h).map(v=>De(v.versionName))]}const ce=JSON.stringify(C.flatMap(n=>[De(n.versionName),...B.isOpen(n.versionName)?n.builds.map(h=>we(h.id)):[]])),he=(n,h)=>{const i=k.find(te=>te.id===n),E=d!=="all"&&h!==d?le(n):[];if(i&&E.length>0){const te=`${Oe(i)} was set to ${h??"no status"}, so the ${d} filter no longer shows it.`,Ue={leaving:n,candidates:E,text:te,key:I};T.current=Ue,w.current=null,R(Ue)}K.mutate({buildId:n,status:h})},ne=D!==null&&!k.some(n=>n.id===D.leaving),W=ne?Xe(D.candidates,ce):null,de=m.data,ge=m.isRefetchError;o.useLayoutEffect(()=>{var E;const n=T.current;if(!n)return;if(n.key!==I||ge){T.current=null,R(null);return}if((de??[]).some(te=>te.id===n.leaving))return;T.current=null;const h=Xe(n.candidates,ce);if(!h||document.activeElement!==null&&document.activeElement!==document.body){J.success(n.text),R(null);return}const i=((E=Z.current)==null?void 0:E.querySelectorAll("[data-status-trigger], [data-release-header]"))??[],v=Array.from(i).find(te=>Ye(te)===h);v instanceof HTMLElement?(w.current=h,v.focus()):(J.success(n.text),R(null))},[I,ge,de,ce]),o.useEffect(()=>{if(!D)return;const n=h=>{const i=Ye(h.target);if(w.current!==null){i!==w.current&&R(null);return}i!==we(D.leaving)&&(i===null||!D.candidates.includes(i))&&R(null)};return document.addEventListener("focusin",n),()=>document.removeEventListener("focusin",n)},[D]);const ee=(x==null?void 0:x.name)??"this app",Ie=g!==""||d!=="all",Me=m.isPlaceholderData&&M!==r,pt=m.isFetchedAfterMount&&(m.isPlaceholderData||m.isLoading),be=P||pt,je=m.isLoadingError||be?"error":m.isLoading||C.length===0&&Me?"loading":C.length===0?"empty":"list",Pe=o.useRef(null),xt=ns(je,Pe),gt=rs(je==="loading",is),Le=o.useId(),Be=o.useId(),ze=o.useId(),qe=o.useId(),Ke=o.useId(),bt=r===null?"":m.isLoadingError?`Couldn't load builds for ${ee}`:m.isLoading||Me||be?`Loading builds for ${ee}`:C.length>0?`Showing ${k.length} build${k.length===1?"":"s"} for ${ee}`:Ie?`No builds match the current filters for ${ee}`:`No builds for ${ee}`;return t.jsxs("div",{className:"flex h-full gap-0",children:[t.jsx(vs,{apps:y,selectedAppId:r,onSelect:Y,onAdd:()=>a.invalidateQueries({queryKey:["apps"]}),canWrite:b}),t.jsxs("div",{className:"flex-1 flex flex-col gap-4 p-4 overflow-y-auto min-w-0",children:[t.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[t.jsx("h1",{className:"text-xl font-semibold tracking-display-sm",children:x?x.name:"App Center"}),t.jsx(ps,{onSuccess:()=>{a.invalidateQueries({queryKey:["apps"]}),a.invalidateQueries({queryKey:["builds"]})},appId:r,canWrite:b})]}),t.jsx("p",{id:Ke,role:"status",className:"sr-only",children:bt}),r===null?t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center",children:[t.jsx(hs,{className:"w-8 h-8 text-muted-foreground/40"}),t.jsx("p",{className:"text-sm font-medium",children:"No app selected"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose an app from the sidebar to view its builds."})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.jsx(qt,{ref:Pe,"aria-describedby":`${qe} ${ze}`,"aria-label":"Search versions",placeholder:"Search version…",value:f,onChange:p}),t.jsxs(Ee,{value:d,onValueChange:N,children:[t.jsx(ke,{className:"h-8 w-36","aria-label":"Filter by status",children:t.jsx(Ce,{placeholder:"Status"})}),t.jsxs(Ae,{children:[t.jsx(F,{value:"all",children:"All statuses"}),t.jsx(F,{value:"Backlog",children:"Backlog"}),t.jsx(F,{value:"In Progress",children:"In Progress"}),t.jsx(F,{value:"Done",children:"Done"}),t.jsx(F,{value:"Rejected",children:"Rejected"})]})]}),m.isRefetchError&&t.jsx("p",{className:"text-sm text-muted-foreground self-center",children:"Showing the last list — refresh failed."})]}),t.jsx("div",{...xt,className:"contents",children:je==="error"?t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center",children:[t.jsx(us,{className:"w-8 h-8 text-muted-foreground/40"}),t.jsx("p",{id:Le,className:"text-sm font-medium",children:"Couldn't load builds"}),t.jsx("p",{id:Be,className:"text-sm text-muted-foreground",children:"Check that the relay is reachable."}),t.jsx(ie,{variant:"outline",size:"sm",className:"mt-1 aria-disabled:opacity-50","aria-describedby":`${Le} ${Be}`,"aria-disabled":be,onClick:()=>{be||(z(!0),m.refetch().finally(()=>z(!1)))},children:be?"Trying…":"Try again"})]}):je==="loading"?t.jsxs("div",{className:"flex flex-col",children:[t.jsx("p",{id:qe,className:"sr-only",children:"Loading…"}),gt&&t.jsx(Ds,{})]}):je==="empty"?t.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 text-center",children:[t.jsx(fs,{className:"w-8 h-8 text-muted-foreground/40"}),t.jsx("p",{id:ze,className:"text-sm font-medium",children:Ie?"No matching builds":"No builds yet"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:Ie?"No build matches the search and status filters.":b?"Upload the first build to get started.":"Builds appear here once a teammate uploads one."})]}):t.jsxs("div",{ref:Z,className:"flex flex-col gap-2","aria-busy":m.isPlaceholderData,children:[ne&&t.jsx("p",{id:U,hidden:!0,children:D.text}),C.map(({versionName:n,builds:h},i)=>t.jsx(Ns,{describedBy:[i===0&&!m.isPlaceholderData?Ke:null,W===De(n)?U:null].filter(Boolean).join(" ")||void 0,rowNote:W!=null&&W.startsWith("row:")?{buildId:Number(W.slice(4)),id:U}:void 0,versionName:n,builds:h,isOpen:B.isOpen(n),onToggle:()=>B.toggle(n),onNavigate:v=>l(`/app-center/build?id=${v}`),onStatusChange:he,onScheduleDeletion:Q,onCancelDeletion:H,canWrite:b},n))]})})]})]})]})}export{Ws as AppCenter};
@@ -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-Bixhy5MB.js";import{F as z}from"./field-hint-B9fPUgi7.js";import{B as Qe}from"./badge-DrDCTAQQ.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-t5vlOabq.js";import{S as ge}from"./slider-DE7lQdK4.js";import{P as he}from"./pencil-ZlrAsWuU.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};
@@ -0,0 +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-Bixhy5MB.js";import{F as ie}from"./field-hint-B9fPUgi7.js";import{a as ne,c as oe,L as le}from"./vendor-router-B1pQim9Z.js";import{P as de}from"./pencil-ZlrAsWuU.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};
@@ -0,0 +1 @@
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-Bixhy5MB.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-Co1N3x_X.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};
@@ -1 +1 @@
1
- import{f as l,j as n}from"./vendor-react-BlPSzrEe.js";function m(r){const e=l.c(8),{code:a,message:i}=r;let t;e[0]!==a?(t=n.jsx("span",{className:"text-lg font-semibold tracking-tight text-foreground",children:a}),e[0]=a,e[1]=t):t=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:"h-6 w-px bg-border","aria-hidden":"true"}),e[2]=o):o=e[2];let s;e[3]!==i?(s=n.jsx("span",{className:"text-sm text-muted-foreground",children:i}),e[3]=i,e[4]=s):s=e[4];let c;return e[5]!==t||e[6]!==s?(c=n.jsx("div",{className:"flex min-h-svh items-center justify-center bg-background p-4",children:n.jsxs("div",{className:"flex items-center gap-4",children:[t,o,s]})}),e[5]=t,e[6]=s,e[7]=c):c=e[7],c}function f(){const r=l.c(1);let e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(m,{code:404,message:"page not found"}),r[0]=e):e=r[0],e}export{f as NotFound};
1
+ import{c as l,j as n}from"./vendor-react-DTSdA8m-.js";function m(r){const e=l.c(8),{code:a,message:i}=r;let t;e[0]!==a?(t=n.jsx("span",{className:"text-lg font-semibold tracking-tight text-foreground",children:a}),e[0]=a,e[1]=t):t=e[1];let o;e[2]===Symbol.for("react.memo_cache_sentinel")?(o=n.jsx("span",{className:"h-6 w-px bg-border","aria-hidden":"true"}),e[2]=o):o=e[2];let s;e[3]!==i?(s=n.jsx("span",{className:"text-sm text-muted-foreground",children:i}),e[3]=i,e[4]=s):s=e[4];let c;return e[5]!==t||e[6]!==s?(c=n.jsx("div",{className:"flex min-h-svh items-center justify-center bg-background p-4",children:n.jsxs("div",{className:"flex items-center gap-4",children:[t,o,s]})}),e[5]=t,e[6]=s,e[7]=c):c=e[7],c}function f(){const r=l.c(1);let e;return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=n.jsx(m,{code:404,message:"page not found"}),r[0]=e):e=r[0],e}export{f as NotFound};