ryco-cli 0.1.23 → 0.1.24

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 (269) hide show
  1. package/dist/bin.cjs +228 -88
  2. package/dist/bin.mjs +230 -90
  3. package/dist/client/assets/AccountSettings-ApnDA1f-.js +1 -0
  4. package/dist/client/assets/AiFocusSettings-CNmGHEcA.js +1 -0
  5. package/dist/client/assets/{AnimatedHeight-D9bpLPqe.js → AnimatedHeight-i0YhvlGD.js} +1 -1
  6. package/dist/client/assets/AppearanceSettings-BG8W4DP0.js +1 -0
  7. package/dist/client/assets/BranchToolbar.logic-AgPy06Mx.js +1 -0
  8. package/dist/client/assets/BrowserPanel-BWztlNuL.js +1 -0
  9. package/dist/client/assets/ChatRightPanel-a6UOHNMm.js +194 -0
  10. package/dist/client/assets/ChatThreadRouteView-CWoBLzR_.js +1 -0
  11. package/dist/client/assets/CommandPaletteDialog-B2iKWCUi.js +1 -0
  12. package/dist/client/assets/CompositeRoot-C1G-Ejus.js +1 -0
  13. package/dist/client/assets/ComputerUseSettings-CPwWoHWj.js +1 -0
  14. package/dist/client/assets/ConnectionsSettings-CPMkuxza.js +7 -0
  15. package/dist/client/assets/ContextHandoffEndpointLabel-BildLLDY.js +4 -0
  16. package/dist/client/assets/DiagnosticsSettings-DvnNz2AZ.js +2 -0
  17. package/dist/client/assets/DialogHandle-8o3kfoiI.js +1 -0
  18. package/dist/client/assets/DialogPopup-CLw6NCkW.js +1 -0
  19. package/dist/client/assets/DialogRoot-SKkIuQHA.js +1 -0
  20. package/dist/client/assets/DialogTitle-DCHX74Tz.js +1 -0
  21. package/dist/client/assets/DialogTrigger-Bl_fcIV2.js +1 -0
  22. package/dist/client/assets/DialogViewport-DVDl03yd.js +1 -0
  23. package/dist/client/assets/DraftChatThreadRouteView-CEDYjbKq.js +1 -0
  24. package/dist/client/assets/{ExternalIdentityWeb.logic-pjD4pCDd.js → ExternalIdentityWeb.logic-arHvT6AX.js} +1 -1
  25. package/dist/client/assets/GlassSurface-GY6owikG.js +1 -0
  26. package/dist/client/assets/HostedConnectionControls-COUhSe9x.js +1 -0
  27. package/dist/client/assets/HostedHubRoot-BTWc0XoQ.js +2 -0
  28. package/dist/client/assets/HostedNativeAuthorizationRoute-DZhYxv--.js +2 -0
  29. package/dist/client/assets/HostedRelayTrustNotice-Bl6On0Yi.js +1 -0
  30. package/dist/client/assets/IntegrationsSettingsPanel-n9owMZf-.js +2 -0
  31. package/dist/client/assets/KeybindingsSettings-CPtXx-W2.js +7 -0
  32. package/dist/client/assets/LazyBrowserPanel-SUIBB7B4.js +2 -0
  33. package/dist/client/assets/McpServersSettings-BWIUud0Z.js +6 -0
  34. package/dist/client/assets/MobileSheet-NTayGHF6.js +1 -0
  35. package/dist/client/assets/NodeSecuritySettings-BFifrshE.js +1 -0
  36. package/dist/client/assets/OpinionatedPluginsSettings-D7WuuNWZ.js +1 -0
  37. package/dist/client/assets/PhoneGetAppInterstitial-R0cqI17q.js +1 -0
  38. package/dist/client/assets/PhoneHome-FqWvnJP_.js +1 -0
  39. package/dist/client/assets/PhoneSettingsSurface-w5PJnoBc.js +2 -0
  40. package/dist/client/assets/ProviderModelPicker-dwWhl7Uf.js +1 -0
  41. package/dist/client/assets/ProvidersSettingsPanel-Ww1ch3xA.js +1 -0
  42. package/dist/client/assets/QuitShortcutFeedback-CklL3jMd.js +1 -0
  43. package/dist/client/assets/RedactedSensitiveText-CLPBtvH1.js +1 -0
  44. package/dist/client/assets/RootAppShell-BdQCs2XJ.js +7 -0
  45. package/dist/client/assets/Separator-CpYBhf-I.js +1 -0
  46. package/dist/client/assets/SettingsDialog-DeMzEeCP.js +2 -0
  47. package/dist/client/assets/SettingsPanels-ZxNz9ZfL.js +3 -0
  48. package/dist/client/assets/SettingsPanels.editor-9pSZP875.js +1 -0
  49. package/dist/client/assets/SourceControlSettings-C1F3Brcn.js +1 -0
  50. package/dist/client/assets/StatisticsPage-C7v-6CTr.js +1 -0
  51. package/dist/client/assets/StatisticsPanel-CeIjiBm8.js +1 -0
  52. package/dist/client/assets/StatisticsSettingsLink-5s_violW.js +1 -0
  53. package/dist/client/assets/{ThreadTerminalDrawer-DcZk76Y9.js → ThreadTerminalDrawer-CHZ60lPI.js} +11 -11
  54. package/dist/client/assets/{ThreadWorkspacePanel-Shhau2BD.js → ThreadWorkspacePanel-Ct5kMcuY.js} +17 -17
  55. package/dist/client/assets/activity-BMBx2Fu0.js +1 -0
  56. package/dist/client/assets/alert-CXnC_RJc.js +1 -0
  57. package/dist/client/assets/{appChrome-CiOQzE1d.js → appChrome-BzM66lXM.js} +1 -1
  58. package/dist/client/assets/arrow-left-CymyVbCi.js +1 -0
  59. package/dist/client/assets/arrow-right-9wyq4YVq.js +1 -0
  60. package/dist/client/assets/arrow-up-right-mfU38K6p.js +1 -0
  61. package/dist/client/assets/authorization-CjOFkg7b.js +1 -0
  62. package/dist/client/assets/badge-Dg7mXiOh.js +1 -0
  63. package/dist/client/assets/bot-BR3RyOWP.js +1 -0
  64. package/dist/client/assets/{capabilities-BTd0MRtv.js → capabilities-C8sxDbKT.js} +1 -1
  65. package/dist/client/assets/chart-column-CcRi3pAd.js +1 -0
  66. package/dist/client/assets/chevron-right-CuUjBsQV.js +1 -0
  67. package/dist/client/assets/clipboard-copy-ezz8rnaT.js +1 -0
  68. package/dist/client/assets/data-list-ZLhzdlED.js +1 -0
  69. package/dist/client/assets/desktopWorkspace-P28r2lN2.js +1 -0
  70. package/dist/client/assets/download-BA9L9tK9.js +1 -0
  71. package/dist/client/assets/editorPreferences-DeKdSV3s.js +1 -0
  72. package/dist/client/assets/empty-3NpXLnAM.js +1 -0
  73. package/dist/client/assets/group-D5qBdsaB.js +1 -0
  74. package/dist/client/assets/hostedConnectionCoordinator-CLV-JD1S.js +1 -0
  75. package/dist/client/assets/{hostedPairing-PogXRAb7.js → hostedPairing-B_ylEEDa.js} +1 -1
  76. package/dist/client/assets/hubRoutes-EWJ3Gdod.js +1 -0
  77. package/dist/client/assets/{index-D5j6WG7w.js → index-DxCd1PgA.js} +2 -2
  78. package/dist/client/assets/input-DrOL1KPS.js +1 -0
  79. package/dist/client/assets/kbd-rWDjJnWX.js +1 -0
  80. package/dist/client/assets/key-round-D2DtQ7aS.js +1 -0
  81. package/dist/client/assets/layers-DtSJWmwy.js +1 -0
  82. package/dist/client/assets/log-out-YAp9fsOg.js +1 -0
  83. package/dist/client/assets/{logging-DfaR8ACp.js → logging-BuUPX1SP.js} +1 -1
  84. package/dist/client/assets/main-BbtLAX7M.js +9 -0
  85. package/dist/client/assets/{main-CRk9p9SC.css → main-D4CtFNPY.css} +1 -1
  86. package/dist/client/assets/monitor-OyD484tI.js +1 -0
  87. package/dist/client/assets/palette-D18VboLH.js +1 -0
  88. package/dist/client/assets/play-d3KUi4G6.js +1 -0
  89. package/dist/client/assets/primary-D_D7eLwT.js +2 -0
  90. package/dist/client/assets/{providerDriverMeta-Cl-ADdmZ.js → providerDriverMeta-DNTocCcU.js} +1 -1
  91. package/dist/client/assets/providerModels-bFbEIfL9.js +1 -0
  92. package/dist/client/assets/{qr-code-Bun4dpvz.js → qr-code-Bk1kdf_k.js} +1 -1
  93. package/dist/client/assets/qr-code-MAZkoKtL.js +1 -0
  94. package/dist/client/assets/radio-group-D-VCGinX.js +2 -0
  95. package/dist/client/assets/refresh-cw-DY3_Ph-S.js +1 -0
  96. package/dist/client/assets/runtime-Djy96GJd.js +17 -0
  97. package/dist/client/assets/save-ugJXuJRM.js +1 -0
  98. package/dist/client/assets/scroll-area-BMnGzd2a.js +1 -0
  99. package/dist/client/assets/scrollEdges-QLSFwGSQ.js +1 -0
  100. package/dist/client/assets/separator-BwUYkCkX.js +1 -0
  101. package/dist/client/assets/settingsLayout-C6SUmJVB.js +1 -0
  102. package/dist/client/assets/sheet-DLy4aeVa.js +1 -0
  103. package/dist/client/assets/shield-Zq_ygsnJ.js +1 -0
  104. package/dist/client/assets/shield-alert-DfUhTI4-.js +1 -0
  105. package/dist/client/assets/shield-check-CO4SMhAs.js +1 -0
  106. package/dist/client/assets/sidebar-DNnW-a2V.js +1 -0
  107. package/dist/client/assets/sidebarProjectFolders-ygpaKZM6.js +4 -0
  108. package/dist/client/assets/sidebarStatusText-CawrXnx0.js +1 -0
  109. package/dist/client/assets/skeleton-DRm4_OvB.js +1 -0
  110. package/dist/client/assets/smartphone-O2VACDhU.js +1 -0
  111. package/dist/client/assets/sparkles-isHutYWU.js +1 -0
  112. package/dist/client/assets/src-BSuAGqhK.js +14 -0
  113. package/dist/client/assets/star-7UHEnC3x.js +1 -0
  114. package/dist/client/assets/{switch-COrEGDkz.js → switch-DD1qVLgN.js} +9 -9
  115. package/dist/client/assets/toastHelpers-CSQRKo4F.js +1 -0
  116. package/dist/client/assets/toggle-CaKBNe6W.js +1 -0
  117. package/dist/client/assets/toggle-group-UeFeTI3u.js +1 -0
  118. package/dist/client/assets/tokenModePresentation-DV56ekA4.js +1 -0
  119. package/dist/client/assets/tooltip-DXvXxL37.js +1 -0
  120. package/dist/client/assets/unplug-DisTpujT.js +1 -0
  121. package/dist/client/assets/useAppSidebarCollapsed-CaAsLi1q.js +1 -0
  122. package/dist/client/assets/useBaseUiId-CJN4MvrU.js +1 -0
  123. package/dist/client/assets/useLabelableId-BsDFG9Oj.js +1 -0
  124. package/dist/client/assets/useNavigate-cLfxn_9L.js +1 -0
  125. package/dist/client/assets/usePhoneThreadActions-rekHL1Mi.js +1 -0
  126. package/dist/client/assets/usePopupViewport-kXU31P6l.js +1 -0
  127. package/dist/client/assets/useScrollLock-DjMxrUJe.js +1 -0
  128. package/dist/client/assets/{useStatistics-DfLU9_Qu.js → useStatistics-BYP-9CmW.js} +15 -15
  129. package/dist/client/assets/useTriggerFocusGuards-DuAm2B8C.js +1 -0
  130. package/dist/client/assets/useValueChanged-DreFjrMK.js +1 -0
  131. package/dist/client/assets/user-round-DctamWV6.js +1 -0
  132. package/dist/client/assets/{vscode-icons-Dgo7Sslf.js → vscode-icons-Dw-LGJAv.js} +1 -1
  133. package/dist/client/assets/{workspaceMetadataProjection-UiprkDbH.js → workspaceMetadataProjection-BL4sEIL2.js} +1 -1
  134. package/dist/client/assets/wrench-Ds8eZerZ.js +1 -0
  135. package/dist/client/index.html +1 -1
  136. package/dist/resource-monitor/ryco-resource-monitor +0 -0
  137. package/dist/resource-monitor/ryco-resource-monitor.exe +0 -0
  138. package/dist/resource-monitor/win32-arm64/ryco-resource-monitor.exe +0 -0
  139. package/dist/resource-monitor/win32-x64/ryco-resource-monitor.exe +0 -0
  140. package/package.json +1 -1
  141. package/dist/client/assets/AccountSettings-DGvZzAqN.js +0 -1
  142. package/dist/client/assets/AiFocusSettings-D8wZfNES.js +0 -1
  143. package/dist/client/assets/AppearanceSettings-BFo6g6_s.js +0 -1
  144. package/dist/client/assets/BranchToolbar.logic-CmO2U1U7.js +0 -1
  145. package/dist/client/assets/BrowserPanel-r6is5C3e.js +0 -1
  146. package/dist/client/assets/ChatRightPanel-BewXBRFZ.js +0 -194
  147. package/dist/client/assets/ChatThreadRouteView-CC_6FmHd.js +0 -1
  148. package/dist/client/assets/CommandPaletteDialog-ftA_Xg2G.js +0 -1
  149. package/dist/client/assets/CompositeRoot-arlgwzfX.js +0 -1
  150. package/dist/client/assets/ComputerUseSettings-V-oMtddy.js +0 -1
  151. package/dist/client/assets/ConnectionsSettings-BrFvrRjz.js +0 -7
  152. package/dist/client/assets/ContextHandoffEndpointLabel-CPeU4K5A.js +0 -4
  153. package/dist/client/assets/DiagnosticsSettings-Dk3JaIOU.js +0 -2
  154. package/dist/client/assets/DialogHandle-00ZXxxpz.js +0 -1
  155. package/dist/client/assets/DialogPopup-mazVJKyB.js +0 -1
  156. package/dist/client/assets/DialogRoot-CWlzx19Z.js +0 -1
  157. package/dist/client/assets/DialogTitle-CKaEtTky.js +0 -1
  158. package/dist/client/assets/DialogTrigger-CiElTNmo.js +0 -1
  159. package/dist/client/assets/DialogViewport-a5beR5bY.js +0 -1
  160. package/dist/client/assets/DraftChatThreadRouteView-DMwnSfgh.js +0 -1
  161. package/dist/client/assets/FloatingPortalLite-DWdtHKob.js +0 -1
  162. package/dist/client/assets/GlassSurface-BqfxDYiR.js +0 -1
  163. package/dist/client/assets/HostedConnectionControls-BmJd89CC.js +0 -1
  164. package/dist/client/assets/HostedHubRoot-CRIiJ67A.js +0 -2
  165. package/dist/client/assets/HostedNativeAuthorizationRoute-DcksCt9n.js +0 -2
  166. package/dist/client/assets/HostedRelayTrustNotice-C9pl5h2a.js +0 -1
  167. package/dist/client/assets/IntegrationsSettingsPanel-BnfjyLrM.js +0 -2
  168. package/dist/client/assets/KeybindingsSettings-CkW7lzvz.js +0 -7
  169. package/dist/client/assets/LazyBrowserPanel-C6uMUmoV.js +0 -2
  170. package/dist/client/assets/McpServersSettings-BdXgS-Pm.js +0 -6
  171. package/dist/client/assets/MobileSheet-D19YdeQ9.js +0 -1
  172. package/dist/client/assets/NodeSecuritySettings-BfcBgtEg.js +0 -1
  173. package/dist/client/assets/OpinionatedPluginsSettings-YY54IT7P.js +0 -1
  174. package/dist/client/assets/PhoneGetAppInterstitial-9r6NwJP8.js +0 -1
  175. package/dist/client/assets/PhoneHome-DnEJp0bU.js +0 -1
  176. package/dist/client/assets/PhoneSettingsSurface-NKJrLCxU.js +0 -2
  177. package/dist/client/assets/ProviderModelPicker-CYGv-4fE.js +0 -1
  178. package/dist/client/assets/ProvidersSettingsPanel-DsXHij4h.js +0 -1
  179. package/dist/client/assets/QuitShortcutFeedback-BVyYaNtd.js +0 -1
  180. package/dist/client/assets/RedactedSensitiveText-D8j7kpow.js +0 -1
  181. package/dist/client/assets/RootAppShell-D7c8sbA0.js +0 -7
  182. package/dist/client/assets/Separator-Bn8l1oSK.js +0 -1
  183. package/dist/client/assets/SettingsDialog-BlPX1mT8.js +0 -2
  184. package/dist/client/assets/SettingsPanels-CeuvwIV_.js +0 -3
  185. package/dist/client/assets/SettingsPanels.editor-CLJJeKLI.js +0 -1
  186. package/dist/client/assets/SourceControlSettings-D-GeZ6PW.js +0 -1
  187. package/dist/client/assets/StatisticsPage-poomFDoQ.js +0 -1
  188. package/dist/client/assets/StatisticsPanel-DbGgCCpZ.js +0 -1
  189. package/dist/client/assets/StatisticsSettingsLink-Brc9--O7.js +0 -1
  190. package/dist/client/assets/activity-Dy-wOS-S.js +0 -1
  191. package/dist/client/assets/alert-4WZo8oMe.js +0 -1
  192. package/dist/client/assets/arrow-left-gLRAasih.js +0 -1
  193. package/dist/client/assets/arrow-right-CAK2t4QL.js +0 -1
  194. package/dist/client/assets/arrow-up-right-DP0hmMEB.js +0 -1
  195. package/dist/client/assets/authorization-K_UCP_xh.js +0 -1
  196. package/dist/client/assets/badge-CYDyJZRJ.js +0 -1
  197. package/dist/client/assets/bot-CCrx5oCt.js +0 -1
  198. package/dist/client/assets/button-QrCU0tNP.js +0 -1
  199. package/dist/client/assets/chart-column-BvK6lSzG.js +0 -1
  200. package/dist/client/assets/chevron-down-yka18-iP.js +0 -1
  201. package/dist/client/assets/chevron-right-CHyIXx5W.js +0 -1
  202. package/dist/client/assets/clamp-D0kAXd-u.js +0 -1
  203. package/dist/client/assets/clipboard-copy-DfdkWOiT.js +0 -1
  204. package/dist/client/assets/copy-riIPLkKV.js +0 -1
  205. package/dist/client/assets/data-list-CsiYTho5.js +0 -1
  206. package/dist/client/assets/download-B0lbSdq5.js +0 -1
  207. package/dist/client/assets/editorPreferences-Cf2Smgu1.js +0 -1
  208. package/dist/client/assets/empty-CHk0OiOB.js +0 -1
  209. package/dist/client/assets/group-DfFZdj79.js +0 -1
  210. package/dist/client/assets/hostedConnectionCoordinator-DZh1yVqz.js +0 -1
  211. package/dist/client/assets/input-BAC5Cd3b.js +0 -1
  212. package/dist/client/assets/kbd-CMUW8K7b.js +0 -1
  213. package/dist/client/assets/key-round-Cm6itp2V.js +0 -1
  214. package/dist/client/assets/layers-DoDpJao_.js +0 -1
  215. package/dist/client/assets/loader-circle-D0CNb5GI.js +0 -1
  216. package/dist/client/assets/log-out-BuoOiS45.js +0 -1
  217. package/dist/client/assets/main-DaXSCt8g.js +0 -9
  218. package/dist/client/assets/monitor-Dyigmrl2.js +0 -1
  219. package/dist/client/assets/palette-kIM_geXk.js +0 -1
  220. package/dist/client/assets/play-Dh8XDMnw.js +0 -1
  221. package/dist/client/assets/primary-DjXNHNGV.js +0 -2
  222. package/dist/client/assets/providerModels-dpugJUmV.js +0 -1
  223. package/dist/client/assets/qr-code-CkI1p05P.js +0 -1
  224. package/dist/client/assets/radio-group-Hh0oQGyf.js +0 -2
  225. package/dist/client/assets/react-dom-x9LNwWQc.js +0 -1
  226. package/dist/client/assets/refresh-cw-MqmsC7V0.js +0 -1
  227. package/dist/client/assets/runtime-L56puJDA.js +0 -17
  228. package/dist/client/assets/save-BSB81i-r.js +0 -1
  229. package/dist/client/assets/scroll-area-DCGCzd6v.js +0 -1
  230. package/dist/client/assets/scrollEdges-DIzjkUJG.js +0 -1
  231. package/dist/client/assets/separator-YeH3P39x.js +0 -1
  232. package/dist/client/assets/settingsLayout-CmNqO2kB.js +0 -1
  233. package/dist/client/assets/settingsSections.logic-Bg960p_I.js +0 -1
  234. package/dist/client/assets/sheet-CTbjQ5Bv.js +0 -1
  235. package/dist/client/assets/shield-DlqCO-0N.js +0 -1
  236. package/dist/client/assets/shield-alert-BrZ-Rb8N.js +0 -1
  237. package/dist/client/assets/shield-check-DHxdM6te.js +0 -1
  238. package/dist/client/assets/sidebar-4cwEndEB.js +0 -1
  239. package/dist/client/assets/sidebarProjectFolders-C7WDwUYJ.js +0 -4
  240. package/dist/client/assets/sidebarStatusText-Cq_MMykN.js +0 -1
  241. package/dist/client/assets/skeleton-BlostfCS.js +0 -1
  242. package/dist/client/assets/smartphone-OaA-Xj_d.js +0 -1
  243. package/dist/client/assets/sparkles-BXwkPX2M.js +0 -1
  244. package/dist/client/assets/src-gDjuIvMO.js +0 -14
  245. package/dist/client/assets/star-BjaAYD-x.js +0 -1
  246. package/dist/client/assets/toast-C_F1LeME.js +0 -1
  247. package/dist/client/assets/toggle-BPNEBXg_.js +0 -1
  248. package/dist/client/assets/toggle-group-BC1zJ9xi.js +0 -1
  249. package/dist/client/assets/tokenModePresentation-DUJ8DMTy.js +0 -1
  250. package/dist/client/assets/tooltip-iy3_osu5.js +0 -1
  251. package/dist/client/assets/triangle-alert-YXqtFxD6.js +0 -1
  252. package/dist/client/assets/unplug-e3z4rXgY.js +0 -1
  253. package/dist/client/assets/useAppSidebarCollapsed-mtvJ7qbW.js +0 -1
  254. package/dist/client/assets/useLabelableId-NJQsKdL6.js +0 -1
  255. package/dist/client/assets/useNavigate-2tVq4iZ2.js +0 -1
  256. package/dist/client/assets/usePhoneThreadActions-97AsVVIR.js +0 -1
  257. package/dist/client/assets/usePopupViewport-8OM2irPK.js +0 -1
  258. package/dist/client/assets/usePositioner-0Kb-C4al.js +0 -1
  259. package/dist/client/assets/useRenderElement-D0HVF5g_.js +0 -1
  260. package/dist/client/assets/useRouter-CcIDS3PN.js +0 -1
  261. package/dist/client/assets/useScrollLock-AUqaSAkf.js +0 -1
  262. package/dist/client/assets/useSwipeDismiss-CcW-GPO_.js +0 -1
  263. package/dist/client/assets/useTriggerFocusGuards-ChBvppef.js +0 -1
  264. package/dist/client/assets/useValueChanged-CThCTn4h.js +0 -1
  265. package/dist/client/assets/user-round-evbX_eto.js +0 -1
  266. package/dist/client/assets/utils-5-6TOrS1.js +0 -1
  267. package/dist/client/assets/visuallyHidden-BRaogTVF.js +0 -1
  268. package/dist/client/assets/wrench-mA--bcId.js +0 -1
  269. package/dist/client/assets/x-_SjFRYll.js +0 -1
