@p4code/cli 0.8.7 → 0.8.9

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 (340) hide show
  1. package/dist/AcpMcpStdioBridge-BFonJkL3.mjs +4 -0
  2. package/dist/{AcpMcpStdioBridge-DHwGLtep.mjs → AcpMcpStdioBridge-WH45ZIFK.mjs} +78 -11
  3. package/dist/{Effect-BahT0mOQ.mjs → Effect-B-zvTJgX.mjs} +2 -2
  4. package/dist/bin.mjs +2 -2
  5. package/dist/{binCli-D_84b0CF.mjs → binCli-C7u9q31G.mjs} +114320 -113097
  6. package/dist/claude-history-worker.mjs +1 -1
  7. package/dist/{claudeHistoryWorker-v_0uyLGp.mjs → claudeHistoryWorker-C1bTkcUr.mjs} +2 -2
  8. package/dist/client/.vite/manifest.json +2072 -2071
  9. package/dist/client/assets/{AnimatedHeight-DewGDSmN.js → AnimatedHeight-DZPLUjm9.js} +2 -2
  10. package/dist/client/assets/{AuthSurfaceShell-D29U36jB.js → AuthSurfaceShell-CY0yRsGY.js} +2 -2
  11. package/dist/client/assets/{CSPContext-CB4Jj3Uk.js → CSPContext-D9jns38x.js} +2 -2
  12. package/dist/client/assets/ChatGptUsageButton-jceJZ5U0.js +2 -0
  13. package/dist/client/assets/ChatMarkdown-B2cnntMF.js +65 -0
  14. package/dist/client/assets/{CodexSetupSection.logic-DQMTTenV.js → CodexSetupSection.logic-Bfp0M73n.js} +2 -2
  15. package/dist/client/assets/ComboboxClear-B-WUNsj0.js +2 -0
  16. package/dist/client/assets/{CommandBlock-VzUG411k.js → CommandBlock-BI9G-Hs9.js} +2 -2
  17. package/dist/client/assets/{ComposerPromptEditor-lIFv0Iko.js → ComposerPromptEditor-CYQVwHWc.js} +56 -56
  18. package/dist/client/assets/CompositeRoot-CZqNlh6y.js +2 -0
  19. package/dist/client/assets/{ConnectionStatusDot-B0ZKI-zI.js → ConnectionStatusDot-BNGv8ojc.js} +2 -2
  20. package/dist/client/assets/DevicePanel-C5V7qlX0.js +2 -0
  21. package/dist/client/assets/{DeviceSetup-Bg5OpWbo.js → DeviceSetup-lLd1Dxuc.js} +2 -2
  22. package/dist/client/assets/{DialogTitle-BVkBTuS9.js → DialogTitle-Bti0gMwZ.js} +2 -2
  23. package/dist/client/assets/{DiffCommentAnnotation-BsI9yTe1.js → DiffCommentAnnotation-DpZ1jfFT.js} +2 -2
  24. package/dist/client/assets/{DiffFileTree-Bg8GHn2r.js → DiffFileTree-DW_wXLvM.js} +2 -2
  25. package/dist/client/assets/DiffPanel-DvsF1RpU.js +2 -0
  26. package/dist/client/assets/{DiffWorkerPoolProvider-B9BXoLYM.js → DiffWorkerPoolProvider-BGHe4Gu5.js} +3 -3
  27. package/dist/client/assets/{EnvironmentMachineIcon-DX1wHHgS.js → EnvironmentMachineIcon-BzeEbEQS.js} +2 -2
  28. package/dist/client/assets/{ExpandableText-DfTvwfDp.js → ExpandableText-CZAoe3pn.js} +2 -2
  29. package/dist/client/assets/{FieldControl-CrNWnPN_.js → FieldControl-DSYkAElP.js} +2 -2
  30. package/dist/client/assets/{FileDiff-Ds-DSHzC.js → FileDiff-qUCf81Vy.js} +2 -2
  31. package/dist/client/assets/{FilePreviewPanel-CyR5pXUr.js → FilePreviewPanel-DgsQ3_bI.js} +4 -4
  32. package/dist/client/assets/{FoldedSettingsSection-DQesC0Ch.js → FoldedSettingsSection-B8ucLmcM.js} +2 -2
  33. package/dist/client/assets/{FormContext-CUf-dYwe.js → FormContext-TllbMdtd.js} +2 -2
  34. package/dist/client/assets/{Icons-DMu3kCVA.js → Icons-CyDEOiJ2.js} +2 -2
  35. package/dist/client/assets/{KeybindingsSettings.logic-BB1oFV_W.js → KeybindingsSettings.logic-Dx9jAbbW.js} +2 -2
  36. package/dist/client/assets/{NoProjectsHero-D0SwrjYG.js → NoProjectsHero-Lxz19PUh.js} +2 -2
  37. package/dist/client/assets/PanelLayoutControls-jZ_kyR1v.js +216 -0
  38. package/dist/client/assets/{PierreEntryIcon-BUl5qtCE.js → PierreEntryIcon-zwmwEij7.js} +2 -2
  39. package/dist/client/assets/PreviewPanel-Cgu0PLKZ.js +2 -0
  40. package/dist/client/assets/ProjectDefaultsSettings-DaLgF84f.js +2 -0
  41. package/dist/client/assets/ProjectFavicon-Cs-IpJFL.js +3 -0
  42. package/dist/client/assets/{ProjectIconPickerDialog-C-KFxEg0.js → ProjectIconPickerDialog-CWU1aanN.js} +2 -2
  43. package/dist/client/assets/{ProjectMonogram-B2dsNF6-.js → ProjectMonogram-De9Vi6mM.js} +2 -2
  44. package/dist/client/assets/{ProviderAuthTerminal-Cwr8Z1Ly.js → ProviderAuthTerminal-Dod9VT45.js} +2 -2
  45. package/dist/client/assets/ProviderModelPicker-DnPxGK8M.js +2 -0
  46. package/dist/client/assets/{ProviderSettingsForm-DpmAB_Jq.js → ProviderSettingsForm-CK0XB_2n.js} +2 -2
  47. package/dist/client/assets/PullRequestCodeTab-TTmg3elC.js +6 -0
  48. package/dist/client/assets/{ReadOnlySourcePreview-C5y6ELAP.js → ReadOnlySourcePreview-DS49yxPu.js} +2 -2
  49. package/dist/client/assets/{RenderErrorBoundary-CyH8UwmD.js → RenderErrorBoundary-ChsSTLIX.js} +2 -2
  50. package/dist/client/assets/ScheduledTasksSettings-DK0fR_O9.js +4 -0
  51. package/dist/client/assets/{ScopedSwitch-pdvWIJp5.js → ScopedSwitch-zab4bpLE.js} +2 -2
  52. package/dist/client/assets/{SecretInput-C11F3Wuh.js → SecretInput-7_dN8OZO.js} +2 -2
  53. package/dist/client/assets/SettingsPanels-CvD-BKml.js +39 -0
  54. package/dist/client/assets/{SettingsPanels.logic-zUA6f3HT.js → SettingsPanels.logic-BxZ7DzP5.js} +2 -2
  55. package/dist/client/assets/{SettingsScopeNotice-N6bcXfto.js → SettingsScopeNotice-Bq3kVMy1.js} +2 -2
  56. package/dist/client/assets/{T3ConnectAccountPages-uVnu-v4W.js → T3ConnectAccountPages-C37rBXr1.js} +2 -2
  57. package/dist/client/assets/{T3ConnectSidebarSignIn-CZCWzt6C.js → T3ConnectSidebarSignIn-Dcx0wC1Y.js} +2 -2
  58. package/dist/client/assets/{ThemeEditorPanel-CjUB7HmU.js → ThemeEditorPanel-CDg13cbU.js} +3 -3
  59. package/dist/client/assets/{ThreadTerminalDrawer-CAh-h3eK.js → ThreadTerminalDrawer-CJZ5gJIq.js} +4 -4
  60. package/dist/client/assets/{Virtualizer-CB4f0UTD.js → Virtualizer-BzpMB2EV.js} +2 -2
  61. package/dist/client/assets/{WorkspaceBreadcrumb-3VgFkWcC.js → WorkspaceBreadcrumb-BG0QcIel.js} +2 -2
  62. package/dist/client/assets/{WorkspacePageContainer-8jksqZGW.js → WorkspacePageContainer-D4M31vG4.js} +2 -2
  63. package/dist/client/assets/{WorkspacePageHeader-IRvZnA0X.js → WorkspacePageHeader-xG2EcvME.js} +2 -2
  64. package/dist/client/assets/_chat-DWZuy8TH.js +45 -0
  65. package/dist/client/assets/{_chat.index-DnYerwxz.js → _chat.index-CFbhMaCi.js} +2 -2
  66. package/dist/client/assets/{_chat.new-XtBIcyRw.js → _chat.new-B9CmLitW.js} +3 -3
  67. package/dist/client/assets/_chat.pull-requests-BvS3LBJa.js +2 -0
  68. package/dist/client/assets/{abnfDiagram-VCTEODGH-DUPWAarL.js → abnfDiagram-VCTEODGH-DTgtRsRm.js} +2 -2
  69. package/dist/client/assets/{alert-DzxRsWWi.js → alert-BFkMrLRZ.js} +2 -2
  70. package/dist/client/assets/architecture-7GRP2DOG-B_WCZ15Q.js +1 -0
  71. package/dist/client/assets/{architectureDiagram-5GKGNRK7-ipdl5Chl.js → architectureDiagram-5GKGNRK7-DoSCknS9.js} +2 -2
  72. package/dist/client/assets/assets-CH9UWZJ9.js +2 -0
  73. package/dist/client/assets/{blockDiagram-I7D4REHJ-CCqcBoEP.js → blockDiagram-I7D4REHJ-CIO7Vskr.js} +2 -2
  74. package/dist/client/assets/{browserHistoryStore-TLJ0k3I1.js → browserHistoryStore-CUwwaVj8.js} +2 -2
  75. package/dist/client/assets/{browserLinkTarget-Du_qPFvd.js → browserLinkTarget-o1Hmp1Jv.js} +2 -2
  76. package/dist/client/assets/{c4Diagram-7LVT6UL2-D0uMteR1.js → c4Diagram-7LVT6UL2-CmnScM2q.js} +2 -2
  77. package/dist/client/assets/channel-Qn29FVeD.js +2 -0
  78. package/dist/client/assets/checkbox-DSb65NrE.js +2 -0
  79. package/dist/client/assets/{chunk-4HAMMTFA-B3SWgtem.js → chunk-4HAMMTFA-CuQTMYv7.js} +2 -2
  80. package/dist/client/assets/{chunk-75Z2AOVW-CXAakYxI.js → chunk-75Z2AOVW-xNjAbRtQ.js} +2 -2
  81. package/dist/client/assets/{chunk-DU6HZSFF-B4qcstD9.js → chunk-DU6HZSFF-B-vhPkPw.js} +2 -2
  82. package/dist/client/assets/{chunk-F27PBJKO-DimzPDjs.js → chunk-F27PBJKO-HjvfKtnV.js} +2 -2
  83. package/dist/client/assets/{chunk-GMAD6QVW-BHA-Os4E.js → chunk-GMAD6QVW-kPi65s4F.js} +2 -2
  84. package/dist/client/assets/{chunk-GVQU2GXP-P9nMI_GJ.js → chunk-GVQU2GXP-xSVP_0Ga.js} +2 -2
  85. package/dist/client/assets/{chunk-IMKFNOWR-RgWCceFN.js → chunk-IMKFNOWR-Bo44GnXt.js} +2 -2
  86. package/dist/client/assets/{chunk-L3NEJ4N5-9p7zIkHC.js → chunk-L3NEJ4N5-CL_FAp25.js} +2 -2
  87. package/dist/client/assets/{chunk-OSK3NFVY-C9IokqLY.js → chunk-OSK3NFVY-C-UAFrKw.js} +2 -2
  88. package/dist/client/assets/{chunk-P2QGCYS3-Dwk8ORW_.js → chunk-P2QGCYS3-Cu_kTzsg.js} +2 -2
  89. package/dist/client/assets/{chunk-POPQ4Y6H-BwYKYQwt.js → chunk-POPQ4Y6H-DlEI3XVl.js} +2 -2
  90. package/dist/client/assets/{chunk-PWAF6VOD-BMw0rklB.js → chunk-PWAF6VOD-COj3Z6PV.js} +2 -2
  91. package/dist/client/assets/{chunk-SHT3W25Y-D3ovSAoa.js → chunk-SHT3W25Y-DmOdlcB6.js} +2 -2
  92. package/dist/client/assets/{chunk-SVP7TREG-CpaRTznV.js → chunk-SVP7TREG-DZcmFNGC.js} +2 -2
  93. package/dist/client/assets/{chunk-TICWLB2K-CAtIccZJ.js → chunk-TICWLB2K-D2Au2dCv.js} +2 -2
  94. package/dist/client/assets/classDiagram-ZZMXUADV-BNlFiwih.js +2 -0
  95. package/dist/client/assets/classDiagram-v2-VYDZK3BY-BNlFiwih.js +2 -0
  96. package/dist/client/assets/{color-picker-DYoHU1P8.js → color-picker-8XrkJD1z.js} +2 -2
  97. package/dist/client/assets/{combobox-Ddag8Jom.js → combobox-BdHSd-gh.js} +2 -2
  98. package/dist/client/assets/{command-B35zAYVN.js → command-DywgXMPU.js} +2 -2
  99. package/dist/client/assets/{connect-XgeleCz9.js → connect-D6Vr-odX.js} +2 -2
  100. package/dist/client/assets/{connect-agent-BRIcxQbo.js → connect-agent-D6S_10vE.js} +2 -2
  101. package/dist/client/assets/{cynefin-OW5HDTMX-Br0UWz2p.js → cynefin-OW5HDTMX-Cl8Piv1U.js} +1 -1
  102. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-Bz8AWXlE.js → cynefinDiagram-5FMLGOSQ-BlrMhOzc.js} +2 -2
  103. package/dist/client/assets/{dagre-GXQ25YYZ-Kk1kLU-A.js → dagre-GXQ25YYZ-zcnnhkbu.js} +2 -2
  104. package/dist/client/assets/{device-CJH4ixRH.js → device-CVYEIUNR.js} +2 -2
  105. package/dist/client/assets/{diagram-S7CK7UJ4-Dogw5edZ.js → diagram-S7CK7UJ4-bDWotpej.js} +2 -2
  106. package/dist/client/assets/{diagram-UQ7AKVKN-kg5DSfbZ.js → diagram-UQ7AKVKN-QfcGX0wU.js} +2 -2
  107. package/dist/client/assets/{diagram-VSXAHHWV-DXdyRkdD.js → diagram-VSXAHHWV-B6rtnGIC.js} +2 -2
  108. package/dist/client/assets/{diagram-VX7I27RA-CNO5Z04I.js → diagram-VX7I27RA-Bh7jDf_z.js} +2 -2
  109. package/dist/client/assets/{diagram-Z3DM3KII-7Pw0HXMg.js → diagram-Z3DM3KII-BF8BOL3s.js} +2 -2
  110. package/dist/client/assets/{dialog-C9_Ef3sx.js → dialog-B5b8j4VI.js} +2 -2
  111. package/dist/client/assets/{diffRendering-CAxImuLd.js → diffRendering-CnRmUrdi.js} +2 -2
  112. package/dist/client/assets/{discovery-list-DXE1P9pq.js → discovery-list-DLWA9rLh.js} +2 -2
  113. package/dist/client/assets/{dist-DOyHkZUI.js → dist-B181ZKao.js} +3 -3
  114. package/dist/client/assets/{draft-input-6dynCiw_.js → draft-input-CidATm_k.js} +2 -2
  115. package/dist/client/assets/{duoViewer-BFeSS1Av.js → duoViewer-gLqnN26Y.js} +2 -2
  116. package/dist/client/assets/{dynamic-BxCDxZLw.js → dynamic-C9YFXILD.js} +2 -2
  117. package/dist/client/assets/{ebnfDiagram-PWID7BFC-DD9UVmrJ.js → ebnfDiagram-PWID7BFC-DbaAPr36.js} +2 -2
  118. package/dist/client/assets/{embeddedScripts-CIC2AYGL.js → embeddedScripts-DZZY2Y12.js} +2 -2
  119. package/dist/client/assets/empty-BQwNj0_P.js +2 -0
  120. package/dist/client/assets/entities-CW57Cs5E.js +2 -0
  121. package/dist/client/assets/{erDiagram-RLTQ6QDP-BJ--ph2e.js → erDiagram-RLTQ6QDP-CkFVQs9q.js} +2 -2
  122. package/dist/client/assets/eventmodeling-NTZA5JFV-Bx5bcL3d.js +1 -0
  123. package/dist/client/assets/{fileLinks-BZV-xG7Q.js → fileLinks-CJJSqeqK.js} +2 -2
  124. package/dist/client/assets/{fileTreeExpansion-SSkII8h0.js → fileTreeExpansion-D1dm7wQj.js} +2 -2
  125. package/dist/client/assets/flowDiagram-HODETNUW-BOrqEpZF.js +1 -0
  126. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-CAMkT1YN.js → ganttDiagram-EL5Y4UJY-bgGfFOUy.js} +2 -2
  127. package/dist/client/assets/{getDiffFileInput-BbRHVLd8.js → getDiffFileInput-C3kf5492.js} +2 -2
  128. package/dist/client/assets/{gitGraph-4MIJSDKK-DsGem99u.js → gitGraph-4MIJSDKK-CkcsQXce.js} +1 -1
  129. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-BkbTIyDI.js → gitGraphDiagram-WWUBYQGX-D9-3rabr.js} +2 -2
  130. package/dist/client/assets/{guideRunStore-CRgghh5M.js → guideRunStore-C7ZnghV_.js} +2 -2
  131. package/dist/client/assets/{htmlRender-DhaCAG_8.js → htmlRender-Dwrbtk9Z.js} +2 -2
  132. package/dist/client/assets/{index-CyuShNwE.js → index-CG78-Gl5.js} +3 -3
  133. package/dist/client/assets/{info-A6RAGUB7-BBQkQpY8.js → info-A6RAGUB7-D_d0Mq_H.js} +1 -1
  134. package/dist/client/assets/{infoDiagram-27XIBGKW-B-aRfZJ5.js → infoDiagram-27XIBGKW-DYnd3lec.js} +2 -2
  135. package/dist/client/assets/{input-BZEAWLAC.js → input-CNGP9r-b.js} +2 -2
  136. package/dist/client/assets/{input-group-DQ0hiSJt.js → input-group-CIDwGwLV.js} +2 -2
  137. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-BuQT0JFA.js → ishikawaDiagram-5VMMS53U-Br3IhV30.js} +2 -2
  138. package/dist/client/assets/{journeyDiagram-3NMN7TZE-DvMkIp6_.js → journeyDiagram-3NMN7TZE-D4gshgtr.js} +2 -2
  139. package/dist/client/assets/{kanban-definition-UXKFOSKX-BH-BleQp.js → kanban-definition-UXKFOSKX-DODm_gbD.js} +2 -2
  140. package/dist/client/assets/{kbd-B5U1dWuw.js → kbd-C3OLELe_.js} +2 -2
  141. package/dist/client/assets/{keybindings-BOV97yVS.js → keybindings-Dw_FB1Sr.js} +2 -2
  142. package/dist/client/assets/{lazyRouteComponent-Cz9CWj20.js → lazyRouteComponent-knQbCz5Y.js} +2 -2
  143. package/dist/client/assets/{line-ldmXyAfR.js → line-B2pKNKWO.js} +2 -2
  144. package/dist/client/assets/{link-GWWfOiYJ.js → link-CBNV8k75.js} +2 -2
  145. package/dist/client/assets/{linkedPrompt-CUOURNo0.js → linkedPrompt-BsxfomUU.js} +2 -2
  146. package/dist/client/assets/main-BEavB8iB.css +2 -0
  147. package/dist/client/assets/main-pmaKofkn.js +30 -0
  148. package/dist/client/assets/{mediaReference-CHMrPLS_.js → mediaReference-BLVT2VlI.js} +2 -2
  149. package/dist/client/assets/{mediaSource-C2DVrhoI.js → mediaSource-1xb6xNr7.js} +2 -2
  150. package/dist/client/assets/{mermaid-parser.core-CLu3jfMo.js → mermaid-parser.core-CT916xNb.js} +4 -4
  151. package/dist/client/assets/{mermaid.core-CcbjUEO9.js → mermaid.core-dZGXThQe.js} +5 -5
  152. package/dist/client/assets/{mindmap-definition-YA3MSWOX-BgA-mHTZ.js → mindmap-definition-YA3MSWOX-DRDe2pwU.js} +2 -2
  153. package/dist/client/assets/number-field-CrV4BtLe.js +2 -0
  154. package/dist/client/assets/{observeResize-DRhwSBbU.js → observeResize-jQzrVN_N.js} +2 -2
  155. package/dist/client/assets/{onboarding-JdAo8zsA.js → onboarding-DnxQtcwh.js} +2 -2
  156. package/dist/client/assets/{openFileInPreview-fPqhkMo9.js → openFileInPreview-Dx_dxN9N.js} +2 -2
  157. package/dist/client/assets/{p4ProjectFile-CvON4UbU.js → p4ProjectFile-BfRZT-Cd.js} +2 -2
  158. package/dist/client/assets/{packet-AYTQ26CC-DApn8qRX.js → packet-AYTQ26CC-BewZkvu0.js} +1 -1
  159. package/dist/client/assets/{pair-BZFzlFlB.js → pair-B5ki01nI.js} +2 -2
  160. package/dist/client/assets/{pegDiagram-XKGWAZYB-CXEiF-e_.js → pegDiagram-XKGWAZYB-C9c_KSl7.js} +2 -2
  161. package/dist/client/assets/{phoneViewer-B2PYzUOK.js → phoneViewer-HVXHif_1.js} +2 -2
  162. package/dist/client/assets/{pie-WAS4IAKB-CYqWZV05.js → pie-WAS4IAKB-CzmLCGka.js} +1 -1
  163. package/dist/client/assets/{pieDiagram-E7YTZNPT-DI-IJXNl.js → pieDiagram-E7YTZNPT-C-Z8w4pJ.js} +2 -2
  164. package/dist/client/assets/{pierre-icons-bBNX7pHG.js → pierre-icons-CnfzBsKG.js} +2 -2
  165. package/dist/client/assets/popover-CCsUmLYF.js +2 -0
  166. package/dist/client/assets/{preview-BVbvXV-T.js → preview-BJJOaGR2.js} +2 -2
  167. package/dist/client/assets/{preview-CBNZZm4k.js → preview-BXxrRVX-.js} +2 -2
  168. package/dist/client/assets/{previewMiniPlayerStore-C_DZeWb5.js → previewMiniPlayerStore-C7poB4-A.js} +2 -2
  169. package/dist/client/assets/primary-DBlVHyxT.js +2 -0
  170. package/dist/client/assets/primaryCloudLinkState-BfCEo8Kn.js +2 -0
  171. package/dist/client/assets/projectFilesQueryState-CgqhXdfj.js +2 -0
  172. package/dist/client/assets/projectScriptEditor-CARl6hYK.js +2 -0
  173. package/dist/client/assets/{providerSkills-JMYzRM2N.js → providerSkills-B2xzNGmJ.js} +2 -2
  174. package/dist/client/assets/{pullRequestDetail.logic-BVBxawC1.js → pullRequestDetail.logic-CYwAUOQC.js} +5 -5
  175. package/dist/client/assets/{pullRequestIcons-CuqlEFYV.js → pullRequestIcons-SCwBWGeD.js} +2 -2
  176. package/dist/client/assets/{pullRequestReviewStore-DmxuV1dp.js → pullRequestReviewStore-C7gfd5m3.js} +2 -2
  177. package/dist/client/assets/pullRequests-DQFba6Nz.js +2 -0
  178. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-Os8jPhhw.js → quadrantDiagram-AXDQQJYC-I8UtWMv_.js} +2 -2
  179. package/dist/client/assets/queries-DfOxYbXr.js +2 -0
  180. package/dist/client/assets/query-w0R7LhwJ.js +2 -0
  181. package/dist/client/assets/{radar-RG4KPBEZ-BwFp-k4W.js → radar-RG4KPBEZ-CuVsLyvG.js} +1 -1
  182. package/dist/client/assets/radio-group-DwQ0T1X6.js +2 -0
  183. package/dist/client/assets/{railroad-74A4TZTK-BhaeCUUR.js → railroad-74A4TZTK-CZZIaT2B.js} +1 -1
  184. package/dist/client/assets/railroad-abnf-HS5TGJTU-DieERyRq.js +1 -0
  185. package/dist/client/assets/railroad-ebnf-LZEXJU2U-BVbP0cR7.js +1 -0
  186. package/dist/client/assets/railroad-peg-WCYAUIDC-BDR9vaLF.js +1 -0
  187. package/dist/client/assets/{railroadDiagram-O6MQD6OU-BwEd4kBJ.js → railroadDiagram-O6MQD6OU-CogIhoTG.js} +2 -2
  188. package/dist/client/assets/{renderScheduler-C031Kal5.js → renderScheduler-wjSXDjer.js} +2 -2
  189. package/dist/client/assets/{requirementDiagram-BXWQKSXE-B3cJlOEK.js → requirementDiagram-BXWQKSXE-B9wTphzK.js} +2 -2
  190. package/dist/client/assets/{rightPanelStore-JWjHC9l1.js → rightPanelStore-CRw1DWSH.js} +2 -2
  191. package/dist/client/assets/runtime-ZOY8Qeg_.js +2 -0
  192. package/dist/client/assets/runtime-qAs3Aj0U.js +6 -0
  193. package/dist/client/assets/runtimeModeConfig-VaVDuoFW.js +2 -0
  194. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-C8CBmy9t.js → sankeyDiagram-P5KCCOFB-CeJuchFj.js} +2 -2
  195. package/dist/client/assets/{scheduledTasksSettings.logic-CJBRz5bk.js → scheduledTasksSettings.logic-BBBjz09I.js} +3 -3
  196. package/dist/client/assets/{scroll-area-D4H8QGpd.js → scroll-area-DyzCabMe.js} +2 -2
  197. package/dist/client/assets/select-BX0YSg0P.js +2 -0
  198. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-IbrowOt4.js → sequenceDiagram-WJ2MYXX4-xpNi2v3f.js} +2 -2
  199. package/dist/client/assets/server-BxsIDqAi.js +2 -0
  200. package/dist/client/assets/session-Lp4r-IPM.js +2 -0
  201. package/dist/client/assets/{session-logic-CiMoVF-V.js → session-logic-BFdJF3Bv.js} +5 -5
  202. package/dist/client/assets/{settings-mAdVdtYz.js → settings-D6fi9-XU.js} +2 -2
  203. package/dist/client/assets/settings.appearance-BBT8xGDi.js +2 -0
  204. package/dist/client/assets/settings.archived-Cg-9thGj.js +2 -0
  205. package/dist/client/assets/{settings.computer-use-IGLZXOs8.js → settings.computer-use-Bona3Wg6.js} +2 -2
  206. package/dist/client/assets/settings.connections-BqAUuYT4.js +2 -0
  207. package/dist/client/assets/{settings.data-controls-FiLy_ddv.js → settings.data-controls-OJqN88f4.js} +2 -2
  208. package/dist/client/assets/{settings.decisions-DZO8QWHd.js → settings.decisions-CZWGkeug.js} +2 -2
  209. package/dist/client/assets/settings.diagnostics-DELbs4ob.js +2 -0
  210. package/dist/client/assets/settings.general-B-fstEU-.js +2 -0
  211. package/dist/client/assets/settings.integrations-B9_Yw0oa.js +2 -0
  212. package/dist/client/assets/{settings.keybindings-BYwCM_iI.js → settings.keybindings-tFQjI19L.js} +2 -2
  213. package/dist/client/assets/{settings.open-source-licenses-CZcWXiGu.js → settings.open-source-licenses-J0KhjvdX.js} +2 -2
  214. package/dist/client/assets/{settings.plugins-P_B4taFp.js → settings.plugins-BnMZc7bA.js} +4 -4
  215. package/dist/client/assets/settings.projects-B9iYESeP.js +4 -0
  216. package/dist/client/assets/settings.providers-D_HCdEfA.js +3 -0
  217. package/dist/client/assets/settings.scheduled-tasks-DaNDwLtr.js +2 -0
  218. package/dist/client/assets/{settings.snap-shot-uj9CX5J6.js → settings.snap-shot-ClQxMhzg.js} +2 -2
  219. package/dist/client/assets/{settings.source-control-H60mYM0m.js → settings.source-control-Bs4O94Ae.js} +2 -2
  220. package/dist/client/assets/{settings.storage--Ghi4ySm.js → settings.storage-BYJ2h7qr.js} +2 -2
  221. package/dist/client/assets/settingsLayout-DhPKINaL.js +3 -0
  222. package/dist/client/assets/{sidebar-7a8hvtAS.js → sidebar-ZKIDHqbk.js} +2 -2
  223. package/dist/client/assets/{sidebarProjectGrouping-BGgp_M_h.js → sidebarProjectGrouping-BFqO8E5C.js} +2 -2
  224. package/dist/client/assets/skeleton--v3ra8uu.js +2 -0
  225. package/dist/client/assets/{sortable.esm-CG0AZByT.js → sortable.esm-UojJGtqY.js} +2 -2
  226. package/dist/client/assets/{sourceControl-B8VqenU-.js → sourceControl-ByZv2xxh.js} +2 -2
  227. package/dist/client/assets/{spinner-YUJ6Pwvq.js → spinner-CH-Dn9Fj.js} +2 -2
  228. package/dist/client/assets/{standalone-page-BxErOfZy.js → standalone-page-BwpW1F1h.js} +2 -2
  229. package/dist/client/assets/{stateDiagram-D77RDMKH-C0i1_7JQ.js → stateDiagram-D77RDMKH-BMh5LMip.js} +2 -2
  230. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CK8WckkU.js +2 -0
  231. package/dist/client/assets/{swimlanes-42K2YHIH-DlWorw-a.js → swimlanes-42K2YHIH-CGCv__e7.js} +2 -2
  232. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-D_se7el1.js +9 -0
  233. package/dist/client/assets/{terminal-links-DnuUiEnP.js → terminal-links-DX86FsHj.js} +2 -2
  234. package/dist/client/assets/{terminalSessions-B89lkZlG.js → terminalSessions-CUABDfio.js} +2 -2
  235. package/dist/client/assets/{textarea-Br1ny3dw.js → textarea-B3ib3YW-.js} +2 -2
  236. package/dist/client/assets/{themePalette-B4vIs8Bi.js → themePalette-Bl55tW1x.js} +3 -3
  237. package/dist/client/assets/threadSort-DDAHH_-8.js +2 -0
  238. package/dist/client/assets/{timeline-definition-24CTP7MA-f1puoyJY.js → timeline-definition-24CTP7MA-C_Okwnia.js} +2 -2
  239. package/dist/client/assets/toast-3I2gpMYd.js +2 -0
  240. package/dist/client/assets/{toggle-DNxTFG4o.js → toggle-Ce46mx2g.js} +2 -2
  241. package/dist/client/assets/{toggle-group-CQtXH1ph.js → toggle-group-Dt1Yldxx.js} +2 -2
  242. package/dist/client/assets/tooltip-DdUPPKq4.js +2 -0
  243. package/dist/client/assets/{treeView-Q6P3EWNA-cachkR0K.js → treeView-Q6P3EWNA-23mUAiRP.js} +1 -1
  244. package/dist/client/assets/{treemap-WGGIJYW6-5vI1Z8yq.js → treemap-WGGIJYW6-CFr3RCz-.js} +1 -1
  245. package/dist/client/assets/usage-DXTqHj0T.js +2 -0
  246. package/dist/client/assets/{usageAccess-BRuBlcgN.js → usageAccess-BX6xSC4z.js} +2 -2
  247. package/dist/client/assets/{usageFormat-B0V5dWS3.js → usageFormat-CWi_Qt3l.js} +2 -2
  248. package/dist/client/assets/{usageShortcuts-CK0JjnNA.js → usageShortcuts-CGv3_tEe.js} +2 -2
  249. package/dist/client/assets/{use-atom-command-JNR1Jqwn.js → use-atom-command-CVDCnNHi.js} +2 -2
  250. package/dist/client/assets/{useAriaLabelledBy-BNA1QLXP.js → useAriaLabelledBy-BnxRm9-q.js} +2 -2
  251. package/dist/client/assets/{useHandleNewThread-vYbjmg4i.js → useHandleNewThread-BrxevYhf.js} +2 -2
  252. package/dist/client/assets/{useLocation-D91_HRP0.js → useLocation-BdZaQ50l.js} +2 -2
  253. package/dist/client/assets/useNavigate-Cdy4Jh5i.js +2 -0
  254. package/dist/client/assets/{useNavigateBack-DnwpvjrN.js → useNavigateBack-BLZDxCI_.js} +2 -2
  255. package/dist/client/assets/{useParams-CYkWvywV.js → useParams-3tEZUuVD.js} +2 -2
  256. package/dist/client/assets/{usePermissionStatus-CuzpUXth.js → usePermissionStatus-DCcJZUJC.js} +2 -2
  257. package/dist/client/assets/usePullRequestActions-cqQ4IRFz.js +3 -0
  258. package/dist/client/assets/{useRegisterFieldControl-C127nghN.js → useRegisterFieldControl-Cs54XrA4.js} +2 -2
  259. package/dist/client/assets/{useScopedModelAvailability-BsIJUZbS.js → useScopedModelAvailability-DSe3UBFZ.js} +2 -2
  260. package/dist/client/assets/useSettings-DsvnJBf2.js +3 -0
  261. package/dist/client/assets/{useT3ConnectAuthPrompt-DlW3HUgA.js → useT3ConnectAuthPrompt-CBxfN-Bk.js} +2 -2
  262. package/dist/client/assets/utils-TSzPLNGf.js +37 -0
  263. package/dist/client/assets/vcsRefInvalidation-iz2QneVc.js +2 -0
  264. package/dist/client/assets/{vennDiagram-4TSXK5OY-HkY_FANS.js → vennDiagram-4TSXK5OY-DsePUj7P.js} +2 -2
  265. package/dist/client/assets/{wardley-WFR3VGLG-B9HKXiPi.js → wardley-WFR3VGLG-DADViFrd.js} +1 -1
  266. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-CJL7EyS8.js → wardleyDiagram-VM6X3IG4-B7tstBZh.js} +2 -2
  267. package/dist/client/assets/{welcome-BOXDf4R_.js → welcome-CQKf0B5f.js} +2 -2
  268. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-Bsll1-pV.js → xychartDiagram-S5SC5T6Z-DRAYLcYA.js} +2 -2
  269. package/dist/client/index.html +1 -1
  270. package/package.json +1 -1
  271. package/dist/AcpMcpStdioBridge-CD9BQr2l.mjs +0 -4
  272. package/dist/client/assets/ChatGptUsageButton-CFN6c9Ue.js +0 -2
  273. package/dist/client/assets/ChatMarkdown-DTSMYNs8.js +0 -65
  274. package/dist/client/assets/ComboboxClear-D8WYxa7i.js +0 -2
  275. package/dist/client/assets/CompositeRoot-CLSWLNTl.js +0 -2
  276. package/dist/client/assets/DevicePanel-BQ6aWeSD.js +0 -2
  277. package/dist/client/assets/DiffPanel-D2TxWIFd.js +0 -2
  278. package/dist/client/assets/PanelLayoutControls-Bfgdx7QX.js +0 -215
  279. package/dist/client/assets/PreviewPanel-CbotCgGz.js +0 -2
  280. package/dist/client/assets/ProjectDefaultsSettings-GpUKCz2U.js +0 -2
  281. package/dist/client/assets/ProjectFavicon-BKEw0TrD.js +0 -3
  282. package/dist/client/assets/ProviderModelPicker-CIxbqWeL.js +0 -2
  283. package/dist/client/assets/PullRequestCodeTab-qEGBl5Kn.js +0 -6
  284. package/dist/client/assets/ScheduledTasksSettings-deUjWQ39.js +0 -4
  285. package/dist/client/assets/SettingsPanels-DExy67bz.js +0 -39
  286. package/dist/client/assets/_chat-BfQTKc_9.js +0 -45
  287. package/dist/client/assets/_chat.pull-requests-Dz-eLkAP.js +0 -2
  288. package/dist/client/assets/architecture-7GRP2DOG-DTyqnvkZ.js +0 -1
  289. package/dist/client/assets/assets-B7aY-rQd.js +0 -2
  290. package/dist/client/assets/channel-BO8pVrSI.js +0 -2
  291. package/dist/client/assets/checkbox-Gd1YCUIl.js +0 -2
  292. package/dist/client/assets/classDiagram-ZZMXUADV-Scmt9e5N.js +0 -2
  293. package/dist/client/assets/classDiagram-v2-VYDZK3BY-Scmt9e5N.js +0 -2
  294. package/dist/client/assets/empty-BvJSXK20.js +0 -2
  295. package/dist/client/assets/entities-Dzl1j2jY.js +0 -2
  296. package/dist/client/assets/eventmodeling-NTZA5JFV-DrPNirV-.js +0 -1
  297. package/dist/client/assets/flowDiagram-HODETNUW-D4bD8hue.js +0 -1
  298. package/dist/client/assets/main-DJbmaTSv.js +0 -30
  299. package/dist/client/assets/main-bt-A8VDR.css +0 -2
  300. package/dist/client/assets/number-field-BuLW4JjE.js +0 -2
  301. package/dist/client/assets/popover-O8JaXWO5.js +0 -2
  302. package/dist/client/assets/primary-fvERVyIG.js +0 -2
  303. package/dist/client/assets/primaryCloudLinkState-CT9FDATw.js +0 -2
  304. package/dist/client/assets/projectFilesQueryState-D-fWLsA3.js +0 -2
  305. package/dist/client/assets/projectScriptEditor-BqddH5Lr.js +0 -2
  306. package/dist/client/assets/pullRequests-CEpTVk5m.js +0 -2
  307. package/dist/client/assets/queries-BBd2XSpN.js +0 -2
  308. package/dist/client/assets/query-fboCqXXy.js +0 -2
  309. package/dist/client/assets/radio-group-B2ziR973.js +0 -2
  310. package/dist/client/assets/railroad-abnf-HS5TGJTU-D_PV710-.js +0 -1
  311. package/dist/client/assets/railroad-ebnf-LZEXJU2U-CmXdS8HA.js +0 -1
  312. package/dist/client/assets/railroad-peg-WCYAUIDC-BpmFZ4-g.js +0 -1
  313. package/dist/client/assets/runtime-B-UcwNuZ.js +0 -2
  314. package/dist/client/assets/runtime-BVzm9sLS.js +0 -6
  315. package/dist/client/assets/runtimeModeConfig-Ce0Dnm2_.js +0 -2
  316. package/dist/client/assets/select-D0wmEFXx.js +0 -2
  317. package/dist/client/assets/server-97u7Iupv.js +0 -2
  318. package/dist/client/assets/session-CPQQ27HG.js +0 -2
  319. package/dist/client/assets/settings.appearance-SUyLnEit.js +0 -2
  320. package/dist/client/assets/settings.archived-C-clMQMK.js +0 -2
  321. package/dist/client/assets/settings.connections-DhpKQ7ay.js +0 -2
  322. package/dist/client/assets/settings.diagnostics-CG2kVUBD.js +0 -2
  323. package/dist/client/assets/settings.general-jsS1Ydzs.js +0 -2
  324. package/dist/client/assets/settings.integrations-DDlR7Et9.js +0 -2
  325. package/dist/client/assets/settings.projects-DqNHL2Mx.js +0 -4
  326. package/dist/client/assets/settings.providers-olNQXPOc.js +0 -3
  327. package/dist/client/assets/settings.scheduled-tasks-Dwr1Iiu5.js +0 -2
  328. package/dist/client/assets/settingsLayout-BdqCokK9.js +0 -3
  329. package/dist/client/assets/skeleton-7wGNlCET.js +0 -2
  330. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-nFt0QPRs.js +0 -2
  331. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Byr1T2AB.js +0 -9
  332. package/dist/client/assets/threadSort-BN7fK5qZ.js +0 -2
  333. package/dist/client/assets/toast-Bkc7xsho.js +0 -2
  334. package/dist/client/assets/tooltip-DH7_Fmka.js +0 -2
  335. package/dist/client/assets/usage-Cuwnw3mn.js +0 -2
  336. package/dist/client/assets/useNavigate-NmIi-1RV.js +0 -2
  337. package/dist/client/assets/usePullRequestActions-DqgBdoH5.js +0 -3
  338. package/dist/client/assets/useSettings-DYKTOdxY.js +0 -3
  339. package/dist/client/assets/utils-vKlT_s3D.js +0 -37
  340. package/dist/client/assets/vcsRefInvalidation-CC_2_Ufo.js +0 -2
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$g as n,$n as r,$o as i,Cb as a,Cg as o,Dg as s,Em as c,Gn as l,Go as u,HT as d,Jg as f,Kg as p,Lo as m,Nb as h,Oc as g,Od as _,Op as v,Qg as y,Qn as b,U_ as x,Ug as S,Vg as C,Vo as w,Wg as T,Wo as E,Xo as D,Yn as O,Zg as k,Zn as A,_p as j,a_ as M,ar as N,by as P,cf as ee,cr as te,dE as ne,d_ as re,dx as ie,e_ as ae,em as oe,fT as se,gT as ce,hT as le,i_ as ue,ir as de,kS as F,n_ as fe,o_ as pe,ol as me,or as he,qg as ge,r_ as _e,rd as ve,rr as ye,ry as be,s_ as xe,sr as I,t as Se,t_ as Ce,td as we,tr as Te,xp as Ee,yT as De}from"./utils-vKlT_s3D.js";import{At as Oe,C as ke,Dn as Ae,Dt as je,Et as L,Ht as Me,L as R,Ot as Ne,P as Pe,Tt as Fe,U as Ie,Vt as z,an as Le,b as B,et as V,o as Re}from"./runtime-BVzm9sLS.js";import{E as H,Et as ze,F as Be,S as U,St as Ve,Tt as He,_ as Ue,bt as We,t as W}from"./runtime-B-UcwNuZ.js";import{a as Ge,n as Ke,t as qe}from"./tooltip-DH7_Fmka.js";import{a as Je,c as Ye,o as Xe,s as Ze,t as Qe}from"./select-D0wmEFXx.js";import{t as G}from"./spinner-YUJ6Pwvq.js";import{i as K,p as $e}from"./toast-Bkc7xsho.js";import{A as et,D as tt,E as nt,O as q,b as rt,c as it,et as at,s as ot,v as J}from"./useSettings-DYKTOdxY.js";import{f as st,h as ct,s as lt}from"./server-97u7Iupv.js";import{a as ut,i as dt,n as ft,s as pt}from"./session-CPQQ27HG.js";import{n as mt}from"./query-fboCqXXy.js";import{t as ht}from"./use-atom-command-JNR1Jqwn.js";import{n as Y}from"./toastHelpers-Dsph6LwL.js";import{i as gt,r as _t}from"./timestampFormat-wac2e_Jz.js";import{t as vt}from"./checkbox-Gd1YCUIl.js";import{t as yt}from"./textarea-Br1ny3dw.js";import{_ as bt,b as xt,g as St,h as Ct,v as wt,x as Tt,y as Et}from"./command-B35zAYVN.js";import{t as Dt}from"./input-BZEAWLAC.js";import{t as Ot}from"./scroll-area-D4H8QGpd.js";import{a as kt,c as At,i as jt,l as Mt,n as Nt,o as Pt,r as Ft,s as It,t as Lt}from"./dialog-C9_Ef3sx.js";import{n as Rt}from"./T3ConnectAccountPages-uVnu-v4W.js";import{a as zt,i as Bt,o as Vt,r as Ht,t as Ut}from"./empty-BvJSXK20.js";import{t as Wt}from"./AnimatedHeight-DewGDSmN.js";import{C as Gt,_ as Kt,w as qt,y as Jt}from"./keybindings-BOV97yVS.js";import{i as Yt,o as Xt,t as Zt}from"./popover-O8JaXWO5.js";import{a as Qt,b as $t,c as en,h as tn,i as nn,l as rn,m as an,n as on,o as sn,p as cn,s as ln,t as un,u as dn}from"./sortable.esm-CG0AZByT.js";import{n as fn,t as pn}from"./EnvironmentMachineIcon-DX1wHHgS.js";import{r as mn,t as hn}from"./alert-DzxRsWWi.js";import{a as gn,i as _n,s as vn,u as yn}from"./settingsLayout-BdqCokK9.js";import{t as X}from"./ConnectionStatusDot-B0ZKI-zI.js";import{a as bn,n as xn,o as Sn,s as Cn,t as wn}from"./primary-fvERVyIG.js";import{n as Tn,t as En}from"./onboarding-JdAo8zsA.js";import{Ar as Dn,Er as On,Fr as kn,Gn as An,Ir as jn,Jn as Mn,Kn as Nn,La as Pn,Mr as Fn,Nr as In,Or as Ln,Pr as Rn,Qn as zn,T as Bn,Tr as Vn,Xn as Hn,Yn as Un,Zn as Wn,_r as Gn,an as Kn,ci as qn,gr as Jn,hr as Yn,in as Xn,ir as Zn,jr as Qn,kr as $n,mr as er,nn as tr,on as nr,qn as rr,si as ir}from"./main-DJbmaTSv.js";import{t as ar}from"./FoldedSettingsSection-DQesC0Ch.js";var Z=ne(),or=[{scope:y,title:`View environment`,description:`Read threads, status, checkpoints, and configuration.`},{scope:k,title:`Operate tasks`,description:`Start, update, and stop tasks.`},{scope:_e,title:`Change environment settings`,description:`Edit environment preferences and keybindings.`},{scope:ae,title:`Manage providers`,description:`Configure, install, sign in to, and update providers and usage sources.`},{scope:p,title:`Maintain environment`,description:`Update the server and control environment processes.`},{scope:n,title:`Control previews`,description:`Open browser previews and host browser automation.`},{scope:T,title:`View diagnostics and usage`,description:`Read process diagnostics, resource history, and usage totals.`},{scope:xe,title:`View terminals`,description:`Read existing terminal output and status.`},{scope:pe,title:`Use terminals`,description:`Create terminals and send input to running shells.`},{scope:ue,title:`Change source control`,description:`Commit, push, manage branches and repositories, and change pull requests.`},{scope:ge,title:`Read files`,description:`Browse host files, search workspaces, and inspect local changes.`},{scope:f,title:`Write files`,description:`Edit workspace files and save plans to disk.`},{scope:C,title:`View access`,description:`Inspect pairing links and authorized clients.`},{scope:S,title:`Manage access`,description:`Issue and revoke credentials for other clients.`},{scope:Ce,title:`View relay`,description:`Inspect managed relay connectivity.`},{scope:fe,title:`Manage relay`,description:`Change managed tunnel connectivity.`}],Q=e(d(),1);function sr(e){let t=(0,Z.c)(4),{environmentId:n,connected:r,routeContext:i}=e,a=i!==void 0&&i,o=ut(n),s;return t[0]!==r||t[1]!==a||t[2]!==o?(s=r&&!o.hasError&&!o.isPending&&o.data?.authenticated?(0,Q.jsxs)(`div`,{className:`space-y-3 py-3 text-xs`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:a?`These permissions apply to your active route. Other routes may have different permissions.`:`These permissions apply to this client’s current connection.`}),(0,Q.jsx)(`ul`,{className:`grid gap-x-6 gap-y-2 sm:grid-cols-2`,children:or.map(e=>{let{scope:t,title:n}=e;return(0,Q.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:re(o.data,t)?`Allowed`:`Not granted`})]},t)})})]}):(0,Q.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:`Permissions not checked. Connect to this environment to view this session’s permissions.`}),t[0]=r,t[1]=a,t[2]=o,t[3]=s):s=t[3],s}var $=e(t(),1);function cr(e,t){let n=new URL(e);return n.pathname=`/pair`,ze(n,t).toString()}function lr(e,t){return new URL(e).protocol===`https:`?U({host:e,token:t}):null}function ur(){let e=(0,Z.c)(48),t=window.desktopBridge?.setLocalEnvironmentEnabled,[n]=(0,$.useState)(dr),[r,i]=(0,$.useState)(!1),[a,o]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null);if(!t)return null;let l;e[0]===n?l=e[1]:(l=async()=>{o(!0),c(null);try{await t(!n)}catch(e){let t=e;c(t instanceof Error?t.message:`Couldn't change this setting.`),o(!1)}},e[0]=n,e[1]=l);let u=l,d;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=Zn(`local-environment`),e[2]=d):d=e[2];let f=n?`Run agents on this computer. Turn off to use P4 Code only with remote environments.`:`Turned off. Agents only run in remote environments.`,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>i(!0),e[3]=p):p=e[3];let m;e[4]!==n||e[5]!==a?(m=(0,Q.jsx)(Pn,{checked:n,disabled:a,onCheckedChange:p,"aria-label":`Local environment`}),e[4]=n,e[5]=a,e[6]=m):m=e[6];let h;e[7]!==f||e[8]!==m?(h=(0,Q.jsx)(gn,{...d,description:f,control:m}),e[7]=f,e[8]=m,e[9]=h):h=e[9];let g;e[10]===a?g=e[11]:(g=e=>{a||(i(e),e||c(null))},e[10]=a,e[11]=g);let _=n?`Turn off local environment?`:`Turn on local environment?`,v;e[12]===_?v=e[13]:(v=(0,Q.jsx)(jn,{children:_}),e[12]=_,e[13]=v);let y=n?`P4 Code will restart without running a server on this computer. Any agents and terminals running here will stop, and other devices will no longer be able to connect to this computer. Your projects, history, and remote environments are unaffected.`:`P4 Code will restart and start running a server on this computer again.`,b;e[14]===y?b=e[15]:(b=(0,Q.jsx)(Fn,{children:y}),e[14]=y,e[15]=b);let x;e[16]!==b||e[17]!==v?(x=(0,Q.jsxs)(Rn,{children:[v,b]}),e[16]=b,e[17]=v,e[18]=x):x=e[18];let S;e[19]===s?S=e[20]:(S=s?(0,Q.jsx)(`p`,{className:`px-6 pb-4 text-sm text-destructive`,children:s}):null,e[19]=s,e[20]=S);let C;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(I,{variant:`outline`}),e[21]=C):C=e[21];let w;e[22]===a?w=e[23]:(w=(0,Q.jsx)(Qn,{disabled:a,render:C,children:`Cancel`}),e[22]=a,e[23]=w);let T=n?`destructive`:`default`,E;e[24]===u?E=e[25]:(E=()=>void u(),e[24]=u,e[25]=E);let D;e[26]!==n||e[27]!==a?(D=a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Restarting…`]}):n?`Restart and turn off`:`Restart and turn on`,e[26]=n,e[27]=a,e[28]=D):D=e[28];let O;e[29]!==a||e[30]!==T||e[31]!==E||e[32]!==D?(O=(0,Q.jsx)(I,{variant:T,disabled:a,onClick:E,children:D}),e[29]=a,e[30]=T,e[31]=E,e[32]=D,e[33]=O):O=e[33];let k;e[34]!==w||e[35]!==O?(k=(0,Q.jsxs)(In,{children:[w,O]}),e[34]=w,e[35]=O,e[36]=k):k=e[36];let A;e[37]!==x||e[38]!==S||e[39]!==k?(A=(0,Q.jsxs)(kn,{children:[x,S,k]}),e[37]=x,e[38]=S,e[39]=k,e[40]=A):A=e[40];let j;e[41]!==r||e[42]!==A||e[43]!==g?(j=(0,Q.jsx)(Dn,{open:r,onOpenChange:g,children:A}),e[41]=r,e[42]=A,e[43]=g,e[44]=j):j=e[44];let M;return e[45]!==j||e[46]!==h?(M=(0,Q.jsxs)(Q.Fragment,{children:[h,j]}),e[45]=j,e[46]=h,e[47]=M):M=e[47],M}function dr(){return!ke()}function fr(e){return e.serverConfig===null?`Connect to this environment to change its icon.`:e.serverConfig.environment.capabilities.environmentIcon===!0?e.operateAccess===`granted`?null:`Your session on this environment cannot change its settings.`:`This environment's server is too old to keep an icon. Update it to choose one.`}function pr(e){let t=(0,Z.c)(27),{environmentId:n,serverConfig:i}=e,a=rt(n),c=dt(n,`settings:write`)?`granted`:`denied`,l;t[0]!==c||t[1]!==i?(l=fr({serverConfig:i,operateAccess:c}),t[0]=c,t[1]=i,t[2]=l):l=t[2];let u=l,d=i?.environment.platform.machine??`server`,f;t[3]===i?f=t[4]:(f=me(i),t[3]=i,t[4]=f);let p=f,m;t[5]===p?m=t[6]:(m=(0,Q.jsxs)(N,{children:[(0,Q.jsx)(fn,{kind:p}),`Icon`]}),t[5]=p,t[6]=m);let h;t[7]===u?h=t[8]:(h=u===null?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(O,{disabled:!0,className:`whitespace-normal`,children:u}),(0,Q.jsx)(Te,{})]}),t[7]=u,t[8]=h);let g;t[9]!==d||t[10]!==u||t[11]!==a?(g=e=>{u===null&&s(e)&&a({environmentIcon:e===d?null:e})},t[9]=d,t[10]=u,t[11]=a,t[12]=g):g=t[12];let _;t[13]!==d||t[14]!==u||t[15]!==i?.environment?(_=o.map(e=>(0,Q.jsx)(r,{value:e,disabled:u!==null,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(fn,{kind:e,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:pn[e]}),e===d?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:i?.environment.platform.machine?`detected`:`default`}):null]})},e)),t[13]=d,t[14]=u,t[15]=i?.environment,t[16]=_):_=t[16];let v;t[17]!==p||t[18]!==g||t[19]!==_?(v=(0,Q.jsx)(b,{value:p,onValueChange:g,children:_}),t[17]=p,t[18]=g,t[19]=_,t[20]=v):v=t[20];let y;t[21]!==h||t[22]!==v?(y=(0,Q.jsxs)(de,{children:[h,v]}),t[21]=h,t[22]=v,t[23]=y):y=t[23];let x;return t[24]!==m||t[25]!==y?(x=(0,Q.jsxs)(ye,{children:[m,y]}),t[24]=m,t[25]=y,t[26]=x):x=t[26],x}function mr(e){let t=(0,Z.c)(31),{environment:n,onAddRoute:r}=e,i=Ne(n.entry),a=i.map(gr),[o,s]=(0,$.useState)(null),c=o!==null&&o.length===a.length&&o.some((e,t)=>e!==a[t])?[...o]:a,l=new Map(i.map(hr)),u=c.flatMap(e=>l.get(e)??[]),d=pt(n.environmentId),f;t[0]!==n.connection||t[1]!==d._tag||t[2]!==d.value?(f=d._tag===`Some`&&n.connection.phase===`connected`?L(d.value.target):null,t[0]=n.connection,t[1]=d._tag,t[2]=d.value,t[3]=f):f=t[3];let p=f,m=ht(ct.reorderRoutes,`Reorder routes`),h=ht(ct.removeRoute,`Remove route`),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g={activationConstraint:{distance:4}},t[4]=g):g=t[4];let _;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_={coordinateGetter:nn},t[5]=_):_=t[5];let v=an(cn(rn,g),cn(en,_)),y;t[6]!==n.environmentId||t[7]!==h?(y=async e=>{let t=Fe(e);await at(`Remove ${je(e)} route?${t===null?``:`\n${t}`}`,{variant:`destructive`})===!0&&await h({environmentId:n.environmentId,routeId:L(e.target)})},t[6]=n.environmentId,t[7]=h,t[8]=y):y=t[8];let b=y,x=e=>{if(e.over===null||e.active.id===e.over.id)return;let t=on(c,c.indexOf(String(e.active.id)),c.indexOf(String(e.over.id)));s(t),m({environmentId:n.environmentId,routeIds:t}).then(e=>{e._tag===`Failure`&&s(null)})},S=ln,C=dn,w;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=[qn,ir],t[9]=w):w=t[9];let T=un,E=sn,D=`Routes to ${n.label}, preferred first`,O=u.map((e,t)=>(0,Q.jsx)(_r,{route:e,position:t+1,inUse:L(e.target)===p,removable:u.length>1&&!Oe(e),onRemove:()=>void b(e)},L(e.target))),k;t[10]!==O||t[11]!==D?(k=(0,Q.jsx)(`ol`,{"aria-label":D,children:O}),t[10]=O,t[11]=D,t[12]=k):k=t[12];let A;t[13]!==T||t[14]!==c||t[15]!==k||t[16]!==E?(A=(0,Q.jsx)(T,{items:c,strategy:E,children:k}),t[13]=T,t[14]=c,t[15]=k,t[16]=E,t[17]=A):A=t[17];let M;t[18]!==S||t[19]!==x||t[20]!==v||t[21]!==A||t[22]!==C||t[23]!==w?(M=(0,Q.jsx)(S,{sensors:v,collisionDetection:C,modifiers:w,onDragEnd:x,children:A}),t[18]=S,t[19]=x,t[20]=v,t[21]=A,t[22]=C,t[23]=w,t[24]=M):M=t[24];let N;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(j,{className:`size-3`}),t[25]=N):N=t[25];let P;t[26]===r?P=t[27]:(P=(0,Q.jsx)(`div`,{className:`-ml-1.5 pt-1`,children:(0,Q.jsxs)(I,{size:`xs`,variant:`ghost-muted`,onClick:r,children:[N,`Add route`]})}),t[26]=r,t[27]=P);let ee;return t[28]!==M||t[29]!==P?(ee=(0,Q.jsxs)(`div`,{className:`mt-2 border-t border-border/50 py-2`,children:[M,P]}),t[28]=M,t[29]=P,t[30]=ee):ee=t[30],ee}function hr(e){return[L(e.target),e]}function gr(e){return L(e.target)}function _r(e){let t=(0,Z.c)(43),{route:n,position:r,inUse:i,removable:a,onRemove:o}=e,s;t[0]===n.target?s=t[1]:(s=L(n.target),t[0]=n.target,t[1]=s);let l=s,u;t[2]===n?u=t[3]:(u=je(n),t[2]=n,t[3]=u);let d=u,f;t[4]===n?f=t[5]:(f=Fe(n),t[4]=n,t[5]=f);let p=f,m;t[6]===l?m=t[7]:(m={id:l},t[6]=l,t[7]=m);let{attributes:h,listeners:g,setNodeRef:_,setActivatorNodeRef:v,transform:y,transition:b,isDragging:x}=Qt(m),S;t[8]===y?S=t[9]:(S=tn.Translate.toString(y),t[8]=y,t[9]=S);let C;t[10]!==S||t[11]!==b?(C={transform:S,transition:b},t[10]=S,t[11]=b,t[12]=C):C=t[12];let w=x&&`relative z-10 rounded-md bg-background shadow-md`,T;t[13]===w?T=t[14]:(T=Se(`flex items-center gap-2 py-2`,w),t[13]=w,t[14]=T);let E;t[15]===i?E=t[16]:(E=i?(0,Q.jsx)(`span`,{className:`rounded-sm bg-success/12 px-1 text-2xs font-normal text-success-foreground`,children:`In use`}):null,t[15]=i,t[16]=E);let D;t[17]!==d||t[18]!==E?(D=(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[d,E]}),t[17]=d,t[18]=E,t[19]=D):D=t[19];let O;t[20]!==p||t[21]!==n?(O=p===null?null:(0,Q.jsxs)(`p`,{className:`truncate text-2xs text-muted-foreground`,children:[p,Oe(n)?` · found automatically`:``]}),t[20]=p,t[21]=n,t[22]=O):O=t[22];let k;t[23]!==D||t[24]!==O?(k=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[D,O]}),t[23]=D,t[24]=O,t[25]=k):k=t[25];let A=`Reorder ${d}, position ${r}`,j;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(ee,{className:`size-3.5`}),t[26]=j):j=t[26];let M;t[27]!==h||t[28]!==g||t[29]!==v||t[30]!==A?(M=(0,Q.jsx)(`button`,{type:`button`,ref:v,...h,...g,"aria-label":A,className:`flex size-6 shrink-0 cursor-grab touch-none items-center justify-center rounded text-muted-foreground/70 outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring active:cursor-grabbing`,children:j}),t[27]=h,t[28]=g,t[29]=v,t[30]=A,t[31]=M):M=t[31];let N;t[32]!==d||t[33]!==o||t[34]!==a?(N=a?(0,Q.jsxs)(qe,{children:[(0,Q.jsx)(Ge,{render:(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Remove ${d} route`,onClick:o}),children:(0,Q.jsx)(c,{className:`size-3`})}),(0,Q.jsx)(Ke,{side:`top`,children:`Remove route`})]}):null,t[32]=d,t[33]=o,t[34]=a,t[35]=N):N=t[35];let P;return t[36]!==_||t[37]!==k||t[38]!==M||t[39]!==N||t[40]!==C||t[41]!==T?(P=(0,Q.jsxs)(`li`,{ref:_,style:C,className:T,children:[k,M,N]}),t[36]=_,t[37]=k,t[38]=M,t[39]=N,t[40]=C,t[41]=T,t[42]=P):P=t[42],P}function vr(e){let t=e.username?`${e.username}@${e.hostname}`:e.hostname;return e.port?`${t}:${e.port}`:t}function yr(e,t=null){let{entry:n}=e;if(n.target._tag===`PrimaryConnectionTarget`)return`This machine`;let r=Ne(n);if(r.length>1){let e=t===null?void 0:r.find(e=>L(e.target)===L(t));return e===void 0?je(r[0]):`via ${je(e)}`}return e.relayManaged?`P4 Connect`:Ue(n.target)?`WSL`:n.target._tag===`SshConnectionTarget`&&ce(n.profile)&&n.profile.value._tag===`SshConnectionProfile`?`SSH ${vr(n.profile.value.target)}`:e.displayUrl??`Remote link`}function br(e){let t=(0,Z.c)(23),{kind:n,label:r,subtitle:i,below:a,detail:o,dimmed:s,className:c,children:l}=e,u=s!==void 0&&s&&`opacity-60`,d;t[0]!==c||t[1]!==u?(d=Se(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 px-3 py-2.5 sm:px-4`,u,c),t[0]=c,t[1]=u,t[2]=d):d=t[2];let f;t[3]===n?f=t[4]:(f=(0,Q.jsx)(fn,{"aria-hidden":!0,kind:n,className:`size-4 text-muted-foreground`}),t[3]=n,t[4]=f);let p;t[5]===r?p=t[6]:(p=(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,children:r}),t[5]=r,t[6]=p);let m;t[7]===i?m=t[8]:(m=(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==a||t[10]!==p||t[11]!==m?(h=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[p,m,a]}),t[9]=a,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]===l?g=t[14]:(g=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:l}),t[13]=l,t[14]=g);let _;t[15]===o?_=t[16]:(_=o?(0,Q.jsx)(`div`,{className:`col-span-2 col-start-2 min-w-0`,children:o}):null,t[15]=o,t[16]=_);let v;return t[17]!==d||t[18]!==f||t[19]!==h||t[20]!==g||t[21]!==_?(v=(0,Q.jsxs)(`div`,{className:d,children:[f,h,g,_]}),t[17]=d,t[18]=f,t[19]=h,t[20]=g,t[21]=_,t[22]=v):v=t[22],v}var xr=[{value:100,label:`Prefer`},{value:50,label:`Normal`},{value:25,label:`Less often`},{value:0,label:`Manual only`}];function Sr(e){return e===void 0||e===50?50:e===0?0:e<50?25:100}function Cr(e){return xr.find(t=>t.value===e).label}function wr(e,t){let n=e.flatMap(e=>{let n=Sr(t[e.environmentId]);return n===50?[]:[`${e.label} ${Cr(n).toLowerCase()}`]});return n.length===0?null:n.join(` · `)}function Tr(e){let t=(0,Z.c)(27),{environments:n}=e,r=ot(),i=it(),a=J();if(n.length<2)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=Zn(`load-balancing`),t[0]=o):o=t[0];let{id:s,title:c}=o,l;t[1]!==n||t[2]!==r.loadBalancingEnabled||t[3]!==r.loadBalancingWeights?(l=r.loadBalancingEnabled?wr(n,r.loadBalancingWeights):`Off`,t[1]=n,t[2]=r.loadBalancingEnabled,t[3]=r.loadBalancingWeights,t[4]=l):l=t[4];let u=!i,d;t[5]===a?d=t[6]:(d=e=>a({loadBalancingEnabled:e}),t[5]=a,t[6]=d);let f;t[7]!==r.loadBalancingEnabled||t[8]!==u||t[9]!==d?(f=(0,Q.jsx)(Pn,{"aria-label":`Automatically balance load`,checked:r.loadBalancingEnabled,disabled:u,onCheckedChange:d}),t[7]=r.loadBalancingEnabled,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`New threads in shared projects start on the machine with the most free CPU and memory, weighted by each machine's preference.`}),t[11]=p):p=t[11];let m;if(t[12]!==n||t[13]!==r.loadBalancingEnabled||t[14]!==r.loadBalancingWeights||t[15]!==i||t[16]!==a){let e;t[18]!==r.loadBalancingEnabled||t[19]!==r.loadBalancingWeights||t[20]!==i||t[21]!==a?(e=e=>(0,Q.jsx)(br,{kind:me(e.serverConfig),label:e.label,subtitle:yr(e),children:(0,Q.jsxs)(Qe,{items:xr,value:Sr(r.loadBalancingWeights[e.environmentId]),disabled:!i||!r.loadBalancingEnabled,onValueChange:t=>{t!==null&&a({loadBalancingWeights:{...r.loadBalancingWeights,[e.environmentId]:t}})},children:[(0,Q.jsx)(Ze,{size:`xs`,className:`w-32`,"aria-label":`${e.label} load preference`,children:(0,Q.jsx)(Ye,{})}),(0,Q.jsx)(Xe,{align:`end`,alignItemWithTrigger:!1,children:xr.map(Er)})]})},e.environmentId),t[18]=r.loadBalancingEnabled,t[19]=r.loadBalancingWeights,t[20]=i,t[21]=a,t[22]=e):e=t[22],m=n.map(e),t[12]=n,t[13]=r.loadBalancingEnabled,t[14]=r.loadBalancingWeights,t[15]=i,t[16]=a,t[17]=m}else m=t[17];let h;return t[23]!==l||t[24]!==f||t[25]!==m?(h=(0,Q.jsxs)(ar,{id:s,title:c,summary:l,control:f,children:[p,m]}),t[23]=l,t[24]=f,t[25]=m,t[26]=h):h=t[26],h}function Er(e){let{value:t,label:n}=e;return(0,Q.jsx)(Je,{value:t,children:n},t)}var Dr=[{value:`off`,label:`Off`},{value:`read`,label:`Read PRs`},{value:`read-write`,label:`Read and act`}],Or={"read-write":`read and act`,read:`read PRs`};function kr(e){let t=[`read-write`,`read`].flatMap(t=>{let n=e.filter(e=>e.permission===t);return n.length===0?[]:[`${n.map(e=>e.label).join(`, `)} ${Or[t]}`]});return t.length===0?null:t.join(` · `)}function Ar(e){let t=(0,Z.c)(19),{environments:n}=e,r=w(ct.githubRoutingPermissionsValueAtom),i=w(ct.catalogValueAtom),a=ht(ct.setGitHubRoutingPermission),[o,s]=(0,$.useState)(!1);if(n.length<2)return null;let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=Zn(`github-routing`),t[0]=c):c=t[0];let{id:l,title:u}=c,d;t[1]!==n||t[2]!==r?(d=kr(n.map(e=>({label:e.label,permission:Me(e.entry,r)})))??`Off`,t[1]=n,t[2]=r,t[3]=d):d=t[3];let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`Machines you trust here can read PR data through each other's GitHub access. Enable both machines. Read and act may use broader permissions than the machine that owns them. This applies only to this device.`}),t[4]=f):f=t[4];let p;if(t[5]!==i||t[6]!==n||t[7]!==r||t[8]!==o||t[9]!==a){let e;t[11]!==i||t[12]!==r||t[13]!==o||t[14]!==a?(e=e=>(0,Q.jsx)(br,{kind:me(e.serverConfig),label:e.label,subtitle:yr(e),children:(0,Q.jsxs)(Qe,{items:Dr,value:Me(e.entry,r),disabled:!i.isReady||o||z(e.entry)===null,onValueChange:t=>{t!==null&&(s(!0),a({environmentId:e.environmentId,permission:t}).then(e=>{s(!1),e._tag===`Failure`&&K.add({type:`error`,title:`Could not save GitHub routing permission`})}))},children:[(0,Q.jsx)(Ze,{size:`xs`,className:`w-32`,"aria-label":`${e.label} GitHub routing`,children:(0,Q.jsx)(Ye,{})}),(0,Q.jsx)(Xe,{align:`end`,alignItemWithTrigger:!1,children:Dr.map(jr)})]})},e.environmentId),t[11]=i,t[12]=r,t[13]=o,t[14]=a,t[15]=e):e=t[15],p=n.map(e),t[5]=i,t[6]=n,t[7]=r,t[8]=o,t[9]=a,t[10]=p}else p=t[10];let m;return t[16]!==d||t[17]!==p?(m=(0,Q.jsxs)(ar,{id:l,title:u,summary:d,children:[f,p]}),t[16]=d,t[17]=p,t[18]=m):m=t[18],m}function jr(e){let{value:t,label:n}=e;return(0,Q.jsx)(Je,{value:t,children:n},t)}function Mr(e){let t=(0,Z.c)(26),{environmentLabel:n,onCancel:r,onConfirm:i}=e,a=Rt(),[o,s]=(0,$.useState)(n);n!==null&&n!==o&&s(n);let c=a.open,l=n!==null,u;t[0]===r?u=t[1]:(u=e=>{e||r()},t[0]=r,t[1]=u);let d;t[2]===o?d=t[3]:(d=(0,Q.jsxs)(jn,{children:[`Remove `,o,` from this device?`]}),t[2]=o,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(Fn,{children:`This forgets its pairing, credentials, and cached threads here.`}),t[4]=f):f=t[4];let p;t[5]!==r||t[6]!==c?(p=c?(0,Q.jsx)(te,{onClick:()=>{r(),c()},children:`P4 Connect settings`}):`P4 Connect settings`,t[5]=r,t[6]=c,t[7]=p):p=t[7];let m;t[8]===p?m=t[9]:(m=(0,Q.jsxs)(Fn,{children:[`It stays on your P4 Connect account and keeps its host space. Deregister it in`,` `,p,` `,`to free it.`]}),t[8]=p,t[9]=m);let h;t[10]!==d||t[11]!==m?(h=(0,Q.jsxs)(Rn,{children:[d,f,m]}),t[10]=d,t[11]=m,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(Qn,{render:(0,Q.jsx)(I,{variant:`outline`}),children:`Cancel`}),t[13]=g):g=t[13];let _;t[14]===i?_=t[15]:(_=(0,Q.jsxs)(In,{children:[g,(0,Q.jsx)(I,{variant:`destructive`,onClick:i,children:`Remove from this device`})]}),t[14]=i,t[15]=_);let v;t[16]!==h||t[17]!==_?(v=(0,Q.jsxs)(kn,{children:[h,_]}),t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==l||t[20]!==v||t[21]!==u?(y=(0,Q.jsx)(Dn,{open:l,onOpenChange:u,children:v}),t[19]=l,t[20]=v,t[21]=u,t[22]=y):y=t[22];let b;return t[23]!==a.portals||t[24]!==y?(b=(0,Q.jsxs)(Q.Fragment,{children:[y,a.portals]}),t[23]=a.portals,t[24]=y,t[25]=b):b=t[25],b}var Nr={pairingLinks:[],clientSessions:[]};function Pr(e,t,n){let r=n(t);return[...e.filter(e=>n(e)!==r),t]}function Fr(e,t){switch(t.type){case`snapshot`:return t.payload;case`pairingLinkUpserted`:return{...e,pairingLinks:Pr(e.pairingLinks,t.payload,e=>e.id)};case`pairingLinkRemoved`:return{...e,pairingLinks:e.pairingLinks.filter(e=>e.id!==t.payload.id)};case`clientUpserted`:return{...e,clientSessions:Pr(e.clientSessions,t.payload,e=>e.sessionId)};case`clientRemoved`:return{...e,clientSessions:e.clientSessions.filter(e=>e.sessionId!==t.payload.sessionId)}}}function Ir(e,t){let n=Fr(e,t);return[n,[{version:1,revision:t.revision,type:`snapshot`,payload:n}]]}function Lr(e){return{accessChanges:Pe(e,{label:`environment-data:server:auth-access-changes`,subscribe:e=>V(g.subscribeAuthAccess,{}).pipe(x(()=>Nr,Ir))})}}var Rr=Lr(W),zr=3e4,Br=class extends P()(`DesktopNetworkAccessUnavailableError`,{}){get message(){return`Desktop network access is unavailable.`}},Vr=class extends P()(`DesktopServerExposureStateLoadError`,{cause:be()}){get message(){return`Failed to load desktop server exposure state.`}},Hr=class extends P()(`DesktopAdvertisedEndpointsLoadError`,{cause:be()}){get message(){return`Failed to load advertised desktop endpoints.`}};function Ur(){return typeof window>`u`?void 0:window.desktopBridge}function Wr(e){let t=ie(`loadDesktopNetworkAccess`)(function*(){let t=e();if(!t)return yield*new Br;let[n,r]=yield*h([F({try:()=>t.getServerExposureState(),catch:e=>new Vr({cause:e})}),F({try:()=>t.getAdvertisedEndpoints(),catch:e=>new Hr({cause:e})})],{concurrency:`unbounded`});return{advertisedEndpoints:r,serverExposureState:n}});return u(t()).pipe(D({staleTime:zr,revalidateOnMount:!0}),E,i(`desktop:network-access`))}var Gr=Wr(Ur);function Kr(){m.refresh(Gr)}function qr(e,t){let n=t.trim().toLowerCase();if(n.length===0)return e;let r=[],i=[];for(let t of e){let e=t.alias.toLowerCase();e.startsWith(n)?r.push(t):e.includes(n)&&i.push(t)}return[...r,...i]}var Jr=class extends P()(`DesktopSshDiscoveryUnavailableError`,{}){get message(){return`Desktop SSH host discovery is unavailable.`}},Yr=class extends P()(`DesktopSshDiscoveryError`,{cause:be()}){get message(){return`Failed to discover SSH hosts.`}};function Xr(){return typeof window>`u`?void 0:window.desktopBridge}function Zr(e){let t=ie(`discoverDesktopSshHosts`)(function*(){let t=e();return t?yield*F({try:()=>t.discoverSshHosts(),catch:e=>new Yr({cause:e})}):yield*new Jr});return u(t()).pipe(D({staleTime:3e4,revalidateOnMount:!0}),E,i(`desktop:ssh-hosts`))}var Qr=Zr(Xr),$r=443,ei=[],ti=[],ni=`backend:default-wsl`,ri=`backend:wsl-off`,ii=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function ai(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:ii.format(t)}function oi(e){let t=(0,Z.c)(13),{scopes:n,label:r}=e,i=`${n.length} ${n.length===1?`scope`:`scopes`}`,a=`${r}: show ${i}`,o;t[0]===a?o=t[1]:(o=(0,Q.jsx)(`button`,{type:`button`,"aria-label":a,className:`cursor-help underline decoration-border underline-offset-2 outline-hidden hover:text-foreground focus-visible:text-foreground`}),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,Q.jsx)(Xt,{openOnHover:!0,delay:250,closeDelay:100,render:o,children:i}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`mb-1 font-medium`,children:`Granted scopes`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=n.map(si),t[6]=n,t[7]=l);let u;t[8]===l?u=t[9]:(u=(0,Q.jsxs)(Yt,{side:`top`,align:`start`,tooltipStyle:!0,className:`w-max max-w-80 whitespace-normal`,children:[c,(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l})]}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Zt,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function si(e){return(0,Q.jsx)(`code`,{className:`font-mono text-foreground/85`,children:e},e)}function ci(e){let t=e.host.trim();if(t.length===0)throw Error(`SSH host or alias is required.`);let n=t,r=e.username.trim()||null,i=null,a=n.lastIndexOf(`@`);if(a>0){let e=n.slice(0,a).trim();n=n.slice(a+1).trim(),!r&&e.length>0&&(r=e)}let o=/^\[([^\]]+)\](?::(\d+))?$/u.exec(n);if(o)n=o[1].trim(),o[2]&&(i=Number.parseInt(o[2],10));else{let e=n.split(`:`);e.length===2&&/^\d+$/u.test(e[1]??``)&&(n=e[0].trim(),i=Number.parseInt(e[1],10))}let s=e.port.trim();if(s.length>0&&(i=Number.parseInt(s,10)),n.length===0)throw Error(`SSH host or alias is required.`);if(i!==null&&(!Number.isInteger(i)||i<=0||i>65535))throw Error(`SSH port must be between 1 and 65535.`);return{alias:n,hostname:n,username:r,port:i}}function li(e){let t=e.trim();if(!t)return null;try{let e=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//u.test(t)||t.startsWith(`//`)?t:`https://${t}`,n=new URL(e,window.location.origin),r=H(n);if(r)return{host:r.host,pairingCode:r.token};let i=He(n);return i?{host:n.origin,pairingCode:i}:null}catch{return null}}function ui(e){let t=li(e.host);if(t)return t;let n=e.host.trim(),r=e.pairingCode.trim();if(!n)throw Error(`Enter a backend host.`);if(!r)throw Error(`Enter a pairing code.`);return{host:n,pairingCode:r}}function di(e){let t=`Failed to connect SSH host.`;return(e instanceof Error?e.message:t).replace(/^Error invoking remote method 'desktop:ensure-ssh-environment':\s*/u,``).replace(/^Ssh[A-Za-z]+Error:\s*/u,``).trim()||t}var fi=`first:rounded-t-xl last:rounded-b-xl px-3 py-2.5 sm:px-4`;function pi(e){return Xn}function mi(e,t){return e===`endpoint-rail`?Se(`relative first:rounded-t-xl last:rounded-b-xl px-3 py-3 sm:px-4`,!t&&`bg-muted/15`):Se(fi,!t&&`bg-muted/24`)}function hi(e){return[...e].toSorted((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())}function gi(e,t){return[`${e.length} ${e.length===1?`client`:`clients`}`,t.length>0?`${t.length} ${t.length===1?`pairing link`:`pairing links`}`:null].filter(e=>e!==null).join(` · `)}function _i(e){return[...e].toSorted((e,t)=>e.current===t.current?e.connected===t.connected?new Date(t.issuedAt).getTime()-new Date(e.issuedAt).getTime():e.connected?-1:1:e.current?-1:1)}function vi(e){return{...e,scopes:e.permissions??e.scopes,createdAt:a(e.createdAt),expiresAt:a(e.expiresAt)}}function yi(e){return{...e,scopes:e.permissions??e.scopes,issuedAt:a(e.issuedAt),expiresAt:a(e.expiresAt),lastConnectedAt:e.lastConnectedAt===null?null:a(e.lastConnectedAt)}}function bi(e,t){let n=e.filter(e=>e.status!==`unavailable`);if(t){let e=n.find(e=>Si(e)===t);if(e)return e}return n.find(e=>e.isDefault)??n.find(e=>e.reachability!==`loopback`)??n.find(e=>e.compatibility.hostedHttpsApp===`compatible`)??null}function xi(e){return e.id.startsWith(`tailscale-magicdns:`)}function Si(e){if(e.id.startsWith(`desktop-loopback:`))return`desktop-core:loopback:http`;if(e.id.startsWith(`desktop-lan:`))return`desktop-core:lan:http`;if(e.id.startsWith(`tailscale-ip:`))return`tailscale:ip:http`;if(xi(e))return`tailscale:magicdns:https`;let t=`unknown`;try{t=new URL(e.httpBaseUrl).protocol.replace(/:$/u,``)}catch{}return`${e.provider.id}:${e.reachability}:${t}:${e.label}`}function Ci(e,t){return e.compatibility.hostedHttpsApp===`compatible`?lr(e.httpBaseUrl,t)??cr(e.httpBaseUrl,t):cr(e.httpBaseUrl,t)}function wi(e){let t=new URL(`/pair`,window.location.href);return ze(t,e).toString()}function Ti(e){try{let t=new URL(e);return t.pathname===`/pair`&&t.searchParams.has(`host`)}catch{return!1}}function Ei(e,t){if(Ti(t))return`Opens the hosted app, no install needed`;switch(e.reachability){case`lan`:return`Devices on the same network`;case`private-network`:return`Devices on your private network`;case`public`:return`Reachable from anywhere`;case`loopback`:return`Clients on this machine`}}var Di=(0,$.memo)(function(e){let t=(0,Z.c)(131),{pairingLink:n,credential:r,endpointUrl:i,endpoints:a,defaultEndpointKey:o,presentation:s,revokingPairingLinkId:c,onRevoke:l,canRevoke:u}=e,d=s===void 0?`current`:s,f=yn(1e3),p=new Date(n.expiresAt).getTime(),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(!1),[v,y]=(0,$.useState)(null),b=(0,$.useId)(),x;t[0]===r?x=t[1]:(x=r?wi(r):null,t[0]=r,t[1]=x);let S=x,C;t[2]!==r||t[3]!==i?(C=r&&i!=null&&i!==``?lr(i,r):null,t[2]=r,t[3]=i,t[4]=C):C=t[4];let w=C,T;if(t[5]!==r||t[6]!==o||t[7]!==a){let e=bi(a,o);T=e&&r?Ci(e,r):null,t[5]=r,t[6]=o,t[7]=a,t[8]=T}else T=t[8];let E=T,D;if(t[9]!==r||t[10]!==a){bb0:{let e=[];if(!r){D=e;break bb0}for(let t of a){if(t.status===`unavailable`)continue;let n=Ci(t,r);e.push({id:t.id,preferenceKey:Si(t),label:t.label,url:n,detail:Ei(t,n),qrShareable:rr(t)})}D=e}t[9]=r,t[10]=a,t[11]=D}else D=t[11];let O=D,k;t[12]!==r||t[13]!==S||t[14]!==E||t[15]!==i||t[16]!==w?(k=E??(r&&i!=null&&i!==``?w??cr(i,r):B(window.location.hostname)?null:S),t[12]=r,t[13]=S,t[14]=E,t[15]=i,t[16]=w,t[17]=k):k=t[17];let A=k,[j,M]=(0,$.useState)(null),N=j??A??r??``,P=N!==r,ee=P&&Ti(N),te=O.find(e=>e.url===N)?.qrShareable??!0,ne=typeof window<`u`&&window.isSecureContext&&navigator.clipboard?.writeText!=null,re;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(re={onCopy:Yi,onError:(e,t)=>{let{value:n,kind:r}=t;M(n),h(!0),K.add(Y({type:`error`,title:ne?r===`hosted-link`?`Could not copy hosted app link`:r===`link`?`Could not copy pairing URL`:`Could not copy pairing code`:`Clipboard copy unavailable`,description:ne?e.message:`Showing the full value instead.`}))}},t[18]=re):re=t[18];let{copyToClipboard:ie}=$e(re),ae;t[19]===ie?ae=t[20]:(ae=(e,t)=>{ie(e,{value:e,kind:t})},t[19]=ie,t[20]=ae);let oe=ae,se=Xi,ce;t[21]!==oe||t[22]!==r?(ce=()=>{r&&oe(r,`code`)},t[21]=oe,t[22]=r,t[23]=ce):ce=t[23];let le=ce,ue;t[24]===n.expiresAt?ue=t[25]:(ue=ai(n.expiresAt),t[24]=n.expiresAt,t[25]=ue);let de=ue,F=n.label??`Pairing link`,fe;t[26]!==o||t[27]!==O||t[28]!==v?(fe=Un(O,v,o),t[26]=o,t[27]=O,t[28]=v,t[29]=fe):fe=t[29];let pe=fe,me=pe?.url??A,he=pe?.qrShareable??!0;if(p<=f)return null;let ge;t[30]===d?ge=t[31]:(ge=pi(d),t[30]=d,t[31]=ge);let _e;t[32]===n.createdAt?_e=t[33]:(_e=ai(n.createdAt),t[32]=n.createdAt,t[33]=_e);let ve=`Link created at ${_e}`,ye;t[34]===ve?ye=t[35]:(ye=(0,Q.jsx)(X,{tooltipText:ve,dotClassName:`bg-warning`}),t[34]=ve,t[35]=ye);let be;t[36]===F?be=t[37]:(be=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:F}),t[36]=F,t[37]=be);let xe;t[38]!==ye||t[39]!==be?(xe=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[ye,be]}),t[38]=ye,t[39]=be,t[40]=xe):xe=t[40];let Ce;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Q.jsx)(`span`,{}),t[41]=Ce):Ce=t[41];let we;t[42]!==f||t[43]!==n.expiresAt?(we=gt(n.expiresAt,f),t[42]=f,t[43]=n.expiresAt,t[44]=we):we=t[44];let Te;t[45]===we?Te=t[46]:(Te=(0,Q.jsx)(Ge,{render:Ce,children:we}),t[45]=we,t[46]=Te);let De;t[47]===de?De=t[48]:(De=(0,Q.jsx)(Ke,{side:`top`,children:de}),t[47]=de,t[48]=De);let Oe;t[49]!==Te||t[50]!==De?(Oe=(0,Q.jsxs)(qe,{children:[Te,De]}),t[49]=Te,t[50]=De,t[51]=Oe):Oe=t[51];let ke;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ke=(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `}),t[52]=ke):ke=t[52];let Ae;t[53]===n.scopes?Ae=t[54]:(Ae=(0,Q.jsx)(oi,{scopes:n.scopes,label:`Pairing link scopes`}),t[53]=n.scopes,t[54]=Ae);let je;t[55]!==Oe||t[56]!==Ae?(je=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[Oe,ke,Ae]}),t[55]=Oe,t[56]=Ae,t[57]=je):je=t[57];let L;t[58]!==r||t[59]!==A?(L=r?A===null?(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Copy the token and pair from another client using this backend's reachable host.`}):null:(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Create a new link to share from this client.`}),t[58]=r,t[59]=A,t[60]=L):L=t[60];let Me;t[61]!==xe||t[62]!==je||t[63]!==L?(Me=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[xe,je,L]}),t[61]=xe,t[62]=je,t[63]=L,t[64]=Me):Me=t[64];let R;t[65]!==g||t[66]!==b||t[67]!==A?(R=A&&ne?(0,Q.jsxs)(I,{size:`xs`,variant:`outline`,"aria-expanded":g,"aria-controls":b,onClick:()=>_(Zi),children:[(0,Q.jsx)(Ee,{"aria-hidden":!0}),`Share`]}):null,t[65]=g,t[66]=b,t[67]=A,t[68]=R):R=t[68];let Ne=r!==void 0&&m,Pe;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=e=>{h(e),e||M(null)},t[69]=Pe):Pe=t[69];let Fe;t[70]!==r||t[71]!==le||t[72]!==A?(Fe=r?ne?A?null:(0,Q.jsx)(I,{size:`xs`,variant:`outline`,onClick:le,children:`Copy code`}):(0,Q.jsx)(Mt,{render:(0,Q.jsx)(I,{size:`xs`,variant:`outline`}),children:A?`Show link`:`Show code`}):null,t[70]=r,t[71]=le,t[72]=A,t[73]=Fe):Fe=t[73];let Ie=P?ee?`Hosted app pairing link`:`Pairing link`:`Pairing code`,z;t[74]===Ie?z=t[75]:(z=(0,Q.jsx)(At,{children:Ie}),t[74]=Ie,t[75]=z);let Le=P?ee?`Clipboard copy is unavailable here. Open or manually copy this hosted app link on the device you want to connect.`:`Clipboard copy is unavailable here. Open or manually copy this full pairing URL on the device you want to connect.`:`Clipboard copy is unavailable here. Manually copy this code into another client.`,V;t[76]===Le?V=t[77]:(V=(0,Q.jsx)(Ft,{children:Le}),t[76]=Le,t[77]=V);let Re;t[78]!==z||t[79]!==V?(Re=(0,Q.jsxs)(kt,{children:[z,V]}),t[78]=z,t[79]=V,t[80]=Re):Re=t[80];let H=P?4:3,ze;t[81]!==N||t[82]!==H?(ze=(0,Q.jsx)(yt,{readOnly:!0,value:N,rows:H,onFocus:Qi,onClick:$i}),t[81]=N,t[82]=H,t[83]=ze):ze=t[83];let Be;t[84]!==te||t[85]!==P||t[86]!==N?(Be=P&&te?(0,Q.jsx)(`div`,{className:`flex justify-center rounded-xl border border-border/60 bg-muted/30 p-4`,children:(0,Q.jsx)(Bn,{value:N,size:132,level:`M`,marginSize:2,title:`Pairing link — scan to open on another device`})}):null,t[84]=te,t[85]=P,t[86]=N,t[87]=Be):Be=t[87];let U;t[88]!==ze||t[89]!==Be?(U=(0,Q.jsxs)(Pt,{children:[ze,Be]}),t[88]=ze,t[89]=Be,t[90]=U):U=t[90];let Ve;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,Q.jsx)(I,{variant:`outline`,onClick:()=>h(!1),children:`Done`}),t[91]=Ve):Ve=t[91];let He;t[92]===le?He=t[93]:(He=ne?(0,Q.jsx)(I,{variant:`outline`,onClick:le,children:`Copy code`}):null,t[92]=le,t[93]=He);let Ue;t[94]===He?Ue=t[95]:(Ue=(0,Q.jsxs)(jt,{variant:`bare`,children:[Ve,He]}),t[94]=He,t[95]=Ue);let We;t[96]!==Re||t[97]!==U||t[98]!==Ue?(We=(0,Q.jsxs)(It,{className:`max-w-md`,children:[Re,U,Ue]}),t[96]=Re,t[97]=U,t[98]=Ue,t[99]=We):We=t[99];let W;t[100]!==Ne||t[101]!==Fe||t[102]!==We?(W=(0,Q.jsxs)(Lt,{open:Ne,onOpenChange:Pe,children:[Fe,We]}),t[100]=Ne,t[101]=Fe,t[102]=We,t[103]=W):W=t[103];let Je=!u||c===n.id,Ye;t[104]!==l||t[105]!==n.id?(Ye=()=>void l(n.id),t[104]=l,t[105]=n.id,t[106]=Ye):Ye=t[106];let Xe=c===n.id?`Revoking…`:`Revoke`,Ze;t[107]!==Je||t[108]!==Ye||t[109]!==Xe?(Ze=(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:Je,onClick:Ye,children:Xe}),t[107]=Je,t[108]=Ye,t[109]=Xe,t[110]=Ze):Ze=t[110];let Qe;t[111]!==R||t[112]!==W||t[113]!==Ze?(Qe=(0,Q.jsxs)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:[R,W,Ze]}),t[111]=R,t[112]=W,t[113]=Ze,t[114]=Qe):Qe=t[114];let G;t[115]!==Me||t[116]!==Qe?(G=(0,Q.jsxs)(`div`,{className:Kn,children:[Me,Qe]}),t[115]=Me,t[116]=Qe,t[117]=G):G=t[117];let et;t[118]!==he||t[119]!==oe||t[120]!==O||t[121]!==le||t[122]!==g||t[123]!==me||t[124]!==b||t[125]!==pe?.id?(et=g&&me!==null?(0,Q.jsxs)(`div`,{id:b,className:`mt-3 flex flex-col gap-4 border-t border-border/50 pt-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[O.length>1?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,role:`radiogroup`,"aria-label":`Endpoint the pairing QR code and URL use`,children:[(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Reach this machine via`}),O.map(e=>{let t=e.id===pe?.id;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:Se(`flex w-full items-baseline gap-2 rounded-lg border px-2.5 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,t?`border-foreground/60 bg-muted/30`:`border-border/50 hover:bg-muted/20`),onClick:()=>y(e.id),children:[(0,Q.jsx)(`span`,{className:Se(`text-xs font-medium`,t?`text-foreground`:`text-muted-foreground`),children:e.label}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-2xs text-muted-foreground/70`,children:e.detail})]},e.id)})]}):null,(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-2.5 py-1.5`,children:[(0,Q.jsxs)(qe,{children:[(0,Q.jsx)(Ge,{render:(0,Q.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-2xs text-muted-foreground`,children:me})}),(0,Q.jsx)(Ke,{side:`top`,children:me})]}),(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,className:`shrink-0`,onClick:()=>oe(me,se(me)),children:`Copy link`})]}),(0,Q.jsx)(I,{size:`xs`,variant:`ghost`,onClick:le,children:`Copy code only`})]}),he?(0,Q.jsx)(`div`,{className:`w-fit shrink-0 self-center rounded-xl bg-white p-3 sm:self-start`,children:(0,Q.jsx)(Bn,{value:me,size:168,level:`M`,marginSize:1,title:`Pairing link — scan to open on another device`})}):(0,Q.jsx)(`div`,{className:`flex size-[192px] shrink-0 items-center justify-center self-center rounded-xl border border-border/50 p-4 sm:self-start`,children:(0,Q.jsx)(`p`,{className:`text-center text-2xs text-muted-foreground/70`,children:`No QR for this endpoint. Another device scanning a loopback link would dial itself; copy the URL for use on this machine instead.`})})]}):null,t[118]=he,t[119]=oe,t[120]=O,t[121]=le,t[122]=g,t[123]=me,t[124]=b,t[125]=pe?.id,t[126]=et):et=t[126];let tt;return t[127]!==ge||t[128]!==G||t[129]!==et?(tt=(0,Q.jsxs)(`div`,{className:ge,children:[G,et]}),t[127]=ge,t[128]=G,t[129]=et,t[130]=tt):tt=t[130],tt}),Oi=(0,$.memo)(function(e){let t=(0,Z.c)(54),{clientSession:n,presentation:r,revokingClientSessionId:i,onRevokeSession:a,canRevoke:o}=e,s=r===void 0?`current`:r,c=yn(1e3),l=n.current||n.connected,u=n.lastConnectedAt,d;t[0]!==l||t[1]!==u||t[2]!==c?(d=l?u?`Connected for ${_t(u,c)}`:`Connected`:u?`Last connected at ${ai(u)}`:`Not connected yet.`,t[0]=l,t[1]=u,t[2]=c,t[3]=d):d=t[3];let f=d,p;t[4]===n.client.deviceType?p=t[5]:(p=n.client.deviceType===`unknown`?null:n.client.deviceType[0]?.toUpperCase()+n.client.deviceType.slice(1),t[4]=n.client.deviceType,t[5]=p);let m=n.client.os??null,h=n.client.browser??null,g=n.client.ipAddress??null,_;t[6]!==p||t[7]!==m||t[8]!==h||t[9]!==g?(_=[p,m,h,g].filter(ea),t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_):_=t[10];let v=_,y;t[11]!==n.client.browser||t[12]!==n.client.label||t[13]!==n.client.os||t[14]!==n.subject?(y=n.client.label??([n.client.os,n.client.browser].filter(Boolean).join(` · `)||n.subject),t[11]=n.client.browser,t[12]=n.client.label,t[13]=n.client.os,t[14]=n.subject,t[15]=y):y=t[15];let b=y,x;t[16]===s?x=t[17]:(x=pi(s),t[16]=s,t[17]=x);let S=l?`bg-success`:`bg-muted-foreground/30`,C=l?`bg-success/60 duration-2000`:null,w;t[18]!==f||t[19]!==S||t[20]!==C?(w=(0,Q.jsx)(X,{tooltipText:f,dotClassName:S,pingClassName:C}),t[18]=f,t[19]=S,t[20]=C,t[21]=w):w=t[21];let T;t[22]===b?T=t[23]:(T=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:b}),t[22]=b,t[23]=T);let E;t[24]===n.current?E=t[25]:(E=n.current?(0,Q.jsx)(`span`,{className:`text-3xs text-muted-foreground/80 rounded-md border border-border/50 bg-muted/50 px-1 py-0.5`,children:`This device`}):null,t[24]=n.current,t[25]=E);let D;t[26]!==w||t[27]!==T||t[28]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[w,T,E]}),t[26]=w,t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]===v?O=t[31]:(O=v.length>0?(0,Q.jsxs)(Q.Fragment,{children:[v.join(` · `),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `})]}):null,t[30]=v,t[31]=O);let k;t[32]===n.scopes?k=t[33]:(k=(0,Q.jsx)(oi,{scopes:n.scopes,label:`Client scopes`}),t[32]=n.scopes,t[33]=k);let A;t[34]!==O||t[35]!==k?(A=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[O,k]}),t[34]=O,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==D||t[38]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[D,A]}),t[37]=D,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==o||t[41]!==n.current||t[42]!==n.sessionId||t[43]!==a||t[44]!==i?(M=n.current?null:(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:!o||i===n.sessionId,onClick:()=>void a(n.sessionId),children:i===n.sessionId?`Revoking…`:`Revoke`}),t[40]=o,t[41]=n.current,t[42]=n.sessionId,t[43]=a,t[44]=i,t[45]=M):M=t[45];let N;t[46]===M?N=t[47]:(N=(0,Q.jsx)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:M}),t[46]=M,t[47]=N);let P;t[48]!==j||t[49]!==N?(P=(0,Q.jsxs)(`div`,{className:Kn,children:[j,N]}),t[48]=j,t[49]=N,t[50]=P):P=t[50];let ee;return t[51]!==P||t[52]!==x?(ee=(0,Q.jsx)(`div`,{className:x,children:P}),t[51]=P,t[52]=x,t[53]=ee):ee=t[53],ee}),ki=(0,$.memo)(function({onPairingLinkCreated:e,clientSessions:t,isRevokingOtherClients:n,onRevokeOtherClients:r,delegatableScopes:i}){let a=q(),[o,s]=(0,$.useState)(!1),[c,l]=(0,$.useState)(``),[u,d]=(0,$.useState)([...M]),f=u.filter(e=>i.includes(e)),[p,m]=(0,$.useState)(!1),h=(0,$.useCallback)(async()=>{if(a!==null&&f.length!==0&&ft(a,`access:write`)&&f.every(e=>ft(a,e))){m(!0);try{e(await xn({label:c,scopes:f})),l(``),d(M.filter(e=>i.includes(e))),s(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to create pairing URL.`;K.add(Y({type:`error`,title:`Could not create pairing URL`,description:t}))}finally{m(!1)}}},[i,e,c,a,f]),g=(0,$.useCallback)((e,t)=>{d(n=>Hn(n,e,t))},[]);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,disabled:n||!Nn(t),onClick:()=>void r(),children:n?`Revoking…`:`Revoke others`}),(0,Q.jsxs)(Lt,{open:o,onOpenChange:e=>{s(e),e||(l(``),d(M.filter(e=>i.includes(e))))},children:[(0,Q.jsx)(Mt,{render:(0,Q.jsxs)(I,{size:`xs`,variant:`default`,children:[(0,Q.jsx)(j,{className:`size-3`}),`Create link`]})}),(0,Q.jsxs)(It,{className:`max-w-md`,children:[(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(At,{children:`Create pairing link`}),(0,Q.jsx)(Ft,{children:`Generate a one-time link that another device can use to pair with this backend as an authorized client.`})]}),(0,Q.jsxs)(Pt,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Client label (optional)`}),(0,Q.jsx)(Dt,{value:c,onChange:e=>l(e.target.value),placeholder:`e.g. Living room iPad`,disabled:p,autoFocus:!0})]}),(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-xs font-medium text-foreground`,children:`Permissions`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Limit what the paired client can do.`})]}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:p,onClick:()=>d([y,ge,T,xe].filter(e=>i.includes(e))),children:`Read only`}),(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:p,onClick:()=>d(M.filter(e=>i.includes(e))),children:`Standard`})]})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-border/60 rounded-lg border border-input bg-muted/25`,children:or.filter(({scope:e})=>i.includes(e)).map(({scope:e,title:t,description:n})=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-3 py-2.5 transition-colors hover:bg-muted/40`,children:[(0,Q.jsx)(vt,{className:`mt-0.5`,checked:u.includes(e),disabled:p,onCheckedChange:t=>g(e,t===!0)}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-xs font-medium text-foreground`,children:t}),(0,Q.jsx)(`span`,{className:`block text-xs leading-snug text-muted-foreground`,children:n})]})]},e))}),f.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:`Select at least one permission.`}):f.includes(`access:write`)?(0,Q.jsx)(`p`,{className:`text-xs text-warning`,children:`This client can create or revoke access for other devices.`}):null]})]}),(0,Q.jsxs)(jt,{variant:`bare`,children:[(0,Q.jsx)(I,{variant:`outline`,disabled:p,onClick:()=>s(!1),children:`Cancel`}),(0,Q.jsx)(I,{disabled:p||f.length===0,onClick:()=>void h(),children:p?`Creating…`:`Create link`})]})]})]})]})}),Ai=(0,$.memo)(function(e){let t=(0,Z.c)(39),{endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:a,isLoading:o,pairingLinks:s,createdPairingCredentials:c,clientSessions:l,revokingPairingLinkId:u,revokingClientSessionId:d,onRevokePairingLink:f,onRevokeClientSession:p,canRevoke:m}=e,h=a===void 0?`current`:a,g;if(t[0]!==m||t[1]!==c||t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==f||t[6]!==s||t[7]!==h||t[8]!==u){let e;t[10]!==m||t[11]!==c||t[12]!==i||t[13]!==n||t[14]!==r||t[15]!==f||t[16]!==h||t[17]!==u?(e=e=>(0,Q.jsx)(Di,{pairingLink:e,credential:c.get(e.id),endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:h,revokingPairingLinkId:u,onRevoke:f,canRevoke:m},e.id),t[10]=m,t[11]=c,t[12]=i,t[13]=n,t[14]=r,t[15]=f,t[16]=h,t[17]=u,t[18]=e):e=t[18],g=s.map(e),t[0]=m,t[1]=c,t[2]=i,t[3]=n,t[4]=r,t[5]=f,t[6]=s,t[7]=h,t[8]=u,t[9]=g}else g=t[9];let _;if(t[19]!==m||t[20]!==l||t[21]!==p||t[22]!==h||t[23]!==d){let e;t[25]!==m||t[26]!==p||t[27]!==h||t[28]!==d?(e=e=>(0,Q.jsx)(Oi,{clientSession:e,presentation:h,revokingClientSessionId:d,onRevokeSession:p,canRevoke:m},e.sessionId),t[25]=m,t[26]=p,t[27]=h,t[28]=d,t[29]=e):e=t[29],_=l.map(e),t[19]=m,t[20]=l,t[21]=p,t[22]=h,t[23]=d,t[24]=_}else _=t[24];let v;t[30]!==l.length||t[31]!==o||t[32]!==s.length||t[33]!==h?(v=s.length===0&&l.length===0&&!o?(0,Q.jsx)(`div`,{className:pi(h),children:(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:`No pairing links or client sessions.`})}):null,t[30]=l.length,t[31]=o,t[32]=s.length,t[33]=h,t[34]=v):v=t[34];let y;return t[35]!==g||t[36]!==_||t[37]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[g,_,v]}),t[35]=g,t[36]=_,t[37]=v,t[38]=y):y=t[38],y}),ji=(0,$.memo)(function(e){let t=(0,Z.c)(50),{endpoint:n,isDefault:r,presentation:i,onSetDefault:a,onSetupTailscaleServe:o,onDisableTailscaleServe:s,isUpdatingTailscaleServe:c}=e,l=i===void 0?`current`:i,u=n.status===`available`,d;t[0]===n?d=t[1]:(d=xi(n)&&n.status!==`available`,t[0]=n,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=xi(n)&&n.status===`available`,t[2]=n,t[3]=p);let m=p,h=!f,g=l===`endpoint-rail`,_;t[4]!==u||t[5]!==l?(_=mi(l,u),t[4]=u,t[5]=l,t[6]=_):_=t[6];let v;t[7]!==r||t[8]!==g?(v=g&&r?(0,Q.jsx)(`span`,{className:`absolute inset-y-2 left-0 w-1 rounded-r-full bg-primary`,"aria-hidden":!0}):null,t[7]=r,t[8]=g,t[9]=v):v=t[9];let y;t[10]===n.label?y=t[11]:(y=(0,Q.jsx)(`h3`,{className:`shrink-0 text-sm leading-5 font-medium text-foreground`,children:n.label}),t[10]=n.label,t[11]=y);let b;t[12]!==n.httpBaseUrl||t[13]!==h?(b=h?(0,Q.jsxs)(qe,{children:[(0,Q.jsx)(Ge,{render:(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-xs leading-5 text-muted-foreground`,children:n.httpBaseUrl})}),(0,Q.jsx)(Ke,{side:`top`,children:n.httpBaseUrl})]}):null,t[12]=n.httpBaseUrl,t[13]=h,t[14]=b):b=t[14];let x;t[15]===u?x=t[16]:(x=u?null:(0,Q.jsx)(`span`,{className:`shrink-0 rounded-md border border-border/70 px-1 py-0.5 text-3xs text-muted-foreground`,children:`Setup required`}),t[15]=u,t[16]=x);let S;t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-3`,children:[y,b,x]}),t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20];let C;t[21]===r?C=t[22]:(C=r?(0,Q.jsx)(`span`,{className:`rounded-md border border-primary/30 bg-primary/10 px-1 py-0.5 text-3xs text-primary`,children:`Default`}):null,t[21]=r,t[22]=C);let w;t[23]!==n||t[24]!==c||t[25]!==f||t[26]!==o?(w=f?(0,Q.jsx)(I,{size:`xs`,variant:`outline`,onClick:()=>o(n),disabled:c,children:c?`Restarting…`:`Setup`}):null,t[23]=n,t[24]=c,t[25]=f,t[26]=o,t[27]=w):w=t[27];let T;t[28]!==m||t[29]!==n||t[30]!==c||t[31]!==s?(T=m?(0,Q.jsx)(I,{size:`xs`,variant:`destructive-outline`,onClick:()=>s(n),disabled:c,children:c?`Restarting…`:`Disable`}):null,t[28]=m,t[29]=n,t[30]=c,t[31]=s,t[32]=T):T=t[32];let E;t[33]!==n||t[34]!==r||t[35]!==f||t[36]!==a?(E=!f&&!r?(0,Q.jsx)(I,{size:`xs`,variant:`outline`,onClick:()=>a(n),children:`Set as default`}):null,t[33]=n,t[34]=r,t[35]=f,t[36]=a,t[37]=E):E=t[37];let D;t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==E?(D=(0,Q.jsxs)(`div`,{className:`ml-auto flex min-h-6 shrink-0 items-center justify-end gap-2`,children:[C,w,T,E]}),t[38]=C,t[39]=w,t[40]=T,t[41]=E,t[42]=D):D=t[42];let O;t[43]!==D||t[44]!==S?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-6 min-w-0 flex-col gap-2 sm:-my-0.5 sm:flex-row sm:items-center`,children:[S,D]}),t[43]=D,t[44]=S,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==_||t[48]!==v?(k=(0,Q.jsxs)(`div`,{className:_,children:[v,O]}),t[46]=O,t[47]=_,t[48]=v,t[49]=k):k=t[49],k});function Mi(e){let t=(0,Z.c)(14),{endpoint:n,hiddenEndpointCount:r,expanded:i,onToggleExpanded:a,fallback:o}=e;if(!n)return o;let s;t[0]===n.httpBaseUrl?s=t[1]:(s=(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:n.httpBaseUrl}),t[0]=n.httpBaseUrl,t[1]=s);let c;t[2]!==i||t[3]!==r?(c=r>0?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:i?`Hide`:`+${r}`}):null,t[2]=i,t[3]=r,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7];let u=l,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Reachable at`}),t[8]=d):d=t[8];let f;return t[9]!==i||t[10]!==r||t[11]!==a||t[12]!==u?(f=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-1`,children:[d,r>0?(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex min-w-0 max-w-full items-baseline gap-2 border-b border-dotted border-muted-foreground/60 text-left text-muted-foreground underline-offset-4 hover:border-foreground hover:text-foreground`,onClick:a,"aria-expanded":i,children:u}):(0,Q.jsx)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-2`,children:u})]}),t[9]=i,t[10]=r,t[11]=a,t[12]=u,t[13]=f):f=t[13],f}function Ni(e){if(!e.entry.enabled&&e.connection.phase!==`unsupported`)return{text:`Off`,tone:`muted`};let{connection:t}=e;switch(t.phase){case`connected`:return{text:`Connected`,tone:`muted`};case`connecting`:return{text:`Connecting`,tone:`muted`};case`reconnecting`:return{text:t.error?`Reconnecting: ${t.error}`:`Reconnecting`,tone:`error`};case`unsupported`:return{text:`Client not supported`,tone:`muted`};case`error`:return{text:t.error?`Connection failed: ${t.error}`:`Connection failed`,tone:`error`};case`offline`:return{text:`Offline`,tone:`muted`};case`available`:return{text:`Not connected`,tone:`muted`}}}function Pi(e){let t=(0,Z.c)(161),{environment:n,removingEnvironmentId:r,onSetEnabled:i,onRemove:a,onAddRoute:o}=e,[s,c]=(0,$.useState)(!1),[u,d]=(0,$.useState)(!1),f=n.environmentId,p=n.connection.phase===`unsupported`,m=n.entry.enabled&&!p,h=n.connection.phase===`connected`,g=r===f,y=n.connection.traceId,b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b={target:`trace ID`,onCopy:Hi,onError:Vi},t[0]=b):b=t[0];let{copyToClipboard:x}=$e(b),S;t[1]===x?S=t[2]:(S=e=>{x(e,{traceId:e})},t[1]=x,t[2]=S);let C=S,T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T={target:`MCP URL`,onCopy:Bi,onError:zi},t[3]=T):T=t[3];let{copyToClipboard:E}=$e(T),D;t[4]===n.serverConfig?D=t[5]:(D=Vn(n.serverConfig),t[4]=n.serverConfig,t[5]=D);let k=D,j;t[6]===f?j=t[7]:(j=st.updateStateAtom(f),t[6]=f,t[7]=j);let M=w(j),N=M.status===`running`&&M.stage===`resuming`,P;t[8]===n?P=t[9]:(P=Ni(n),t[8]=n,t[9]=P);let ee=P,te=n.serverConfig?.environment.serverVersion??null,ne=et(),re;t[10]!==f||t[11]!==ne.environments?(re=se(ne.environments.get(f)?.status??De())?.descriptor,t[10]=f,t[11]=ne.environments,t[12]=re):re=t[12];let ie=re,[ae,oe]=(0,$.useState)(ie);ie!==void 0&&ie!==ae&&oe(ie);let ce;t[13]!==f||t[14]!==ne.environments?(ce=ne.environments.get(f)?.environment.endpoint.httpBaseUrl,t[13]=f,t[14]=ne.environments,t[15]=ce):ce=t[15];let le=ce,[ue,de]=(0,$.useState)(le);le!==void 0&&le!==ue&&de(le);let F=pt(f),fe=h&&F._tag===`Some`?F.value.target:null,pe=le??ue,ge;t[16]!==fe||t[17]!==n.entry||t[18]!==pe?(ge=Ve({entry:n.entry,relayHttpBaseUrl:pe,connectedTarget:fe}),t[16]=fe,t[17]=n.entry,t[18]=pe,t[19]=ge):ge=t[19];let _e=ge,ve;t[20]!==n.serverConfig||t[21]!==ae?(ve=n.serverConfig??(ae===void 0?null:{environment:ae}),t[20]=n.serverConfig,t[21]=ae,t[22]=ve):ve=t[22];let ye;t[23]===ve?ye=t[24]:(ye=me(ve),t[23]=ve,t[24]=ye);let be=ye,xe;t[25]===n.entry?xe=t[26]:(xe=Ne(n.entry),t[25]=n.entry,t[26]=xe);let Ce=xe.length,Ee;t[27]!==fe||t[28]!==n?(Ee=yr(n,fe),t[27]=fe,t[28]=n,t[29]=Ee):Ee=t[29];let Oe=N?`Restarting`:ee.text,ke=m&&k?te:null,Ae;t[30]!==Ee||t[31]!==Oe||t[32]!==ke?(Ae=[Ee,Oe,ke].filter(Ri),t[30]=Ee,t[31]=Oe,t[32]=ke,t[33]=Ae):Ae=t[33];let je=Ae.join(` · `),L=m&&h&&k!==null&&(M.status===`idle`||M.status===`failed`),Me;t[34]!==m||t[35]!==n.connection||t[36]!==p?(Me=p?n.connection.error??We(n.connection):m?We(n.connection):`Switched off`,t[34]=m,t[35]=n.connection,t[36]=p,t[37]=Me):Me=t[37];let R=`${Me}${k?`\nUpdate available: ${k.serverVersion} → ${k.clientVersion}`:``}`,Pe=n.label,Fe=!m,Ie=m&&ee.tone===`error`&&!N&&`text-destructive`,z;t[38]===Ie?z=t[39]:(z=Se(`min-w-0 truncate`,Ie),t[38]=Ie,t[39]=z);let Le;t[40]===z?Le=t[41]:(Le=(0,Q.jsx)(`span`,{className:z}),t[40]=z,t[41]=Le);let B;t[42]!==R||t[43]!==je||t[44]!==Le?(B=(0,Q.jsx)(Ge,{payload:R,render:Le,children:je}),t[42]=R,t[43]=je,t[44]=Le,t[45]=B):B=t[45];let V;t[46]===R?V=t[47]:(V=(0,Q.jsx)(Ke,{side:`top`,className:`whitespace-pre-wrap`,children:R}),t[46]=R,t[47]=V);let Re;t[48]!==B||t[49]!==V?(Re=(0,Q.jsxs)(qe,{children:[B,V]}),t[48]=B,t[49]=V,t[50]=Re):Re=t[50];let H;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[51]=H):H=t[51];let ze;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>c(Li),t[52]=ze):ze=t[52];let U=Ce===1?`Routes`:`${Ce} routes`,He=s&&`rotate-90`,Ue;t[53]===He?Ue=t[54]:(Ue=Se(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,He),t[53]=He,t[54]=Ue);let W;t[55]===Ue?W=t[56]:(W=(0,Q.jsx)(we,{"aria-hidden":!0,className:Ue}),t[55]=Ue,t[56]=W);let Je;t[57]!==s||t[58]!==U||t[59]!==W?(Je=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:ze,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[U,W]}),t[57]=s,t[58]=U,t[59]=W,t[60]=Je):Je=t[60];let Ye;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[61]=Ye):Ye=t[61];let Xe=`remote-permissions-${f}`,Ze;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=()=>d(Ii),t[62]=Ze):Ze=t[62];let Qe=u&&`rotate-90`,G;t[63]===Qe?G=t[64]:(G=Se(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,Qe),t[63]=Qe,t[64]=G);let K;t[65]===G?K=t[66]:(K=(0,Q.jsx)(we,{"aria-hidden":!0,className:G}),t[65]=G,t[66]=K);let tt;t[67]!==u||t[68]!==Xe||t[69]!==K?(tt=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":u,"aria-controls":Xe,onClick:Ze,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[`Permissions`,K]}),t[67]=u,t[68]=Xe,t[69]=K,t[70]=tt):tt=t[70];let nt;t[71]!==Re||t[72]!==Je||t[73]!==tt?(nt=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[Re,H,Je,Ye,tt]}),t[71]=Re,t[72]=Je,t[73]=tt,t[74]=nt):nt=t[74];let q;t[75]===M?q=t[76]:(q=M.status===`idle`?null:(0,Q.jsx)(`div`,{className:`mt-1 max-w-md`,children:(0,Q.jsx)(Jn,{state:M})}),t[75]=M,t[76]=q);let rt;t[77]!==n||t[78]!==o||t[79]!==s?(rt=s&&(0,Q.jsx)(mr,{environment:n,onAddRoute:()=>o(n)}),t[77]=n,t[78]=o,t[79]=s,t[80]=rt):rt=t[80];let it;t[81]!==f||t[82]!==h||t[83]!==u?(it=u&&(0,Q.jsx)(`div`,{id:`remote-permissions-${f}`,className:`mt-2 border-t border-border/50`,children:(0,Q.jsx)(sr,{environmentId:f,connected:h,routeContext:!0})}),t[81]=f,t[82]=h,t[83]=u,t[84]=it):it=t[84];let at;t[85]!==rt||t[86]!==it?(at=(0,Q.jsxs)(Q.Fragment,{children:[rt,it]}),t[85]=rt,t[86]=it,t[87]=at):at=t[87];let ot;t[88]!==n.entry.serverUpdateRequired||t[89]!==n.label||t[90]!==f||t[91]!==ae?.serverVersion||t[92]!==M.status||t[93]!==p?(ot=p&&n.entry.serverUpdateRequired===!0&&M.status!==`running`?(0,Q.jsx)(er,{environmentId:f,serverLabel:`${n.label} server`,fromVersion:ae?.serverVersion,targetVersion:Be,label:M.status===`failed`?`Retry update`:`Update`}):null,t[88]=n.entry.serverUpdateRequired,t[89]=n.label,t[90]=f,t[91]=ae?.serverVersion,t[92]=M.status,t[93]=p,t[94]=ot):ot=t[94];let J;t[95]!==n.label||t[96]!==n.serverConfig||t[97]!==f||t[98]!==M.status||t[99]!==L||t[100]!==k?(J=L?(0,Q.jsx)(Yn,{environmentId:f,serverLabel:`${n.label} server`,selfUpdate:On(n.serverConfig),installation:n.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:Ln(n.serverConfig),threadContinuation:$n(n.serverConfig),targetVersion:k.clientVersion,label:M.status===`failed`?`Retry update`:`Update`,appearance:`icon`}):null,t[95]=n.label,t[96]=n.serverConfig,t[97]=f,t[98]=M.status,t[99]=L,t[100]=k,t[101]=J):J=t[101];let ct=g||p,lt=`${m?`Switch off`:`Switch on`} ${n.label}`,ut;t[102]!==f||t[103]!==i?(ut=e=>i(f,e),t[102]=f,t[103]=i,t[104]=ut):ut=t[104];let dt;t[105]!==m||t[106]!==ct||t[107]!==lt||t[108]!==ut?(dt=(0,Q.jsx)(Ge,{render:(0,Q.jsx)(Pn,{size:`sm`,checked:m,disabled:ct,"aria-label":lt,onCheckedChange:ut})}),t[105]=m,t[106]=ct,t[107]=lt,t[108]=ut,t[109]=dt):dt=t[109];let ft=p?`Client not supported`:m?`Switch off`:`Switch on`,mt;t[110]===ft?mt=t[111]:(mt=(0,Q.jsx)(Ke,{side:`top`,children:ft}),t[110]=ft,t[111]=mt);let ht;t[112]!==dt||t[113]!==mt?(ht=(0,Q.jsxs)(qe,{children:[dt,mt]}),t[112]=dt,t[113]=mt,t[114]=ht):ht=t[114];let Y=`More actions for ${n.label}`,gt;t[115]!==g||t[116]!==Y?(gt=(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,disabled:g,"aria-label":Y}),t[115]=g,t[116]=Y,t[117]=gt):gt=t[117];let _t;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,Q.jsx)(_,{className:`size-3.5`}),t[118]=_t):_t=t[118];let vt;t[119]===gt?vt=t[120]:(vt=(0,Q.jsx)(he,{render:gt,children:_t}),t[119]=gt,t[120]=vt);let yt;t[121]!==n.serverConfig||t[122]!==f?(yt=(0,Q.jsx)(pr,{environmentId:f,serverConfig:n.serverConfig}),t[121]=n.serverConfig,t[122]=f,t[123]=yt):yt=t[123];let bt,xt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(bt=()=>c(Fi),xt=(0,Q.jsx)(v,{}),t[124]=bt,t[125]=xt):(bt=t[124],xt=t[125]);let St=s?`Hide routes`:`Routes`,Ct;t[126]===St?Ct=t[127]:(Ct=(0,Q.jsxs)(O,{onClick:bt,children:[xt,St]}),t[126]=St,t[127]=Ct);let wt;t[128]!==E||t[129]!==_e?(wt=_e?(0,Q.jsx)(O,{onClick:()=>E(_e,{url:_e}),children:`Copy MCP URL`}):null,t[128]=E,t[129]=_e,t[130]=wt):wt=t[130];let Tt;t[131]!==C||t[132]!==y?(Tt=y?(0,Q.jsx)(O,{onClick:()=>C(y),children:`Copy trace ID`}):null,t[131]=C,t[132]=y,t[133]=Tt):Tt=t[133];let Et;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(Et=(0,Q.jsx)(Te,{}),t[134]=Et):Et=t[134];let Dt;t[135]!==n||t[136]!==a?(Dt=()=>a(n),t[135]=n,t[136]=a,t[137]=Dt):Dt=t[137];let Ot=g?`Removing…`:`Remove from this device…`,kt;t[138]!==Dt||t[139]!==Ot?(kt=(0,Q.jsx)(O,{variant:`destructive`,onClick:Dt,children:Ot}),t[138]=Dt,t[139]=Ot,t[140]=kt):kt=t[140];let At;t[141]!==yt||t[142]!==Ct||t[143]!==wt||t[144]!==Tt||t[145]!==kt?(At=(0,Q.jsxs)(A,{align:`end`,children:[yt,Ct,wt,Tt,Et,kt]}),t[141]=yt,t[142]=Ct,t[143]=wt,t[144]=Tt,t[145]=kt,t[146]=At):At=t[146];let jt;t[147]!==vt||t[148]!==At?(jt=(0,Q.jsxs)(l,{children:[vt,At]}),t[147]=vt,t[148]=At,t[149]=jt):jt=t[149];let Mt;return t[150]!==n.label||t[151]!==be||t[152]!==Fe||t[153]!==nt||t[154]!==q||t[155]!==at||t[156]!==ot||t[157]!==J||t[158]!==ht||t[159]!==jt?(Mt=(0,Q.jsxs)(br,{kind:be,label:Pe,dimmed:Fe,subtitle:nt,below:q,detail:at,children:[ot,J,ht,jt]}),t[150]=n.label,t[151]=be,t[152]=Fe,t[153]=nt,t[154]=q,t[155]=at,t[156]=ot,t[157]=J,t[158]=ht,t[159]=jt,t[160]=Mt):Mt=t[160],Mt}function Fi(e){return!e}function Ii(e){return!e}function Li(e){return!e}function Ri(e){return e!==null}function zi(e){K.add(Y({type:`error`,title:`Could not copy MCP URL`,description:e.message}))}function Bi(e){let{url:t}=e;K.add({type:`success`,title:`MCP URL copied`,description:`Add it to an agent, e.g. claude mcp add --transport http p4 ${t}`})}function Vi(e){K.add(Y({type:`error`,title:`Could not copy trace ID`,description:e.message}))}function Hi(e){let{traceId:t}=e;K.add({type:`success`,title:`Trace ID copied`,description:t})}function Ui(e){let t=(0,Z.c)(10),{checked:n,disabled:r,disabledReason:i,onCheckedChange:a,ariaLabel:o}=e,s=o===void 0?`Enable P4 Connect`:o,c;t[0]===a?c=t[1]:(c=a?{onCheckedChange:a}:{},t[0]=a,t[1]=c);let l;t[2]!==s||t[3]!==n||t[4]!==r||t[5]!==c?(l=(0,Q.jsx)(Pn,{"aria-label":s,checked:n,disabled:r,...c}),t[2]=s,t[3]=n,t[4]=r,t[5]=c,t[6]=l):l=t[6];let u=l,d;return t[7]!==u||t[8]!==i?(d=i?(0,Q.jsxs)(qe,{children:[(0,Q.jsx)(Ge,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:u})}),(0,Q.jsx)(Ke,{side:`top`,children:i})]}):u,t[7]=u,t[8]=i,t[9]=d):d=t[9],d}function Wi(e){let t=(0,Z.c)(44),{canManageRelay:n}=e,r=q(),{isSignedIn:i,linkState:a,linkRevoked:o,managedTunnelActive:s,managedTunnelOutOfSync:c,publishAgentActivity:l,holdWebhooksWhileOffline:u,operationError:d,reconcileCloudState:f}=nr(),[p,m]=(0,$.useState)(!1),[h,g]=(0,$.useState)(!1),_=i?n?null:`Your session does not have permission to manage P4 Connect access.`:`Sign in to P4 Connect to manage this environment.`,v=p||h,y;t[0]!==r||t[1]!==l||t[2]!==f?(y=async e=>{r!==null&&ft(r,`relay:write`)&&(m(!0),await f({managedTunnel:e,publish:l})&&K.add({type:`success`,title:e?`P4 Connect linked`:l?`P4 Connect tunnel disabled`:`P4 Connect unlinked`,description:e?`This environment is available through P4 Connect.`:l?`The managed tunnel was removed. Agent activity publishing stays on.`:`This environment is no longer available through P4 Connect.`}),m(!1))},t[0]=r,t[1]=l,t[2]=f,t[3]=y):y=t[3];let b=y,x;t[4]!==s||t[5]!==r||t[6]!==f?(x=async e=>{r!==null&&ft(r,`relay:write`)&&(g(!0),await f({managedTunnel:s,publish:e})&&K.add({type:`success`,title:e?`Agent activity enabled`:`Agent activity disabled`,description:e?`This environment publishes agent activity to your mobile clients.`:`This environment will stop publishing agent activity.`}),g(!1))},t[4]=s,t[5]=r,t[6]=f,t[7]=x):x=t[7];let S=x,C;t[8]!==s||t[9]!==l||t[10]!==f?(C=async e=>{g(!0),await f({managedTunnel:s,publish:l,holdWebhooksWhileOffline:e})&&K.add({type:`success`,title:e?`Webhooks held while offline`:`Webhooks no longer held`,description:e?`P4 Connect keeps webhook requests for up to 24 hours while this environment is offline.`:`Requests to an offline environment now fail. Anything already held is still delivered.`}),g(!1)},t[8]=s,t[9]=l,t[10]=f,t[11]=C):C=t[11];let w=C,T;t[12]!==n||t[13]!==_||t[14]!==v||t[15]!==i||t[16]!==o||t[17]!==s||t[18]!==c||t[19]!==d||t[20]!==a||t[21]!==b?(T=window.desktopBridge?(0,Q.jsx)(gn,{title:Zn(`t3-connect`).title,description:o?`This environment was removed from P4 Connect. Turn it on to link it again.`:s?`This environment is available to your other devices through P4 Connect.`:c?`P4 Connect is out of sync. This environment is linked only to publish agent activity, so other devices cannot connect. Turn P4 Connect on to repair it.`:`Make this environment available to your other devices through P4 Connect.`,status:d??a.error,control:(0,Q.jsx)(Ui,{checked:s,disabled:!n||!i||a.data===null||a.isPending||v,disabledReason:_,onCheckedChange:e=>void b(e)})}):o?(0,Q.jsx)(gn,{title:Zn(`t3-connect`).title,description:"This environment was removed from P4 Connect. Run `p4c connect link` on the host to link it again."}):null,t[12]=n,t[13]=_,t[14]=v,t[15]=i,t[16]=o,t[17]=s,t[18]=c,t[19]=d,t[20]=a,t[21]=b,t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E=Zn(`publish-agent-activity`),t[23]=E):E=t[23];let D=!n||!i||a.data===null||a.isPending||v,O;t[24]===S?O=t[25]:(O=e=>void S(e),t[24]=S,t[25]=O);let k;t[26]!==_||t[27]!==l||t[28]!==D||t[29]!==O?(k=(0,Q.jsx)(gn,{title:E.title,description:`Send activity to mobile notifications and Live Activities without P4 Connect.`,control:(0,Q.jsx)(Ui,{ariaLabel:`Publish agent activity to mobile clients`,checked:l,disabled:D,disabledReason:_,onCheckedChange:O})}),t[26]=_,t[27]=l,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]!==n||t[32]!==_||t[33]!==u||t[34]!==v||t[35]!==i||t[36]!==s||t[37]!==a||t[38]!==w?(A=s?(0,Q.jsx)(gn,{title:Zn(`hold-webhooks-while-offline`).title,description:`Keep webhook requests for up to 24 hours while this environment is offline, then deliver them. Off: P4 Connect only forwards requests and stores nothing.`,control:(0,Q.jsx)(Ui,{ariaLabel:`Hold webhook requests while this environment is offline`,checked:u,disabled:!n||!i||a.isPending||v,disabledReason:_,onCheckedChange:e=>void w(e)})}):null,t[31]=n,t[32]=_,t[33]=u,t[34]=v,t[35]=i,t[36]=s,t[37]=a,t[38]=w,t[39]=A):A=t[39];let j;return t[40]!==T||t[41]!==k||t[42]!==A?(j=(0,Q.jsxs)(Q.Fragment,{children:[T,k,A]}),t[40]=T,t[41]=k,t[42]=A,t[43]=j):j=t[43],j}function Gi(e){let t=(0,Z.c)(3),{canReadRelay:n,canManageRelay:r}=e;if(!Re())return null;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(gn,{title:`P4 Connect`,description:`To edit these settings, pair this connection with both View relay and Manage relay permissions.`}),t[0]=e):e=t[0],e}let i;return t[1]===r?i=t[2]:(i=(0,Q.jsx)(Wi,{canManageRelay:r}),t[1]=r,t[2]=i),i}function Ki(e){let t=(0,Z.c)(4),{cloudEnabled:n}=e,r=n===void 0||n,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(zt,{variant:`icon`,children:(0,Q.jsx)(ve,{})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(Vt,{children:`No saved remote environments`}),t[1]=a):a=t[1];let o=r?`Click “Add environment” to pair another environment, or connect one from P4 Connect.`:`Click “Add environment” to pair another environment.`,s;return t[2]===o?s=t[3]:(s=(0,Q.jsxs)(Ut,{className:`min-h-52`,children:[i,(0,Q.jsxs)(Bt,{children:[a,(0,Q.jsx)(Ht,{children:o})]})]}),t[2]=o,t[3]=s),s}function qi(e){let t=(0,Z.c)(3),{primaryEnvironmentId:n,savedEnvironments:r}=e,i;return t[0]!==n||t[1]!==r?(i=Re()?(0,Q.jsx)(tr,{primaryEnvironmentId:n,savedEnvironments:r,empty:(0,Q.jsx)(Ki,{})}):r.length===0?(0,Q.jsx)(Ki,{cloudEnabled:!1}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Ji(){let e=window.desktopBridge,t=w(lt),{environments:n}=nt(),r=tt(),i=ht(En,{reportFailure:!1}),a=ht(Tn,{reportFailure:!1}),o=ht(ct.remove,{reportFailure:!1}),s=ht(ct.register,{reportFailure:!1}),c=et(),d=ht(ct.setEnabled,{reportFailure:!1}),f=r?.environmentId??null,m=wn(),h=m.data?.authenticated?m.data.permissions??m.data.scopes??null:null,g=e?null:m.data?.auth.policy??null,v=(0,$.useMemo)(()=>n.filter(e=>e.entry.target._tag!==`PrimaryConnectionTarget`),[n]),y=(0,$.useMemo)(()=>v.filter(e=>!Ue(e.entry.target)),[v]),b=(0,$.useMemo)(()=>u(e=>v.map(t=>({environment:t,updateStatus:e(st.updateStateAtom(t.environmentId)).status}))),[v]),x=w(b),T=(0,$.useMemo)(()=>x.flatMap(({environment:e,updateStatus:t})=>{let n=Vn(e.serverConfig),r=On(e.serverConfig),i=Ln(e.serverConfig);return!n||t===`running`||!e.entry.enabled||e.connection.phase!==`connected`||Ue(e.entry.target)||r===null||r===`desktop-managed`&&!i?[]:[{environmentId:e.environmentId,serverLabel:e.label,selfUpdate:r,installation:e.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:i,threadContinuation:$n(e.serverConfig),continueThreadsAfterServerUpdate:e.serverConfig?.settings.continueThreadsAfterServerUpdate??!1,targetVersion:n.clientVersion}]}),[x]),E=(0,$.useMemo)(()=>[...r?[r]:[],...v.filter(e=>e.entry.enabled)],[r,v]),D=(0,$.useMemo)(()=>{let e=new Set;for(let t of v){let n=t.entry.profile;if(t.entry.target._tag!==`SshConnectionTarget`||le(n)||n.value._tag!==`SshConnectionProfile`)continue;let r=n.value.target;e.add(r.alias),e.add(vr(r))}return e},[v]),[O,k]=(0,$.useState)(null),[M,N]=(0,$.useState)(null),[P,ee]=(0,$.useState)(()=>new Map),te=(0,$.useCallback)(e=>{ee(t=>new Map(t).set(e.id,e.credential))},[]),[ne,re]=(0,$.useState)(null),[ie,ae]=(0,$.useState)(null),[se,ce]=(0,$.useState)(!1),[ue,de]=(0,$.useState)(!1),[F,pe]=(0,$.useState)(null),[ge,_e]=(0,$.useState)(`remote`),[ye,be]=(0,$.useState)(``),[xe,Te]=(0,$.useState)(``),[Ee,De]=(0,$.useState)(``),[Oe,je]=(0,$.useState)(``),[L,Me]=(0,$.useState)(``),[Ne,Pe]=(0,$.useState)(!1),Fe=(0,$.useRef)(void 0),[z,B]=(0,$.useState)(null),[V,H]=(0,$.useState)(!1),[ze,Be]=(0,$.useState)(null),[U,Ve]=(0,$.useState)(!1),[He,We]=(0,$.useState)(!1),[W,$e]=(0,$.useState)(!1),[q,rt]=(0,$.useState)(!1),[it,ot]=(0,$.useState)(null),[J,ut]=(0,$.useState)(null),pt=J!==null,[gt,_t]=(0,$.useState)(null),[vt,yt]=(0,$.useState)(!1),[Rt,zt]=(0,$.useState)(String($r)),[Bt,Vt]=(0,$.useState)(null),Ht=r?.serverConfig??null,Ut=Vn(Ht),Yt=w(st.updateStateAtom(f)),[Xt,Zt]=(0,$.useState)(!1),Qt=$t(e=>e.defaultAdvertisedEndpointKey),en=$t(e=>e.setDefaultAdvertisedEndpointKey),tn=dt(f,C),nn=dt(f,S),rn=dt(f,Ce),an=dt(f,p),on=dt(f,fe),sn=!ke()&&an,cn=mt(tn&&f!==null?Rr.accessChanges({environmentId:f,input:null}):null),ln=mt(sn&&e?Gr:null),un=e!==void 0&&ue&&ge===`ssh`,dn=mt(un?Qr:null),pn=dn.refresh;(0,$.useEffect)(()=>{un&&pn()},[un,pn]);let yn=mt(sn&&e?Wn:null),X=yn.data,xn=it??yn.error,Nn=yn.isPending&&yn.data===null,Bn=dn.data??ti,Hn=(0,$.useMemo)(()=>Bn.filter(e=>{let t=vr(e);return!D.has(e.alias)&&!D.has(t)}),[Bn,D]),Un=(0,$.useMemo)(()=>qr(Hn,Ee),[Ee,Hn]),Kn=dn.isPending&&dn.data===null,qn=dn.error,Xn=e!==void 0&&(Kn||Hn.length>0),er=ln.data?.serverExposureState??null,tr=ln.data?.advertisedEndpoints??ei,nr=O??ln.error,rr=M??cn.error,ir=cn.isPending&&cn.data===null,Z=(0,$.useMemo)(()=>{let e=cn.data;return e?.type===`snapshot`?hi(e.payload.pairingLinks.map(e=>vi(e))):[]},[cn.data]),or=(0,$.useMemo)(()=>{let e=cn.data;return e?.type===`snapshot`?_i(e.payload.clientSessions.map(e=>yi(e))):[]},[cn.data]),cr=e?er?.mode===`network-accessible`:g===`remote-reachable`,lr=Rt.trim(),dr=Number(lr),fr=/^\d+$/u.test(lr)&&Number.isInteger(dr)&&dr>=1&&dr<=65535,mr=(0,$.useMemo)(()=>{if(!gt)return null;if(!fr||dr===$r)return gt.httpBaseUrl;try{let e=new URL(gt.httpBaseUrl);return e.port=String(dr),e.toString().replace(/\/$/u,``)}catch{return gt.httpBaseUrl}},[fr,dr,gt]),hr=(0,$.useCallback)(async t=>{if(e&&f!==null&&ft(f,`environment:maintain`)){Ve(!0),k(null);try{await e.setServerExposureMode(t?`network-accessible`:`local-only`),Kr(),We(!1),Ve(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to update network exposure.`;We(!1),k(t),K.add(Y({type:`error`,title:`Could not update network access`,description:t})),Ve(!1)}}},[e,f]),gr=(0,$.useCallback)(()=>{Bt!==null&&hr(Bt===`network-accessible`)},[hr,Bt]),_r=(0,$.useCallback)(async()=>{if(e&&f!==null&&ft(f,`environment:maintain`)&&fr){$e(!0),k(null);try{await e.setTailscaleServeEnabled({enabled:!0,port:dr}),Kr(),_t(null)}catch(e){let t=e instanceof Error?e.message:`Failed to configure Tailscale HTTPS.`;k(t),K.add(Y({type:`error`,title:`Could not set up Tailscale HTTPS`,description:t}))}finally{$e(!1)}}},[e,fr,dr,f]),yr=(0,$.useCallback)(e=>{zt(String(er?.tailscaleServePort??$r)),_t(e)},[er?.tailscaleServePort]),br=(0,$.useCallback)(async()=>{if(e&&f!==null&&ft(f,`environment:maintain`)){$e(!0),k(null);try{await e.setTailscaleServeEnabled({enabled:!1,port:er?.tailscaleServePort??$r}),Kr(),yt(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to disable Tailscale HTTPS.`;k(t),K.add(Y({type:`error`,title:`Could not disable Tailscale HTTPS`,description:t}))}finally{$e(!1)}}},[e,er,f]),xr=(0,$.useCallback)(e=>{yt(!0)},[]),Sr=(0,$.useCallback)(async e=>{if(f!==null&&ft(f,`access:write`)){re(e),N(null);try{await Cn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke pairing link.`;N(t),K.add(Y({type:`error`,title:`Could not revoke pairing link`,description:t}))}finally{re(null)}}},[f]),Cr=(0,$.useCallback)(async e=>{if(f!==null&&ft(f,`access:write`)){ae(e),N(null);try{await Sn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke client access.`;N(t),K.add(Y({type:`error`,title:`Could not revoke client access`,description:t}))}finally{ae(null)}}},[f]),wr=(0,$.useCallback)(async()=>{if(f!==null&&ft(f,`access:write`)){ce(!0),N(null);try{let e=await bn();K.add({type:`success`,title:e===1?`Revoked 1 other client`:`Revoked ${e} clients`,description:`Other paired clients will need a new pairing link before reconnecting.`})}catch(e){let t=e instanceof Error?e.message:`Failed to revoke other clients.`;N(t),K.add(Y({type:`error`,title:`Could not revoke other clients`,description:t}))}finally{ce(!1)}}},[f]),Er=(0,$.useCallback)(async e=>{H(!0),B(null);let t=await a({target:e,label:``,...F?{expectedEnvironmentId:F.environmentId}:{}});if(t._tag===`Failure`){R(t)||B(di(Ie(t))),H(!1);return}be(``),Te(``),De(``),je(``),Me(``),de(!1),K.add({type:`success`,title:F?`Route added`:`Environment connected`,description:F?`${F.label} can now be reached over SSH ${e.alias}.`:`${e.alias} is ready over an SSH-managed tunnel.`}),H(!1)},[a,F]),Dr=(0,$.useCallback)(async()=>{if(ge===`ssh`){let e;try{e=ci({host:Ee,username:Oe,port:L})}catch(e){B(di(e));return}await Er(e);return}H(!0),B(null);let e;try{e=ui({host:ye,pairingCode:xe})}catch(e){let t=e instanceof Error?e.message:`Failed to add backend.`;B(t),K.add(Y({type:`error`,title:`Could not add backend`,description:t})),H(!1);return}let t=await i({...e,...F?{expectedEnvironmentId:F.environmentId}:{}});if(t._tag===`Failure`){if(!R(t)){let e=Ie(t),n=e instanceof Error?e.message:`Failed to add backend.`;B(n),K.add(Y({type:`error`,title:`Could not add backend`,description:n}))}H(!1);return}be(``),Te(``),De(``),je(``),Me(``),de(!1),K.add(F?{type:`success`,title:`Route added`,description:`${F.label} now has another way to connect.`}:{type:`success`,title:`Backend added`,description:`The environment is saved and will reconnect on app startup.`}),H(!1)},[F,i,Er,ye,ge,xe,Ee,L,Oe]),Or=(0,$.useCallback)(e=>{e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&Ee.trim().length>0&&(e.preventDefault(),Dr())},[Dr,Ee]),kr=(0,$.useCallback)(async t=>{if(V||!e)return;H(!0),B(null),De(t.alias);let n;try{n=await e.resolveSshHost(t.alias)}catch(e){B(di(e)),H(!1);return}je(n.username??``),Me(n.port===null?``:String(n.port)),await Er(n)},[Er,e,V]),jr=(0,$.useCallback)(e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;let n=Ne&&Xn;if(n){let n=Kt(e,t,{platform:navigator.platform,context:{modelPickerOpen:!1}}),r=qt(n??``),i=r===null?void 0:Un[r];if(i){e.preventDefault(),e.stopPropagation(),Pe(!1),kr(i);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation();return}}let r=n&&Fe.current!==void 0;!e.defaultPrevented&&!r&&e.key===`Enter`&&Ee.trim().length>0&&(e.preventDefault(),Dr())},[Un,Dr,kr,Xn,t,Ee,Ne]),Nr=(0,$.useCallback)(async(e,t)=>{B(null);let n=await d({environmentId:e,enabled:t});if(n._tag===`Failure`&&!R(n)){let e=Ie(n),r=e instanceof Error?e.message:`Failed to switch the backend ${t?`on`:`off`}.`;B(r),K.add(Y({type:`error`,title:`Could not switch backend ${t?`on`:`off`}`,description:r}))}},[d]),Pr=(0,$.useCallback)(async e=>{let t=e.environmentId;Be(t),B(null);let n=await o(t);if(Be(null),n._tag===`Failure`&&!R(n)){let e=Ie(n),t=e instanceof Error?e.message:`Failed to remove backend.`;B(t),K.add(Y({type:`error`,title:`Could not remove backend`,description:t}))}},[o]),[Fr,Ir]=(0,$.useState)(null),Lr=(0,$.useCallback)(async e=>{if(e.relayManaged&&Re()){Ir(e);return}await at(`Remove ${e.label} from this device?\nThis forgets its pairing, credentials, and cached threads here. Switch it off instead to keep it saved.`,{variant:`destructive`})===!0&&await Pr(e)},[Pr]),zr=Z,Br=(0,$.useMemo)(()=>tr.find(xi)??null,[tr]),Vr=(0,$.useMemo)(()=>cr?tr.filter(e=>!xi(e)):[],[tr,cr]),Hr=(0,$.useMemo)(()=>Br?[...Vr,Br]:Vr,[Br,Vr]),Ur=(0,$.useMemo)(()=>bi(Vr,Qt),[Qt,Vr]),Wr=(0,$.useMemo)(()=>Ur??bi(Br?[Br]:[],Qt),[Qt,Ur,Br]),Jr=Wr?Si(Wr):null,Yr=(0,$.useCallback)(e=>{en(Si(e))},[en]),Xr=(0,$.useCallback)(e=>{let t=li(e);if(t){be(t.host),Te(t.pairingCode);return}be(e)},[]),Zr=e=>{let t=ge===e.mode;return(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":t,className:Se(`group flex min-h-24 items-start gap-3 rounded-lg border p-4 text-left`,t?`border-primary/50 bg-primary/5`:`border-border/60 hover:bg-muted/40`),disabled:V,onClick:()=>{_e(e.mode)},children:[e.icon?(0,Q.jsx)(`span`,{className:Se(`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md border`,t?`border-primary/30 bg-primary/10 text-primary`:`border-border/70 bg-background text-muted-foreground group-hover:text-foreground`),children:e.icon}):null,(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})},ii=()=>(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Host`}),(0,Q.jsx)(Dt,{value:ye,onChange:e=>Xr(e.target.value),placeholder:`backend.example.com`,disabled:V,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Pairing code`}),(0,Q.jsx)(Dt,{value:xe,onChange:e=>Te(e.target.value),placeholder:`PAIRCODE`,disabled:V,spellCheck:!1})]})]}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`span`,{className:`mt-1 block text-2xs text-muted-foreground`,children:`Paste a full pairing URL here to fill both fields automatically.`})})]}),ai=F!==null&&!F.relayManaged&&c.environments.has(F.environmentId)?c.environments.get(F.environmentId).environment:null,oi=async()=>{if(ai===null||F===null)return;H(!0);let e=await s(new Le({target:new Ae({environmentId:ai.environmentId,label:F.label})}));if(H(!1),e._tag===`Failure`){if(!R(e)){let t=Ie(e);B(t instanceof Error?t.message:`Could not add the route.`)}return}de(!1),K.add({type:`success`,title:`Route added`,description:`${F.label} falls back to P4 Connect when its other routes are unreachable.`})},si=()=>(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[ai===null?null:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This machine is on your P4 Connect account. Use it as a fallback route.`}),(0,Q.jsx)(I,{size:`xs`,variant:`outline`,disabled:V,onClick:()=>void oi(),children:`Add P4 Connect`})]}),ii(),z?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:z}):null,(0,Q.jsxs)(I,{variant:`outline`,className:`w-full`,disabled:V,onClick:()=>void Dr(),children:[(0,Q.jsx)(j,{className:`size-3.5`}),V?`Adding…`:F?`Add route`:`Add environment`]})]}),fi=()=>(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`block`,children:[(0,Q.jsx)(`label`,{htmlFor:`saved-backend-ssh-host`,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`SSH host or alias`}),(0,Q.jsxs)(St,{items:Un,itemToStringValue:e=>e.alias,mode:`none`,openOnInputClick:!0,open:Ne,onOpenChange:Pe,onItemHighlighted:e=>{Fe.current=e},value:Ee,onValueChange:(e,t)=>{if(De(e),t.reason!==`item-press`)return;let n=Un.find(t=>t.alias===e);n&&kr(n)},children:[(0,Q.jsx)(wt,{id:`saved-backend-ssh-host`,onKeyDown:jr,placeholder:`Search hosts or type devbox`,disabled:V,spellCheck:!1}),Xn?(0,Q.jsx)(Tt,{children:Kn?(0,Q.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:`Loading hosts…`}):Un.length>0?(0,Q.jsx)(xt,{className:`max-h-72`,children:Un.map((e,n)=>{let r=vr(e),i=n<9?Gt(n):null,a=i?Jt(t,i,navigator.platform):null;return(0,Q.jsxs)(Et,{value:e,className:`h-8 min-h-8 whitespace-nowrap`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:e.alias}),r===e.alias?(0,Q.jsx)(`span`,{className:`flex-1`}):(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:r}),a?(0,Q.jsx)(Ct,{className:`shrink-0`,children:a}):null]},`${e.alias}:${e.hostname}:${e.port??``}`)})}):(0,Q.jsxs)(bt,{className:`break-all`,children:[`No hosts match "`,Ee.trim(),`".`]})}):null]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_7rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Username`}),(0,Q.jsx)(Dt,{value:Oe,onChange:e=>je(e.target.value),onKeyDown:Or,placeholder:`root`,disabled:V,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Port`}),(0,Q.jsx)(Dt,{value:L,onChange:e=>Me(e.target.value),onKeyDown:Or,placeholder:`22`,inputMode:`numeric`,disabled:V,spellCheck:!1})]})]}),z||qn?(0,Q.jsx)(hn,{variant:`error`,children:(0,Q.jsx)(mn,{children:z??qn})}):null,(0,Q.jsxs)(I,{variant:`outline`,className:`w-full`,disabled:V,onClick:()=>void Dr(),children:[(0,Q.jsx)(j,{className:`size-3.5`}),V?`Adding…`:F?`Add route`:`Add environment`]})]})}),mi=()=>(0,Q.jsx)(Pn,{checked:er?.mode===`network-accessible`,disabled:!er||U,onCheckedChange:e=>{Vt(e?`network-accessible`:`local-only`),We(!0)},"aria-label":`Enable network access`}),Ci=e=>Xt?Vr.map(t=>{let n=Si(t);return(0,Q.jsx)(ji,{endpoint:t,isDefault:n===Jr,presentation:e,onSetDefault:Yr,onSetupTailscaleServe:yr,onDisableTailscaleServe:xr,isUpdatingTailscaleServe:W},t.id)}):null,wi=(0,$.useCallback)(async t=>{if(e&&f!==null&&ft(f,`environment:maintain`)){rt(!0),ot(null);try{await t(),zn()}catch(e){let t=e instanceof Error?e.message:`Failed to update WSL backend.`;ot(t),K.add(Y({type:`error`,title:`Could not change WSL backend`,description:t})),zn()}finally{rt(!1)}}},[e,f]),Ti=(0,$.useCallback)(()=>{ot(null),zn()},[]),Ei=(0,$.useMemo)(()=>n.some(e=>Ue(e.entry.target)),[n]),Di=(0,$.useCallback)(t=>{if(!e||!X)return;let n=X.distros.find(e=>e.isDefault)?.name??null;if(t===ri){if(!X.enabled&&!X.wslOnly)return;let t=X.wslOnly;if(Ei||t){ut({kind:`disable`,wasWslOnly:t});return}wi(()=>e.setWslBackendEnabled(!1));return}let r=t===ni?null:t,i=r??n;if(!X.enabled){ut({kind:`enable`,nextDistro:r});return}if((X.distro??n)!==i){if(Ei||X.wslOnly){ut({kind:`distro`,nextDistro:r});return}wi(()=>e.setWslDistro(r))}},[wi,e,X,Ei]),Oi=(0,$.useCallback)(t=>{if(!e||!J||J.kind!==`enable`)return;let n=J.nextDistro;ut(null);let r=X?.distro??null;wi(()=>An({bridge:e,mode:t,nextDistro:n,persistedDistro:r}))},[wi,e,X,J]),Ni=(0,$.useCallback)(t=>{e&&X&&X.wslOnly!==t&&ut({kind:`wsl-only`,nextValue:t})},[e,X]),Fi=(0,$.useCallback)(()=>{if(!e||!J)return;let t=J;if(t.kind!==`enable`){if(ut(null),t.kind===`disable`){wi(async()=>{let n=await e.setWslBackendEnabled(!1);return t.wasWslOnly?await e.setWslOnly(!1):n});return}if(t.kind===`distro`){wi(()=>e.setWslDistro(t.nextDistro));return}wi(()=>e.setWslOnly(t.nextValue))}},[wi,e,J]),Ii=()=>{if(!X)return Mn({state:null,error:xn})&&sn?(0,Q.jsx)(gn,{...Zn(`wsl-backend`),description:`Couldn't load the WSL backend state.`,status:(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}),control:(0,Q.jsx)(I,{size:`sm`,variant:`outline`,onClick:Ti,disabled:Nn,children:Nn?`Retrying…`:`Retry`})}):null;if(!Mn({state:X,error:xn}))return null;if(!X.available)return(0,Q.jsx)(gn,{...Zn(`wsl-backend`),description:`WSL is unavailable, so Windows is running instead. Turn WSL off to clear this preference.`,status:xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}):null,control:(0,Q.jsx)(I,{size:`sm`,variant:`outline`,disabled:q,onClick:()=>Di(ri),children:`Switch to Windows`})});let e=X.distros.find(e=>e.isDefault)?.name??null,t=X.enabled?X.distro??e??ni:ri,n=t===ri?`Off`:t===ni?`Default distro`:t;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(gn,{...Zn(`wsl-backend`),description:`Run the selected WSL distro alongside Windows. Projects remain on their current filesystem.`,status:xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:xn}):X.preflightError?(0,Q.jsxs)(`span`,{className:`block text-destructive`,children:[`WSL backend couldn't start: `,X.preflightError]}):null,control:(0,Q.jsxs)(Qe,{value:t,onValueChange:e=>{typeof e==`string`&&Di(e)},children:[(0,Q.jsx)(Ze,{size:`sm`,className:`w-full sm:w-56`,"aria-label":`WSL backend`,disabled:q,children:(0,Q.jsx)(Ye,{children:n})}),(0,Q.jsxs)(Xe,{align:`end`,alignItemWithTrigger:!1,children:[(0,Q.jsx)(Je,{hideIndicator:!0,value:ri,children:`Off`}),X.distros.length===0?(0,Q.jsx)(Je,{hideIndicator:!0,value:ni,children:`Default distro`}):X.distros.map(e=>(0,Q.jsxs)(Je,{hideIndicator:!0,value:e.name,children:[e.name,e.isDefault?` (default)`:``]},e.name))]})]})}),X.enabled?(0,Q.jsx)(gn,{title:`WSL only`,description:`Run only the WSL backend. P4 Code restarts when this changes.`,className:`bg-muted/20 pl-7 sm:pl-8`,control:(0,Q.jsx)(Pn,{checked:X.wslOnly,disabled:q,onCheckedChange:e=>Ni(e),"aria-label":`Run WSL only`})}):null]})},Li=()=>(0,Q.jsx)(gn,{title:Zn(`tailscale-https`).title,description:Br?Br.status===`available`?Br.httpBaseUrl:`Use Tailscale Serve to expose this backend through a MagicDNS HTTPS URL.`:`Start Tailscale to set up HTTPS access through MagicDNS.`,control:Br?(0,Q.jsx)(Pn,{checked:Br.status===`available`,disabled:W,onCheckedChange:e=>{if(e){yr(Br);return}xr(Br)},"aria-label":`Enable Tailscale HTTPS`}):null}),Ri=e=>(0,Q.jsxs)(Q.Fragment,{children:[rr?(0,Q.jsx)(`div`,{className:pi(e),children:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:rr})}):null,(0,Q.jsx)(Ai,{endpointUrl:er?.endpointUrl,endpoints:Hr,defaultEndpointKey:Jr,presentation:e,isLoading:ir,pairingLinks:zr,createdPairingCredentials:P,clientSessions:or,revokingPairingLinkId:ne,revokingClientSessionId:ie,onRevokePairingLink:Sr,onRevokeClientSession:Cr,canRevoke:nn})]}),zi=()=>(0,Q.jsx)(gn,{title:Zn(`network-access`).title,description:cr?(0,Q.jsx)(Mi,{endpoint:Ur,hiddenEndpointCount:Math.max(Vr.length-1,0),expanded:Xt,onToggleExpanded:()=>Zt(e=>!e),fallback:er?.endpointUrl?`Reachable at ${er.endpointUrl}`:er?.advertisedHost?`Exposed on all interfaces. Pairing links use ${er.advertisedHost}.`:`Exposed on all interfaces.`}):er?`Limited to this machine.`:`Loading…`,status:nr?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:nr}):null,control:mi()}),Bi=()=>(0,Q.jsx)(gn,{title:Zn(`network-access`).title,description:e?`This connection cannot view or change network exposure.`:g===`remote-reachable`?`Remote access is already configured. Change network exposure where the server starts.`:g===`loopback-browser`?`Only this machine can connect. Restart with a non-loopback host for remote pairing.`:`Network exposure information is unavailable.`,control:!e&&(g===`remote-reachable`||g===`loopback-browser`)?(0,Q.jsxs)(qe,{children:[(0,Q.jsx)(Ge,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(Pn,{checked:cr,disabled:!0,"aria-label":`Enable network access`})})}),(0,Q.jsx)(Ke,{side:`top`,children:`Network exposure changes restart the backend and must be controlled where the server process is launched.`})]}):void 0}),Vi=(0,Q.jsx)(Q.Fragment,{children:f===null?(0,Q.jsxs)(vn,{...Zn(`connections-environment`),children:[(0,Q.jsx)(gn,{title:`No environment selected`,description:`Connect an environment to view its settings and access.`}),(0,Q.jsx)(ur,{}),rn||on?(0,Q.jsx)(Gi,{canReadRelay:rn,canManageRelay:on}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(vn,{...Zn(`connections-environment`),title:r?.label??(e?`This machine`:`Primary environment`),icon:(0,Q.jsx)(fn,{"aria-hidden":!0,kind:Ht?me(Ht):`desktop`,className:`size-4`}),headerAction:f===null?null:(0,Q.jsxs)(l,{children:[(0,Q.jsx)(he,{render:(0,Q.jsx)(I,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`More actions for this machine`}),children:(0,Q.jsx)(_,{className:`size-3.5`})}),(0,Q.jsx)(A,{align:`end`,children:(0,Q.jsx)(pr,{environmentId:f,serverConfig:Ht})})]}),children:[(0,Q.jsx)(ur,{}),sn?(0,Q.jsx)(gn,{title:`Version`,description:Yt.status===`idle`?[Ht?.environment.serverVersion??null,r?.displayUrl??null].filter(e=>e!==null).join(` · `)||`Loading…`:(0,Q.jsx)(Jn,{state:Yt}),control:Ut&&f!==null&&Yt.status!==`running`?(0,Q.jsx)(Yn,{size:`sm`,environmentId:f,serverLabel:r?`${r.label} server`:`server`,selfUpdate:On(Ht),installation:Ht?.environment.capabilities.serverInstallation,desktopAppUpdate:Ln(Ht),threadContinuation:$n(Ht),targetVersion:Ut.clientVersion,label:Yt.status===`failed`?`Retry update`:`Update to ${Ut.clientVersion}`}):Yt.status===`idle`&&Ht?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up to date`}):void 0}):null,sn&&e?(0,Q.jsxs)(Q.Fragment,{children:[zi(),Ci(`endpoint-rail`),Li(),Ii(),rn||on?(0,Q.jsx)(Gi,{canReadRelay:rn,canManageRelay:on}):null]}):sn?(0,Q.jsxs)(Q.Fragment,{children:[Bi(),rn||on?(0,Q.jsx)(Gi,{canReadRelay:rn,canManageRelay:on}):null]}):null,r?(0,Q.jsxs)(`details`,{className:`group px-3 sm:px-4`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-md text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring [&::-webkit-details-marker]:hidden`,children:[`Permissions`,(0,Q.jsx)(we,{"aria-hidden":!0,className:`size-3 text-muted-foreground group-open:rotate-90`})]}),(0,Q.jsx)(sr,{environmentId:r.environmentId,connected:r.connection.phase===`connected`})]}):null]}),tn||nn?(0,Q.jsx)(ar,{id:`authorized-clients`,title:`Authorized clients`,summary:gi(or,zr),control:nn?(0,Q.jsx)(ki,{delegatableScopes:h??[],onPairingLinkCreated:te,clientSessions:tn&&cn.error===null&&cn.data?.type===`snapshot`?or:null,isRevokingOtherClients:se,onRevokeOtherClients:wr}):void 0,children:(0,Q.jsx)(Ot,{scrollFade:!0,chainVerticalScroll:!0,className:`max-h-[22.5rem]`,"data-testid":`authorized-clients-scroll-area`,children:tn?Ri(`current`):(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`This connection can create access links but cannot view authorized clients.`})})}):null,(0,Q.jsx)(Dn,{open:He&&sn,onOpenChange:e=>{U||We(e)},onOpenChangeComplete:e=>{e||Vt(null)},children:(0,Q.jsxs)(kn,{children:[(0,Q.jsxs)(Rn,{children:[(0,Q.jsx)(jn,{children:Bt===`network-accessible`?`Enable network access?`:`Disable network access?`}),(0,Q.jsx)(Fn,{children:Bt===`network-accessible`?`Let your other devices connect to P4 Code over the network. Pair devices to give them access. P4 Code will restart.`:`Devices connected over your local network will disconnect. Existing tunnels, such as P4 Connect or Tailscale HTTPS, keep working. P4 Code will restart.`})]}),(0,Q.jsxs)(In,{children:[(0,Q.jsx)(Qn,{disabled:U,render:(0,Q.jsx)(I,{variant:`outline`,disabled:U}),children:(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:`Cancel`})}),(0,Q.jsxs)(I,{variant:`default`,onClick:gr,disabled:!sn||Bt===null||U,children:[U&&(0,Q.jsx)(G,{size:`sm`}),(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:U?`Restarting…`:Bt===`network-accessible`?`Restart and enable`:`Restart and disable`})]})]})]})}),(0,Q.jsx)(Dn,{open:pt&&sn,onOpenChange:e=>{q||e||ut(null)},children:(0,Q.jsxs)(kn,{children:[(0,Q.jsxs)(Rn,{children:[(0,Q.jsx)(jn,{children:J?.kind===`disable`?J.wasWslOnly?`Turn off WSL and switch back to Windows?`:`Disable WSL backend?`:J?.kind===`distro`?`Switch WSL distro?`:J?.kind===`enable`?`Start the WSL backend`:J?.nextValue?`Run only the WSL backend?`:`Re-enable the Windows backend?`}),(0,Q.jsx)(Fn,{children:J?.kind===`disable`?J.wasWslOnly?`P4 Code will restart on the Windows backend. Threads and projects opened against WSL stay safe inside the distro and become available again when you re-enable WSL.`:`The WSL backend will stop. Threads and projects opened against WSL stay safe inside the distro, but they'll be unavailable in P4 Code until you re-enable WSL.`:J?.kind===`distro`?`P4 Code will restart the WSL backend on the new distro. Sessions still running on the current distro will be interrupted.`:J?.kind===`enable`?`Run the WSL backend alongside the Windows one, or stop the Windows backend and use only WSL? You can change this later from Settings.`:J?.nextValue?`P4 Code will restart and start only the WSL backend. Your Windows-side projects won't be accessible until you turn this off again.`:`P4 Code will restart and bring the Windows backend back up alongside WSL.`})]}),(0,Q.jsxs)(In,{children:[(0,Q.jsx)(Qn,{disabled:q,render:(0,Q.jsx)(I,{variant:`outline`,disabled:q}),children:`Cancel`}),J?.kind===`enable`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(I,{variant:`outline`,onClick:()=>Oi(`wsl-only`),disabled:q||!sn,children:q?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):`Use only WSL`}),(0,Q.jsx)(I,{variant:`default`,onClick:()=>Oi(`both`),disabled:q||!sn,children:q?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):`Run both backends`})]}):(0,Q.jsx)(I,{variant:J?.kind===`disable`||J?.kind===`wsl-only`&&J.nextValue?`destructive`:`default`,onClick:Fi,disabled:q||!sn,children:q?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Applying…`]}):J?.kind===`disable`?J.wasWslOnly?`Switch to Windows`:`Disable WSL`:J?.kind===`distro`?`Switch distro`:J?.nextValue?`Restart and enable`:`Restart and disable`})]})]})}),(0,Q.jsx)(Dn,{open:vt&&sn,onOpenChange:e=>{W||yt(e)},children:(0,Q.jsxs)(kn,{children:[(0,Q.jsxs)(Rn,{children:[(0,Q.jsx)(jn,{children:`Disable Tailscale HTTPS?`}),(0,Q.jsx)(Fn,{children:`P4 Code will restart the local backend without Tailscale Serve.`})]}),(0,Q.jsxs)(In,{children:[(0,Q.jsx)(Qn,{disabled:W,render:(0,Q.jsx)(I,{variant:`outline`,disabled:W}),children:`Cancel`}),(0,Q.jsx)(I,{variant:`destructive`,onClick:()=>void br(),disabled:W||!sn,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Restarting…`]}):`Restart and disable`})]})]})}),(0,Q.jsx)(Lt,{open:gt!==null,onOpenChange:e=>{W||e||_t(null)},children:(0,Q.jsxs)(It,{className:`max-w-md`,children:[(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(At,{children:`Set up Tailscale HTTPS?`}),(0,Q.jsx)(Ft,{children:`P4 Code will restart the local backend with Tailscale Serve enabled and ask Tailscale to proxy HTTPS traffic to this backend.`})]}),(0,Q.jsxs)(Pt,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`HTTPS port`}),(0,Q.jsx)(Dt,{className:`mt-2`,type:`number`,inputMode:`numeric`,min:1,max:65535,step:1,value:Rt,onChange:e=>zt(e.target.value),disabled:W})]}),fr?null:(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:`Enter a port from 1 to 65535.`}),(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-muted/20 px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`HTTPS endpoint`}),(0,Q.jsxs)(qe,{children:[(0,Q.jsx)(Ge,{render:(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm text-foreground`,children:mr??`Pending MagicDNS endpoint`})}),mr?(0,Q.jsx)(Ke,{side:`top`,children:mr}):null]})]})]}),(0,Q.jsxs)(jt,{children:[(0,Q.jsx)(Nt,{disabled:W,render:(0,Q.jsx)(I,{variant:`outline`,disabled:W}),children:`Cancel`}),(0,Q.jsx)(I,{onClick:()=>void _r(),disabled:W||!fr,children:W?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(G,{size:`sm`}),`Restarting…`]}):`Enable`})]})]})})]})});return(0,Q.jsxs)(_n,{children:[Vi,(0,Q.jsxs)(vn,{...Zn(`remote-environments`),title:`Environments`,headerAction:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[T.length>0?(0,Q.jsx)(Gn,{targets:T,variant:`ghost-muted`}):null,(0,Q.jsxs)(Lt,{open:ue,onOpenChange:e=>{de(e),e?pe(null):B(null)},children:[(0,Q.jsxs)(qe,{children:[(0,Q.jsx)(Ge,{render:(0,Q.jsx)(Mt,{render:(0,Q.jsxs)(I,{size:`xs`,variant:`ghost-muted`,"aria-label":`Add environment`,children:[(0,Q.jsx)(j,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Add environment`})]})})}),(0,Q.jsx)(Ke,{side:`top`,children:`Add environment`})]}),(0,Q.jsxs)(It,{className:`max-h-[80dvh] sm:max-w-3xl`,children:[(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(At,{children:F?`Add a route to ${F.label}`:`Add Environment`}),(0,Q.jsx)(Ft,{children:F?`Pair this machine again over another address, such as its Tailscale name. It joins the existing routes instead of adding a second machine.`:`Pair another environment to this client.`})]}),(0,Q.jsx)(Pt,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Zr({mode:`remote`,title:`Remote link`,description:`Enter a backend host and pairing code.`,icon:(0,Q.jsx)(ve,{"aria-hidden":!0,className:`size-4`})}),e?Zr({mode:`ssh`,title:`SSH`,description:`Use local SSH config, agent, and tunnels for the backend.`,icon:(0,Q.jsx)(oe,{"aria-hidden":!0,className:`size-4`})}):null]}),(0,Q.jsx)(Wt,{children:ge===`ssh`?fi():si()})]})})]})]})]}),children:[y.map(e=>(0,Q.jsx)(Pi,{environment:e,removingEnvironmentId:ze,onSetEnabled:Nr,onRemove:Lr,onAddRoute:e=>{pe(e),B(null),de(!0)}},e.environmentId)),(0,Q.jsx)(qi,{primaryEnvironmentId:f,savedEnvironments:v})]}),Re()?(0,Q.jsx)(Mr,{environmentLabel:Fr?.label??null,onCancel:()=>Ir(null),onConfirm:()=>{Fr&&(Ir(null),Pr(Fr))}}):null,(0,Q.jsx)(Tr,{environments:E}),(0,Q.jsx)(Ar,{environments:E})]})}function Yi(e){let{kind:t}=e;K.add({type:`success`,title:t===`hosted-link`?`Hosted app link copied`:t===`link`?`Pairing URL copied`:`Pairing code copied`,description:t===`hosted-link`?`Open it in the browser on the device you want to connect.`:t===`link`?`Open it in the client you want to pair to this environment.`:`Paste it into another client to finish pairing.`})}function Xi(e){return Ti(e)?`hosted-link`:`link`}function Zi(e){return!e}function Qi(e){return e.currentTarget.select()}function $i(e){return e.currentTarget.select()}function ea(e){return e!==null}var ta=Ji;export{ta as component};
2
- //# sourceMappingURL=settings.connections-DhpKQ7ay.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Cb as n,Ed as r,HT as i,Kg as a,Lu as o,Pf as s,Sd as c,Su as l,Td as u,Vo as d,Wg as f,Xd as p,Zg as m,aT as h,cr as g,dE as _,dT as v,fT as y,hf as b,mT as x,qd as S,sr as C,t as w,uf as ee,uw as te,vT as T,wu as E}from"./utils-vKlT_s3D.js";import{L as ne,U as re}from"./runtime-BVzm9sLS.js";import{a as D,c as O,d as k,f as A,n as j,t as M}from"./tooltip-DH7_Fmka.js";import{i as N,p as P}from"./toast-Bkc7xsho.js";import{D as F,q as ie}from"./useSettings-DYKTOdxY.js";import{f as I}from"./server-97u7Iupv.js";import{i as ae,n as oe,t as se}from"./session-CPQQ27HG.js";import{n as ce}from"./query-fboCqXXy.js";import{t as le}from"./use-atom-command-JNR1Jqwn.js";import{a as L,o as R,u as ue}from"./timestampFormat-wac2e_Jz.js";import{n as de,t as fe}from"./toggle-group-CQtXH1ph.js";import{t as pe}from"./input-BZEAWLAC.js";import{t as z}from"./scroll-area-D4H8QGpd.js";import{B as me,P as he,i as ge,s as B,u as V}from"./settingsLayout-BdqCokK9.js";import{t as _e}from"./ConnectionStatusDot-B0ZKI-zI.js";import{Ni as H,Wa as ve,qa as ye}from"./main-DJbmaTSv.js";import{t as be}from"./usageAccess-BRuBlcgN.js";import{t as xe}from"./ExpandableText-DfTvwfDp.js";import{t as U}from"./formatBytes-D8LhsSVR.js";import{t as W}from"./SettingsScopeNotice-N6bcXfto.js";var G=_(),K=e(i(),1);function q(e){let t=(0,G.c)(19),{disabled:n,onSignal:r}=e,i;t[0]===r?i=t[1]:(i=()=>r(`SIGINT`),t[0]=r,t[1]=i);let a;t[2]!==n||t[3]!==i?(a=(0,K.jsx)(D,{render:(0,K.jsx)(g,{disabled:n,"aria-label":`Send SIGINT`,tone:`muted`,onClick:i,children:`INT`})}),t[2]=n,t[3]=i,t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,K.jsx)(j,{side:`top`,children:`Send SIGINT`}),t[5]=o):o=t[5];let s;t[6]===a?s=t[7]:(s=(0,K.jsxs)(M,{children:[a,o]}),t[6]=a,t[7]=s);let c;t[8]===r?c=t[9]:(c=()=>r(`SIGKILL`),t[8]=r,t[9]=c);let l;t[10]!==n||t[11]!==c?(l=(0,K.jsx)(D,{render:(0,K.jsx)(g,{disabled:n,"aria-label":`Send SIGKILL`,tone:`destructive`,onClick:c,children:`KILL`})}),t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(j,{side:`top`,children:`Send SIGKILL`}),t[13]=u):u=t[13];let d;t[14]===l?d=t[15]:(d=(0,K.jsxs)(M,{children:[l,u]}),t[14]=l,t[15]=d);let f;return t[16]!==s||t[17]!==d?(f=(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[s,d]}),t[16]=s,t[17]=d,t[18]=f):f=t[18],f}var J=e(t(),1);function Se(e){let t=(0,G.c)(10),n=F(),r=e===void 0?n?.environmentId??null:e,i=ae(r,f),a;t[0]!==i||t[1]!==r?(a=r===null||!i?null:I.resourceTelemetry({environmentId:r,input:{}}),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o=ce(a),s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s={reportFailure:!1},t[3]=s):s=t[3];let c=le(I.retryResourceTelemetry,s),l;t[4]!==r||t[5]!==c?(l=async()=>{if(r===null)throw Error(`No environment is selected.`);if(!oe(r,`environment:maintain`)||!oe(r,`diagnostics:read`))throw Error(`This connection cannot restart the resource monitor.`);let e=await c({environmentId:r,input:{}});if(e._tag===`Failure`)throw te(e.cause);return e.value.snapshot},t[4]=r,t[5]=c,t[6]=l):l=t[6];let u=l,d;return t[7]!==o||t[8]!==u?(d={...o,retry:u},t[7]=o,t[8]=u,t[9]=d):d=t[9],d}function Ce(e,t){let n=(0,G.c)(4),r=F(),i=t===void 0?r?.environmentId??null:t,a=ae(i,f),o;return n[0]!==a||n[1]!==i||n[2]!==e?(o=i===null||!a?null:I.resourceTelemetryHistory({environmentId:i,input:e}),n[0]=a,n[1]=i,n[2]=e,n[3]=o):o=n[3],ce(o)}function Y(e){return`${e.identity.pid}:${e.identity.startTimeMs}`}function we(e,t){let n=new Map;for(let t of e){let e=n.get(t.ppid)??[];e.push(t),n.set(t.ppid,e)}let r=new Set,i=e=>{for(let t of n.get(e)??[]){let e=Y(t);r.has(e)||(r.add(e),i(t.identity.pid))}};for(let n of e)t.has(Y(n))&&i(n.identity.pid);return e.filter(e=>!r.has(Y(e)))}function Te(e){return e.nativeStatus===null&&e.error!==null||e.nativeStatus===`degraded`||e.nativeStatus===`unavailable`||e.nativeStatus===`stopped`}function X(e){return e.value<=0?0:Math.max(e.minimumVisiblePercent,e.value/Math.max(1,e.max)*100)}function Ee(e){return Math.max(1,...e.map(e=>e.avgCpuPercent))}var De=[{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 Oe(e){return`${U(e)}/s`}function ke(e){let t=e/1e3;if(t<60)return`${t.toFixed(t>=10?1:2)}s`;let n=t/60;return n<60?`${n.toFixed(n>=10?1:2)}m`:`${(n/60).toFixed(2)}h`}function Ae(e){return e<1e3?`${Math.round(e)} µs`:e<1e6?`${(e/1e3).toFixed(2)} ms`:`${(e/1e6).toFixed(2)} s`}function je(e){if(e<1e3)return`${Math.max(0,Math.round(e))} ms`;let t=e/1e3;return`${t.toLocaleString(void 0,{maximumFractionDigits:1})} ${t===1?`second`:`seconds`}`}function Me(e){return`${e.identity.pid}:${e.identity.startTimeMs}`}function Ne(e){return`${e.identity.pid}:${e.identity.startTimeMs}`}function Pe(e){if(e.name.trim())return e.name;let t=(e.command.trim().split(/\s+/)[0]??e.command).replace(/^['"]|['"]$/g,``);return t.split(/[\\/]/).findLast(e=>e.length>0)??t}function Fe(e){switch(e){case`server`:return`Server`;case`server-child`:return`Backend child`;case`provider-root`:return`Provider`;case`terminal-root`:return`Terminal`;case`electron-main`:return`Electron main`;case`electron-renderer`:return`Renderer`;case`electron-gpu`:return`GPU`;case`electron-utility`:return`Electron utility`;case`resource-monitor`:return`Monitor`;case`unknown-t3`:return`P4 process`}}function Ie(e){return e===`resource-monitor`?`bg-warning`:e.startsWith(`electron-`)?`bg-info`:e===`server`?`bg-violet-500`:`bg-success`}function Le(e){switch(e){case`storage`:return`Storage bytes`;case`logical`:return`Logical bytes`;case`all-io`:return`All I/O bytes`;case`unavailable`:return`Unavailable`}}function Re(e,t){return e===`true`?t.true:e===`false`?t.false:`Unknown`}function ze(e){return e===`healthy`?`default`:e===`starting`||e===`degraded`?`warning`:`danger`}function Be(e){let t=(0,G.c)(20),{label:n,status:r,presentation:i}=e,a;t[0]!==i?.tone||t[1]!==r?(a=i?.tone??ze(r),t[0]=i?.tone,t[1]=r,t[2]=a):a=t[2];let o=a,s=o===`neutral`&&`border-border/70 bg-muted/45 text-muted-foreground`,c=o==="default"&&`border-success/25 bg-success/10 text-success-foreground`,l=o===`warning`&&`border-warning/30 bg-warning/10 text-warning-foreground`,u=o===`danger`&&`border-destructive/30 bg-destructive/10 text-destructive`,d;t[3]!==s||t[4]!==c||t[5]!==l||t[6]!==u?(d=w(`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-3xs font-semibold uppercase tracking-widest`,s,c,l,u),t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d):d=t[7];let f=o===`neutral`&&`bg-muted-foreground/55`,p=o==="default"&&`bg-success`,m=o===`warning`&&`bg-warning`,h=o===`danger`&&`bg-destructive`,g;t[8]!==h||t[9]!==f||t[10]!==p||t[11]!==m?(g=w(`size-1.5 rounded-full`,f,p,m,h),t[8]=h,t[9]=f,t[10]=p,t[11]=m,t[12]=g):g=t[12];let _;t[13]===g?_=t[14]:(_=(0,K.jsx)(`span`,{className:g}),t[13]=g,t[14]=_);let v=i?.label??r,y;return t[15]!==n||t[16]!==_||t[17]!==v||t[18]!==d?(y=(0,K.jsxs)(`span`,{className:d,children:[_,n,` `,v]}),t[15]=n,t[16]=_,t[17]=v,t[18]=d,t[19]=y):y=t[19],y}function Ve(e){let t=(0,G.c)(9),{sampledAt:r}=e;if(V(),!r){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`span`,{className:`text-2xs text-muted-foreground/55`,children:`Waiting for sample`}),t[0]=e):e=t[0],e}let i;t[1]===r?i=t[2]:(i=L(n(r)),t[1]=r,t[2]=i);let a=i;if(!a){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`span`,{className:`text-2xs text-muted-foreground/55`,children:`Waiting for sample`}),t[3]=e):e=t[3],e}let o;t[4]===a.value?o=t[5]:(o=(0,K.jsx)(`span`,{className:`font-mono tabular-nums`,children:a.value}),t[4]=a.value,t[5]=o);let s=a.suffix?` ${a.suffix}`:``,c;return t[6]!==o||t[7]!==s?(c=(0,K.jsxs)(`span`,{className:`text-2xs text-muted-foreground/60`,children:[`Updated `,o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function He(e){let t=(0,G.c)(19),{icon:n,label:r,value:i,detail:a,tone:o}=e,s=o===void 0?`default`:o,c;t[0]===n?c=t[1]:(c=(0,K.jsx)(`span`,{className:`text-muted-foreground/55 transition-colors group-hover:text-foreground/65`,children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=(0,K.jsx)(`span`,{className:`truncate`,children:r}),t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-3xs font-semibold uppercase tracking-widest text-muted-foreground/70`,children:[c,l]}),t[4]=c,t[5]=l,t[6]=u):u=t[6];let d=s===`warning`&&`text-warning-foreground`,f=s===`danger`&&`text-destructive`,p;t[7]!==d||t[8]!==f?(p=w(`mt-2.5 truncate font-mono text-2xl font-semibold tracking-tighter tabular-nums text-foreground`,d,f),t[7]=d,t[8]=f,t[9]=p):p=t[9];let m;t[10]!==p||t[11]!==i?(m=(0,K.jsx)(`div`,{className:p,children:i}),t[10]=p,t[11]=i,t[12]=m):m=t[12];let h;t[13]===a?h=t[14]:(h=a?(0,K.jsx)(`div`,{className:`mt-1.5 truncate text-3xs text-muted-foreground/60`,children:a}):null,t[13]=a,t[14]=h);let g;return t[15]!==u||t[16]!==m||t[17]!==h?(g=(0,K.jsxs)(`div`,{className:`group min-w-0 px-4 py-4 sm:px-5`,children:[u,m,h]}),t[15]=u,t[16]=m,t[17]=h,t[18]=g):g=t[18],g}function Ue(e){let t=(0,G.c)(37),{label:n,accentClass:r,aggregate:i}=e,a;t[0]===r?a=t[1]:(a=w(`absolute inset-x-5 top-0 h-0.5 rounded-full opacity-75`,r),t[0]=r,t[1]=a);let o;t[2]===a?o=t[3]:(o=(0,K.jsx)(`span`,{className:a}),t[2]=a,t[3]=o);let s;t[4]===n?s=t[5]:(s=(0,K.jsx)(`div`,{className:`text-3xs font-semibold uppercase tracking-widest text-muted-foreground/75`,children:n}),t[4]=n,t[5]=s);let c=i.processCount===1?`process`:`processes`,l;t[6]!==i.processCount||t[7]!==c?(l=(0,K.jsxs)(`div`,{className:`rounded-md bg-muted/55 px-1.5 py-0.5 font-mono text-3xs tabular-nums text-muted-foreground/70`,children:[i.processCount,` `,c]}),t[6]=i.processCount,t[7]=c,t[8]=l):l=t[8];let u;t[9]!==s||t[10]!==l?(u=(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[s,l]}),t[9]=s,t[10]=l,t[11]=u):u=t[11];let d;t[12]===i.currentCpuPercent?d=t[13]:(d=i.currentCpuPercent.toFixed(1),t[12]=i.currentCpuPercent,t[13]=d);let f=`${d}%`,p;t[14]===f?p=t[15]:(p=(0,K.jsx)(We,{label:`CPU`,value:f}),t[14]=f,t[15]=p);let m;t[16]===i.currentRssBytes?m=t[17]:(m=U(i.currentRssBytes),t[16]=i.currentRssBytes,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,K.jsx)(We,{label:`Memory`,value:m}),t[18]=m,t[19]=h);let g;t[20]===i.ioReadBytesPerSecond?g=t[21]:(g=Oe(i.ioReadBytesPerSecond),t[20]=i.ioReadBytesPerSecond,t[21]=g);let _;t[22]===g?_=t[23]:(_=(0,K.jsx)(We,{label:`Read`,value:g}),t[22]=g,t[23]=_);let v;t[24]===i.ioWriteBytesPerSecond?v=t[25]:(v=Oe(i.ioWriteBytesPerSecond),t[24]=i.ioWriteBytesPerSecond,t[25]=v);let y;t[26]===v?y=t[27]:(y=(0,K.jsx)(We,{label:`Write`,value:v}),t[26]=v,t[27]=y);let b;t[28]!==h||t[29]!==_||t[30]!==y||t[31]!==p?(b=(0,K.jsxs)(`div`,{className:`mt-3.5 grid grid-cols-2 gap-x-4 gap-y-2.5`,children:[p,h,_,y]}),t[28]=h,t[29]=_,t[30]=y,t[31]=p,t[32]=b):b=t[32];let x;return t[33]!==b||t[34]!==o||t[35]!==u?(x=(0,K.jsxs)(`div`,{className:`relative overflow-hidden border-t border-border/60 px-4 py-4 first:border-t-0 md:border-t-0 md:border-l md:first:border-l-0 sm:px-5`,children:[o,u,b]}),t[33]=b,t[34]=o,t[35]=u,t[36]=x):x=t[36],x}function We(e){let t=(0,G.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,K.jsx)(`div`,{className:`text-3xs font-semibold uppercase tracking-widest text-muted-foreground/45`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,K.jsx)(`div`,{className:`truncate font-mono text-xs font-medium tabular-nums text-foreground/90`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,K.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ge(e){let t=(0,G.c)(21),{label:n,health:r}=e,i;t[0]!==r.lastError||t[1]!==r.status?(i=r.status===`unavailable`&&h(r.lastError,Je),t[0]=r.lastError,t[1]=r.status,t[2]=i):i=t[2];let a=i,o;t[3]===n?o=t[4]:(o=(0,K.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:n}),t[3]=n,t[4]=o);let s;t[5]!==a||t[6]!==r.lastError?(s=a?`Available when this page runs inside the desktop app.`:T(r.lastError,{onNone:qe,onSome:Ke}),t[5]=a,t[6]=r.lastError,t[7]=s):s=t[7];let c;t[8]===s?c=t[9]:(c=(0,K.jsx)(`div`,{className:`mt-1 text-2xs leading-relaxed text-muted-foreground/65`,children:s}),t[8]=s,t[9]=c);let l;t[10]!==o||t[11]!==c?(l=(0,K.jsxs)(`div`,{className:`min-w-0`,children:[o,c]}),t[10]=o,t[11]=c,t[12]=l):l=t[12];let u;t[13]===a?u=t[14]:(u=a?{label:`Desktop only`,tone:`neutral`}:void 0,t[13]=a,t[14]=u);let d;t[15]!==r.status||t[16]!==u?(d=(0,K.jsx)(Be,{label:``,status:r.status,presentation:u}),t[15]=r.status,t[16]=u,t[17]=d):d=t[17];let f;return t[18]!==l||t[19]!==d?(f=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-t border-border/50 py-3 first:border-t-0`,children:[l,d]}),t[18]=l,t[19]=d,t[20]=f):f=t[20],f}function Ke(e){return e}function qe(){return`No reported errors`}function Je(e){return e.includes(`'web' mode`)}function Ye(e){let t=(0,G.c)(10),{label:n,value:r,valueClassName:i}=e,a;t[0]===n?a=t[1]:(a=(0,K.jsx)(`span`,{className:`text-2xs text-muted-foreground/75`,children:n}),t[0]=n,t[1]=a);let o;t[2]===i?o=t[3]:(o=w(`min-w-0 truncate text-right font-mono text-2xs tabular-nums text-foreground/85`,i),t[2]=i,t[3]=o);let s;t[4]!==o||t[5]!==r?(s=(0,K.jsx)(`span`,{className:o,children:r}),t[4]=o,t[5]=r,t[6]=s):s=t[6];let c;return t[7]!==a||t[8]!==s?(c=(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4 border-t border-border/50 py-2.5 first:border-t-0`,children:[a,s]}),t[7]=a,t[8]=s,t[9]=c):c=t[9],c}function Xe(e){let t=(0,G.c)(8),{selectedWindowMs:n,onSelect:r}=e,i=String(n),a;t[0]===i?a=t[1]:(a=[i],t[0]=i,t[1]=a);let o;t[2]===r?o=t[3]:(o=e=>{let t=De.find(t=>String(t.windowMs)===e[0]);t&&r(t.windowMs)},t[2]=r,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=De.map(Ze),t[4]=s):s=t[4];let c;return t[5]!==a||t[6]!==o?(c=(0,K.jsx)(de,{"aria-label":`Resource history period`,variant:`segmented`,value:a,onValueChange:o,children:s}),t[5]=a,t[6]=o,t[7]=c):c=t[7],c}function Ze(e){return(0,K.jsx)(fe,{value:String(e.windowMs),children:e.label},e.windowMs)}function Qe(e){let t=(0,G.c)(15),{buckets:r}=e,i,a,o,s;if(t[0]!==r){let e=Ee(r),c=Math.max(1,...r.map($e));o=`border-t border-border/60 px-4 py-4 sm:px-5`;let l;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-3 rounded-full bg-foreground/70`}),` CPU average`]}),t[5]=l):l=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-3 rounded-full bg-info/70`}),` I/O reads`]}),t[6]=u):u=t[6],t[7]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-x-4 gap-y-1 text-3xs text-muted-foreground/65`,children:[l,u,(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`h-1.5 w-3 rounded-full bg-warning/80`}),` I/O writes`]})]}),t[7]=s):s=t[7],i=`flex h-32 items-end gap-1 overflow-hidden rounded-lg border border-border/40 bg-muted/8 px-2 pt-3 pb-2`,a=r.map(t=>{let r=X({value:t.avgCpuPercent,max:e,minimumVisiblePercent:2}),i=X({value:t.ioReadBytes,max:c,minimumVisiblePercent:1}),a=X({value:t.ioWriteBytes,max:c,minimumVisiblePercent:1});return(0,K.jsxs)(M,{children:[(0,K.jsx)(D,{render:(0,K.jsxs)(`div`,{className:`grid h-full min-w-1 flex-1 grid-cols-3 items-end gap-px`,children:[(0,K.jsx)(`span`,{className:`block rounded-t-sm bg-foreground/65`,style:{height:`${r}%`}}),(0,K.jsx)(`span`,{className:`block rounded-t-sm bg-info/70`,style:{height:`${i}%`}}),(0,K.jsx)(`span`,{className:`block rounded-t-sm bg-warning/80`,style:{height:`${a}%`}})]})}),(0,K.jsx)(j,{side:`top`,className:`text-left`,children:(0,K.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,K.jsxs)(`div`,{children:[`CPU avg `,t.avgCpuPercent.toFixed(1),`%`]}),(0,K.jsxs)(`div`,{children:[`CPU peak `,t.maxCpuPercent.toFixed(1),`%`]}),(0,K.jsxs)(`div`,{children:[`Read `,U(t.ioReadBytes)]}),(0,K.jsxs)(`div`,{children:[`Write `,U(t.ioWriteBytes)]})]})})]},n(t.startedAt))}),t[0]=r,t[1]=i,t[2]=a,t[3]=o,t[4]=s}else i=t[1],a=t[2],o=t[3],s=t[4];let c;t[8]!==i||t[9]!==a?(c=(0,K.jsx)(`div`,{className:i,children:a}),t[8]=i,t[9]=a,t[10]=c):c=t[10];let l;return t[11]!==o||t[12]!==s||t[13]!==c?(l=(0,K.jsxs)(`div`,{className:o,children:[s,c]}),t[11]=o,t[12]=s,t[13]=c,t[14]=l):l=t[14],l}function $e(e){return e.ioReadBytes+e.ioWriteBytes}function et(e){let t=(0,G.c)(26),{process:n,collapsed:r,onToggle:i}=e,a;t[0]===n?a=t[1]:(a=Pe(n),t[0]=n,t[1]=a);let o=a,s=n.childPids.length>0,c=`${Math.min(n.depth,7)*10}px`,l;t[2]===c?l=t[3]:(l={paddingLeft:c},t[2]=c,t[3]=l);let u;t[4]!==r||t[5]!==s||t[6]!==o||t[7]!==i||t[8]!==n?(u=s?(0,K.jsx)(C,{size:`icon-micro`,variant:`ghost-muted`,onClick:()=>i(n),"aria-label":r?`Expand ${o}`:`Collapse ${o}`,children:(0,K.jsx)(O,{className:`size-3.5`,icon:r?A:k})}):(0,K.jsx)(`span`,{className:`size-5`,"aria-hidden":!0}),t[4]=r,t[5]=s,t[6]=o,t[7]=i,t[8]=n,t[9]=u):u=t[9];let d;t[10]===n.category?d=t[11]:(d=w(`size-1.5 rounded-full`,Ie(n.category)),t[10]=n.category,t[11]=d);let f;t[12]===d?f=t[13]:(f=(0,K.jsx)(`span`,{className:d}),t[12]=d,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,K.jsx)(D,{render:(0,K.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:o})}),t[14]=o,t[15]=p);let m=n.command||n.name,h;t[16]===m?h=t[17]:(h=(0,K.jsx)(j,{side:`top`,variant:`code`,children:m}),t[16]=m,t[17]=h);let g;t[18]!==p||t[19]!==h?(g=(0,K.jsxs)(M,{children:[p,h]}),t[18]=p,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==g||t[22]!==l||t[23]!==u||t[24]!==f?(_=(0,K.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[1.25rem_0.375rem_minmax(0,1fr)] items-center gap-2`,style:l,children:[u,f,g]}),t[21]=g,t[22]=l,t[23]=u,t[24]=f,t[25]=_):_=t[25],_}function tt(e){return e.category===`server-child`||e.category===`provider-root`||e.category===`terminal-root`}function nt(e){let t=(0,G.c)(10),{process:n,canMaintainEnvironment:r,signalingKeys:i,onSignal:a}=e;if(!tt(n)){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`span`,{className:`text-3xs text-muted-foreground/35`,children:`—`}),t[0]=e):e=t[0],e}let o;t[1]!==n||t[2]!==i?(o=i.has(Me(n)),t[1]=n,t[2]=i,t[3]=o):o=t[3];let s=!r||o,c;t[4]!==a||t[5]!==n?(c=e=>a(n,e),t[4]=a,t[5]=n,t[6]=c):c=t[6];let l;return t[7]!==s||t[8]!==c?(l=(0,K.jsx)(q,{disabled:s,onSignal:c}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function rt(e){let t=(0,G.c)(22),{processes:n,canMaintainEnvironment:r,signalingKeys:i,onSignal:a}=e,[o,s]=(0,J.useState)(it),c;t[0]!==o||t[1]!==n?(c=we(n,o),t[0]=o,t[1]=n,t[2]=c):c=t[2];let l=c,u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{let t=Me(e);s(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},t[3]=u):u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,K.jsxs)(`colgroup`,{children:[(0,K.jsx)(`col`,{className:`w-[20%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`}),(0,K.jsx)(`col`,{className:`w-[7%]`}),(0,K.jsx)(`col`,{className:`w-[8%]`}),(0,K.jsx)(`col`,{className:`w-[9%]`}),(0,K.jsx)(`col`,{className:`w-[9%]`}),(0,K.jsx)(`col`,{className:`w-[9%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`}),(0,K.jsx)(`col`,{className:`w-[8%]`}),(0,K.jsx)(`col`,{className:`w-[6%]`}),(0,K.jsx)(`col`,{className:`w-[4%]`})]}),t[4]=f):f=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,K.jsx)(`thead`,{className:`sticky top-0 z-10 border-b border-border/60 bg-card text-3xs uppercase tracking-widest text-muted-foreground/65`,children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Process`}),(0,K.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Category`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU Time`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Memory`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Read/s`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Write/s`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Read Total`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Write Total`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`PID`}),(0,K.jsx)(`th`,{className:`px-2 py-2 text-right font-semibold sm:pr-4`,children:`Kill`})]})}),t[5]=p):p=t[5];let m;t[6]===l.length?m=t[7]:(m=l.length===0?(0,K.jsx)(`tr`,{children:(0,K.jsx)(`td`,{colSpan:11,className:`px-4 py-5 text-xs text-muted-foreground sm:px-5`,children:`Waiting for the native process monitor.`})}):null,t[6]=l.length,t[7]=m);let h;if(t[8]!==r||t[9]!==o||t[10]!==a||t[11]!==i||t[12]!==l){let e;t[14]!==r||t[15]!==o||t[16]!==a||t[17]!==i?(e=e=>(0,K.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,K.jsx)(`td`,{className:`px-4 py-2 sm:pl-5`,children:(0,K.jsx)(et,{process:e,collapsed:o.has(Me(e)),onToggle:d})}),(0,K.jsx)(`td`,{className:`truncate px-3 py-2 text-2xs text-muted-foreground`,children:Fe(e.category)}),(0,K.jsxs)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:[e.cpuPercent.toFixed(1),`%`]}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:ke(e.cpuTimeMs)}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:U(e.residentBytes)}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-info-foreground`,children:Oe(e.ioReadBytesPerSecond)}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-warning-foreground`,children:Oe(e.ioWriteBytesPerSecond)}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:U(e.ioReadBytes)}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:(0,K.jsxs)(M,{children:[(0,K.jsx)(D,{render:(0,K.jsx)(`span`,{children:U(e.ioWriteBytes)})}),(0,K.jsx)(j,{side:`top`,children:Le(e.ioSemantics)})]})}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:e.identity.pid}),(0,K.jsx)(`td`,{className:`px-2 py-2 text-right sm:pr-4`,children:(0,K.jsx)(nt,{process:e,canMaintainEnvironment:r,signalingKeys:i,onSignal:a})})]},Me(e)),t[14]=r,t[15]=o,t[16]=a,t[17]=i,t[18]=e):e=t[18],h=l.map(e),t[8]=r,t[9]=o,t[10]=a,t[11]=i,t[12]=l,t[13]=h}else h=t[13];let g;return t[19]!==m||t[20]!==h?(g=(0,K.jsx)(`div`,{className:`border-t border-border/60`,children:(0,K.jsx)(z,{chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[min(68vh,48rem)] w-full max-w-full`,children:(0,K.jsxs)(`table`,{className:`w-full min-w-[1320px] table-fixed text-left text-xs`,children:[f,p,(0,K.jsxs)(`tbody`,{className:`divide-y divide-border/50`,children:[m,h]})]})})}),t[19]=m,t[20]=h,t[21]=g):g=t[21],g}function it(){return new Set}function at(e){let t=(0,G.c)(9),{processes:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsxs)(`colgroup`,{children:[(0,K.jsx)(`col`,{className:`w-[24%]`}),(0,K.jsx)(`col`,{className:`w-[11%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`}),(0,K.jsx)(`col`,{className:`w-[11%]`}),(0,K.jsx)(`col`,{className:`w-[11%]`}),(0,K.jsx)(`col`,{className:`w-[11%]`}),(0,K.jsx)(`col`,{className:`w-[7%]`}),(0,K.jsx)(`col`,{className:`w-[5%]`})]}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,K.jsx)(`thead`,{className:`sticky top-0 z-10 border-b border-border/60 bg-card text-3xs uppercase tracking-widest text-muted-foreground/65`,children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Process`}),(0,K.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Category`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU Time`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Peak CPU`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Peak Mem`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Read`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Write`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Samples`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold sm:pr-5`,children:`PID`})]})}),t[1]=i):i=t[1];let a;t[2]===n.length?a=t[3]:(a=n.length===0?(0,K.jsx)(`tr`,{children:(0,K.jsx)(`td`,{colSpan:9,className:`px-4 py-5 text-xs text-muted-foreground sm:px-5`,children:`No retained process samples in this window.`})}):null,t[2]=n.length,t[3]=a);let o;t[4]===n?o=t[5]:(o=n.map(ot),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s=(0,K.jsx)(`div`,{className:`border-t border-border/60`,children:(0,K.jsx)(z,{chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[28rem] w-full max-w-full`,children:(0,K.jsxs)(`table`,{className:`w-full min-w-[1020px] table-fixed text-left text-xs`,children:[r,i,(0,K.jsxs)(`tbody`,{className:`divide-y divide-border/50`,children:[a,o]})]})})}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function ot(e){return(0,K.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,K.jsx)(`td`,{className:`px-4 py-2 sm:pl-5`,children:(0,K.jsxs)(M,{children:[(0,K.jsx)(D,{render:(0,K.jsx)(`span`,{className:`block truncate font-medium text-foreground`,children:e.name||e.command})}),(0,K.jsx)(j,{side:`top`,variant:`code`,children:e.command||e.name})]})}),(0,K.jsx)(`td`,{className:`truncate px-3 py-2 text-2xs text-muted-foreground`,children:Fe(e.category)}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:ke(e.cpuTimeMs)}),(0,K.jsxs)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:[e.maxCpuPercent.toFixed(1),`%`]}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:U(e.peakRssBytes)}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-info-foreground`,children:U(e.ioReadBytes)}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-warning-foreground`,children:U(e.ioWriteBytes)}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:e.sampleCount}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground sm:pr-5`,children:e.identity.pid})]},Ne(e))}function st(e){let t=(0,G.c)(9),{entries:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsxs)(`colgroup`,{children:[(0,K.jsx)(`col`,{className:`w-[22%]`}),(0,K.jsx)(`col`,{className:`w-[28%]`}),(0,K.jsx)(`col`,{className:`w-[14%]`}),(0,K.jsx)(`col`,{className:`w-[14%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`}),(0,K.jsx)(`col`,{className:`w-[12%]`})]}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,K.jsx)(`thead`,{className:`border-b border-border/60 text-3xs uppercase tracking-widest text-muted-foreground/65`,children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Component`}),(0,K.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Operation`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Logical Read`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Logical Write`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Count`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold sm:pr-5`,children:`Time`})]})}),t[1]=i):i=t[1];let a;t[2]===n.length?a=t[3]:(a=n.length===0?(0,K.jsx)(`tr`,{children:(0,K.jsx)(`td`,{colSpan:6,className:`px-4 py-5 text-xs text-muted-foreground sm:px-5`,children:`No instrumented application I/O has been recorded yet.`})}):null,t[2]=n.length,t[3]=a);let o;t[4]===n?o=t[5]:(o=n.map(ct),t[4]=n,t[5]=o);let s;return t[6]!==a||t[7]!==o?(s=(0,K.jsx)(`div`,{className:`overflow-x-auto border-t border-border/60`,children:(0,K.jsxs)(`table`,{className:`w-full min-w-[720px] table-fixed text-left text-xs`,children:[r,i,(0,K.jsxs)(`tbody`,{className:`divide-y divide-border/50`,children:[a,o]})]})}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function ct(e){return(0,K.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,K.jsx)(`td`,{className:`truncate px-4 py-2 font-medium text-foreground sm:pl-5`,children:e.component}),(0,K.jsx)(`td`,{className:`truncate px-3 py-2 text-muted-foreground`,children:e.operation}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-info-foreground`,children:U(e.logicalReadBytes)}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-warning-foreground`,children:U(e.logicalWriteBytes)}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:e.count}),(0,K.jsxs)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground sm:pr-5`,children:[(e.durationMs/1e3).toFixed(2),`s`]})]},`${e.component}:${e.operation}`)}function lt(e){let t=(0,G.c)(207),{environmentId:n}=e,[i,c]=(0,J.useState)(9e5),d;t[0]===i?d=t[1]:(d=De.find(e=>e.windowMs===i)??De[1],t[0]=i,t[1]=d);let f=d,m=ae(n,a),h=Se(n),g=h.retry,_;t[2]!==f.bucketMs||t[3]!==f.windowMs?(_={windowMs:f.windowMs,bucketMs:f.bucketMs},t[2]=f.bucketMs,t[3]=f.windowMs,t[4]=_):_=t[4];let b=Ce(_,n),x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x={reportFailure:!1},t[5]=x):x=t[5];let S=le(I.signalProcess,x),[w,te]=(0,J.useState)(mt),O;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(O=new Set,t[6]=O):O=t[6];let k=(0,J.useRef)(O),A=(0,J.useRef)(n),P,F;t[7]===n?(P=t[8],F=t[9]):(P=()=>(A.current=n,()=>{A.current=null}),F=[n],t[7]=n,t[8]=P,t[9]=F),(0,J.useEffect)(P,F);let[se,ce]=(0,J.useState)(!1),L=h.data,R=L?.groups.allT3,ue;t[10]===S?ue=t[11]:(ue=async(e,t)=>{let n=A.current;if(n===null||!oe(n,`environment:maintain`))return;let r=Me(e);if(k.current.has(r))return;let i=new Set(k.current).add(r);k.current=i,te(i);let a=()=>{let e=new Set(k.current);e.delete(r),k.current=e,te(e)};if(t===`SIGKILL`){let n;try{n=await ie().dialogs.confirm(`Send SIGKILL to process ${e.identity.pid}? This cannot be handled by the process.`,{variant:`destructive`})}catch(e){let n=e;a(),N.add({type:`error`,title:`Could not confirm signal`,description:n instanceof Error?n.message:`Failed to send ${t}.`});return}if(!n){a();return}}if(A.current!==n||!oe(n,`environment:maintain`)){a();return}S({environmentId:n,input:{pid:e.identity.pid,startTimeMs:e.identity.startTimeMs,signal:t}}).then(n=>{if(n._tag===`Failure`){if(ne(n))return;throw re(n)}n.value.signaled||N.add({type:`error`,title:`Could not send ${t}`,description:v(n.value.message,()=>`Failed to send ${t} to process ${e.identity.pid}.`)})}).catch(e=>{N.add({type:`error`,title:`Could not send ${t}`,description:e instanceof Error?e.message:`Failed to send ${t}.`})}).finally(()=>{a()})},t[10]=S,t[11]=ue);let de=ue,fe;t[12]===g?fe=t[13]:(fe=()=>{let e=A.current;e!==null&&oe(e,`environment:maintain`)&&(ce(!0),g().catch(pt).finally(()=>{ce(!1)}))},t[12]=g,t[13]=fe);let pe=fe,z,me,he,ge,V,_e,H,ve,be,xe,W,q,Y,we,X,Ee,Ne,Pe,Fe;if(t[14]!==R||t[15]!==L||t[16]!==h.error||t[17]!==h.isPending||t[18]!==h.refresh){V=L?y(L.speedLimitPercent):null;let e=L?.health.native.status??null,n;t[38]!==e||t[39]!==h.error?(n=Te({nativeStatus:e,error:h.error}),t[38]=e,t[39]=h.error,t[40]=n):n=t[40],he=n,ge=L!==null&&(L.power.onBattery!==`unknown`||L.power.lowPowerMode!==`unknown`||L.power.idle!==`unknown`||L.power.locked!==`unknown`||L.power.thermalState!==`unknown`),me=B,Ee=`Resource monitor`,t[41]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,K.jsx)(l,{className:`size-4 text-muted-foreground`}),t[41]=Ne):Ne=t[41];let i;t[42]===L?i=t[43]:(i=L?(0,K.jsx)(Be,{label:`Native`,status:L.health.native.status}):null,t[42]=L,t[43]=i);let a=L?.readAt??null,o;t[44]===a?o=t[45]:(o=(0,K.jsx)(Ve,{sampledAt:a}),t[44]=a,t[45]=o);let c;t[46]===h.isPending?c=t[47]:(c=(0,K.jsx)(ye,{size:`xs`,refreshing:h.isPending}),t[46]=h.isPending,t[47]=c);let d;t[48]!==c||t[49]!==h.isPending||t[50]!==h.refresh?(d=(0,K.jsx)(D,{render:(0,K.jsx)(C,{size:`icon-micro`,variant:`ghost`,disabled:h.isPending,onClick:h.refresh,"aria-label":`Refresh resource telemetry`,children:c})}),t[48]=c,t[49]=h.isPending,t[50]=h.refresh,t[51]=d):d=t[51];let f;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,K.jsx)(j,{side:`top`,children:`Refresh telemetry snapshot`}),t[52]=f):f=t[52];let m;t[53]===d?m=t[54]:(m=(0,K.jsxs)(M,{children:[d,f]}),t[53]=d,t[54]=m),t[55]!==i||t[56]!==o||t[57]!==m?(Pe=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[i,o,m]}),t[55]=i,t[56]=o,t[57]=m,t[58]=Pe):Pe=t[58],we=`overflow-hidden rounded-2xl border border-border/70 bg-card shadow-sm/5`;let g;t[59]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`text-3xs font-semibold uppercase tracking-widest text-muted-foreground/70`,children:`P4 system footprint`}),(0,K.jsx)(`p`,{className:`mt-1 max-w-xl text-xs leading-relaxed text-muted-foreground`,children:`Live native counters for the server, providers, terminals, desktop processes, and the monitor itself.`})]}),t[59]=g):g=t[59];let _;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,K.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),t[60]=_):_=t[60];let v;t[61]===L?v=t[62]:(v=L?je(L.sampleIntervalMs):`...`,t[61]=L,t[62]=v),t[63]===v?X=t[64]:(X=(0,K.jsxs)(`div`,{className:`flex flex-col gap-3 border-b border-border/60 bg-linear-to-r from-muted/45 via-muted/20 to-transparent px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-5`,children:[g,(0,K.jsxs)(`div`,{className:`flex items-center gap-2 text-3xs text-muted-foreground/65`,children:[_,`Sampling every `,v]})]}),t[63]=v,t[64]=X),ve=`grid grid-cols-2 divide-x divide-y divide-border/55 md:grid-cols-3`;let b;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,K.jsx)(u,{className:`size-3.5`}),t[65]=b):b=t[65];let x;t[66]===R?x=t[67]:(x=R?`${R.currentCpuPercent.toFixed(1)}%`:`...`,t[66]=R,t[67]=x);let S;t[68]===R?S=t[69]:(S=R?`${ke(R.cpuTimeMs)} observed CPU time`:void 0,t[68]=R,t[69]=S),t[70]!==x||t[71]!==S?(be=(0,K.jsx)(He,{icon:b,label:`Current CPU`,value:x,detail:S}),t[70]=x,t[71]=S,t[72]=be):be=t[72];let w;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsx)(s,{className:`size-3.5`}),t[73]=w):w=t[73];let te;t[74]===R?te=t[75]:(te=R?U(R.currentRssBytes):`...`,t[74]=R,t[75]=te);let T;t[76]===R?T=t[77]:(T=R?`${U(R.peakRssBytes)} combined process peaks`:void 0,t[76]=R,t[77]=T),t[78]!==te||t[79]!==T?(xe=(0,K.jsx)(He,{icon:w,label:`Resident memory`,value:te,detail:T}),t[78]=te,t[79]=T,t[80]=xe):xe=t[80];let E;t[81]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,K.jsx)(l,{className:`size-3.5`}),t[81]=E):E=t[81];let ne=R?String(R.processCount):`...`,re=R?`${R.processStarts} starts · ${R.processExits} exits`:void 0;t[82]!==ne||t[83]!==re?(W=(0,K.jsx)(He,{icon:E,label:`Process count`,value:ne,detail:re}),t[82]=ne,t[83]=re,t[84]=W):W=t[84];let O;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,K.jsx)(ee,{className:`size-3.5`}),t[85]=O):O=t[85];let k;t[86]===R?k=t[87]:(k=R?Oe(R.ioReadBytesPerSecond):`...`,t[86]=R,t[87]=k);let A;t[88]===R?A=t[89]:(A=R?`${U(R.ioReadBytes)} observed`:void 0,t[88]=R,t[89]=A),t[90]!==k||t[91]!==A?(q=(0,K.jsx)(He,{icon:O,label:`Read throughput`,value:k,detail:A}),t[90]=k,t[91]=A,t[92]=q):q=t[92];let N;t[93]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,K.jsx)(r,{className:`size-3.5`}),t[93]=N):N=t[93];let P;t[94]===R?P=t[95]:(P=R?Oe(R.ioWriteBytesPerSecond):`...`,t[94]=R,t[95]=P);let F;t[96]===R?F=t[97]:(F=R?`${U(R.ioWriteBytes)} observed`:void 0,t[96]=R,t[97]=F);let ie=R&&R.ioWriteBytesPerSecond>=10485760?`danger`:R&&R.ioWriteBytesPerSecond>=1048576?`warning`:`default`;t[98]!==P||t[99]!==F||t[100]!==ie?(Y=(0,K.jsx)(He,{icon:N,label:`Write throughput`,value:P,detail:F,tone:ie}),t[98]=P,t[99]=F,t[100]=ie,t[101]=Y):Y=t[101],z=He,t[102]===Symbol.for(`react.memo_cache_sentinel`)?(Fe=(0,K.jsx)(p,{className:`size-3.5`}),t[102]=Fe):Fe=t[102],_e=`CPU speed limit`,H=L?V===null?`Unknown`:`${V.toFixed(0)}%`:`...`,t[14]=R,t[15]=L,t[16]=h.error,t[17]=h.isPending,t[18]=h.refresh,t[19]=z,t[20]=me,t[21]=he,t[22]=ge,t[23]=V,t[24]=_e,t[25]=H,t[26]=ve,t[27]=be,t[28]=xe,t[29]=W,t[30]=q,t[31]=Y,t[32]=we,t[33]=X,t[34]=Ee,t[35]=Ne,t[36]=Pe,t[37]=Fe}else z=t[19],me=t[20],he=t[21],ge=t[22],V=t[23],_e=t[24],H=t[25],ve=t[26],be=t[27],xe=t[28],W=t[29],q=t[30],Y=t[31],we=t[32],X=t[33],Ee=t[34],Ne=t[35],Pe=t[36],Fe=t[37];let Ie=L?`${L.power.thermalState} thermal state`:void 0,Le=V!==null&&V<80?`warning`:`default`,ze;t[103]!==z||t[104]!==_e||t[105]!==H||t[106]!==Ie||t[107]!==Le||t[108]!==Fe?(ze=(0,K.jsx)(z,{icon:Fe,label:_e,value:H,detail:Ie,tone:Le}),t[103]=z,t[104]=_e,t[105]=H,t[106]=Ie,t[107]=Le,t[108]=Fe,t[109]=ze):ze=t[109];let We;t[110]!==ve||t[111]!==be||t[112]!==xe||t[113]!==W||t[114]!==q||t[115]!==Y||t[116]!==ze?(We=(0,K.jsxs)(`div`,{className:ve,children:[be,xe,W,q,Y,ze]}),t[110]=ve,t[111]=be,t[112]=xe,t[113]=W,t[114]=q,t[115]=Y,t[116]=ze,t[117]=We):We=t[117];let Ke;t[118]===h.error?Ke=t[119]:(Ke=h.error?(0,K.jsxs)(`div`,{className:`flex items-start gap-2 border-t border-destructive/20 bg-destructive/5 px-4 py-3 text-xs text-destructive sm:px-5`,children:[(0,K.jsx)(E,{className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:h.error})]}):null,t[118]=h.error,t[119]=Ke);let qe;t[120]===L?qe=t[121]:(qe=L?(0,K.jsxs)(`div`,{className:`grid border-t border-border/60 bg-muted/10 md:grid-cols-3`,children:[(0,K.jsx)(Ue,{label:`Backend + agents`,accentClass:`bg-success/80`,aggregate:L.groups.backend}),(0,K.jsx)(Ue,{label:`Desktop`,accentClass:`bg-info/80`,aggregate:L.groups.electron}),(0,K.jsx)(Ue,{label:`Monitor overhead`,accentClass:`bg-warning/80`,aggregate:L.groups.monitor})]}):null,t[120]=L,t[121]=qe);let Je;t[122]!==we||t[123]!==X||t[124]!==We||t[125]!==Ke||t[126]!==qe?(Je=(0,K.jsxs)(`div`,{className:we,children:[X,We,Ke,qe]}),t[122]=we,t[123]=X,t[124]=We,t[125]=Ke,t[126]=qe,t[127]=Je):Je=t[127];let Ze;t[128]!==me||t[129]!==Ee||t[130]!==Ne||t[131]!==Pe||t[132]!==Je?(Ze=(0,K.jsx)(me,{title:Ee,icon:Ne,headerAction:Pe,children:Je}),t[128]=me,t[129]=Ee,t[130]=Ne,t[131]=Pe,t[132]=Je,t[133]=Ze):Ze=t[133];let $e;t[134]===Symbol.for(`react.memo_cache_sentinel`)?($e=(0,K.jsx)(p,{className:`size-4 text-muted-foreground`}),t[134]=$e):$e=t[134];let et;t[135]!==he||t[136]!==se||t[137]!==pe?(et=he?(0,K.jsxs)(C,{size:`xs`,variant:`outline`,disabled:se,onClick:pe,children:[(0,K.jsx)(ye,{size:`xs`,refreshing:se}),`Retry monitor`]}):null,t[135]=he,t[136]=se,t[137]=pe,t[138]=et):et=t[138];let tt;t[139]===Symbol.for(`react.memo_cache_sentinel`)?(tt=(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-3xs font-semibold uppercase tracking-widest text-muted-foreground/70`,children:[(0,K.jsx)(`span`,{className:`flex size-6 items-center justify-center rounded-md bg-muted/60`,children:(0,K.jsx)(o,{className:`size-3.5`})}),`Host state`]}),t[139]=tt):tt=t[139];let nt;t[140]!==ge||t[141]!==L?(nt=(0,K.jsxs)(`div`,{className:`px-4 py-4 sm:px-5`,children:[tt,ge&&L?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ye,{label:`Power source`,value:Re(L.power.onBattery,{true:`Battery`,false:`External power`})}),(0,K.jsx)(Ye,{label:`Low power mode`,value:Re(L.power.lowPowerMode,{true:`Enabled`,false:`Disabled`})}),(0,K.jsx)(Ye,{label:`Idle`,value:`${Re(L.power.idle,{true:`Idle`,false:`Active`})}${L.power.idleSeconds===null?``:` · ${Math.round(L.power.idleSeconds)}s`}`}),(0,K.jsx)(Ye,{label:`Session`,value:L.power.suspended?`Suspended`:Re(L.power.locked,{true:`Locked`,false:`Unlocked`})}),(0,K.jsx)(Ye,{label:`Thermal`,value:L.power.thermalState,valueClassName:L.power.thermalState===`serious`||L.power.thermalState===`critical`?`text-destructive`:void 0})]}):(0,K.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/70 bg-muted/20 px-4 py-5`,children:[(0,K.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`Desktop host signals not connected`}),(0,K.jsx)(`p`,{className:`mt-1.5 max-w-sm text-2xs leading-relaxed text-muted-foreground/70`,children:`Power, idle, lock, and thermal state are supplied by the desktop host. Process telemetry remains fully active in this browser session.`})]})]}),t[140]=ge,t[141]=L,t[142]=nt):nt=t[142];let it;t[143]===Symbol.for(`react.memo_cache_sentinel`)?(it=(0,K.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-3xs font-semibold uppercase tracking-widest text-muted-foreground/70`,children:[(0,K.jsx)(`span`,{className:`flex size-6 items-center justify-center rounded-md bg-muted/60`,children:(0,K.jsx)(p,{className:`size-3.5`})}),`Collection health`]}),t[143]=it):it=t[143];let ot;t[144]===L?ot=t[145]:(ot=(0,K.jsxs)(`div`,{className:`border-t border-border/60 px-4 py-4 md:border-t-0 sm:px-5`,children:[it,L?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Ge,{label:`Native process monitor`,health:L.health.native}),(0,K.jsx)(Ge,{label:`Electron main process`,health:L.health.desktop}),(0,K.jsx)(Ye,{label:`Collection time`,value:Ae(L.health.collectionDurationMicros)}),(0,K.jsx)(Ye,{label:`Process scan`,value:`${L.health.retainedProcessCount}/${L.health.scannedProcessCount} retained`}),(0,K.jsx)(Ye,{label:`Inaccessible`,value:String(L.health.inaccessibleProcessCount),valueClassName:L.health.inaccessibleProcessCount>0?`text-warning-foreground`:void 0}),(0,K.jsx)(Ye,{label:`Sidecar`,value:T(L.health.sidecarVersion,{onNone:ft,onSome:e=>`${e}${T(L.health.sidecarPid,{onNone:dt,onSome:ut})}`})}),(0,K.jsx)(Ye,{label:`Restarts`,value:String(L.health.restartCount)})]}):(0,K.jsx)(`div`,{className:`py-4 text-xs text-muted-foreground`,children:`Waiting for collector health.`})]}),t[144]=L,t[145]=ot);let ct;t[146]!==nt||t[147]!==ot?(ct=(0,K.jsxs)(`div`,{className:`grid overflow-hidden rounded-2xl border border-border/70 bg-card shadow-xs/5 md:grid-cols-2 md:divide-x md:divide-border/60`,children:[nt,ot]}),t[146]=nt,t[147]=ot,t[148]=ct):ct=t[148];let lt;t[149]!==et||t[150]!==ct?(lt=(0,K.jsx)(B,{title:`Host & collection`,icon:$e,headerAction:et,children:ct}),t[149]=et,t[150]=ct,t[151]=lt):lt=t[151];let ht;t[152]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,K.jsx)(ee,{className:`size-4 text-muted-foreground`}),t[152]=ht):ht=t[152];let gt;t[153]===i?gt=t[154]:(gt=(0,K.jsx)(Xe,{selectedWindowMs:i,onSelect:c}),t[153]=i,t[154]=gt);let _t;t[155]===b.isPending?_t=t[156]:(_t=(0,K.jsx)(ye,{size:`xs`,refreshing:b.isPending}),t[155]=b.isPending,t[156]=_t);let vt;t[157]!==b.isPending||t[158]!==b.refresh||t[159]!==_t?(vt=(0,K.jsx)(C,{size:`icon-micro`,variant:`ghost`,disabled:b.isPending,onClick:b.refresh,"aria-label":`Refresh resource history`,children:_t}),t[157]=b.isPending,t[158]=b.refresh,t[159]=_t,t[160]=vt):vt=t[160];let yt;t[161]!==gt||t[162]!==vt?(yt=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[gt,vt]}),t[161]=gt,t[162]=vt,t[163]=yt):yt=t[163];let bt;t[164]===b.error?bt=t[165]:(bt=b.error?(0,K.jsxs)(`div`,{className:`flex items-start gap-2 border-b border-destructive/20 bg-destructive/5 px-4 py-3 text-xs text-destructive sm:px-5`,children:[(0,K.jsx)(E,{className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:b.error})]}):null,t[164]=b.error,t[165]=bt);let Z;t[166]===b.data?.buckets?Z=t[167]:(Z=b.data?.buckets??[],t[166]=b.data?.buckets,t[167]=Z);let Q;t[168]===Z?Q=t[169]:(Q=(0,K.jsx)(Qe,{buckets:Z}),t[168]=Z,t[169]=Q);let xt;t[170]===b.data?.topProcesses?xt=t[171]:(xt=b.data?.topProcesses??[],t[170]=b.data?.topProcesses,t[171]=xt);let St;t[172]===xt?St=t[173]:(St=(0,K.jsx)(at,{processes:xt}),t[172]=xt,t[173]=St);let Ct;t[174]!==bt||t[175]!==Q||t[176]!==St?(Ct=(0,K.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-border/70 bg-card shadow-xs/5`,children:[bt,Q,St]}),t[174]=bt,t[175]=Q,t[176]=St,t[177]=Ct):Ct=t[177];let wt;t[178]!==yt||t[179]!==Ct?(wt=(0,K.jsx)(B,{title:`Resource timeline`,icon:ht,headerAction:yt,children:Ct}),t[178]=yt,t[179]=Ct,t[180]=wt):wt=t[180];let Tt;t[181]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=(0,K.jsx)(u,{className:`size-4 text-muted-foreground`}),t[181]=Tt):Tt=t[181];let $;t[182]===L?$=t[183]:($=L?(0,K.jsxs)(`span`,{className:`text-3xs text-muted-foreground/55`,children:[`Identity: `,(0,K.jsx)(`span`,{className:`font-mono`,children:`PID + start time`})]}):null,t[182]=L,t[183]=$);let Et;t[184]===L?.processes?Et=t[185]:(Et=L?.processes??[],t[184]=L?.processes,t[185]=Et);let Dt;t[186]!==m||t[187]!==de||t[188]!==w||t[189]!==Et?(Dt=(0,K.jsx)(`div`,{className:`overflow-hidden rounded-2xl border border-border/70 bg-card shadow-xs/5`,children:(0,K.jsx)(rt,{processes:Et,canMaintainEnvironment:m,signalingKeys:w,onSignal:de})}),t[186]=m,t[187]=de,t[188]=w,t[189]=Et,t[190]=Dt):Dt=t[190];let Ot;t[191]!==$||t[192]!==Dt?(Ot=(0,K.jsx)(B,{title:`Live process tree`,icon:Tt,headerAction:$,children:Dt}),t[191]=$,t[192]=Dt,t[193]=Ot):Ot=t[193];let kt,At;t[194]===Symbol.for(`react.memo_cache_sentinel`)?(kt=(0,K.jsx)(r,{className:`size-4 text-muted-foreground`}),At=(0,K.jsx)(`span`,{className:`text-3xs text-muted-foreground/55`,children:`Logical bytes by operation`}),t[194]=kt,t[195]=At):(kt=t[194],At=t[195]);let jt;t[196]===Symbol.for(`react.memo_cache_sentinel`)?(jt=(0,K.jsx)(`div`,{className:`bg-muted/15 px-4 py-3 text-2xs leading-relaxed text-muted-foreground sm:px-5`,children:`Native counters identify which process is reading or writing. These application-level counters identify known P4 Code operations so process spikes can be correlated with specific persistence and logging paths.`}),t[196]=jt):jt=t[196];let Mt;t[197]===L?.attribution.entries?Mt=t[198]:(Mt=L?.attribution.entries??[],t[197]=L?.attribution.entries,t[198]=Mt);let Nt;t[199]===Mt?Nt=t[200]:(Nt=(0,K.jsx)(B,{title:`Instrumented application I/O`,icon:kt,headerAction:At,children:(0,K.jsxs)(`div`,{className:`overflow-hidden rounded-2xl border border-border/70 bg-card shadow-xs/5`,children:[jt,(0,K.jsx)(st,{entries:Mt})]})}),t[199]=Mt,t[200]=Nt);let Pt;return t[201]!==Ze||t[202]!==lt||t[203]!==wt||t[204]!==Ot||t[205]!==Nt?(Pt=(0,K.jsxs)(K.Fragment,{children:[Ze,lt,wt,Ot,Nt]}),t[201]=Ze,t[202]=lt,t[203]=wt,t[204]=Ot,t[205]=Nt,t[206]=Pt):Pt=t[206],Pt}function ut(e){return` · PID ${e}`}function dt(){return``}function ft(){return`Unavailable`}function pt(e){N.add({type:`error`,title:`Could not restart resource monitor`,description:e instanceof Error?e.message:`The resource monitor retry failed.`})}function mt(){return new Set}var ht=[{key:`otlpTracesUrl`,label:`Traces`,signal:`traces`},{key:`otlpMetricsUrl`,label:`Metrics`,signal:`metrics`},{key:`otlpLogsUrl`,label:`Logs`,signal:`logs`}],gt=e=>/^https?:\/\/./i.test(e);function _t(e,t){if(e===``)return{label:`Off`,dot:`bg-muted-foreground/40`};if(t?.url!==e)return{label:`Not checked`,dot:`bg-muted-foreground/40`};let{result:n}=t;if(n===null)return{label:`Checking…`,dot:`bg-warning`};switch(n._tag){case`Accepted`:return{label:`Connected · ${Math.round(n.latencyMs)} ms`,dot:`bg-success`};case`Rejected`:return{label:`Rejected · HTTP ${n.status}`,dot:`bg-destructive`};case`Unreachable`:return{label:n.timedOut?`Timed out`:`Unreachable`,dot:`bg-destructive`}}}function vt(){let e=(0,G.c)(3),{environment:t,scope:n}=me();if(n.kind!==`environment`||!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsx)(B,{title:`OpenTelemetry export`,id:`telemetry-export`,children:(0,K.jsx)(W,{target:`environment`,children:`Choose one environment to configure its telemetry exports.`})}),e[0]=t):t=e[0],t}let r;return e[1]===t.environmentId?r=e[2]:(r=(0,K.jsx)(yt,{},t.environmentId),e[1]=t.environmentId,e[2]=r),r}function yt(){let{environment:e}=me(),t=he(e=>e.observability),[n,r]=(0,J.useState)({}),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(null),c=e?.environmentId,l=d(I.checkOtlpEndpoint.permissionAtom(c??null)),u=l&&e?.serverConfig?.environment.capabilities.otlpEndpointCheck===!0,[f,p]=(0,J.useState)(()=>Object.fromEntries(ht.filter(({key:e})=>gt(t[e])).map(({key:e})=>[e,{url:t[e],result:null}]))),m=le(I.updateSettings,{reportFailure:!0}),h=le(I.checkOtlpEndpoint),g={...t,...n},_=ht.filter(({key:e})=>g[e].trim()!==t[e]),v=_.length>0,y=e?.serverConfig?.observability,b=async(e,t,n)=>{if(!c)return;let r=await h({environmentId:c,input:{signal:t,url:n}});p(t=>{if(t[e]?.url!==n||t[e].result!==null)return t;let i={...t};return r._tag===`Success`?i[e]={url:n,result:r.value}:delete i[e],i})},x=(e,t,n)=>{gt(n)&&(p(t=>({...t,[e]:{url:n,result:null}})),b(e,t,n))},S=(0,J.useEffectEvent)(()=>{for(let{key:e,signal:t}of ht){let n=f[e];n?.result===null&&b(e,t,n.url)}});return(0,J.useEffect)(()=>{u&&S()},[u]),(0,K.jsx)(B,{title:`OpenTelemetry export`,id:`telemetry-export`,children:(0,K.jsxs)(`form`,{className:`grid gap-4 px-4 py-4 sm:px-5`,onSubmit:async t=>{if(t.preventDefault(),e&&!i){a(!0),s(null);try{(await m({environmentId:e.environmentId,input:{patch:{observability:Object.fromEntries(_.map(({key:e})=>[e,g[e]]))}}}))._tag===`Success`&&(r({}),s(`Saved. Restart the server to apply.`))}finally{a(!1)}}},children:[(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Send traces, metrics, and logs to an OTLP HTTP receiver. Restart the server to apply. Environment variables override these settings.`}),!l&&(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`This connection lacks permission to change settings on`,` `,e?.label??`the selected environment`,`.`]}),ht.map(({key:e,label:n,signal:a})=>{let o=g[e].trim(),c=u?_t(o,f[e]):null;return(0,K.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[c&&(0,K.jsx)(_e,{dotClassName:c.dot}),(0,K.jsxs)(H,{htmlFor:e,children:[n,` endpoint`]})]}),c&&(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:c.label})]}),(0,K.jsxs)(`div`,{className:`flex gap-2`,children:[(0,K.jsx)(pe,{id:e,size:`sm`,type:`url`,pattern:`[Hh][Tt][Tt][Pp][Ss]?://.*`,title:`Enter an HTTP or HTTPS endpoint, or leave empty to disable export.`,placeholder:`http://localhost:4318/v1/${a}`,value:g[e],disabled:i||!l,onChange:n=>{let i=n.target.value;r(n=>{let r={...n,[e]:i};return i.trim()===t[e]&&delete r[e],r}),s(null)}}),u&&(0,K.jsx)(C,{type:`button`,size:`sm`,variant:`outline`,disabled:!gt(o)||f[e]?.result===null,onClick:()=>void x(e,a,o),children:`Test`})]}),t[e]!==(y?.[e]??``)&&(0,K.jsxs)(`p`,{className:`break-all text-xs text-muted-foreground`,children:[`Running: `,y?.[e]||`Disabled`]})]},e)}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,K.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:o}),(0,K.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,K.jsx)(C,{type:`button`,size:`xs`,variant:`outline`,disabled:!v||i||!l,onClick:()=>{if(r({}),s(null),u)for(let{key:e,signal:n}of ht)f[e]?.url!==t[e]&&x(e,n,t[e])},children:`Discard`}),(0,K.jsx)(C,{type:`submit`,size:`xs`,disabled:!v||i||!l,children:i?`Saving…`:`Save`})]})]})]})})}var bt=new Intl.NumberFormat;function Z(e){return bt.format(e)}function Q(e){return e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(e>=1e4?1:2)} s`}function xt(e){if(e<1024)return`${e} B`;let t=[`KB`,`MB`,`GB`],n=-1,r=e;do r/=1024,n+=1;while(r>=1024&&n<t.length-1);return`${r.toFixed(r>=10?1:2)} ${t[n]}`}function St(e){return e?R(n(e)):`No trace records`}function Ct(e){return St(e).replaceAll(` `,`\xA0`)}function wt(e){return e.length<=32?e:`${e.slice(0,18)}...${e.slice(-10)}`}function Tt(e){return e?.includes(`not a live descendant`)??!1}function $(e){let t=(0,G.c)(17),{label:n,value:r,tooltip:i,tone:a}=e,o=a===void 0?`default`:a,s;t[0]===n?s=t[1]:(s=(0,K.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),t[0]=n,t[1]=s);let c;t[2]!==n||t[3]!==i?(c=i?(0,K.jsxs)(M,{children:[(0,K.jsx)(D,{render:(0,K.jsx)(`button`,{type:`button`,className:`cursor-pointer inline-flex size-3.5 shrink-0 items-center justify-center rounded-sm text-muted-foreground/60 hover:text-foreground`,"aria-label":`${n} details`,children:(0,K.jsx)(b,{className:`size-3`})})}),(0,K.jsx)(j,{side:`top`,children:i})]}):null,t[2]=n,t[3]=i,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==c?(l=(0,K.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5 text-2xs font-medium uppercase tracking-widest text-muted-foreground/70`,children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7];let u=o===`warning`&&`text-warning-foreground`,d=o===`danger`&&`text-destructive`,f;t[8]!==u||t[9]!==d?(f=w(`mt-1 truncate font-mono text-lg font-semibold tabular-nums text-foreground`,u,d),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==f||t[12]!==r?(p=(0,K.jsx)(`div`,{className:f,children:r}),t[11]=f,t[12]=r,t[13]=p):p=t[13];let m;return t[14]!==l||t[15]!==p?(m=(0,K.jsxs)(`div`,{className:`min-w-0 border-border/60 px-4 py-3 sm:px-5`,children:[l,p]}),t[14]=l,t[15]=p,t[16]=m):m=t[16],m}function Et(e){let t=(0,G.c)(6),{children:n}=e,r,i,a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 left-1/2 w-px bg-border/60`,"aria-hidden":!0}),i=(0,K.jsx)(`span`,{className:`pointer-events-none absolute inset-x-0 top-1/2 h-px bg-border/60 sm:hidden`,"aria-hidden":!0}),a=(0,K.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 left-1/4 hidden w-px bg-border/60 sm:block`,"aria-hidden":!0}),o=(0,K.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 left-3/4 hidden w-px bg-border/60 sm:block`,"aria-hidden":!0}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):(r=t[0],i=t[1],a=t[2],o=t[3]);let s;return t[4]===n?s=t[5]:(s=(0,K.jsxs)(`div`,{className:`relative grid grid-cols-2 sm:grid-cols-4`,children:[r,i,a,o,n]}),t[4]=n,t[5]=s),s}function Dt(e){let t=(0,G.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(`div`,{className:`px-4 py-4 text-xs text-muted-foreground sm:px-5`,children:n}),t[0]=n,t[1]=r),r}function Ot(e){let t=(0,G.c)(21),{headers:n,children:r,minTableWidth:i,columnWidths:a}=e,o=i===void 0?`min-w-[640px]`:i,s=a&&`table-fixed`,c;t[0]!==o||t[1]!==s?(c=w(`w-full text-left text-xs`,o,s),t[0]=o,t[1]=s,t[2]=c):c=t[2];let l;t[3]!==a||t[4]!==n?(l=a?(0,K.jsx)(`colgroup`,{children:n.map((e,t)=>(0,K.jsx)(`col`,{className:a[t]},e))}):null,t[3]=a,t[4]=n,t[5]=l):l=t[5];let u;if(t[6]!==a||t[7]!==n){let e;t[9]!==a||t[10]!==n.length?(e=(e,t)=>(0,K.jsx)(`th`,{className:w(`whitespace-nowrap px-4 py-2.5 font-semibold first:sm:pl-5 last:sm:pr-5`,!a&&t===n.length-1&&`w-px`),children:e.replaceAll(` `,`\xA0`)},e),t[9]=a,t[10]=n.length,t[11]=e):e=t[11],u=n.map(e),t[6]=a,t[7]=n,t[8]=u}else u=t[8];let d;t[12]===u?d=t[13]:(d=(0,K.jsx)(`thead`,{className:`border-b border-border/60 text-2xs uppercase tracking-widest text-muted-foreground/70`,children:(0,K.jsx)(`tr`,{children:u})}),t[12]=u,t[13]=d);let f;t[14]===r?f=t[15]:(f=(0,K.jsx)(`tbody`,{className:`divide-y divide-border/60`,children:r}),t[14]=r,t[15]=f);let p;return t[16]!==c||t[17]!==l||t[18]!==d||t[19]!==f?(p=(0,K.jsx)(z,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`w-full max-w-full`,children:(0,K.jsxs)(`table`,{className:c,children:[l,d,f]})}),t[16]=c,t[17]=l,t[18]=d,t[19]=f,t[20]=p):p=t[20],p}function kt(e){let t=(0,G.c)(25),{traceId:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={target:`trace ID`,timeout:1200},t[0]=r):r=t[0];let{copyToClipboard:i,isCopied:a}=P(r),o;t[1]===n?o=t[2]:(o=wt(n),t[1]=n,t[2]=o);let s;t[3]===o?s=t[4]:(s=(0,K.jsx)(D,{render:(0,K.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-2xs`,children:o})}),t[3]=o,t[4]=s);let l;t[5]===n?l=t[6]:(l=(0,K.jsx)(j,{side:`top`,variant:`code`,children:n}),t[5]=n,t[6]=l);let u;t[7]!==s||t[8]!==l?(u=(0,K.jsxs)(M,{children:[s,l]}),t[7]=s,t[8]=l,t[9]=u):u=t[9];let d=a?`Copied trace ID`:`Copy trace ID`,f;t[10]!==i||t[11]!==n?(f=()=>i(n),t[10]=i,t[11]=n,t[12]=f):f=t[12];let p;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,K.jsx)(c,{className:`size-3`}),t[13]=p):p=t[13];let m;t[14]!==d||t[15]!==f?(m=(0,K.jsx)(D,{render:(0,K.jsx)(C,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":d,onClick:f,children:p})}),t[14]=d,t[15]=f,t[16]=m):m=t[16];let h=a?`Copied`:`Copy full trace ID`,g;t[17]===h?g=t[18]:(g=(0,K.jsx)(j,{side:`top`,children:h}),t[17]=h,t[18]=g);let _;t[19]!==g||t[20]!==m?(_=(0,K.jsxs)(M,{children:[m,g]}),t[19]=g,t[20]=m,t[21]=_):_=t[21];let v;return t[22]!==_||t[23]!==u?(v=(0,K.jsxs)(`div`,{className:`flex w-full min-w-0 max-w-full items-center gap-2`,children:[u,_]}),t[22]=_,t[23]=u,t[24]=v):v=t[24],v}function At(e){let t=e.trim().split(/\s+/)[0];if(!t)return e;let n=t.replace(/^['"]|['"]$/g,``);return n.split(/[\\/]/).filter(Boolean).at(-1)??n}function jt(e){return e.depth>0?`Subprocess`:/\b(codex|claude|opencode|cursor)\b/i.test(e.command)?`Agent`:`Process`}function Mt(e){let t=(0,G.c)(22),{process:n,isExpanded:r,onToggle:i}=e,a;t[0]===n.command?a=t[1]:(a=At(n.command),t[0]=n.command,t[1]=a);let o=a,s=n.childPids.length>0,c=`${Math.min(n.depth,6)*10}px`,l;t[2]===c?l=t[3]:(l={paddingLeft:c},t[2]=c,t[3]=l);let u;t[4]!==s||t[5]!==r||t[6]!==o||t[7]!==i||t[8]!==n.pid?(u=s?(0,K.jsx)(C,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":r?`Collapse ${o}`:`Expand ${o}`,onClick:()=>i(n.pid),children:(0,K.jsx)(O,{className:`size-3.5`,icon:r?k:A})}):(0,K.jsx)(`span`,{className:`size-5 shrink-0`,"aria-hidden":`true`}),t[4]=s,t[5]=r,t[6]=o,t[7]=i,t[8]=n.pid,t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-success/80`}),t[10]=d):d=t[10];let f;t[11]===o?f=t[12]:(f=(0,K.jsx)(D,{render:(0,K.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:o})}),t[11]=o,t[12]=f);let p;t[13]===n.command?p=t[14]:(p=(0,K.jsx)(j,{side:`top`,variant:`code`,children:n.command}),t[13]=n.command,t[14]=p);let m;t[15]!==f||t[16]!==p?(m=(0,K.jsxs)(M,{children:[f,p]}),t[15]=f,t[16]=p,t[17]=m):m=t[17];let h;return t[18]!==l||t[19]!==u||t[20]!==m?(h=(0,K.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[1.25rem_0.375rem_minmax(0,1fr)] items-center gap-2`,style:l,children:[u,d,m]}),t[18]=l,t[19]=u,t[20]=m,t[21]=h):h=t[21],h}function Nt(e){let t=(0,G.c)(18),{processes:n,canMaintainEnvironment:r,signalingPid:i,onSignal:a,emptyLabel:o}=e,[s,c]=(0,J.useState)(Pt),l;if(t[0]!==s||t[1]!==n){l=[];let e=null;for(let t of n){if(e!==null){if(t.depth>e)continue;e=null}l.push(t),s.has(t.pid)&&(e=t.depth)}t[0]=s,t[1]=n,t[2]=l}else l=t[2];let u=l,d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},t[3]=d):d=t[3];let f=d,p;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,K.jsxs)(`colgroup`,{children:[(0,K.jsx)(`col`,{className:`w-[24%]`}),(0,K.jsx)(`col`,{className:`w-[8%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`}),(0,K.jsx)(`col`,{className:`w-[33%]`}),(0,K.jsx)(`col`,{className:`w-[8%]`}),(0,K.jsx)(`col`,{className:`w-[11%]`}),(0,K.jsx)(`col`,{className:`w-[6%]`})]}),t[4]=p):p=t[4];let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,K.jsx)(`thead`,{className:`sticky top-0 z-10 border-b border-border/60 bg-card text-2xs uppercase tracking-widest text-muted-foreground/70`,children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Name`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Memory`}),(0,K.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Command`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`PID`}),(0,K.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Type`}),(0,K.jsx)(`th`,{className:`p-2 text-right font-semibold sm:pr-4`,children:`Kill`})]})}),t[5]=m):m=t[5];let h;t[6]!==o||t[7]!==u.length?(h=u.length===0?(0,K.jsx)(`tr`,{children:(0,K.jsx)(`td`,{colSpan:7,className:`px-4 py-4 text-xs text-muted-foreground sm:px-5`,children:o??`No live descendant processes found.`})}):null,t[6]=o,t[7]=u.length,t[8]=h):h=t[8];let g;t[9]!==r||t[10]!==s||t[11]!==a||t[12]!==i||t[13]!==u?(g=u.map(e=>(0,K.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,K.jsx)(`td`,{className:`px-4 py-2 align-middle sm:pl-5`,children:(0,K.jsx)(Mt,{process:e,isExpanded:!s.has(e.pid),onToggle:f})}),(0,K.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.cpuPercent.toFixed(1),`%`]}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:xt(e.rssBytes)}),(0,K.jsx)(`td`,{className:`px-3 py-2 align-middle text-muted-foreground`,children:(0,K.jsxs)(M,{children:[(0,K.jsx)(D,{render:(0,K.jsx)(`span`,{className:`block truncate`,children:e.command})}),(0,K.jsx)(j,{side:`top`,variant:`code`,children:e.command})]})}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums text-muted-foreground`,children:e.pid}),(0,K.jsx)(`td`,{className:`truncate px-3 py-2 align-middle text-muted-foreground`,children:jt(e)}),(0,K.jsx)(`td`,{className:`p-2 align-middle sm:pr-4`,children:(0,K.jsx)(q,{disabled:!r||i===e.pid,onSignal:t=>a(e.pid,t)})})]},e.pid)),t[9]=r,t[10]=s,t[11]=a,t[12]=i,t[13]=u,t[14]=g):g=t[14];let _;return t[15]!==h||t[16]!==g?(_=(0,K.jsx)(`div`,{className:`border-t border-border/60`,children:(0,K.jsx)(z,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[min(64vh,44rem)] w-full max-w-full`,children:(0,K.jsxs)(`table`,{className:`w-full min-w-[1040px] table-fixed text-left text-xs`,children:[p,m,(0,K.jsxs)(`tbody`,{className:`divide-y divide-border/50`,children:[h,g]})]})})}),t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function Pt(){return new Set}var Ft=[{label:`5m`,windowMs:3e5,bucketMs:3e4},{label:`15m`,windowMs:9e5,bucketMs:6e4},{label:`30m`,windowMs:18e5,bucketMs:12e4},{label:`1h`,windowMs:36e5,bucketMs:3e5}];function It(e){if(e<60)return`${e.toFixed(e>=10?1:2)}s`;let t=e/60;return t<60?`${t.toFixed(t>=10?1:2)}m`:`${(t/60).toFixed(2)}h`}function Lt(e){let t=At(e);return t.length>42?`${t.slice(0,39)}...`:t}function Rt(e){let t=(0,G.c)(21),{process:n,visualDepth:r}=e,i;t[0]===n.command?i=t[1]:(i=Lt(n.command),t[0]=n.command,t[1]=i);let a=i,o=`${Math.min(r,6)*10}px`,s;t[2]===o?s=t[3]:(s={paddingLeft:o},t[2]=o,t[3]=s);let c=`${n.isServerRoot?`Root`:`Child`} process ${a}`,l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(`span`,{className:`size-5 shrink-0`,"aria-hidden":`true`}),t[4]=l):l=t[4];let u=n.isServerRoot?`bg-warning/90`:`bg-success/80`,d;t[5]===u?d=t[6]:(d=w(`size-1.5 shrink-0 rounded-full`,u),t[5]=u,t[6]=d);let f;t[7]===d?f=t[8]:(f=(0,K.jsx)(`span`,{className:d}),t[7]=d,t[8]=f);let p;t[9]===a?p=t[10]:(p=(0,K.jsx)(D,{render:(0,K.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:a})}),t[9]=a,t[10]=p);let m;t[11]===n.command?m=t[12]:(m=(0,K.jsx)(j,{side:`top`,variant:`code`,children:n.command}),t[11]=n.command,t[12]=m);let h;t[13]!==m||t[14]!==p?(h=(0,K.jsxs)(M,{children:[p,m]}),t[13]=m,t[14]=p,t[15]=h):h=t[15];let g;return t[16]!==h||t[17]!==s||t[18]!==c||t[19]!==f?(g=(0,K.jsxs)(`div`,{className:`grid min-w-0 grid-cols-[1.25rem_0.375rem_minmax(0,1fr)] items-center gap-2`,style:s,"aria-label":c,children:[l,f,h]}),t[16]=h,t[17]=s,t[18]=c,t[19]=f,t[20]=g):g=t[20],g}function zt(e){let t=(0,G.c)(9),{buckets:r}=e,i;t[0]===r?i=t[1]:(i=Math.max(1,...r.map(Bt)),t[0]=r,t[1]=i);let a=i,o;if(t[2]!==r||t[3]!==a){let e;t[5]===a?e=t[6]:(e=e=>{let t=Math.max(2,e.maxCpuPercent/a*100),r=Math.max(2,e.avgCpuPercent/a*100);return(0,K.jsxs)(M,{children:[(0,K.jsx)(D,{render:(0,K.jsx)(`div`,{className:`flex h-full min-w-1 flex-1 items-end`,children:(0,K.jsxs)(`div`,{className:`relative h-full w-full`,"aria-label":`Average CPU ${e.avgCpuPercent.toFixed(1)}%, peak CPU ${e.maxCpuPercent.toFixed(1)}%`,children:[(0,K.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 rounded-t-sm bg-foreground/15 transition-colors`,style:{height:`${t}%`}}),(0,K.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 rounded-t-sm bg-foreground/60 transition-colors`,style:{height:`${r}%`}})]})})}),(0,K.jsxs)(j,{side:`top`,children:[`Avg `,e.avgCpuPercent.toFixed(1),`%, peak `,e.maxCpuPercent.toFixed(1),`%`]})]},n(e.startedAt))},t[5]=a,t[6]=e),o=r.map(e),t[2]=r,t[3]=a,t[4]=o}else o=t[4];let s;return t[7]===o?s=t[8]:(s=(0,K.jsx)(`div`,{className:`border-t border-border/60 px-4 py-3 sm:px-5`,children:(0,K.jsx)(`div`,{className:`flex h-28 items-end gap-1 overflow-hidden rounded-sm bg-muted/10 p-2`,children:o})}),t[7]=o,t[8]=s),s}function Bt(e){return e.maxCpuPercent}function Vt(e){let t=(0,G.c)(8),{selectedWindowMs:n,onSelect:r}=e,i=String(n),a;t[0]===i?a=t[1]:(a=[i],t[0]=i,t[1]=a);let o;t[2]===r?o=t[3]:(o=e=>{let t=Ft.find(t=>String(t.windowMs)===e[0]);t&&r(t.windowMs)},t[2]=r,t[3]=o);let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=Ft.map(Ht),t[4]=s):s=t[4];let c;return t[5]!==a||t[6]!==o?(c=(0,K.jsx)(de,{"aria-label":`Process history period`,variant:`segmented`,value:a,onValueChange:o,children:s}),t[5]=a,t[6]=o,t[7]=c):c=t[7],c}function Ht(e){return(0,K.jsx)(fe,{value:String(e.windowMs),children:e.label},e.windowMs)}function Ut(e){let t=(0,G.c)(13),{processes:n,emptyLabel:r}=e,i=n.reduce(Wt,null),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsxs)(`colgroup`,{children:[(0,K.jsx)(`col`,{className:`w-[24%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`}),(0,K.jsx)(`col`,{className:`w-[16%]`}),(0,K.jsx)(`col`,{className:`w-[10%]`})]}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,K.jsx)(`thead`,{className:`sticky top-0 z-10 border-b border-border/60 bg-card text-2xs uppercase tracking-widest text-muted-foreground/70`,children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Process`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU Time`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Current`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Average`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Peak`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Max Mem`}),(0,K.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Command`}),(0,K.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold sm:pr-5`,children:`PID`})]})}),t[1]=o):o=t[1];let s;t[2]!==r||t[3]!==n.length?(s=n.length===0?(0,K.jsx)(`tr`,{children:(0,K.jsx)(`td`,{colSpan:8,className:`px-4 py-4 text-xs text-muted-foreground sm:px-5`,children:r})}):null,t[2]=r,t[3]=n.length,t[4]=s):s=t[4];let c;if(t[5]!==n||t[6]!==i){let e;t[8]===i?e=t[9]:(e=e=>(0,K.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,K.jsx)(`td`,{className:`px-4 py-2 align-middle sm:pl-5`,children:(0,K.jsx)(Rt,{process:e,visualDepth:e.isServerRoot||i===null?0:Math.max(1,e.depth-i+1)})}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:It(e.cpuSecondsApprox)}),(0,K.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.currentCpuPercent.toFixed(1),`%`]}),(0,K.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.avgCpuPercent.toFixed(1),`%`]}),(0,K.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.maxCpuPercent.toFixed(1),`%`]}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:xt(e.maxRssBytes)}),(0,K.jsx)(`td`,{className:`px-3 py-2 align-middle text-muted-foreground`,children:(0,K.jsxs)(M,{children:[(0,K.jsx)(D,{render:(0,K.jsx)(`span`,{className:`block truncate`,children:e.command})}),(0,K.jsx)(j,{side:`top`,variant:`code`,children:e.command})]})}),(0,K.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums text-muted-foreground sm:pr-5`,children:e.pid})]},e.processKey),t[8]=i,t[9]=e),c=n.map(e),t[5]=n,t[6]=i,t[7]=c}else c=t[7];let l;return t[10]!==s||t[11]!==c?(l=(0,K.jsx)(`div`,{className:`border-t border-border/60`,children:(0,K.jsx)(z,{chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[min(64vh,44rem)] w-full max-w-full`,children:(0,K.jsxs)(`table`,{className:`w-full min-w-[980px] table-fixed text-left text-xs`,children:[a,o,(0,K.jsxs)(`tbody`,{className:`divide-y divide-border/50`,children:[s,c]})]})})}),t[10]=s,t[11]=c,t[12]=l):l=t[12],l}function Wt(e,t){return t.isServerRoot?e:e===null?t.depth:Math.min(e,t.depth)}function Gt(e){let t=(0,G.c)(7),{checkedAt:r}=e;V();let i;t[0]===r?i=t[1]:(i=ue(r?n(r):null),t[0]=r,t[1]=i);let a=i;if(a.status===`missing`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`span`,{className:`text-2xs text-muted-foreground/50`,children:`Checking`}),t[2]=e):e=t[2],e}if(a.status===`invalid`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,K.jsx)(`span`,{className:`text-2xs text-muted-foreground/50`,children:`Checked unavailable`}),t[3]=e):e=t[3],e}let o;return t[4]!==a.suffix||t[5]!==a.value?(o=(0,K.jsx)(`span`,{className:`text-2xs text-muted-foreground/60`,children:a.suffix?(0,K.jsxs)(K.Fragment,{children:[`Checked `,(0,K.jsx)(`span`,{className:`font-mono tabular-nums`,children:a.value}),` `,a.suffix]}):(0,K.jsxs)(K.Fragment,{children:[`Checked `,a.value]})}),t[4]=a.suffix,t[5]=a.value,t[6]=o):o=t[6],o}function Kt(e){let t=(0,G.c)(12),{isPending:n,label:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=(0,K.jsx)(ye,{refreshing:n}),t[0]=n,t[1]=a);let o;t[2]!==n||t[3]!==r||t[4]!==i||t[5]!==a?(o=(0,K.jsx)(D,{render:(0,K.jsx)(C,{size:`icon-xs`,variant:`ghost-muted`,disabled:n,onClick:i,"aria-label":r,children:a})}),t[2]=n,t[3]=r,t[4]=i,t[5]=a,t[6]=o):o=t[6];let s;t[7]===r?s=t[8]:(s=(0,K.jsx)(j,{side:`top`,children:r}),t[7]=r,t[8]=s);let c;return t[9]!==o||t[10]!==s?(c=(0,K.jsxs)(M,{children:[o,s]}),t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function qt(){let{environment:e}=me(),t=e?.environmentId??null,r=ae(t,a),i=e?.serverConfig?.observability,o=e?.serverConfig?.availableEditors,s=ae(t,m),c=ce(t===null?null:se.sessionStateAtom(t)),l=be({connectionPhase:e?.connection.phase??`available`,session:c.data,hasSessionError:c.error!==null}),u=l.canReadDiagnostics,d=le(I.signalProcess,{reportFailure:!1}),f=ve(t,o??[]),[p,h]=(0,J.useState)(9e5),g=Ft.find(e=>e.windowMs===p)??Ft[1],{data:_,error:b,isPending:ee,refresh:te}=ce(t===null||!u?null:I.traceDiagnostics({environmentId:t,input:{}})),{data:T,error:O,isPending:k,refresh:A}=ce(t===null||!u?null:I.processDiagnostics({environmentId:t,input:{}})),{data:P,error:F,isPending:L,refresh:R}=ce(t===null||!u?null:I.processResourceHistory({environmentId:t,input:{windowMs:g.windowMs,bucketMs:g.bucketMs}})),[ue,de]=(0,J.useState)(!1),[fe,pe]=(0,J.useState)(null),[he,V]=(0,J.useState)(null),_e=(0,J.useRef)(null),H=(0,J.useRef)(t),ye=(0,J.useRef)(T);(0,J.useEffect)(()=>{ye.current=T},[T]),(0,J.useEffect)(()=>(H.current=t,()=>{H.current=null}),[t]);let U=(0,J.useCallback)(()=>{let e=i?.logsDirectoryPath??null;e&&t!==null&&oe(t,`orchestration:operate`)&&(de(!0),pe(null),(async()=>{let t=await f(e);if(de(!1),t._tag===`Failure`&&!ne(t)){let e=re(t);pe(e instanceof Error?e.message:`Unable to open logs folder.`)}})())},[t,i?.logsDirectoryPath,f]),W=ee&&_===null,G=k&&T===null,q=L&&P===null,[Se,Ce]=(0,J.useState)(null);Se!==t&&u&&!W&&!G&&!q&&Ce(t);let Y=(0,J.useCallback)(async(e,t)=>{let n=H.current,r=ye.current?.processes.find(t=>t.pid===e);if(n===null||r===void 0||!oe(n,`environment:maintain`)||_e.current!==null)return;_e.current=e,V(e);let i=()=>{_e.current=null,V(null)};if(t===`SIGKILL`){let n=!1;try{n=await ie().dialogs.confirm(`Send SIGKILL to process ${e}? This cannot be handled by the process.`,{variant:`destructive`})}catch(e){i(),N.add({type:`error`,title:`Could not confirm signal`,description:e instanceof Error?e.message:`Failed to send ${t}.`});return}if(!n){i();return}}let a=H.current;if(a===null||a!==n||!oe(a,`environment:maintain`)){i();return}if(ye.current?.processes.find(t=>t.pid===e)?.startTimeMs!==r.startTimeMs){i();return}try{let i=await d({environmentId:n,input:{pid:e,startTimeMs:r.startTimeMs,signal:t}});if(i._tag===`Failure`){if(!ne(i)){let e=re(i);N.add({type:`error`,title:`Could not send ${t}`,description:e instanceof Error?e.message:`Failed to send ${t}.`})}return}if(!i.value.signaled){let e=x(i.value.message);if(A(),Tt(e)){N.add({type:`info`,title:`Process already exited`,description:`The process is not a child of the P4 Code server. It might already have exited.`});return}N.add({type:`error`,title:`Could not send ${t}`,description:e??`Failed to send ${t}.`});return}A()}finally{i()}},[A,d]),we=T?y(T.error):null,Te=P?y(P.error):null,X=_?y(_.error):null,Ee=_?v(_.partialFailure,()=>!1):!1;return u?(0,K.jsxs)(ge,{width:`expanded`,className:`gap-10`,children:[(0,K.jsx)(lt,{environmentId:t}),(0,K.jsxs)(B,{title:`Live Processes`,headerAction:(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Gt,{checkedAt:T?.readAt??null}),(0,K.jsx)(Kt,{isPending:k,label:`Refresh process diagnostics`,onClick:A})]}),children:[(0,K.jsxs)(Et,{children:[(0,K.jsx)($,{label:`Child Processes`,value:T?Z(T.processCount):`...`}),(0,K.jsx)($,{label:`CPU`,value:T?`${T.totalCpuPercent.toFixed(1)}%`:`...`,tooltip:`Total CPU across live child processes of the current server process. The desktop shell and other parent processes are not included.`}),(0,K.jsx)($,{label:`Memory`,value:T?xt(T.totalRssBytes):`...`,tooltip:`Total resident memory across live child processes of the current server process. The desktop shell and other parent processes are not included.`}),(0,K.jsx)($,{label:`Server PID`,value:T?String(T.serverPid):`...`})]}),we||O?(0,K.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5`,children:[we?(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,K.jsx)(E,{className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:we.message})]}):null,O?(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,K.jsx)(E,{className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:O})]}):null]}):null,(0,K.jsx)(Nt,{processes:T?.processes??[],canMaintainEnvironment:r,signalingPid:he,onSignal:Y,emptyLabel:G?`Loading live processes...`:`No live descendant processes found.`})]}),(0,K.jsxs)(B,{title:`Resource History`,headerAction:(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Vt,{selectedWindowMs:p,onSelect:h}),(0,K.jsx)(Gt,{checkedAt:P?.readAt??null}),(0,K.jsx)(Kt,{isPending:L,label:`Refresh resource history`,onClick:R})]}),children:[(0,K.jsxs)(Et,{children:[(0,K.jsx)($,{label:`CPU Time`,value:P?It(P.totalCpuSecondsApprox):`...`,tooltip:`Approximate active CPU time for the P4 Code server root process and its descendants during the selected window. It grows only while sampled processes use CPU and older samples leave as the window moves.`}),(0,K.jsx)($,{label:`Samples`,value:P?Z(P.retainedSampleCount):`...`,tooltip:`In-memory process samples retained by the server. The server samples only while diagnostics is open, and this resets when the server restarts.`}),(0,K.jsx)($,{label:`Interval`,value:P?P.sampleIntervalMs===0?`On demand`:Q(P.sampleIntervalMs):`...`}),(0,K.jsx)($,{label:`Processes`,value:P?Z(P.topProcesses.length):`...`})]}),Te||F?(0,K.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5`,children:[Te?(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,K.jsx)(E,{className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:Te.message})]}):null,F?(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,K.jsx)(E,{className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:F})]}):null]}):null,(0,K.jsx)(zt,{buckets:P?.buckets??[]}),(0,K.jsx)(Ut,{processes:P?.topProcesses??[],emptyLabel:q?`Collecting process resource samples...`:`No process resource samples found for this window.`})]}),(0,K.jsxs)(B,{title:`Trace Diagnostics`,headerAction:(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,K.jsx)(Gt,{checkedAt:_?.readAt??null}),(0,K.jsxs)(M,{children:[(0,K.jsx)(D,{render:(0,K.jsx)(C,{size:`icon-xs`,variant:`ghost-muted`,disabled:!s||!i?.logsDirectoryPath||ue,onClick:U,"aria-label":`Open logs folder`,children:(0,K.jsx)(S,{})})}),(0,K.jsx)(j,{side:`top`,children:`Open logs folder`})]}),(0,K.jsx)(Kt,{isPending:ee,label:`Refresh trace diagnostics`,onClick:te})]}),children:[(0,K.jsxs)(Et,{children:[(0,K.jsx)($,{label:`Spans`,value:_?Z(_.recordCount):`...`}),(0,K.jsx)($,{label:`Failures`,value:_?Z(_.failureCount):`...`,tone:_&&_.failureCount>0?`danger`:`default`}),(0,K.jsx)($,{label:`Slow Spans`,value:_?Z(_.slowSpanCount):`...`,tooltip:_?`Spans with a duration of ${Q(_.slowSpanThresholdMs)} or longer.`:`Spans at or above the configured slow-span threshold.`,tone:_&&_.slowSpanCount>0?`warning`:`default`}),(0,K.jsx)($,{label:`Parse Errors`,value:_?Z(_.parseErrorCount):`...`,tone:_&&_.parseErrorCount>0?`warning`:`default`})]}),fe||X||b?(0,K.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5`,children:[fe?(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,K.jsx)(E,{className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:fe})]}):null,X?(0,K.jsxs)(`div`,{className:w(`flex items-start gap-2`,Ee?`text-warning-foreground`:`text-destructive`),children:[(0,K.jsx)(E,{className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:Ee?`Some trace files could not be read, so diagnostics may be incomplete. ${X.message}`:X.message})]}):null,b?(0,K.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,K.jsx)(E,{className:`mt-0.5 size-3.5 shrink-0`}),(0,K.jsx)(`span`,{children:b})]}):null]}):null]}),(0,K.jsx)(B,{title:`Latest Failures`,children:_&&_.latestFailures.length>0?(0,K.jsx)(Ot,{headers:[`Span`,`Cause`,`Duration`,`Ended`],children:_.latestFailures.map(e=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,K.jsx)(`td`,{className:`max-w-[360px] px-4 py-3 align-top text-muted-foreground`,children:(0,K.jsx)(xe,{text:e.cause})}),(0,K.jsx)(`td`,{className:`px-4 py-3 align-top font-mono tabular-nums`,children:Q(e.durationMs)}),(0,K.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums text-muted-foreground last:sm:pr-5`,children:Ct(e.endedAt)})]},`${e.traceId}:${e.spanId}`))}):(0,K.jsx)(Dt,{label:W?`Loading failures...`:`No failed spans found.`})}),(0,K.jsx)(B,{title:`Most Common Failures`,children:_&&_.commonFailures.length>0?(0,K.jsx)(Ot,{headers:[`Span`,`Count`,`Cause`,`Last Seen`],minTableWidth:`min-w-[760px]`,children:_.commonFailures.map(e=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,K.jsx)(`td`,{className:`px-4 py-3 align-top font-mono tabular-nums`,children:Z(e.count)}),(0,K.jsx)(`td`,{className:`max-w-[360px] px-4 py-3 align-top text-muted-foreground`,children:(0,K.jsx)(xe,{text:e.cause})}),(0,K.jsx)(`td`,{className:`w-px whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums text-muted-foreground last:sm:pr-5`,children:Ct(e.lastSeenAt)})]},`${e.name}:${e.cause}`))}):(0,K.jsx)(Dt,{label:W?`Loading failure groups...`:`No repeated failures found.`})}),(0,K.jsx)(B,{title:`Slowest Spans`,children:_&&_.slowestSpans.length>0?(0,K.jsx)(Ot,{headers:[`Span`,`Duration`,`Ended`,`Trace`],minTableWidth:`min-w-[900px]`,columnWidths:[`w-[44%]`,`w-[14%]`,`w-[12%]`,`w-[30%]`],children:_.slowestSpans.map(e=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,K.jsx)(`td`,{className:`px-4 py-3 align-top font-mono tabular-nums`,children:Q(e.durationMs)}),(0,K.jsx)(`td`,{className:`w-px whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums text-muted-foreground`,children:Ct(e.endedAt)}),(0,K.jsx)(`td`,{className:`min-w-0 whitespace-nowrap px-4 py-3 align-top text-muted-foreground last:sm:pr-5`,children:(0,K.jsx)(kt,{traceId:e.traceId})})]},`${e.traceId}:${e.spanId}`))}):(0,K.jsx)(Dt,{label:W?`Loading slow spans...`:`No spans found.`})}),(0,K.jsx)(B,{title:`Span Logs`,children:_&&_.latestWarningAndErrorLogs.length>0?(0,K.jsx)(z,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`w-full max-w-full`,children:(0,K.jsxs)(`table`,{className:`w-full min-w-[920px] table-fixed text-left text-xs`,children:[(0,K.jsxs)(`colgroup`,{children:[(0,K.jsx)(`col`,{className:`w-[11%]`}),(0,K.jsx)(`col`,{className:`w-[9%]`}),(0,K.jsx)(`col`,{className:`w-[24%]`}),(0,K.jsx)(`col`,{className:`w-[26%]`}),(0,K.jsx)(`col`,{className:`w-[30%]`})]}),(0,K.jsx)(`thead`,{className:`border-b border-border/60 text-2xs uppercase tracking-widest text-muted-foreground/70`,children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold sm:pl-5`,children:`Time`}),(0,K.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold`,children:`Level`}),(0,K.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold`,children:`Span`}),(0,K.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold`,children:`Message`}),(0,K.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold sm:pr-5`,children:`Trace`})]})}),(0,K.jsx)(`tbody`,{className:`divide-y divide-border/60`,children:_.latestWarningAndErrorLogs.map(e=>(0,K.jsxs)(`tr`,{className:`hover:bg-muted/15`,children:[(0,K.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums text-muted-foreground sm:pl-5`,children:Ct(e.seenAt)}),(0,K.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,K.jsx)(`span`,{className:`inline-flex rounded bg-muted px-1.5 py-0.5 font-mono text-2xs font-medium uppercase text-foreground/80`,children:e.level})}),(0,K.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,K.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:e.spanName})}),(0,K.jsx)(`td`,{className:`px-4 py-3 align-top text-muted-foreground`,children:(0,K.jsx)(xe,{collapsedClassName:`line-clamp-2`,expandLabel:`Show full message`,text:e.message})}),(0,K.jsx)(`td`,{className:`min-w-0 whitespace-nowrap px-4 py-3 align-top text-muted-foreground sm:pr-5`,children:(0,K.jsx)(kt,{traceId:e.traceId})})]},`${e.traceId}:${e.spanId}:${n(e.seenAt)}:${e.message}`))})]})}):(0,K.jsx)(Dt,{label:W?`Loading recent logs...`:`No warnings or errors found.`})}),(0,K.jsx)(B,{title:`Top Span Names`,children:_&&_.topSpansByCount.length>0?(0,K.jsx)(Ot,{headers:[`Span`,`Count`,`Failures`,`Average`,`Max`],minTableWidth:`min-w-[760px]`,columnWidths:[`w-[48%]`,`w-[13%]`,`w-[13%]`,`w-[13%]`,`w-[13%]`],children:_.topSpansByCount.map(e=>(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,K.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums`,children:Z(e.count)}),(0,K.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums`,children:Z(e.failureCount)}),(0,K.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums`,children:Q(e.averageDurationMs)}),(0,K.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums last:sm:pr-5`,children:Q(e.maxDurationMs)})]},e.name))}):(0,K.jsx)(Dt,{label:W?`Loading span names...`:`No spans found.`})}),Se===t&&(0,K.jsx)(vt,{})]}):(0,K.jsx)(ge,{children:(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===null?`Connect an environment to see diagnostics.`:l.isPending?`Checking diagnostics access…`:l.error})})}var Jt=qt;export{Jt as component};
2
- //# sourceMappingURL=settings.diagnostics-CG2kVUBD.js.map
@@ -1,2 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{HT as t,dE as n}from"./utils-vKlT_s3D.js";import{n as r}from"./SettingsPanels-DExy67bz.js";var i=n(),a=e(t());function o(){let e=(0,i.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(r,{}),e[0]=t):t=e[0],t}export{o as component};
2
- //# sourceMappingURL=settings.general-jsS1Ydzs.js.map