@@ -1,2 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{G as n,K as r}from"./primary-DjXNHNGV.js";import{t as i}from"./src-gDjuIvMO.js";import{$i as a,En as o,Fi as s,Gn as c,K as l,P as u,Pi as d,Qi as f,Ri as p,_i as m,ia as h,p as g,qi as _,ra as v,vi as y,yi as b}from"./runtime-L56puJDA.js";import{t as x}from"./compiler-runtime-qmuS0Svy.js";import{t as S}from"./authorization-K_UCP_xh.js";import{s as C}from"./hostedConnectionCoordinator-DZh1yVqz.js";import{f as w}from"./useRenderElement-D0HVF5g_.js";import{a as T,c as E,n as D,o as O,s as k,t as A}from"./badge-CYDyJZRJ.js";import{a as j,i as M,o as N}from"./toast-C_F1LeME.js";import{t as P}from"./clipboard-copy-DfdkWOiT.js";import{n as ee,t as te}from"./play-Dh8XDMnw.js";import{t as F}from"./refresh-cw-MqmsC7V0.js";import{t as I}from"./triangle-alert-YXqtFxD6.js";import{r as L}from"./editorPreferences-Cf2Smgu1.js";import{t as R}from"./button-QrCU0tNP.js";import{t as z}from"./utils-5-6TOrS1.js";import"./usePresentationTier-B_SCFvN7.js";import{i as B,r as V,t as H}from"./alert-4WZo8oMe.js";import{i as U,n as W,r as G}from"./settingsLayout-CmNqO2kB.js";var ne={name:`clipboard-check`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]};ne.node;var re=w(ne),K=e(t(),1),q=x();function ie(e){return!e.connected||e.role===`client`?!1:e.primary||e.role===`owner`}function ae(e){let t=(0,q.c)(16),n=v(),i=u(oe),a=C(),o;t[0]===n?o=t[1]:(o=e=>n?e.byId[n.environmentId]:void 0,t[0]=n,t[1]=o);let s=y(o),c,l;if(t[2]!==e||t[3]!==i.browserStatus||t[4]!==i.directoryStatus||t[5]!==i.effectiveRole||t[6]!==i.sessionStatus||t[7]!==i.transportStatus||t[8]!==n||t[9]!==a.machines){let o;t[12]===n?.environmentId?o=t[13]:(o=e=>e.environmentId===n?.environmentId,t[12]=n?.environmentId,t[13]=o);let s=a.machines.find(o);c=r(),l=S({hosted:c,role:s?s.effectiveRole:n&&!n.primary?null:i.effectiveRole,fresh:i.directoryStatus===`ready`&&(s?s.connectionState===`connected`&&s.canMutate&&s.cacheDisposition===`available`&&s.presence.online:i.transportStatus===`online`),browserCurrent:i.browserStatus===`current`,sessionReady:i.sessionStatus===`ready`,method:e}),t[2]=e,t[3]=i.browserStatus,t[4]=i.directoryStatus,t[5]=i.effectiveRole,t[6]=i.sessionStatus,t[7]=i.transportStatus,t[8]=n,t[9]=a.machines,t[10]=c,t[11]=l}else c=t[10],l=t[11];let d=l;if(!c&&n&&!ie({primary:n.primary,connected:n.connected&&(!s||s.connectionState===`connected`),role:s?.role})){let e;return t[14]===c?e=t[15]:(e={hosted:c,allowed:!1,reason:`Diagnostics require a connected owner session.`},t[14]=c,t[15]=e),e}return d}function oe(e){return e}function se(e){let t=!1,n=!1;return{async refresh(){if(!(t||n)){n=!0,e.onLoading(!0);try{let n=await e.fetch();t||e.onSuccess(n)}catch(n){t||e.onError(n)}finally{n=!1,t||e.onLoading(!1)}}},dispose(){t=!0}}}function ce(e,t){let n=new Map(e.map(e=>[e.identity.pid,e]));return e.filter(e=>{let r=new Set([e.identity.pid]),i=n.get(e.ppid);for(;i&&!r.has(i.identity.pid);){if(t.has(`${i.identity.pid}:${i.identity.startTimeMs}`))return!1;r.add(i.identity.pid),i=n.get(i.ppid)}return!0})}function le(e){return e===`failure`||e===`error`}function J(e){if(!Number.isFinite(e)||e<=0)return`0 B`;let t=[`B`,`KB`,`MB`,`GB`,`TB`],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||r===0?n.toFixed(0):n.toFixed(1)} ${t[r]}`}function Y(e){return!Number.isFinite(e)||e<=0?`0 ms`:e<1e3?`${Math.round(e)} ms`:e<6e4?`${(e/1e3).toFixed(+(e<1e4))} s`:`${(e/6e4).toFixed(1)} min`}function X(e){return e===void 0||!Number.isFinite(e)?`n/a`:`${Math.max(0,e).toFixed(1)}%`}function Z(e,t=Date.now()){let n=Date.parse(e);if(!Number.isFinite(n))return e;let r=Math.max(0,t-n);return r<1e3?`just now`:r<6e4?`${Math.floor(r/1e3)}s ago`:r<36e5?`${Math.floor(r/6e4)}m ago`:r<864e5?`${Math.floor(r/36e5)}h ago`:`${Math.floor(r/864e5)}d ago`}function ue(e){return e.map(e=>({label:e.sampledAt,value:e.memory.rssBytes}))}function de(e){return e.map(e=>({label:e.sampledAt,value:e.cpu.utilizationPercent??0}))}function fe(e){return e.map(e=>({label:e.label,value:e.count}))}function pe(e){return e.slice(0,8).map(e=>({label:e.name,value:e.count}))}function me(e){let t=e.failures.latest[0];return t?t.message:`No failures`}var Q=h(),he=[{label:`5m`,windowMs:3e5,bucketMs:15e3},{label:`15m`,windowMs:9e5,bucketMs:3e4},{label:`30m`,windowMs:18e5,bucketMs:6e4},{label:`1h`,windowMs:36e5,bucketMs:12e4}];function ge({telemetry:e,paused:t,refresh:n}){let r=v()?.environmentId,[a,o]=(0,K.useState)(0),[s,l]=(0,K.useState)(null),[u,d]=(0,K.useState)(null),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!0),[y,x]=(0,K.useState)(new Set),S=(0,K.useRef)(null),C=(0,K.useRef)(t);C.current=t;let w=ae(i.serverRetryResourceTelemetry),T=ae(i.serverGetResourceTelemetryHistory),E=he[a]??he[0],D=(0,K.useRef)(0);(0,K.useEffect)(()=>(D.current+=1,h(!1),()=>{D.current+=1}),[r]),(0,K.useEffect)(()=>{if(l(null),d(null),!T.allowed){p(!1);return}let e=se({fetch:async()=>{let e=r?c(r)?.server:b().server;if(!e?.getResourceTelemetryHistory)throw Error(`Resource history is unavailable on this server.`);return e.getResourceTelemetryHistory({windowMs:E.windowMs,bucketMs:E.bucketMs})},onSuccess:e=>{l(e),d(null)},onError:e=>d(e instanceof Error?e.message:`Resource history could not be refreshed.`),onLoading:p});S.current=e.refresh;let t=()=>{!C.current&&document.visibilityState===`visible`&&e.refresh()};t();let n=window.setInterval(t,5e3);return document.addEventListener(`visibilitychange`,t),()=>{e.dispose(),S.current=null,window.clearInterval(n),document.removeEventListener(`visibilitychange`,t)}},[r,E,T.allowed,T.reason]);async function O(){if(m||!w.allowed)return;let e=D.current;h(!0);try{let t=r?c(r)?.server:b().server;if(!t?.retryResourceTelemetry)throw Error(`Resource monitor retry is unavailable on this server.`);if(await t.retryResourceTelemetry(),e!==D.current)return;await n(),await S.current?.()}catch(t){e===D.current&&d(t instanceof Error?t.message:`Could not retry resource monitor.`)}finally{e===D.current&&h(!1)}}let k=e?.health,A=ce(e?.processes??[],y).filter(e=>g||e.cpuPercent>0||e.ioReadBytesPerSecond>0||e.ioWriteBytesPerSecond>0||e.category===`server`),j=s?.buckets??[],M=Math.max(1,...j.map(e=>e.maxCpuPercent)),N=Math.max(1,...j.map(e=>Math.max(e.ioReadBytes,e.ioWriteBytes))),P=Math.max(1,...j.map(e=>e.maxRssBytes));return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(U,{title:`Resource monitor`,headerAction:(0,Q.jsx)(R,{size:`xs`,variant:`outline`,disabled:m||!w.allowed,onClick:()=>void O(),children:m?`Retrying…`:`Retry monitor`}),children:[(0,Q.jsxs)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:[e?`Sampled ${Z(e.readAt)} · interval ${Y(e.sampleIntervalMs)}`:`Waiting for resource telemetry.`,` `,`CPU may exceed 100% across cores. I/O availability depends on the platform.`]}),(0,Q.jsx)(`dl`,{className:`grid grid-cols-2 divide-x divide-y border-t lg:grid-cols-3`,children:[[`Current CPU`,e?X(e.groups.allRyco.currentCpuPercent):`Loading…`],[`Resident memory`,e?J(e.groups.allRyco.currentRssBytes):`Loading…`],[`Process count`,e?String(e.groups.allRyco.processCount):`Loading…`],[`Read throughput`,e?`${J(e.groups.allRyco.ioReadBytesPerSecond)}/s`:`Loading…`],[`Write throughput`,e?`${J(e.groups.allRyco.ioWriteBytesPerSecond)}/s`:`Loading…`],[`CPU speed limit`,e?.speedLimitPercent==null?`Unknown`:`${e.speedLimitPercent}%`]].map(([e,t])=>(0,Q.jsxs)(`div`,{className:`px-4 py-4`,children:[(0,Q.jsx)(`dt`,{className:`text-[11px] font-medium uppercase tracking-wide text-muted-foreground`,children:e}),(0,Q.jsx)(`dd`,{className:`mt-2 text-2xl font-semibold tabular-nums`,children:t})]},e))}),(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full min-w-[850px] text-left text-xs [&_td]:px-4 [&_td]:py-3`,children:[(0,Q.jsx)(`thead`,{className:`border-y text-muted-foreground`,children:(0,Q.jsx)(`tr`,{children:[`Group`,`Processes`,`CPU / time`,`RSS / peak`,`Read / write rate`,`Read / write total`,`Starts / exits`].map(e=>(0,Q.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:e},e))})}),(0,Q.jsx)(`tbody`,{className:`divide-y`,children:e?Object.entries(e.groups).map(([e,t])=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{children:{allRyco:`All Ryco`,backend:`Backend + agents`,electron:`Desktop`,monitor:`Monitor overhead`}[e]??e}),(0,Q.jsx)(`td`,{children:t.processCount}),(0,Q.jsxs)(`td`,{children:[X(t.currentCpuPercent),(0,Q.jsx)(`div`,{children:Y(t.cpuTimeMs)})]}),(0,Q.jsxs)(`td`,{children:[J(t.currentRssBytes),(0,Q.jsx)(`div`,{children:J(t.peakRssBytes)})]}),(0,Q.jsxs)(`td`,{children:[J(t.ioReadBytesPerSecond),`/s`,(0,Q.jsxs)(`div`,{children:[J(t.ioWriteBytesPerSecond),`/s`]})]}),(0,Q.jsxs)(`td`,{children:[J(t.ioReadBytes),(0,Q.jsx)(`div`,{children:J(t.ioWriteBytes)})]}),(0,Q.jsxs)(`td`,{children:[t.processStarts,` / `,t.processExits]})]},e)):null})]})})]}),(0,Q.jsxs)(U,{title:`Host & collection`,children:[k?(0,Q.jsxs)(`div`,{className:`grid gap-3 border-t px-4 py-3 text-xs sm:grid-cols-2`,children:[[`native`,`desktop`].map(e=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsxs)(`strong`,{className:`capitalize`,children:[e,`: `,k[e].status]}),(0,Q.jsx)(`p`,{className:`mt-1 text-muted-foreground`,children:k[e].lastSampleAt?`Last sample ${Z(k[e].lastSampleAt)}`:`No sample`}),k[e].lastError?(0,Q.jsx)(`p`,{className:`mt-1 text-warning`,children:k[e].lastError}):null]},e)),(0,Q.jsxs)(`p`,{children:[`Monitor `,k.sidecarVersion??`version unavailable`,` · PID`,` `,k.sidecarPid??`unavailable`,` · `,k.restartCount,` restarts`]}),(0,Q.jsxs)(`p`,{children:[(k.collectionDurationMicros/1e3).toFixed(2),` ms collection ·`,` `,k.scannedProcessCount,` scanned · `,k.retainedProcessCount,` retained ·`,` `,k.inaccessibleProcessCount,` inaccessible`]})]}):null,(0,Q.jsxs)(`div`,{className:`border-t px-4 py-3 text-xs`,children:[(0,Q.jsx)(`h3`,{className:`text-xs font-medium`,children:`Power and background state`}),e?.power?(0,Q.jsx)(`dl`,{className:`mt-3 grid grid-cols-2 gap-3`,children:Object.entries(e.power).map(([e,t])=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:{idleState:`Idle state`,idleSeconds:`Idle seconds`,onBattery:`On battery`,thermalState:`Thermal state`,speedLimitPercent:`CPU speed limit (%)`,suspended:`Suspended`,lowPowerMode:`Low power mode`,locked:`Screen locked`,updatedAt:`Updated`,stale:`Stale`}[e]??e}),(0,Q.jsx)(`dd`,{children:t===null?`Unknown`:typeof t==`boolean`?t?`Yes`:`No`:String(t)})]},e))}):(0,Q.jsx)(`p`,{className:`mt-2 text-muted-foreground`,children:`Desktop power state is unavailable on this connection.`}),(0,Q.jsxs)(`p`,{className:`mt-2`,children:[`CPU speed limit:`,` `,e?.speedLimitPercent==null?`Unknown`:`${e.speedLimitPercent}%`]})]})]}),(0,Q.jsxs)(U,{title:`Resource timeline`,headerAction:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`div`,{role:`group`,"aria-label":`Resource history period`,className:`flex gap-1`,children:he.map((e,t)=>(0,Q.jsx)(R,{size:`xs`,variant:a===t?`secondary`:`outline`,"aria-pressed":a===t,onClick:()=>o(t),children:e.label},e.label))}),(0,Q.jsx)(R,{size:`xs`,variant:`outline`,disabled:f,onClick:()=>void S.current?.(),children:`Refresh`})]}),children:[u?(0,Q.jsx)(`p`,{role:`alert`,className:`px-4 py-3 text-xs text-destructive`,children:u}):null,(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:s?`${s.totalCpuTimeMs===void 0?`Unavailable`:Y(s.totalCpuTimeMs)} total CPU time · ${s.retainedSampleCount} retained samples · ${Y(s.sampleIntervalMs)} sampling interval · checked ${Z(s.readAt)}`:`Collecting resource history…`}),(0,Q.jsx)(`div`,{className:`grid gap-4 px-4 pb-4 sm:grid-cols-2`,children:[`cpu`,`memory`,`read`,`write`].map(e=>(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium`,children:e===`cpu`?`CPU average / peak`:e===`memory`?`Peak RSS`:e===`read`?`I/O reads`:`I/O writes`}),(0,Q.jsx)(`svg`,{viewBox:`0 0 400 100`,role:`img`,"aria-label":e===`cpu`?`CPU history`:e===`memory`?`Memory history`:e===`read`?`I/O read history`:`I/O write history`,className:`h-24 w-full text-info`,children:j.map((t,n)=>{let r=e===`cpu`?t.maxCpuPercent/M:e===`memory`?t.maxRssBytes/P:(e===`read`?t.ioReadBytes:t.ioWriteBytes)/N,i=t.avgCpuPercent/M;return(0,Q.jsxs)(`g`,{children:[(0,Q.jsxs)(`title`,{children:[new Date(t.startedAt).toLocaleTimeString(),`: average`,` `,X(t.avgCpuPercent),`, peak`,` `,X(t.maxCpuPercent),`, RSS `,J(t.maxRssBytes),`, read `,J(t.ioReadBytes),`, write`,` `,J(t.ioWriteBytes),`, `,t.maxProcessCount,` processes`]}),(0,Q.jsx)(`rect`,{x:n*400/Math.max(1,j.length),y:100-r*100,width:Math.max(1,400/Math.max(1,j.length)-2),height:r*100,fill:`currentColor`,opacity:e===`cpu`?.3:1}),e===`cpu`?(0,Q.jsx)(`rect`,{x:n*400/Math.max(1,j.length),y:100-i*100,width:Math.max(1,400/Math.max(1,j.length)-2),height:i*100,fill:`currentColor`}):null]},t.startedAt)})}),(0,Q.jsxs)(`p`,{className:`text-[11px] text-muted-foreground`,children:[`Scale:`,` `,e===`cpu`?X(M):J(e===`memory`?P:N)]})]},e))}),(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full min-w-[850px] text-left text-xs [&_td]:px-4 [&_td]:py-3`,children:[(0,Q.jsx)(`thead`,{className:`border-y text-muted-foreground`,children:(0,Q.jsx)(`tr`,{children:[`Process`,`CPU avg / peak`,`CPU time`,`RSS / peak`,`I/O read / write`,`Samples / last seen`].map(e=>(0,Q.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:e},e))})}),(0,Q.jsx)(`tbody`,{className:`divide-y`,children:s?.topProcesses.map(e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsxs)(`td`,{children:[(0,Q.jsxs)(`details`,{children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer`,children:[e.name,` (`,e.identity.pid,`)`]}),(0,Q.jsx)(`p`,{className:`max-w-72 break-all font-mono`,children:e.command})]}),(0,Q.jsx)(`div`,{className:`text-muted-foreground`,children:e.category})]}),(0,Q.jsxs)(`td`,{children:[X(e.avgCpuPercent),` / `,X(e.maxCpuPercent)]}),(0,Q.jsx)(`td`,{children:Y(e.cpuTimeMs)}),(0,Q.jsxs)(`td`,{children:[J(e.currentRssBytes),` / `,J(e.peakRssBytes)]}),(0,Q.jsx)(`td`,{children:e.ioSemantics===`unavailable`?`Unavailable`:`${J(e.ioReadBytes)} / ${J(e.ioWriteBytes)}`}),(0,Q.jsxs)(`td`,{children:[e.sampleCount,` · `,Z(e.lastSeenAt)]})]},`${e.identity.pid}:${e.identity.startTimeMs}`))})]})})]}),(0,Q.jsxs)(U,{title:`Live process tree`,headerAction:(0,Q.jsx)(R,{size:`xs`,variant:`outline`,"aria-pressed":g,onClick:()=>_(e=>!e),children:g?`Hide idle processes`:`Show idle processes`}),children:[(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full min-w-[1000px] text-left text-xs [&_td]:px-4 [&_td]:py-3 [&_td]:align-top`,children:[(0,Q.jsx)(`thead`,{className:`border-b text-muted-foreground`,children:(0,Q.jsx)(`tr`,{children:[`Process / category`,`PID / parent`,`CPU / time`,`RSS / peak / virtual`,`I/O rate / semantics`,`Wakeups / uptime`].map(e=>(0,Q.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:e},e))})}),(0,Q.jsx)(`tbody`,{className:`divide-y`,children:A.map(e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsxs)(`td`,{className:`max-w-80`,children:[(0,Q.jsxs)(`div`,{style:{paddingLeft:Math.min(e.depth,8)*10},children:[e.childPids.length>0?(0,Q.jsx)(R,{size:`xs`,variant:`ghost`,"aria-label":`${y.has(`${e.identity.pid}:${e.identity.startTimeMs}`)?`Expand`:`Collapse`} ${e.name} children`,"aria-expanded":!y.has(`${e.identity.pid}:${e.identity.startTimeMs}`),onClick:()=>x(t=>{let n=new Set(t),r=`${e.identity.pid}:${e.identity.startTimeMs}`;return n.has(r)?n.delete(r):n.add(r),n}),children:y.has(`${e.identity.pid}:${e.identity.startTimeMs}`)?`+`:`−`}):null,(0,Q.jsxs)(`details`,{children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer break-all`,children:e.name}),(0,Q.jsx)(`p`,{className:`mt-2 break-all font-mono`,children:e.command}),(0,Q.jsxs)(`p`,{children:[`First seen `,Z(e.firstSeenAt),` · last seen`,` `,Z(e.lastSeenAt)]})]})]}),(0,Q.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[e.category,` `,e.electronType,` `,e.electronServiceName,` ·`,` `,e.status]})]}),(0,Q.jsxs)(`td`,{children:[e.identity.pid,` / `,e.ppid]}),(0,Q.jsxs)(`td`,{children:[X(e.cpuPercent),(0,Q.jsx)(`div`,{children:Y(e.cpuTimeMs)})]}),(0,Q.jsxs)(`td`,{children:[J(e.residentBytes),(0,Q.jsx)(`div`,{children:J(e.peakResidentBytes)}),(0,Q.jsx)(`div`,{children:J(e.virtualBytes)})]}),(0,Q.jsxs)(`td`,{children:[e.ioSemantics===`unavailable`?`Unavailable`:(0,Q.jsxs)(Q.Fragment,{children:[J(e.ioReadBytesPerSecond),`/s read`,(0,Q.jsxs)(`div`,{children:[J(e.ioWriteBytesPerSecond),`/s write`]}),(0,Q.jsxs)(`div`,{children:[J(e.ioReadBytes),` / `,J(e.ioWriteBytes),` `,`total`]})]}),(0,Q.jsx)(`div`,{className:`text-muted-foreground`,children:e.ioSemantics})]}),(0,Q.jsxs)(`td`,{children:[e.idleWakeupsPerSecond==null?`Unavailable`:`${e.idleWakeupsPerSecond.toFixed(1)}/s`,(0,Q.jsx)(`div`,{children:Y(e.runTimeMs)})]})]},`${e.identity.pid}:${e.identity.startTimeMs}`))})]})}),A.length===0?(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`No active processes in this sample. Show idle processes to include retained idle entries.`}):null]}),(0,Q.jsxs)(U,{title:`Instrumented application I/O`,children:[(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`Application read/write counters describe logical work and are separate from operating-system storage bytes.`}),(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full min-w-[650px] text-left text-xs [&_td]:px-4 [&_td]:py-3`,children:[(0,Q.jsx)(`thead`,{className:`border-y text-muted-foreground`,children:(0,Q.jsx)(`tr`,{children:[`Component / operation`,`Read`,`Write`,`Count`,`Duration`].map(e=>(0,Q.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:e},e))})}),(0,Q.jsx)(`tbody`,{className:`divide-y`,children:e?.attribution.entries.map(e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsxs)(`td`,{children:[e.component,` / `,e.operation]}),(0,Q.jsx)(`td`,{children:J(e.logicalReadBytes)}),(0,Q.jsx)(`td`,{children:J(e.logicalWriteBytes)}),(0,Q.jsx)(`td`,{children:e.count}),(0,Q.jsx)(`td`,{children:Y(e.durationMs)})]},`${e.component}:${e.operation}`))})]})}),e?.attribution.entries.length?null:(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`No logical I/O attribution captured.`})]})]})}function _e({snapshot:e,refresh:t}){let n=v(),r=ae(i.serverSignalDiagnosticProcess),[a,o]=(0,K.useState)(null),[s,l]=(0,K.useState)(null),u=(0,K.useRef)({target:n,snapshot:e,allowed:!1}),d=(0,K.useRef)(!1),f=(0,K.useRef)(!0),p=r.allowed;u.current={target:n,snapshot:e,allowed:p},(0,K.useEffect)(()=>(f.current=!0,()=>{f.current=!1}),[]);async function m(e,n){if(d.current||!u.current.allowed)return;let r=u.current.target?.environmentId;d.current=!0,o(e.pid),l(null);try{if(!await b().dialogs.confirm(`${n===`SIGKILL`?`Force kill`:`Interrupt`} process ${e.pid} (${e.command})? ${n===`SIGKILL`?`Unsaved work may be lost.`:`This may stop an active agent or terminal task.`}`)||!f.current||!u.current.allowed||u.current.target?.environmentId!==r)return;if(!u.current.snapshot?.processTree?.processes.find(t=>t.pid===e.pid&&t.startTimeMs===e.startTimeMs)){l(`Process already exited or changed. Refresh diagnostics.`);return}let i=r?c(r)?.server:b().server;if(!i?.signalDiagnosticProcess)throw Error(`Process controls are unavailable on this server.`);let a=await i.signalDiagnosticProcess({pid:e.pid,startTimeMs:e.startTimeMs,signal:n});if(!f.current||u.current.target?.environmentId!==r)return;l(a.signaled?`${n} sent to process ${e.pid}.`:a.message??`Process already exited or is no longer a server child.`),await t()}catch(e){f.current&&u.current.target?.environmentId===r&&l(e instanceof Error?e.message:`Could not signal process.`)}finally{d.current=!1,f.current&&o(null)}}let h=e?.processTree;return(0,Q.jsxs)(U,{title:`Live descendant processes`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-4 px-4 py-4 text-xs lg:grid-cols-4`,children:[(0,Q.jsxs)(`div`,{children:[`Child processes`,(0,Q.jsx)(`div`,{className:`mt-1 font-mono`,children:h?.processes.length??`Unavailable`})]}),(0,Q.jsxs)(`div`,{children:[`Child CPU`,(0,Q.jsx)(`div`,{className:`mt-1 font-mono`,children:X(h?.totalCpuPercent)})]}),(0,Q.jsxs)(`div`,{children:[`Child RSS`,(0,Q.jsx)(`div`,{className:`mt-1 font-mono`,children:h?J(h.totalRssBytes):`Unavailable`})]}),(0,Q.jsxs)(`div`,{children:[`Server PID`,(0,Q.jsx)(`div`,{className:`mt-1 font-mono`,children:h?.serverPid??e?.liveProcesses.server.pid??`Unavailable`})]})]}),(0,Q.jsxs)(`p`,{className:`px-4 pb-3 text-xs text-muted-foreground`,children:[`Live children of the selected server. The server and desktop shell are excluded.`,` `,h?`Checked ${Z(h.readAt)}.`:`This server has not supplied process diagnostics.`]}),h?.error?(0,Q.jsx)(`p`,{role:`alert`,className:`px-4 pb-3 text-xs text-destructive`,children:h.error}):null,s?(0,Q.jsx)(`p`,{role:`status`,className:`px-4 pb-3 text-xs`,children:s}):null,p?null:(0,Q.jsx)(`p`,{className:`px-4 pb-3 text-xs text-muted-foreground`,children:r.reason??`Process controls require a connected owner session.`}),(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full min-w-[760px] text-left text-xs [&_td]:px-4 [&_td]:py-3 [&_td]:align-top`,children:[(0,Q.jsx)(`thead`,{className:`border-y text-muted-foreground`,children:(0,Q.jsx)(`tr`,{children:[`Process`,`PID / Parent`,`CPU`,`RSS`,`Status / Age`,`Actions`].map(e=>(0,Q.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:e},e))})}),(0,Q.jsx)(`tbody`,{className:`divide-y divide-border/60`,children:h?.processes.map(e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{className:`max-w-96`,children:(0,Q.jsxs)(`details`,{style:{marginLeft:Math.min(e.depth,8)*10},children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer break-all`,children:e.command.split(/[\\/]/).at(-1)||`Process`}),(0,Q.jsx)(`div`,{className:`mt-2 break-all font-mono`,children:e.command}),(0,Q.jsxs)(`div`,{className:`mt-1 text-muted-foreground`,children:[e.childPids.length,` children · Started`,` `,new Date(e.startTimeMs).toLocaleString()]})]})}),(0,Q.jsxs)(`td`,{className:`font-mono`,children:[e.pid,` / `,e.ppid]}),(0,Q.jsx)(`td`,{children:X(e.cpuPercent)}),(0,Q.jsx)(`td`,{children:J(e.rssBytes)}),(0,Q.jsxs)(`td`,{children:[e.status,(0,Q.jsx)(`div`,{className:`mt-1 text-muted-foreground`,children:e.elapsed})]}),(0,Q.jsx)(`td`,{children:(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(R,{size:`xs`,variant:`outline`,disabled:!p||a!==null,onClick:()=>void m(e,`SIGINT`),children:`Interrupt`}),(0,Q.jsx)(R,{size:`xs`,variant:`outline`,disabled:!p||a!==null,onClick:()=>void m(e,`SIGKILL`),children:`Force kill`})]})})]},`${e.pid}:${e.startTimeMs}`))})]})}),h?.processes.length===0?(0,Q.jsx)(`p`,{className:`px-4 py-4 text-sm text-muted-foreground`,children:`No live descendant processes.`}):null]})}function ve(e){let t=(0,q.c)(11),{value:n}=e,{copyToClipboard:r,isCopied:i}=N(),a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`code`,{className:`break-all text-[11px]`,children:n}),t[0]=n,t[1]=a);let o;t[2]!==r||t[3]!==n?(o=()=>r(n,void 0),t[2]=r,t[3]=n,t[4]=o):o=t[4];let s=i?`Copied`:`Copy`,c;t[5]!==o||t[6]!==s?(c=(0,Q.jsx)(R,{size:`xs`,variant:`ghost`,"aria-label":`Copy trace ID`,onClick:o,children:s}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;return t[8]!==a||t[9]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[a,c]}),t[8]=a,t[9]=c,t[10]=l):l=t[10],l}function ye(e){let t=(0,q.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=n.length>180?(0,Q.jsxs)(`details`,{children:[(0,Q.jsxs)(`summary`,{className:`cursor-pointer break-words`,children:[n.slice(0,180),`…`]}),(0,Q.jsx)(`pre`,{className:`mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words font-sans`,children:n})]}):(0,Q.jsx)(`span`,{className:`break-words`,children:n}),t[0]=n,t[1]=r),r}function be(e){let t=(0,q.c)(10),{headers:n,children:r,empty:i}=e;if(i){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`px-4 py-4 text-sm text-muted-foreground`,children:`No retained records.`}),t[0]=e):e=t[0],e}let a;t[1]===n?a=t[2]:(a=n.map(xe),t[1]=n,t[2]=a);let o;t[3]===a?o=t[4]:(o=(0,Q.jsx)(`thead`,{className:`border-b text-muted-foreground`,children:(0,Q.jsx)(`tr`,{children:a})}),t[3]=a,t[4]=o);let s;t[5]===r?s=t[6]:(s=(0,Q.jsx)(`tbody`,{className:`divide-y divide-border/60`,children:r}),t[5]=r,t[6]=s);let c;return t[7]!==o||t[8]!==s?(c=(0,Q.jsx)(`div`,{className:`overflow-x-auto`,children:(0,Q.jsxs)(`table`,{className:`w-full min-w-[680px] text-left text-xs [&_td]:px-4 [&_td]:py-3 [&_td]:align-top`,children:[o,s]})}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function xe(e){return(0,Q.jsx)(`th`,{className:`px-4 py-2 font-medium`,children:e},e)}function Se(e){let t=(0,q.c)(84),{snapshot:n,nowMs:r}=e,i=n?.tracing.summary,a;t[0]===n?.tracing.topSpanNames?a=t[1]:(a=n?.tracing.topSpanNames??[],t[0]=n?.tracing.topSpanNames,t[1]=a);let o=a,s;t[2]===n?.failures.common?s=t[3]:(s=n?.failures.common??[],t[2]=n?.failures.common,t[3]=s);let c=s,l;t[4]===i?.latestWarningAndErrorLogs?l=t[5]:(l=i?.latestWarningAndErrorLogs??[],t[4]=i?.latestWarningAndErrorLogs,t[5]=l);let u=l,d=n?.tracing.retainedSpanCount,f;t[6]===d?f=t[7]:(f=[`Retained spans`,d],t[6]=d,t[7]=f);let p=i?.failureCount,m;t[8]===p?m=t[9]:(m=[`Failures`,p],t[8]=p,t[9]=m);let h=i?.interruptionCount,g;t[10]===h?g=t[11]:(g=[`Interrupted spans`,h],t[10]=h,t[11]=g);let _=i?.slowSpanCount,v;t[12]===_?v=t[13]:(v=[`Slow spans`,_],t[12]=_,t[13]=v);let y=i?.parseErrorCount,b;t[14]===y?b=t[15]:(b=[`Parse errors`,y],t[14]=y,t[15]=b);let x;t[16]===i?x=t[17]:(x=i?Y(i.slowSpanThresholdMs):void 0,t[16]=i,t[17]=x);let S;t[18]===x?S=t[19]:(S=[`Slow threshold`,x],t[18]=x,t[19]=S);let C;t[20]!==r||t[21]!==i?(C=i?.firstSpanAt?Z(i.firstSpanAt,r):void 0,t[20]=r,t[21]=i,t[22]=C):C=t[22];let w;t[23]===C?w=t[24]:(w=[`First span`,C],t[23]=C,t[24]=w);let T;t[25]!==r||t[26]!==i?(T=i?.lastSpanAt?Z(i.lastSpanAt,r):void 0,t[25]=r,t[26]=i,t[27]=T):T=t[27];let E;t[28]===T?E=t[29]:(E=[`Last span`,T],t[28]=T,t[29]=E);let D;t[30]!==v||t[31]!==b||t[32]!==S||t[33]!==w||t[34]!==E||t[35]!==f||t[36]!==m||t[37]!==g?(D=(0,Q.jsx)(`dl`,{className:`grid grid-cols-2 gap-4 px-4 py-4 text-xs lg:grid-cols-4`,children:[f,m,g,v,b,S,w,E].map(Ee)}),t[30]=v,t[31]=b,t[32]=S,t[33]=w,t[34]=E,t[35]=f,t[36]=m,t[37]=g,t[38]=D):D=t[38];let O;t[39]===i?.partialFailure?O=t[40]:(O=i?.partialFailure?(0,Q.jsx)(`p`,{className:`px-4 pb-3 text-xs text-warning`,children:`Some trace files could not be read. These results are incomplete.`}):null,t[39]=i?.partialFailure,t[40]=O);let k;t[41]===i?k=t[42]:(k=i?(0,Q.jsxs)(`details`,{className:`border-t px-4 py-3 text-xs`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:`Collection details`}),(0,Q.jsxs)(`div`,{className:`mt-2 space-y-2`,children:[(0,Q.jsxs)(`p`,{children:[`Log levels:`,` `,Object.entries(i.logLevelCounts).map(Te).join(` · `)||`None`]}),i.scannedFilePaths.map(we)]})]}):null,t[41]=i,t[42]=k);let A;t[43]!==D||t[44]!==O||t[45]!==k?(A=(0,Q.jsxs)(U,{title:`Trace diagnostics`,children:[D,O,k]}),t[43]=D,t[44]=O,t[45]=k,t[46]=A):A=t[46];let j;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(j=[`Source / category`,`Count`,`Cause`,`Last seen`],t[47]=j):j=t[47];let M=c.length===0,N;if(t[48]!==c||t[49]!==r){let e;t[51]===r?e=t[52]:(e=e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsxs)(`td`,{children:[e.source,(0,Q.jsx)(`div`,{className:`text-muted-foreground`,children:e.category})]}),(0,Q.jsx)(`td`,{className:`font-mono`,children:e.count}),(0,Q.jsx)(`td`,{className:`max-w-96`,children:(0,Q.jsx)(ye,{children:e.sampleMessage})}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap`,children:Z(e.latestAt,r)})]},`${e.source}:${e.signature}`),t[51]=r,t[52]=e),N=c.map(e),t[48]=c,t[49]=r,t[50]=N}else N=t[50];let P;t[53]!==M||t[54]!==N?(P=(0,Q.jsx)(U,{title:`Most common failures`,children:(0,Q.jsx)(be,{headers:j,empty:M,children:N})}),t[53]=M,t[54]=N,t[55]=P):P=t[55];let ee;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(ee=[`Time`,`Level`,`Span`,`Message`,`Trace`],t[56]=ee):ee=t[56];let te=u.length===0,F;if(t[57]!==u||t[58]!==r){let e;t[60]===r?e=t[61]:(e=e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{className:`whitespace-nowrap`,children:Z(e.seenAt,r)}),(0,Q.jsx)(`td`,{children:e.level}),(0,Q.jsx)(`td`,{children:e.spanName}),(0,Q.jsx)(`td`,{className:`max-w-96`,children:(0,Q.jsx)(ye,{children:e.message})}),(0,Q.jsx)(`td`,{children:(0,Q.jsx)(ve,{value:e.traceId})})]},`${e.traceId}:${e.spanId}:${e.seenAt}:${e.level}:${e.message}`),t[60]=r,t[61]=e),F=u.map(e),t[57]=u,t[58]=r,t[59]=F}else F=t[59];let I;t[62]!==te||t[63]!==F?(I=(0,Q.jsx)(U,{title:`Span warning and error logs`,children:(0,Q.jsx)(be,{headers:ee,empty:te,children:F})}),t[62]=te,t[63]=F,t[64]=I):I=t[64];let L;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(L=[`Span`,`Count`,`Failures`,`Average`,`Maximum`,`Total`],t[65]=L):L=t[65];let R=o.length===0,z;t[66]===o?z=t[67]:(z=o.map(Ce),t[66]=o,t[67]=z);let B;t[68]!==R||t[69]!==z?(B=(0,Q.jsx)(U,{title:`Top span names`,children:(0,Q.jsx)(be,{headers:L,empty:R,children:z})}),t[68]=R,t[69]=z,t[70]=B):B=t[70];let V;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(V=[`Span`,`Status`,`Duration`,`Ended`,`Trace`],t[71]=V):V=t[71];let H=!n?.tracing.recentSpans.length,W;t[72]!==r||t[73]!==n?.tracing.recentSpans?(W=n?.tracing.recentSpans.map(e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsxs)(`td`,{children:[e.name,e.failureMessage?(0,Q.jsx)(`div`,{className:`mt-1 text-destructive`,children:(0,Q.jsx)(ye,{children:e.failureMessage})}):null]}),(0,Q.jsx)(`td`,{children:e.status}),(0,Q.jsx)(`td`,{children:Y(e.durationMs)}),(0,Q.jsx)(`td`,{className:`whitespace-nowrap`,children:Z(e.endTime,r)}),(0,Q.jsx)(`td`,{children:(0,Q.jsx)(ve,{value:e.traceId})})]},e.id)),t[72]=r,t[73]=n?.tracing.recentSpans,t[74]=W):W=t[74];let G;t[75]!==H||t[76]!==W?(G=(0,Q.jsx)(U,{title:`Recent spans`,children:(0,Q.jsx)(be,{headers:V,empty:H,children:W})}),t[75]=H,t[76]=W,t[77]=G):G=t[77];let ne;return t[78]!==A||t[79]!==P||t[80]!==I||t[81]!==B||t[82]!==G?(ne=(0,Q.jsxs)(Q.Fragment,{children:[A,P,I,B,G]}),t[78]=A,t[79]=P,t[80]=I,t[81]=B,t[82]=G,t[83]=ne):ne=t[83],ne}function Ce(e){return(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`td`,{children:e.name}),(0,Q.jsx)(`td`,{children:e.count}),(0,Q.jsx)(`td`,{children:e.failureCount}),(0,Q.jsx)(`td`,{children:Y(e.averageDurationMs)}),(0,Q.jsx)(`td`,{children:Y(e.maxDurationMs)}),(0,Q.jsx)(`td`,{children:Y(e.totalDurationMs)})]},e.name)}function we(e){return(0,Q.jsx)(`p`,{className:`break-all font-mono`,children:e},e)}function Te(e){let[t,n]=e;return`${t}: ${n}`}function Ee(e){let[t,n]=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:t}),(0,Q.jsx)(`dd`,{className:`mt-1 font-mono`,children:n??`Unavailable`})]},t)}var De=/token|secret|password|passwd|credential|authorization|bearer|api[-_]?key|cookie|session|private[-_]?key|pairing[-_]?code|access[-_]?key|signature|email|proof|ticket/iu;function Oe(e){return e.replace(/-----BEGIN [^-]*PRIVATE KEY-----[\s\S]*?(?:-----END [^-]*PRIVATE KEY-----|$)/gu,`[redacted]`).replace(/\bBearer\s+[^\s,;"']+/giu,`Bearer [redacted]`).replace(/\b(?:sk-[A-Za-z0-9_-]{8,}|gh[pousr]_[A-Za-z0-9_]{8,}|github_pat_[A-Za-z0-9_]+)\b/gu,`[redacted]`).replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/gu,`[redacted]`).replace(/\b((?:access[-_]?token|refresh[-_]?token|token|secret|password|passwd|credential|authorization|api[-_]?key|cookie|pairing[-_]?code|proof|ticket)\s*[=:]\s*)(?:"[^"]*"|'[^']*'|[^\s,;&]+)/giu,`$1[redacted]`).replace(/https?:\/\/[^\s<>"']+/giu,e=>{try{let t=new URL(e);t.username=``,t.password=``,t.hash=``;for(let e of t.searchParams.keys())/token|secret|password|credential|authorization|key|cookie|proof|ticket|signature|code/iu.test(e)&&t.searchParams.set(e,`[redacted]`);return t.toString()}catch{return`[redacted URL]`}})}var ke=`[redacted]`,Ae=De;function je(e){let t;try{t=new URL(e)}catch{return e}(t.username||t.password)&&(t.username=``,t.password=``);for(let e of t.searchParams.keys())Ae.test(e)&&t.searchParams.set(e,ke);return t.toString()}function Me(e){return Ne(e,!1)}function Ne(e,t){if(t)return e==null?e:ke;if(typeof e==`string`)return Oe(je(e));if(Array.isArray(e))return e.map(e=>Ne(e,!1));if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=Ne(r,Ae.test(n));return t}return e}function Pe(e){return Me({generatedAt:e.generatedAt,app:e.app,environments:e.environments.map(e=>({environmentId:e.environmentId,label:e.record?.label??null,connectionState:e.runtime?.connectionState??null,authState:e.runtime?.authState??null,role:e.runtime?.role??null,lastError:e.runtime?.lastError??null,lastErrorAt:e.runtime?.lastErrorAt??null,connectedAt:e.runtime?.connectedAt??null,disconnectedAt:e.runtime?.disconnectedAt??null,pushSequence:e.pushSequence})),providers:e.providers.map(e=>({instanceId:e.instanceId,driver:e.driver,enabled:e.enabled,installed:e.installed,version:e.version,status:e.status,availability:e.availability??`available`,authStatus:e.auth.status,authType:e.auth.type??null,message:e.message??null,unavailableReason:e.unavailableReason??null,checkedAt:e.checkedAt})),observability:e.observability?{logsDirectoryConfigured:e.observability.logsDirectoryPath.length>0,localTracingEnabled:e.observability.localTracingEnabled,otlpTracesEnabled:e.observability.otlpTracesEnabled,otlpMetricsEnabled:e.observability.otlpMetricsEnabled,localMetrics:e.observability.localMetrics?{turnQuiescenceAvgMs:e.observability.localMetrics.turnQuiescenceAvgMs,checkpointDurationP95Ms:e.observability.localMetrics.checkpointDurationP95Ms,wsReconnectCount:e.observability.localMetrics.wsReconnectCount,capturedAt:e.observability.localMetrics.capturedAt}:null}:null,performance:e.performance?{local:{turnQuiescenceAvgMs:e.performance.local.turnQuiescenceAvgMs,checkpointDurationP95Ms:e.performance.local.checkpointDurationP95Ms,latestThreadSnapshotDurationMs:e.performance.local.latestThreadSnapshotDurationMs,threadSnapshotDurationP95Ms:e.performance.local.threadSnapshotDurationP95Ms,wsReconnectCount:e.performance.local.wsReconnectCount,windowSampleCounts:{...e.performance.local.windowSampleCounts},capturedAt:e.performance.local.capturedAt},queues:{...e.performance.queues},traceSink:e.performance.traceSink?{...e.performance.traceSink}:null,snapshotCollectionDurationMs:e.performance.snapshotCollectionDurationMs}:null})}function Fe(e){return JSON.stringify(e,null,2)}function Ie(e){return(e?.gapCount??0)>0}var Le={connected:`bg-success`,connecting:`bg-warning`,error:`bg-destructive`,disconnected:`bg-muted-foreground/40`},Re={ready:`bg-success`,warning:`bg-warning`,error:`bg-destructive`,disabled:`bg-muted-foreground/40`};function ze(e){let t=(0,q.c)(4),{className:n}=e,r;t[0]===n?r=t[1]:(r=z(`inline-block size-2 shrink-0 rounded-full`,n),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`span`,{className:r,"aria-hidden":!0}),t[2]=r,t[3]=i),i}function Be(e){if(!e)return`No push events observed yet.`;let t=[`last #${e.highestSequence??`—`}`,`${e.eventCount} events`,`${e.snapshotCount} snapshots`];return e.gapCount>0?t.push(`${e.gapCount} gap${e.gapCount===1?``:`s`}`):t.push(`no gaps`),t.join(` · `)}function Ve(e){let t=(0,q.c)(25),{environmentId:n,record:r,runtime:i,pushSequence:a}=e,o=i?.connectionState??`disconnected`,s=r?.label??n,c=Ie(a),l=Le[o]??`bg-muted-foreground/40`,u;t[0]===l?u=t[1]:(u=(0,Q.jsx)(ze,{className:l}),t[0]=l,t[1]=u);let d;t[2]!==s||t[3]!==u?(d=(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[u,s]}),t[2]=s,t[3]=u,t[4]=d):d=t[4];let f=i?.authState?` · auth ${i.authState}`:``,p=i?.role?` · ${i.role}`:``,m;t[5]!==o||t[6]!==f||t[7]!==p?(m=(0,Q.jsxs)(`span`,{className:`block`,children:[`WS `,o,f,p]}),t[5]=o,t[6]=f,t[7]=p,t[8]=m):m=t[8];let h=c?`text-warning`:`text-muted-foreground/70`,g;t[9]===h?g=t[10]:(g=z(`block`,h),t[9]=h,t[10]=g);let _;t[11]===a?_=t[12]:(_=Be(a),t[11]=a,t[12]=_);let v;t[13]!==g||t[14]!==_?(v=(0,Q.jsx)(`span`,{className:g,children:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]===i?y=t[17]:(y=i?.lastError?(0,Q.jsx)(`span`,{className:`block break-all text-destructive`,children:i.lastError}):null,t[16]=i,t[17]=y);let b;t[18]!==v||t[19]!==y||t[20]!==m?(b=(0,Q.jsxs)(`span`,{className:`space-y-0.5`,children:[m,v,y]}),t[18]=v,t[19]=y,t[20]=m,t[21]=b):b=t[21];let x;return t[22]!==b||t[23]!==d?(x=(0,Q.jsx)(G,{title:d,description:b}),t[22]=b,t[23]=d,t[24]=x):x=t[24],x}function He(e){let t=(0,q.c)(59),{snapshot:r}=e,i=m(Ye),c=y(Je),l=o(qe),u=v(),p=a(),h=f(),x=_(),S;t[0]!==p||t[1]!==u?(S=u?u.serverConfig?.providers??[]:p,t[0]=p,t[1]=u,t[2]=S):S=t[2];let C=S,w=r?.observability??(u?u.serverConfig?.observability??null:h),T;t[3]!==x||t[4]!==u?(T=u?u.serverConfig?.availableEditors??[]:x,t[3]=x,t[4]=u,t[5]=T):T=t[5];let E=T,D=r?.performance?.local??null,[O,k]=(0,K.useState)(!1),A;t[6]!==D||t[7]!==w?(A=w?{...w,...D?{localMetrics:D}:{}}:null,t[6]=D,t[7]=w,t[8]=A):A=t[8];let ee=A,te;t[9]!==l||t[10]!==i||t[11]!==c?(te=[...new Set([...Object.keys(i),...Object.keys(c),...Object.keys(l)])].toSorted(),t[9]=l,t[10]=i,t[11]=c,t[12]=te):te=t[12];let F=te,I;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(I={onCopy:Ke,onError:Ge},t[13]=I):I=t[13];let{copyToClipboard:z,isCopied:B}=N(I),V;t[14]!==z||t[15]!==F||t[16]!==ee||t[17]!==C||t[18]!==l||t[19]!==i||t[20]!==c||t[21]!==r?.performance?(V=()=>{let e=Pe({generatedAt:new Date().toISOString(),app:{version:s,stage:d,isElectron:n,userAgent:typeof navigator>`u`?null:navigator.userAgent},environments:F.map(e=>({environmentId:e,record:i[e]??null,runtime:c[e]??null,pushSequence:l[e]??null})),providers:C,observability:ee,performance:r?.performance??null});z(Fe(e),void 0)},t[14]=z,t[15]=F,t[16]=ee,t[17]=C,t[18]=l,t[19]=i,t[20]=c,t[21]=r?.performance,t[22]=V):V=t[22],r?.performance;let H=V,W=w?.logsDirectoryPath??null,ne;t[23]!==E||t[24]!==W||t[25]!==u?(ne=()=>{if(!W)return;k(!0);let e=L(E??[]);if(!e){k(!1),M.add(j({type:`error`,title:`Could not open logs folder`,description:`No available editors found.`}));return}(u?g(u.environmentId)?.client.shell.openInEditor({cwd:W,editor:e})??Promise.reject(Error(`Selected environment is disconnected.`)):b().shell.openInEditor(W,e)).catch(We).finally(()=>{k(!1)})},t[23]=E,t[24]=W,t[25]=u,t[26]=ne):ne=t[26];let ie=ne,ae;t[27]===B?ae=t[28]:(ae=B?(0,Q.jsx)(re,{className:`size-3.5`}):(0,Q.jsx)(P,{className:`size-3.5`}),t[27]=B,t[28]=ae);let oe=B?`Copied`:`Copy debug bundle`,se;t[29]!==H||t[30]!==ae||t[31]!==oe?(se=(0,Q.jsxs)(R,{size:`xs`,variant:`outline`,onClick:H,children:[ae,oe]}),t[29]=H,t[30]=ae,t[31]=oe,t[32]=se):se=t[32];let ce;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,Q.jsx)(G,{title:`Application`,description:`Version ${s} · ${d}${n?` · Desktop`:` · Browser`}`}),t[33]=ce):ce=t[33];let le=W??`Resolving logs directory…`,J=!W||O,Y=O?`Opening…`:`Open logs folder`,X;t[34]!==ie||t[35]!==J||t[36]!==Y?(X=(0,Q.jsx)(R,{size:`xs`,variant:`outline`,disabled:J,onClick:ie,children:Y}),t[34]=ie,t[35]=J,t[36]=Y,t[37]=X):X=t[37];let Z;t[38]!==le||t[39]!==X?(Z=(0,Q.jsx)(G,{title:`Logs`,description:le,control:X}),t[38]=le,t[39]=X,t[40]=Z):Z=t[40];let ue;t[41]!==se||t[42]!==Z?(ue=(0,Q.jsxs)(U,{title:`Diagnostics`,headerAction:se,children:[ce,Z]}),t[41]=se,t[42]=Z,t[43]=ue):ue=t[43];let de;t[44]!==F||t[45]!==l||t[46]!==i||t[47]!==c?(de=F.length===0?(0,Q.jsx)(G,{title:`No environments`,description:`No environment connections are tracked yet.`}):F.map(e=>(0,Q.jsx)(Ve,{environmentId:e,record:i[e]??null,runtime:c[e]??null,pushSequence:l[e]??null},e)),t[44]=F,t[45]=l,t[46]=i,t[47]=c,t[48]=de):de=t[48];let fe;t[49]===de?fe=t[50]:(fe=(0,Q.jsx)(U,{title:`Environments`,children:de}),t[49]=de,t[50]=fe);let pe;t[51]===C?pe=t[52]:(pe=C.length===0?(0,Q.jsx)(G,{title:`No providers`,description:`No provider instances are configured.`}):C.map(Ue),t[51]=C,t[52]=pe);let me;t[53]===pe?me=t[54]:(me=(0,Q.jsx)(U,{title:`Providers`,children:pe}),t[53]=pe,t[54]=me);let he;return t[55]!==ue||t[56]!==fe||t[57]!==me?(he=(0,Q.jsxs)(Q.Fragment,{children:[ue,fe,me]}),t[55]=ue,t[56]=fe,t[57]=me,t[58]=he):he=t[58],he}function Ue(e){let t=e.unavailableReason??e.message??null;return(0,Q.jsx)(G,{title:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,Q.jsx)(ze,{className:Re[e.status]??`bg-muted-foreground/40`}),e.displayName??e.instanceId]}),description:(0,Q.jsxs)(`span`,{className:`space-y-0.5`,children:[(0,Q.jsxs)(`span`,{className:`block`,children:[e.status,` · auth `,e.auth.status,e.version?` · v${e.version}`:``]}),t?(0,Q.jsx)(`span`,{className:`block break-all text-muted-foreground/70`,children:t}):null]})},e.instanceId)}function We(e){M.add(j({type:`error`,title:`Could not open logs folder`,description:e instanceof Error?e.message:`Failed to open logs folder.`}))}function Ge(e){M.add(j({type:`error`,title:`Could not copy debug bundle`,description:e.message}))}function Ke(){M.add({type:`success`,title:`Debug bundle copied`,description:`Secrets are redacted before export.`})}function qe(e){return e.byEnvironment}function Je(e){return e.byId}function Ye(e){return e.byId}var Xe=[{method:`thread/snapshot`,requestId:`req_9f2c81d4a6`,startedAt:`12s ago`},{method:`git/status`,requestId:`req_c07b3e51fd`,startedAt:`9s ago`}];function Ze(e){M.update(e,{type:`loading`,title:`Updating Claude Code`,description:`Running provider update command.`,timeout:0,actionProps:void 0,data:{hideCopyButton:!0}}),window.setTimeout(()=>{M.update(e,{type:`success`,title:`Provider updated`,description:`New sessions will use the updated provider.`,timeout:0,data:{hideCopyButton:!0,dismissAfterVisibleMs:3e3}})},1800)}var Qe=[{value:`provider-update`,label:`Provider update available`,fire:()=>{let e=M.add(j({type:`warning`,title:`Update Available: Claude Code v2.1.4`,description:`Install the update now or review provider settings.`,timeout:0,actionProps:{children:`Update`,onClick:()=>Ze(e)},actionVariant:`default`,data:{hideCopyButton:!0,secondaryActionProps:{children:`Settings`,onClick:()=>l.getState().openSettings(`providers`)},secondaryActionVariant:`outline`}}))}},{value:`pr-checks-passed`,label:`PR checks passed`,fire:()=>{M.add({type:`success`,title:`Checks passed for PR #316`,description:`Redesign the notification toasts · 3273af68e412`,timeout:6e3,actionProps:{children:`Open PR`,onClick:()=>void 0},data:{actionVariant:`outline`}})}},{value:`git-push`,label:`Git push with follow-up action`,fire:()=>{M.add(j({type:`success`,title:`Pushed`,description:`3 commits pushed to origin/feat/notifications-toasts.`,timeout:0,actionProps:{children:`Open PR`,onClick:()=>void 0},actionVariant:`outline`,data:{dismissAfterVisibleMs:1e4}}))}},{value:`git-failed`,label:`Git action failed`,fire:()=>{M.add(j({type:`error`,title:`Action failed`,description:`remote: Permission to sak0a/ryco.git denied to deploy-bot.
2
- fatal: unable to access 'https://github.com/sak0a/ryco.git/': The requested URL returned error: 403`,timeout:0}))}},{value:`git-pull`,label:`Git pull (loading → result)`,fire:()=>{M.promise(new Promise(e=>{window.setTimeout(e,2400)}),{loading:{title:`Pulling...`},success:{title:`Pulled`,description:`Updated main from origin/main.`},error:{title:`Pull failed`,description:`Could not fast-forward.`}})}},{value:`slow-requests`,label:`Slow requests (expandable)`,fire:()=>{M.add({type:`warning`,title:`Some requests are slow`,description:`2 requests waiting longer than 5s.`,timeout:0,data:{expandableDescriptionTrigger:!0,expandableLabels:{expand:`Show requests`,collapse:`Hide requests`},expandableContent:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:Xe.map(e=>(0,Q.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Q.jsx)(`span`,{className:`shrink-0 rounded-sm bg-muted px-1 py-0.5 font-mono text-[10px]`,children:e.method}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate font-mono text-[11px] text-muted-foreground`,children:e.requestId}),(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 text-[11px] text-muted-foreground`,children:e.startedAt})]},e.requestId))})}})}},{value:`reconnected`,label:`Connection restored`,fire:()=>{M.add({type:`success`,title:`Reconnected to Ryco Server`,description:`Connection restored at ${new Date().toLocaleTimeString()}.`,timeout:0,data:{dismissAfterVisibleMs:8e3,hideCopyButton:!0}})}},{value:`long-error`,label:`Error with long details`,fire:()=>{M.add({type:`error`,title:`Provider session crashed`,description:`The provider session exited unexpectedly with code 137 while processing the turn. Last stderr output: FATAL ERROR: Reached heap limit — allocation failed, JavaScript heap out of memory. Restart the session or reduce the attached context, then try again.`,timeout:0})}}],$e=[`pr-checks-passed`,`provider-update`,`git-failed`];function et(){$e.forEach((e,t)=>{let n=Qe.find(t=>t.value===e);n&&window.setTimeout(()=>n.fire(),t*350)})}function tt(){let e=(0,q.c)(17),[t,n]=(0,K.useState)(Qe[0]?.value??``),r;e[0]===t?r=e[1]:(r=Qe.find(e=>e.value===t)??Qe[0],e[0]=t,e[1]=r);let i=r,a;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=e=>{typeof e==`string`&&n(e)},e[2]=a):a=e[2];let o=i?.label,s;e[3]===o?s=e[4]:(s=(0,Q.jsx)(k,{className:`w-full sm:w-56`,"aria-label":`Notification sample`,children:(0,Q.jsx)(E,{children:o})}),e[3]=o,e[4]=s);let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(O,{align:`end`,alignItemWithTrigger:!1,children:Qe.map(nt)}),e[5]=c):c=e[5];let l;e[6]!==t||e[7]!==s?(l=(0,Q.jsxs)(D,{value:t,onValueChange:a,children:[s,c]}),e[6]=t,e[7]=s,e[8]=l):l=e[8];let u;e[9]===i?u=e[10]:(u=(0,Q.jsx)(R,{"aria-label":`Show test notification`,size:`xs`,onClick:()=>i?.fire(),children:`Show`}),e[9]=i,e[10]=u);let d;e[11]!==l||e[12]!==u?(d=(0,Q.jsx)(G,{title:`Test notification`,description:`Preview the notification design with realistic samples. Nothing is sent or changed.`,control:(0,Q.jsxs)(`div`,{className:`flex w-full items-center gap-2 sm:w-auto`,children:[l,u]})}),e[11]=l,e[12]=u,e[13]=d):d=e[13];let f;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(G,{title:`Notification stack`,description:`Fire a short burst to preview stacking, peeking, and hover expansion.`,control:(0,Q.jsx)(R,{size:`xs`,variant:`outline`,onClick:et,children:`Show stack`})}),e[14]=f):f=e[14];let p;return e[15]===d?p=e[16]:(p=(0,Q.jsxs)(U,{title:`Notifications`,children:[d,f]}),e[15]=d,e[16]=p),p}function nt(e){return(0,Q.jsx)(T,{hideIndicator:!0,value:e.value,children:e.label},e.value)}var rt=5e3;function it(e){let t=(0,q.c)(33),{points:n,formatValue:r}=e,i;bb0:{if(n.length===0){i=``;break bb0}let e;t[0]===n?e=t[1]:(e=Math.max(...n.map(at),1),t[0]=n,t[1]=e);let r=e,a;if(t[2]!==r||t[3]!==n){let e;t[5]!==r||t[6]!==n.length?(e=(e,t)=>{let i=n.length===1?320:t/(n.length-1)*320,a=96-e.value/r*84-6;return`${t===0?`M`:`L`}${i.toFixed(2)},${a.toFixed(2)}`},t[5]=r,t[6]=n.length,t[7]=e):e=t[7],a=n.map(e).join(` `),t[2]=r,t[3]=n,t[4]=a}else a=t[4];i=a}let a=i,o,s,c,l,u;if(t[8]!==r||t[9]!==n){let e=n.at(-1)?.value??0;u=`min-w-0`,c=`mb-2 flex items-baseline justify-between gap-3`,t[15]===n.length?l=t[16]:(l=(0,Q.jsxs)(`span`,{className:`font-mono text-[11px] text-muted-foreground/70`,children:[n.length,` samples`]}),t[15]=n.length,t[16]=l),o=`font-mono text-xs text-foreground`,s=r(e),t[8]=r,t[9]=n,t[10]=o,t[11]=s,t[12]=c,t[13]=l,t[14]=u}else o=t[10],s=t[11],c=t[12],l=t[13],u=t[14];let d;t[17]!==o||t[18]!==s?(d=(0,Q.jsx)(`span`,{className:o,children:s}),t[17]=o,t[18]=s,t[19]=d):d=t[19];let f;t[20]!==c||t[21]!==l||t[22]!==d?(f=(0,Q.jsxs)(`div`,{className:c,children:[l,d]}),t[20]=c,t[21]=l,t[22]=d,t[23]=f):f=t[23];let p;t[24]===a?p=t[25]:(p=(0,Q.jsx)(`path`,{d:a,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,vectorEffect:`non-scaling-stroke`}),t[24]=a,t[25]=p);let m;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(`line`,{x1:`0`,y1:95,x2:320,y2:95,className:`stroke-border`}),t[26]=m):m=t[26];let h;t[27]===p?h=t[28]:(h=(0,Q.jsxs)(`svg`,{viewBox:`0 0 320 96`,className:`h-24 w-full overflow-visible text-info`,role:`img`,"aria-label":`Diagnostics history chart`,children:[p,m]}),t[27]=p,t[28]=h);let g;return t[29]!==h||t[30]!==u||t[31]!==f?(g=(0,Q.jsxs)(`div`,{className:u,children:[f,h]}),t[29]=h,t[30]=u,t[31]=f,t[32]=g):g=t[32],g}function at(e){return e.value}function ot(e){let t=(0,q.c)(12),{points:n,formatValue:r}=e,i=r===void 0?String:r,a;t[0]===n?a=t[1]:(a=Math.max(...n.map(st),1),t[0]=n,t[1]=a);let o=a;if(n.length===0){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`px-4 py-4 text-muted-foreground text-sm`,children:`No data yet.`}),t[2]=e):e=t[2],e}let s;if(t[3]!==i||t[4]!==o||t[5]!==n){let e;t[7]!==i||t[8]!==o?(e=e=>(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_5rem] items-center gap-3 px-4 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`mb-1 truncate text-[12px] font-medium`,children:e.label}),(0,Q.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-muted`,children:(0,Q.jsx)(`div`,{className:`h-full rounded-full bg-info`,style:{width:`${Math.max(4,e.value/o*100)}%`}})})]}),(0,Q.jsx)(`div`,{className:`text-right font-mono text-[11px] text-muted-foreground`,children:i(e.value)})]},e.label),t[7]=i,t[8]=o,t[9]=e):e=t[9],s=n.map(e),t[3]=i,t[4]=o,t[5]=n,t[6]=s}else s=t[6];let c;return t[10]===s?c=t[11]:(c=(0,Q.jsx)(`div`,{className:`divide-y divide-border/60`,children:s}),t[10]=s,t[11]=c),c}function st(e){return e.value}function $(e){let t=(0,q.c)(10),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`truncate text-[11px] font-medium text-muted-foreground uppercase tracking-[0.08em]`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`div`,{className:`mt-1 truncate text-[15px] font-semibold text-foreground`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=i?(0,Q.jsx)(`div`,{className:`mt-0.5 truncate text-[11px] text-muted-foreground`,children:i}):null,t[4]=i,t[5]=s);let c;return t[6]!==a||t[7]!==o||t[8]!==s?(c=(0,Q.jsxs)(`div`,{className:`min-w-0 border-border/60 border-t px-4 py-3 first:border-t-0 sm:px-5`,children:[a,o,s]}),t[6]=a,t[7]=o,t[8]=s,t[9]=c):c=t[9],c}function ct(e){let t=(0,q.c)(12),{label:n,value:r,detail:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`text-[12px] font-medium text-foreground`,children:n}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`div`,{className:`font-mono text-[12px] text-foreground`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`div`,{className:`mt-0.5 text-[11px] text-muted-foreground`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`grid gap-1 border-border/60 border-t px-4 py-3 first:border-t-0 sm:grid-cols-[11rem_minmax(0,1fr)] sm:px-5`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function lt(e){let t=(0,q.c)(5),{value:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(`summary`,{className:`cursor-pointer select-none text-[11px] text-muted-foreground hover:text-foreground`,children:`raw`}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=JSON.stringify(n,null,2),t[1]=n,t[2]=i);let a;return t[3]===i?a=t[4]:(a=(0,Q.jsxs)(`details`,{className:`group`,children:[r,(0,Q.jsx)(`pre`,{className:`mt-2 max-h-64 overflow-auto rounded-md bg-muted/60 p-3 text-[11px] leading-relaxed`,children:i})]}),t[3]=i,t[4]=a),a}function ut(e){let t=(0,q.c)(8),{spans:n,showTraceId:r}=e,i=r!==void 0&&r;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`p`,{className:`px-4 py-4 text-muted-foreground text-sm`,children:`No spans retained yet.`}),t[0]=e):e=t[0],e}let a;if(t[1]!==i||t[2]!==n){let e;t[4]===i?e=t[5]:(e=e=>(0,Q.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 sm:grid-cols-[minmax(0,1fr)_6rem_5rem] sm:items-start`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.name}),(0,Q.jsx)(A,{size:`sm`,variant:le(e.status)?`error`:`outline`,children:e.status})]}),(0,Q.jsxs)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:[e.source,` / `,e.kind,` / `,e.spanId]}),i?(0,Q.jsx)(ve,{value:e.traceId}):null,e.failureMessage&&le(e.status)?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[11px] text-destructive`,children:e.failureMessage}):null,(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(lt,{value:e})})]}),(0,Q.jsx)(`div`,{className:`font-mono text-[11px] text-muted-foreground sm:text-right`,children:Y(e.durationMs)}),(0,Q.jsx)(`div`,{className:`font-mono text-[11px] text-muted-foreground sm:text-right`,children:Z(e.endTime)})]},e.id),t[4]=i,t[5]=e),a=n.slice(0,10).map(e),t[1]=i,t[2]=n,t[3]=a}else a=t[3];let o;return t[6]===a?o=t[7]:(o=(0,Q.jsx)(`div`,{className:`divide-y divide-border/60`,children:a}),t[6]=a,t[7]=o),o}function dt(e){let t=(0,q.c)(9),{memorySeries:n,cpuSeries:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(`div`,{className:`mb-1 text-[12px] font-semibold`,children:`RSS memory`}),t[0]=i):i=t[0];let a;t[1]===n?a=t[2]:(a=(0,Q.jsxs)(`div`,{className:`min-w-0 p-4`,children:[i,(0,Q.jsx)(it,{points:n,formatValue:J})]}),t[1]=n,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(`div`,{className:`mb-1 text-[12px] font-semibold`,children:`CPU utilization`}),t[3]=o):o=t[3];let s;t[4]===r?s=t[5]:(s=(0,Q.jsxs)(`div`,{className:`min-w-0 p-4`,children:[o,(0,Q.jsx)(it,{points:r,formatValue:ft})]}),t[4]=r,t[5]=s);let c;return t[6]!==a||t[7]!==s?(c=(0,Q.jsx)(U,{title:`Resource history`,children:(0,Q.jsxs)(`div`,{className:`grid gap-0 divide-y divide-border/60 lg:grid-cols-2 lg:divide-x lg:divide-y-0`,children:[a,s]})}),t[6]=a,t[7]=s,t[8]=c):c=t[8],c}function ft(e){return`${e.toFixed(1)}%`}function pt(e){let t=(0,q.c)(26),{snapshot:n,showTraceId:r}=e,i=r!==void 0&&r,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`div`,{className:`border-border/60 border-b px-4 py-2 text-[12px] font-semibold`,children:`Top span names`}),t[0]=a):a=t[0];let o;t[1]===n?.tracing.topSpanNames?o=t[2]:(o=n?.tracing.topSpanNames??[],t[1]=n?.tracing.topSpanNames,t[2]=o);let s;t[3]===o?s=t[4]:(s=pe(o),t[3]=o,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,Q.jsx)(ot,{points:s})]}),t[5]=s,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(`div`,{className:`border-border/60 border-b px-4 py-2 text-[12px] font-semibold`,children:`Duration buckets`}),t[7]=l):l=t[7];let u;t[8]===n?.tracing.durationBuckets?u=t[9]:(u=n?.tracing.durationBuckets??[],t[8]=n?.tracing.durationBuckets,t[9]=u);let d;t[10]===u?d=t[11]:(d=fe(u),t[10]=u,t[11]=d);let f;t[12]===d?f=t[13]:(f=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[l,(0,Q.jsx)(ot,{points:d})]}),t[12]=d,t[13]=f);let p;t[14]!==c||t[15]!==f?(p=(0,Q.jsxs)(`div`,{className:`grid gap-0 divide-y divide-border/60 lg:grid-cols-2 lg:divide-x lg:divide-y-0`,children:[c,f]}),t[14]=c,t[15]=f,t[16]=p):p=t[16];let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(`div`,{className:`border-border/60 border-b px-4 py-2 text-[12px] font-semibold`,children:`Slowest spans`}),t[17]=m):m=t[17];let h;t[18]===n?.tracing.slowestSpans?h=t[19]:(h=n?.tracing.slowestSpans??[],t[18]=n?.tracing.slowestSpans,t[19]=h);let g;t[20]!==i||t[21]!==h?(g=(0,Q.jsxs)(`div`,{className:`border-border/60 border-t`,children:[m,(0,Q.jsx)(ut,{spans:h,showTraceId:i})]}),t[20]=i,t[21]=h,t[22]=g):g=t[22];let _;return t[23]!==p||t[24]!==g?(_=(0,Q.jsxs)(U,{title:`Tracing diagnostics`,children:[p,g]}),t[23]=p,t[24]=g,t[25]=_):_=t[25],_}function mt(e){let t=(0,q.c)(10),{snapshot:n,nowMs:r}=e,i;if(t[0]!==r||t[1]!==n?.failures.latest){let e;t[3]===r?e=t[4]:(e=e=>(0,Q.jsxs)(`div`,{className:`grid gap-2 px-4 py-3 sm:grid-cols-[minmax(0,1fr)_6rem]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(A,{size:`sm`,variant:`error`,children:e.category}),(0,Q.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.message})]}),(0,Q.jsxs)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:[e.source,` / `,e.signature]}),(0,Q.jsx)(`div`,{className:`mt-2`,children:(0,Q.jsx)(lt,{value:e.raw??e})})]}),(0,Q.jsx)(`div`,{className:`font-mono text-[11px] text-muted-foreground sm:text-right`,children:Z(e.occurredAt,r)})]},e.id),t[3]=r,t[4]=e),i=(n?.failures.latest??[]).slice(0,8).map(e),t[0]=r,t[1]=n?.failures.latest,t[2]=i}else i=t[2];let a;t[5]===n?a=t[6]:(a=n&&n.failures.latest.length===0?(0,Q.jsx)(`p`,{className:`px-4 py-4 text-muted-foreground text-sm`,children:`No failures retained.`}):null,t[5]=n,t[6]=a);let o;return t[7]!==i||t[8]!==a?(o=(0,Q.jsx)(U,{title:`Failures`,children:(0,Q.jsxs)(`div`,{className:`divide-y divide-border/60`,children:[i,a]})}),t[7]=i,t[8]=a,t[9]=o):o=t[9],o}function ht(e){let t=(0,q.c)(27),{snapshot:n,slowRpcAcks:r,nowMs:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`div`,{className:`border-border/60 border-b px-4 py-2 text-[12px] font-semibold`,children:`Providers`}),t[0]=a):a=t[0];let o;t[1]===n?.liveProcesses.providers?o=t[2]:(o=n?.liveProcesses.providers??[],t[1]=n?.liveProcesses.providers,t[2]=o);let s;t[3]===o?s=t[4]:(s=o.map(_t),t[3]=o,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[a,(0,Q.jsx)(`div`,{className:`divide-y divide-border/60`,children:s})]}),t[5]=s,t[6]=c);let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(`div`,{className:`border-border/60 border-b px-4 py-2 text-[12px] font-semibold`,children:`Terminals and slow RPCs`}),t[7]=l):l=t[7];let u;t[8]===n?.liveProcesses.terminals?u=t[9]:(u=n?.liveProcesses.terminals??[],t[8]=n?.liveProcesses.terminals,t[9]=u);let d;t[10]===u?d=t[11]:(d=u.map(gt),t[10]=u,t[11]=d);let f;if(t[12]!==i||t[13]!==r){let e;t[15]===i?e=t[16]:(e=e=>(0,Q.jsxs)(`div`,{className:`px-4 py-2.5`,children:[(0,Q.jsx)(`div`,{className:`truncate text-[13px] font-medium`,children:e.tag}),(0,Q.jsxs)(`div`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:[`slow ack / `,Z(e.startedAt,i)]})]},e.requestId),t[15]=i,t[16]=e),f=r.map(e),t[12]=i,t[13]=r,t[14]=f}else f=t[14];let p;t[17]!==r.length||t[18]!==n?.liveProcesses.terminals.length?(p=(n?.liveProcesses.terminals.length??0)===0&&r.length===0?(0,Q.jsx)(`p`,{className:`px-4 py-4 text-muted-foreground text-sm`,children:`No live terminal or slow RPC activity.`}):null,t[17]=r.length,t[18]=n?.liveProcesses.terminals.length,t[19]=p):p=t[19];let m;t[20]!==d||t[21]!==f||t[22]!==p?(m=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[l,(0,Q.jsxs)(`div`,{className:`divide-y divide-border/60`,children:[d,f,p]})]}),t[20]=d,t[21]=f,t[22]=p,t[23]=m):m=t[23];let h;return t[24]!==m||t[25]!==c?(h=(0,Q.jsx)(U,{title:`Live activity`,children:(0,Q.jsxs)(`div`,{className:`grid gap-0 divide-y divide-border/60 lg:grid-cols-2 lg:divide-x lg:divide-y-0`,children:[c,m]})}),t[24]=m,t[25]=c,t[26]=h):h=t[26],h}function gt(e){return(0,Q.jsxs)(`div`,{className:`px-4 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[13px] font-medium`,children:e.terminalId}),(0,Q.jsx)(A,{size:`sm`,variant:e.status===`error`?`error`:`outline`,children:e.status})]}),(0,Q.jsxs)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:[`pid `,e.pid??`n/a`,` / subprocess`,` `,e.hasRunningSubprocess?`yes`:`no`]})]},`${e.threadId}:${e.terminalId}`)}function _t(e){return(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center justify-between gap-3 px-4 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`truncate text-[13px] font-medium`,children:e.displayName??e.instanceId}),(0,Q.jsx)(`div`,{className:`truncate font-mono text-[11px] text-muted-foreground`,children:e.driver})]}),(0,Q.jsx)(A,{size:`sm`,variant:e.status===`error`?`error`:e.status===`warning`?`warning`:`outline`,children:e.status})]},e.instanceId)}function vt(e){let t=(0,q.c)(57),{snapshot:n,memorySeries:r,cpuSeries:i,slowRpcAcks:a,latestFailure:o,nowMs:s}=e,c;t[0]===n?c=t[1]:(c=n?Y(n.uptimeMs):`n/a`,t[0]=n,t[1]=c);let l;t[2]!==s||t[3]!==n?(l=n?`Started ${Z(n.serverStartedAt,s)}`:void 0,t[2]=s,t[3]=n,t[4]=l):l=t[4];let u;t[5]!==c||t[6]!==l?(u=(0,Q.jsx)($,{label:`Uptime`,value:c,detail:l}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d;t[8]===n?d=t[9]:(d=n?J(n.resources.current.memory.rssBytes):`n/a`,t[8]=n,t[9]=d);let f;t[10]===n?f=t[11]:(f=n?`${J(n.resources.current.memory.heapUsedBytes)} heap used`:void 0,t[10]=n,t[11]=f);let p;t[12]!==d||t[13]!==f?(p=(0,Q.jsx)($,{label:`Memory`,value:d,detail:f}),t[12]=d,t[13]=f,t[14]=p):p=t[14];let m;t[15]===n?m=t[16]:(m=n?X(n.resources.current.cpu.utilizationPercent):`n/a`,t[15]=n,t[16]=m);let h;t[17]===n?h=t[18]:(h=n?.resources.current.eventLoopDelayMs===void 0?void 0:`${Y(n.resources.current.eventLoopDelayMs)} event loop delay`,t[17]=n,t[18]=h);let g;t[19]!==m||t[20]!==h?(g=(0,Q.jsx)($,{label:`CPU`,value:m,detail:h}),t[19]=m,t[20]=h,t[21]=g):g=t[21];let _;t[22]===n?.liveProcesses.providers?_=t[23]:(_=n?.liveProcesses.providers.filter(yt).length??0,t[22]=n?.liveProcesses.providers,t[23]=_);let v=`${_} providers`,y=`${n?.liveProcesses.terminals.length??0} terminal sessions`,b;t[24]!==v||t[25]!==y?(b=(0,Q.jsx)($,{label:`Activity`,value:v,detail:y}),t[24]=v,t[25]=y,t[26]=b):b=t[26];let x=`${n?.tracing.retainedSpanCount??0} spans`,S=n?`${n.limits.fileTailBytes/1024} KB file tail`:void 0,C;t[27]!==x||t[28]!==S?(C=(0,Q.jsx)($,{label:`Tracing`,value:x,detail:S}),t[27]=x,t[28]=S,t[29]=C):C=t[29];let w;t[30]===o?w=t[31]:(w=(0,Q.jsx)($,{label:`Latest failure`,value:o}),t[30]=o,t[31]=w);let T;t[32]!==b||t[33]!==C||t[34]!==w||t[35]!==u||t[36]!==p||t[37]!==g?(T=(0,Q.jsx)(U,{title:`Overview`,children:(0,Q.jsxs)(`div`,{className:`grid sm:grid-cols-2 lg:grid-cols-3`,children:[u,p,g,b,C,w]})}),t[32]=b,t[33]=C,t[34]=w,t[35]=u,t[36]=p,t[37]=g,t[38]=T):T=t[38];let E;t[39]!==i||t[40]!==r?(E=(0,Q.jsx)(dt,{memorySeries:r,cpuSeries:i}),t[39]=i,t[40]=r,t[41]=E):E=t[41];let D;t[42]===n?D=t[43]:(D=(0,Q.jsx)(pt,{snapshot:n}),t[42]=n,t[43]=D);let O;t[44]!==s||t[45]!==n?(O=(0,Q.jsx)(mt,{snapshot:n,nowMs:s}),t[44]=s,t[45]=n,t[46]=O):O=t[46];let k;t[47]!==s||t[48]!==a||t[49]!==n?(k=(0,Q.jsx)(ht,{snapshot:n,slowRpcAcks:a,nowMs:s}),t[47]=s,t[48]=a,t[49]=n,t[50]=k):k=t[50];let A;return t[51]!==T||t[52]!==E||t[53]!==D||t[54]!==O||t[55]!==k?(A=(0,Q.jsxs)(Q.Fragment,{children:[T,E,D,O,k]}),t[51]=T,t[52]=E,t[53]=D,t[54]=O,t[55]=k,t[56]=A):A=t[56],A}function yt(e){return e.enabled}function bt(e){let t=(0,q.c)(14),{snapshot:n,error:r}=e;if(!r&&(!n||n.warnings.length===0))return null;let i=r?`error`:`warning`,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(I,{}),t[0]=a):a=t[0];let o=r?`Diagnostics refresh failed`:`Diagnostics warnings`,s;t[1]===o?s=t[2]:(s=(0,Q.jsx)(B,{children:o}),t[1]=o,t[2]=s);let c;t[3]===r?c=t[4]:(c=r?(0,Q.jsx)(`span`,{children:r}):null,t[3]=r,t[4]=c);let l;t[5]===n?.warnings?l=t[6]:(l=n?.warnings.slice(0,4).map(xt),t[5]=n?.warnings,t[6]=l);let u;t[7]!==c||t[8]!==l?(u=(0,Q.jsxs)(V,{children:[c,l]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;return t[10]!==i||t[11]!==s||t[12]!==u?(d=(0,Q.jsxs)(H,{variant:i,children:[a,s,u]}),t[10]=i,t[11]=s,t[12]=u,t[13]=d):d=t[13],d}function xt(e){return(0,Q.jsxs)(`span`,{children:[e.message,e.count?` (${e.count})`:``]},`${e.code}:${e.source??``}`)}function St(e){let t=(0,q.c)(3),{presentation:n}=e,r=n===void 0?`performance`:n,i=v()?.environmentId??`local`,a;return t[0]!==r||t[1]!==i?(a=(0,Q.jsx)(Ct,{presentation:r},i),t[0]=r,t[1]=i,t[2]=a):a=t[2],a}function Ct({presentation:e}){let t=v(),[n,r]=(0,K.useState)(null),[a,o]=(0,K.useState)(null),[s,l]=(0,K.useState)(!0),[u,d]=(0,K.useState)(!1),f=(0,K.useRef)(null),m=(0,K.useRef)(u);m.current=u;let h=p(),g=y(e=>e.byId),_=Date.now(),x=ae(i.serverGetDiagnosticsSnapshot),S=t?.environmentId,C=t?.nodeLabel,w=(0,K.useCallback)(async(e=!1)=>{await f.current?.()},[]);(0,K.useEffect)(()=>{if(r(null),o(null),l(!0),!x.allowed){o(x.reason),l(!1);return}let e=se({fetch:async()=>{let e=S?c(S)?.server:b().server;if(!e)throw Error(`Diagnostics are unavailable on ${C??`this environment`}.`);return e.getDiagnosticsSnapshot()},onSuccess:e=>{r(e),o(null)},onError:e=>o(e instanceof Error?e.message:`Unable to refresh diagnostics.`),onLoading:l});f.current=e.refresh;let t=()=>{!m.current&&document.visibilityState===`visible`&&e.refresh()};t();let n=window.setInterval(t,rt);return document.addEventListener(`visibilitychange`,t),()=>{e.dispose(),f.current=null,window.clearInterval(n),document.removeEventListener(`visibilitychange`,t)}},[S,C,x.allowed,x.reason]),(0,K.useEffect)(()=>{!u&&document.visibilityState===`visible`&&w()},[u,w]);let T=(0,K.useMemo)(()=>ue(n?.resources.history??[]),[n]),E=(0,K.useMemo)(()=>de(n?.resources.history??[]),[n]),D=n?me(n):`No snapshot`,O=n?.liveProcesses.providers.filter(e=>e.enabled).length??0,k=n?.liveProcesses.terminals.filter(e=>e.status===`starting`||e.status===`running`).length??0,A=Object.values(g),j=A.filter(e=>e.connectionState===`connected`).length,M=A.filter(e=>e.connectionState===`connecting`).length,N=A.length===0?`No tracked clients`:`${j} connected${M>0?` · ${M} connecting`:``}`,P=n?.tracing.slowestSpans.find(e=>e.source===`server`)??null,I=h[0]??null,L=n?.performance??null,B=L?.local.turnQuiescenceAvgMs??null,V=L?.local.checkpointDurationP95Ms??null,H=L?.local.latestThreadSnapshotDurationMs??null,G=L?.local.threadSnapshotDurationP95Ms??null;return(0,Q.jsxs)(W,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Diagnostics`}),(0,Q.jsx)(`p`,{className:`mt-1 text-muted-foreground text-xs`,children:n?`Updated ${Z(n.generatedAt,_)}`:`Waiting for snapshot`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(R,{size:`xs`,variant:`outline`,onClick:()=>d(e=>!e),children:[u?(0,Q.jsx)(te,{className:`size-3.5`}):(0,Q.jsx)(ee,{className:`size-3.5`}),u?`Resume`:`Pause`]}),(0,Q.jsxs)(R,{size:`xs`,variant:`outline`,onClick:()=>void w(!0),disabled:s,children:[(0,Q.jsx)(F,{className:z(`size-3.5`,s&&`animate-spin`)}),`Refresh`]})]})]}),(0,Q.jsx)(bt,{snapshot:n,error:a}),null,e===`phone-legacy`?(0,Q.jsx)(vt,{snapshot:n,memorySeries:T,cpuSeries:E,slowRpcAcks:h,latestFailure:D,nowMs:_}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ge,{telemetry:n?.telemetry,paused:u,refresh:w},`telemetry:${S??`local`}`),(0,Q.jsx)(_e,{snapshot:n,refresh:w},S??`local`),(0,Q.jsx)(Se,{snapshot:n,nowMs:_}),(0,Q.jsx)(pt,{snapshot:n,showTraceId:!0}),(0,Q.jsx)(mt,{snapshot:n,nowMs:_}),(0,Q.jsx)(ht,{snapshot:n,slowRpcAcks:h,nowMs:_}),(0,Q.jsx)(U,{title:`Performance now`,children:(0,Q.jsxs)(`div`,{className:`grid sm:grid-cols-2 lg:grid-cols-3`,children:[(0,Q.jsx)($,{label:`Backend CPU`,value:n?X(n.resources.current.cpu.utilizationPercent):`n/a`,detail:n?`Process uptime ${Y(n.uptimeMs)}`:void 0}),(0,Q.jsx)($,{label:`RSS / heap`,value:n?J(n.resources.current.memory.rssBytes):`n/a`,detail:n?`${J(n.resources.current.memory.heapUsedBytes)} heap used`:void 0}),(0,Q.jsx)($,{label:`Event-loop delay`,value:n?.resources.current.eventLoopDelayMs===void 0?`n/a`:Y(n.resources.current.eventLoopDelayMs),detail:`Measured once for this requested snapshot`}),(0,Q.jsx)($,{label:`Providers / terminals`,value:`${O} enabled providers`,detail:`${k} active terminals`}),(0,Q.jsx)($,{label:`Turn quiescence`,value:B===null?`No samples`:Y(B),detail:`Rolling average`}),(0,Q.jsx)($,{label:`Checkpoint duration`,value:V===null?`No samples`:Y(V),detail:`Rolling p95`}),(0,Q.jsx)($,{label:`WebSocket state`,value:N,detail:`${L?.local.wsReconnectCount??0} reconnects in this server process`}),(0,Q.jsx)($,{label:`Thread snapshot`,value:H===null?`No samples`:Y(H),detail:G===null?`Latest successful subscription snapshot`:`${Y(G)} rolling p95`}),(0,Q.jsx)($,{label:`Latest failure`,value:D})]})}),(0,Q.jsxs)(U,{title:`Why was this slow?`,children:[(0,Q.jsx)(ct,{label:`Thread snapshot`,value:H===null?`No thread snapshot timing yet`:`${Y(H)} latest`,detail:G===null?`Replay duration and payload bytes are not collected because the current transport has no zero-copy attribution hook.`:`${Y(G)} rolling p95. Replay duration and payload bytes are not collected because the current transport has no zero-copy attribution hook.`}),(0,Q.jsx)(ct,{label:`Queue pressure`,value:L?`${L.queues.runtimeDepthTotal+L.queues.liveBufferDepthTotal} queued now`:`No snapshot`,detail:L?`Largest runtime high-water ${L.queues.runtimeHighWaterMax}; live-buffer high-water ${L.queues.liveBufferHighWaterMax}; ${L.queues.liveBufferOverflowCount} overflows; replay depth ${L.queues.replayDepthMax}; replay lag ${L.queues.replayLagMax}; ${L.queues.providerLogDroppedRecords} provider log records dropped.`:`Runtime and replay queue evidence will appear after the first snapshot.`}),(0,Q.jsx)(ct,{label:`Slowest server stage`,value:P?`${P.name} · ${Y(P.durationMs)}`:`No retained spans`,detail:P?`Server span completed ${Z(P.endTime,_)}.`:`Tracing has not retained a server stage yet.`}),(0,Q.jsx)(ct,{label:`Current slow client RPC`,value:I?.tag??`No slow RPC acknowledgement in progress`,detail:I?`Exceeded its ${Y(I.thresholdMs)} acknowledgement threshold; started ${Z(I.startedAt,_)}.`:`Only RPCs that cross the existing client acknowledgement threshold appear here.`}),(0,Q.jsx)(ct,{label:`Reconnect / resume`,value:N,detail:`${L?.local.wsReconnectCount??0} server-side reconnects. Per-environment push gaps and recovery state are in the Environments section.`}),(0,Q.jsx)(ct,{label:`Recent failure`,value:n?.failures.latest[0]?.message??`No retained failures`,detail:n?.failures.latest[0]?`${n.failures.latest[0].source} · ${Z(n.failures.latest[0].occurredAt,_)}`:`No failure evidence is available for the current server process.`}),(0,Q.jsx)(ct,{label:`Trace persistence`,value:L?.traceSink?`${J(L.traceSink.bufferedBytes)} buffered`:`Health unavailable`,detail:L?.traceSink?`${J(L.traceSink.maxBufferedBytes)} cap; ${L.traceSink.droppedRecords} dropped records; ${L.traceSink.writeFailures} write failures; retry delay ${Y(L.traceSink.retryDelayMs)}.`:`This diagnostics service is not attached to the local trace-file sink.`})]}),(0,Q.jsx)(dt,{memorySeries:T,cpuSeries:E}),(0,Q.jsx)(He,{snapshot:n}),(0,Q.jsx)(tt,{}),null]})]})}export{St as DiagnosticsSettings};
@@ -1 +0,0 @@
1
- import{r as e}from"./DialogViewport-a5beR5bY.js";import{a as t,m as n}from"./visuallyHidden-BRaogTVF.js";import{D as r}from"./usePopupViewport-8OM2irPK.js";var i=class extends r{constructor(){super(e(),`Dialog`,!1)}open(e){this.openByTrigger(e)}openWithPayload(e){let r=this.attachedStore;r!==null&&(r.set(`payload`,e),r.setOpen(!0,t(n)))}close(){this.closePopup()}get isOpen(){return this.attachedStore?.select(`open`)??!1}};function a(){return new i}export{a as n,i as t};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{ia as n}from"./runtime-L56puJDA.js";import{f as r,zt as i}from"./usePositioner-0Kb-C4al.js";import{t as a}from"./useRenderElement-D0HVF5g_.js";import{a as o,o as s,s as c}from"./DialogViewport-a5beR5bY.js";import{f as l,g as u}from"./usePopupViewport-8OM2irPK.js";import{p as d,s as f}from"./useScrollLock-AUqaSAkf.js";var p=e(t(),1),m=p.forwardRef(function(e,t){let{render:n,className:r,style:o,forceRender:s=!1,...l}=e,u=c(),d=u.useState(`open`),f=u.useState(`nested`),p=u.useState(`mounted`),m={open:d,transitionStatus:u.useState(`transitionStatus`)};return a(`div`,e,{state:m,ref:[u.context.backdropRef,t],stateAttributesMapping:i,props:[{role:`presentation`,hidden:!p,style:{userSelect:`none`,WebkitUserSelect:`none`}},l],enabled:s||!f})}),h=`--nested-dialogs`,g=n(),_=p.forwardRef(function(e,t){let{render:n,className:i,style:p,finalFocus:m,initialFocus:_,...v}=e,y=c(),b=y.useState(`descriptionElementId`),x=y.useState(`disablePointerDismissal`),S=y.useState(`floatingRootContext`),C=y.useState(`popupProps`),w=y.useState(`modal`),T=y.useState(`mounted`),E=y.useState(`nested`),D=y.useState(`nestedOpenDialogCount`),O=y.useState(`open`),k=y.useState(`openMethod`),A=y.useState(`titleElementId`),j=y.useState(`transitionStatus`),M=y.useState(`role`),N=S.useState(`floatingId`);s(),r({open:O,ref:y.context.popupRef,onComplete(){O&&y.context.onOpenChangeComplete?.(!0)}});let P=_===void 0?u(y.context.popupRef):_,F=D>0,I=y.useStateSetter(`popupElement`),L=a(`div`,e,{state:{open:O,nested:E,transitionStatus:j,nestedDialogOpen:F},props:[C,{id:N,"aria-labelledby":A,"aria-describedby":b,role:M,...l,hidden:!T,onKeyDown(e){f.has(e.key)&&e.stopPropagation()},style:{[h]:D}},v],ref:[t,y.context.popupRef,I],stateAttributesMapping:o});return(0,g.jsx)(d,{context:S,openInteractionType:k,disabled:!T,closeOnFocusOut:!x,initialFocus:P,returnFocus:m,modal:w!==!1,restoreFocus:`popup`,children:L})});export{m as n,_ as t};
@@ -1 +0,0 @@
1
- import{g as e}from"./usePositioner-0Kb-C4al.js";import{n as t}from"./DialogViewport-a5beR5bY.js";var n=e(function(e){return t(`dialog`,e)});export{n as t};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./useRenderElement-D0HVF5g_.js";import{s as r}from"./DialogViewport-a5beR5bY.js";import{a as i,l as a,r as o}from"./visuallyHidden-BRaogTVF.js";import{n as s}from"./useValueChanged-CThCTn4h.js";var c=e(t(),1),l=c.forwardRef(function(e,t){let{render:o,className:c,style:l,disabled:u=!1,nativeButton:d=!0,...f}=e,p=r(),m=p.useState(`open`),{getButtonProps:h,buttonRef:g}=s({disabled:u,native:d}),_={disabled:u};function v(e){m&&p.setOpen(!1,i(a,e.nativeEvent))}return n(`button`,e,{state:_,ref:[t,g],props:[{onClick:v},f,h]})}),u=c.forwardRef(function(e,t){let{render:i,className:a,style:s,id:c,...l}=e,u=r(),d=o(c);return u.useSyncedValueWithCleanup(`descriptionElementId`,d),n(`p`,e,{ref:t,props:[{id:d},l]})}),d=c.forwardRef(function(e,t){let{render:i,className:a,style:s,id:c,...l}=e,u=r(),d=o(c);return u.useSyncedValueWithCleanup(`titleElementId`,d),n(`h2`,e,{ref:t,props:[{id:d},l]})});export{u as n,l as r,d as t};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{A as n,Vt as r,_ as i}from"./usePositioner-0Kb-C4al.js";import{l as a,t as o}from"./useRenderElement-D0HVF5g_.js";import{I as s,M as c}from"./badge-CYDyJZRJ.js";import{s as l}from"./DialogViewport-a5beR5bY.js";import{r as u}from"./visuallyHidden-BRaogTVF.js";import{n as d}from"./useValueChanged-CThCTn4h.js";import{C as f,l as p}from"./usePopupViewport-8OM2irPK.js";var m=e(t(),1),h=i(function(e,t){let{render:i,className:h,style:g,disabled:_=!1,nativeButton:v=!0,id:y,payload:b,handle:x,...S}=e,C=l(!0),w=p(x)??C;if(!w)throw Error(a(79));let T=u(y),E=w.useState(`floatingRootContext`),D=w.useState(`isOpenedByTrigger`,T),O=w.useState(`triggerPopupId`,T),k=m.useRef(null),{registerTrigger:A,isMountedByThisTrigger:j}=f(T,k,w,{payload:b}),{getButtonProps:M,buttonRef:N}=d({disabled:_,native:v}),P=s(E),F=c(()=>w.select(`open`),e=>{w.set(`openMethod`,e)}),I={disabled:_,open:D},L=w.useState(`triggerProps`,j);return o(`button`,e,{state:I,ref:[N,t,A,k],props:[P.reference,L,F,{[n]:``,id:T,"aria-haspopup":`dialog`,"aria-expanded":D,"aria-controls":O},S,M],stateAttributesMapping:r})});export{h as t};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{ia as n}from"./runtime-L56puJDA.js";import{E as r,Jt as i,Rt as a,bt as o,d as s,h as c,u as l,xt as u}from"./usePositioner-0Kb-C4al.js";import{l as d,t as f}from"./useRenderElement-D0HVF5g_.js";import{A as p,a as m,m as h}from"./visuallyHidden-BRaogTVF.js";import{O as g,S as _,_ as v,b as y,d as b,i as x,p as S,u as C,v as w,x as T,y as E}from"./usePopupViewport-8OM2irPK.js";import{n as D,t as O}from"./useScrollLock-AUqaSAkf.js";var k=e(t(),1),A=k.createContext(void 0);function j(e){let t=k.useContext(A);if(!e&&t===void 0)throw Error(d(27));return t}var M=k.createContext(void 0);function N(){let e=k.useContext(M);if(e===void 0)throw Error(d(26));return e}var P=n(),F=`data-nested-dialog-open`,I={...a,...i,nestedDialogOpen(e){return e?{[F]:``}:null}},L=k.forwardRef(function(e,t){let{keepMounted:n=!1,...i}=e,a=j(),o=a.useState(`mounted`),s=a.useState(`modal`),c=a.useState(`open`);return o||n?(0,P.jsx)(M.Provider,{value:n,children:(0,P.jsxs)(r,{ref:t,...i,children:[o&&s===!0&&(0,P.jsx)(D,{ref:a.context.internalBackdropRef,inert:l(!c)}),e.children]})}):null});function R({store:e,parentContext:t,isDrawer:n}){let r=e.useState(`open`),i=e.useState(`disablePointerDismissal`),a=e.useState(`modal`),s=e.useState(`popupElement`),c=e.useState(`floatingRootContext`),[l,d]=k.useState(0),[f,m]=k.useState(0),h=l===0,_=g(c,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?`intentional`:{mouse:a===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(t){if(!e.context.outsidePressEnabledRef.current||`button`in t&&t.button!==0)return!1;if(`touches`in t){if(t.type===`touchend`){if(t.changedTouches.length!==1||t.touches.length!==0)return!1}else if(t.touches.length!==1)return!1}let n=u(t);if(h&&!i){if(a){let t=e.context.internalBackdropRef.current,r=e.context.backdropRef.current;return t||r?t===n||r===n||o(n,s)&&!n?.hasAttribute(`data-base-ui-portal`):!0}return!0}return!1},escapeKey:h});return O(r&&a===!0,s),e.useContextCallback(`onNestedDialogOpen`,(e,t)=>{d(e),m(t)}),p(()=>(t?.onNestedDialogOpen&&(r?t.onNestedDialogOpen(l+1,f+ +!!n):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&r&&t.onNestedDialogOpen(0,0)}),[n,r,l,f,t]),y(e,{activeTriggerProps:_.reference,inactiveTriggerProps:_.trigger,popupProps:_.floating,nestedOpenDialogCount:l,nestedOpenDrawerCount:f}),null}var z={...b,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role},B=class extends c{constructor(e,t,n){let r=new s,i=H(e,r,t,n);super(i,U(r),z)}setOpen=(e,t)=>{t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),!t.isCanceled&&(this.state.floatingRootContext.dispatchOpenChange(e,t),this.update(v(this.state,e,t.trigger)))}};function V(){let e=new s;return new x(Object.freeze(H(void 0,e)),Object.freeze(U(e)),z)}function H(e,t,n,r=!1){return{...C(t,n,r),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}function U(e){return{popupRef:k.createRef(),backdropRef:k.createRef(),internalBackdropRef:k.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function W(e,t){let{children:n,open:r,defaultOpen:i=!1,onOpenChange:a,onOpenChangeComplete:o,disablePointerDismissal:s=!1,modal:c=!0,actionsRef:l,handle:u,triggerId:d,defaultTriggerId:f=null}=t,p=e===`drawer`,g=e===`alert-dialog`,v=g?!0:c,y=g||s,b=g?`alertdialog`:`dialog`,x=j(!0),C={modal:v,disablePointerDismissal:y,nested:x!=null,role:b},D=T((e,t)=>new B({open:i,openProp:r,activeTriggerId:f,triggerIdProp:d,...C},e,t),!0);D.useControlledProp(`openProp`,r),D.useControlledProp(`triggerIdProp`,d),D.useSyncedValues(C),D.useContextCallback(`onOpenChange`,a),D.useContextCallback(`onOpenChangeComplete`,o);let O=D.useState(`open`),M=D.useState(`mounted`),N=D.useState(`payload`);_(D,O),w(D);let{forceUnmount:F}=E(O,D);k.useImperativeHandle(l,()=>({unmount:F,close:()=>D.setOpen(!1,m(h))}),[F,D]);let I=O||M;return(0,P.jsxs)(A.Provider,{value:D,children:[u&&(0,P.jsx)(S,{handle:u,store:D}),I&&(0,P.jsx)(R,{store:D,parentContext:x?.context,isDrawer:p}),typeof n==`function`?n({payload:N}):n]})}var G=k.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,s=N(),c=j(),l=c.useState(`open`),u=c.useState(`nested`),d=c.useState(`transitionStatus`),p=c.useState(`nestedOpenDialogCount`),m=c.useState(`mounted`),h=c.useStateSetter(`viewportElement`);return f(`div`,e,{enabled:s||m,state:{open:l,nested:u,transitionStatus:d,nestedDialogOpen:p>0},ref:[t,h],stateAttributesMapping:I,props:[{role:`presentation`,hidden:!m,style:{pointerEvents:l?void 0:`none`},children:a},o]})});export{I as a,L as i,W as n,N as o,V as r,j as s,G as t};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{It as n}from"./primary-DjXNHNGV.js";import{Ar as r,Tn as i,ia as a,in as o}from"./runtime-L56puJDA.js";import{a as s,d as ee,f as te,i as c,l as ne,m as re,n as ie,o as ae,p as oe,r as se,t as ce,u as le}from"./ChatRightPanel-BewXBRFZ.js";import{k as ue}from"./ContextHandoffEndpointLabel-CPeU4K5A.js";import{t as de}from"./utils-5-6TOrS1.js";import{c as fe}from"./useSwipeDismiss-CcW-GPO_.js";import{t as pe}from"./useNavigate-2tVq4iZ2.js";import{t as me}from"./usePresentationTier-B_SCFvN7.js";import{o as l}from"./sidebar-4cwEndEB.js";import{t as he}from"./useAppSidebarCollapsed-mtvJ7qbW.js";import{_ as u,c as ge,d,f,g as p,h as m,m as h,p as g,s as _e,u as _}from"./main-DaXSCt8g.js";var v=e(t(),1),y=a();function b({rawDraftId:e,search:t}){let a=pe(),b=r.make(e),x=`draft:${b}`,ve=(0,v.useCallback)(e=>{a({to:`/draft/$draftId`,params:{draftId:b},replace:!0,search:e})},[b,a]),S=ee({threadKey:x,search:t,replaceSearch:ve}),C=re(b),w=i((0,v.useMemo)(()=>o(C?.threadId??null),[C?.threadId])),T=ne(w),E=(0,v.useMemo)(()=>C?.promotedTo?T?C.promotedTo:null:w?{environmentId:w.environmentId,threadId:w.id}:null,[C?.promotedTo,w,T]),D=S.diff===`1`,O=S.preview===`1`,k=_e(S),A=ge(S),j=S.workspaceTab===`agent`&&S.workspaceAgentKey?S.workspaceAgentKey:null,M=ue(le),N=me(),P=E?`${E.environmentId}:${E.threadId}`:null,F=n(e=>P?e.pendingOpenByThreadKey[P]:void 0),ye=n(e=>e.consumeOpenRequest),be=he(),{maximized:I,toggleMaximized:xe}=oe({threadKey:b,open:A,canMaximize:!M&&N!==`phone`}),[L,R]=(0,v.useState)(()=>({draftId:b,hasOpenedDiff:D,hasOpenedPreview:O,hasOpenedTerminal:k===`terminal`,hasOpenedSimulator:k===`simulator`,hasOpenedBrowser:k===`browser`,hasOpenedAgents:k===`agents`,openedAgentKeys:j?[j]:[]}));(0,v.useEffect)(()=>{E&&F&&N!==`phone`&&(ye(E.environmentId,E.threadId),a({to:`/draft/$draftId`,params:{draftId:b},search:e=>m(e)}))},[E,ye,b,a,F,N]);let z=L.draftId===b?L.hasOpenedDiff:D,B=L.draftId===b?L.hasOpenedPreview:O,V=L.draftId===b?L.hasOpenedTerminal:k===`terminal`,H=L.draftId===b?L.hasOpenedSimulator:k===`simulator`,U=L.draftId===b?L.hasOpenedBrowser:k===`browser`,W=L.draftId===b?L.hasOpenedAgents:k===`agents`,G=(0,v.useMemo)(()=>{let e=L.draftId===b?L.openedAgentKeys:j?[j]:[];return j&&!e.includes(j)?[...e,j]:e},[j,b,L]),[K,Se]=(0,v.useState)(()=>k??`files`),q=(0,v.useMemo)(()=>{let e=[];return(B||k===`files`)&&e.push(`files`),(z||k===`review`)&&e.push(`review`),(V||k===`terminal`)&&e.push(`terminal`),(H||k===`simulator`)&&e.push(`simulator`),(U||k===`browser`)&&e.push(`browser`),(W||k===`agents`)&&e.push(`agents`),e},[W,z,B,H,U,V,k]),J=(0,v.useCallback)(e=>{Se(e),R(t=>{let n={draftId:b,hasOpenedDiff:(t.draftId===b?t.hasOpenedDiff:D)||e===`review`,hasOpenedPreview:(t.draftId===b?t.hasOpenedPreview:O)||e===`files`,hasOpenedTerminal:(t.draftId===b?t.hasOpenedTerminal:k===`terminal`)||e===`terminal`,hasOpenedSimulator:(t.draftId===b?t.hasOpenedSimulator:k===`simulator`)||e===`simulator`,hasOpenedBrowser:(t.draftId===b?t.hasOpenedBrowser:k===`browser`)||e===`browser`,hasOpenedAgents:(t.draftId===b?t.hasOpenedAgents:k===`agents`)||e===`agents`,openedAgentKeys:t.draftId===b?t.openedAgentKeys:G};return t.draftId===n.draftId&&t.hasOpenedDiff===n.hasOpenedDiff&&t.hasOpenedPreview===n.hasOpenedPreview&&t.hasOpenedTerminal===n.hasOpenedTerminal&&t.hasOpenedSimulator===n.hasOpenedSimulator&&t.hasOpenedBrowser===n.hasOpenedBrowser&&t.hasOpenedAgents===n.hasOpenedAgents&&t.openedAgentKeys===n.openedAgentKeys?t:n})},[D,b,G,O,k]),Y=(0,v.useCallback)(()=>{a({to:`/draft/$draftId`,params:{draftId:b},search:e=>se(e)})},[b,a]),X=(0,v.useCallback)(()=>{a({to:`/draft/$draftId`,params:{draftId:b},search:e=>{let t=G[G.length-1];return K===`agent`&&t?_(e,t):K===`files`&&B?g(e):K===`review`&&z?h(e):K===`terminal`&&V?p(e):K===`simulator`&&H?m(e):K===`browser`&&U?f(e):K===`agents`&&W?d(e):B?g(e):z?h(e):V?p(e):H?m(e):U?f(e):W?d(e):t?_(e,t):u(e)}})},[b,W,z,B,H,U,V,K,a,G]),Z=(0,v.useCallback)(()=>{if(A){Y();return}X()},[Y,X,A]),Q=(0,v.useCallback)(e=>{if(e.mode===`agent`){let t=G.filter(t=>t!==e.agentKey);R(e=>({draftId:b,hasOpenedDiff:e.draftId===b?e.hasOpenedDiff:z,hasOpenedPreview:e.draftId===b?e.hasOpenedPreview:B,hasOpenedTerminal:e.draftId===b?e.hasOpenedTerminal:V,hasOpenedSimulator:e.draftId===b?e.hasOpenedSimulator:H,hasOpenedBrowser:e.draftId===b?e.hasOpenedBrowser:U,hasOpenedAgents:e.draftId===b?e.hasOpenedAgents:W,openedAgentKeys:t})),k===`agent`&&j===e.agentKey&&a({to:`/draft/$draftId`,params:{draftId:b},search:e=>{let n=t[t.length-1];return n?_(e,n):B?g(e):z?h(e):V?p(e):H?m(e):U?f(e):W?d(e):u(e)}});return}let t=e.mode===`review`?!1:z||k===`review`,n=e.mode===`files`?!1:B||k===`files`,r=e.mode===`terminal`?!1:V||k===`terminal`,i=e.mode===`simulator`?!1:H||k===`simulator`,o=e.mode===`browser`?!1:U||k===`browser`,s=e.mode===`agents`?!1:W||k===`agents`;R(e=>{let a={draftId:b,hasOpenedDiff:t,hasOpenedPreview:n,hasOpenedTerminal:r,hasOpenedSimulator:i,hasOpenedBrowser:o,hasOpenedAgents:s,openedAgentKeys:e.draftId===b?e.openedAgentKeys:G};return e.draftId===a.draftId&&e.hasOpenedDiff===a.hasOpenedDiff&&e.hasOpenedPreview===a.hasOpenedPreview&&e.hasOpenedTerminal===a.hasOpenedTerminal&&e.hasOpenedSimulator===a.hasOpenedSimulator&&e.hasOpenedBrowser===a.hasOpenedBrowser&&e.hasOpenedAgents===a.hasOpenedAgents&&e.openedAgentKeys===a.openedAgentKeys?e:a}),k===e.mode&&a({to:`/draft/$draftId`,params:{draftId:b},search:a=>e.mode!==`files`&&n?g(a):e.mode!==`review`&&t?h(a):e.mode!==`terminal`&&r?p(a):e.mode!==`simulator`&&i?m(a):e.mode!==`browser`&&o?f(a):e.mode!==`agents`&&s?d(a):u(a)})},[j,b,W,z,B,H,U,V,a,G,k]);if((0,v.useEffect)(()=>{k!==null&&(Se(k),J(k))},[J,k]),(0,v.useEffect)(()=>{j&&R(e=>{let t=e.draftId===b?e.openedAgentKeys:[];return t.includes(j)?e.draftId===b?e:{draftId:b,hasOpenedDiff:z,hasOpenedPreview:B,hasOpenedTerminal:V,hasOpenedSimulator:H,hasOpenedBrowser:U,hasOpenedAgents:W,openedAgentKeys:t}:{draftId:b,hasOpenedDiff:e.draftId===b?e.hasOpenedDiff:D,hasOpenedPreview:e.draftId===b?e.hasOpenedPreview:O,hasOpenedTerminal:e.draftId===b?e.hasOpenedTerminal:k===`terminal`,hasOpenedSimulator:e.draftId===b?e.hasOpenedSimulator:k===`simulator`,hasOpenedBrowser:e.draftId===b?e.hasOpenedBrowser:k===`browser`,hasOpenedAgents:e.draftId===b?e.hasOpenedAgents:k===`agents`,openedAgentKeys:[...t,j]}})},[j,D,b,W,z,B,H,U,V,O,k]),(0,v.useEffect)(()=>{E&&(te(x,`${E.environmentId}:${E.threadId}`),a({to:`/$environmentId/$threadId`,params:fe(E),replace:!0}))},[E,a,x]),(0,v.useEffect)(()=>{C||E||a({to:`/`,replace:!0})},[E,C,a]),E)return(0,y.jsx)(l,{className:`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,children:(0,y.jsx)(c,{environmentId:E.environmentId,threadId:E.threadId,routeKind:`server`})});if(!C)return null;let Ce=A||k===`review`||z||k===`files`||B||k===`terminal`||V||k===`simulator`||H||k===`browser`||U||k===`agents`||W||k===`agent`||G.length>0,we=A||k===`review`||z||k===`files`||B||k===`terminal`||V||k===`agent`||G.length>0,$=A?k:K;return N===`phone`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l,{className:`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,children:(0,y.jsx)(c,{draftId:b,environmentId:C.environmentId,threadId:C.threadId,onDiffPanelOpen:()=>J(`review`),onPreviewPanelOpen:()=>J(`files`),onTerminalPanelOpen:()=>J(`terminal`),onAgentPanelOpen:()=>J(`agent`),workspacePanelOpen:A,onToggleWorkspacePanel:Z,routeKind:`draft`})}),(0,y.jsx)(ae,{label:`Workspace`,open:A,onClose:Y,children:we?(0,y.jsx)(ce,{mode:`phone`,panelMode:$,openedPanelModes:q,openedAgentKeys:G,onClosePanelTab:Q}):null})]}):M?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l,{className:`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,children:(0,y.jsx)(c,{draftId:b,environmentId:C.environmentId,threadId:C.threadId,onDiffPanelOpen:()=>J(`review`),onPreviewPanelOpen:()=>J(`files`),onTerminalPanelOpen:()=>J(`terminal`),onAgentPanelOpen:()=>J(`agent`),workspacePanelOpen:A,onToggleWorkspacePanel:Z,routeKind:`draft`})}),(0,y.jsx)(s,{open:A,onClose:Y,children:Ce?(0,y.jsx)(ce,{mode:`sheet`,panelMode:$,openedPanelModes:q,openedAgentKeys:G,onClosePanelTab:Q}):null})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(l,{className:de(`h-svh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground md:h-dvh`,I&&`w-0 flex-none`),inert:I?!0:void 0,children:(0,y.jsx)(c,{draftId:b,environmentId:C.environmentId,threadId:C.threadId,onDiffPanelOpen:()=>J(`review`),onPreviewPanelOpen:()=>J(`files`),onTerminalPanelOpen:()=>J(`terminal`),onAgentPanelOpen:()=>J(`agent`),workspacePanelOpen:A,onToggleWorkspacePanel:Z,routeKind:`draft`})}),(0,y.jsx)(ie,{open:A,panelMode:$,openedPanelModes:q,openedAgentKeys:G,onClosePanelTab:Q,onClose:Y,onOpen:X,renderContent:Ce,maximized:I,onToggleMaximized:xe,reserveChromeInset:I&&be})]})}export{b as DraftChatThreadRouteView};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{ia as n}from"./runtime-L56puJDA.js";import{D as r}from"./usePositioner-0Kb-C4al.js";import{t as i}from"./react-dom-x9LNwWQc.js";var a=e(t(),1),o=e(i(),1),s=n(),c=a.forwardRef(function(e,t){let{children:n,container:i,className:c,render:l,style:u,...d}=e,{node:f,subtree:p}=r({container:i,ref:t,componentProps:e,elementProps:d});return!p&&!f?null:(0,s.jsxs)(a.Fragment,{children:[p,f&&o.createPortal(n,f)]})});export{c as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./utils-5-6TOrS1.js";import"./appearancePreferences-nFx4MHoI.js";var t={sheet:`app-glass-surface-sheet`,chip:`app-glass-surface-chip`,dock:`app-glass-surface-dock`};function n(n){return e(`app-glass-surface`,t[n])}export{n as t};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{K as n}from"./primary-DjXNHNGV.js";import{Qr as r,ti as i}from"./src-gDjuIvMO.js";import{P as a,ia as o}from"./runtime-L56puJDA.js";import{t as s}from"./compiler-runtime-qmuS0Svy.js";import{o as c}from"./authorization-K_UCP_xh.js";import{f as l,g as u,h as d,m as f,p,t as m,u as h,v as g,y as _}from"./hostedConnectionCoordinator-DZh1yVqz.js";import{f as v}from"./useRenderElement-D0HVF5g_.js";import{t as y}from"./chevron-down-yka18-iP.js";import{t as b}from"./copy-riIPLkKV.js";import{t as x}from"./download-B0lbSdq5.js";import{t as ee}from"./log-out-BuoOiS45.js";import{t as te}from"./refresh-cw-MqmsC7V0.js";import{t as S}from"./shield-check-DHxdM6te.js";import{t as C}from"./shield-DlqCO-0N.js";import{t as w}from"./smartphone-OaA-Xj_d.js";import{t as ne}from"./user-round-evbX_eto.js";import{t as T}from"./x-_SjFRYll.js";import{t as E}from"./button-QrCU0tNP.js";import{t as D}from"./utils-5-6TOrS1.js";import{t as O}from"./useNavigate-2tVq4iZ2.js";import{t as k}from"./usePresentationTier-B_SCFvN7.js";import{a as re,i as A,n as ie,o as j,s as M,t as N}from"./MobileSheet-D19YdeQ9.js";import{t as P}from"./GlassSurface-BqfxDYiR.js";import{a as ae,c as oe,i as F,n as I,o as L,r as R,s as se,t as z}from"./HostedRelayTrustNotice-C9pl5h2a.js";import{n as B,o as ce}from"./settingsSections.logic-Bg960p_I.js";var V={name:`badge-check`,size:24,node:[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`verified`]};V.node;var H=v(V),le={name:`layout-grid`,size:24,node:[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]};le.node;var ue=v(le),U={name:`shield-off`,size:24,node:[[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71`,key:`1jlk70`}],[`path`,{d:`M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264`,key:`18rp1v`}]]};U.node;var de=v(U),W={name:`wifi-off`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};W.node;var G=v(W),fe={name:`wifi`,size:24,node:[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]};fe.node;var pe=v(fe),K=s(),q=e(t(),1),me=Object.freeze({"":`overview`,security:`security`,appearance:`appearance`}),he=Object.freeze({"sign-in":`/sign-in`,"sign-in-password":`/sign-in/password`,"sign-in-recovery-code":`/sign-in/recovery-code`,"sign-up":`/sign-up`,"sign-up-verify":`/public-signup/verify`,"reset-password":`/password-reset`,invitation:`/invitation`,setup:`/setup`,"email-verification":`/email-verification`,nodes:`/nodes`,"nodes-enroll":`/nodes/enroll`}),ge=Object.freeze([`sign-in`,`sign-up`,`public-signup`,`password-reset`,`invitation`,`setup`,`email-verification`,`nodes`,`account`]);function _e(e){return e.length>1&&e.endsWith(`/`)?e.slice(0,-1):e===``?`/`:e}function ve(e){let t=_e(e);if(t.startsWith(`/account`))return{kind:`account`,section:me[t.slice(8).replace(/^\//,``)]??`overview`};for(let[e,n]of Object.entries(he))if(t===n)return{kind:e};return null}function ye(e){return e.kind===`account`?e.section===`overview`?`/account`:`/account/${e.section}`:he[e.kind]}function be(e){switch(e.kind){case`sign-in`:return`Sign in`;case`sign-in-password`:return`Sign in with a password`;case`sign-in-recovery-code`:return`Use a recovery code`;case`sign-up`:return`Create your account`;case`sign-up-verify`:return`Verify your email`;case`reset-password`:return`Reset your password`;case`invitation`:return`Redeem your invitation`;case`setup`:return`Claim this Hub`;case`email-verification`:return`Email verification`;case`nodes`:return`Your nodes`;case`nodes-enroll`:return`Enroll a node`;case`account`:return e.section===`overview`?`Account`:e.section===`security`?`Security`:`Appearance`}}var xe=typeof window>`u`?`/`:_e(window.location.pathname),Se=new Set;function Ce(){for(let e of Array.from(Se))e()}function we(e){let t=_e(e);t!==xe&&(xe=t,Ce())}var Te=!1;function Ee(){Te||(Te=!0,_(()=>{we(u().logicalPathname)}))}function De(){return d()===null?typeof window>`u`?xe:_e(window.location.pathname):xe}var Oe=!1;function ke(){Oe||typeof window>`u`||(Oe=!0,window.addEventListener(`popstate`,()=>{d()===null&&Ce()}))}function Ae(e){return Ee(),ke(),Se.add(e),()=>{Se.delete(e)}}function je(e,t){Me(ye(e),t)}function Me(e,t){let n=_e(e),r=d();if(r){t?.replace===!0?r.replace(n):r.push(n),we(n);return}typeof window<`u`&&(t?.replace===!0?window.history.replaceState(window.history.state,``,n):window.history.pushState(window.history.state,``,n)),xe=n,Ce()}function Ne(){let e=(0,K.c)(2),t=(0,q.useSyncExternalStore)(Ae,De),n;return e[0]===t?n=e[1]:(n=ve(t),e[0]=t,e[1]=n),n}var J=o(),Pe={unavailable:`The node from this link is not in your authorized node directory. Choose a node to continue.`,revoked:`Access to the node from this link was revoked. Choose a node to continue.`,offline:`The node from this link is offline. Choose a node to continue.`,"invalid-link":`This node link is not valid. Choose a node to continue.`},Fe=null,Ie=new Set;function Y(e){if(Fe!==e){Fe=e;for(let e of Array.from(Ie))e()}}function Le(e){return Ie.add(e),()=>{Ie.delete(e)}}function Re(){return Fe===null?null:Pe[Fe]}function ze(){return(0,q.useSyncExternalStore)(Le,Re)}function Be(){return(0,q.useSyncExternalStore)(_,u)}var Ve=new Set([`node`,`draft`,`pair`,`diagnostics`,...ge]);function He(e){let t=/^\/([^/]+)\/([^/]+)\/?$/.exec(e);if(!t)return null;let n=t[1]??``;if(Ve.has(n))return null;try{return decodeURIComponent(n)}catch{return n}}function Ue(e){let t=/^\/([^/]+)\/([^/]+)\/?$/u.exec(e);if(!t||Ve.has(t[1]??``))return null;try{return{environmentId:r.make(decodeURIComponent(t[1]??``)),threadId:i.make(decodeURIComponent(t[2]??``))}}catch{return null}}function We(e){return e.startsWith(`/draft/`)}var X=null,Z=null,Q=null,Ge=!1,Ke=null,qe=0,Je=!1,Ye=null,Xe=null;function $(e){let t=e?JSON.stringify([e.environmentId,e.threadId]):null;t!==Ye&&(Xe?.(),Xe=null,Ye=t,e&&(Xe=h(e.environmentId,e.threadId)))}function Ze(e){return e?JSON.stringify([e.environmentId,e.threadId]):null}function Qe(){Je||(Je=!0,queueMicrotask(()=>{Je=!1,qe!==0&&tt()}))}function $e(e){Ge=!0;try{e()}finally{Ge=!1}Qe()}function et(e,t){X=null,Z=null,Q=null,(e===`none`||e===`online`||e===`offline`)&&Y(t),p()}function tt(){if(Ge||!d())return;let e=u(),t=a.getState();if(e.malformed){Y(`invalid-link`),$(null),p();return}if(t.accountStatus!==`authenticated`){$(null),Ke===`authenticated`&&Y(null),Ke=t.accountStatus;return}Ke=t.accountStatus;let n=e.nodeId;if(n===null){if(Q=null,$(null),X=null,Z=null,t.selectedNode&&!m()){let e=t.selectionStatus===`revoked`||t.selectionStatus===`authorization-removed`||t.selectionStatus===`incompatible`;c.returnToDirectory(e?{preserveTerminalSelection:!0}:void 0);return}nt(e.logicalPathname,t);return}let r=Ue(e.logicalPathname);Ze(r)!==Ye&&$(null);let i=t.nodes.find(e=>e.id===n)??null;if(i&&(i.capabilities?.nativeClientRequired===!0||r&&i.environmentId!==r.environmentId)){$(null),et(t.selectionStatus,`unavailable`);return}if(t.selectedNode?.id===n){if($(r),X=null,Q=null,t.sessionEstablished){Z=null,Y(null);return}if(Z===n&&t.transportStatus===`terminal-failure`&&(t.selectionStatus===`revoked`||t.selectionStatus===`authorization-removed`||t.selectionStatus===`incompatible`)){Z=null,$e(()=>{p(),c.returnToDirectory({preserveTerminalSelection:!0})});return}Z===n&&t.transportStatus===`terminal-failure`&&t.selectionStatus===`offline`&&t.errorMessage===`Ryco state could not be synchronized.`&&$e(()=>{et(t.selectionStatus,`offline`),c.returnToDirectory()});return}if(t.directoryStatus===`stale`){et(t.selectionStatus,`unavailable`);return}if(t.directoryStatus!==`ready`||t.browserStatus!==`current`)return;let o=t.nodes.find(e=>e.id===n);if(!o){et(t.selectionStatus,`unavailable`);return}if(o.revokedAt!==null){et(t.selectionStatus,`revoked`);return}let s=Q===n;$(r);let l=r!==null&&!o.presence.online&&!s;r&&m()&&!l||X!==n&&(X=n,Z=s?null:n,Q=null,Y(null),c.selectNode(o.id).finally(()=>{X===n&&(X=null)}))}function nt(e,t){if(We(e)){p();return}let n=He(e);if(n===null)return;if(t.directoryStatus===`stale`){Y(`unavailable`),p();return}if(t.directoryStatus!==`ready`)return;let r=t.nodes.find(e=>e.environmentId===n&&e.revokedAt===null);if(!r){Y(`unavailable`),p();return}l(r.id)}function rt(e){return d()?(Q=e,Y(null),f(e)):!1}function it(){if(!d())return!1;Q=null,Y(null);let e=u();return e.nodeId===null&&e.logicalPathname===`/nodes`||g()}function at(){qe+=1;let e=_(Qe),t=a.subscribe(Qe),n=d()?.subscribe(()=>Qe());Qe();let r=!1;return()=>{r||(r=!0,--qe,e(),t(),n?.())}}function ot(){let e=(0,K.c)(1),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=[],e[0]=t):t=e[0],(0,q.useEffect)(st,t)}function st(){return at()}function ct(e){let t=(0,K.c)(11),{label:n,status:r,icon:i,onClick:a,testId:o,className:s}=e,c;t[0]===s?c=t[1]:(c=D(P(`chip`),`flex min-h-11 min-w-11 max-w-[136px] shrink items-center justify-center gap-1.5 rounded-full border border-border px-2.5 text-xs font-medium outline-none focus-visible:ring-2 focus-visible:ring-ring`,s),t[0]=s,t[1]=c);let l;t[2]===r?l=t[3]:(l=(0,J.jsx)(`span`,{"data-slot":`mobile-status-chip-status`,className:`min-w-0 truncate`,children:r}),t[2]=r,t[3]=l);let u;return t[4]!==i||t[5]!==n||t[6]!==a||t[7]!==c||t[8]!==l||t[9]!==o?(u=(0,J.jsxs)(`button`,{type:`button`,"aria-label":n,"data-slot":`mobile-status-chip`,"data-testid":o,className:c,onClick:a,children:[i,l]}),t[4]=i,t[5]=n,t[6]=a,t[7]=c,t[8]=l,t[9]=o,t[10]=u):u=t[10],u}var lt={legacy:{glyph:`legacy`,iconClassName:`text-amber-500`},web:{glyph:`browser-encrypted`,iconClassName:`text-sky-500`},account:{glyph:`account-trusted`,iconClassName:`text-indigo-500`},e2ee:{glyph:`native-verified`,iconClassName:`text-emerald-500`}};function ut(e){return e.guarantee===`none`?e.connected?{glyph:`connected`,iconClassName:`text-emerald-500`}:{glyph:`disconnected`,iconClassName:`text-amber-500`}:lt[e.guarantee]}function dt(){let e=(0,K.c)(19),t=ae(),r=L(),i=a(mt),o=a(pt),s=a(ft);if(t!==`web-unsigned`)return null;let c,l;e[0]!==r||e[1]!==o||e[2]!==i||e[3]!==s?(c=R(ce(`security`,{hosted:n(),role:B(i,o,s)})),l=F(r,c),e[0]=r,e[1]=o,e[2]=i,e[3]=s,e[4]=c,e[5]=l):(c=e[4],l=e[5]);let u=l;if(!u){let t;return e[6]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`section`,{"aria-label":`Session code`,"data-testid":`hosted-e2ee-verification`,"data-code":`absent`,className:`space-y-2`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium`,children:`Session code`}),(0,J.jsx)(`p`,{"data-testid":`hosted-e2ee-verification-unavailable`,className:`text-[11px] leading-relaxed text-muted-foreground`,children:I})]}),e[6]=t):t=e[6],t}let d;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,J.jsx)(`p`,{className:`text-xs font-medium`,children:`Session code`}),e[7]=d):d=e[7];let f;e[8]===u.display?f=e[9]:(f=(0,J.jsx)(`p`,{"data-testid":`hosted-e2ee-verification-code`,className:`font-mono text-base leading-none font-semibold tracking-[0.2em] whitespace-nowrap select-all`,children:u.display}),e[8]=u.display,e[9]=f);let p;e[10]===u.display?p=e[11]:(p=()=>void navigator.clipboard.writeText(u.display),e[10]=u.display,e[11]=p);let m;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,J.jsx)(b,{"aria-hidden":!0,className:`size-3.5`}),e[12]=m):m=e[12];let h;e[13]===p?h=e[14]:(h=(0,J.jsxs)(`button`,{type:`button`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,onClick:p,children:[m,` Copy`]}),e[13]=p,e[14]=h);let g;return e[15]!==c||e[16]!==f||e[17]!==h?(g=(0,J.jsxs)(`section`,{"aria-label":`Session code`,"data-testid":`hosted-e2ee-verification`,"data-code":`present`,"data-form":c,className:`space-y-2`,children:[d,f,h]}),e[15]=c,e[16]=f,e[17]=h,e[18]=g):g=e[18],g}function ft(e){return e.transportStatus}function pt(e){return e.directoryStatus}function mt(e){return e.effectiveRole}var ht=`ryco:pwa:activate:v1`,gt=`Installation is temporarily unavailable.`,_t={errorMessage:null,installState:`hidden`,platform:`other`,registrationState:`disabled`,updateState:`idle`};function vt(e){return e===``||e===`./`?`./`:e.endsWith(`/`)?e:`${e}/`}function yt(e){let t=e.navigator.userAgent;return/iPad|iPhone|iPod/.test(t)||/Macintosh/.test(t)&&e.navigator.maxTouchPoints>1}function bt(e){let t=e;return typeof t.prompt==`function`&&t.userChoice instanceof Promise}function xt(e){let t=_t,n=!1,r=null,i=null,a=!!e.navigator.serviceWorker?.controller,o=!1,s=!1,c=new Set,l=e.window.matchMedia(`(display-mode: standalone)`),u=e=>{let n={...t,...e};Object.entries(n).every(([e,n])=>t[e]===n)||(t=n,c.forEach(e=>e()))},d=()=>l.matches||e.navigator.standalone===!0,f=()=>d()?`installed`:`manual-available`,p=e=>{bt(e)&&!d()&&(e.preventDefault(),r=e,u({installState:`native-available`}))},m=()=>{r=null,u({installState:`installed`})},h=()=>{d()?(r=null,u({installState:`installed`})):u({installState:r?`native-available`:`manual-available`})},g=()=>{let t=a;a=!!e.navigator.serviceWorker?.controller,!(o||!s&&!t)&&(s=!1,o=!0,e.window.reload())},_=t=>{i=t,t.waiting&&u({updateState:`ready`}),t.addEventListener(`updatefound`,()=>{let n=t.installing;n&&n.addEventListener(`statechange`,()=>{n.state===`installed`&&e.navigator.serviceWorker?.controller&&u({updateState:`ready`})})})},v=async()=>{let t=e.navigator.serviceWorker;if(!t){u({registrationState:`unavailable`,errorMessage:gt});return}u({registrationState:`registering`,errorMessage:null});try{let n=vt(e.baseUrl);_(await t.register(`${n}service-worker.js`,{scope:n})),u({registrationState:`ready`,errorMessage:null})}catch{u({registrationState:`unavailable`,errorMessage:gt})}};return{activateUpdate(){let e=i?.waiting;e&&t.updateState===`ready`&&(s=!0,u({updateState:`activating`}),e.postMessage({type:ht}))},dismissInstall(){r=null,u({installState:d()?`installed`:`hidden`})},getSnapshot(){return t},async promptInstall(){let e=r;e&&(r=null,u({installState:`hidden`}),await e.prompt(),(await e.userChoice).outcome===`dismissed`&&!d()&&u({installState:`manual-available`}))},async start(t){n||(n=!0,t.enabled&&(a=!!e.navigator.serviceWorker?.controller,o=!1,u({installState:f(),platform:yt(e)?`ios`:`other`}),e.window.addEventListener(`beforeinstallprompt`,p),e.window.addEventListener(`appinstalled`,m),l.addEventListener(`change`,h),e.navigator.serviceWorker?.addEventListener(`controllerchange`,g),e.document.readyState===`complete`?await v():e.window.addEventListener(`load`,()=>void v(),{once:!0})))},stop(){n&&(n=!1,r=null,i=null,a=!1,o=!1,s=!1,e.window.removeEventListener(`beforeinstallprompt`,p),e.window.removeEventListener(`appinstalled`,m),l.removeEventListener(`change`,h),e.navigator.serviceWorker?.removeEventListener(`controllerchange`,g),t=_t,c.forEach(e=>e()))},subscribe(e){return c.add(e),()=>c.delete(e)}}}function St(){let e=navigator;return{baseUrl:`/`,document,navigator:{maxTouchPoints:e.maxTouchPoints,userAgent:e.userAgent,...e.serviceWorker?{serviceWorker:e.serviceWorker}:{},...typeof e.standalone==`boolean`?{standalone:e.standalone}:{}},window:{addEventListener:window.addEventListener.bind(window),removeEventListener:window.removeEventListener.bind(window),matchMedia:window.matchMedia.bind(window),reload:()=>window.location.reload()}}}var Ct=typeof window>`u`?null:xt(St());function wt(e){let t=(0,K.c)(3),{compact:n,lifecycle:r}=e,i=n!==void 0&&n,a=r===void 0?Ct:r,o;return t[0]!==i||t[1]!==a?(o=a?(0,J.jsx)(Tt,{compact:i,lifecycle:a}):null,t[0]=i,t[1]=a,t[2]=o):o=t[2],o}function Tt(e){let t=(0,K.c)(27),{compact:n,lifecycle:r}=e,i=(0,q.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot),[a,o]=(0,q.useState)(!1);if(i.installState!==`native-available`&&i.installState!==`manual-available`&&i.updateState===`idle`&&i.registrationState!==`unavailable`)return null;let s=n?`space-y-2`:`mt-4 space-y-3`,c;t[0]!==n||t[1]!==r||t[2]!==i.installState?(c=i.installState===`native-available`?(0,J.jsxs)(E,{className:`min-h-11`,size:n?`sm`:`default`,variant:`outline`,onClick:()=>void r.promptInstall(),children:[(0,J.jsx)(x,{"aria-hidden":!0}),` Install Ryco`]}):null,t[0]=n,t[1]=r,t[2]=i.installState,t[3]=c):c=t[3];let l;t[4]!==n||t[5]!==a||t[6]!==i.installState?(l=i.installState===`manual-available`?(0,J.jsxs)(E,{className:`min-h-11`,size:n?`sm`:`default`,variant:`outline`,"aria-expanded":a,onClick:()=>o(Et),children:[(0,J.jsx)(w,{"aria-hidden":!0}),` How to install`]}):null,t[4]=n,t[5]=a,t[6]=i.installState,t[7]=l):l=t[7];let u;t[8]!==n||t[9]!==r||t[10]!==i.updateState?(u=i.updateState===`idle`?null:(0,J.jsxs)(E,{className:`min-h-11`,size:n?`sm`:`default`,variant:`outline`,disabled:i.updateState===`activating`,onClick:()=>r.activateUpdate(),children:[(0,J.jsx)(te,{"aria-hidden":!0}),i.updateState===`activating`?`Updating…`:`Update ready`]}),t[8]=n,t[9]=r,t[10]=i.updateState,t[11]=u):u=t[11];let d;t[12]!==c||t[13]!==l||t[14]!==u?(d=(0,J.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c,l,u]}),t[12]=c,t[13]=l,t[14]=u,t[15]=d):d=t[15];let f;t[16]!==a||t[17]!==i?(f=a?(0,J.jsx)(Dt,{snapshot:i,onClose:()=>o(!1)}):null,t[16]=a,t[17]=i,t[18]=f):f=t[18];let p;t[19]!==i.errorMessage||t[20]!==i.registrationState?(p=i.registrationState===`unavailable`&&i.errorMessage?(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:i.errorMessage}):null,t[19]=i.errorMessage,t[20]=i.registrationState,t[21]=p):p=t[21];let m;return t[22]!==s||t[23]!==d||t[24]!==f||t[25]!==p?(m=(0,J.jsxs)(`section`,{className:s,"aria-label":`Ryco app installation`,children:[d,f,p]}),t[22]=s,t[23]=d,t[24]=f,t[25]=p,t[26]=m):m=t[26],m}function Et(e){return!e}function Dt(e){let t=(0,K.c)(13),{snapshot:n,onClose:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,J.jsx)(`p`,{className:`font-medium`,children:`Install Ryco on this device`}),t[0]=i):i=t[0];let a;t[1]===n.platform?a=t[2]:(a=(0,J.jsxs)(`div`,{children:[i,n.platform===`ios`?(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`In Safari, open the Share or browser menu, choose Add to Home Screen, enable Open as Web App when offered, then tap Add.`}):(0,J.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-muted-foreground`,children:`Open the browser menu, choose Add to home screen or Install app, then confirm Install.`})]}),t[1]=n.platform,t[2]=a);let o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,J.jsx)(T,{"aria-hidden":!0}),t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,J.jsx)(`span`,{className:`sr-only`,children:`Close install instructions`}),t[4]=s):s=t[4];let c;t[5]===r?c=t[6]:(c=(0,J.jsxs)(E,{className:`size-11 shrink-0`,size:`icon`,variant:`ghost`,onClick:r,children:[o,` `,s]}),t[5]=r,t[6]=c);let l;t[7]!==a||t[8]!==c?(l=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[a,c]}),t[7]=a,t[8]=c,t[9]=l):l=t[9];let u;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,J.jsx)(`div`,{className:`mt-3 border-t border-border pt-3`,children:(0,J.jsx)(z,{compact:!0})}),t[10]=u):u=t[10];let d;return t[11]===l?d=t[12]:(d=(0,J.jsxs)(`div`,{role:`region`,"aria-label":`Install Ryco instructions`,className:`rounded-lg border border-border bg-background p-3 text-sm`,children:[l,u]}),t[11]=l,t[12]=d),d}var Ot={connected:pe,disconnected:G,legacy:de,"browser-encrypted":C,"account-trusted":H,"native-verified":S};function kt(e){let t=(0,K.c)(9),{indicator:n,className:r,testId:i}=e,a;t[0]===n?a=t[1]:(a=ut(n),t[0]=n,t[1]=a);let{glyph:o,iconClassName:s}=a,c=Ot[o],l=String(n.connected),u=`${r} ${s}`,d;return t[2]!==c||t[3]!==o||t[4]!==n.guarantee||t[5]!==l||t[6]!==u||t[7]!==i?(d=(0,J.jsx)(c,{"aria-hidden":!0,"data-testid":i,"data-connected":l,"data-guarantee":n.guarantee,"data-glyph":o,className:u}),t[2]=c,t[3]=o,t[4]=n.guarantee,t[5]=l,t[6]=u,t[7]=i,t[8]=d):d=t[8],d}function At(e){let t=(0,K.c)(3),{node:n}=e;if(n.revokedAt){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,J.jsx)(`span`,{className:`text-xs text-destructive`,children:`Revoked`}),t[0]=e):e=t[0],e}let r;return t[1]===n.presence.online?r=t[2]:(r=n.presence.online?(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-emerald-600 dark:text-emerald-400`,children:[(0,J.jsx)(pe,{"aria-hidden":!0,className:`size-3.5`}),` Online`]}):(0,J.jsxs)(`span`,{className:`flex items-center gap-1 text-xs text-muted-foreground`,children:[(0,J.jsx)(G,{"aria-hidden":!0,className:`size-3.5`}),` Offline`]}),t[1]=n.presence.online,t[2]=r),r}function jt(){let e=(0,K.c)(7),t=O(),n;e[0]===t?n=e[1]:(n=async e=>{rt(e.id)||(await t({to:`/`,replace:!0}),await c.selectNode(e.id))},e[0]=t,e[1]=n);let r=n,i;e[2]===t?i=e[3]:(i=async()=>{it()||(await t({to:`/`,replace:!0}),await c.returnToDirectory())},e[2]=t,e[3]=i);let a=i,o;return e[4]!==a||e[5]!==r?(o={switchNode:r,returnToAllNodes:a},e[4]=a,e[5]=r,e[6]=o):o=e[6],o}function Mt(){let e=(0,K.c)(5),t=a(Ft),n=a(Pt);if(t!==`delivery-unknown`)return null;let r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,J.jsx)(`p`,{children:`A request may or may not have reached the node. Ryco did not resend it automatically.`}),e[0]=r):r=e[0];let i=!n,o=n?void 0:`Wait for session replay to finish before acknowledging this warning.`,s=n?`Acknowledge`:`Synchronizing…`,c;return e[1]!==i||e[2]!==o||e[3]!==s?(c=(0,J.jsxs)(`div`,{role:`alert`,className:`mt-2 rounded-md border border-amber-500/30 bg-amber-500/5 p-2 text-xs`,children:[r,(0,J.jsx)(E,{className:`mt-2`,size:`sm`,variant:`outline`,disabled:i,title:o,onClick:Nt,children:s})]}),e[1]=i,e[2]=o,e[3]=s,e[4]=c):c=e[4],c}function Nt(){return c.acknowledgeDeliveryUnknown()}function Pt(e){return e.sessionRecoveredAfterUnknown}function Ft(e){return e.sessionStatus}function It(){let e=(0,K.c)(62),t=a(qt),n=a(Kt),r=a(Gt),i=a(Wt),o=a(Ut),s=a(Ht),c=a(Vt),l=a(Bt),u=a(zt),d=ae(),{switchNode:f,returnToAllNodes:p}=jt(),m=(0,q.useRef)(null);if(!t)return null;let h,g;if(e[0]!==u||e[1]!==d||e[2]!==o||e[3]!==i||e[4]!==r){let t={browserStatus:u,sessionStatus:i,selectionStatus:o,transportStatus:r,e2eeStatus:d};h=oe(t),g=se(t),e[0]=u,e[1]=d,e[2]=o,e[3]=i,e[4]=r,e[5]=h,e[6]=g}else h=e[5],g=e[6];let _=g,v;e[7]===_?v=e[8]:(v=(0,J.jsx)(kt,{indicator:_,className:`size-4`}),e[7]=_,e[8]=v);let b;e[9]===t.label?b=e[10]:(b=(0,J.jsx)(`span`,{className:`max-w-32 truncate font-medium`,children:t.label}),e[9]=t.label,e[10]=b);let x;e[11]===h?x=e[12]:(x=(0,J.jsx)(`span`,{className:`max-w-24 truncate text-xs text-muted-foreground`,children:h}),e[11]=h,e[12]=x);let S;e[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,J.jsx)(y,{"aria-hidden":!0,className:`size-3.5 transition-transform group-open:rotate-180`}),e[13]=S):S=e[13];let C;e[14]!==v||e[15]!==b||e[16]!==x?(C=(0,J.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center gap-2 rounded-lg border border-border bg-card/95 px-3 py-2 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:[v,b,x,S]}),e[14]=v,e[15]=b,e[16]=x,e[17]=C):C=e[17];let w;e[18]===t.label?w=e[19]:(w=(0,J.jsx)(`p`,{className:`font-medium`,children:t.label}),e[18]=t.label,e[19]=w);let T=c??`Role unavailable`,D;e[20]!==h||e[21]!==T?(D=(0,J.jsxs)(`p`,{className:`mt-0.5 text-xs capitalize text-muted-foreground`,children:[T,` · `,h]}),e[20]=h,e[21]=T,e[22]=D):D=e[22];let O;e[23]!==t.label||e[24]!==h?(O=(0,J.jsxs)(`p`,{className:`sr-only`,"aria-live":`polite`,children:[`Node `,t.label,`: `,h,`.`]}),e[23]=t.label,e[24]=h,e[25]=O):O=e[25];let k;e[26]===l?k=e[27]:(k=l?(0,J.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:l}):null,e[26]=l,e[27]=k);let re;e[28]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,J.jsx)(Mt,{}),e[28]=re):re=e[28];let A;e[29]===p?A=e[30]:(A=()=>void p(),e[29]=p,e[30]=A);let ie;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,J.jsx)(ue,{"aria-hidden":!0,className:`size-4`}),e[31]=ie):ie=e[31];let j;e[32]===A?j=e[33]:(j=(0,J.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:A,children:[ie,` All nodes`]}),e[32]=A,e[33]=j);let M;if(e[34]!==u||e[35]!==s||e[36]!==t.id||e[37]!==n||e[38]!==f){let r;e[40]===t.id?r=e[41]:(r=e=>e.id!==t.id,e[40]=t.id,e[41]=r);let i;e[42]!==u||e[43]!==s||e[44]!==f?(i=e=>(0,J.jsxs)(`button`,{type:`button`,disabled:s!==`ready`||u!==`current`||e.revokedAt!==null||e.capabilities?.nativeClientRequired===!0,title:e.capabilities?.nativeClientRequired===!0?`Open in Desktop/Mobile`:void 0,className:`flex w-full items-center justify-between rounded-md px-2 py-2 text-left text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50`,onClick:()=>void f(e),children:[(0,J.jsx)(`span`,{className:`truncate`,children:e.label}),(0,J.jsx)(At,{node:e})]},e.id),e[42]=u,e[43]=s,e[44]=f,e[45]=i):i=e[45],M=n.filter(r).map(i),e[34]=u,e[35]=s,e[36]=t.id,e[37]=n,e[38]=f,e[39]=M}else M=e[39];let N;e[46]!==j||e[47]!==M?(N=(0,J.jsxs)(`div`,{className:`mt-3 max-h-48 space-y-1 overflow-auto border-t border-border pt-3`,children:[j,M]}),e[46]=j,e[47]=M,e[48]=N):N=e[48];let P;e[49]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,J.jsxs)(E,{size:`sm`,variant:`outline`,onClick:Rt,children:[(0,J.jsx)(te,{"aria-hidden":!0}),` Refresh`]}),e[49]=P):P=e[49];let F;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,J.jsxs)(E,{size:`sm`,variant:`ghost`,onClick:Lt,children:[(0,J.jsx)(ee,{"aria-hidden":!0}),` Sign out`]}),e[50]=F):F=e[50];let I;e[51]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 border-t border-border pt-3`,children:[P,F,(0,J.jsxs)(E,{size:`sm`,variant:`ghost`,onClick:()=>{m.current&&(m.current.open=!1),je({kind:`account`,section:`security`})},children:[(0,J.jsx)(ne,{"aria-hidden":!0}),` Security details`]})]}),e[51]=I):I=e[51];let L;e[52]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsxs)(`div`,{className:`mt-3 space-y-3 border-t border-border pt-3`,children:[(0,J.jsx)(dt,{}),(0,J.jsx)(wt,{compact:!0})]}),e[52]=L):L=e[52];let R;e[53]!==k||e[54]!==N||e[55]!==w||e[56]!==D||e[57]!==O?(R=(0,J.jsxs)(`div`,{className:`absolute right-0 z-50 mt-2 w-72 rounded-xl border border-border bg-popover p-3 shadow-xl`,children:[w,D,O,k,re,N,I,L]}),e[53]=k,e[54]=N,e[55]=w,e[56]=D,e[57]=O,e[58]=R):R=e[58];let z;return e[59]!==R||e[60]!==C?(z=(0,J.jsx)(`div`,{className:`relative max-w-full`,children:(0,J.jsxs)(`details`,{ref:m,className:`group relative`,children:[C,R]})}),e[59]=R,e[60]=C,e[61]=z):z=e[61],z}function Lt(){c.signOut()}function Rt(){c.refreshDirectory()}function zt(e){return e.browserStatus}function Bt(e){return e.errorMessage}function Vt(e){return e.effectiveRole}function Ht(e){return e.directoryStatus}function Ut(e){return e.selectionStatus}function Wt(e){return e.sessionStatus}function Gt(e){return e.transportStatus}function Kt(e){return e.nodes}function qt(e){return e.selectedNode}function Jt(e){let t=(0,K.c)(66),{open:n,onOpenChange:r}=e,i=a(on),o=a(an),s=a(rn),c=a(nn),l=a(tn),u=a(en),d=a($t),f=a(Qt),p=a(Zt),m=ae(),{switchNode:h,returnToAllNodes:g}=jt();if(!i)return null;let _,v;if(t[0]!==p||t[1]!==m||t[2]!==l||t[3]!==c||t[4]!==s){let e={browserStatus:p,sessionStatus:c,selectionStatus:l,transportStatus:s,e2eeStatus:m};_=oe(e),v=se(e),t[0]=p,t[1]=m,t[2]=l,t[3]=c,t[4]=s,t[5]=_,t[6]=v}else _=t[5],v=t[6];let y=v,b=u!==`ready`||p!==`current`,x;t[7]===y?x=t[8]:(x=(0,J.jsx)(kt,{indicator:y,className:`size-4`}),t[7]=y,t[8]=x);let S;t[9]===i.label?S=t[10]:(S=(0,J.jsx)(`span`,{className:`truncate`,children:i.label}),t[9]=i.label,t[10]=S);let C;t[11]!==x||t[12]!==S?(C=(0,J.jsxs)(j,{className:`flex items-center gap-2`,children:[x,S]}),t[11]=x,t[12]=S,t[13]=C):C=t[13];let w=d??`Role unavailable`,T;t[14]!==_||t[15]!==w?(T=(0,J.jsxs)(ie,{className:`capitalize`,children:[w,` · `,_]}),t[14]=_,t[15]=w,t[16]=T):T=t[16];let D;t[17]!==i.label||t[18]!==_?(D=(0,J.jsxs)(`p`,{className:`sr-only`,"aria-live":`polite`,children:[`Node `,i.label,`: `,_,`.`]}),t[17]=i.label,t[18]=_,t[19]=D):D=t[19];let O;t[20]!==C||t[21]!==T||t[22]!==D?(O=(0,J.jsxs)(A,{children:[C,T,D]}),t[20]=C,t[21]=T,t[22]=D,t[23]=O):O=t[23];let k;t[24]===f?k=t[25]:(k=f?(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:f}):null,t[24]=f,t[25]=k);let P;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,J.jsx)(Mt,{}),t[26]=P):P=t[26];let F;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,J.jsx)(ne,{"aria-hidden":!0,className:`size-4 shrink-0`}),t[27]=F):F=t[27];let I;t[28]===r?I=t[29]:(I=(0,J.jsx)(M,{label:`Security details`,icon:F,onClick:()=>{r(!1),je({kind:`account`,section:`security`})}}),t[28]=r,t[29]=I);let L;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,J.jsx)(ue,{"aria-hidden":!0,className:`size-4 shrink-0`}),t[30]=L):L=t[30];let R;t[31]!==r||t[32]!==g?(R=(0,J.jsx)(M,{label:`All nodes`,icon:L,onClick:()=>{r(!1),g()}}),t[31]=r,t[32]=g,t[33]=R):R=t[33];let z;if(t[34]!==i.id||t[35]!==o||t[36]!==r||t[37]!==h||t[38]!==b){let e;t[40]===i.id?e=t[41]:(e=e=>e.id!==i.id,t[40]=i.id,t[41]=e);let n;t[42]!==r||t[43]!==h||t[44]!==b?(n=e=>(0,J.jsx)(M,{label:e.label,disabled:b||e.revokedAt!==null||e.capabilities?.nativeClientRequired===!0,disabledReason:e.capabilities?.nativeClientRequired===!0?`Open in Desktop/Mobile`:e.revokedAt===null?`Node switching is unavailable until the directory and this browser are current.`:`Access to this node was revoked.`,trailing:(0,J.jsx)(At,{node:e}),onClick:()=>{r(!1),h(e)}},e.id),t[42]=r,t[43]=h,t[44]=b,t[45]=n):n=t[45],z=o.filter(e).map(n),t[34]=i.id,t[35]=o,t[36]=r,t[37]=h,t[38]=b,t[39]=z}else z=t[39];let B;t[46]!==I||t[47]!==R||t[48]!==z?(B=(0,J.jsxs)(`div`,{className:`mt-3 space-y-1 border-t border-border pt-3`,children:[I,R,z]}),t[46]=I,t[47]=R,t[48]=z,t[49]=B):B=t[49];let ce=u===`loading`,V;t[50]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,J.jsx)(te,{"aria-hidden":!0}),t[50]=V):V=t[50];let H;t[51]===ce?H=t[52]:(H=(0,J.jsxs)(E,{size:`sm`,variant:`outline`,className:`min-h-11`,disabled:ce,onClick:Xt,children:[V,` Refresh nodes`]}),t[51]=ce,t[52]=H);let le;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,J.jsxs)(E,{size:`sm`,variant:`ghost`,className:`min-h-11`,onClick:Yt,children:[(0,J.jsx)(ee,{"aria-hidden":!0}),` Sign out`]}),t[53]=le):le=t[53];let U;t[54]===H?U=t[55]:(U=(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2 border-t border-border pt-3`,children:[H,le]}),t[54]=H,t[55]=U);let de;t[56]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,J.jsx)(`div`,{className:`mt-3 space-y-3 border-t border-border pt-3`,children:(0,J.jsx)(wt,{compact:!0})}),t[56]=de):de=t[56];let W;t[57]!==B||t[58]!==U||t[59]!==k?(W=(0,J.jsxs)(re,{children:[k,P,B,U,de]}),t[57]=B,t[58]=U,t[59]=k,t[60]=W):W=t[60];let G;return t[61]!==r||t[62]!==n||t[63]!==W||t[64]!==O?(G=(0,J.jsxs)(N,{open:n,onOpenChange:r,label:`Connection`,children:[O,W]}),t[61]=r,t[62]=n,t[63]=W,t[64]=O,t[65]=G):G=t[65],G}function Yt(){c.signOut()}function Xt(){c.refreshDirectory()}function Zt(e){return e.browserStatus}function Qt(e){return e.errorMessage}function $t(e){return e.effectiveRole}function en(e){return e.directoryStatus}function tn(e){return e.selectionStatus}function nn(e){return e.sessionStatus}function rn(e){return e.transportStatus}function an(e){return e.nodes}function on(e){return e.selectedNode}function sn(){let e=(0,K.c)(25),t=a(fn),n=a(dn),r=a(un),i=a(ln),o=a(cn),s=ae(),[c,l]=(0,q.useState)(!1);if(!t)return null;let u,d;if(e[0]!==o||e[1]!==s||e[2]!==i||e[3]!==r||e[4]!==n){let t={browserStatus:o,sessionStatus:r,selectionStatus:i,transportStatus:n,e2eeStatus:s};u=oe(t),d=se(t),e[0]=o,e[1]=s,e[2]=i,e[3]=r,e[4]=n,e[5]=u,e[6]=d}else u=e[5],d=e[6];let f=d,p;e[7]!==t.label||e[8]!==c||e[9]!==r||e[10]!==u?(p=c?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`span`,{role:`status`,"aria-live":`polite`,"data-testid":`hosted-connection-status-announcer`,className:`sr-only`,children:[`Node `,t.label,`: `,u,`.`]}),r===`delivery-unknown`?(0,J.jsx)(`span`,{role:`alert`,className:`sr-only`,children:`Delivery unknown: a request may or may not have reached the node. Open the connection controls to acknowledge.`}):null]}),e[7]=t.label,e[8]=c,e[9]=r,e[10]=u,e[11]=p):p=e[11];let m=`Connection: ${t.label}, ${u}`,h;e[12]===f?h=e[13]:(h=(0,J.jsx)(kt,{indicator:f,testId:`hosted-connection-icon`,className:`size-3.5 shrink-0`}),e[12]=f,e[13]=h);let g;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>l(!0),e[14]=g):g=e[14];let _;e[15]!==f.shortLabel||e[16]!==m||e[17]!==h?(_=(0,J.jsx)(ct,{testId:`hosted-connection-pill`,label:m,status:f.shortLabel,icon:h,onClick:g}),e[15]=f.shortLabel,e[16]=m,e[17]=h,e[18]=_):_=e[18];let v;e[19]===c?v=e[20]:(v=(0,J.jsx)(Jt,{open:c,onOpenChange:l}),e[19]=c,e[20]=v);let y;return e[21]!==p||e[22]!==_||e[23]!==v?(y=(0,J.jsxs)(J.Fragment,{children:[p,_,v]}),e[21]=p,e[22]=_,e[23]=v,e[24]=y):y=e[24],y}function cn(e){return e.browserStatus}function ln(e){return e.selectionStatus}function un(e){return e.sessionStatus}function dn(e){return e.transportStatus}function fn(e){return e.selectedNode}function pn(){let e=(0,K.c)(2),t=k(),n;return e[0]===t?n=e[1]:(n=t===`phone`?(0,J.jsx)(sn,{}):(0,J.jsx)(It,{}),e[0]=t,e[1]=n),n}export{Ne as _,jt as a,Ue as c,ot as d,Be as f,Me as g,je as h,At as i,rt as l,be as m,sn as n,wt as o,ye as p,It as r,Ct as s,pn as t,ze as u,G as v};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-CRk9p9SC.css"])))=>i.map(i=>d[i]);
2
- import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./index-D5j6WG7w.js";import"./src-gDjuIvMO.js";import{F as r,I as i,N as a,P as o,Tn as s,ia as c,xn as l}from"./runtime-L56puJDA.js";import{Ft as u,It as d,Mt as f,Nt as p,Pt as m,an as h,jt as g,kt as _,r as v}from"./switch-COrEGDkz.js";import{t as y}from"./compiler-runtime-qmuS0Svy.js";import{_ as b,b as x,ht as S,o as C}from"./authorization-K_UCP_xh.js";import{h as w,t as T}from"./RootAppShell-D7c8sbA0.js";import{a as E,n as D,o as O}from"./hostedConnectionCoordinator-DZh1yVqz.js";import{f as k}from"./useRenderElement-D0HVF5g_.js";import{t as A}from"./arrow-left-gLRAasih.js";import{_ as j,a as M,c as N,d as P,f as F,g as I,h as L,i as R,l as z,m as B,o as V,p as H,t as U,u as W}from"./HostedConnectionControls-BmJd89CC.js";import{n as G,t as ee}from"./loader-circle-D0CNb5GI.js";import{t as te}from"./chevron-down-yka18-iP.js";import{t as ne}from"./chevron-right-CHyIXx5W.js";import{c as re,n as ie,o as ae,t as K}from"./toast-C_F1LeME.js";import{t as oe}from"./copy-riIPLkKV.js";import{t as se}from"./key-round-Cm6itp2V.js";import{t as ce}from"./log-out-BuoOiS45.js";import{t as le}from"./palette-kIM_geXk.js";import{t as ue}from"./refresh-cw-MqmsC7V0.js";import{t as de}from"./shield-check-DHxdM6te.js";import{t as fe}from"./triangle-alert-YXqtFxD6.js";import{t as pe}from"./user-round-evbX_eto.js";import{t as q}from"./button-QrCU0tNP.js";import{t as me}from"./utils-5-6TOrS1.js";import{t as he}from"./useNavigate-2tVq4iZ2.js";import{n as J,t as Y}from"./input-BAC5Cd3b.js";import{a as ge,i as _e,n as ve,o as ye,r as be,s as xe,t as Se}from"./sheet-CTbjQ5Bv.js";import{t as Ce}from"./skeleton-BlostfCS.js";import{t as we}from"./usePresentationTier-B_SCFvN7.js";import{i as Te,r as Ee,t as De}from"./alert-4WZo8oMe.js";import{a as Oe,i as ke,n as Ae,o as je,r as Me,t as Ne}from"./MobileSheet-D19YdeQ9.js";import{a as Pe,i as Fe,n as Ie,o as Le,r as Re,t as ze}from"./empty-CHk0OiOB.js";import{c as Be,n as Ve,r as He,t as Ue}from"./ExternalIdentityWeb.logic-pjD4pCDd.js";import{a as We}from"./settingsLayout-CmNqO2kB.js";import{t as Ge}from"./HostedRelayTrustNotice-C9pl5h2a.js";import{n as X,t as Ke}from"./data-list-CsiYTho5.js";import{S as qe,a as Je,i as Ye,o as Xe}from"./main-DaXSCt8g.js";var Ze={name:`life-buoy`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m4.93 4.93 4.24 4.24`,key:`1ymg45`}],[`path`,{d:`m14.83 9.17 4.24-4.24`,key:`1cb5xl`}],[`path`,{d:`m14.83 14.83 4.24 4.24`,key:`q42g0n`}],[`path`,{d:`m9.17 14.83-4.24 4.24`,key:`bqpfvv`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]};Ze.node;var Qe=k(Ze),$e={name:`mail`,size:24,node:[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]};$e.node;var et=k($e),Z=e(t(),1),Q=y(),tt=/^[A-Za-z0-9_-]{43}$/u,nt=/^signup_[A-Za-z0-9_-]{22,43}$/u;function rt(e){if(e.pathname===`/public-signup/verify`){let t=new URLSearchParams(e.hash.startsWith(`#`)?e.hash.slice(1):e.hash),n=t.get(`attempt`),r=t.get(`attempt_secret`),i=t.get(`token`);return n!==null&&nt.test(n)&&r!==null&&tt.test(r)&&i!==null&&tt.test(i)?{kind:`signup-verification`,attemptId:n,attemptSecret:r,token:i}:{kind:`invalid-signup-verification`}}if(e.pathname===`/password-reset`){let t=new URLSearchParams(e.hash.startsWith(`#`)?e.hash.slice(1):e.hash).get(`token`);return t!==null&&tt.test(t)?{kind:`password-reset`,token:t}:{kind:`invalid-password-reset`}}if(e.pathname===`/email-verification`){let t=new URLSearchParams(e.hash.startsWith(`#`)?e.hash.slice(1):e.hash).get(`token`);return t!==null&&tt.test(t)?{kind:`email-verification`,token:t}:{kind:`invalid-email-verification`}}return null}function it(e){let t=new URL(e.href),n=rt(t);return n===null?null:(e.replaceState(e.historyState,``,`${t.pathname}${t.search}`),n)}function at(){let e=(0,Q.c)(3),t=o(lt),n,r;e[0]===t?(n=e[1],r=e[2]):(n=()=>{if(t!==`authenticated`)return;let e=st,n=()=>{document.visibilityState===`hidden`?(E(!0),C.suspendBrowser(`hidden`)):e()},r=ot,i=()=>e(),a=()=>e();return document.addEventListener(`visibilitychange`,n),window.addEventListener(`offline`,r),window.addEventListener(`online`,i),window.addEventListener(`pageshow`,a),navigator.onLine||r(),()=>{document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`offline`,r),window.removeEventListener(`online`,i),window.removeEventListener(`pageshow`,a)}},r=[t],e[0]=t,e[1]=n,e[2]=r),(0,Z.useEffect)(n,r)}function ot(){E(!0),C.suspendBrowser(`offline`)}function st(){document.visibilityState===`visible`&&navigator.onLine&&C.resumeBrowser().then(ct)}function ct(){return E(!1)}function lt(e){return e.accountStatus}var $=c(),ut=100;function dt(e){let t=(0,Q.c)(52),{node:n,open:r,onOpenChange:i,onRename:a}=e,[o,s]=(0,Z.useState)(n.label),[c,l]=(0,Z.useState)(!1),[h,v]=(0,Z.useState)(null),y,b;t[0]!==n.label||t[1]!==r?(y=()=>{r&&(s(n.label),l(!1),v(null))},b=[n.label,r],t[0]=n.label,t[1]=r,t[2]=y,t[3]=b):(y=t[2],b=t[3]),(0,Z.useEffect)(y,b);let x;t[4]===o?x=t[5]:(x=o.trim(),t[4]=o,t[5]=x);let S=x,C=S.length===0?`Enter a node name.`:S.length>ut?`Use 100 characters or fewer.`:null,w=C===null&&S!==n.label&&!c,T;t[6]!==w||t[7]!==S||t[8]!==i||t[9]!==a?(T=async()=>{if(w){l(!0),v(null);try{await a(S),i(!1)}catch(e){let t=e;v(t instanceof Error?t.message:`Unable to rename this node.`),l(!1)}}},t[6]=w,t[7]=S,t[8]=i,t[9]=a,t[10]=T):T=t[10];let E=T,D=!c,O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsxs)(p,{children:[(0,$.jsx)(d,{children:`Rename node`}),(0,$.jsx)(g,{children:`This is the canonical name shown to everyone authorized to use this node.`})]}),t[11]=O):O=t[11];let k;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(`label`,{htmlFor:`hosted-node-name`,className:`text-sm font-medium`,children:`Node name`}),t[12]=k):k=t[12];let A=C!==null||h!==null,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>{s(e.currentTarget.value),v(null)},t[13]=j):j=t[13];let M;t[14]!==w||t[15]!==E?(M=e=>{e.key===`Enter`&&w&&E()},t[14]=w,t[15]=E,t[16]=M):M=t[16];let N;t[17]!==o||t[18]!==c||t[19]!==M||t[20]!==A?(N=(0,$.jsx)(Y,{id:`hosted-node-name`,value:o,autoFocus:!0,disabled:c,"aria-invalid":A,onChange:j,onKeyDown:M}),t[17]=o,t[18]=c,t[19]=M,t[20]=A,t[21]=N):N=t[21];let P;t[22]===C?P=t[23]:(P=C?(0,$.jsx)(`p`,{className:`text-xs text-destructive`,children:C}):null,t[22]=C,t[23]=P);let F;t[24]===h?F=t[25]:(F=h?(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:h}):null,t[24]=h,t[25]=F);let I;t[26]!==N||t[27]!==P||t[28]!==F?(I=(0,$.jsxs)(m,{className:`space-y-2`,children:[k,N,P,F]}),t[26]=N,t[27]=P,t[28]=F,t[29]=I):I=t[29];let L;t[30]===i?L=t[31]:(L=()=>i(!1),t[30]=i,t[31]=L);let R;t[32]!==c||t[33]!==L?(R=(0,$.jsx)(q,{variant:`outline`,disabled:c,onClick:L,children:`Cancel`}),t[32]=c,t[33]=L,t[34]=R):R=t[34];let z=!w,B;t[35]===E?B=t[36]:(B=()=>void E(),t[35]=E,t[36]=B);let V=c?`Saving…`:`Save`,H;t[37]!==z||t[38]!==B||t[39]!==V?(H=(0,$.jsx)(q,{disabled:z,onClick:B,children:V}),t[37]=z,t[38]=B,t[39]=V,t[40]=H):H=t[40];let U;t[41]!==R||t[42]!==H?(U=(0,$.jsxs)(f,{children:[R,H]}),t[41]=R,t[42]=H,t[43]=U):U=t[43];let W;t[44]!==I||t[45]!==U||t[46]!==D?(W=(0,$.jsxs)(u,{className:`max-w-md`,showCloseButton:D,children:[O,I,U]}),t[44]=I,t[45]=U,t[46]=D,t[47]=W):W=t[47];let G;return t[48]!==i||t[49]!==r||t[50]!==W?(G=(0,$.jsx)(_,{open:r,onOpenChange:i,children:W}),t[48]=i,t[49]=r,t[50]=W,t[51]=G):G=t[51],G}var ft=`owner_revoked`,pt=Object.freeze([Object.freeze({id:`access`,text:`Every Hub grant on this node stops working immediately, for everyone authorized through this Hub — not only for you — and any relay channel it has open right now closes.`}),Object.freeze({id:`direct`,text:`Clients paired directly with that machine are separate and keep working. Those are managed on the machine itself, with the ryco auth command.`}),Object.freeze({id:`directory`,text:`It leaves the directory for every account on this Hub, not only yours, and stays gone. There is no undo here and no state it can return to.`}),Object.freeze({id:`return`,text:`Putting that machine back starts on the machine itself: use “Leave this Hub” there, then enroll it again with a new device code and your approval. It is a new enrollment, not a reconnection.`}),Object.freeze({id:`reach`,text:`All of that is recorded here, on the Hub. A node that is offline, unreachable, or long gone is revoked in exactly the same way — which is the point of doing it from here.`})]),mt=`Check the identifier below against the machine you meant. Two nodes can carry the same name, and this is the only value that tells them apart.`;function ht(e){return{title:`Revoke ${e.label}?`,consequences:pt,subjectPrompt:mt,subjectId:e.id,confirmLabel:`Revoke this node`,pendingLabel:`Revoking…`,cancelLabel:`Cancel`,dismissLabel:`Back to the list`}}var gt=`Revoke`;function _t(e){return`${e} was revoked. It is gone from this Hub's directory for every account, and this cannot be undone.`}function vt(e){return e===null||e.outcome===`unchanged`}var yt=e=>Object.freeze(e),bt=Object.freeze([yt({id:`invalidResponse`,probe:Object.freeze({code:`invalid_response`,status:502}),selects:(e,t)=>t===`invalid_response`,failure:Object.freeze({message:`The Hub accepted the request and its answer could not be read, so whether this node was revoked is not known here. Refresh the list and check before trying again.`,outcome:`unknown`})}),yt({id:`transport`,probe:Object.freeze({code:`unavailable`,status:0}),selects:(e,t)=>e===0||t===`timeout`||t===`unavailable`,failure:Object.freeze({message:`The request left this browser and no answer came back, so whether this node was revoked is not known here. Check your connection, then refresh the list and look before trying again.`,outcome:`unknown`})}),yt({id:`csrf`,probe:Object.freeze({code:`csrf_rejected`,status:403}),selects:(e,t)=>t===`csrf_rejected`,failure:Object.freeze({message:`This request could not be verified, so nothing was changed. Refresh the page and try again.`,outcome:`unchanged`})}),yt({id:`unauthorized`,probe:Object.freeze({code:`session_invalid`,status:401}),selects:(e,t)=>e===401||t===`session_invalid`,failure:Object.freeze({message:`Your Hub session is no longer valid, so nothing was changed. Sign in and try again.`,outcome:`unchanged`})}),yt({id:`forbidden`,probe:Object.freeze({code:`forbidden`,status:403}),selects:e=>e===403,failure:Object.freeze({message:`Only an owner of this Hub can revoke a node. Nothing was changed.`,outcome:`unchanged`})}),yt({id:`notFound`,probe:Object.freeze({code:`not_found`,status:404}),selects:e=>e===404,failure:Object.freeze({message:`The Hub has no active node under this identifier: it was already revoked, or it is not this Hub's. Either way there is nothing here left to revoke.`,outcome:`already-gone`})}),yt({id:`conflict`,probe:Object.freeze({code:`conflict`,status:409}),selects:e=>e===409,failure:Object.freeze({message:`The Hub reported a conflicting change on this node, so nothing was changed. Refresh and look at it again before retrying.`,outcome:`unchanged`})}),yt({id:`rateLimited`,probe:Object.freeze({code:`node_rate_limited`,status:429}),selects:e=>e===429,failure:Object.freeze({message:`The Hub is refusing further owner changes for now, so nothing was changed. Wait a little and try again.`,outcome:`unchanged`})}),yt({id:`badRequest`,probe:Object.freeze({code:`invalid_request`,status:400}),selects:(e,t)=>e===400||t===`invalid_request`,failure:Object.freeze({message:`The Hub refused this request, so nothing was changed.`,outcome:`unchanged`})})]),xt=Object.freeze({message:`This node could not be revoked. Nothing was changed. Try again in a moment.`,outcome:`unchanged`});function St(e){let t=Ct(e),n=wt(e);for(let e of bt)if(e.selects(t,n))return e.failure;return xt}function Ct(e){if(typeof e!=`object`||!e)return null;let{status:t}=e;return typeof t==`number`&&Number.isFinite(t)?t:null}function wt(e){if(typeof e!=`object`||!e)return null;let{code:t}=e;return typeof t==`string`?t:null}var Tt=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function Et(e){return e===null||!Number.isFinite(e)?null:Tt.format(new Date(e))}function Dt(e){switch(e){case`darwin`:return`macOS`;case`linux`:return`Linux`;case`windows`:return`Windows`;case`unknown`:return`Unknown platform`}}function Ot(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function kt(e){return Ot(e)}function At(e,t){if(!Number.isFinite(e))return`unknown`;let n=t-e;if(n<0)return Et(e)??`unknown`;let r=Math.floor(n/6e4);if(r<2)return`just now`;if(r<60)return`${String(r)} min ago`;let i=Math.floor(r/60);return i<24?`${String(i)} h ago`:Et(e)??`unknown`}function jt(e,t){return e.presence.online?null:e.presence.lastHeartbeatAt===null?e.lastAuthenticatedAt===null?`No connection recorded`:`Last authenticated ${At(e.lastAuthenticatedAt,t)}`:`Last seen ${At(e.presence.lastHeartbeatAt,t)}`}function Mt(e){let t=`${Dt(e.platformOs)} · ${e.platformArch}`;return e.revokedAt===null?`${t} · ${kt(e.effectiveRole)}`:e.revocationReasonCode?`${t} · Access revoked — ${e.revocationReasonCode}`:`${t} · Access revoked`}function Nt(e){return e.toSorted((e,t)=>{let n=e.revokedAt===null?0:1,r=t.revokedAt===null?0:1;return n===r?e.label.localeCompare(t.label,void 0,{numeric:!0,sensitivity:`base`}):n-r})}function Pt(e){return e.filter(e=>e.revokedAt===null).length}function Ft(e){return e.filter(e=>e.revokedAt===null&&e.presence.online).length}function It(e){let t=Pt(e),n=Ft(e),r=e.length-t,i=`${String(t)} authorized · ${n===0?`none online`:`${String(n)} online`}`;return r===0?i:`${i} · ${String(r)} revoked`}function Lt(e){return e.directoryStatus!==`ready`||e.browserStatus!==`current`||e.node.revokedAt!==null||e.node.capabilities?.nativeClientRequired===!0}function Rt(e){return e.node.capabilities?.nativeClientRequired===!0?`Open this node in Desktop/Mobile.`:e.node.revokedAt===null?e.directoryStatus!==`ready`||e.browserStatus!==`current`?`Node switching is unavailable until the directory and this browser are current.`:null:`Access to this node was revoked.`}function zt({node:e,open:t,onOpenChange:n,onRevoke:r}){let[i,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),c=ht(e),l=vt(o);(0,Z.useEffect)(()=>{t&&!i&&(a(!1),s(null))},[e.id,t]);let h=async()=>{if(!i){a(!0),s(null);try{await r(),n(!1)}catch(e){s(St(e)),a(!1)}}};return(0,$.jsx)(_,{open:t,onOpenChange:e=>{(e||!i)&&n(e)},disablePointerDismissal:i,children:(0,$.jsxs)(u,{className:`max-w-md`,showCloseButton:!i,children:[(0,$.jsxs)(p,{children:[(0,$.jsx)(d,{children:c.title}),(0,$.jsx)(g,{children:c.subjectPrompt})]}),(0,$.jsxs)(m,{className:`space-y-4`,children:[(0,$.jsxs)(Ke,{children:[(0,$.jsx)(X,{term:`Node`,children:e.label}),(0,$.jsx)(X,{term:`Node ID`,mono:!0,children:c.subjectId}),(0,$.jsx)(X,{term:`Platform`,children:`${Dt(e.platformOs)} · ${e.platformArch}`})]}),(0,$.jsx)(`ul`,{className:`space-y-2 text-xs leading-relaxed text-muted-foreground`,children:c.consequences.map(e=>(0,$.jsx)(`li`,{children:e.text},e.id))}),o?(0,$.jsxs)(`p`,{role:`alert`,className:`flex items-start gap-2 text-xs leading-relaxed text-destructive`,children:[(0,$.jsx)(fe,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0`}),o.message]}):null]}),(0,$.jsxs)(f,{children:[(0,$.jsx)(q,{variant:`outline`,disabled:i,onClick:()=>n(!1),children:l?c.cancelLabel:c.dismissLabel}),l?(0,$.jsx)(q,{variant:`destructive`,disabled:i,onClick:()=>void h(),children:i?c.pendingLabel:c.confirmLabel}):null]})]})})}function Bt(e){let t=(0,Q.c)(57),{node:n}=e,r=We(6e4),{copyToClipboard:i,isCopied:a}=ae(),o;t[0]===n.createdAt?o=t[1]:(o=Et(n.createdAt),t[0]=n.createdAt,t[1]=o);let s=o,c;t[2]===n.lastAuthenticatedAt?c=t[3]:(c=Et(n.lastAuthenticatedAt),t[2]=n.lastAuthenticatedAt,t[3]=c);let l=c,u;t[4]===n.revokedAt?u=t[5]:(u=Et(n.revokedAt),t[4]=n.revokedAt,t[5]=u);let d=u,f=n.grant.role!==n.effectiveRole,p;t[6]===n?p=t[7]:(p=(0,$.jsx)(X,{term:`Status`,children:(0,$.jsx)(R,{node:n})}),t[6]=n,t[7]=p);let m;t[8]!==n.presence.lastHeartbeatAt||t[9]!==r?(m=n.presence.lastHeartbeatAt===null?`Not reported`:(0,$.jsx)(`span`,{title:Et(n.presence.lastHeartbeatAt)??void 0,children:At(n.presence.lastHeartbeatAt,r)}),t[8]=n.presence.lastHeartbeatAt,t[9]=r,t[10]=m):m=t[10];let h;t[11]===m?h=t[12]:(h=(0,$.jsx)(X,{term:`Last heartbeat`,children:m}),t[11]=m,t[12]=h);let g=l??`Never`,_;t[13]===g?_=t[14]:(_=(0,$.jsx)(X,{term:`Last connected`,children:g}),t[13]=g,t[14]=_);let v;t[15]===n.platformOs?v=t[16]:(v=Dt(n.platformOs),t[15]=n.platformOs,t[16]=v);let y=`${v} · ${n.platformArch}`,b;t[17]===y?b=t[18]:(b=(0,$.jsx)(X,{term:`Platform`,children:y}),t[17]=y,t[18]=b);let x;t[19]===n.clientVersion?x=t[20]:(x=(0,$.jsx)(X,{term:`Client version`,mono:!0,children:n.clientVersion}),t[19]=n.clientVersion,t[20]=x);let S;t[21]===n.effectiveRole?S=t[22]:(S=kt(n.effectiveRole),t[21]=n.effectiveRole,t[22]=S);let C;t[23]===S?C=t[24]:(C=(0,$.jsx)(X,{term:`Your role`,children:S}),t[23]=S,t[24]=C);let w;t[25]!==f||t[26]!==n.grant.role?(w=f?(0,$.jsxs)(X,{term:`Granted role`,children:[kt(n.grant.role),(0,$.jsx)(`span`,{className:`mt-1 block text-muted-foreground`,children:`The role on your grant differs from the role in effect.`})]}):null,t[25]=f,t[26]=n.grant.role,t[27]=w):w=t[27];let T=s??`Not reported`,E;t[28]===T?E=t[29]:(E=(0,$.jsx)(X,{term:`Enrolled`,children:T}),t[28]=T,t[29]=E);let D;t[30]!==n.revocationReasonCode||t[31]!==n.revokedAt||t[32]!==d?(D=n.revokedAt===null?null:(0,$.jsx)(X,{term:`Revoked`,children:`${d??`Not reported`}${n.revocationReasonCode?` — ${n.revocationReasonCode}`:``}`}),t[30]=n.revocationReasonCode,t[31]=n.revokedAt,t[32]=d,t[33]=D):D=t[33];let O=a?`Copied`:`Copy node ID`,k;t[34]!==i||t[35]!==n.id?(k=()=>i(n.id,void 0),t[34]=i,t[35]=n.id,t[36]=k):k=t[36];let A;t[37]===a?A=t[38]:(A=a?(0,$.jsx)(G,{"aria-hidden":!0}):(0,$.jsx)(oe,{"aria-hidden":!0}),t[37]=a,t[38]=A);let j;t[39]!==O||t[40]!==k||t[41]!==A?(j=(0,$.jsx)(q,{size:`icon-xs`,variant:`ghost`,"aria-label":O,onClick:k,children:A}),t[39]=O,t[40]=k,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n.id||t[44]!==j?(M=(0,$.jsx)(X,{term:`Node ID`,mono:!0,action:j,children:n.id}),t[43]=n.id,t[44]=j,t[45]=M):M=t[45];let N;return t[46]!==b||t[47]!==x||t[48]!==C||t[49]!==w||t[50]!==E||t[51]!==D||t[52]!==M||t[53]!==p||t[54]!==h||t[55]!==_?(N=(0,$.jsxs)(Ke,{children:[p,h,_,b,x,C,w,E,D,M]}),t[46]=b,t[47]=x,t[48]=C,t[49]=w,t[50]=E,t[51]=D,t[52]=M,t[53]=p,t[54]=h,t[55]=_,t[56]=N):N=t[56],N}function Vt(e){let t=(0,Q.c)(93),{node:n,directoryStatus:r,browserStatus:i,canRename:a,canRevoke:o,onOpenChange:s,onConnect:c,onRename:l,onRevoke:u}=e,d=we()===`phone`,[f,p]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(null),g=n!==null;if(!n)return null;let _;t[0]!==i||t[1]!==r||t[2]!==n?(_=Lt({directoryStatus:r,browserStatus:i,node:n}),t[0]=i,t[1]=r,t[2]=n,t[3]=_):_=t[3];let v=_,y;t[4]!==i||t[5]!==r||t[6]!==n?(y=Rt({directoryStatus:r,browserStatus:i,node:n}),t[4]=i,t[5]=r,t[6]=n,t[7]=y):y=t[7];let b=y,x;t[8]!==n||t[9]!==c||t[10]!==s?(x=()=>{s(!1),c(n)},t[8]=n,t[9]=c,t[10]=s,t[11]=x):x=t[11];let S=x,C=v&&b?b:null;if(d){let e=`Node details: ${n.label}`,r;t[12]===n.label?r=t[13]:(r=(0,$.jsx)(je,{children:n.label}),t[12]=n.label,t[13]=r);let i;t[14]===n?i=t[15]:(i=Mt(n),t[14]=n,t[15]=i);let a;t[16]===i?a=t[17]:(a=(0,$.jsx)(Ae,{children:i}),t[16]=i,t[17]=a);let o;t[18]!==r||t[19]!==a?(o=(0,$.jsxs)(ke,{children:[r,a]}),t[18]=r,t[19]=a,t[20]=o):o=t[20];let c;t[21]===n?c=t[22]:(c=(0,$.jsx)(Bt,{node:n}),t[21]=n,t[22]=c);let l;t[23]===C?l=t[24]:(l=C?(0,$.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:C}):null,t[23]=C,t[24]=l);let u;t[25]!==l||t[26]!==c?(u=(0,$.jsxs)(Oe,{children:[c,l]}),t[25]=l,t[26]=c,t[27]=u):u=t[27];let d;t[28]!==v||t[29]!==S?(d=(0,$.jsx)(Me,{children:(0,$.jsx)(q,{className:`min-h-11`,disabled:v,onClick:S,children:`Connect`})}),t[28]=v,t[29]=S,t[30]=d):d=t[30];let f;return t[31]!==s||t[32]!==g||t[33]!==u||t[34]!==d||t[35]!==e||t[36]!==o?(f=(0,$.jsxs)(Ne,{open:g,onOpenChange:s,label:e,children:[o,u,d]}),t[31]=s,t[32]=g,t[33]=u,t[34]=d,t[35]=e,t[36]=o,t[37]=f):f=t[37],f}let w=o&&n.revokedAt===null,T;t[38]!==s||t[39]!==f||t[40]!==m?(T=e=>{(e||m===null&&f===null)&&(e||(p(null),h(null)),s(e))},t[38]=s,t[39]=f,t[40]=m,t[41]=T):T=t[41];let E;t[42]===n.label?E=t[43]:(E=(0,$.jsx)(xe,{className:`truncate`,children:n.label}),t[42]=n.label,t[43]=E);let D;t[44]===n?D=t[45]:(D=Mt(n),t[44]=n,t[45]=D);let O;t[46]===D?O=t[47]:(O=(0,$.jsx)(ve,{children:D}),t[46]=D,t[47]=O);let k;t[48]!==E||t[49]!==O?(k=(0,$.jsxs)(_e,{children:[E,O]}),t[48]=E,t[49]=O,t[50]=k):k=t[50];let A;t[51]===n?A=t[52]:(A=(0,$.jsx)(Bt,{node:n}),t[51]=n,t[52]=A);let j;t[53]===C?j=t[54]:(j=C?(0,$.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:C}):null,t[53]=C,t[54]=j);let M;t[55]!==j||t[56]!==A?(M=(0,$.jsxs)(ge,{children:[A,j]}),t[55]=j,t[56]=A,t[57]=M):M=t[57];let N;t[58]!==n.id||t[59]!==w?(N=w?(0,$.jsx)(q,{variant:`destructive-outline`,className:`sm:mr-auto`,onClick:()=>h(n.id),children:gt}):null,t[58]=n.id,t[59]=w,t[60]=N):N=t[60];let P;t[61]!==a||t[62]!==n.id?(P=a?(0,$.jsx)(q,{variant:`outline`,onClick:()=>p(n.id),children:`Rename`}):null,t[61]=a,t[62]=n.id,t[63]=P):P=t[63];let F;t[64]!==v||t[65]!==S?(F=(0,$.jsx)(q,{disabled:v,onClick:S,children:`Connect`}),t[64]=v,t[65]=S,t[66]=F):F=t[66];let I;t[67]!==N||t[68]!==P||t[69]!==F?(I=(0,$.jsxs)(be,{children:[N,P,F]}),t[67]=N,t[68]=P,t[69]=F,t[70]=I):I=t[70];let L;t[71]!==M||t[72]!==I||t[73]!==k?(L=(0,$.jsxs)(ye,{side:`right`,className:`w-full sm:max-w-md`,children:[k,M,I]}),t[71]=M,t[72]=I,t[73]=k,t[74]=L):L=t[74];let R;t[75]!==g||t[76]!==L||t[77]!==T?(R=(0,$.jsx)(Se,{open:g,onOpenChange:T,children:L}),t[75]=g,t[76]=L,t[77]=T,t[78]=R):R=t[78];let z;t[79]!==a||t[80]!==n||t[81]!==l||t[82]!==f?(z=a?(0,$.jsx)(dt,{node:n,open:f===n.id,onOpenChange:e=>p(e?n.id:null),onRename:e=>l(n,e)}):null,t[79]=a,t[80]=n,t[81]=l,t[82]=f,t[83]=z):z=t[83];let B;t[84]!==n||t[85]!==u||t[86]!==w||t[87]!==m?(B=w?(0,$.jsx)(zt,{node:n,open:m===n.id,onOpenChange:e=>h(e?n.id:null),onRevoke:()=>u(n)}):null,t[84]=n,t[85]=u,t[86]=w,t[87]=m,t[88]=B):B=t[88];let V;return t[89]!==R||t[90]!==z||t[91]!==B?(V=(0,$.jsxs)($.Fragment,{children:[R,z,B]}),t[89]=R,t[90]=z,t[91]=B,t[92]=V):V=t[92],V}function Ht(e){let t=(0,Q.c)(18),{children:n,title:r,description:i,actions:a,titleRef:o}=e,s;t[0]!==r||t[1]!==o?(s=(0,$.jsx)(`h1`,{ref:o,tabIndex:-1,className:`font-semibold text-2xl tracking-tight outline-none`,children:r}),t[0]=r,t[1]=o,t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=i===void 0?null:(0,$.jsx)(`div`,{className:`mt-1.5 text-muted-foreground text-sm`,children:i}),t[3]=i,t[4]=c);let l;t[5]!==s||t[6]!==c?(l=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7];let u;t[8]===a?u=t[9]:(u=a===void 0?null:(0,$.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:a}),t[8]=a,t[9]=u);let d;t[10]!==l||t[11]!==u?(d=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-4 gap-y-3`,children:[l,u]}),t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]===n?f=t[14]:(f=(0,$.jsx)(`div`,{className:`mt-8`,children:n}),t[13]=n,t[14]=f);let p;return t[15]!==d||t[16]!==f?(p=(0,$.jsxs)($.Fragment,{children:[d,f]}),t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function Ut(e){let t=(0,Q.c)(12),{children:n,className:r,title:i,description:a,actions:o}=e,s;t[0]===r?s=t[1]:(s=me(`app-surface relative rounded-2xl border not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,r),t[0]=r,t[1]=s);let c;t[2]!==o||t[3]!==a||t[4]!==i?(c=i===void 0&&o===void 0?null:(0,$.jsxs)(`header`,{className:`flex flex-wrap items-start justify-between gap-x-4 gap-y-2 border-border/60 border-b px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[i===void 0?null:(0,$.jsx)(`h2`,{className:`font-medium text-base`,children:i}),a===void 0?null:(0,$.jsx)(`p`,{className:`mt-1 text-muted-foreground text-sm leading-relaxed`,children:a})]}),o===void 0?null:(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o})]}),t[2]=o,t[3]=a,t[4]=i,t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=n===void 0?null:(0,$.jsx)(`div`,{className:`px-5 py-4`,children:n}),t[6]=n,t[7]=l);let u;return t[8]!==s||t[9]!==c||t[10]!==l?(u=(0,$.jsxs)(`section`,{className:s,children:[c,l]}),t[8]=s,t[9]=c,t[10]=l,t[11]=u):u=t[11],u}function Wt(e){let t=(0,Q.c)(8),{className:n,size:r}=e,i=r===void 0?`default`:r,a=i===`lg`?`gap-2.5 text-lg`:`gap-2 text-sm`,o;t[0]!==n||t[1]!==a?(o=me(`inline-flex items-center font-semibold text-foreground`,a,n),t[0]=n,t[1]=a,t[2]=o):o=t[2];let s=i===`lg`?`h-6`:`h-4.5`,c;t[3]===s?c=t[4]:(c=(0,$.jsx)(qe,{className:s}),t[3]=s,t[4]=c);let l;return t[5]!==o||t[6]!==c?(l=(0,$.jsxs)(`span`,{className:o,children:[c,Je]}),t[5]=o,t[6]=c,t[7]=l):l=t[7],l}var Gt=`h-dvh overflow-x-hidden overflow-y-auto overscroll-contain text-foreground`,Kt=`px-4 sm:px-6 phone:px-[max(1rem,env(safe-area-inset-left),env(safe-area-inset-right))] phone:pt-[max(2.5rem,calc(env(safe-area-inset-top)+1rem))] phone:pb-[max(2.5rem,calc(env(safe-area-inset-bottom)+1rem))]`,qt=`flex min-h-full flex-col`,Jt={form:`max-w-[28rem]`,content:`max-w-3xl`,page:`max-w-5xl`};function Yt(e){let t=(0,Q.c)(13),{nav:n,trailing:r}=e,i,a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=me(`app-chrome-glass shrink-0 border-border/60 border-b`,`pt-[env(safe-area-inset-top)]`),a=me(`mx-auto flex h-14 w-full items-center gap-3 px-4 sm:px-6`,Jt.page),o=(0,$.jsx)(Wt,{}),t[0]=i,t[1]=a,t[2]=o):(i=t[0],a=t[1],o=t[2]);let s;t[3]===n?s=t[4]:(s=n===void 0?null:(0,$.jsx)(`nav`,{"aria-label":`Hub`,className:`min-w-0 flex-1`,children:n}),t[3]=n,t[4]=s);let c;t[5]===n?c=t[6]:(c=n===void 0?(0,$.jsx)(`div`,{className:`flex-1`}):null,t[5]=n,t[6]=c);let l;t[7]===r?l=t[8]:(l=r===void 0?null:(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:r}),t[7]=r,t[8]=l);let u;return t[9]!==s||t[10]!==c||t[11]!==l?(u=(0,$.jsx)(`header`,{className:i,children:(0,$.jsxs)(`div`,{className:a,children:[o,s,c,l]})}),t[9]=s,t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function Xt(e){let t=(0,Q.c)(16),{children:n,nav:r,trailing:i,scrollRef:a,measure:o}=e,s=o===void 0?`page`:o,c=we()===`phone`,l;t[0]!==c||t[1]!==r||t[2]!==i?(l=c?null:(0,$.jsx)(Yt,{nav:r,trailing:i}),t[0]=c,t[1]=r,t[2]=i,t[3]=l):l=t[3];let u=c?`min-h-full py-10`:`pt-8 pb-16`,d=Jt[s],f;t[4]!==u||t[5]!==d?(f=me(`mx-auto flex w-full flex-col`,u,Kt,d),t[4]=u,t[5]=d,t[6]=f):f=t[6];let p;t[7]!==n||t[8]!==f?(p=(0,$.jsx)(`section`,{className:f,children:n}),t[7]=n,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==a||t[11]!==p?(m=(0,$.jsx)(`main`,{ref:a,className:`min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain`,children:p}),t[10]=a,t[11]=p,t[12]=m):m=t[12];let h;return t[13]!==l||t[14]!==m?(h=(0,$.jsx)(ie,{children:(0,$.jsx)(K,{children:(0,$.jsxs)(`div`,{className:`hub-ambient flex h-dvh flex-col text-foreground`,children:[l,m]})})}),t[13]=l,t[14]=m,t[15]=h):h=t[15],h}var Zt=(0,Z.lazy)(()=>n(()=>import(`./AccountSettings-DGvZzAqN.js`).then(e=>({default:e.AccountSettingsPanel})),__vite__mapDeps([0]))),Qt=(0,Z.lazy)(()=>n(()=>import(`./AppearanceSettings-BFo6g6_s.js`).then(e=>({default:e.AppearanceSettingsPanel})),__vite__mapDeps([0]))),$t=[{id:`overview`,label:`Overview`,icon:pe},{id:`security`,label:`Security`,icon:de},{id:`appearance`,label:`Appearance`,icon:le}];function en(e){let t=(0,Q.c)(15),{section:n}=e,r=o(nn),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsxs)(q,{variant:`ghost`,onClick:tn,children:[(0,$.jsx)(A,{"aria-hidden":!0}),` Nodes`]}),t[0]=i):i=t[0];let a;t[1]===r?a=t[2]:(a=r===null?void 0:`${r.displayName} · ${r.role.charAt(0).toUpperCase()}${r.role.slice(1)}`,t[1]=r,t[2]=a);let s;t[3]===n?s=t[4]:(s=$t.map(e=>{let t=e.id===n;return(0,$.jsx)(`li`,{children:(0,$.jsxs)(q,{variant:t?`secondary`:`ghost`,"aria-current":t?`page`:void 0,className:`w-full justify-start`,onClick:()=>L({kind:`account`,section:e.id}),children:[(0,$.jsx)(e.icon,{"aria-hidden":!0}),e.label]})},e.id)}),t[3]=n,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`nav`,{"aria-label":`Account`,className:`shrink-0 sm:w-48`,children:(0,$.jsx)(`ul`,{className:`flex gap-1 overflow-x-auto sm:flex-col sm:overflow-visible`,children:s})}),t[5]=s,t[6]=c);let l;t[7]===n?l=t[8]:(l=(0,$.jsx)(`div`,{className:`min-w-0 flex-1`,children:n===`overview`?(0,$.jsx)(rn,{}):(0,$.jsx)(Z.Suspense,{fallback:(0,$.jsx)(Ce,{className:`h-64 w-full rounded-2xl`}),children:n===`security`?(0,$.jsx)(Zt,{}):(0,$.jsx)(Qt,{surface:`hub`})})}),t[7]=n,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6 sm:flex-row sm:gap-8`,children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;return t[12]!==a||t[13]!==u?(d=(0,$.jsx)(Xt,{measure:`page`,trailing:i,children:(0,$.jsx)(Ht,{title:`Account`,description:a,children:u})}),t[12]=a,t[13]=u,t[14]=d):d=t[14],d}function tn(){return L({kind:`nodes`})}function nn(e){return e.account}function rn(){let e=(0,Q.c)(11),t=o(an),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(`dt`,{className:`text-muted-foreground text-xs`,children:`Display name`}),e[0]=n):n=e[0];let r=t?.displayName??`—`,i;e[1]===r?i=e[2]:(i=(0,$.jsxs)(`div`,{children:[n,(0,$.jsx)(`dd`,{className:`mt-0.5 text-sm`,children:r})]}),e[1]=r,e[2]=i);let a;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(`dt`,{className:`text-muted-foreground text-xs`,children:`Role`}),e[3]=a):a=e[3];let s;e[4]===t?s=e[5]:(s=t===null?`—`:`${t.role.charAt(0).toUpperCase()}${t.role.slice(1)}`,e[4]=t,e[5]=s);let c;e[6]===s?c=e[7]:(c=(0,$.jsxs)(`div`,{children:[a,(0,$.jsx)(`dd`,{className:`mt-0.5 text-sm`,children:s})]}),e[6]=s,e[7]=c);let l;return e[8]!==i||e[9]!==c?(l=(0,$.jsx)(Ut,{title:`Your account`,description:`Identity this Hub knows you by.`,children:(0,$.jsxs)(`dl`,{className:`grid gap-x-6 gap-y-4 sm:grid-cols-2`,children:[i,c]})}),e[8]=i,e[9]=c,e[10]=l):l=e[10],l}function an(e){return e.account}function on(e){let t=(0,Q.c)(7),{links:n}=e,r;t[0]===n?r=t[1]:(r=n===void 0?[]:n,t[0]=n,t[1]=r);let i=r,a=typeof window>`u`?null:window.location.host,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=a===null?null:(0,$.jsxs)(`p`,{children:[`Signing in to `,(0,$.jsx)(`span`,{className:`font-medium text-foreground`,children:a})]}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=i.length===0?null:(0,$.jsx)(`ul`,{className:`flex flex-wrap items-center justify-center gap-x-4 gap-y-1`,children:i.map(sn)}),t[3]=i,t[4]=s);let c;return t[5]===s?c=t[6]:(c=(0,$.jsxs)(`footer`,{className:`mt-10 flex flex-col items-center gap-2 text-center text-muted-foreground text-xs`,children:[o,s]}),t[5]=s,t[6]=c),c}function sn(e){return(0,$.jsx)(`li`,{children:(0,$.jsx)(`a`,{className:`rounded-sm underline-offset-4 outline-none hover:underline focus-visible:ring-2 focus-visible:ring-ring`,href:e.href,rel:`noreferrer`,target:`_blank`,children:e.label})},e.href)}function cn(e){let t=(0,Q.c)(25),{children:n,title:r,description:i,actions:a,trailing:o,scrollRef:s,titleRef:c,measure:l}=e,u=l===void 0?`form`:l,d,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=me(Gt,`hub-ambient`),f=me(qt,Kt,`py-10`),t[0]=d,t[1]=f):(d=t[0],f=t[1]);let p=Jt[u],m;t[2]===p?m=t[3]:(m=me(`my-auto w-full self-center phone:my-0 phone:flex phone:max-w-none phone:flex-1 phone:flex-col`,p),t[2]=p,t[3]=m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`div`,{className:`mb-8 flex justify-center phone:mb-6 phone:justify-start`,children:(0,$.jsx)(Wt,{size:`lg`})}),t[4]=h):h=t[4];let g;t[5]!==r||t[6]!==c?(g=(0,$.jsx)(`h1`,{ref:c,tabIndex:-1,className:`font-semibold text-2xl tracking-tight outline-none`,children:r}),t[5]=r,t[6]=c,t[7]=g):g=t[7];let _;t[8]===i?_=t[9]:(_=i===void 0?null:(0,$.jsx)(`p`,{className:`mt-2 text-muted-foreground text-sm leading-relaxed`,children:i}),t[8]=i,t[9]=_);let v;t[10]===n?v=t[11]:(v=(0,$.jsx)(`div`,{className:`mt-6 phone:flex phone:flex-1 phone:flex-col`,children:n}),t[10]=n,t[11]=v);let y;t[12]!==a||t[13]!==g||t[14]!==_||t[15]!==v||t[16]!==o?(y=(0,$.jsxs)(`section`,{className:`hub-gateway-panel app-surface relative rounded-2xl border p-6 not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-2xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] sm:p-8 phone:flex phone:flex-1 phone:flex-col phone:rounded-none phone:border-0 phone:p-0 phone:shadow-none phone:before:hidden dark:before:shadow-[0_-1px_--theme(--color-white/6%)]`,children:[g,_,v,a,o]}),t[12]=a,t[13]=g,t[14]=_,t[15]=v,t[16]=o,t[17]=y):y=t[17];let b;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(on,{}),t[18]=b):b=t[18];let x;t[19]!==y||t[20]!==m?(x=(0,$.jsx)(`div`,{className:f,children:(0,$.jsxs)(`div`,{className:m,children:[h,y,b]})}),t[19]=y,t[20]=m,t[21]=x):x=t[21];let S;return t[22]!==s||t[23]!==x?(S=(0,$.jsx)(`main`,{ref:s,className:d,children:x}),t[22]=s,t[23]=x,t[24]=S):S=t[24],S}function ln({onClose:e}){let[t,n]=(0,Z.useState)(``),[r,a]=(0,Z.useState)(null),[o,s]=(0,Z.useState)(`input`),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null),f=(0,Z.useRef)(``),p=(0,Z.useRef)(null);(0,Z.useEffect)(()=>()=>{p.current?.abort(),p.current=null,f.current=``},[]);let m=()=>{p.current?.abort();let e=new AbortController;return p.current=e,l(!0),d(null),e},h=e=>{p.current===e&&(p.current=null,l(!1))},g=async(e,t)=>{if(!(e instanceof DOMException&&e.name===`AbortError`)){if(e instanceof b&&e.status===401){f.current=``,n(``),a(null),await C.expireSession();return}d(t??(e instanceof b?e.message:`Hub is temporarily unavailable.`))}},_=async e=>{e.preventDefault();let r=t.trim();n(``),f.current=``;let o=m();try{let e=await i.lookupNodeEnrollment(r,o.signal);if(o.signal.aborted)return;f.current=r,a(e),s(`review`)}catch(e){await g(e)}finally{h(o)}},y=async()=>{let e=f.current;if(!e||!r)return;let t=m();try{if(await i.approveNodeEnrollment(e,t.signal),t.signal.aborted)return;f.current=``,a(null),s(`approved`),await C.refreshDirectory()}catch(e){f.current=``,a(null),s(`input`),await g(e,`The approval result is unknown. Enter the device code again to verify its current state.`)}finally{h(t)}},x=async()=>{let e=f.current;if(!e||!r)return;let t=m();try{if(await i.denyNodeEnrollment(e,t.signal),t.signal.aborted)return;f.current=``,a(null),s(`denied`)}catch(e){await g(e)}finally{h(t)}},S=()=>{p.current?.abort(),f.current=``,n(``),a(null),e()};return o===`approved`||o===`denied`?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(re,{"aria-hidden":!0,className:`size-8 text-primary`}),(0,$.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold`,children:o===`approved`?`Node approved`:`Enrollment denied`}),(0,$.jsx)(`p`,{role:`status`,className:`mt-2 text-sm text-muted-foreground`,children:o===`approved`?`The node can now finish enrollment and connect. Online presence may take a few seconds.`:`This ceremony cannot be reused. Start a new enrollment on the node if needed.`}),(0,$.jsx)(q,{className:`mt-5`,onClick:S,children:`Back to nodes`})]}):r?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(w,{"aria-hidden":!0,className:`size-8 text-primary`}),(0,$.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold`,children:`Review node enrollment`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`Compare every field, especially the fingerprint, with the node or a trusted operator channel before approving.`}),(0,$.jsxs)(Ke,{className:`mt-5 rounded-xl border border-border bg-background p-4`,children:[(0,$.jsx)(X,{term:`Label`,children:(0,$.jsx)(`span`,{className:`font-medium break-words`,children:r.label})}),(0,$.jsx)(X,{term:`Platform`,children:`${r.platformOs} · ${r.platformArch}`}),(0,$.jsx)(X,{term:`Version`,mono:!0,children:r.clientVersion}),(0,$.jsx)(X,{term:`Algorithm`,children:r.algorithm}),(0,$.jsx)(X,{term:`Fingerprint`,mono:!0,children:r.fingerprint}),(0,$.jsx)(X,{term:`Expires`,children:new Date(r.expiresAt).toLocaleString()})]}),u?(0,$.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-destructive`,children:u}):null,o===`confirm-denial`?(0,$.jsxs)(`div`,{className:`mt-4 rounded-lg border border-destructive/30 bg-destructive/5 p-3`,children:[(0,$.jsxs)(`p`,{className:`flex gap-2 text-sm`,children:[(0,$.jsx)(fe,{"aria-hidden":!0,className:`mt-0.5 size-4 shrink-0`}),` Denial is permanent for this device code.`]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,$.jsx)(q,{variant:`destructive`,disabled:c,onClick:()=>void x(),children:`Confirm denial`}),(0,$.jsx)(q,{variant:`outline`,disabled:c,onClick:()=>s(`review`),children:`Keep reviewing`})]})]}):(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,$.jsx)(q,{disabled:c,onClick:()=>void y(),children:c?`Approving…`:`Approve node`}),(0,$.jsx)(q,{variant:`outline`,disabled:c,onClick:()=>s(`confirm-denial`),children:`Deny`}),(0,$.jsx)(q,{variant:`ghost`,disabled:c,onClick:S,children:`Cancel`})]})]}):(0,$.jsxs)(`div`,{children:[(0,$.jsx)(w,{"aria-hidden":!0,className:`size-8 text-primary`}),(0,$.jsx)(`h1`,{className:`mt-4 text-2xl font-semibold`,children:`Enroll a Ryco node`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:`Start enrollment on the node, then enter the short device code shown there. Codes expire after ten minutes.`}),u?(0,$.jsx)(`p`,{role:`alert`,className:`mt-4 text-sm text-destructive`,children:u}):null,(0,$.jsxs)(`form`,{className:`mt-5 space-y-4`,autoComplete:`off`,onSubmit:e=>void _(e),children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-node-device-code`,children:`Device code`}),(0,$.jsx)(Y,{id:`hub-node-device-code`,required:!0,autoFocus:!0,maxLength:16,value:t,className:`font-mono uppercase ${J}`,onChange:e=>n(e.currentTarget.value)})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(q,{type:`submit`,disabled:c,children:c?`Looking up…`:`Review node`}),(0,$.jsx)(q,{type:`button`,variant:`outline`,onClick:S,children:`Cancel`})]})]})]})}function un(e){let t=(0,Q.c)(14),{step:n,total:r,label:i}=e,a=Math.min(Math.max(n,1),r),o;t[0]===i?o=t[1]:(o=i===void 0?null:(0,$.jsxs)(`span`,{className:`sr-only`,children:[`: `,i]}),t[0]=i,t[1]=o);let s;t[2]!==a||t[3]!==o||t[4]!==r?(s=(0,$.jsxs)(`p`,{className:`font-medium text-muted-foreground text-xs`,children:[`Step `,a,` of `,r,o]}),t[2]=a,t[3]=o,t[4]=r,t[5]=s):s=t[5];let c;if(t[6]!==a||t[7]!==r){let e;t[9]===a?e=t[10]:(e=(e,t)=>(0,$.jsx)(`span`,{className:`h-1 flex-1 rounded-full transition-colors ${t<a?`bg-primary`:`bg-border`}`},t),t[9]=a,t[10]=e),c=(0,$.jsx)(`div`,{"aria-hidden":!0,className:`flex flex-1 items-center gap-1.5`,children:Array.from({length:r},e)}),t[6]=a,t[7]=r,t[8]=c}else c=t[8];let l;return t[11]!==s||t[12]!==c?(l=(0,$.jsxs)(`div`,{className:`mb-6 flex items-center gap-3`,children:[s,c]}),t[11]=s,t[12]=c,t[13]=l):l=t[13],l}var dn=`https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit`,fn=null;function pn(){return window.turnstile?Promise.resolve(window.turnstile):fn||(fn=new Promise((e,t)=>{let n=document.querySelector(`script[src="${dn}"]`),r=n??document.createElement(`script`);r.addEventListener(`load`,()=>{window.turnstile?e(window.turnstile):t(Error(`Turnstile did not initialize`))},{once:!0}),r.addEventListener(`error`,()=>t(Error(`Turnstile could not be loaded`)),{once:!0}),n||(r.src=dn,r.async=!0,r.defer=!0,document.head.append(r))}).catch(e=>{throw fn=null,e}),fn)}function mn(e){let t=(0,Q.c)(10),{siteKey:n,action:r,onToken:i}=e,a=(0,Z.useRef)(null),[o,s]=(0,Z.useState)(!1),c,l;t[0]!==r||t[1]!==i||t[2]!==n?(c=()=>{let e=!1,t=null;return i(null),s(!1),pn().then(o=>{e||a.current===null||(t={api:o,id:o.render(a.current,{sitekey:n,action:r,theme:document.documentElement.classList.contains(`dark`)?`dark`:`light`,callback:t=>{e||i(t)},"expired-callback":()=>{e||i(null)},"error-callback":()=>{e||(i(null),s(!0))}})})}).catch(()=>{e||s(!0)}),()=>{e=!0,i(null),t&&t.api.remove(t.id)}},l=[r,i,n],t[0]=r,t[1]=i,t[2]=n,t[3]=c,t[4]=l):(c=t[3],l=t[4]),(0,Z.useEffect)(c,l);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(`div`,{ref:a,"aria-label":`Anti-bot verification`,className:`min-h-[65px]`}),t[5]=u):u=t[5];let d;t[6]===o?d=t[7]:(d=o?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:`Verification could not load. Check your connection and try again.`}):null,t[6]=o,t[7]=d);let f;return t[8]===d?f=t[9]:(f=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[u,d]}),t[8]=d,t[9]=f),f}function hn(e,t){return e instanceof b?e.message:t}function gn(){let e=new Uint8Array(32);return crypto.getRandomValues(e),S(e)}function _n(){let e=(0,Q.c)(5),[t,n]=(0,Z.useState)(null),[r,a]=(0,Z.useState)(!0),o,s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=new AbortController;return i.getPublicSignupConfiguration(e.signal).then(n).catch(()=>n({status:`disabled`})).finally(()=>{e.signal.aborted||a(!1)}),()=>e.abort()},s=[],e[0]=o,e[1]=s):(o=e[0],s=e[1]),(0,Z.useEffect)(o,s);let c;return e[2]!==t||e[3]!==r?(c={config:t,loading:r},e[2]=t,e[3]=r,e[4]=c):c=e[4],c}function vn(e){return e!==null&&`activationSecret`in e}function yn({config:e,initialLink:t,onConsumeLink:n,onCancel:r}){let[a,o]=(0,Z.useState)(t?.kind===`signup-verification`||t?.kind===`invalid-signup-verification`?`verifying`:`details`),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(``),[d,f]=(0,Z.useState)(``),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)(``),[_,y]=(0,Z.useState)(null),[b,x]=(0,Z.useState)(!1),[S,w]=(0,Z.useState)(null),T=(0,Z.useRef)(null),E=(0,Z.useRef)(!1);(0,Z.useEffect)(()=>{if(E.current||t===null)return;if(E.current=!0,t.kind!==`signup-verification`){t.kind===`invalid-signup-verification`&&(w(`This verification link is incomplete or expired. Start signup again.`),o(`details`));return}let e=new AbortController;return x(!0),i.verifyPublicSignup({attemptId:t.attemptId,attemptSecret:t.attemptSecret,proof:{kind:`link_token`,token:t.token}},e.signal).then(e=>{T.current=e,o(`credential`)}).catch(e=>w(hn(e,`This verification link could not be confirmed.`))).finally(()=>{n(),e.signal.aborted||x(!1)}),()=>e.abort()},[t,n]);let D=async t=>{if(t.preventDefault(),b||e===null)return;let n=e.antiBot.provider===`bypass`?`development`:_??``;if(!n){w(`Complete the anti-bot check before continuing.`);return}x(!0),w(null);try{let e=await i.startPublicSignup({username:s.trim().toLowerCase(),email:l.trim().toLowerCase(),antiBotAssertion:n});T.current=e,o(`check-email`)}catch(e){w(hn(e,`Account creation is temporarily unavailable.`))}finally{x(!1)}},O=async e=>{e.preventDefault();let t=T.current;if(!b&&t!==null&&`attemptSecret`in t){x(!0),w(null);try{let e=await i.verifyPublicSignup({attemptId:t.attemptId,attemptSecret:t.attemptSecret,proof:{kind:`email_code`,code:d.trim()}});f(``),T.current=e,o(`credential`)}catch(e){w(hn(e,`That email code could not be verified.`))}finally{x(!1)}}},k=async e=>{let t=T.current;if(b||!vn(t))return;if(e===`password`&&p!==h){w(`The passwords do not match.`);return}x(!0),w(null);let n=p;m(``),g(``);try{let r=e===`passkey`?await i.finishPublicSignupWithPasskey({attemptId:t.attemptId,activationSecret:t.activationSecret,idempotencyKey:gn()}):await i.finishPublicSignupWithPassword({attemptId:t.attemptId,activationSecret:t.activationSecret,password:n,idempotencyKey:gn()});T.current=null,await C.adoptPublicBrowserIdentity(r.identity,r.recoveryCodes)}catch(e){w(hn(e,`Account creation did not complete.`))}finally{x(!1)}},A=a===`details`?1:a===`check-email`||a===`verifying`?2:3;return(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col`,children:[(0,$.jsx)(un,{step:A,total:3,label:A===1?`Your details`:A===2?`Verify your email`:`Choose how you sign in`}),a===`details`?(0,$.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>void D(e),children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-signup-username`,children:`Username`}),(0,$.jsx)(Y,{id:`hub-signup-username`,autoCapitalize:`none`,autoComplete:`username`,maxLength:32,pattern:`[A-Za-z0-9_]+`,required:!0,value:s,className:J,onChange:e=>c(e.currentTarget.value.toLowerCase())}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Lowercase letters, numbers, and underscores.`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-signup-email`,children:`Email`}),(0,$.jsx)(Y,{id:`hub-signup-email`,type:`email`,autoCapitalize:`none`,autoComplete:`email`,maxLength:254,required:!0,value:l,className:J,onChange:e=>u(e.currentTarget.value)})]}),e?.antiBot.provider===`turnstile`?(0,$.jsx)(mn,{siteKey:e.antiBot.siteKey,action:`public_signup`,onToken:y}):null,(0,$.jsx)(wn,{value:S}),(0,$.jsx)(Tn,{onCancel:r,pending:b,submitLabel:`Send verification email`,submitDisabled:e===null})]}):a===`check-email`?(0,$.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>void O(e),children:[(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-background/60 p-4`,children:[(0,$.jsx)(et,{"aria-hidden":!0,className:`size-5 text-primary`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm font-medium`,children:`Check your email`}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Enter the six-digit code, or open the verification link on this device.`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-signup-code`,children:`Verification code`}),(0,$.jsx)(Y,{id:`hub-signup-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,pattern:`[0-9]{6}`,required:!0,value:d,className:J,onChange:e=>f(e.currentTarget.value)})]}),(0,$.jsx)(wn,{value:S}),(0,$.jsx)(Tn,{onCancel:r,pending:b,submitLabel:`Verify email`})]}):a===`password`?(0,$.jsxs)(`form`,{className:`space-y-4`,onSubmit:e=>{e.preventDefault(),k(`password`)},children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-signup-password`,children:`Password`}),(0,$.jsx)(Y,{id:`hub-signup-password`,type:`password`,autoComplete:`new-password`,minLength:12,maxLength:256,required:!0,value:p,className:J,onChange:e=>m(e.currentTarget.value)})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-signup-password-confirmation`,children:`Repeat password`}),(0,$.jsx)(Y,{id:`hub-signup-password-confirmation`,type:`password`,autoComplete:`new-password`,minLength:12,maxLength:256,required:!0,value:h,className:J,onChange:e=>g(e.currentTarget.value)})]}),(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:[`At least `,12,` characters. Password sign-in always asks for an email or authenticator code too.`]}),(0,$.jsx)(wn,{value:S}),(0,$.jsx)(Tn,{onCancel:()=>o(`credential`),pending:b,submitLabel:`Create account`})]}):(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-background/60 p-4`,children:[(0,$.jsx)(de,{"aria-hidden":!0,className:`size-5 text-primary`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm font-medium`,children:a===`verifying`?`Verifying your email…`:`Choose how you sign in`}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-muted-foreground`,children:`A passkey is the strongest and easiest option. A password always requires a second factor on future sign-ins.`})]}),(0,$.jsx)(wn,{value:S}),(0,$.jsxs)(`div`,{className:`space-y-3 phone:mt-auto ${Ye}`,children:[(0,$.jsxs)(q,{type:`button`,size:`lg`,className:`min-h-11 w-full`,disabled:b||a===`verifying`,onClick:()=>void k(`passkey`),children:[b?(0,$.jsx)(ee,{"aria-hidden":!0,className:`animate-spin`}):(0,$.jsx)(se,{"aria-hidden":!0}),b?`Creating passkey…`:`Create a passkey`]}),(0,$.jsx)(q,{type:`button`,variant:`outline`,className:`min-h-11 w-full`,disabled:b||a===`verifying`,onClick:()=>o(`password`),children:`Use a password instead`}),(0,$.jsx)(q,{type:`button`,variant:`ghost`,className:`min-h-11 w-full`,onClick:r,children:`Cancel`})]})]})]})}function bn({pendingSignup:e,config:t,onCancel:n}){let[r,a]=(0,Z.useState)(e.suggestedUsername??``),[o,s]=(0,Z.useState)(null),[c,l]=(0,Z.useState)(!1),[u,d]=(0,Z.useState)(null),f=async e=>{if(e.preventDefault(),c||t===null)return;let n=t.antiBot.provider===`bypass`?`development`:o??``;if(!n){d(`Complete the anti-bot check before continuing.`);return}l(!0),d(null);try{let e=await i.finishExternalIdentitySignup({provider:`github`,username:r.trim().toLowerCase(),antiBotAssertion:n,idempotencyKey:gn()});await C.adoptPublicBrowserIdentity(e.identity,e.recoveryCodes)}catch(e){d(hn(e,`GitHub signup did not complete.`))}finally{l(!1)}};return(0,$.jsxs)(`form`,{className:`flex flex-1 flex-col space-y-4`,onSubmit:e=>void f(e),children:[(0,$.jsx)(un,{step:1,total:1,label:`Confirm your Ryco username`}),(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-background/60 p-4`,children:[(0,$.jsx)(de,{"aria-hidden":!0,className:`size-5 text-primary`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm font-medium`,children:`GitHub verified`}),(0,$.jsxs)(`p`,{className:`mt-1 text-sm leading-relaxed text-muted-foreground`,children:[e.displayName?`${e.displayName} authorized Ryco through GitHub. `:`GitHub authorized this account. `,`Choose the public username Ryco should use. Nothing is created until you confirm.`]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-external-signup-username`,children:`Username`}),(0,$.jsx)(Y,{id:`hub-external-signup-username`,autoCapitalize:`none`,autoComplete:`username`,maxLength:32,pattern:`[A-Za-z0-9_]+`,required:!0,value:r,className:J,onChange:e=>a(e.currentTarget.value.toLowerCase())}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`GitHub suggested this name. You can change it before creating the account.`})]}),t?.antiBot.provider===`turnstile`?(0,$.jsx)(mn,{siteKey:t.antiBot.siteKey,action:`external_signup`,onToken:s}):null,(0,$.jsx)(wn,{value:u}),(0,$.jsx)(Tn,{onCancel:n,pending:c,submitLabel:`Create account with GitHub`,submitDisabled:t===null})]})}function xn({onCancel:e,onUseRecoveryCode:t,onResetPassword:n}){let[r,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(null),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(null),g=async e=>{if(e.preventDefault(),!f){p(!0),h(null);try{if(u===null){let e=await i.startPasswordLogin({identifier:r.trim().toLowerCase(),password:o});s(``),d(e)}else{let e=await i.finishPasswordLogin({attemptId:u.attemptId,attemptSecret:u.attemptSecret,factor:u.factor,code:c.trim()});l(``),await C.adoptPublicBrowserIdentity(e)}}catch(e){h(hn(e,`Password sign-in did not complete.`))}finally{p(!1)}}};return(0,$.jsxs)(`form`,{className:`mt-6 flex flex-1 flex-col space-y-4`,onSubmit:e=>void g(e),children:[u===null?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-login-identifier`,children:`Username or verified email`}),(0,$.jsx)(Y,{id:`hub-login-identifier`,autoCapitalize:`none`,autoComplete:`username`,required:!0,value:r,className:J,onChange:e=>a(e.currentTarget.value)})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-login-password`,children:`Password`}),(0,$.jsx)(Y,{id:`hub-login-password`,type:`password`,autoComplete:`current-password`,required:!0,maxLength:256,value:o,className:J,onChange:e=>s(e.currentTarget.value)})]})]}):(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-login-second-factor`,children:u.factor===`totp`?`Authenticator code`:`Email code`}),(0,$.jsx)(Y,{id:`hub-login-second-factor`,inputMode:`numeric`,autoComplete:`one-time-code`,pattern:`[0-9]{6}`,maxLength:6,required:!0,value:c,className:J,onChange:e=>l(e.currentTarget.value)}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u.factor===`totp`?`Enter the current code from your authenticator app.`:`We sent a six-digit code to your verified email address.`})]}),(0,$.jsx)(wn,{value:m}),u===null?(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:t,children:`Use recovery code`}),(0,$.jsx)(q,{type:`button`,variant:`ghost`,size:`sm`,onClick:n,children:`Forgot password?`})]}):null,(0,$.jsx)(Tn,{onCancel:u===null?e:()=>d(null),pending:f,submitLabel:u===null?`Continue`:`Sign in`})]})}function Sn({initialLink:e,onConsumeLink:t,onCancel:n}){let[r,a]=(0,Z.useState)(e?.kind===`password-reset`||e?.kind===`invalid-password-reset`?`verifying`:`request`),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),[u,d]=(0,Z.useState)(``),[f,p]=(0,Z.useState)(``),[m,h]=(0,Z.useState)(``),[g,_]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),x=(0,Z.useRef)(null),S=(0,Z.useRef)(!1),C=async(e,t)=>{let n=await i.verifyPasswordReset({token:e},t);x.current=n,l(``),a(`password`)};(0,Z.useEffect)(()=>{if(S.current||e===null)return;if(S.current=!0,e.kind!==`password-reset`){e.kind===`invalid-password-reset`&&(b(`This reset link is incomplete or expired. Request a new one.`),a(`request`));return}let n=new AbortController;return _(!0),C(e.token,n.signal).catch(e=>b(hn(e,`This reset link could not be verified.`))).finally(()=>{t(),n.signal.aborted||_(!1)}),()=>n.abort()},[e,t]);let w=async e=>{if(e.preventDefault(),!g){_(!0),b(null);try{if(r===`request`)await i.requestPasswordReset({identifier:o.trim().toLowerCase()}),a(`check-email`);else if(r===`check-email`)await C(c.trim());else if(r===`password`){let e=x.current;if(e===null)return;if(u!==f){b(`The passwords do not match.`);return}let t=u;d(``),p(``),await i.finishPasswordReset({attemptId:e.attemptId,attemptSecret:e.attemptSecret,password:t,factor:e.requiresTotp?{kind:`totp`,code:m.trim()}:{kind:`none`}}),h(``),x.current=null,a(`complete`)}}catch(e){b(hn(e,`Password reset did not complete.`))}finally{_(!1)}}},T=r===`request`?1:r===`check-email`||r===`verifying`?2:3;return(0,$.jsxs)(`form`,{className:`flex flex-1 flex-col space-y-4`,onSubmit:e=>void w(e),children:[r===`complete`?null:(0,$.jsx)(un,{step:T,total:3,label:T===1?`Find your account`:T===2?`Check your email`:`Set a new password`}),r===`request`?(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-reset-identifier`,children:`Username or verified email`}),(0,$.jsx)(Y,{id:`hub-reset-identifier`,autoCapitalize:`none`,autoComplete:`username`,required:!0,value:o,className:J,onChange:e=>s(e.currentTarget.value)}),(0,$.jsx)(`p`,{className:`text-xs leading-relaxed text-muted-foreground`,children:`If the account is eligible, its verified address receives a single-use reset link.`})]}):r===`check-email`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-background/60 p-4`,children:[(0,$.jsx)(et,{"aria-hidden":!0,className:`size-5 text-primary`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm font-medium`,children:`Check your email`}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Open the reset link, or paste its token below.`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-reset-token`,children:`Reset token`}),(0,$.jsx)(Y,{id:`hub-reset-token`,type:`password`,autoComplete:`one-time-code`,maxLength:64,required:!0,value:c,className:J,onChange:e=>l(e.currentTarget.value)})]})]}):r===`password`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-reset-password`,children:`New password`}),(0,$.jsx)(Y,{id:`hub-reset-password`,type:`password`,autoComplete:`new-password`,minLength:12,maxLength:256,required:!0,value:u,className:J,onChange:e=>d(e.currentTarget.value)})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-reset-password-confirmation`,children:`Repeat password`}),(0,$.jsx)(Y,{id:`hub-reset-password-confirmation`,type:`password`,autoComplete:`new-password`,minLength:12,maxLength:256,required:!0,value:f,className:J,onChange:e=>p(e.currentTarget.value)})]}),x.current?.requiresTotp?(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-reset-totp`,children:`Authenticator code`}),(0,$.jsx)(Y,{id:`hub-reset-totp`,inputMode:`numeric`,autoComplete:`one-time-code`,pattern:`[0-9]{6}`,maxLength:6,required:!0,value:m,className:J,onChange:e=>h(e.currentTarget.value)})]}):null]}):r===`complete`?(0,$.jsxs)(`div`,{className:`rounded-xl border border-border bg-background/60 p-4`,children:[(0,$.jsx)(de,{"aria-hidden":!0,className:`size-5 text-primary`}),(0,$.jsx)(`p`,{className:`mt-2 text-sm font-medium`,children:`Password changed`}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-relaxed text-muted-foreground`,children:`Every previous session was revoked. Sign in again with the new password and its normal second factor.`})]}):(0,$.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:`Verifying your reset link…`}),(0,$.jsx)(wn,{value:y}),r===`complete`?(0,$.jsx)(`div`,{className:`phone:mt-auto ${Ye}`,children:(0,$.jsx)(q,{type:`button`,className:`min-h-11 w-full`,onClick:n,children:`Back to sign in`})}):(0,$.jsx)(Tn,{onCancel:n,pending:g,submitLabel:r===`request`?`Send reset email`:r===`check-email`?`Verify reset token`:r===`password`?`Change password`:`Verifying…`,submitDisabled:r===`verifying`})]})}function Cn({onCancel:e}){let[t,n]=(0,Z.useState)(``),[r,a]=(0,Z.useState)(!1),[o,s]=(0,Z.useState)(null),c=async e=>{if(e.preventDefault(),r)return;a(!0),s(null);let o=t;n(``);try{await i.signInWithRecoveryCode(o),await C.bootstrap()}catch(e){s(hn(e,`That recovery code could not be used.`))}finally{a(!1)}};return(0,$.jsxs)(`form`,{className:`mt-6 flex flex-1 flex-col space-y-4`,onSubmit:e=>void c(e),children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(v,{htmlFor:`hub-login-recovery-code`,children:`Recovery code`}),(0,$.jsx)(Y,{id:`hub-login-recovery-code`,type:`password`,autoComplete:`one-time-code`,required:!0,maxLength:128,value:t,className:J,onChange:e=>n(e.currentTarget.value)})]}),(0,$.jsx)(wn,{value:o}),(0,$.jsx)(Tn,{onCancel:e,pending:r,submitLabel:`Use recovery code`})]})}function wn(e){let t=(0,Q.c)(2),{value:n}=e,r;return t[0]===n?r=t[1]:(r=n?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive`,children:n}):null,t[0]=n,t[1]=r),r}function Tn(e){let t=(0,Q.c)(12),{onCancel:n,pending:r,submitLabel:i,submitDisabled:a}=e,o=r||a!==void 0&&a,s;t[0]===r?s=t[1]:(s=r?(0,$.jsx)(ee,{"aria-hidden":!0,className:`animate-spin motion-reduce:animate-none`}):null,t[0]=r,t[1]=s);let c=r?`Working…`:i,l;t[2]!==o||t[3]!==s||t[4]!==c?(l=(0,$.jsxs)(q,{type:`submit`,size:`lg`,className:`min-h-11 w-full`,disabled:o,children:[s,c]}),t[2]=o,t[3]=s,t[4]=c,t[5]=l):l=t[5];let u;t[6]!==n||t[7]!==r?(u=(0,$.jsx)(q,{type:`button`,variant:`ghost`,className:`min-h-11 w-full`,disabled:r,onClick:n,children:`Back`}),t[6]=n,t[7]=r,t[8]=u):u=t[8];let d;return t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`space-y-3 phone:mt-auto ${Ye}`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11],d}var En;function Dn(){if(window.location.pathname!==`/email-verification`)return null;if(En!==void 0)return En;let e=it({href:window.location.href,historyState:window.history.state,replaceState:(e,t,n)=>window.history.replaceState(e,t,n)});return En=e?.kind===`email-verification`||e?.kind===`invalid-email-verification`?e:null,En}function On(){let e=(0,Q.c)(3),t=j(),n,r;e[0]===t?(n=e[1],r=e[2]):(n=()=>{document.title=Xe(t===null?void 0:B(t))},r=[t],e[0]=t,e[1]=n,e[2]=r),(0,Z.useEffect)(n,r)}function kn(){let e=(0,Q.c)(30),[t,n]=(0,Z.useState)(Dn),i=o(Ln),a=o(In),c=o(Fn),u=o(Pn),d=o(Nn),f=o(Mn),p=r(jn),m=F(),h;e[0]===m.logicalPathname?h=e[1]:(h=N(m.logicalPathname),e[0]=m.logicalPathname,e[1]=h);let g=h,_;e[2]===g?_=e[3]:(_=e=>l(e,g),e[2]=g,e[3]=_);let v=s(_),y=W();P();let b;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=[],e[4]=b):b=e[4],(0,Z.useEffect)(An,b),at(),On();let x=j(),S;e[5]!==i||e[6]!==x?.kind?(S=()=>{i===`authenticated`&&x?.kind===`sign-up`&&I(`/`,{replace:!0})},e[5]=i,e[6]=x?.kind,e[7]=S):S=e[7];let C;if(e[8]!==i||e[9]!==x?(C=[i,x],e[8]=i,e[9]=x,e[10]=C):C=e[10],(0,Z.useEffect)(S,C),t?.kind===`email-verification`||t?.kind===`invalid-email-verification`){let r;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{window.history.replaceState(window.history.state,``,`/`),n(null)},e[11]=r):r=e[11];let i;return e[12]===t?i=e[13]:(i=(0,$.jsx)(Rn,{link:t,onContinue:r}),e[12]=t,e[13]=i),i}if(i!==`authenticated`){let t;return e[14]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Jn,{}),e[14]=t):t=e[14],t}if(c.length>0&&!p){let t;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Zn,{}),e[15]=t):t=e[15],t}if(x?.kind===`account`){let t;return e[16]===x.section?t=e[17]:(t=(0,$.jsx)(en,{section:x.section}),e[16]=x.section,e[17]=t),t}if(x?.kind===`nodes`||x?.kind===`nodes-enroll`){let t;return e[18]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(nr,{}),e[18]=t):t=e[18],t}if(m.nodeId===null){if(y||m.malformed){let t;return e[19]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(nr,{}),e[19]=t):t=e[19],t}if(a&&d){let t;return e[20]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(T,{authGateState:{status:`hosted-hub`}}),e[20]=t):t=e[20],t}let t;return e[21]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(T,{authGateState:{status:`hosted-cached`}}),e[21]=t):t=e[21],t}if(!a||a.id!==m.nodeId){let t;return e[22]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Wn,{}),e[22]=t):t=e[22],t}if(u===`terminal-failure`){let t;return e[23]!==f||e[24]!==a?(t=(0,$.jsx)(Vn,{node:a,message:f}),e[23]=f,e[24]=a,e[25]=t):t=e[25],t}if(!d){if(v){let t;return e[26]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(T,{authGateState:{status:`hosted-cached`}}),e[26]=t):t=e[26],t}let t;return e[27]===a?t=e[28]:(t=(0,$.jsx)(Gn,{node:a}),e[27]=a,e[28]=t),t}let w;return e[29]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(T,{authGateState:{status:`hosted-hub`}}),e[29]=w):w=e[29],w}function An(){return O()}function jn(e){return e.leased}function Mn(e){return e.errorMessage}function Nn(e){return e.sessionEstablished}function Pn(e){return e.transportStatus}function Fn(e){return e.recoveryCodes}function In(e){return e.selectedNode}function Ln(e){return e.accountStatus}function Rn(e){let t=(0,Q.c)(15),{link:n,onContinue:r}=e,[a,o]=(0,Z.useState)(n.kind===`email-verification`?`verifying`:`invalid`),s;t[0]!==n.kind||t[1]!==n.token?(s=()=>{if(n.kind!==`email-verification`)return;let e=new AbortController;return i.confirmEmailVerification(n.token,e.signal).then(()=>o(`verified`)).catch(()=>{e.signal.aborted||o(`invalid`)}).finally(zn),()=>e.abort()},t[0]=n.kind,t[1]=n.token,t[2]=s):s=t[2];let c;t[3]===n?c=t[4]:(c=[n],t[3]=n,t[4]=c),(0,Z.useEffect)(s,c);let l=a===`verifying`?`Verifying your email`:a===`verified`?`Email verified`:`This verification link is unavailable`,u=a===`verifying`?`This will only take a moment.`:a===`verified`?`Your address is now available for account recovery.`:`The link is incomplete, expired, or has already been used. Request a new one from Account settings.`,d;t[5]!==r||t[6]!==a?(d=a===`verifying`?void 0:(0,$.jsx)(q,{size:`cta`,className:`mt-6 w-full`,onClick:r,children:`Continue`}),t[5]=r,t[6]=a,t[7]=d):d=t[7];let f;t[8]===a?f=t[9]:(f=a===`verifying`?(0,$.jsxs)(`p`,{role:`status`,"aria-live":`polite`,className:`text-muted-foreground text-sm`,children:[(0,$.jsx)(Bn,{}),`Confirming the link…`]}):null,t[8]=a,t[9]=f);let p;return t[10]!==l||t[11]!==u||t[12]!==d||t[13]!==f?(p=(0,$.jsx)(cn,{title:l,description:u,actions:d,children:f}),t[10]=l,t[11]=u,t[12]=d,t[13]=f,t[14]=p):p=t[14],p}function zn(){En=void 0}function Bn(){let e=(0,Q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ee,{"aria-hidden":!0,className:`mr-2 inline size-4 animate-spin align-[-0.15em] motion-reduce:animate-none`}),e[0]=t):t=e[0],t}function Vn(e){let t=(0,Q.c)(10),{node:n,message:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(U,{}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(fe,{"aria-hidden":!0,className:`size-8 text-destructive`}),t[1]=a):a=t[1];let o=`Unable to connect to ${n.label}`,s=r??`The relay session could not be established. Choose another node or retry.`,c;t[2]===s?c=t[3]:(c=(0,$.jsx)(`p`,{role:`alert`,className:`text-muted-foreground text-sm`,children:s}),t[2]=s,t[3]=c);let l;t[4]===r?l=t[5]:(l=r===`Ryco state could not be synchronized.`?(0,$.jsxs)(q,{className:`mt-5`,onClick:Hn,children:[(0,$.jsx)(ue,{"aria-hidden":!0}),` Retry`]}):null,t[4]=r,t[5]=l);let u;return t[6]!==o||t[7]!==c||t[8]!==l?(u=(0,$.jsx)(Xt,{measure:`content`,trailing:i,children:(0,$.jsxs)(Un,{tone:`destructive`,icon:a,title:o,children:[c,l]})}),t[6]=o,t[7]=c,t[8]=l,t[9]=u):u=t[9],u}function Hn(){C.retrySelectedNode()}function Un(e){let t=(0,Q.c)(9),{children:n,icon:r,title:i,tone:a}=e,o=`mt-4 font-semibold text-2xl tracking-tight ${(a===void 0?`default`:a)===`destructive`?`text-foreground`:``}`,s;t[0]!==o||t[1]!==i?(s=(0,$.jsx)(`h1`,{className:o,children:i}),t[0]=o,t[1]=i,t[2]=s):s=t[2];let c;t[3]===n?c=t[4]:(c=(0,$.jsx)(`div`,{className:`mt-2`,children:n}),t[3]=n,t[4]=c);let l;return t[5]!==r||t[6]!==s||t[7]!==c?(l=(0,$.jsxs)(`div`,{className:`mx-auto flex max-w-lg flex-col items-center pt-10 text-center`,children:[r,s,c]}),t[5]=r,t[6]=s,t[7]=c,t[8]=l):l=t[8],l}function Wn(){let e=(0,Q.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(w,{"aria-hidden":!0,className:`size-8 text-primary`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsx)(Xt,{measure:`content`,children:(0,$.jsx)(Un,{icon:t,title:`Restoring your node`,children:(0,$.jsxs)(`p`,{role:`status`,"aria-live":`polite`,className:`text-muted-foreground text-sm`,children:[(0,$.jsx)(Bn,{}),`Checking your access before reconnecting…`]})})}),e[1]=n):n=e[1],n}function Gn(e){let t=(0,Q.c)(7),{node:n}=e,{returnToAllNodes:r}=M(),i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,$.jsx)(w,{"aria-hidden":!0,className:`size-8 text-primary`}),t[0]=i):i=t[0];let a=`Connecting to ${n.label}`,o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsxs)(`p`,{role:`status`,"aria-live":`polite`,className:`text-muted-foreground text-sm`,children:[(0,$.jsx)(Bn,{}),`Preparing a private relay session and synchronizing Ryco state…`]}),t[1]=o):o=t[1];let s;t[2]===r?s=t[3]:(s=(0,$.jsx)(q,{variant:`outline`,className:`mt-5 phone:min-h-11`,onClick:()=>void r(),children:`Back to nodes`}),t[2]=r,t[3]=s);let c;return t[4]!==a||t[5]!==s?(c=(0,$.jsx)(Xt,{measure:`content`,children:(0,$.jsxs)(Un,{icon:i,title:a,children:[o,s]})}),t[4]=a,t[5]=s,t[6]=c):c=t[6],c}function Kn(e){let t=(0,Q.c)(15),{bootstrapAvailable:n,publicSignupEnabled:r}=e,[i,a]=(0,Z.useState)(!1),o=(0,Z.useId)(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>a(qn),t[0]=s):s=t[0];let c=`transition-transform ${i?`rotate-180`:``}`,l;t[1]===c?l=t[2]:(l=(0,$.jsx)(te,{"aria-hidden":!0,className:c}),t[1]=c,t[2]=l);let u;t[3]!==i||t[4]!==o||t[5]!==l?(u=(0,$.jsxs)(q,{variant:`ghost`,size:`sm`,"aria-expanded":i,"aria-controls":o,className:`-mx-2 h-auto min-h-8 max-w-full whitespace-normal py-1.5 text-left phone:min-h-11`,onClick:s,children:[`New to this Hub?`,l]}),t[3]=i,t[4]=o,t[5]=l,t[6]=u):u=t[6];let d;t[7]!==n||t[8]!==i||t[9]!==o||t[10]!==r?(d=i?(0,$.jsxs)(`div`,{id:o,className:`mt-2 space-y-2 text-xs leading-relaxed text-muted-foreground`,children:[(0,$.jsxs)(`p`,{children:[(0,$.jsx)(`span`,{className:`font-medium text-foreground`,children:`Getting access.`}),` Accounts are`,r?` open to signup on this Hub. Verify your email, then choose a passkey or password.`:` created by invitation. An owner sends you an invitation code; redeem it below to create your account.`]}),(0,$.jsxs)(`p`,{children:[(0,$.jsx)(`span`,{className:`font-medium text-foreground`,children:`What a passkey is here.`}),` The passkey is created by your browser or password manager and never leaves it. It is the only credential this Hub treats as strong.`]}),n?(0,$.jsxs)(`p`,{children:[(0,$.jsx)(`span`,{className:`font-medium text-foreground`,children:`If this Hub is brand new.`}),` No owner exists yet. “Set up first owner” claims this Hub with a bootstrap credential from whoever deployed it.`]}):null]}):null,t[7]=n,t[8]=i,t[9]=o,t[10]=r,t[11]=d):d=t[11];let f;return t[12]!==u||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`mt-4`,children:[u,d]}),t[12]=u,t[13]=d,t[14]=f):f=t[14],f}function qn(e){return!e}function Jn({context:e=`hub`,autoExternalProvider:t=null}={}){let n=o(e=>e.accountStatus),r=o(e=>e.errorMessage),s=o(e=>e.errorReason??null),c=o(e=>e.bootstrapAvailable),[l,u]=(0,Z.useState)(()=>it({href:window.location.href,historyState:window.history.state,replaceState:(e,t,n)=>window.history.replaceState(e,t,n)})),d=(0,Z.useCallback)(()=>u(null),[]),{config:f}=_n(),p=a(e=>e.externalIdentityConfiguration),m=He(p),[g,_]=(0,Z.useState)(!1),[v,y]=(0,Z.useState)(null),S=(0,Z.useRef)(!1),[w,T]=(0,Z.useState)(void 0),E=j(),D=E?.kind===`sign-up`||E?.kind===`sign-up-verify`?`public`:E?.kind===`invitation`?`invitation`:E?.kind===`setup`?`bootstrap`:null,O=E?.kind===`sign-in-password`?`password`:E?.kind===`sign-in-recovery-code`?`recovery-code`:E?.kind===`reset-password`?`password-reset`:null,k=e=>{L(e===`public`?{kind:`sign-up`}:e===`invitation`?{kind:`invitation`}:e===`bootstrap`?{kind:`setup`}:{kind:`sign-in`})},A=e=>{L(e===`password`?{kind:`sign-in-password`}:e===`recovery-code`?{kind:`sign-in-recovery-code`}:e===`password-reset`?{kind:`reset-password`}:{kind:`sign-in`})},M=(0,Z.useRef)(null),N=(0,Z.useRef)(null),P=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{C.refreshExternalIdentityConfiguration()},[]),(0,Z.useEffect)(()=>{if(D!==`public`&&e!==`native-authorization`){T(void 0);return}let t=new AbortController;return T(void 0),i.getPendingExternalIdentity(t.signal).then(e=>{t.signal.aborted||T(e)}).catch(()=>{t.signal.aborted||T({status:`none`})}),()=>t.abort()},[e,D]);let F=(0,Z.useCallback)(async()=>{if(!g){_(!0),y(null);try{await Ue({intent:`authenticate`,returnTo:e===`native-authorization`?window.location.pathname:H({kind:`sign-up`}),start:e=>i.startExternalIdentityAuthorization(e),navigate:e=>window.location.assign(e)})}catch(e){y(e instanceof b?e.message:`GitHub sign-in is temporarily unavailable.`),_(!1)}}},[e,g]);(0,Z.useEffect)(()=>{e!==`native-authorization`||t!==`github`||n!==`signed-out`||m?.login!==!0||w?.status!==`none`||S.current||(S.current=!0,F())},[t,e,w?.status,m?.login,F,n]),(0,Z.useEffect)(()=>{D===`invitation`||D===`bootstrap`?N.current?.focus({preventScroll:!0}):M.current?.focus({preventScroll:!0})},[O,D]),(0,Z.useEffect)(()=>{P.current?.scrollTo({top:0,left:0})},[O,D]);let I=D===`invitation`||D===`bootstrap`?(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 phone:mt-auto ${Ye}`,children:[(0,$.jsx)(q,{type:`submit`,form:Yn,className:`phone:min-h-11`,disabled:n===`authenticating`,children:D===`invitation`?`Create account and passkey`:`Create owner and passkey`}),(0,$.jsx)(q,{type:`button`,variant:`outline`,className:`phone:min-h-11`,onClick:n===`authenticating`?()=>C.cancelAuthentication():()=>k(null),children:n===`authenticating`?`Cancel`:`Back`})]}):null,R=D||O?null:(0,$.jsx)(`div`,{className:`phone:mt-auto ${Ye}`,children:(0,$.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3`,children:[m?.login?(0,$.jsxs)(q,{size:`lg`,className:`phone:min-h-11`,disabled:g||n===`authenticating`||n===`signing-out`,onClick:()=>void F(),children:[g?(0,$.jsx)(ee,{"aria-hidden":!0,className:`animate-spin`}):(0,$.jsx)(h,{"aria-hidden":!0}),g?`Opening GitHub…`:`Continue with GitHub`]}):null,(0,$.jsxs)(q,{size:`lg`,className:`phone:min-h-11`,disabled:n===`authenticating`||n===`signing-out`,onClick:()=>void C.signIn(),children:[(0,$.jsx)(se,{"aria-hidden":!0}),n===`authenticating`?`Waiting for passkey…`:`Sign in with passkey`]}),n===`authenticating`?(0,$.jsx)(q,{variant:`outline`,size:`lg`,className:`phone:min-h-11`,onClick:()=>C.cancelAuthentication(),children:`Cancel`}):(0,$.jsxs)($.Fragment,{children:[f?.status===`enabled`?(0,$.jsx)(q,{variant:`outline`,size:`lg`,className:`phone:min-h-11`,onClick:()=>k(`public`),children:`Create account`}):null,(0,$.jsx)(q,{variant:`ghost`,size:`lg`,className:`phone:min-h-11`,onClick:()=>k(`invitation`),children:`Redeem invitation`}),c?(0,$.jsx)(q,{variant:`ghost`,size:`lg`,className:`phone:min-h-11`,onClick:()=>k(`bootstrap`),children:`Set up first owner`}):null]})]})}),z=(0,$.jsxs)($.Fragment,{children:[n===`unavailable`?(0,$.jsxs)(q,{className:`mt-3 phone:min-h-11`,variant:`ghost`,onClick:()=>void C.bootstrap(),children:[(0,$.jsx)(ue,{"aria-hidden":!0}),` Retry Hub`]}):null,(0,$.jsx)(`p`,{className:`sr-only`,"aria-live":`polite`,children:n===`authenticating`?`Passkey authentication is in progress.`:``})]}),B=s?x(s):null,U=v??r??B?.message,W=v===null&&B!==null?B.title:`Sign-in did not complete`,G=U?(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsxs)(De,{variant:`error`,children:[(0,$.jsx)(fe,{"aria-hidden":!0}),(0,$.jsx)(Te,{children:W}),(0,$.jsx)(Ee,{children:U})]})}):null,te=w?.status===`signup`?w:null,ne=w?.status===`error`?w:null,re=e===`native-authorization`&&D!==`public`;if(D===`public`||re&&(te!==null||ne!==null)){let e=()=>{re?T({status:`none`}):k(null)};return(0,$.jsxs)(cn,{title:`Create your account`,description:re?`Choose your Ryco username, then return to approving this device.`:`Pick a username and confirm your email. You choose a passkey or a password at the end.`,trailing:z,scrollRef:P,titleRef:M,children:[G,w===void 0?(0,$.jsx)(Ce,{className:`h-64 w-full rounded-2xl`}):te?(0,$.jsx)(bn,{pendingSignup:te,config:f?.status===`enabled`?f:null,onCancel:e}):ne?(0,$.jsxs)(`div`,{className:`space-y-4`,children:[(0,$.jsxs)(De,{variant:`warning`,children:[(0,$.jsx)(fe,{"aria-hidden":!0}),(0,$.jsx)(Te,{children:`GitHub signup did not continue`}),(0,$.jsx)(Ee,{children:Ve(ne.code)})]}),(0,$.jsx)(q,{variant:`outline`,onClick:e,children:`Back to sign in`})]}):(0,$.jsx)(yn,{config:f?.status===`enabled`?f:null,initialLink:l,onConsumeLink:d,onCancel:()=>{d(),k(null)}})]})}if(D===`invitation`||D===`bootstrap`)return(0,$.jsxs)(cn,{title:D===`invitation`?`Redeem your invitation`:`Claim this Hub`,description:D===`invitation`?`Enter the invitation code an owner sent you. Your browser creates a passkey at the same time.`:`No owner exists yet. The bootstrap credential from whoever deployed this Hub makes you its first owner.`,actions:I,trailing:z,scrollRef:P,titleRef:M,children:[G,(0,$.jsx)(Xn,{mode:D,credentialRef:N})]});if(O!==null){let e={password:{title:`Sign in with a password`,description:`Password sign-in always asks for a second factor — an authenticator code, or a code sent to your verified email.`},"recovery-code":{title:`Use a recovery code`,description:`One of the single-use codes you saved when your account was created. Each code works once.`},"password-reset":{title:`Reset your password`,description:`We email a single-use link. Setting a new password signs out every device, including this one.`}}[O];return(0,$.jsxs)(cn,{title:e.title,description:e.description,trailing:z,scrollRef:P,titleRef:M,children:[G,O===`password`?(0,$.jsx)(xn,{onCancel:()=>A(null),onUseRecoveryCode:()=>A(`recovery-code`),onResetPassword:()=>A(`password-reset`)}):O===`recovery-code`?(0,$.jsx)(Cn,{onCancel:()=>A(null)}):(0,$.jsx)(Sn,{initialLink:l,onConsumeLink:d,onCancel:()=>{d(),A(null)}})]})}return(0,$.jsxs)(cn,{title:e===`native-authorization`?`Sign in to continue on your device`:n===`session-expired`?`Your session expired`:`Connect to your Ryco nodes`,description:e===`native-authorization`?`Authenticate in this browser first. Ryco will ask again before it authorizes the mobile app.`:`Ryco Hub reaches the developer machines an owner has authorized for your account. Your session lives in an HttpOnly cookie — nothing about it is readable by this page.`,actions:R,trailing:z,scrollRef:P,titleRef:M,children:[(0,$.jsx)(Ge,{}),(0,$.jsx)(Kn,{bootstrapAvailable:c,publicSignupEnabled:f?.status===`enabled`}),n===`authenticating`?null:(0,$.jsxs)(q,{variant:`ghost`,size:`sm`,className:`-ml-2 mt-2 h-auto min-h-8 whitespace-normal phone:min-h-11`,onClick:()=>A(`password`),children:[(0,$.jsx)(Qe,{"aria-hidden":!0}),`Password, recovery code, or reset`]}),(0,$.jsx)(V,{}),G]})}var Yn=`hub-registration-form`;function Xn(e){let t=(0,Q.c)(29),{mode:n,credentialRef:r}=e,[i,a]=(0,Z.useState)(``),[o,s]=(0,Z.useState)(``),[c,l]=(0,Z.useState)(``),u;t[0]!==i||t[1]!==o||t[2]!==n||t[3]!==c?(u=async e=>{e.preventDefault();let t=i;a(``);let r={displayName:o.trim(),passkeyLabel:c.trim()||null};n===`invitation`?await C.redeemInvitation({secret:t,...r}):await C.bootstrapOwner({credential:t,...r})},t[0]=i,t[1]=o,t[2]=n,t[3]=c,t[4]=u):u=t[4];let d=u,f;t[5]===d?f=t[6]:(f=e=>void d(e),t[5]=d,t[6]=f);let p=n===`invitation`?`Invitation code`:`Bootstrap credential`,m;t[7]===p?m=t[8]:(m=(0,$.jsx)(v,{htmlFor:`hub-registration-credential`,children:p}),t[7]=p,t[8]=m);let h;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>a(e.currentTarget.value),t[9]=h):h=t[9];let g;t[10]!==i||t[11]!==r?(g=(0,$.jsx)(Y,{ref:r,id:`hub-registration-credential`,type:`password`,required:!0,maxLength:128,value:i,className:J,onChange:h}),t[10]=i,t[11]=r,t[12]=g):g=t[12];let _;t[13]!==m||t[14]!==g?(_=(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[m,g]}),t[13]=m,t[14]=g,t[15]=_):_=t[15];let y;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(v,{htmlFor:`hub-display-name`,children:`Display name`}),t[16]=y):y=t[16];let b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>s(e.currentTarget.value),t[17]=b):b=t[17];let x;t[18]===o?x=t[19]:(x=(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[y,(0,$.jsx)(Y,{id:`hub-display-name`,required:!0,maxLength:200,value:o,className:J,onChange:b})]}),t[18]=o,t[19]=x);let S;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsxs)(v,{htmlFor:`hub-passkey-label`,children:[`Passkey label `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:`(optional)`})]}),t[20]=S):S=t[20];let w;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>l(e.currentTarget.value),t[21]=w):w=t[21];let T;t[22]===c?T=t[23]:(T=(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[S,(0,$.jsx)(Y,{id:`hub-passkey-label`,maxLength:100,value:c,className:J,onChange:w})]}),t[22]=c,t[23]=T);let E;return t[24]!==x||t[25]!==T||t[26]!==f||t[27]!==_?(E=(0,$.jsxs)(`form`,{id:Yn,className:`mt-6 space-y-4`,onSubmit:f,autoComplete:`off`,children:[_,x,T]}),t[24]=x,t[25]=T,t[26]=f,t[27]=_,t[28]=E):E=t[28],E}function Zn(){let e=(0,Q.c)(20),t=o(er),{copyToClipboard:n,isCopied:r}=ae(),i=`Save all ${String(t.length)} codes — they are shown once and cannot be retrieved later. Ryco does not save them in browser storage.`,a;e[0]!==n||e[1]!==t?(a=()=>n(Be(t),void 0),e[0]=n,e[1]=t,e[2]=a):a=e[2];let s;e[3]===r?s=e[4]:(s=r?(0,$.jsx)(G,{"aria-hidden":!0}):(0,$.jsx)(oe,{"aria-hidden":!0}),e[3]=r,e[4]=s);let c=r?`Copied`:`Copy codes`,l;e[5]!==a||e[6]!==s||e[7]!==c?(l=(0,$.jsxs)(q,{variant:`outline`,className:`mt-5 w-full phone:min-h-11`,onClick:a,children:[s,c]}),e[5]=a,e[6]=s,e[7]=c,e[8]=l):l=e[8];let u;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(q,{size:`cta`,className:`mt-3 w-full`,onClick:$n,children:`I saved the codes`}),e[9]=u):u=e[9];let d;e[10]===l?d=e[11]:(d=(0,$.jsxs)(`div`,{className:`phone:mt-auto ${Ye}`,children:[l,u]}),e[10]=l,e[11]=d);let f;e[12]===t?f=e[13]:(f=t.map(Qn),e[12]=t,e[13]=f);let p;e[14]===f?p=e[15]:(p=(0,$.jsx)(`ul`,{"aria-label":`Recovery codes`,className:`grid gap-2 rounded-xl border border-border bg-background p-4 font-mono text-sm break-all sm:grid-cols-2`,children:f}),e[14]=f,e[15]=p);let m;return e[16]!==i||e[17]!==d||e[18]!==p?(m=(0,$.jsx)(cn,{title:`Save your recovery codes`,description:i,actions:d,children:p}),e[16]=i,e[17]=d,e[18]=p,e[19]=m):m=e[19],m}function Qn(e){return(0,$.jsx)(`li`,{children:e},e)}function $n(){return C.dismissRecoveryCodes()}function er(e){return e.recoveryCodes}function tr(e){let t=(0,Q.c)(38),{node:n,nowMs:r,disabled:i,onConnect:a,onOpenDetail:o}=e,s;t[0]!==n||t[1]!==r?(s=jt(n,r),t[0]=n,t[1]=r,t[2]=s):s=t[2];let c=s,l;t[3]===n?l=t[4]:(l=D(n),t[3]=n,t[4]=l);let u=l,d=i||u,f;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsx)(`span`,{className:`flex size-[36px] shrink-0 items-center justify-center rounded-lg bg-muted`,children:(0,$.jsx)(w,{"aria-hidden":!0,className:`size-4`})}),t[5]=f):f=t[5];let p;t[6]===n.label?p=t[7]:(p=(0,$.jsx)(`span`,{className:`block truncate font-medium`,children:n.label}),t[6]=n.label,t[7]=p);let m;t[8]===n?m=t[9]:(m=Mt(n),t[8]=n,t[9]=m);let h;t[10]===m?h=t[11]:(h=(0,$.jsx)(`span`,{className:`block truncate text-xs text-muted-foreground`,children:m}),t[10]=m,t[11]=h);let g;t[12]===u?g=t[13]:(g=u?(0,$.jsx)(`span`,{className:`block truncate text-xs font-medium text-muted-foreground`,children:`Open in Desktop/Mobile`}):null,t[12]=u,t[13]=g);let _;t[14]!==p||t[15]!==h||t[16]!==g?(_=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[p,h,g]}),t[14]=p,t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]===n?v=t[19]:(v=(0,$.jsx)(R,{node:n}),t[18]=n,t[19]=v);let y;t[20]===c?y=t[21]:(y=c?(0,$.jsx)(`span`,{className:`whitespace-nowrap text-[11px] text-muted-foreground max-sm:hidden phone:hidden`,children:c}):null,t[20]=c,t[21]=y);let b;t[22]!==v||t[23]!==y?(b=(0,$.jsxs)(`span`,{className:`flex shrink-0 flex-col items-end gap-0.5`,children:[v,y]}),t[22]=v,t[23]=y,t[24]=b):b=t[24];let x;t[25]!==a||t[26]!==b||t[27]!==d||t[28]!==_?(x=(0,$.jsxs)(`button`,{type:`button`,disabled:d,onClick:a,className:`flex min-h-16 min-w-0 flex-1 flex-wrap items-center gap-3 px-4 py-3 text-left outline-none hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset disabled:opacity-60 disabled:hover:bg-transparent phone:min-h-18`,children:[f,_,b]}),t[25]=a,t[26]=b,t[27]=d,t[28]=_,t[29]=x):x=t[29];let S;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`w-px shrink-0 bg-border/60`}),t[30]=S):S=t[30];let C=`Node details: ${n.label}`,T;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(ne,{"aria-hidden":!0,className:`size-4`}),t[31]=T):T=t[31];let E;t[32]!==o||t[33]!==C?(E=(0,$.jsx)(`button`,{type:`button`,"aria-label":C,onClick:o,className:`flex w-[44px] shrink-0 items-center justify-center text-muted-foreground outline-none hover:bg-accent/50 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset`,children:T}),t[32]=o,t[33]=C,t[34]=E):E=t[34];let O;return t[35]!==x||t[36]!==E?(O=(0,$.jsxs)(`li`,{className:`flex items-stretch overflow-hidden rounded-xl border border-border bg-background`,children:[x,S,E]}),t[35]=x,t[36]=E,t[37]=O):O=t[37],O}function nr(){let e=(0,Q.c)(110),t=o(gr),n=o(hr),r=o(mr),a=o(pr),s=o(fr),c=o(dr),l=W(),u=he(),d=we()===`phone`,f=j()?.kind===`nodes-enroll`,p=ur,[m,h]=(0,Z.useState)(null),[g,_]=(0,Z.useState)(null),v=(0,Z.useRef)(null),y=We(6e4),b,x;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{v.current?.focus({preventScroll:!0})},x=[],e[0]=b,e[1]=x):(b=e[0],x=e[1]),(0,Z.useEffect)(b,x);let S;e[2]===u?S=e[3]:(S=async e=>{z(e.id)||(await u({to:`/`,replace:!0}),await C.selectNode(e.id))},e[2]=u,e[3]=S);let T=S;if(f){let t;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(Xt,{measure:`content`,children:(0,$.jsx)(ln,{onClose:()=>p(!1)})}),e[4]=t):t=e[4],t}let E,D,O,k,A,M,N,P,F,I,L,R,B,H,U,G,te,ne;if(e[5]!==s||e[6]!==r||e[7]!==m||e[8]!==a||e[9]!==d||e[10]!==t||e[11]!==y||e[12]!==g||e[13]!==l||e[14]!==T||e[15]!==c||e[16]!==n){let i=Nt(t),o;e[35]!==m||e[36]!==t?(o=m===null?null:t.find(e=>e.id===m)??null,e[35]=m,e[36]=t,e[37]=o):o=e[37],k=o,N=s?.role===`owner`;let u=n===`ready`&&t.length===0;M=N&&!u;let f;e[38]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,$.jsxs)(q,{variant:`ghost`,className:`min-h-11 flex-1`,onClick:lr,children:[(0,$.jsx)(pe,{"aria-hidden":!0}),` Account`]}),e[38]=f):f=e[38],O=f;let _;e[39]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsxs)(q,{variant:`ghost`,className:`min-h-11 flex-1`,onClick:cr,children:[(0,$.jsx)(ce,{"aria-hidden":!0}),` Sign out`]}),e[39]=_):_=e[39],F=_;let b=d?`mt-3 phone:min-h-11 phone:w-full`:void 0,x,S;e[40]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>p(!0),S=(0,$.jsx)(w,{"aria-hidden":!0}),e[40]=x,e[41]=S):(x=e[40],S=e[41]);let C;e[42]===b?C=e[43]:(C=(0,$.jsxs)(q,{className:b,onClick:x,children:[S,` Enroll node`]}),e[42]=b,e[43]=C),A=C;let j=d?`mt-3 phone:min-h-11 phone:w-full`:void 0,z=n===`loading`,V;e[44]===n?V=e[45]:(V=n===`loading`?(0,$.jsx)(ee,{"aria-hidden":!0,className:`animate-spin motion-reduce:animate-none`}):(0,$.jsx)(ue,{"aria-hidden":!0}),e[44]=n,e[45]=V);let W;e[46]!==j||e[47]!==z||e[48]!==V?(W=(0,$.jsxs)(q,{className:j,variant:`outline`,disabled:z,onClick:sr,children:[V,`Refresh nodes`]}),e[46]=j,e[47]=z,e[48]=V,e[49]=W):W=e[49],P=W,D=Xt;let re;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Account settings`,onClick:or,children:(0,$.jsx)(pe,{"aria-hidden":!0})}),e[50]=re):re=e[50],e[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsxs)($.Fragment,{children:[re,(0,$.jsx)(q,{size:`icon`,variant:`ghost`,"aria-label":`Sign out`,onClick:ar,children:(0,$.jsx)(ce,{"aria-hidden":!0})})]}),e[51]=L):L=e[51],E=Ht,R=v,B=t.length===1?`Your node`:`Your nodes`;let ie=s?.displayName??`Hub account`,ae;e[52]===s?ae=e[53]:(ae=s?` · ${s.role.charAt(0).toUpperCase()}${s.role.slice(1)}`:``,e[52]=s,e[53]=ae);let K;e[54]!==ie||e[55]!==ae?(K=(0,$.jsxs)(`p`,{className:`truncate`,children:[`Signed in as `,ie,ae]}),e[54]=ie,e[55]=ae,e[56]=K):K=e[56];let oe;e[57]===t?oe=e[58]:(oe=t.length>1?(0,$.jsx)(`p`,{className:`mt-0.5 truncate text-xs`,children:It(t)}):null,e[57]=t,e[58]=oe),e[59]!==K||e[60]!==oe?(H=(0,$.jsxs)($.Fragment,{children:[K,oe]}),e[59]=K,e[60]=oe,e[61]=H):H=e[61],e[62]!==A||e[63]!==M||e[64]!==d||e[65]!==P?(U=d?void 0:(0,$.jsxs)($.Fragment,{children:[P,M?A:null]}),e[62]=A,e[63]=M,e[64]=d,e[65]=P,e[66]=U):U=e[66],e[67]===n?G=e[68]:(G=n===`stale`?(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsxs)(De,{variant:`warning`,role:`status`,children:[(0,$.jsx)(fe,{"aria-hidden":!0}),(0,$.jsx)(Ee,{children:`Directory data is stale. Connecting is unavailable until it refreshes.`})]})}):null,e[67]=n,e[68]=G),e[69]===g?te=e[70]:(te=g?(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsxs)(De,{variant:`warning`,role:`status`,children:[(0,$.jsx)(fe,{"aria-hidden":!0}),(0,$.jsx)(Ee,{children:g})]})}):null,e[69]=g,e[70]=te);let se=n===`stale`?null:a;e[71]!==l||e[72]!==c||e[73]!==se?(ne=(0,$.jsx)(_r,{selection:c,routeNotice:l,error:se}),e[71]=l,e[72]=c,e[73]=se,e[74]=ne):ne=e[74],I=u?(0,$.jsx)(vr,{isOwner:N,onEnroll:()=>p(!0)}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`ul`,{role:`list`,className:`mt-5 space-y-2`,"aria-busy":n===`loading`,children:[i.map(e=>(0,$.jsx)(tr,{node:e,nowMs:y,disabled:Lt({directoryStatus:n,browserStatus:r,node:e}),onConnect:()=>void T(e),onOpenDetail:()=>h(e.id)},`${e.id}:${e.environmentId}`)),n===`loading`&&t.length===0?(0,$.jsx)($.Fragment,{children:[0,1,2].map(ir)}):null]}),n===`loading`&&t.length===0?(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:`Loading authorized nodes…`}):null,t.length>0?(0,$.jsx)(`p`,{className:`mt-2 px-1 text-[11px] text-muted-foreground`,children:`Presence refreshes about every 20 seconds.`}):null]}),e[5]=s,e[6]=r,e[7]=m,e[8]=a,e[9]=d,e[10]=t,e[11]=y,e[12]=g,e[13]=l,e[14]=T,e[15]=c,e[16]=n,e[17]=E,e[18]=D,e[19]=O,e[20]=k,e[21]=A,e[22]=M,e[23]=N,e[24]=P,e[25]=F,e[26]=I,e[27]=L,e[28]=R,e[29]=B,e[30]=H,e[31]=U,e[32]=G,e[33]=te,e[34]=ne}else E=e[17],D=e[18],O=e[19],k=e[20],A=e[21],M=e[22],N=e[23],P=e[24],F=e[25],I=e[26],L=e[27],R=e[28],B=e[29],H=e[30],U=e[31],G=e[32],te=e[33],ne=e[34];let re,ie;e[75]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,$.jsx)(`div`,{className:`mt-5`,children:(0,$.jsx)(Ge,{})}),ie=(0,$.jsx)(V,{}),e[75]=re,e[76]=ie):(re=e[75],ie=e[76]);let ae;e[77]===Symbol.for(`react.memo_cache_sentinel`)?(ae=e=>{e||h(null)},e[77]=ae):ae=e[77];let K;e[78]===T?K=e[79]:(K=e=>void T(e),e[78]=T,e[79]=K);let oe;e[80]===Symbol.for(`react.memo_cache_sentinel`)?(oe=async e=>{await i.revokeNode(e.id,ft),_(_t(e.label)),await C.refreshDirectory(),h(null)},e[80]=oe):oe=e[80];let se;e[81]!==r||e[82]!==k||e[83]!==N||e[84]!==n||e[85]!==K?(se=(0,$.jsx)(Vt,{node:k,directoryStatus:n,browserStatus:r,canRename:N,canRevoke:N,onOpenChange:ae,onConnect:K,onRename:rr,onRevoke:oe}),e[81]=r,e[82]=k,e[83]=N,e[84]=n,e[85]=K,e[86]=se):se=e[86];let le;e[87]!==E||e[88]!==I||e[89]!==se||e[90]!==R||e[91]!==B||e[92]!==H||e[93]!==U||e[94]!==G||e[95]!==te||e[96]!==ne?(le=(0,$.jsxs)(E,{titleRef:R,title:B,description:H,actions:U,children:[G,te,ne,I,re,ie,se]}),e[87]=E,e[88]=I,e[89]=se,e[90]=R,e[91]=B,e[92]=H,e[93]=U,e[94]=G,e[95]=te,e[96]=ne,e[97]=le):le=e[97];let de;e[98]!==O||e[99]!==A||e[100]!==M||e[101]!==d||e[102]!==P||e[103]!==F?(de=d?(0,$.jsxs)(`div`,{className:`mt-auto ${Ye}`,children:[(0,$.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[O,F]}),M?A:null,P]}):null,e[98]=O,e[99]=A,e[100]=M,e[101]=d,e[102]=P,e[103]=F,e[104]=de):de=e[104];let me;return e[105]!==D||e[106]!==L||e[107]!==le||e[108]!==de?(me=(0,$.jsxs)(D,{trailing:L,children:[le,de]}),e[105]=D,e[106]=L,e[107]=le,e[108]=de,e[109]=me):me=e[109],me}async function rr(e,t){await i.renameNode(e.id,t),await C.refreshDirectory()}function ir(e){return(0,$.jsx)(`li`,{children:(0,$.jsx)(Ce,{className:`h-16 w-full rounded-xl`})},e)}function ar(){C.signOut()}function or(){L({kind:`account`,section:`security`})}function sr(){C.refreshDirectory()}function cr(){C.signOut()}function lr(){L({kind:`account`,section:`security`})}function ur(e){return L(e?{kind:`nodes-enroll`}:{kind:`nodes`})}function dr(e){return e.selectionStatus}function fr(e){return e.account}function pr(e){return e.errorMessage}function mr(e){return e.browserStatus}function hr(e){return e.directoryStatus}function gr(e){return e.nodes}function _r(e){let t=(0,Q.c)(3),{selection:n,routeNotice:r,error:i}=e,a=(n===`authorization-removed`?`Authorization for the previous node was removed.`:n===`revoked`?`The previous node or grant was revoked.`:n===`incompatible`?`The previous node uses an incompatible relay version.`:null)??r??i;if(!a)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(fe,{"aria-hidden":!0}),t[0]=o):o=t[0];let s;return t[1]===a?s=t[2]:(s=(0,$.jsx)(`div`,{className:`mt-4`,children:(0,$.jsxs)(De,{variant:`error`,children:[o,(0,$.jsx)(Ee,{children:a})]})}),t[1]=a,t[2]=s),s}function vr(e){let t=(0,Q.c)(14),{isOwner:n,onEnroll:r}=e,i;t[0]===n?i=t[1]:(i=(0,$.jsx)(Pe,{variant:`icon`,children:n?(0,$.jsx)(w,{"aria-hidden":!0}):(0,$.jsx)(de,{"aria-hidden":!0})}),t[0]=n,t[1]=i);let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(Le,{children:`No nodes yet`}),t[2]=a):a=t[2];let o=n?`A node appears here once the Ryco client on that machine has been enrolled. Start enrollment on the node, then enter the short device code it shows — codes expire after ten minutes.`:`A node appears here once an owner of this Hub authorizes your account for it.`,s;t[3]===o?s=t[4]:(s=(0,$.jsx)(Re,{children:o}),t[3]=o,t[4]=s);let c;t[5]!==i||t[6]!==s?(c=(0,$.jsxs)(Fe,{children:[i,a,s]}),t[5]=i,t[6]=s,t[7]=c):c=t[7];let l;t[8]!==n||t[9]!==r?(l=n?(0,$.jsx)(Ie,{children:(0,$.jsxs)(q,{className:`phone:min-h-11`,onClick:r,children:[(0,$.jsx)(w,{"aria-hidden":!0}),` Enroll node`]})}):null,t[8]=n,t[9]=r,t[10]=l):l=t[10];let u;return t[11]!==c||t[12]!==l?(u=(0,$.jsxs)(ze,{className:`min-h-64`,children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13],u}export{Jn as HostedAuthenticationSurface,kn as HostedHubRoot};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-CRk9p9SC.css"])))=>i.map(i=>d[i]);
2
- import{i as e,t}from"./react-SIfiwpqq.js";import{t as n}from"./index-D5j6WG7w.js";import{I as r,Ni as i,P as a,ia as o}from"./runtime-L56puJDA.js";import{_ as s,o as c}from"./authorization-K_UCP_xh.js";import{n as l,t as u}from"./loader-circle-D0CNb5GI.js";import{t as d}from"./log-out-BuoOiS45.js";import{t as f}from"./shield-check-DHxdM6te.js";import{t as p}from"./smartphone-OaA-Xj_d.js";import{t as m}from"./triangle-alert-YXqtFxD6.js";import{t as h}from"./x-_SjFRYll.js";import{t as g}from"./button-QrCU0tNP.js";import{i as _,r as v,t as y}from"./alert-4WZo8oMe.js";var b=e(t(),1),x=o(),S=(0,b.lazy)(()=>n(()=>import(`./HostedHubRoot-CRIiJ67A.js`).then(e=>({default:e.HostedAuthenticationSurface})),__vite__mapDeps([0])));function C(e){window.location.assign(e)}function w({handoffId:e,navigate:t=C}){let n=a(e=>e.accountStatus),o=a(e=>e.account),[w,T]=(0,b.useState)(null),[E,D]=(0,b.useState)(!0),[O,k]=(0,b.useState)(null),[A,j]=(0,b.useState)(null),[M,N]=(0,b.useState)(null),P=(0,b.useRef)(null);if((0,b.useEffect)(()=>{let t=new AbortController;return D(!0),N(null),r.getNativeHandoffPresentation(e,t.signal).then(e=>T(e)).catch(e=>{t.signal.aborted||N(e instanceof s?e.message:`This device authorization is unavailable or has expired.`)}).finally(()=>{t.signal.aborted||D(!1)}),()=>t.abort()},[e]),(0,b.useEffect)(()=>{!E&&n===`authenticated`&&P.current?.focus({preventScroll:!0})},[n,E]),n!==`authenticated`||!o)return(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(S,{context:`native-authorization`,autoExternalProvider:w?.providerHint??null})});let F=async n=>{if(O===null){k(n),N(null);try{if(n===`switch-account`){await c.signOut();return}let i=n===`approve`?await r.approveNativeHandoff(e):await r.cancelNativeHandoff(e);n===`approve`&&(j({redirectUri:i.redirectUri,deviceLabel:w?.deviceLabel??`your device`}),await new Promise(e=>requestAnimationFrame(()=>e()))),t(i.redirectUri)}catch(e){n===`approve`&&j(null),N(e instanceof s?e.message:`The device authorization could not be completed.`)}finally{k(null)}}};return A===null?(0,x.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center overflow-x-hidden bg-background px-4 py-10 text-foreground sm:px-6`,children:(0,x.jsxs)(`section`,{className:`w-full max-w-md rounded-[1.5rem] border border-border bg-card p-5 shadow-2xl shadow-black/10 sm:p-7`,children:[(0,x.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,x.jsx)(`div`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl border border-border bg-background text-primary`,children:(0,x.jsx)(f,{"aria-hidden":!0,className:`size-5`})}),(0,x.jsxs)(`p`,{className:`pt-1 text-[11px] font-semibold tracking-[0.16em] text-muted-foreground uppercase`,children:[i,` Hub`]})]}),(0,x.jsx)(`h1`,{ref:P,tabIndex:-1,className:`mt-6 text-2xl font-semibold tracking-tight outline-none`,children:`Continue on this device?`}),(0,x.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-muted-foreground`,children:`Only continue if you started this connection from the Ryco app. The app receives a one-time code, never this browser session.`}),(0,x.jsxs)(`div`,{className:`mt-6 overflow-hidden rounded-2xl border border-border bg-background/65`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border px-4 py-3.5`,children:[(0,x.jsx)(p,{"aria-hidden":!0,className:`size-5 text-muted-foreground`}),(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Requesting device`}),(0,x.jsx)(`p`,{className:`truncate text-sm font-medium`,children:E?`Checking request…`:w?.deviceLabel??`Unknown device`})]})]}),(0,x.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3.5`,children:[(0,x.jsx)(`div`,{"aria-hidden":!0,className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/12 text-xs font-semibold text-primary`,children:o.displayName.trim().slice(0,1).toLocaleUpperCase()||`R`}),(0,x.jsxs)(`div`,{className:`min-w-0`,children:[(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Signed in as`}),(0,x.jsx)(`p`,{className:`truncate text-sm font-medium`,children:o.displayName})]})]})]}),M?(0,x.jsxs)(y,{variant:`error`,className:`mt-4`,children:[(0,x.jsx)(m,{"aria-hidden":!0}),(0,x.jsx)(_,{children:`Authorization did not complete`}),(0,x.jsx)(v,{children:M})]}):null,(0,x.jsxs)(`div`,{className:`mt-6 space-y-2.5`,children:[(0,x.jsxs)(g,{size:`lg`,className:`min-h-11 w-full`,disabled:E||!w||O!==null,onClick:()=>void F(`approve`),children:[O===`approve`?(0,x.jsx)(u,{"aria-hidden":!0,className:`animate-spin motion-reduce:animate-none`}):(0,x.jsx)(l,{"aria-hidden":!0}),`Continue as `,o.displayName]}),(0,x.jsxs)(g,{size:`lg`,variant:`outline`,className:`min-h-11 w-full`,disabled:O!==null,onClick:()=>void F(`switch-account`),children:[O===`switch-account`?(0,x.jsx)(u,{"aria-hidden":!0,className:`animate-spin motion-reduce:animate-none`}):(0,x.jsx)(d,{"aria-hidden":!0}),`Use another account`]}),(0,x.jsxs)(g,{size:`lg`,variant:`ghost`,className:`min-h-11 w-full`,disabled:E||!w||O!==null,onClick:()=>void F(`cancel`),children:[O===`cancel`?(0,x.jsx)(u,{"aria-hidden":!0,className:`animate-spin motion-reduce:animate-none`}):(0,x.jsx)(h,{"aria-hidden":!0}),`Cancel`]})]}),(0,x.jsx)(`p`,{className:`mt-5 text-center text-xs leading-relaxed text-muted-foreground`,children:`Access remains limited to the nodes and permissions assigned to this Hub account.`})]})}):(0,x.jsx)(`main`,{className:`flex min-h-dvh items-center justify-center overflow-hidden bg-background px-4 py-10 text-foreground sm:px-6`,children:(0,x.jsxs)(`section`,{role:`status`,"aria-live":`polite`,className:`w-full max-w-md rounded-[1.5rem] border border-border bg-card p-6 text-center shadow-2xl shadow-black/10 sm:p-8`,children:[(0,x.jsxs)(`div`,{className:`relative mx-auto flex size-24 items-center justify-center`,children:[(0,x.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-2 rounded-full bg-success/20 motion-safe:animate-ping`}),(0,x.jsx)(`span`,{"aria-hidden":!0,className:`absolute inset-0 rounded-full border border-success/25 motion-safe:animate-pulse`}),(0,x.jsx)(`span`,{className:`relative flex size-16 items-center justify-center rounded-full bg-success text-success-foreground shadow-lg shadow-success/20`,children:(0,x.jsx)(l,{"aria-hidden":!0,className:`size-8`,strokeWidth:2.5})})]}),(0,x.jsx)(`p`,{className:`mt-7 text-[11px] font-semibold tracking-[0.16em] text-success uppercase`,children:`Sign-in approved`}),(0,x.jsx)(`h1`,{className:`mt-2 text-2xl font-semibold tracking-tight`,children:`Ryco is opening`}),(0,x.jsxs)(`p`,{className:`mt-3 text-sm leading-relaxed text-muted-foreground`,children:[`Ryco is securely finishing account and node setup on `,A.deviceLabel,`. This tab can be closed when the app shows setup complete.`]}),(0,x.jsx)(`div`,{className:`mt-7 rounded-2xl border border-border bg-background/65 p-4`,children:(0,x.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm font-medium`,children:[(0,x.jsx)(p,{"aria-hidden":!0,className:`size-4 text-primary`}),`Waiting for the Ryco app`,(0,x.jsxs)(`span`,{className:`flex gap-1`,"aria-hidden":!0,children:[(0,x.jsx)(`span`,{className:`size-1 rounded-full bg-primary motion-safe:animate-pulse`}),(0,x.jsx)(`span`,{className:`size-1 rounded-full bg-primary motion-safe:animate-pulse [animation-delay:150ms]`}),(0,x.jsx)(`span`,{className:`size-1 rounded-full bg-primary motion-safe:animate-pulse [animation-delay:300ms]`})]})]})}),(0,x.jsx)(g,{size:`lg`,variant:`outline`,className:`mt-5 min-h-11 w-full`,onClick:()=>t(A.redirectUri),children:`Open Ryco again`})]})})}export{w as HostedNativeAuthorizationRoute};
@@ -1 +0,0 @@
1
- import{i as e,t}from"./react-SIfiwpqq.js";import{_t as n,gt as r,ia as i}from"./runtime-L56puJDA.js";import{t as a}from"./compiler-runtime-qmuS0Svy.js";import{Q as o,n as s,r as c,tt as l}from"./authorization-K_UCP_xh.js";import{t as u}from"./shield-alert-BrZ-Rb8N.js";import{t as d}from"./shield-DlqCO-0N.js";function f(e){return c(e)}function p(e){return s(e)}var m=a(),h=e(t(),1),g=()=>n().status;function _(){return(0,h.useSyncExternalStore)(r,g,g)}var v=()=>n().verificationCode;function y(){return(0,h.useSyncExternalStore)(r,v,v)}function b(e){let t=e.split(l.separator);if(t.length!==l.groups)return[];for(let e of t){if(e.length!==l.charsPerGroup)return[];for(let t of e)if(!`0123456789ABCDEFGHJKMNPQRSTVWXYZ`.includes(t))return[]}return t}l.chars*Math.log2(o.length);var x=`Compare this code with the one your node's CLI shows for this session. A match catches accidental wrong-node routing and some network interposition while the loaded code is honest; it cannot protect against the Hub operator, who serves this page, and it does not rule out someone sitting in the middle.`,S=`Settings → Security explains what else this tab cannot check.`,C=`Compare this code with the one your node's CLI shows for this session. A match catches accidental wrong-node routing and some network interposition while the loaded code is honest. This tab pins no node identity, so that comparison is the only thing that speaks to whether the far end is your machine or the Hub standing in for it — and it cannot protect against the Hub operator, who serves this page and could serve code that completes the same handshake and displays this same code anyway. A match does not rule out someone sitting in the middle.`,w="Run `ryco e2ee sessions` on the machine running the node to read its end of the comparison.",T=`No session code is available for this channel, so there is nothing here to compare against your node's CLI.`;function E(e){return e?`inline`:`settings`}var D={inline:{advisory:x,more:S},settings:{advisory:C,more:w}};Object.keys(D);function O(e,t){if(e===null)return null;let n=b(e);if(n.length===0)return null;let{advisory:r,more:i}=D[t];return{groups:n,display:n.join(l.separator),advisory:r,more:i}}var k={unavailable:{tone:`caution`,body:`Hosted connections reach your nodes through the Ryco Hub over WSS. No node channel is open in this tab, so the Hub still forwards what you send in a form it can read, and it is expected not to log or keep it.`},negotiating:{tone:`caution`,body:`This tab is still agreeing a channel with your node and has released nothing to it yet. Until that settles, treat this connection as one the Hub can read.`},"web-unsigned":{tone:`advisory`,body:`This tab and the node it was routed to agreed a browser channel, so while the code this page is running is honest the Hub relays ciphertext instead of readable payload. It is weaker than the channel the Ryco mobile app gets, in two ways this tab cannot close. This tab pins no node identity, so it cannot tell whether the far end of that channel is your machine or the Hub standing in for it. And it cannot protect against the Hub operator, who serves every byte of this page's JavaScript and could serve code that completes the same handshake and copies your data anyway. Its downgrade check is held in memory only — empty again in every new tab and after every reload, and worth nothing against that operator. Only your node can close the plaintext path for browsers.`},legacy:{tone:`caution`,body:`This channel fell back to legacy plaintext. This tab cannot tell whether your node offered no encrypted channel or something on the path removed the offer, so treat everything sent over it as readable by the Hub, which is expected not to log or keep it. Only your node can refuse plaintext for browsers.`}};function A(e){return k[e]}Object.keys(k);var j=i();function M(e){let t=(0,m.c)(13),{compact:n}=e,r=n!==void 0&&n,i=_(),a;t[0]===i?a=t[1]:(a=A(i),t[0]=i,t[1]=a);let{tone:o,body:s}=a,c=o===`advisory`?d:u,l=o===`advisory`?`text-sky-600`:`text-amber-600`,f=r?`flex gap-2 text-xs leading-relaxed text-muted-foreground`:`flex gap-2 rounded-lg border px-3 py-2.5 text-xs leading-relaxed text-muted-foreground ${o===`advisory`?`border-sky-500/25 bg-sky-500/5`:`border-amber-500/25 bg-amber-500/5`}`,p=`mt-0.5 size-4 shrink-0 ${l}`,h;t[2]!==c||t[3]!==p?(h=(0,j.jsx)(c,{"aria-hidden":!0,className:p}),t[2]=c,t[3]=p,t[4]=h):h=t[4];let g;t[5]===s?g=t[6]:(g=(0,j.jsx)(`p`,{children:s}),t[5]=s,t[6]=g);let v;return t[7]!==i||t[8]!==f||t[9]!==h||t[10]!==g||t[11]!==o?(v=(0,j.jsxs)(`div`,{className:f,"data-hosted-relay-trust-notice":`true`,"data-e2ee-status":i,"data-tone":o,children:[h,g]}),t[7]=i,t[8]=f,t[9]=h,t[10]=g,t[11]=o,t[12]=v):v=t[12],v}export{_ as a,f as c,O as i,T as n,y as o,E as r,p as s,M as t};