@p4code/cli 0.9.18 → 0.9.19
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.
- package/dist/AcpMcpStdioBridge-DbCGhPmy.mjs +3 -0
- package/dist/{AcpMcpStdioBridge-4vUttgH1.mjs → AcpMcpStdioBridge-DxIZyDJz.mjs} +4 -4
- package/dist/{Effect-_Rz7VLdg.mjs → Effect-BqRgldaH.mjs} +20 -4
- package/dist/{Schema-APnY3Ozr.mjs → Schema-CkGB1Dgx.mjs} +2 -2
- package/dist/{Stream-CJtpwu3-.mjs → Stream-DZTo5F3N.mjs} +2 -2
- package/dist/{TraceDiagnostics-CeQ-TvdA.mjs → TraceDiagnostics-BU8mTsuy.mjs} +278 -50
- package/dist/bin.mjs +2 -2
- package/dist/{binCli-DzRO6f_z.mjs → binCli-CJGD6FcB.mjs} +297 -125
- package/dist/claude-history-worker.mjs +1 -1
- package/dist/{claudeHistoryWorker-B6KX_N9G.mjs → claudeHistoryWorker-Cst8OnLH.mjs} +1 -1
- package/dist/{claudeHistoryWorker-DZ1Ft4NK.mjs → claudeHistoryWorker-r4mV4Dxy.mjs} +2 -2
- package/dist/client/.vite/manifest.json +2143 -2131
- package/dist/client/assets/{2NI2N5EU-Ds9jiLPm.js → 2NI2N5EU-dXNVRqH0.js} +2 -2
- package/dist/client/assets/{4UO7MD6I-BWEQQJHY.js → 4UO7MD6I-BnTV2LIU.js} +2 -2
- package/dist/client/assets/{5B3SVYGG-lcm66GRf.js → 5B3SVYGG-BW_NJOn9.js} +2 -2
- package/dist/client/assets/{5GK6JWQ2-DegG64te.js → 5GK6JWQ2-zR4M88FU.js} +2 -2
- package/dist/client/assets/{5N7A7DKN-CDv2ioO3.js → 5N7A7DKN-DIzrmjXm.js} +2 -2
- package/dist/client/assets/{5OC2THR4-CaZVvwg8.js → 5OC2THR4-D9gz0spY.js} +2 -2
- package/dist/client/assets/{5S6HY5KT-B8WMtvrw.js → 5S6HY5KT-BFO1LsJz.js} +2 -2
- package/dist/client/assets/{6IMQ5BUJ-R-et-GtO.js → 6IMQ5BUJ-CflGSI2z.js} +2 -2
- package/dist/client/assets/{6OLKWJ4F-CdOZHr7D.js → 6OLKWJ4F-B_-tUtQE.js} +2 -2
- package/dist/client/assets/{74OO7NKP-DVS5qE0v.js → 74OO7NKP-CNFGk064.js} +2 -2
- package/dist/client/assets/{75O6YZUN-B6bJpGs2.js → 75O6YZUN-DSw7e3qz.js} +2 -2
- package/dist/client/assets/{77XECAW3-DDozcJnk.js → 77XECAW3-C1endahg.js} +2 -2
- package/dist/client/assets/{ABYRPUBD-BZd5-ucB.js → ABYRPUBD-DGyrlbqz.js} +2 -2
- package/dist/client/assets/AlertDialogRoot-CfwItD_i.js +2 -0
- package/dist/client/assets/{AnimatedHeight-CsOfc5H1.js → AnimatedHeight-DG3oq8Fl.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell--2lH1vql.js → AuthSurfaceShell-uHFuClfP.js} +2 -2
- package/dist/client/assets/{BB2UYUI2-DAb-WdIu.js → BB2UYUI2-DJtfqV3f.js} +2 -2
- package/dist/client/assets/{BUM34MOA-DMU6CGcz.js → BUM34MOA-B4MgXIYY.js} +2 -2
- package/dist/client/assets/{CEQABKGZ-BnDJUiDl.js → CEQABKGZ-CnWbDLSz.js} +2 -2
- package/dist/client/assets/{CXAC5362-QKBU6D2s.js → CXAC5362-DdZ6n5qP.js} +2 -2
- package/dist/client/assets/ChatGptUsageButton-Dg1SR7pz.js +2 -0
- package/dist/client/assets/ChatMarkdown-eJNo9q4b.js +49 -0
- package/dist/client/assets/CheckboxIndicator-BpGIx6Ze.js +2 -0
- package/dist/client/assets/{ClippedText-aNLi0IDp.js → ClippedText-Cny-j-4e.js} +2 -2
- package/dist/client/assets/CodexSetupSection.logic-C4KEUUA1.js +2 -0
- package/dist/client/assets/CollapsiblePanel-vHsKk5wM.js +2 -0
- package/dist/client/assets/ComboboxClear-DI8al7ca.js +2 -0
- package/dist/client/assets/{ComboboxGroupLabel-BaZLyLCv.js → ComboboxGroupLabel-9alK0hYt.js} +2 -2
- package/dist/client/assets/{CommandBlock-Bg2O3rbF.js → CommandBlock-BOYakQHx.js} +2 -2
- package/dist/client/assets/CompositeRoot-OiiGu5cn.js +2 -0
- package/dist/client/assets/{ConnectAgentSurface-D-fMTn_R.js → ConnectAgentSurface-D9vE8btn.js} +2 -2
- package/dist/client/assets/{ConnectionStatusDot-vOKtZfeV.js → ConnectionStatusDot-DL0Hsk-v.js} +2 -2
- package/dist/client/assets/{DRLTVNUE-DvpJAT6K.js → DRLTVNUE-D99K7hWK.js} +2 -2
- package/dist/client/assets/{DYY6UVD2-DFSg5DAZ.js → DYY6UVD2-BF6iP9-o.js} +2 -2
- package/dist/client/assets/DevicePanel-BzIRsUjQ.js +2 -0
- package/dist/client/assets/DeviceSetup-DQqwNSXQ.js +2 -0
- package/dist/client/assets/DialogTitle-BNEjkHZl.js +2 -0
- package/dist/client/assets/{DiffCommentAnnotation-CAml763Q.js → DiffCommentAnnotation-DOn5F9Vx.js} +3 -3
- package/dist/client/assets/{DiffFileTree-2Y-Da6MW.js → DiffFileTree-C7d_tSjH.js} +2 -2
- package/dist/client/assets/DiffPanel-zzTYLQBt.js +2 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-Czi5bOUV.js → DiffWorkerPoolProvider-CHaL1Ona.js} +3 -3
- package/dist/client/assets/{EmbeddedDesign-AHra-cLY.js → EmbeddedDesign-DZezJSS1.js} +8 -8
- package/dist/client/assets/{EnvironmentMachineIcon-BnMVjB89.js → EnvironmentMachineIcon-BrYDn6tR.js} +2 -2
- package/dist/client/assets/{ExpandableText-gKNgCxfU.js → ExpandableText-BsOIEd28.js} +2 -2
- package/dist/client/assets/{FNOVOB4O-D2IqnTWb.js → FNOVOB4O-B07Bu4_g.js} +2 -2
- package/dist/client/assets/{FieldControl-Bjdbc6Ii.js → FieldControl-Ua5R3Une.js} +2 -2
- package/dist/client/assets/{FileDiff-Di0hvnyJ.js → FileDiff-CAhD0qa4.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-2-RLs_YZ.js → FilePreviewPanel-Ptxxfl5h.js} +6 -6
- package/dist/client/assets/FoldedSettingsSection-C-4eZXtv.js +2 -0
- package/dist/client/assets/{HDGCDEEZ-AZF834xy.js → HDGCDEEZ-BiCUaNcl.js} +2 -2
- package/dist/client/assets/{HSJLKHB7-Dtz-7WMf.js → HSJLKHB7-MsC8mniI.js} +2 -2
- package/dist/client/assets/{Icons-BzIBDVKW.js → Icons-D8Idteuf.js} +2 -2
- package/dist/client/assets/Input-BtekXNnW.js +2 -0
- package/dist/client/assets/{IntervalSecondsField-Fdrpvkqj.js → IntervalSecondsField-Aqwzi0Sz.js} +2 -2
- package/dist/client/assets/JZOYTAAL-B8yh1QUr.js +1 -0
- package/dist/client/assets/{K3MD6TGW-BPz_yQfQ.js → K3MD6TGW-CkU_KXkd.js} +2 -2
- package/dist/client/assets/{K7RP3OMA-C-IhAYzY.js → K7RP3OMA-DLs66X2w.js} +2 -2
- package/dist/client/assets/{KeybindingsSettings.logic-DjD-8Wsr.js → KeybindingsSettings.logic-DNTed1xn.js} +2 -2
- package/dist/client/assets/{LHDIQX7Q-Dw7FK-yZ.js → LHDIQX7Q-BOSadp0O.js} +2 -2
- package/dist/client/assets/{LUXOKEGN-Cp4yLfcO.js → LUXOKEGN-qg2nPaOP.js} +2 -2
- package/dist/client/assets/{LinkMachineSelect-v3ZAAPFG.js → LinkMachineSelect-CQIJcmq4.js} +2 -2
- package/dist/client/assets/{MathTypeset-CAVYwtpt.js → MathTypeset-B_2pC76G.js} +2 -2
- package/dist/client/assets/ModelLiveLayer-BdDN1RwJ.js +3 -0
- package/dist/client/assets/{N3JZAHOW-sZve4CbV.js → N3JZAHOW-DkFZrX8t.js} +2 -2
- package/dist/client/assets/{NUIALGQ3-DMlKhtdq.js → NUIALGQ3-DF_hOTNF.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-B0ChXuQG.js → NoProjectsHero-DIDw2XWy.js} +2 -2
- package/dist/client/assets/{O65XPQGZ-COhBlGA1.js → O65XPQGZ-DX7_CzKu.js} +2 -2
- package/dist/client/assets/{O7XIQ6OM-D-y75rjS.js → O7XIQ6OM-mHLqolvI.js} +2 -2
- package/dist/client/assets/{OFQON5FD-kw-f4mV4.js → OFQON5FD-Suig0WTF.js} +2 -2
- package/dist/client/assets/{P4ConnectAccountPages-BXM_FJyy.js → P4ConnectAccountPages-naPvNZLz.js} +2 -2
- package/dist/client/assets/{P4ConnectSidebarSignIn-D8uwPPR6.js → P4ConnectSidebarSignIn-D2rgfUAh.js} +2 -2
- package/dist/client/assets/{PJQHF43J-Dww1R-k6.js → PJQHF43J-7rnsehAx.js} +2 -2
- package/dist/client/assets/PanelLayoutControls-D6h4yyW-.js +216 -0
- package/dist/client/assets/{PierreEntryIcon-C-5f-jFb.js → PierreEntryIcon-0R4z7KQU.js} +2 -2
- package/dist/client/assets/PopoverHandle-BxV9_kh8.js +2 -0
- package/dist/client/assets/PreviewPanel-DCN5UudG.js +2 -0
- package/dist/client/assets/ProjectDefaultsSettings-BVdLNACE.js +2 -0
- package/dist/client/assets/{ProjectFavicon-CPvmNs3J.js → ProjectFavicon-DJmxMkvz.js} +3 -3
- package/dist/client/assets/{ProjectIconPickerDialog-blbck4gY.js → ProjectIconPickerDialog-3Bcbbvvc.js} +2 -2
- package/dist/client/assets/{ProjectMonogram-Cesz5yVS.js → ProjectMonogram-Bb9wZVNY.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-BXGE9cPY.js → ProviderAuthTerminal-mgY-tn0M.js} +2 -2
- package/dist/client/assets/ProviderModelPicker-D3VH0Z__.js +2 -0
- package/dist/client/assets/{ProviderSettingsForm-CRvI8mDe.js → ProviderSettingsForm-CGySH9bP.js} +2 -2
- package/dist/client/assets/PullRequestCodeTab-D-J3laup.js +6 -0
- package/dist/client/assets/{RHNBAITX-CY4FKVtu.js → RHNBAITX-Ddcb7a4G.js} +2 -2
- package/dist/client/assets/{ReadOnlySourcePreview-DK9ZCAf4.js → ReadOnlySourcePreview-CUrcvaQB.js} +2 -2
- package/dist/client/assets/{RedactedSensitiveText-DrIhPFXw.js → RedactedSensitiveText-DiLAhy4C.js} +2 -2
- package/dist/client/assets/RenderErrorBoundary-DNjP1Gq4.js +23 -0
- package/dist/client/assets/{RightPanelResizeHandle-DBCfKzRv.js → RightPanelResizeHandle-BKZPxtjZ.js} +2 -2
- package/dist/client/assets/{SLD4V6NK-Dtrbq5qR.js → SLD4V6NK-CAdpUQd9.js} +2 -2
- package/dist/client/assets/ScheduledTasksSettings-BIqva7uG.js +6 -0
- package/dist/client/assets/{ScopedSwitch-DQHfQgMZ.js → ScopedSwitch-CjWqxV6P.js} +2 -2
- package/dist/client/assets/{ScrollAreaCorner-B9Aiu69u.js → ScrollAreaCorner-BNGMax5h.js} +2 -2
- package/dist/client/assets/{SecretInput-CxJl9pux.js → SecretInput-F_2AS4sm.js} +2 -2
- package/dist/client/assets/SelectScrollUpArrow-r18qpNEu.js +2 -0
- package/dist/client/assets/{SelfImproveSettingsSection-yFj7aCio.js → SelfImproveSettingsSection-dyJbezur.js} +2 -2
- package/dist/client/assets/{SettingsPanels-H_7XUe5G.js → SettingsPanels-BwrWyM3f.js} +7 -7
- package/dist/client/assets/{SettingsPanels.logic-BYLv56aj.js → SettingsPanels.logic-DWRYwc9b.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-pJqEfHRd.js → SettingsScopeNotice-DpC9Q9ae.js} +2 -2
- package/dist/client/assets/{SidebarStageBackdrop-DWShR_RZ.js → SidebarStageBackdrop-ByWEF0y2.js} +2 -2
- package/dist/client/assets/{T3PCR2KE-BFmO9IZ-.js → T3PCR2KE-BsP9x4U3.js} +2 -2
- package/dist/client/assets/{TKWO2OVW-DMeVANpK.js → TKWO2OVW-BONiqXri.js} +2 -2
- package/dist/client/assets/{TSHNXIZL-COvYTPCc.js → TSHNXIZL-CLTZIB-s.js} +2 -2
- package/dist/client/assets/{ThemeEditorPanel-BxOl9N6E.js → ThemeEditorPanel-C7o3GtWa.js} +3 -3
- package/dist/client/assets/{ThreadDetailsItemsMenu-BXQbo6bY.js → ThreadDetailsItemsMenu-Bq_XM62t.js} +40 -40
- package/dist/client/assets/ThreadTerminalDrawer-CD5oxZhC.js +5 -0
- package/dist/client/assets/TooltipProvider-DPt8xz_3.js +2 -0
- package/dist/client/assets/{UQJE5E4I-CajoppS3.js → UQJE5E4I-BS_wwVFT.js} +2 -2
- package/dist/client/assets/{USNYFO5S-BQLaJAkC.js → USNYFO5S-CpDVNtuT.js} +2 -2
- package/dist/client/assets/{Virtualizer-kAxtf9JI.js → Virtualizer-BWztABfX.js} +2 -2
- package/dist/client/assets/{WEVWDWVA-Bn1CMBLe.js → WEVWDWVA-4IVaqPOG.js} +2 -2
- package/dist/client/assets/{WorkspaceBreadcrumb-KdZMrP13.js → WorkspaceBreadcrumb-BHensDdi.js} +2 -2
- package/dist/client/assets/{WorkspacePageContainer-VqvvyrKx.js → WorkspacePageContainer-CCJOwHlv.js} +2 -2
- package/dist/client/assets/{WorkspacePageHeader-Ca7-ugiS.js → WorkspacePageHeader-C9Tpr_np.js} +2 -2
- package/dist/client/assets/{X5RFHQXM-CPBgn0uR.js → X5RFHQXM-DO1k5hPx.js} +2 -2
- package/dist/client/assets/{X62E3GBT-DEsBFWSE.js → X62E3GBT-DR5ebldd.js} +2 -2
- package/dist/client/assets/{XBNEOJTC-rIiejuIa.js → XBNEOJTC-D6Kx02Ci.js} +2 -2
- package/dist/client/assets/{YHV2MVVZ-FepTeOr1.js → YHV2MVVZ-B7xQdu1d.js} +2 -2
- package/dist/client/assets/{YURCZMG2-Co7j1onF.js → YURCZMG2-vpRi9ruy.js} +2 -2
- package/dist/client/assets/{YVG2LODB-CH8YtqJ9.js → YVG2LODB-BPr-N_Eh.js} +2 -2
- package/dist/client/assets/_chat-B7MuBHoN.js +47 -0
- package/dist/client/assets/{_chat.design-C593M39o.js → _chat.design-JY93KEj-.js} +2 -2
- package/dist/client/assets/{_chat.index-DZmhCx_Q.js → _chat.index-BLQil4HT.js} +2 -2
- package/dist/client/assets/{_chat.new-BLxqLetm.js → _chat.new-BUUjlaam.js} +3 -3
- package/dist/client/assets/_chat.pull-requests-hoMASTBm.js +2 -0
- package/dist/client/assets/{alert-BdISKl4u.js → alert-Eh-IusVP.js} +2 -2
- package/dist/client/assets/{alert-dialog-Broi1wym.js → alert-dialog-BxwvNOYD.js} +2 -2
- package/dist/client/assets/{assetUrls-DyJx-URx.js → assetUrls-Bk8CvVQ5.js} +2 -2
- package/dist/client/assets/assets-w0TTeveX.js +2 -0
- package/dist/client/assets/{browserHistoryStore-zdRsIuMc.js → browserHistoryStore-CQgs_U0x.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-aye_Gpt4.js → browserLinkTarget-BD9wK52f.js} +2 -2
- package/dist/client/assets/{checkbox-ueGFMqVv.js → checkbox-CDoyvSyH.js} +2 -2
- package/dist/client/assets/{color-picker-CUoPp4AJ.js → color-picker-BOsv4n_B.js} +2 -2
- package/dist/client/assets/{combobox-BfOjf6Iu.js → combobox-BJsEk7ze.js} +2 -2
- package/dist/client/assets/{command-CeMH9lgx.js → command-Cg83G2rG.js} +2 -2
- package/dist/client/assets/{connect-CQUjsv6p.js → connect-C7ENaX3L.js} +2 -2
- package/dist/client/assets/connect-agent-BEYL9KOm.js +2 -0
- package/dist/client/assets/{design-BL2REeQ-.js → design-pZfTAgOJ.js} +2 -2
- package/dist/client/assets/{device-DUMKyegd.js → device-CG5GzxuX.js} +2 -2
- package/dist/client/assets/{dialog-BzESHWgr.js → dialog-wBelv1Ac.js} +2 -2
- package/dist/client/assets/diffPanelStore-C8bCQWTi.js +2 -0
- package/dist/client/assets/{diffRendering-BnN6RWwy.js → diffRendering-C_l9f0DJ.js} +2 -2
- package/dist/client/assets/{dist--Lo1A95S.js → dist-1X_vspyy.js} +3 -3
- package/dist/client/assets/{draft-input-BozMgkbl.js → draft-input-BhYlt4Pu.js} +2 -2
- package/dist/client/assets/{duoViewer-mOZwt5UN.js → duoViewer-C9zEhnho.js} +2 -2
- package/dist/client/assets/{dynamic-3CmgXeht.js → dynamic--1QgBotz.js} +3 -3
- package/dist/client/assets/{embeddedScripts-g3gqCUmg.js → embeddedScripts-B_jWJYkI.js} +2 -2
- package/dist/client/assets/{empty-CeYEMFdG.js → empty-CJnssipy.js} +2 -2
- package/dist/client/assets/entities-CRXY8xy3.js +2 -0
- package/dist/client/assets/{fileLinks-LQyYck3z.js → fileLinks-Bg40qEqI.js} +2 -2
- package/dist/client/assets/{fileTreeExpansion-CY-keZ2e.js → fileTreeExpansion-C_MZA2Fb.js} +2 -2
- package/dist/client/assets/fold-vertical-CN9ryhZz.js +2 -0
- package/dist/client/assets/{getDiffFileInput-ClUa7N40.js → getDiffFileInput-PLuWhYlb.js} +2 -2
- package/dist/client/assets/{htmlRender-CxBGTvqW.js → htmlRender-DNX1FsUO.js} +2 -2
- package/dist/client/assets/index-BeP8Inse.js +3 -0
- package/dist/client/assets/{input-K95B1E2P.js → input-Cd-93Wp0.js} +2 -2
- package/dist/client/assets/{input-group-BAbOiIZs.js → input-group-CsS-Psw7.js} +2 -2
- package/dist/client/assets/{kbd-D9Q8zN3_.js → kbd-DB5SHS11.js} +2 -2
- package/dist/client/assets/{keybindings-C427DPQo.js → keybindings-DBugaGH3.js} +2 -2
- package/dist/client/assets/{lazy-BDrl-IrZ.js → lazy-8c6T_8yh.js} +4 -4
- package/dist/client/assets/{lazyRouteComponent-Bi84pz13.js → lazyRouteComponent-DtOhACEQ.js} +2 -2
- package/dist/client/assets/{link-B57I0_wC.js → link-BrJlIcQX.js} +2 -2
- package/dist/client/assets/{linkedPrompt-zM8XlD0_.js → linkedPrompt-CN6Qis59.js} +2 -2
- package/dist/client/assets/main-CNyrs4J_.js +37 -0
- package/dist/client/assets/main-h6l_SQzg.css +2 -0
- package/dist/client/assets/mediaReference-CJpFszQ0.js +2 -0
- package/dist/client/assets/{mediaSource-BQkNpHYP.js → mediaSource-D0cInV6V.js} +2 -2
- package/dist/client/assets/{modelScene-DWYEc7-j.js → modelScene-BmBrNhLd.js} +2 -2
- package/dist/client/assets/number-field-CSK9SRbZ.js +2 -0
- package/dist/client/assets/{observeResize-nOwAB2yP.js → observeResize-CFw3_anS.js} +2 -2
- package/dist/client/assets/{onboarding-BpYTNtvC.js → onboarding-Eqww5SU9.js} +2 -2
- package/dist/client/assets/openFileInPreview-D0wySgTe.js +2 -0
- package/dist/client/assets/{p4ProjectFile-Dkwk3dWQ.js → p4ProjectFile-BBI5SxD4.js} +2 -2
- package/dist/client/assets/{pair-Bc34xPWk.js → pair-DQR36eTM.js} +2 -2
- package/dist/client/assets/{pendingSendStore-ettG1x40.js → pendingSendStore-Dxq1oBH6.js} +2 -2
- package/dist/client/assets/{phoneViewer-BCeyyPaZ.js → phoneViewer-DLo78qRr.js} +2 -2
- package/dist/client/assets/{pierre-icons-C2-xRx0J.js → pierre-icons-uaZzWTro.js} +2 -2
- package/dist/client/assets/{popover-CtPuvMeZ.js → popover-DU7x_UNP.js} +2 -2
- package/dist/client/assets/{preview-DIIM6Lws.js → preview-CiDRJw3K.js} +2 -2
- package/dist/client/assets/{preview-CS0uw3GP.js → preview-DpJtvz_q.js} +2 -2
- package/dist/client/assets/previewMiniPlayerStore-D98YBqjW.js +2 -0
- package/dist/client/assets/primary-B5Ds-X9y.js +2 -0
- package/dist/client/assets/primaryCloudLinkState-7otRI1yH.js +2 -0
- package/dist/client/assets/projectFilesQueryState-CgQDudyR.js +2 -0
- package/dist/client/assets/{projectScriptEditor-Bp7idsB3.js → projectScriptEditor-BvwaSAI1.js} +2 -2
- package/dist/client/assets/providerSkills-BzFbjrTC.js +2 -0
- package/dist/client/assets/{pullRequestDetail.logic-8vF2qB9V.js → pullRequestDetail.logic-D9w_E_Dv.js} +3 -3
- package/dist/client/assets/{pullRequestIcons-6_4tgVDN.js → pullRequestIcons-gBL3Yt9x.js} +2 -2
- package/dist/client/assets/{pullRequestReviewStore-C8_coQYO.js → pullRequestReviewStore-CDUFfLmu.js} +2 -2
- package/dist/client/assets/pullRequests-BZ7PzmTm.js +2 -0
- package/dist/client/assets/queries-CzRpIoRQ.js +2 -0
- package/dist/client/assets/query-B8d0w621.js +2 -0
- package/dist/client/assets/radio-group-XlBZKXvU.js +2 -0
- package/dist/client/assets/relay-BWVOLzv_.js +2 -0
- package/dist/client/assets/{renderScheduler-Cvu4oEGc.js → renderScheduler-B6SrQg1c.js} +2 -2
- package/dist/client/assets/{rightPanelStore-D-meSGn7.js → rightPanelStore-BuudmoUr.js} +2 -2
- package/dist/client/assets/runtime-DYDOkR3G.js +7 -0
- package/dist/client/assets/{runtimeModeConfig-MYD8WQl8.js → runtimeModeConfig-DyiI0NS9.js} +2 -2
- package/dist/client/assets/{scheduledTasksSettings.logic-DmlMHwKF.js → scheduledTasksSettings.logic-DK9Z9azP.js} +3 -3
- package/dist/client/assets/{scroll-area-D9QT2Odm.js → scroll-area-B1iVi_db.js} +2 -2
- package/dist/client/assets/{select-BtqP8nTL.js → select-Dn3MxyiK.js} +2 -2
- package/dist/client/assets/{selfImproveFindings-DZS7PCvJ.js → selfImproveFindings-D5ELz2sX.js} +2 -2
- package/dist/client/assets/server-DQkamj54.js +2 -0
- package/dist/client/assets/session-A0FOa5Fv.js +2 -0
- package/dist/client/assets/session-logic-21koHfxl.js +27 -0
- package/dist/client/assets/{settings-A-pqSt1Y.js → settings-RZUSGfch.js} +2 -2
- package/dist/client/assets/{settings.appearance-C_uChPSz.js → settings.appearance-C2NUZQFB.js} +2 -2
- package/dist/client/assets/settings.archived-BOhwFyi3.js +2 -0
- package/dist/client/assets/{settings.computer-use-Dg_7f0JL.js → settings.computer-use-BhT0XlhO.js} +2 -2
- package/dist/client/assets/settings.connections-CVIPNlOU.js +2 -0
- package/dist/client/assets/{settings.data-controls-SDdipjc2.js → settings.data-controls-GIrtB4_J.js} +2 -2
- package/dist/client/assets/{settings.decisions-CoyKjdc1.js → settings.decisions-BBnbf4E4.js} +2 -2
- package/dist/client/assets/{settings.designs-4eHPAt6y.js → settings.designs-BrpJ4wJk.js} +2 -2
- package/dist/client/assets/settings.diagnostics-H0YPr7JD.js +2 -0
- package/dist/client/assets/{settings.general-DAWqQIHm.js → settings.general-CuMxiE8w.js} +2 -2
- package/dist/client/assets/settings.integrations-bw-NYX6w.js +2 -0
- package/dist/client/assets/{settings.keybindings-B0oNRJrN.js → settings.keybindings-Mqx8YmX-.js} +2 -2
- package/dist/client/assets/{settings.open-source-licenses-BI8-fEG8.js → settings.open-source-licenses-DppmDqdO.js} +2 -2
- package/dist/client/assets/settings.plugins-PhsBK5Nz.js +5 -0
- package/dist/client/assets/settings.projects-DvjxFMyV.js +4 -0
- package/dist/client/assets/settings.providers-DZac28bF.js +3 -0
- package/dist/client/assets/{settings.scheduled-tasks-Bx6ZIK0R.js → settings.scheduled-tasks-_8iDYzJF.js} +2 -2
- package/dist/client/assets/{settings.secrets-Dt4ORQnt.js → settings.secrets-B5WZy_fN.js} +2 -2
- package/dist/client/assets/{settings.snap-shot-CytMd2pC.js → settings.snap-shot-BThcjeQt.js} +2 -2
- package/dist/client/assets/settings.source-control-Cj9K4HE8.js +2 -0
- package/dist/client/assets/{settings.storage-BfvQd358.js → settings.storage-D3QQPs1U.js} +2 -2
- package/dist/client/assets/settingsLayout-LNYGC372.js +3 -0
- package/dist/client/assets/{sidebar-DbrWNN9-.js → sidebar-CCcDCy-Q.js} +2 -2
- package/dist/client/assets/{sidebarProjectGrouping-CZnpDNTf.js → sidebarProjectGrouping-Bj_Qatcf.js} +2 -2
- package/dist/client/assets/{skeleton-DxuQc9Kk.js → skeleton-dlFZVmO8.js} +2 -2
- package/dist/client/assets/{sourceControl-BbrGhAuF.js → sourceControl-Tyc4OKDH.js} +2 -2
- package/dist/client/assets/sourceControlClients-ECBkjM0e.js +2 -0
- package/dist/client/assets/{spinner-DmRIQvmI.js → spinner-fU7Q2OR1.js} +2 -2
- package/dist/client/assets/src-B7vcPG0D.js +15 -0
- package/dist/client/assets/terminal-links-CPJORRle.js +2 -0
- package/dist/client/assets/terminalSessions-B00GvWIU.js +2 -0
- package/dist/client/assets/{textarea-C_3SxeEV.js → textarea-CEng2dlo.js} +2 -2
- package/dist/client/assets/{themePalette-DSR5tBE9.js → themePalette-CcasVi_y.js} +3 -3
- package/dist/client/assets/{threadCheckpoints-D0dMlqZE.js → threadCheckpoints-D7P5EX0m.js} +2 -2
- package/dist/client/assets/{toggle-Zti3zuzr.js → toggle-DN8nwGi8.js} +2 -2
- package/dist/client/assets/{toggle-group-D015gcqT.js → toggle-group-Dx-ruC5S.js} +2 -2
- package/dist/client/assets/{tooltip-CAzkzAoH.js → tooltip-Da633nbs.js} +2 -2
- package/dist/client/assets/uiStateStore-aIXF8Zlu.js +2 -0
- package/dist/client/assets/unfold-vertical-CldLe1hB.js +2 -0
- package/dist/client/assets/{usage-BJA7zQoS.js → usage-DXoXMoKb.js} +2 -2
- package/dist/client/assets/{usageAccess-D5FAb4jV.js → usageAccess-RRnEiTSy.js} +2 -2
- package/dist/client/assets/{usageFormat-Njxx7Q49.js → usageFormat-D95Lw1XX.js} +2 -2
- package/dist/client/assets/{usageShortcuts-DuJeedG7.js → usageShortcuts-3UXG3hMD.js} +2 -2
- package/dist/client/assets/{use-atom-command-DMW6SFOx.js → use-atom-command-BkSai4ZH.js} +2 -2
- package/dist/client/assets/{useAriaLabelledBy-E7KNTqMb.js → useAriaLabelledBy-rzE7PQnj.js} +2 -2
- package/dist/client/assets/useHandleNewThread-CT3UAzyB.js +2 -0
- package/dist/client/assets/{useLocation-hVHAnHTx.js → useLocation-D7ZCVKu2.js} +2 -2
- package/dist/client/assets/{useNavigate-B7EiSugn.js → useNavigate-C6_wm78C.js} +2 -2
- package/dist/client/assets/{useNavigateBack-BC3GGm7e.js → useNavigateBack-iqJmvild.js} +2 -2
- package/dist/client/assets/{useP4ConnectAuthPrompt-D3qxx30I.js → useP4ConnectAuthPrompt-CKTZ-MxU.js} +2 -2
- package/dist/client/assets/{useParams-C5b2x5BH.js → useParams-DND-Jy5h.js} +2 -2
- package/dist/client/assets/{usePermissionStatus-Zf48W2tu.js → usePermissionStatus-DFJ-2rdQ.js} +2 -2
- package/dist/client/assets/{usePopupViewport-Dtwu2x5j.js → usePopupViewport-EARvZG9w.js} +2 -2
- package/dist/client/assets/{usePullRequestActions-BtPaWuCg.js → usePullRequestActions-DRrQpPhD.js} +3 -3
- package/dist/client/assets/{useRegisterFieldControl-BMmbsxkx.js → useRegisterFieldControl-Byb-EJOb.js} +2 -2
- package/dist/client/assets/{useScopedModelAvailability-BIveWOlk.js → useScopedModelAvailability-tXU_0tMY.js} +2 -2
- package/dist/client/assets/useSettings-BOuYsEM0.js +3 -0
- package/dist/client/assets/utils-DsOiwDNN.js +24 -0
- package/dist/client/assets/vcsRefInvalidation-CnjZD1r1.js +2 -0
- package/dist/client/assets/welcome-BgxI7gmD.js +2 -0
- package/dist/client/index.html +1 -1
- package/dist/{mcpResponsePayloads-BBvPAlwj.mjs → mcpResponsePayloads-tqyeJD3c.mjs} +10 -9
- package/dist/{ProjectCloneTracker-DAE46hjz.mjs → preview-C_h8Tda3.mjs} +894 -438
- package/dist/{renderer-iWfzRWCX.mjs → renderer-BeTlHpQk.mjs} +2 -2
- package/dist/{runtime-CllDK9QU.mjs → runtime-BUfUqrrw.mjs} +3 -3
- package/dist/{runtimeLayer-CblMBDQ6.mjs → runtimeLayer-5R-ZfBsl.mjs} +3152 -2949
- package/dist/{runtimeLayer-D1H3yRj8.mjs → runtimeLayer-DurN_FAN.mjs} +1 -1
- package/dist/{server-vm1eH-y1.mjs → server-DuD96ZSr.mjs} +347 -228
- package/dist/{sha2-9FUhed4s.mjs → sha2-oCwRxj9g.mjs} +13 -7
- package/package.json +1 -1
- package/dist/AcpMcpStdioBridge-RQnwhGrw.mjs +0 -3
- package/dist/client/assets/AlertDialogRoot-D2Lzxp77.js +0 -2
- package/dist/client/assets/ChatGptUsageButton-CM16mB7z.js +0 -2
- package/dist/client/assets/ChatMarkdown-LYkpVHJO.js +0 -49
- package/dist/client/assets/CheckboxIndicator-CLFg8-A1.js +0 -2
- package/dist/client/assets/CodexSetupSection.logic-CNAX4_fV.js +0 -2
- package/dist/client/assets/CollapsiblePanel-BlUD5mJC.js +0 -2
- package/dist/client/assets/ComboboxClear-DKHwuDAL.js +0 -2
- package/dist/client/assets/CompositeRoot-_C3uLH2F.js +0 -2
- package/dist/client/assets/DevicePanel-Dvozgov3.js +0 -2
- package/dist/client/assets/DeviceSetup-O_9LLGD9.js +0 -2
- package/dist/client/assets/DialogTitle-C9j5Tmuy.js +0 -2
- package/dist/client/assets/DiffPanel-CDixqNzb.js +0 -2
- package/dist/client/assets/FoldedSettingsSection-CrJX4FnL.js +0 -2
- package/dist/client/assets/Input-BWhtnCC0.js +0 -2
- package/dist/client/assets/JZOYTAAL-BCdmxsmo.js +0 -1
- package/dist/client/assets/ModelLiveLayer-CxX5pYmA.js +0 -3
- package/dist/client/assets/PanelLayoutControls-CC5OYRRR.js +0 -216
- package/dist/client/assets/PopoverHandle-BwqnKm9Y.js +0 -2
- package/dist/client/assets/PreviewPanel-BvRNyyKQ.js +0 -2
- package/dist/client/assets/ProjectDefaultsSettings-rvN_67Gu.js +0 -2
- package/dist/client/assets/ProviderModelPicker-Cq3CogU6.js +0 -2
- package/dist/client/assets/PullRequestCodeTab-C5kr72DG.js +0 -6
- package/dist/client/assets/RenderErrorBoundary-DgYrYlQR.js +0 -23
- package/dist/client/assets/ScheduledTasksSettings-CvbQDrJp.js +0 -6
- package/dist/client/assets/SelectScrollUpArrow-Dj2om6Qx.js +0 -2
- package/dist/client/assets/ThreadTerminalDrawer-DcYWT4k2.js +0 -5
- package/dist/client/assets/TooltipProvider-BzOo4iyi.js +0 -2
- package/dist/client/assets/_chat-DoDgVLYz.js +0 -47
- package/dist/client/assets/_chat.pull-requests-0Ce1mGUC.js +0 -2
- package/dist/client/assets/assets-lJdcWn_Q.js +0 -2
- package/dist/client/assets/connect-agent-DsQQcex2.js +0 -2
- package/dist/client/assets/diffPanelStore-B-hQEy6C.js +0 -2
- package/dist/client/assets/entities-CpJdh0W5.js +0 -2
- package/dist/client/assets/fold-vertical-BscQ96iN.js +0 -2
- package/dist/client/assets/index-BWKkBtFt.js +0 -3
- package/dist/client/assets/main-C8b9a0ht.js +0 -37
- package/dist/client/assets/main-CCH0X0zL.css +0 -2
- package/dist/client/assets/mediaReference-BIsAfUoY.js +0 -2
- package/dist/client/assets/number-field-D6t0GpAB.js +0 -2
- package/dist/client/assets/openFileInPreview-DFpXOfx7.js +0 -2
- package/dist/client/assets/previewMiniPlayerStore-oJw0qrRM.js +0 -2
- package/dist/client/assets/primary-B0bbGdiR.js +0 -2
- package/dist/client/assets/primaryCloudLinkState-B6CxZwAR.js +0 -2
- package/dist/client/assets/projectFilesQueryState-DpLF9eJd.js +0 -2
- package/dist/client/assets/providerSkills-yqPKKW6i.js +0 -2
- package/dist/client/assets/pullRequests-u-PJpGXV.js +0 -2
- package/dist/client/assets/queries-DDAXRF4r.js +0 -2
- package/dist/client/assets/query-DpmTmXUV.js +0 -2
- package/dist/client/assets/radio-group-DSfZzUu8.js +0 -2
- package/dist/client/assets/relay-CnLeC-mg.js +0 -2
- package/dist/client/assets/runtime-DUPVFypn.js +0 -7
- package/dist/client/assets/server-BYnv0CK4.js +0 -2
- package/dist/client/assets/session-BryEqNW-.js +0 -2
- package/dist/client/assets/session-logic-DZfPxiBF.js +0 -26
- package/dist/client/assets/settings.archived-BtKfrhpi.js +0 -2
- package/dist/client/assets/settings.connections-CHawbHDz.js +0 -2
- package/dist/client/assets/settings.diagnostics-BFlcsuN0.js +0 -2
- package/dist/client/assets/settings.integrations-CpUf4-MX.js +0 -2
- package/dist/client/assets/settings.plugins-B6My9wD7.js +0 -5
- package/dist/client/assets/settings.projects-hrhEEIli.js +0 -4
- package/dist/client/assets/settings.providers-BKeGnq6G.js +0 -3
- package/dist/client/assets/settings.source-control-B6eUVvNg.js +0 -2
- package/dist/client/assets/settingsLayout-BijX6mlS.js +0 -3
- package/dist/client/assets/sourceControlClients-CG8qRQgm.js +0 -2
- package/dist/client/assets/src-BZzGU-vc.js +0 -15
- package/dist/client/assets/terminal-links-FD1wyGOp.js +0 -2
- package/dist/client/assets/terminalSessions-D1m7FXoa.js +0 -2
- package/dist/client/assets/uiStateStore-B0Z02qoV.js +0 -2
- package/dist/client/assets/unfold-vertical-DeuiNAAp.js +0 -2
- package/dist/client/assets/useHandleNewThread-Cmiu3y4G.js +0 -2
- package/dist/client/assets/useSettings-C6RmJr-q.js +0 -3
- package/dist/client/assets/utils-Cs97wR6T.js +0 -24
- package/dist/client/assets/vcsRefInvalidation-CAa5en8i.js +0 -2
- package/dist/client/assets/welcome-BRX7e-eN.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Bu as i,Cu as a,Eu as o,Jo as s,Ku as c,Qc as l,Ql as u,el as d,fd as f,hr as p,mr as m,nu as h,pl as g,t as _,tu as v}from"./utils-Cs97wR6T.js";import{$m as y,Ta as b,Up as x,Wl as S,ba as ee,mh as te,oh as ne,sh as re,uh as C,va as w}from"./src-BZzGU-vc.js";import{Dr as ie,Sr as ae}from"./runtime-DUPVFypn.js";import{m as T,p as E,u as D}from"./TooltipProvider-BzOo4iyi.js";import{a as O,m as k}from"./relay-CnLeC-mg.js";import{O as A,q as oe}from"./useSettings-C6RmJr-q.js";import{f as j}from"./server-BYnv0CK4.js";import{i as M,n as N,t as se}from"./session-BryEqNW-.js";import{n as P}from"./query-DpmTmXUV.js";import{t as ce}from"./use-atom-command-DMW6SFOx.js";import{a as le,o as ue,u as de}from"./timestampFormat-Dq7sHZpd.js";import{a as F,n as I,t as L}from"./tooltip-CAzkzAoH.js";import{n as fe,t as R}from"./toggle-group-D015gcqT.js";import{t as pe}from"./input-K95B1E2P.js";import{t as z}from"./scroll-area-D9QT2Odm.js";import{F as me,V as he,i as ge,s as B,u as _e}from"./settingsLayout-BijX6mlS.js";import{t as ve}from"./ConnectionStatusDot-vOKtZfeV.js";import{Vo as ye,Wo as V,ba as be,gn as H}from"./main-C8b9a0ht.js";import{t as xe}from"./usageAccess-D5FAb4jV.js";import{t as Se}from"./ExpandableText-gKNgCxfU.js";import{t as Ce}from"./SettingsScopeNotice-pJqEfHRd.js";var U=n(),W=e(r(),1);function we(e){let t=(0,U.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,W.jsx)(F,{render:(0,W.jsx)(p,{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,W.jsx)(I,{side:`top`,children:`Send SIGINT`}),t[5]=o):o=t[5];let s;t[6]===a?s=t[7]:(s=(0,W.jsxs)(L,{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,W.jsx)(F,{render:(0,W.jsx)(p,{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,W.jsx)(I,{side:`top`,children:`Send SIGKILL`}),t[13]=u):u=t[13];let d;t[14]===l?d=t[15]:(d=(0,W.jsxs)(L,{children:[l,u]}),t[14]=l,t[15]=d);let f;return t[16]!==s||t[17]!==d?(f=(0,W.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 G=e(t(),1);function Te(e){let t=A(),n=e===void 0?t?.environmentId??null:e,r=M(n,w),i=P(n===null||!r?null:j.resourceTelemetry({environmentId:n,input:{}})),a=ce(j.retryResourceTelemetry,{reportFailure:!1}),o=(0,G.useCallback)(async()=>{if(n===null)throw Error(`No environment is selected.`);if(!N(n,`environment:maintain`)||!N(n,`diagnostics:read`))throw Error(`This connection cannot restart the resource monitor.`);let e=await a({environmentId:n,input:{}});if(e._tag===`Failure`)throw x(e.cause);return i.refresh(),e.value.snapshot},[n,a]);return{...i,retry:o}}function Ee(e,t){let n=(0,U.c)(4),r=A(),i=t===void 0?r?.environmentId??null:t,a=M(i,w),o;return n[0]!==a||n[1]!==i||n[2]!==e?(o=i===null||!a?null:j.resourceTelemetryHistory({environmentId:i,input:e}),n[0]=a,n[1]=i,n[2]=e,n[3]=o):o=n[3],P(o)}function De(e){return`${e.identity.pid}:${e.identity.startTimeMs}`}function Oe(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=De(t);r.has(e)||(r.add(e),i(t.identity.pid))}};for(let n of e)t.has(De(n))&&i(n.identity.pid);return e.filter(e=>!r.has(De(e)))}function ke(e){return e.nativeStatus===null&&e.error!==null||e.nativeStatus===`degraded`||e.nativeStatus===`unavailable`||e.nativeStatus===`stopped`}function K(e){return e.value<=0?0:Math.max(e.minimumVisiblePercent,e.value/Math.max(1,e.max)*100)}function Ae(e){return Math.max(1,...e.map(e=>e.avgCpuPercent))}var q=[{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 J(e){return`${H(e)}/s`}function je(e){let t=e/1e3;if(t<60)return`${t.toFixed(t>=10?1:2).replace(/\.0+$/,``)}s`;let n=t/60;return n<60?`${n.toFixed(n>=10?1:2).replace(/\.0+$/,``)}m`:`${(n/60).toFixed(2).replace(/\.0+$/,``)}h`}function Me(e){return e<1e3?`${Math.round(e)} µs`:e<1e6?`${(e/1e3).toFixed(2).replace(/\.0+$/,``)} ms`:`${(e/1e6).toFixed(2).replace(/\.0+$/,``)} s`}function Ne(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 Pe(e){return`${e.identity.pid}:${e.identity.startTimeMs}`}function Fe(e){return`${e.identity.pid}:${e.identity.startTimeMs}`}function Ie(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 Le(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-p4`:return`P4 process`}}function Re(e){return e===`resource-monitor`?`bg-warning`:e.startsWith(`electron-`)?`bg-info`:e===`server`?`bg-violet-500`:`bg-success`}function ze(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 Be(e,t){return e===`true`?t.true:e===`false`?t.false:`Unknown`}function Ve(e){return e===`healthy`?`default`:e===`starting`||e===`degraded`?`warning`:`danger`}function He(e){let t=(0,U.c)(20),{label:n,status:r,presentation:i}=e,a;t[0]!==i?.tone||t[1]!==r?(a=i?.tone??Ve(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=_(`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=_(`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 v;t[13]===g?v=t[14]:(v=(0,W.jsx)(`span`,{className:g}),t[13]=g,t[14]=v);let y=i?.label??r,b;return t[15]!==n||t[16]!==v||t[17]!==y||t[18]!==d?(b=(0,W.jsxs)(`span`,{className:d,children:[v,n,` `,y]}),t[15]=n,t[16]=v,t[17]=y,t[18]=d,t[19]=b):b=t[19],b}function Ue(e){let t=(0,U.c)(9),{sampledAt:n}=e;if(_e(),!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(`span`,{className:`text-2xs text-muted-foreground/55`,children:`Waiting for sample`}),t[0]=e):e=t[0],e}let r;t[1]===n?r=t[2]:(r=le(S(n)),t[1]=n,t[2]=r);let i=r;if(!i){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(`span`,{className:`text-2xs text-muted-foreground/55`,children:`Waiting for sample`}),t[3]=e):e=t[3],e}let a;t[4]===i.value?a=t[5]:(a=(0,W.jsx)(`span`,{className:`font-mono tabular-nums`,children:i.value}),t[4]=i.value,t[5]=a);let o=i.suffix?` ${i.suffix}`:``,s;return t[6]!==a||t[7]!==o?(s=(0,W.jsxs)(`span`,{className:`text-2xs text-muted-foreground/60`,children:[`Updated `,a,o]}),t[6]=a,t[7]=o,t[8]=s):s=t[8],s}function Y(e){let t=(0,U.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,W.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,W.jsx)(`span`,{className:`truncate`,children:r}),t[2]=r,t[3]=l);let u;t[4]!==c||t[5]!==l?(u=(0,W.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=_(`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,W.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,W.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,W.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 We(e){let t=(0,U.c)(37),{label:n,accentClass:r,aggregate:i}=e,a;t[0]===r?a=t[1]:(a=_(`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,W.jsx)(`span`,{className:a}),t[2]=a,t[3]=o);let s;t[4]===n?s=t[5]:(s=(0,W.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,W.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,W.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,W.jsx)(Ge,{label:`CPU`,value:f}),t[14]=f,t[15]=p);let m;t[16]===i.currentRssBytes?m=t[17]:(m=H(i.currentRssBytes),t[16]=i.currentRssBytes,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,W.jsx)(Ge,{label:`Memory`,value:m}),t[18]=m,t[19]=h);let g;t[20]===i.ioReadBytesPerSecond?g=t[21]:(g=J(i.ioReadBytesPerSecond),t[20]=i.ioReadBytesPerSecond,t[21]=g);let v;t[22]===g?v=t[23]:(v=(0,W.jsx)(Ge,{label:`Read`,value:g}),t[22]=g,t[23]=v);let y;t[24]===i.ioWriteBytesPerSecond?y=t[25]:(y=J(i.ioWriteBytesPerSecond),t[24]=i.ioWriteBytesPerSecond,t[25]=y);let b;t[26]===y?b=t[27]:(b=(0,W.jsx)(Ge,{label:`Write`,value:y}),t[26]=y,t[27]=b);let x;t[28]!==h||t[29]!==v||t[30]!==b||t[31]!==p?(x=(0,W.jsxs)(`div`,{className:`mt-3.5 grid grid-cols-2 gap-x-4 gap-y-2.5`,children:[p,h,v,b]}),t[28]=h,t[29]=v,t[30]=b,t[31]=p,t[32]=x):x=t[32];let S;return t[33]!==x||t[34]!==o||t[35]!==u?(S=(0,W.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,x]}),t[33]=x,t[34]=o,t[35]=u,t[36]=S):S=t[36],S}function Ge(e){let t=(0,U.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,W.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,W.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,W.jsxs)(`div`,{className:`min-w-0`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Ke(e){let t=(0,U.c)(21),{label:n,health:r}=e,i;t[0]!==r.lastError||t[1]!==r.status?(i=r.status===`unavailable`&&y(r.lastError,Ye),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,W.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.`:te(r.lastError,{onNone:Je,onSome:qe}),t[5]=a,t[6]=r.lastError,t[7]=s):s=t[7];let c;t[8]===s?c=t[9]:(c=(0,W.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,W.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,W.jsx)(He,{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,W.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 qe(e){return e}function Je(){return`No reported errors`}function Ye(e){return e.includes(`'web' mode`)}function X(e){let t=(0,U.c)(10),{label:n,value:r,valueClassName:i}=e,a;t[0]===n?a=t[1]:(a=(0,W.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=_(`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,W.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,W.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,U.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=q.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=q.map(Ze),t[4]=s):s=t[4];let c;return t[5]!==a||t[6]!==o?(c=(0,W.jsx)(fe,{"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,W.jsx)(R,{value:String(e.windowMs),children:e.label},e.windowMs)}function Qe(e){let t=(0,U.c)(15),{buckets:n}=e,r,i,a,o;if(t[0]!==n){let e=Ae(n),s=Math.max(1,...n.map($e));a=`border-t border-border/60 px-4 py-4 sm:px-5`;let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`h-1.5 w-3 rounded-full bg-foreground/70`}),` CPU average`]}),t[5]=c):c=t[5];let l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`h-1.5 w-3 rounded-full bg-info/70`}),` I/O reads`]}),t[6]=l):l=t[6],t[7]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-x-4 gap-y-1 text-3xs text-muted-foreground/65`,children:[c,l,(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,W.jsx)(`span`,{className:`h-1.5 w-3 rounded-full bg-warning/80`}),` I/O writes`]})]}),t[7]=o):o=t[7],r=`flex h-32 items-end gap-1 overflow-hidden rounded-lg border border-border/40 bg-muted/8 px-2 pt-3 pb-2`,i=n.map(t=>{let n=K({value:t.avgCpuPercent,max:e,minimumVisiblePercent:2}),r=K({value:t.ioReadBytes,max:s,minimumVisiblePercent:1}),i=K({value:t.ioWriteBytes,max:s,minimumVisiblePercent:1});return(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsxs)(`div`,{className:`grid h-full min-w-1 flex-1 grid-cols-3 items-end gap-px`,children:[(0,W.jsx)(`span`,{className:`block rounded-t-sm bg-foreground/65`,style:{height:`${n}%`}}),(0,W.jsx)(`span`,{className:`block rounded-t-sm bg-info/70`,style:{height:`${r}%`}}),(0,W.jsx)(`span`,{className:`block rounded-t-sm bg-warning/80`,style:{height:`${i}%`}})]})}),(0,W.jsx)(I,{side:`top`,className:`text-left`,children:(0,W.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,W.jsxs)(`div`,{children:[`CPU avg `,t.avgCpuPercent.toFixed(1),`%`]}),(0,W.jsxs)(`div`,{children:[`CPU peak `,t.maxCpuPercent.toFixed(1),`%`]}),(0,W.jsxs)(`div`,{children:[`Read `,H(t.ioReadBytes)]}),(0,W.jsxs)(`div`,{children:[`Write `,H(t.ioWriteBytes)]})]})})]},S(t.startedAt))}),t[0]=n,t[1]=r,t[2]=i,t[3]=a,t[4]=o}else r=t[1],i=t[2],a=t[3],o=t[4];let s;t[8]!==r||t[9]!==i?(s=(0,W.jsx)(`div`,{className:r,children:i}),t[8]=r,t[9]=i,t[10]=s):s=t[10];let c;return t[11]!==a||t[12]!==o||t[13]!==s?(c=(0,W.jsxs)(`div`,{className:a,children:[o,s]}),t[11]=a,t[12]=o,t[13]=s,t[14]=c):c=t[14],c}function $e(e){return e.ioReadBytes+e.ioWriteBytes}function et(e){let t=(0,U.c)(26),{process:n,collapsed:r,onToggle:i}=e,a;t[0]===n?a=t[1]:(a=Ie(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,W.jsx)(m,{size:`icon-micro`,variant:`ghost-muted`,onClick:()=>i(n),"aria-label":r?`Expand ${o}`:`Collapse ${o}`,children:(0,W.jsx)(D,{className:`size-3.5`,icon:r?T:E})}):(0,W.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=_(`size-1.5 rounded-full`,Re(n.category)),t[10]=n.category,t[11]=d);let f;t[12]===d?f=t[13]:(f=(0,W.jsx)(`span`,{className:d}),t[12]=d,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`min-w-0 truncate font-medium text-foreground`,children:o})}),t[14]=o,t[15]=p);let h=n.command||n.name,g;t[16]===h?g=t[17]:(g=(0,W.jsx)(I,{side:`top`,variant:`code`,children:h}),t[16]=h,t[17]=g);let v;t[18]!==p||t[19]!==g?(v=(0,W.jsxs)(L,{children:[p,g]}),t[18]=p,t[19]=g,t[20]=v):v=t[20];let y;return t[21]!==v||t[22]!==l||t[23]!==u||t[24]!==f?(y=(0,W.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,v]}),t[21]=v,t[22]=l,t[23]=u,t[24]=f,t[25]=y):y=t[25],y}function tt(e){return e.category===`server-child`||e.category===`provider-root`||e.category===`terminal-root`}function nt(e){let t=(0,U.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,W.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(Pe(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,W.jsx)(we,{disabled:s,onSignal:c}),t[7]=s,t[8]=c,t[9]=l):l=t[9],l}function rt(e){let t=(0,U.c)(22),{processes:n,canMaintainEnvironment:r,signalingKeys:i,onSignal:a}=e,[o,s]=(0,G.useState)(it),c;t[0]!==o||t[1]!==n?(c=Oe(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=Pe(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,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[20%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[7%]`}),(0,W.jsx)(`col`,{className:`w-[8%]`}),(0,W.jsx)(`col`,{className:`w-[9%]`}),(0,W.jsx)(`col`,{className:`w-[9%]`}),(0,W.jsx)(`col`,{className:`w-[9%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[8%]`}),(0,W.jsx)(`col`,{className:`w-[6%]`}),(0,W.jsx)(`col`,{className:`w-[4%]`})]}),t[4]=f):f=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,W.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,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Process`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Category`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU Time`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Memory`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Read/s`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Write/s`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Read Total`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Write Total`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`PID`}),(0,W.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,W.jsx)(`tr`,{children:(0,W.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,W.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,W.jsx)(`td`,{className:`px-4 py-2 sm:pl-5`,children:(0,W.jsx)(et,{process:e,collapsed:o.has(Pe(e)),onToggle:d})}),(0,W.jsx)(`td`,{className:`truncate px-3 py-2 text-2xs text-muted-foreground`,children:Le(e.category)}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:[e.cpuPercent.toFixed(1),`%`]}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:je(e.cpuTimeMs)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:H(e.residentBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-info-foreground`,children:J(e.ioReadBytesPerSecond)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-warning-foreground`,children:J(e.ioWriteBytesPerSecond)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:H(e.ioReadBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{children:H(e.ioWriteBytes)})}),(0,W.jsx)(I,{side:`top`,children:ze(e.ioSemantics)})]})}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:e.identity.pid}),(0,W.jsx)(`td`,{className:`px-2 py-2 text-right sm:pr-4`,children:(0,W.jsx)(nt,{process:e,canMaintainEnvironment:r,signalingKeys:i,onSignal:a})})]},Pe(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,W.jsx)(`div`,{className:`border-t border-border/60`,children:(0,W.jsx)(z,{chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[min(68vh,48rem)] w-full max-w-full`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[1320px] table-fixed text-left text-xs`,children:[f,p,(0,W.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,U.c)(9),{processes:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[24%]`}),(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[7%]`}),(0,W.jsx)(`col`,{className:`w-[5%]`})]}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,W.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,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Process`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Category`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU Time`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Peak CPU`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Peak Mem`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Read`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Write`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Samples`}),(0,W.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,W.jsx)(`tr`,{children:(0,W.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,W.jsx)(`div`,{className:`border-t border-border/60`,children:(0,W.jsx)(z,{chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[28rem] w-full max-w-full`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[1020px] table-fixed text-left text-xs`,children:[r,i,(0,W.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,W.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,W.jsx)(`td`,{className:`px-4 py-2 sm:pl-5`,children:(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`block truncate font-medium text-foreground`,children:e.name||e.command})}),(0,W.jsx)(I,{side:`top`,variant:`code`,children:e.command||e.name})]})}),(0,W.jsx)(`td`,{className:`truncate px-3 py-2 text-2xs text-muted-foreground`,children:Le(e.category)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:je(e.cpuTimeMs)}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:[e.maxCpuPercent.toFixed(1),`%`]}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:H(e.peakRssBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-info-foreground`,children:H(e.ioReadBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-warning-foreground`,children:H(e.ioWriteBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground`,children:e.sampleCount}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-muted-foreground sm:pr-5`,children:e.identity.pid})]},Fe(e))}function st(e){let t=(0,U.c)(9),{entries:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[22%]`}),(0,W.jsx)(`col`,{className:`w-[28%]`}),(0,W.jsx)(`col`,{className:`w-[14%]`}),(0,W.jsx)(`col`,{className:`w-[14%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[12%]`})]}),t[0]=r):r=t[0];let i;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,W.jsx)(`thead`,{className:`border-b border-border/60 text-3xs uppercase tracking-widest text-muted-foreground/65`,children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Component`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Operation`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Logical Read`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Logical Write`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Count`}),(0,W.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,W.jsx)(`tr`,{children:(0,W.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,W.jsx)(`div`,{className:`overflow-x-auto border-t border-border/60`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[720px] table-fixed text-left text-xs`,children:[r,i,(0,W.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,W.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,W.jsx)(`td`,{className:`truncate px-4 py-2 font-medium text-foreground sm:pl-5`,children:e.component}),(0,W.jsx)(`td`,{className:`truncate px-3 py-2 text-muted-foreground`,children:e.operation}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-info-foreground`,children:H(e.logicalReadBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums text-warning-foreground`,children:H(e.logicalWriteBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right font-mono tabular-nums`,children:e.count}),(0,W.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).replace(/\.0+$/,``),`s`]})]},`${e.component}:${e.operation}`)}function lt({environmentId:e}){let[t,n]=(0,G.useState)(9e5),r=q.find(e=>e.windowMs===t)??q[1],a=M(e,ee),s=Te(e),c=s.retry,u=Ee({windowMs:r.windowMs,bucketMs:r.bucketMs},e),p=u.refresh,_=(0,G.useRef)({environmentId:e,windowMs:t,refreshHistory:p});(0,G.useEffect)(()=>{_.current={environmentId:e,windowMs:t,refreshHistory:p}},[e,t,p]);let y=ce(j.signalProcess,{reportFailure:!1}),[b,x]=(0,G.useState)(()=>new Set),S=(0,G.useRef)(new Set),C=(0,G.useRef)(e);(0,G.useEffect)(()=>(C.current=e,()=>{C.current=null}),[e]);let[w,T]=(0,G.useState)(!1),E=s.data,D=E?.groups.allP4,k=(0,G.useCallback)(async(e,t)=>{let n=C.current;if(n===null||!N(n,`environment:maintain`))return;let r=Pe(e);if(S.current.has(r))return;let i=new Set(S.current).add(r);S.current=i,x(i);let a=()=>{let e=new Set(S.current);e.delete(r),S.current=e,x(e)};if(t===`SIGKILL`){let n=!1;try{n=await oe().dialogs.confirm(`Send SIGKILL to process ${e.identity.pid}? This cannot be handled by the process.`,{variant:`destructive`})}catch(e){a(),O.add({type:`error`,title:`Could not confirm signal`,description:e instanceof Error?e.message:`Failed to send ${t}.`});return}if(!n){a();return}}C.current!==n||!N(n,`environment:maintain`)?a():y({environmentId:n,input:{pid:e.identity.pid,startTimeMs:e.identity.startTimeMs,signal:t}}).then(n=>{if(n._tag===`Failure`){if(ae(n))return;throw ie(n)}n.value.signaled||O.add({type:`error`,title:`Could not send ${t}`,description:ne(n.value.message,()=>`Failed to send ${t} to process ${e.identity.pid}.`)})}).catch(e=>{O.add({type:`error`,title:`Could not send ${t}`,description:e instanceof Error?e.message:`Failed to send ${t}.`})}).finally(()=>{a()})},[y]),A=(0,G.useCallback)(()=>{let e=C.current;e!==null&&N(e,`environment:maintain`)&&(T(!0),c().then(()=>{p();let n=_.current;C.current===e&&n.environmentId===e&&n.windowMs!==t&&n.refreshHistory()}).catch(e=>{O.add({type:`error`,title:`Could not restart resource monitor`,description:e instanceof Error?e.message:`The resource monitor retry failed.`})}).finally(()=>{T(!1)}))},[c]),se=E?re(E.speedLimitPercent):null,P=ke({nativeStatus:E?.health.native.status??null,error:s.error}),le=E!==null&&(E.power.onBattery!==`unknown`||E.power.lowPowerMode!==`unknown`||E.power.idle!==`unknown`||E.power.locked!==`unknown`||E.power.thermalState!==`unknown`);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(B,{title:`Resource monitor`,icon:(0,W.jsx)(l,{className:`size-4 text-muted-foreground`}),headerAction:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E?(0,W.jsx)(He,{label:`Native`,status:E.health.native.status}):null,(0,W.jsx)(Ue,{sampledAt:E?.readAt??null}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(m,{size:`icon-micro`,variant:`ghost`,disabled:s.isPending,onClick:s.refresh,"aria-label":`Refresh resource telemetry`,children:(0,W.jsx)(V,{size:`xs`,refreshing:s.isPending})})}),(0,W.jsx)(I,{side:`top`,children:`Refresh telemetry snapshot`})]})]}),children:(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-[inherit]`,children:[(0,W.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:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-3xs font-semibold uppercase tracking-widest text-muted-foreground/70`,children:`P4 system footprint`}),(0,W.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.`})]}),(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-3xs text-muted-foreground/65`,children:[(0,W.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),`Sampling every `,E?Ne(E.sampleIntervalMs):`...`]})]}),(0,W.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-y divide-border/55 md:grid-cols-3`,children:[(0,W.jsx)(Y,{icon:(0,W.jsx)(v,{className:`size-3.5`}),label:`Current CPU`,value:D?`${D.currentCpuPercent.toFixed(1)}%`:`...`,detail:D?`${je(D.cpuTimeMs)} observed CPU time`:void 0}),(0,W.jsx)(Y,{icon:(0,W.jsx)(f,{className:`size-3.5`}),label:`Resident memory`,value:D?H(D.currentRssBytes):`...`,detail:D?`${H(D.peakRssBytes)} combined process peaks`:void 0}),(0,W.jsx)(Y,{icon:(0,W.jsx)(l,{className:`size-3.5`}),label:`Process count`,value:D?String(D.processCount):`...`,detail:D?`${D.processStarts} starts · ${D.processExits} exits`:void 0}),(0,W.jsx)(Y,{icon:(0,W.jsx)(i,{className:`size-3.5`}),label:`Read throughput`,value:D?J(D.ioReadBytesPerSecond):`...`,detail:D?`${H(D.ioReadBytes)} observed`:void 0}),(0,W.jsx)(Y,{icon:(0,W.jsx)(h,{className:`size-3.5`}),label:`Write throughput`,value:D?J(D.ioWriteBytesPerSecond):`...`,detail:D?`${H(D.ioWriteBytes)} observed`:void 0,tone:D&&D.ioWriteBytesPerSecond>=10485760?`danger`:D&&D.ioWriteBytesPerSecond>=1048576?`warning`:`default`}),(0,W.jsx)(Y,{icon:(0,W.jsx)(o,{className:`size-3.5`}),label:`CPU speed limit`,value:E?se===null?`Unknown`:`${se.toFixed(0)}%`:`...`,detail:E?`${E.power.thermalState} thermal state`:void 0,tone:se!==null&&se<80?`warning`:`default`})]}),s.error?(0,W.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,W.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:s.error})]}):null,E?(0,W.jsxs)(`div`,{className:`grid border-t border-border/60 bg-muted/10 md:grid-cols-3`,children:[(0,W.jsx)(We,{label:`Backend + agents`,accentClass:`bg-success/80`,aggregate:E.groups.backend}),(0,W.jsx)(We,{label:`Desktop`,accentClass:`bg-info/80`,aggregate:E.groups.electron}),(0,W.jsx)(We,{label:`Monitor overhead`,accentClass:`bg-warning/80`,aggregate:E.groups.monitor})]}):null]})}),(0,W.jsx)(B,{title:`Host & collection`,icon:(0,W.jsx)(o,{className:`size-4 text-muted-foreground`}),headerAction:P?(0,W.jsxs)(m,{size:`xs`,variant:`outline`,disabled:w,onClick:A,children:[(0,W.jsx)(V,{size:`xs`,refreshing:w}),`Retry monitor`]}):null,children:(0,W.jsxs)(`div`,{className:`grid overflow-hidden rounded-[inherit] md:grid-cols-2 md:divide-x md:divide-border/60`,children:[(0,W.jsxs)(`div`,{className:`px-4 py-4 sm:px-5`,children:[(0,W.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-3xs font-semibold uppercase tracking-widest text-muted-foreground/70`,children:[(0,W.jsx)(`span`,{className:`flex size-6 items-center justify-center rounded-md bg-muted/60`,children:(0,W.jsx)(g,{className:`size-3.5`})}),`Host state`]}),le&&E?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(X,{label:`Power source`,value:Be(E.power.onBattery,{true:`Battery`,false:`External power`})}),(0,W.jsx)(X,{label:`Low power mode`,value:Be(E.power.lowPowerMode,{true:`Enabled`,false:`Disabled`})}),(0,W.jsx)(X,{label:`Idle`,value:`${Be(E.power.idle,{true:`Idle`,false:`Active`})}${E.power.idleSeconds===null?``:` · ${Math.round(E.power.idleSeconds)}s`}`}),(0,W.jsx)(X,{label:`Session`,value:E.power.suspended?`Suspended`:Be(E.power.locked,{true:`Locked`,false:`Unlocked`})}),(0,W.jsx)(X,{label:`Thermal`,value:E.power.thermalState,valueClassName:E.power.thermalState===`serious`||E.power.thermalState===`critical`?`text-destructive`:void 0})]}):(0,W.jsxs)(`div`,{className:`rounded-xl border border-dashed border-border/70 bg-muted/20 px-4 py-5`,children:[(0,W.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`Desktop host signals not connected`}),(0,W.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.`})]})]}),(0,W.jsxs)(`div`,{className:`border-t border-border/60 px-4 py-4 md:border-t-0 sm:px-5`,children:[(0,W.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 text-3xs font-semibold uppercase tracking-widest text-muted-foreground/70`,children:[(0,W.jsx)(`span`,{className:`flex size-6 items-center justify-center rounded-md bg-muted/60`,children:(0,W.jsx)(o,{className:`size-3.5`})}),`Collection health`]}),E?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Ke,{label:`Native process monitor`,health:E.health.native}),(0,W.jsx)(Ke,{label:`Electron main process`,health:E.health.desktop}),(0,W.jsx)(X,{label:`Collection time`,value:Me(E.health.collectionDurationMicros)}),(0,W.jsx)(X,{label:`Process scan`,value:`${E.health.retainedProcessCount}/${E.health.scannedProcessCount} retained`}),(0,W.jsx)(X,{label:`Inaccessible`,value:String(E.health.inaccessibleProcessCount),valueClassName:E.health.inaccessibleProcessCount>0?`text-warning-foreground`:void 0}),(0,W.jsx)(X,{label:`Sidecar`,value:te(E.health.sidecarVersion,{onNone:()=>`Unavailable`,onSome:e=>`${e}${te(E.health.sidecarPid,{onNone:()=>``,onSome:e=>` · PID ${e}`})}`})}),(0,W.jsx)(X,{label:`Restarts`,value:String(E.health.restartCount)})]}):(0,W.jsx)(`div`,{className:`py-4 text-xs text-muted-foreground`,children:`Waiting for collector health.`})]})]})}),(0,W.jsx)(B,{title:`Resource timeline`,icon:(0,W.jsx)(i,{className:`size-4 text-muted-foreground`}),headerAction:(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(Xe,{selectedWindowMs:t,onSelect:n}),(0,W.jsx)(m,{size:`icon-micro`,variant:`ghost`,disabled:u.isPending,onClick:u.refresh,"aria-label":`Refresh resource history`,children:(0,W.jsx)(V,{size:`xs`,refreshing:u.isPending})})]}),children:(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-[inherit]`,children:[u.error?(0,W.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,W.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:u.error})]}):null,(0,W.jsx)(Qe,{buckets:u.data?.buckets??[]}),(0,W.jsx)(at,{processes:u.data?.topProcesses??[]})]})}),(0,W.jsx)(B,{title:`Live process tree`,icon:(0,W.jsx)(v,{className:`size-4 text-muted-foreground`}),headerAction:E?(0,W.jsxs)(`span`,{className:`text-3xs text-muted-foreground/55`,children:[`Identity: `,(0,W.jsx)(`span`,{className:`font-mono`,children:`PID + start time`})]}):null,children:(0,W.jsx)(`div`,{className:`overflow-hidden rounded-[inherit]`,children:(0,W.jsx)(rt,{processes:E?.processes??[],canMaintainEnvironment:a,signalingKeys:b,onSignal:k})})}),(0,W.jsx)(B,{title:`Instrumented application I/O`,icon:(0,W.jsx)(h,{className:`size-4 text-muted-foreground`}),headerAction:(0,W.jsx)(`span`,{className:`text-3xs text-muted-foreground/55`,children:`Logical bytes by operation`}),children:(0,W.jsxs)(`div`,{className:`overflow-hidden rounded-[inherit]`,children:[(0,W.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.`}),(0,W.jsx)(st,{entries:E?.attribution.entries??[]})]})})]})}var ut=[{key:`otlpTracesUrl`,label:`Traces`,signal:`traces`},{key:`otlpMetricsUrl`,label:`Metrics`,signal:`metrics`},{key:`otlpLogsUrl`,label:`Logs`,signal:`logs`}],dt=e=>/^https?:\/\/./i.test(e);function ft(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 pt(){let e=(0,U.c)(3),{environment:t,scope:n}=he();if(n.kind!==`environment`||!t){let t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,W.jsx)(B,{title:`OpenTelemetry export`,id:`telemetry-export`,children:(0,W.jsx)(Ce,{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,W.jsx)(mt,{},t.environmentId),e[1]=t.environmentId,e[2]=r),r}function mt(){let{environment:e}=he(),t=me(e=>e.observability),[n,r]=(0,G.useState)({}),[i,a]=(0,G.useState)(!1),[o,c]=(0,G.useState)(null),l=e?.environmentId,u=s(j.checkOtlpEndpoint.permissionAtom(l??null)),d=u&&e?.serverConfig?.environment.capabilities.otlpEndpointCheck===!0,[f,p]=(0,G.useState)(()=>Object.fromEntries(ut.filter(({key:e})=>dt(t[e])).map(({key:e})=>[e,{url:t[e],result:null}]))),h=ce(j.updateSettings,{reportFailure:!0}),g=ce(j.checkOtlpEndpoint),_={...t,...n},v=ut.filter(({key:e})=>_[e].trim()!==t[e]),y=v.length>0,b=e?.serverConfig?.observability,x=async(e,t,n)=>{if(!l)return;let r=await g({environmentId:l,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})},S=(e,t,n)=>{dt(n)&&(p(t=>({...t,[e]:{url:n,result:null}})),x(e,t,n))},ee=(0,G.useEffectEvent)(()=>{for(let{key:e,signal:t}of ut){let n=f[e];n?.result===null&&x(e,t,n.url)}});return(0,G.useEffect)(()=>{d&&ee()},[d]),(0,W.jsx)(B,{title:`OpenTelemetry export`,id:`telemetry-export`,children:(0,W.jsxs)(`form`,{className:`grid gap-4 px-4 py-4 sm:px-5`,onSubmit:async t=>{if(t.preventDefault(),e&&!i){a(!0),c(null);try{(await h({environmentId:e.environmentId,input:{patch:{observability:Object.fromEntries(v.map(({key:e})=>[e,_[e]]))}}}))._tag===`Success`&&(r({}),c(`Saved. Restart the server to apply.`))}finally{a(!1)}}},children:[(0,W.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.`}),!u&&(0,W.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`This connection lacks permission to change settings on`,` `,e?.label??`the selected environment`,`.`]}),ut.map(({key:e,label:n,signal:a})=>{let o=_[e].trim(),s=d?ft(o,f[e]):null;return(0,W.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[s&&(0,W.jsx)(ve,{dotClassName:s.dot}),(0,W.jsxs)(be,{htmlFor:e,children:[n,` endpoint`]})]}),s&&(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s.label})]}),(0,W.jsxs)(`div`,{className:`flex gap-2`,children:[(0,W.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:_[e],disabled:i||!u,onChange:n=>{let i=n.target.value;r(n=>{let r={...n,[e]:i};return i.trim()===t[e]&&delete r[e],r}),c(null)}}),d&&(0,W.jsx)(m,{type:`button`,size:`sm`,variant:`outline`,disabled:!dt(o)||f[e]?.result===null,onClick:()=>void S(e,a,o),children:`Test`})]}),t[e]!==(b?.[e]??``)&&(0,W.jsxs)(`p`,{className:`break-all text-xs text-muted-foreground`,children:[`Running: `,b?.[e]||`Disabled`]})]},e)}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,W.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:o}),(0,W.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,W.jsx)(m,{type:`button`,size:`xs`,variant:`outline`,disabled:!y||i||!u,onClick:()=>{if(r({}),c(null),d)for(let{key:e,signal:n}of ut)f[e]?.url!==t[e]&&S(e,n,t[e])},children:`Discard`}),(0,W.jsx)(m,{type:`submit`,size:`xs`,disabled:!y||i||!u,children:i?`Saving…`:`Save`})]})]})]})})}var ht=new Intl.NumberFormat;function Z(e){return ht.format(e)}function Q(e){return e<1e3?`${Math.round(e)} ms`:`${(e/1e3).toFixed(e>=1e4?1:2).replace(/\.0+$/,``)} s`}function gt(e){return e?ue(S(e)):`No trace records`}function _t(e){return gt(e).replaceAll(` `,`\xA0`)}function vt(e){return e.length<=32?e:`${e.slice(0,18)}...${e.slice(-10)}`}function yt(e){return e?.includes(`not a live descendant`)??!1}function $(e){let t=(0,U.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,W.jsx)(`span`,{className:`min-w-0 truncate`,children:n}),t[0]=n,t[1]=s);let l;t[2]!==n||t[3]!==i?(l=i?(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.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,W.jsx)(c,{className:`size-3`})})}),(0,W.jsx)(I,{side:`top`,children:i})]}):null,t[2]=n,t[3]=i,t[4]=l):l=t[4];let u;t[5]!==s||t[6]!==l?(u=(0,W.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,l]}),t[5]=s,t[6]=l,t[7]=u):u=t[7];let d=o===`warning`&&`text-warning-foreground`,f=o===`danger`&&`text-destructive`,p;t[8]!==d||t[9]!==f?(p=_(`mt-1 truncate font-mono text-lg font-semibold tabular-nums text-foreground`,d,f),t[8]=d,t[9]=f,t[10]=p):p=t[10];let m;t[11]!==p||t[12]!==r?(m=(0,W.jsx)(`div`,{className:p,children:r}),t[11]=p,t[12]=r,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,W.jsxs)(`div`,{className:`min-w-0 border-border/60 px-4 py-3 sm:px-5`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}function bt(e){let t=(0,U.c)(6),{children:n}=e,r,i,a,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,W.jsx)(`span`,{className:`pointer-events-none absolute inset-y-0 left-1/2 w-px bg-border/60`,"aria-hidden":!0}),i=(0,W.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,W.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,W.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,W.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 xt(e){let t=(0,U.c)(2),{label:n}=e,r;return t[0]===n?r=t[1]:(r=(0,W.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 St(e){let t=(0,U.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-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,W.jsx)(`colgroup`,{children:n.map((e,t)=>(0,W.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,W.jsx)(`th`,{className:_(`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,W.jsx)(`thead`,{className:`border-b border-border/60 text-2xs uppercase tracking-widest text-muted-foreground/70`,children:(0,W.jsx)(`tr`,{children:u})}),t[12]=u,t[13]=d);let f;t[14]===r?f=t[15]:(f=(0,W.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,W.jsx)(z,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`w-full max-w-full`,children:(0,W.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 Ct(e){let t=(0,U.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}=k(r),o;t[1]===n?o=t[2]:(o=vt(n),t[1]=n,t[2]=o);let s;t[3]===o?s=t[4]:(s=(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-2xs`,children:o})}),t[3]=o,t[4]=s);let c;t[5]===n?c=t[6]:(c=(0,W.jsx)(I,{side:`top`,variant:`code`,children:n}),t[5]=n,t[6]=c);let l;t[7]!==s||t[8]!==c?(l=(0,W.jsxs)(L,{children:[s,c]}),t[7]=s,t[8]=c,t[9]=l):l=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,W.jsx)(u,{className:`size-3`}),t[13]=p):p=t[13];let h;t[14]!==d||t[15]!==f?(h=(0,W.jsx)(F,{render:(0,W.jsx)(m,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":d,onClick:f,children:p})}),t[14]=d,t[15]=f,t[16]=h):h=t[16];let g=a?`Copied`:`Copy full trace ID`,_;t[17]===g?_=t[18]:(_=(0,W.jsx)(I,{side:`top`,children:g}),t[17]=g,t[18]=_);let v;t[19]!==_||t[20]!==h?(v=(0,W.jsxs)(L,{children:[h,_]}),t[19]=_,t[20]=h,t[21]=v):v=t[21];let y;return t[22]!==v||t[23]!==l?(y=(0,W.jsxs)(`div`,{className:`flex w-full min-w-0 max-w-full items-center gap-2`,children:[l,v]}),t[22]=v,t[23]=l,t[24]=y):y=t[24],y}function wt(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 Tt(e){return e.depth>0?`Subprocess`:/\b(codex|claude|opencode|cursor)\b/i.test(e.command)?`Agent`:`Process`}function Et(e){let t=(0,U.c)(22),{process:n,isExpanded:r,onToggle:i}=e,a;t[0]===n.command?a=t[1]:(a=wt(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,W.jsx)(m,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":r?`Collapse ${o}`:`Expand ${o}`,onClick:()=>i(n.pid),children:(0,W.jsx)(D,{className:`size-3.5`,icon:r?E:T})}):(0,W.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,W.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,W.jsx)(F,{render:(0,W.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,W.jsx)(I,{side:`top`,variant:`code`,children:n.command}),t[13]=n.command,t[14]=p);let h;t[15]!==f||t[16]!==p?(h=(0,W.jsxs)(L,{children:[f,p]}),t[15]=f,t[16]=p,t[17]=h):h=t[17];let g;return t[18]!==l||t[19]!==u||t[20]!==h?(g=(0,W.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,h]}),t[18]=l,t[19]=u,t[20]=h,t[21]=g):g=t[21],g}function Dt(e){let t=(0,U.c)(18),{processes:n,canMaintainEnvironment:r,signalingPid:i,onSignal:a,emptyLabel:o}=e,[s,c]=(0,G.useState)(Ot),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,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[24%]`}),(0,W.jsx)(`col`,{className:`w-[8%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[33%]`}),(0,W.jsx)(`col`,{className:`w-[8%]`}),(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[6%]`})]}),t[4]=p):p=t[4];let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,W.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,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Name`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Memory`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Command`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`PID`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Type`}),(0,W.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,W.jsx)(`tr`,{children:(0,W.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,W.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,W.jsx)(`td`,{className:`px-4 py-2 align-middle sm:pl-5`,children:(0,W.jsx)(Et,{process:e,isExpanded:!s.has(e.pid),onToggle:f})}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.cpuPercent.toFixed(1),`%`]}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:H(e.rssBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 align-middle text-muted-foreground`,children:(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`block truncate`,children:e.command})}),(0,W.jsx)(I,{side:`top`,variant:`code`,children:e.command})]})}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums text-muted-foreground`,children:e.pid}),(0,W.jsx)(`td`,{className:`truncate px-3 py-2 align-middle text-muted-foreground`,children:Tt(e)}),(0,W.jsx)(`td`,{className:`p-2 align-middle sm:pr-4`,children:(0,W.jsx)(we,{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,W.jsx)(`div`,{className:`border-t border-border/60`,children:(0,W.jsx)(z,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[min(64vh,44rem)] w-full max-w-full`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[1040px] table-fixed text-left text-xs`,children:[p,m,(0,W.jsxs)(`tbody`,{className:`divide-y divide-border/50`,children:[h,g]})]})})}),t[15]=h,t[16]=g,t[17]=_):_=t[17],_}function Ot(){return new Set}var kt=[{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 At(e){if(e<60)return`${e.toFixed(e>=10?1:2).replace(/\.0+$/,``)}s`;let t=e/60;return t<60?`${t.toFixed(t>=10?1:2).replace(/\.0+$/,``)}m`:`${(t/60).toFixed(2).replace(/\.0+$/,``)}h`}function jt(e){let t=wt(e);return t.length>42?`${t.slice(0,39)}...`:t}function Mt(e){let t=(0,U.c)(21),{process:n,visualDepth:r}=e,i;t[0]===n.command?i=t[1]:(i=jt(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,W.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=_(`size-1.5 shrink-0 rounded-full`,u),t[5]=u,t[6]=d);let f;t[7]===d?f=t[8]:(f=(0,W.jsx)(`span`,{className:d}),t[7]=d,t[8]=f);let p;t[9]===a?p=t[10]:(p=(0,W.jsx)(F,{render:(0,W.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,W.jsx)(I,{side:`top`,variant:`code`,children:n.command}),t[11]=n.command,t[12]=m);let h;t[13]!==m||t[14]!==p?(h=(0,W.jsxs)(L,{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,W.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 Nt(e){let t=(0,U.c)(9),{buckets:n}=e,r;t[0]===n?r=t[1]:(r=Math.max(1,...n.map(Pt)),t[0]=n,t[1]=r);let i=r,a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=Math.max(2,e.maxCpuPercent/i*100),n=Math.max(2,e.avgCpuPercent/i*100);return(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(`div`,{className:`flex h-full min-w-1 flex-1 items-end`,children:(0,W.jsxs)(`div`,{className:`relative h-full w-full`,"aria-label":`Average CPU ${e.avgCpuPercent.toFixed(1)}%, peak CPU ${e.maxCpuPercent.toFixed(1)}%`,children:[(0,W.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 rounded-t-sm bg-foreground/15 transition-colors`,style:{height:`${t}%`}}),(0,W.jsx)(`div`,{className:`absolute inset-x-0 bottom-0 rounded-t-sm bg-foreground/60 transition-colors`,style:{height:`${n}%`}})]})})}),(0,W.jsxs)(I,{side:`top`,children:[`Avg `,e.avgCpuPercent.toFixed(1),`%, peak `,e.maxCpuPercent.toFixed(1),`%`]})]},S(e.startedAt))},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,W.jsx)(`div`,{className:`border-t border-border/60 px-4 py-3 sm:px-5`,children:(0,W.jsx)(`div`,{className:`flex h-28 items-end gap-1 overflow-hidden rounded-sm bg-muted/10 p-2`,children:a})}),t[7]=a,t[8]=o),o}function Pt(e){return e.maxCpuPercent}function Ft(e){let t=(0,U.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=kt.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=kt.map(It),t[4]=s):s=t[4];let c;return t[5]!==a||t[6]!==o?(c=(0,W.jsx)(fe,{"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 It(e){return(0,W.jsx)(R,{value:String(e.windowMs),children:e.label},e.windowMs)}function Lt(e){let t=(0,U.c)(13),{processes:n,emptyLabel:r}=e,i=n.reduce(Rt,null),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[24%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`}),(0,W.jsx)(`col`,{className:`w-[16%]`}),(0,W.jsx)(`col`,{className:`w-[10%]`})]}),t[0]=a):a=t[0];let o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,W.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,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`px-4 py-2 font-semibold sm:pl-5`,children:`Process`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`CPU Time`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Current`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Average`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Peak`}),(0,W.jsx)(`th`,{className:`px-3 py-2 text-right font-semibold`,children:`Max Mem`}),(0,W.jsx)(`th`,{className:`px-3 py-2 font-semibold`,children:`Command`}),(0,W.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,W.jsx)(`tr`,{children:(0,W.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,W.jsxs)(`tr`,{className:`hover:bg-muted/20`,children:[(0,W.jsx)(`td`,{className:`px-4 py-2 align-middle sm:pl-5`,children:(0,W.jsx)(Mt,{process:e,visualDepth:e.isServerRoot||i===null?0:Math.max(1,e.depth-i+1)})}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:At(e.cpuSecondsApprox)}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.currentCpuPercent.toFixed(1),`%`]}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.avgCpuPercent.toFixed(1),`%`]}),(0,W.jsxs)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:[e.maxCpuPercent.toFixed(1),`%`]}),(0,W.jsx)(`td`,{className:`px-3 py-2 text-right align-middle font-mono tabular-nums`,children:H(e.maxRssBytes)}),(0,W.jsx)(`td`,{className:`px-3 py-2 align-middle text-muted-foreground`,children:(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(`span`,{className:`block truncate`,children:e.command})}),(0,W.jsx)(I,{side:`top`,variant:`code`,children:e.command})]})}),(0,W.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,W.jsx)(`div`,{className:`border-t border-border/60`,children:(0,W.jsx)(z,{chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`max-h-[min(64vh,44rem)] w-full max-w-full`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[980px] table-fixed text-left text-xs`,children:[a,o,(0,W.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 Rt(e,t){return t.isServerRoot?e:e===null?t.depth:Math.min(e,t.depth)}function zt(e){let t=(0,U.c)(7),{checkedAt:n}=e;_e();let r;t[0]===n?r=t[1]:(r=de(n?S(n):null),t[0]=n,t[1]=r);let i=r;if(i.status===`missing`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(`span`,{className:`text-2xs text-muted-foreground/50`,children:`Checking`}),t[2]=e):e=t[2],e}if(i.status===`invalid`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,W.jsx)(`span`,{className:`text-2xs text-muted-foreground/50`,children:`Checked unavailable`}),t[3]=e):e=t[3],e}let a;return t[4]!==i.suffix||t[5]!==i.value?(a=(0,W.jsx)(`span`,{className:`text-2xs text-muted-foreground/60`,children:i.suffix?(0,W.jsxs)(W.Fragment,{children:[`Checked `,(0,W.jsx)(`span`,{className:`font-mono tabular-nums`,children:i.value}),` `,i.suffix]}):(0,W.jsxs)(W.Fragment,{children:[`Checked `,i.value]})}),t[4]=i.suffix,t[5]=i.value,t[6]=a):a=t[6],a}function Bt(e){let t=(0,U.c)(12),{isPending:n,label:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=(0,W.jsx)(V,{refreshing:n}),t[0]=n,t[1]=a);let o;t[2]!==n||t[3]!==r||t[4]!==i||t[5]!==a?(o=(0,W.jsx)(F,{render:(0,W.jsx)(m,{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,W.jsx)(I,{side:`top`,children:r}),t[7]=r,t[8]=s);let c;return t[9]!==o||t[10]!==s?(c=(0,W.jsxs)(L,{children:[o,s]}),t[9]=o,t[10]=s,t[11]=c):c=t[11],c}function Vt(){let{environment:e}=he(),t=e?.environmentId??null,n=M(t,ee),r=e?.serverConfig?.observability,i=e?.serverConfig?.availableEditors,o=M(t,b),s=P(t===null?null:se.sessionStateAtom(t)),c=xe({connectionPhase:e?.connection.phase??`available`,session:s.data,hasSessionError:s.error!==null}),l=c.canReadDiagnostics,u=ce(j.signalProcess,{reportFailure:!1}),f=ye(t,i??[]),[p,h]=(0,G.useState)(9e5),g=kt.find(e=>e.windowMs===p)??kt[1],{data:v,error:y,isPending:x,refresh:te}=P(t===null||!l?null:j.traceDiagnostics({environmentId:t,input:{}})),{data:w,error:T,isPending:E,refresh:D}=P(t===null||!l?null:j.processDiagnostics({environmentId:t,input:{}})),{data:k,error:A,isPending:le,refresh:ue}=P(t===null||!l?null:j.processResourceHistory({environmentId:t,input:{windowMs:g.windowMs,bucketMs:g.bucketMs}})),[de,fe]=(0,G.useState)(!1),[R,pe]=(0,G.useState)(null),[me,_e]=(0,G.useState)(null),ve=(0,G.useRef)(null),V=(0,G.useRef)(t),be=(0,G.useRef)(w);(0,G.useEffect)(()=>{be.current=w},[w]),(0,G.useEffect)(()=>(V.current=t,()=>{V.current=null}),[t]);let Ce=(0,G.useCallback)(()=>{let e=r?.logsDirectoryPath??null;e&&t!==null&&N(t,`orchestration:operate`)&&(fe(!0),pe(null),(async()=>{let t=await f(e);if(fe(!1),t._tag===`Failure`&&!ae(t)){let e=ie(t);pe(e instanceof Error?e.message:`Unable to open logs folder.`)}})())},[t,r?.logsDirectoryPath,f]),U=x&&v===null,we=E&&w===null,Te=le&&k===null,[Ee,De]=(0,G.useState)(null);Ee!==t&&l&&!U&&!we&&!Te&&De(t);let Oe=(0,G.useCallback)(async(e,t)=>{let n=V.current,r=be.current?.processes.find(t=>t.pid===e);if(n===null||r===void 0||!N(n,`environment:maintain`)||ve.current!==null)return;ve.current=e,_e(e);let i=()=>{ve.current=null,_e(null)};if(t===`SIGKILL`){let n=!1;try{n=await oe().dialogs.confirm(`Send SIGKILL to process ${e}? This cannot be handled by the process.`,{variant:`destructive`})}catch(e){i(),O.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=V.current;if(a===null||a!==n||!N(a,`environment:maintain`))i();else if(be.current?.processes.find(t=>t.pid===e)?.startTimeMs!==r.startTimeMs)i();else try{let i=await u({environmentId:n,input:{pid:e,startTimeMs:r.startTimeMs,signal:t}});if(i._tag===`Failure`){if(!ae(i)){let e=ie(i);O.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=C(i.value.message);if(D(),yt(e)){O.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}O.add({type:`error`,title:`Could not send ${t}`,description:e??`Failed to send ${t}.`});return}D()}finally{i()}},[D,u]),ke=w?re(w.error):null,K=k?re(k.error):null,Ae=v?re(v.error):null,q=v?ne(v.partialFailure,()=>!1):!1;return l?(0,W.jsxs)(ge,{width:`expanded`,className:`gap-10`,children:[(0,W.jsx)(lt,{environmentId:t}),(0,W.jsxs)(B,{title:`Live Processes`,headerAction:(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(zt,{checkedAt:w?.readAt??null}),(0,W.jsx)(Bt,{isPending:E,label:`Refresh process diagnostics`,onClick:D})]}),children:[(0,W.jsxs)(bt,{children:[(0,W.jsx)($,{label:`Child Processes`,value:w?Z(w.processCount):`...`}),(0,W.jsx)($,{label:`CPU`,value:w?`${w.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,W.jsx)($,{label:`Memory`,value:w?H(w.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,W.jsx)($,{label:`Server PID`,value:w?String(w.serverPid):`...`})]}),ke||T?(0,W.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5`,children:[ke?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:ke.message})]}):null,T?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:T})]}):null]}):null,(0,W.jsx)(Dt,{processes:w?.processes??[],canMaintainEnvironment:n,signalingPid:me,onSignal:Oe,emptyLabel:we?`Loading live processes...`:`No live descendant processes found.`})]}),(0,W.jsxs)(B,{title:`Resource History`,headerAction:(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(Ft,{selectedWindowMs:p,onSelect:h}),(0,W.jsx)(zt,{checkedAt:k?.readAt??null}),(0,W.jsx)(Bt,{isPending:le,label:`Refresh resource history`,onClick:ue})]}),children:[(0,W.jsxs)(bt,{children:[(0,W.jsx)($,{label:`CPU Time`,value:k?At(k.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,W.jsx)($,{label:`Samples`,value:k?Z(k.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,W.jsx)($,{label:`Interval`,value:k?k.sampleIntervalMs===0?`On demand`:Q(k.sampleIntervalMs):`...`}),(0,W.jsx)($,{label:`Processes`,value:k?Z(k.topProcesses.length):`...`})]}),K||A?(0,W.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5`,children:[K?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:K.message})]}):null,A?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:A})]}):null]}):null,(0,W.jsx)(Nt,{buckets:k?.buckets??[]}),(0,W.jsx)(Lt,{processes:k?.topProcesses??[],emptyLabel:Te?`Collecting process resource samples...`:`No process resource samples found for this window.`})]}),(0,W.jsxs)(B,{title:`Trace Diagnostics`,headerAction:(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,W.jsx)(zt,{checkedAt:v?.readAt??null}),(0,W.jsxs)(L,{children:[(0,W.jsx)(F,{render:(0,W.jsx)(m,{size:`icon-xs`,variant:`ghost-muted`,disabled:!o||!r?.logsDirectoryPath||de,onClick:Ce,"aria-label":`Open logs folder`,children:(0,W.jsx)(a,{})})}),(0,W.jsx)(I,{side:`top`,children:`Open logs folder`})]}),(0,W.jsx)(Bt,{isPending:x,label:`Refresh trace diagnostics`,onClick:te})]}),children:[(0,W.jsxs)(bt,{children:[(0,W.jsx)($,{label:`Spans`,value:v?Z(v.recordCount):`...`}),(0,W.jsx)($,{label:`Failures`,value:v?Z(v.failureCount):`...`,tone:v&&v.failureCount>0?`danger`:`default`}),(0,W.jsx)($,{label:`Slow Spans`,value:v?Z(v.slowSpanCount):`...`,tooltip:v?`Spans with a duration of ${Q(v.slowSpanThresholdMs)} or longer.`:`Spans at or above the configured slow-span threshold.`,tone:v&&v.slowSpanCount>0?`warning`:`default`}),(0,W.jsx)($,{label:`Parse Errors`,value:v?Z(v.parseErrorCount):`...`,tone:v&&v.parseErrorCount>0?`warning`:`default`})]}),R||Ae||y?(0,W.jsxs)(`div`,{className:`space-y-2 border-t border-border/60 px-4 py-3 text-xs text-muted-foreground sm:px-5`,children:[R?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:R})]}):null,Ae?(0,W.jsxs)(`div`,{className:_(`flex items-start gap-2`,q?`text-warning-foreground`:`text-destructive`),children:[(0,W.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:q?`Some trace files could not be read, so diagnostics may be incomplete. ${Ae.message}`:Ae.message})]}):null,y?(0,W.jsxs)(`div`,{className:`flex items-start gap-2 text-destructive`,children:[(0,W.jsx)(d,{className:`mt-0.5 size-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:y})]}):null]}):null]}),(0,W.jsx)(B,{title:`Latest Failures`,children:v&&v.latestFailures.length>0?(0,W.jsx)(St,{headers:[`Span`,`Cause`,`Duration`,`Ended`],children:v.latestFailures.map(e=>(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,W.jsx)(`td`,{className:`max-w-[360px] px-4 py-3 align-top text-muted-foreground`,children:(0,W.jsx)(Se,{text:e.cause})}),(0,W.jsx)(`td`,{className:`px-4 py-3 align-top font-mono tabular-nums`,children:Q(e.durationMs)}),(0,W.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums text-muted-foreground last:sm:pr-5`,children:_t(e.endedAt)})]},`${e.traceId}:${e.spanId}`))}):(0,W.jsx)(xt,{label:U?`Loading failures...`:`No failed spans found.`})}),(0,W.jsx)(B,{title:`Most Common Failures`,children:v&&v.commonFailures.length>0?(0,W.jsx)(St,{headers:[`Span`,`Count`,`Cause`,`Last Seen`],minTableWidth:`min-w-[760px]`,children:v.commonFailures.map(e=>(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,W.jsx)(`td`,{className:`px-4 py-3 align-top font-mono tabular-nums`,children:Z(e.count)}),(0,W.jsx)(`td`,{className:`max-w-[360px] px-4 py-3 align-top text-muted-foreground`,children:(0,W.jsx)(Se,{text:e.cause})}),(0,W.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:_t(e.lastSeenAt)})]},`${e.name}:${e.cause}`))}):(0,W.jsx)(xt,{label:U?`Loading failure groups...`:`No repeated failures found.`})}),(0,W.jsx)(B,{title:`Slowest Spans`,children:v&&v.slowestSpans.length>0?(0,W.jsx)(St,{headers:[`Span`,`Duration`,`Ended`,`Trace`],minTableWidth:`min-w-[900px]`,columnWidths:[`w-[44%]`,`w-[14%]`,`w-[12%]`,`w-[30%]`],children:v.slowestSpans.map(e=>(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,W.jsx)(`td`,{className:`px-4 py-3 align-top font-mono tabular-nums`,children:Q(e.durationMs)}),(0,W.jsx)(`td`,{className:`w-px whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums text-muted-foreground`,children:_t(e.endedAt)}),(0,W.jsx)(`td`,{className:`min-w-0 whitespace-nowrap px-4 py-3 align-top text-muted-foreground last:sm:pr-5`,children:(0,W.jsx)(Ct,{traceId:e.traceId})})]},`${e.traceId}:${e.spanId}`))}):(0,W.jsx)(xt,{label:U?`Loading slow spans...`:`No spans found.`})}),(0,W.jsx)(B,{title:`Span Logs`,children:v&&v.latestWarningAndErrorLogs.length>0?(0,W.jsx)(z,{radius:`none`,chainVerticalScroll:!0,scrollFade:!0,hideScrollbars:!0,className:`w-full max-w-full`,children:(0,W.jsxs)(`table`,{className:`w-full min-w-[920px] table-fixed text-left text-xs`,children:[(0,W.jsxs)(`colgroup`,{children:[(0,W.jsx)(`col`,{className:`w-[11%]`}),(0,W.jsx)(`col`,{className:`w-[9%]`}),(0,W.jsx)(`col`,{className:`w-[24%]`}),(0,W.jsx)(`col`,{className:`w-[26%]`}),(0,W.jsx)(`col`,{className:`w-[30%]`})]}),(0,W.jsx)(`thead`,{className:`border-b border-border/60 text-2xs uppercase tracking-widest text-muted-foreground/70`,children:(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold sm:pl-5`,children:`Time`}),(0,W.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold`,children:`Level`}),(0,W.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold`,children:`Span`}),(0,W.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold`,children:`Message`}),(0,W.jsx)(`th`,{className:`whitespace-nowrap px-4 py-2.5 font-semibold sm:pr-5`,children:`Trace`})]})}),(0,W.jsx)(`tbody`,{className:`divide-y divide-border/60`,children:v.latestWarningAndErrorLogs.map(e=>(0,W.jsxs)(`tr`,{className:`hover:bg-muted/15`,children:[(0,W.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums text-muted-foreground sm:pl-5`,children:_t(e.seenAt)}),(0,W.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,W.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,W.jsx)(`td`,{className:`px-4 py-3 align-top`,children:(0,W.jsx)(`div`,{className:`truncate font-medium text-foreground`,children:e.spanName})}),(0,W.jsx)(`td`,{className:`px-4 py-3 align-top text-muted-foreground`,children:(0,W.jsx)(Se,{collapsedClassName:`line-clamp-2`,expandLabel:`Show full message`,text:e.message})}),(0,W.jsx)(`td`,{className:`min-w-0 whitespace-nowrap px-4 py-3 align-top text-muted-foreground sm:pr-5`,children:(0,W.jsx)(Ct,{traceId:e.traceId})})]},`${e.traceId}:${e.spanId}:${S(e.seenAt)}:${e.message}`))})]})}):(0,W.jsx)(xt,{label:U?`Loading recent logs...`:`No warnings or errors found.`})}),(0,W.jsx)(B,{title:`Top Span Names`,children:v&&v.topSpansByCount.length>0?(0,W.jsx)(St,{headers:[`Span`,`Count`,`Failures`,`Average`,`Max`],minTableWidth:`min-w-[760px]`,columnWidths:[`w-[48%]`,`w-[13%]`,`w-[13%]`,`w-[13%]`,`w-[13%]`],children:v.topSpansByCount.map(e=>(0,W.jsxs)(`tr`,{children:[(0,W.jsx)(`td`,{className:`px-4 py-3 align-top text-xs font-medium text-foreground first:sm:pl-5`,children:e.name}),(0,W.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums`,children:Z(e.count)}),(0,W.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums`,children:Z(e.failureCount)}),(0,W.jsx)(`td`,{className:`whitespace-nowrap px-4 py-3 align-top font-mono tabular-nums`,children:Q(e.averageDurationMs)}),(0,W.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,W.jsx)(xt,{label:U?`Loading span names...`:`No spans found.`})}),Ee===t&&(0,W.jsx)(pt,{})]}):(0,W.jsx)(ge,{children:(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t===null?`Connect an environment to see diagnostics.`:c.isPending?`Checking diagnostics access…`:c.error})})}var Ht=Vt;export{Ht as component};
|
|
2
|
-
//# sourceMappingURL=settings.diagnostics-BFlcsuN0.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{t as i}from"./cloud-BhcSs4Ie.js";import{t as a}from"./plus-B2sOrZDk.js";import{t as o}from"./x-C35beONT.js";import{$n as s,Bu as c,Cd as l,Dl as u,Ed as d,Sd as f,Xn as p,Yd as m,Zn as h,er as g,fr as _,hr as v,l as y,mr as b,ol as x,rl as S,rp as C,rr as w,ru as T,sr as E,t as D,tr as O}from"./utils-Cs97wR6T.js";import{Bp as k,Dn as A,Fc as j,Ms as M,Ns as N,On as P,Up as F,_ as I,_i as L,_n as R,ai as z,bn as B,fh as ee,fi as V,gi as te,ja as ne,kn as re,mi as ie,oi as ae,ui as H,v as oe,vi as U,vn as se}from"./src-BZzGU-vc.js";import{Dr as ce}from"./runtime-DUPVFypn.js";import{w as le}from"./entities-CpJdh0W5.js";import{a as W,r as ue,t as G}from"./number-field-D6t0GpAB.js";import{a as K,c as de,i as fe,o as pe,r as me,s as he,t as ge}from"./select-BtqP8nTL.js";import{t as _e}from"./spinner-DmRIQvmI.js";import{a as q}from"./relay-CnLeC-mg.js";import{D as ve,J as ye,O as be,c as xe,o as Se,r as Ce,s as J,x as Y}from"./useSettings-C6RmJr-q.js";import{f as we}from"./server-BYnv0CK4.js";import{i as Te,n as Ee}from"./session-BryEqNW-.js";import{t as De}from"./query-DpmTmXUV.js";import{t as Oe}from"./use-atom-command-DMW6SFOx.js";import{t as ke}from"./env-BfPir1X4.js";import{a as Ae,n as je,t as Me}from"./tooltip-CAzkzAoH.js";import{t as Ne}from"./input-K95B1E2P.js";import{a as Pe,c as Fe,i as Ie,n as Le,o as Re,r as ze,s as Be,t as Ve}from"./dialog-BzESHWgr.js";import{i as He,t as Ue}from"./device-DUMKyegd.js";import{a as We,i as Ge,l as Ke,n as qe,o as Je,t as Ye,u as Xe}from"./DeviceSetup-O_9LLGD9.js";import{t as Ze}from"./AnimatedHeight-CsOfc5H1.js";import{i as Qe,n as $e}from"./Icons-BzIBDVKW.js";import{t as et}from"./preview-CS0uw3GP.js";import{r as tt}from"./preview-DIIM6Lws.js";import{a as nt,i as rt,o as it,t as at}from"./popover-CtPuvMeZ.js";import{a as ot,i as st,n as ct,o as lt,r as ut,s as dt,t as ft}from"./alert-dialog-Broi1wym.js";import{F as pt,R as mt,V as ht,a as X,c as gt,i as _t,r as vt,s as yt,w as bt}from"./settingsLayout-BijX6mlS.js";import{$a as xt,Lr as St,Po as Ct,Wo as wt,eo as Tt,so as Et}from"./main-C8b9a0ht.js";import{t as Dt}from"./ProjectDefaultsSettings-rvN_67Gu.js";import{t as Ot}from"./draft-input-BozMgkbl.js";import{t as kt}from"./ScopedSwitch-DQHfQgMZ.js";import{t as At}from"./SecretInput-CxJl9pux.js";import{n as jt,r as Mt,t as Nt}from"./usePermissionStatus-Zf48W2tu.js";var Z=n(),Q=e(r(),1);function Pt(e){let t=(0,Z.c)(27),{tools:n,action:r,kind:i,owner:a,error:o}=e,s=i?n?.[i]:void 0,c;t[0]===s?c=t[1]:(c=s?.runningVersion??(s?.installedVersions.includes(s.requiredVersion)?s.requiredVersion:s?.installedVersions.toSorted(Ft).at(-1)),t[0]=s,t[1]=c);let l=c,u=i===`hub`?`Device hub`:`Agent device`,d=i?`${u}: ${l?`version ${l}`:s?`not installed`:`version unknown`}. Show details`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(v,{tone:`muted`}),t[2]=f):f=t[2];let p=i?l?`v${l}`:s?`Not installed`:`Version unknown`:o?`Versions unavailable`:`Versions`,m;t[3]!==d||t[4]!==p?(m=(0,Q.jsx)(it,{"aria-label":d,render:f,children:p}),t[3]=d,t[4]=p,t[5]=m):m=t[5];let h=i?u:`Device tools`,g;t[6]===h?g=t[7]:(g=(0,Q.jsx)(nt,{children:h}),t[6]=h,t[7]=g);let _;t[8]!==i||t[9]!==u||t[10]!==n?(_=n?(0,Q.jsx)(`div`,{className:`mt-4 divide-y divide-border/50`,children:[[`Device hub`,n.hub],[`Agent device`,n.agent]].filter(e=>{let[t]=e;return!i||t===u}).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`space-y-2 py-3 first:pt-0 last:pb-0`,children:[i?null:(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:t}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Running`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.runningVersion??`Not running`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Required`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.requiredVersion}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Installed`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono break-words`,children:n.installedVersions.join(`, `)||`None`})]})]},t)})}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Versions have not been checked.`}),t[8]=i,t[9]=u,t[10]=n,t[11]=_):_=t[11];let y=a?`Managed by ${a}. `:``,b;t[12]===y?b=t[13]:(b=(0,Q.jsxs)(`p`,{className:`mt-4 border-t border-border/50 pt-3 text-xs text-muted-foreground`,children:[y,`Tools update automatically on this host when needed.`]}),t[12]=y,t[13]=b);let x;t[14]===o?x=t[15]:(x=o?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-destructive`,children:o}):null,t[14]=o,t[15]=x);let S;t[16]===r?S=t[17]:(S=r?(0,Q.jsx)(`div`,{className:`mt-3`,children:r}):null,t[16]=r,t[17]=S);let C;t[18]!==b||t[19]!==x||t[20]!==S||t[21]!==g||t[22]!==_?(C=(0,Q.jsxs)(rt,{align:`end`,width:`md`,children:[g,_,b,x,S]}),t[18]=b,t[19]=x,t[20]=S,t[21]=g,t[22]=_,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==m?(w=(0,Q.jsxs)(at,{children:[m,C]}),t[24]=C,t[25]=m,t[26]=w):w=t[26],w}function Ft(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function It(e,t,n,r=t){let i=(e,t)=>e.target===t.target&&e.port===t.port&&e.identityFile===t.identityFile,a=t=>{let n=e.filter(e=>i(e,t));if(n.length>1)throw Error(`Multiple hosts match this SSH destination. Select the environment to edit its hosts.`);return n[0]},o=e.find(e=>e.id===r.id)??a(r)??(n?void 0:a(t));return n?e.filter(e=>e.id!==o?.id):o?e.map(e=>e.id===o.id?{...t,id:o.id}:e):[...e,t]}function Lt(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Rt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:r}),t[2]=r,t[3]=i),i}function Rt(e){return(0,Q.jsxs)(Me,{children:[(0,Q.jsxs)(Ae,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(u,{className:`size-3`}):(0,Q.jsx)(f,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(je,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var zt=j(N);function Bt(e){let{identityFile:t,...n}=e;return zt({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function Vt(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function Ht(e,t,n,r){await Promise.all(e.map(async e=>{r(e.environmentId,{status:`pending`});try{if(!e.connected)throw Error(`Environment disconnected`);let i=await n(e.environmentId,t);r(e.environmentId,i.kind===`local`?{status:`local`}:{status:`connected`,platforms:i.platforms,...i.tools?{tools:i.tools}:{}})}catch(t){r(e.environmentId,{status:`failed`,error:t instanceof Error?t.message:String(t)})}}))}function Ut(e){let t=Oe(Ue.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=Vt(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await Ht(e,n,async(e,n)=>{if(!Ee(e,`settings:write`))throw Error(`This connection cannot test device hosts.`);let r=await t({environmentId:e,input:n});if(r._tag===`Failure`)throw Error(k(r.cause));return r.value},(e,t)=>{o[e]=t,r(n=>({...n,[a]:{...n[a],[e]:t}}))}),o}finally{i.current.delete(a)}}}}function Wt(e){let t=(0,Z.c)(107),{host:n,isNew:r,targets:i,busy:a,onSave:o,onClose:s}=e,[c,d]=(0,$.useState)(n),{checks:f,testConnection:p}=Ut(i),m=f[Vt(c)],h=Object.values(m??{}).some(Kt),g,_;t[0]===c?(g=t[1],_=t[2]):(g=Bt({...c,label:c.label.trim()||c.target}),_=ee(g),t[0]=c,t[1]=g,t[2]=_);let v=_,y;t[3]===m?y=t[4]:(y=Object.values(m??{}).filter(Gt),t[3]=m,t[4]=y);let x=y.length,S;t[5]!==a||t[6]!==s?(S=e=>{!e&&!a&&s()},t[5]=a,t[6]=s,t[7]=S):S=t[7];let w=!a,T;t[8]!==a||t[9]!==h||t[10]!==c.label||t[11]!==g||t[12]!==o?(T=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),ee(g)&&c.label.trim()&&!a&&!h&&o(g.value)}}),t[8]=a,t[9]=h,t[10]=c.label,t[11]=g,t[12]=o,t[13]=T):T=t[13];let E=r?`Add device host`:`Edit device host`,D;t[14]===E?D=t[15]:(D=(0,Q.jsx)(Fe,{children:E}),t[14]=E,t[15]=D);let O=i.length===1?`Connect from ${i[0]?.label}.`:`Connect from ${i.length} selected environments.`,k;t[16]===O?k=t[17]:(k=(0,Q.jsxs)(ze,{children:[O,` `,`Hosts on the same machine are skipped.`]}),t[16]=O,t[17]=k);let A;t[18]!==D||t[19]!==k?(A=(0,Q.jsxs)(Pe,{children:[D,k]}),t[18]=D,t[19]=k,t[20]=A):A=t[20];let j;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(`span`,{children:`Name`}),t[21]=j):j=t[21];let M;t[22]===c?M=t[23]:(M=e=>d({...c,label:e.target.value}),t[22]=c,t[23]=M);let N;t[24]!==a||t[25]!==c.label||t[26]!==M?(N=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[j,(0,Q.jsx)(Ne,{autoFocus:!0,required:!0,value:c.label,disabled:a,onChange:M,placeholder:`Mac mini`})]}),t[24]=a,t[25]=c.label,t[26]=M,t[27]=N):N=t[27];let P;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(`span`,{children:`SSH target`}),t[28]=P):P=t[28];let F;t[29]===c?F=t[30]:(F=e=>d({...c,target:e.target.value}),t[29]=c,t[30]=F);let I;t[31]!==a||t[32]!==c.target||t[33]!==F?(I=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[P,(0,Q.jsx)(Ne,{required:!0,value:c.target,disabled:a,onChange:F,placeholder:`user@host or SSH alias`})]}),t[31]=a,t[32]=c.target,t[33]=F,t[34]=I):I=t[34];let L=n.port!==void 0||n.identityFile!==void 0||void 0,R;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`SSH options`}),t[35]=R):R=t[35];let z;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(`span`,{children:`Identity file`}),t[36]=z):z=t[36];let B=c.identityFile??``,V;t[37]===c?V=t[38]:(V=e=>{let{identityFile:t,...n}=c;d(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=c,t[38]=V);let te;t[39]!==a||t[40]!==B||t[41]!==V?(te=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[z,(0,Q.jsx)(Ne,{value:B,disabled:a,onChange:V,placeholder:`SSH config default`})]}),t[39]=a,t[40]=B,t[41]=V,t[42]=te):te=t[42];let ne;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=ne):ne=t[43];let re=c.port??``,ie;t[44]===c?ie=t[45]:(ie=e=>{let{port:t,...n}=c;d(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=c,t[45]=ie);let ae;t[46]!==a||t[47]!==re||t[48]!==ie?(ae=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[ne,(0,Q.jsx)(Ne,{type:`number`,min:1,max:65535,value:re,disabled:a,onChange:ie,placeholder:`Default`})]}),t[46]=a,t[47]=re,t[48]=ie,t[49]=ae):ae=t[49];let H;t[50]!==te||t[51]!==ae?(H=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[te,ae]}),t[50]=te,t[51]=ae,t[52]=H):H=t[52];let oe;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=oe):oe=t[53];let U;t[54]!==L||t[55]!==H?(U=(0,Q.jsxs)(`details`,{open:L,className:`text-sm`,children:[R,H,oe]}),t[54]=L,t[55]=H,t[56]=U):U=t[56];let se=h?`Checking environments…`:m?x?`${x} of ${i.length} failed`:`Connection checks passed`:`Check access before saving`,ce;t[57]===se?ce=t[58]:(ce=(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:se}),t[57]=se,t[58]=ce);let le=a||h||!v,W;t[59]!==g||t[60]!==p?(W=()=>{ee(g)&&p(g.value)},t[59]=g,t[60]=p,t[61]=W):W=t[61];let ue;t[62]===h?ue=t[63]:(ue=h?(0,Q.jsx)(_e,{size:`xs`}):null,t[62]=h,t[63]=ue);let G;t[64]!==le||t[65]!==W||t[66]!==ue?(G=(0,Q.jsxs)(b,{type:`button`,size:`sm`,variant:`outline`,disabled:le,onClick:W,children:[ue,` Test connection`]}),t[64]=le,t[65]=W,t[66]=ue,t[67]=G):G=t[67];let K;t[68]!==ce||t[69]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[ce,G]}),t[68]=ce,t[69]=G,t[70]=K):K=t[70];let de;t[71]!==m||t[72]!==i?(de=m?(0,Q.jsx)(`ul`,{className:`border-t border-border/60 divide-y divide-border/40`,children:i.map(e=>{let t=m[e.environmentId];return t?(0,Q.jsxs)(`li`,{className:`px-3 py-2.5 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:e.label}),(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-1.5 ${t.status===`failed`?`text-destructive`:`text-muted-foreground`}`,children:t.status===`pending`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_e,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(C,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(u,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(Lt,{platforms:t.platforms})}):null,t.status===`failed`?(0,Q.jsxs)(`details`,{className:`mt-1.5 text-muted-foreground`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:`Show error`}),(0,Q.jsx)(`p`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words`,children:t.error})]}):null]},e.environmentId):null})}):null,t[71]=m,t[72]=i,t[73]=de):de=t[73];let fe;t[74]!==K||t[75]!==de?(fe=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/60`,children:[K,de]}),t[74]=K,t[75]=de,t[76]=fe):fe=t[76];let pe;t[77]!==N||t[78]!==I||t[79]!==U||t[80]!==fe?(pe=(0,Q.jsxs)(Re,{children:[N,I,U,fe]}),t[77]=N,t[78]=I,t[79]=U,t[80]=fe,t[81]=pe):pe=t[81];let me;t[82]!==a||t[83]!==s?(me=(0,Q.jsx)(b,{type:`button`,variant:`ghost`,disabled:a,onClick:s,children:`Cancel`}),t[82]=a,t[83]=s,t[84]=me):me=t[84];let he;t[85]!==a||t[86]!==h||t[87]!==c.label||t[88]!==v?(he=a||h||!v||!c.label.trim(),t[85]=a,t[86]=h,t[87]=c.label,t[88]=v,t[89]=he):he=t[89];let ge;t[90]===a?ge=t[91]:(ge=a?(0,Q.jsx)(_e,{size:`xs`}):null,t[90]=a,t[91]=ge);let q;t[92]!==he||t[93]!==ge?(q=(0,Q.jsxs)(b,{type:`submit`,disabled:he,children:[ge,` Save host`]}),t[92]=he,t[93]=ge,t[94]=q):q=t[94];let ve;t[95]!==me||t[96]!==q?(ve=(0,Q.jsxs)(Ie,{children:[me,q]}),t[95]=me,t[96]=q,t[97]=ve):ve=t[97];let ye;t[98]!==A||t[99]!==pe||t[100]!==w||t[101]!==ve||t[102]!==T?(ye=(0,Q.jsxs)(Be,{showCloseButton:w,render:T,children:[A,pe,ve]}),t[98]=A,t[99]=pe,t[100]=w,t[101]=ve,t[102]=T,t[103]=ye):ye=t[103];let be;return t[104]!==S||t[105]!==ye?(be=(0,Q.jsx)(Ve,{open:!0,onOpenChange:S,children:ye}),t[104]=S,t[105]=ye,t[106]=be):be=t[106],be}function Gt(e){return e.status===`failed`}function Kt(e){return e.status===`pending`}function qt(e){let{scope:t,environments:n,connectedEnvironments:r}=ht(),i=Te(e.environmentId,ne),a=t.kind===`project`||t.kind===`checkout`,o=Oe(we.updateSettings,{reportFailure:!1}),[s,c]=(0,$.useState)(null),[l,u]=(0,$.useState)(null),[d,f]=(0,$.useState)(!1),p=n.map(e=>({environmentId:e.environmentId,label:e.label,connected:e.connection.phase===`connected`})),{checks:h,testConnection:g}=Ut(p),_=async(t,r=!1,i=t)=>{if(e.environmentId&&!a){f(!0);try{let e=await Promise.allSettled(n.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Ee(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return o({environmentId:e.environmentId,input:{patch:{deviceHosts:It(e.serverConfig.settings.deviceHosts,t,r,i)}}})})),a=n.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});a.length===0?c(null):q.add({type:`error`,title:`Device hosts not saved on all environments`,description:`Could not update ${a.map(e=>e.label).join(`, `)}.`})}finally{f(!1)}}};return(0,Q.jsx)(X,{id:`device-hosts`,title:`Device hosts`,serverScoped:!0,settingKeys:[`deviceHosts`],description:`Add remote machines with simulator or emulator runtimes installed, and the selected environments will connect over SSH and set up device tools automatically.`,control:(0,Q.jsxs)(b,{size:`sm`,variant:`outline`,disabled:!i||a||d||!e.environmentId||s!==null,onClick:()=>{u(null),c({kind:`ssh`,id:y(),label:``,target:``})},children:[(0,Q.jsx)(m,{className:`size-3.5`}),` Add host`]}),children:(0,Q.jsx)(`div`,{className:`pt-3 pb-2`,children:e.environmentId?(0,Q.jsxs)(Q.Fragment,{children:[r.map(e=>(0,Q.jsxs)(`div`,{children:[r.length>1?(0,Q.jsx)(`p`,{className:`pt-3 pb-1 text-xs font-medium text-muted-foreground`,children:e.label}):null,(0,Q.jsx)(Jt,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!i||a||d,checks:h,testConnection:async e=>{let t=await g(e);if(!t)return;let n=p.filter(e=>t[e.environmentId]?.status===`failed`);return q.add({type:n.length?`error`:`success`,title:n.length?`${e.label}: ${n.length} of ${p.length} environments failed`:`${e.label}: connection checks passed`,description:n.length?`Could not connect from ${n.map(e=>e.label).join(`, `)}.`:`Connected or already available locally on each selected environment.`}),t},onEdit:e=>{u(e),c(e)},onRemove:e=>void _(e,!0)})]},e.environmentId)),s?(0,Q.jsx)(Wt,{host:s,isNew:l===null,targets:p,busy:d,onSave:e=>void _(e,!1,l??e),onClose:()=>c(null)},s.id):null]}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect a selected environment to manage device hosts.`})})})}function Jt(e){let t=(0,Z.c)(28),{environmentLabel:n,environmentId:r,hosts:i,busy:a,onEdit:o,onRemove:s,checks:c,testConnection:l}=e,{state:u}=He(r),f=Oe(Ue.list),[p,m]=(0,$.useState)(null),g;t[0]===i.length?g=t[1]:(g=i.length===0?(0,Q.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No device hosts.`}):null,t[0]=i.length,t[1]=g);let v;if(t[2]!==a||t[3]!==c||t[4]!==r||t[5]!==n||t[6]!==i||t[7]!==o||t[8]!==s||t[9]!==f||t[10]!==p||t[11]!==u||t[12]!==l){let e;t[14]!==a||t[15]!==c||t[16]!==r||t[17]!==n||t[18]!==o||t[19]!==s||t[20]!==f||t[21]!==p||t[22]!==u||t[23]!==l?(e=e=>{let t=u.hostStatuses[e.id],i=c[Vt(e)]?.[r],g=(i?.status===`connected`?i.platforms:void 0)??u.hosts.find(t=>t.id===e.id)?.platforms??[],v=i?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,y=i?.status===`failed`?i.error:i?.status===`local`?void 0:t?.status===`failed`?t.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/50 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label}),g.filter(Xt).map(Yt)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(Pt,{owner:n,error:u.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:u.hosts.find(t=>t.id===e.id)?.tools??(i?.status===`connected`?i.tools:void 0)}),i?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,y?(0,Q.jsx)(`div`,{className:`mt-1`,role:`status`,children:(0,Q.jsxs)(`details`,{className:`text-xs text-destructive`,children:[(0,Q.jsx)(`summary`,{children:`Connection failed`}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:y})]})}):null]}),v?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(_e,{size:`xs`}),v]}):null,(0,Q.jsxs)(h,{children:[(0,Q.jsx)(_,{render:(0,Q.jsx)(b,{size:`icon-sm`,variant:`ghost-muted`,disabled:a,"aria-label":e.label+` options`}),children:(0,Q.jsx)(d,{})}),(0,Q.jsxs)(w,{align:`end`,children:[(0,Q.jsx)(O,{onClick:()=>{o(e)},children:`Edit`}),(0,Q.jsx)(O,{variant:`destructive`,onClick:()=>s(e),children:`Remove`})]})]}),t?.status===`failed`&&u.supportsHostRetry&&u.hostStatus!==`disabled`?(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:a||p!==null,onClick:()=>{m(e.id),f({environmentId:r,input:{retryHostId:e.id}}).finally(()=>m(null))},children:p===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:a||v!==null,onClick:()=>void l(e),children:`Test connection`})]},e.id)},t[14]=a,t[15]=c,t[16]=r,t[17]=n,t[18]=o,t[19]=s,t[20]=f,t[21]=p,t[22]=u,t[23]=l,t[24]=e):e=t[24],v=i.map(e),t[2]=a,t[3]=c,t[4]=r,t[5]=n,t[6]=i,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=u,t[12]=l,t[13]=v}else v=t[13];let y;return t[25]!==g||t[26]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[g,v]}),t[25]=g,t[26]=v,t[27]=y):y=t[27],y}function Yt(e){return(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ae,{render:(0,Q.jsx)(`span`,{tabIndex:0,role:`img`,"aria-label":e.platform===`ios`?`iOS available`:`Android available`,className:`shrink-0 text-muted-foreground`}),children:e.platform===`ios`?(0,Q.jsx)(Qe,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)($e,{className:`size-3.5`})}),(0,Q.jsx)(je,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function Xt(e){return e.available}var Zt=j(M),Qt=e=>({kind:`eas`,id:e,label:`EAS Simulator`,accessToken:``,maxSessionMinutes:30,idleMinutes:10,maxConcurrentSessions:2});function $t(e,t,n){return n?e.filter(e=>e.id!==t.id):e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t]}function en(e){return`Up to ${e.maxConcurrentSessions===1?`1 session`:`${e.maxConcurrentSessions} sessions`} at once, each stopped after ${e.maxSessionMinutes} min or ${e.idleMinutes} idle min`}var tn=`thread-project`,nn={settings:`the access token saved here`,env:`EXPO_TOKEN on the server`,"eas-login":`the server's eas login`},rn=e=>{let t=F(e);return t instanceof Error?t.message:String(t)};function an(e){let t=(0,Z.c)(24),{scope:n,connectedEnvironments:r}=ht(),o=Te(e.environmentId,ne),s=n.kind===`project`||n.kind===`checkout`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={reportFailure:!1},t[0]=c):c=t[0];let l=Oe(we.updateSettings,c),u;t[1]===e.environmentId?u=t[2]:(u=t=>t.environmentId===e.environmentId,t[1]=e.environmentId,t[2]=u);let d=r.find(u)?.serverConfig?.settings.easDeviceHosts??[],[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(!1),g=!o||s||m||!e.environmentId,_=async(t,n)=>{if(!e.environmentId||!Ee(e.environmentId,`settings:write`))return;h(!0);let r=await l({environmentId:e.environmentId,input:{patch:{easDeviceHosts:$t(d,t,n)}}});h(!1),r._tag===`Success`?p(null):q.add({type:`error`,title:n?`EAS host not removed`:`EAS host not saved`,description:rn(r.cause)})},v=X,x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=[`easDeviceHosts`],t[3]=x):x=t[3];let S=g||f!==null,C;t[4]===p?C=t[5]:(C=()=>p({host:Qt(y()),isNew:!0}),t[4]=p,t[5]=C);let w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(a,{className:`size-3.5`}),t[6]=w):w=t[6];let T;t[7]!==S||t[8]!==C?(T=(0,Q.jsxs)(b,{size:`sm`,variant:`outline`,disabled:S,onClick:C,children:[w,` Add EAS host`]}),t[7]=S,t[8]=C,t[9]=T):T=t[9];let E=d.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No EAS hosts.`}):(0,Q.jsx)(`ul`,{className:`divide-y divide-border/40`,children:d.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate font-medium`,children:[(0,Q.jsx)(i,{className:`size-3.5 shrink-0`}),` `,e.label]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:en(e)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(b,{size:`sm`,variant:`ghost`,disabled:g,onClick:()=>p({host:e,isNew:!1}),children:`Edit`}),(0,Q.jsx)(b,{size:`sm`,variant:`ghost-destructive`,disabled:g,onClick:()=>void _(e,!0),children:`Remove`})]})]},e.id))}),D;t[10]!==m||t[11]!==f||t[12]!==e.environmentId||t[13]!==_||t[14]!==p?(D=f&&e.environmentId?(0,Q.jsx)(on,{environmentId:e.environmentId,host:f.host,isNew:f.isNew,busy:m,onSave:e=>void _(e,!1),onClose:()=>p(null)},f.host.id):null,t[10]=m,t[11]=f,t[12]=e.environmentId,t[13]=_,t[14]=p,t[15]=D):D=t[15];let O;t[16]!==E||t[17]!==D?(O=(0,Q.jsxs)(`div`,{className:`pt-3 pb-2`,children:[E,D]}),t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;return t[19]!==v||t[20]!==T||t[21]!==O||t[22]!==x?(k=(0,Q.jsx)(v,{id:`eas-device-hosts`,title:`EAS Simulator`,serverScoped:!0,settingKeys:x,description:`Run iOS Simulators and Android emulators in Expo's cloud from this environment. Sessions bill the Expo account until they stop, so each host limits how many run and for how long. Editing or removing a host stops its running sessions.`,control:T,children:O}),t[19]=v,t[20]=T,t[21]=O,t[22]=x,t[23]=k):k=t[23],k}function on(e){let t=(0,Z.c)(135),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=Oe(Ue.easAccount,n),[i,a]=(0,$.useState)(e.host),s=(0,$.useId)(),c;t[1]===e.host.accessToken?c=t[2]:(c=e.host.accessToken?{kind:`saved`}:{kind:`cleared`},t[1]=e.host.accessToken,t[2]=c);let[l,u]=(0,$.useState)(c),d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d={status:`checking`},t[3]=d):d=t[3];let[f,p]=(0,$.useState)(d),m,h;t[4]!==i||t[5]!==e.host.accessToken||t[6]!==l.kind||t[7]!==l.value?(m={...i,label:i.label.trim(),accessToken:l.kind===`saved`?e.host.accessToken:l.kind===`new`?l.value:``},h=ee(Zt(m)),t[4]=i,t[5]=e.host.accessToken,t[6]=l.kind,t[7]=l.value,t[8]=m,t[9]=h):(m=t[8],h=t[9]);let g=h,_=g?null:i.maxSessionMinutes>0&&i.idleMinutes>=i.maxSessionMinutes?`Idle minutes must be smaller than session minutes.`:`Give the host a label and limits within the ranges shown.`,v;t[10]!==f.account||t[11]!==f.status?(v=f.status===`signed-in`?f.account.apps:[],t[10]=f.account,t[11]=f.status,t[12]=v):v=t[12];let y=v,x=(0,$.useRef)(0),S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{x.current+=1,p({status:`idle`})},t[13]=S):S=t[13];let C=S,w;t[14]!==r||t[15]!==e.environmentId||t[16]!==e.host.id||t[17]!==e.isNew||t[18]!==l.kind||t[19]!==l.value?(w=async()=>{let t=x.current+=1,n=await r({environmentId:e.environmentId,input:{...l.kind===`saved`&&!e.isNew?{hostId:e.host.id}:{},...l.kind===`new`?{accessToken:l.value}:l.kind===`cleared`?{accessToken:``}:{}}});t===x.current&&p(n._tag===`Success`?{status:`signed-in`,account:n.value}:{status:`failed`,error:rn(n.cause)})},t[14]=r,t[15]=e.environmentId,t[16]=e.host.id,t[17]=e.isNew,t[18]=l.kind,t[19]=l.value,t[20]=w):w=t[20];let T=w,E;t[21]===T?E=t[22]:(E=()=>{p({status:`checking`}),T()},t[21]=T,t[22]=E);let D=E,O;t[23]===T?O=t[24]:(O=()=>void T(),t[23]=T,t[24]=O);let k=(0,$.useEffectEvent)(O),A;t[25]===k?A=t[26]:(A=()=>{k()},t[25]=k,t[26]=A);let j;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(j=[],t[27]=j):j=t[27],(0,$.useEffect)(A,j);let M;t[28]!==i||t[29]!==e.busy?(M=(t,n,r)=>(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(Ne,{type:`number`,min:1,max:r,value:i[t],disabled:e.busy,onChange:e=>{let n=Number(e.target.value);a(e=>({...e,[t]:n}))}})]}),t[28]=i,t[29]=e.busy,t[30]=M):M=t[30];let N=M,P;t[31]===e?P=t[32]:(P=t=>{!t&&!e.busy&&e.onClose()},t[31]=e,t[32]=P);let F=!e.busy,I;t[33]!==m||t[34]!==e||t[35]!==g?(I=t=>{t.preventDefault(),g&&!e.busy&&e.onSave(m)},t[33]=m,t[34]=e,t[35]=g,t[36]=I):I=t[36];let L=e.isNew?`Add EAS host`:`Edit EAS host`,R;t[37]===L?R=t[38]:(R=(0,Q.jsx)(Fe,{children:L}),t[37]=L,t[38]=R);let z;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(ze,{children:`The environment's server signs in to Expo and starts the sessions. Without a token here it uses EXPO_TOKEN, then its eas login.`}),t[39]=z):z=t[39];let B;t[40]===R?B=t[41]:(B=(0,Q.jsxs)(Pe,{children:[R,z]}),t[40]=R,t[41]=B);let V;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(`span`,{children:`Name`}),t[42]=V):V=t[42];let te;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(te=e=>{let t=e.target.value;a(e=>({...e,label:t}))},t[43]=te):te=t[43];let ne;t[44]!==i.label||t[45]!==e.busy?(ne=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[V,(0,Q.jsx)(Ne,{autoFocus:!0,required:!0,value:i.label,disabled:e.busy,onChange:te})]}),t[44]=i.label,t[45]=e.busy,t[46]=ne):ne=t[46];let re;t[47]===s?re=t[48]:(re=(0,Q.jsx)(`label`,{htmlFor:s,className:`block`,children:`Expo access token`}),t[47]=s,t[48]=re);let ie=l.kind===`saved`,ae=l.kind===`new`?l.value:``,H;t[49]===e.host.accessToken?H=t[50]:(H=t=>{let n=t.target.value;u(n?{kind:`new`,value:n}:e.host.accessToken?{kind:`saved`}:{kind:`cleared`}),C()},t[49]=e.host.accessToken,t[50]=H);let oe;t[51]!==e.busy||t[52]!==ie||t[53]!==ae||t[54]!==H||t[55]!==s?(oe=(0,Q.jsx)(At,{id:s,className:`min-w-0 flex-1`,configured:ie,value:ae,disabled:e.busy,placeholder:`Optional`,onChange:H}),t[51]=e.busy,t[52]=ie,t[53]=ae,t[54]=H,t[55]=s,t[56]=oe):oe=t[56];let U;t[57]===l.kind?U=t[58]:(U=l.kind===`cleared`?null:(0,Q.jsx)(b,{type:`button`,size:`icon-sm`,variant:`ghost-destructive`,"aria-label":`Clear access token`,onClick:()=>{u({kind:`cleared`}),C()},children:(0,Q.jsx)(o,{className:`size-3.5`})}),t[57]=l.kind,t[58]=U);let se;t[59]!==oe||t[60]!==U?(se=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[oe,U]}),t[59]=oe,t[60]=U,t[61]=se):se=t[61];let ce;t[62]!==re||t[63]!==se?(ce=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[re,se]}),t[62]=re,t[63]=se,t[64]=ce):ce=t[64];let le=f.status===`signed-in`?`Signed in as ${f.account.signedInAs} with ${nn[f.account.credentialSource]}.`:f.status===`failed`?f.error:f.status===`checking`?`Checking the Expo account…`:`Check the Expo account before choosing a project.`,W;t[65]===le?W=t[66]:(W=(0,Q.jsx)(`p`,{role:`status`,className:`min-w-0 text-xs text-muted-foreground`,children:le}),t[65]=le,t[66]=W);let ue=e.busy||f.status===`checking`,G;t[67]===D?G=t[68]:(G=()=>void D(),t[67]=D,t[68]=G);let fe;t[69]===f.status?fe=t[70]:(fe=f.status===`checking`?(0,Q.jsx)(_e,{size:`xs`}):null,t[69]=f.status,t[70]=fe);let me;t[71]!==ue||t[72]!==G||t[73]!==fe?(me=(0,Q.jsxs)(b,{type:`button`,size:`sm`,variant:`outline`,disabled:ue,onClick:G,children:[fe,` Check account`]}),t[71]=ue,t[72]=G,t[73]=fe,t[74]=me):me=t[74];let q;t[75]!==W||t[76]!==me?(q=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2.5`,children:[W,me]}),t[75]=W,t[76]=me,t[77]=q):q=t[77];let ve;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(`span`,{children:`EAS project`}),t[78]=ve):ve=t[78];let ye=i.appId??tn,be=e.busy,xe;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>{typeof e==`string`&&a(t=>{let{appId:n,...r}=t;return e===tn?r:{...r,appId:e}})},t[79]=xe):xe=t[79];let Se;t[80]===y?Se=t[81]:(Se=(0,Q.jsx)(he,{size:`sm`,"aria-label":`EAS project`,children:(0,Q.jsx)(de,{children:e=>e===tn?`From the thread's project`:y.find(t=>t.id===e)?.fullName??e})}),t[80]=y,t[81]=Se);let Ce;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,Q.jsx)(K,{value:tn,children:`From the thread's project`}),t[82]=Ce):Ce=t[82];let J;t[83]!==y||t[84]!==i.appId?(J=i.appId&&!y.some(e=>e.id===i.appId)?(0,Q.jsx)(K,{value:i.appId,children:i.appId}):null,t[83]=y,t[84]=i.appId,t[85]=J):J=t[85];let Y;t[86]===y?Y=t[87]:(Y=y.map(sn),t[86]=y,t[87]=Y);let we;t[88]!==J||t[89]!==Y?(we=(0,Q.jsxs)(pe,{children:[Ce,J,Y]}),t[88]=J,t[89]=Y,t[90]=we):we=t[90];let Te;t[91]!==e.busy||t[92]!==ye||t[93]!==Se||t[94]!==we?(Te=(0,Q.jsxs)(ge,{value:ye,disabled:be,onValueChange:xe,children:[Se,we]}),t[91]=e.busy,t[92]=ye,t[93]=Se,t[94]=we,t[95]=Te):Te=t[95];let Ee;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sessions bill the project's Expo account. "From the thread's project" reads extra.eas.projectId from the project's app config.`}),t[96]=Ee):Ee=t[96];let De;t[97]===Te?De=t[98]:(De=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ve,Te,Ee]}),t[97]=Te,t[98]=De);let ke;t[99]===N?ke=t[100]:(ke=(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[N(`maxConcurrentSessions`,`Sessions at once`,20),N(`maxSessionMinutes`,`Session minutes`,115),N(`idleMinutes`,`Idle minutes`,60)]}),t[99]=N,t[100]=ke);let Ae=e.isNew?null:` Saving restarts this host, which stops its running sessions.`,je;t[101]===Ae?je=t[102]:(je=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Expo allows sessions of up to 40 minutes on free accounts and 115 on paid ones, and ends one after the idle minutes without activity, so idle minutes must be smaller than session minutes.`,Ae]}),t[101]=Ae,t[102]=je);let Me;t[103]===_?Me=t[104]:(Me=_===null?null:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:_}),t[103]=_,t[104]=Me);let Le;t[105]!==ne||t[106]!==ce||t[107]!==q||t[108]!==De||t[109]!==ke||t[110]!==je||t[111]!==Me?(Le=(0,Q.jsxs)(Re,{children:[ne,ce,q,De,ke,je,Me]}),t[105]=ne,t[106]=ce,t[107]=q,t[108]=De,t[109]=ke,t[110]=je,t[111]=Me,t[112]=Le):Le=t[112];let He;t[113]!==e.busy||t[114]!==e.onClose?(He=(0,Q.jsx)(b,{type:`button`,variant:`ghost`,disabled:e.busy,onClick:e.onClose,children:`Cancel`}),t[113]=e.busy,t[114]=e.onClose,t[115]=He):He=t[115];let We=e.busy||!g,Ge;t[116]===e.busy?Ge=t[117]:(Ge=e.busy?(0,Q.jsx)(_e,{size:`xs`}):null,t[116]=e.busy,t[117]=Ge);let Ke;t[118]!==We||t[119]!==Ge?(Ke=(0,Q.jsxs)(b,{type:`submit`,disabled:We,children:[Ge,` Save host`]}),t[118]=We,t[119]=Ge,t[120]=Ke):Ke=t[120];let qe;t[121]!==He||t[122]!==Ke?(qe=(0,Q.jsxs)(Ie,{children:[He,Ke]}),t[121]=He,t[122]=Ke,t[123]=qe):qe=t[123];let Je;t[124]!==I||t[125]!==B||t[126]!==Le||t[127]!==qe?(Je=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-col`,onSubmit:I,children:[B,Le,qe]}),t[124]=I,t[125]=B,t[126]=Le,t[127]=qe,t[128]=Je):Je=t[128];let Ye;t[129]!==F||t[130]!==Je?(Ye=(0,Q.jsx)(Be,{showCloseButton:F,children:Je}),t[129]=F,t[130]=Je,t[131]=Ye):Ye=t[131];let Xe;return t[132]!==P||t[133]!==Ye?(Xe=(0,Q.jsx)(Ve,{open:!0,onOpenChange:P,children:Ye}),t[132]=P,t[133]=Ye,t[134]=Xe):Xe=t[134],Xe}function sn(e){return(0,Q.jsx)(K,{value:e.id,children:e.fullName},e.id)}function cn(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function ln(e,t,n){if(e.kind===`new`)return{kind:`new`,profileId:t};let r=n.find(t=>t.id===e.profileId);if(r!==void 0)return{kind:`existing`,profileId:e.profileId,name:r.name}}function un(e){return e.step!==`importing`}function dn(e){return e.unavailable===`browserRunning`?{step:`quit`}:e.unavailable===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`configure`}:e.unavailable===void 0?e.profiles.length===0?{step:`blocked`,reason:`unknownSourceProfile`}:{step:`configure`}:{step:`blocked`,reason:e.unavailable}}function fn(e){return e.kind===`imported`?{step:`done`,imported:e.imported,skipped:e.skipped,skippedDomains:e.skippedDomains,targetName:e.targetName}:e.reason===`browserRunning`?{step:`quit`}:e.reason===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`import`,checked:!0}:{step:`blocked`,reason:e.reason}}function pn(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:dn(e)}function mn(e){let t=pn(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function hn(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function gn(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function _n(e){return e.length===0?``:e.length===1?e[0]:e.length<=3?`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`:`${e.slice(0,3).join(`, `)} and ${e.length-3} more`}function vn(e){let t=(0,Z.c)(46),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,onImport:o,onRefreshSource:s,onOpenFullDiskAccessSettings:c,onCheckFullDiskAccess:l,onClose:u}=e,[d,f]=(0,$.useState)(n),p;t[0]===n?p=t[1]:(p=()=>dn(n),t[0]=n,t[1]=p);let[m,h]=(0,$.useState)(p),g;t[2]===n.profiles[0]?.directory?g=t[3]:(g=()=>n.profiles[0]?.directory??``,t[2]=n.profiles[0]?.directory,t[3]=g);let[_,v]=(0,$.useState)(g),b;t[4]!==a||t[5]!==i?(b=()=>cn(a,i),t[4]=a,t[5]=i,t[6]=b):b=t[6];let[x,S]=(0,$.useState)(b),[C,w]=(0,$.useState)(),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=y(),t[7]=T):T=t[7];let E=(0,$.useRef)(`profile-${T}`),D=(0,$.useRef)(!1),O;t[8]!==o||t[9]!==_||t[10]!==x||t[11]!==i?(O=()=>{if(D.current)return;let e=ln(x,E.current,i);e===void 0?(w(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`})):(w(void 0),D.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(fn(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{D.current=!1}))},t[8]=o,t[9]=_,t[10]=x,t[11]=i,t[12]=O):O=t[12];let k=O,A;t[13]===s?A=t[14]:(A=(e,t)=>{h({step:`checking`,check:e}),s().then(e=>{e&&(f(e),v(t=>hn(t,e))),h(t(e))}).catch(()=>h({step:`blocked`,reason:`readFailed`}))},t[13]=s,t[14]=A);let j=A,M;t[15]===j?M=t[16]:(M=()=>j(`browser`,pn),t[15]=j,t[16]=M);let N=M,P;t[17]===j?P=t[18]:(P=()=>j(`fullDiskAccess`,mn),t[17]=j,t[18]=P);let F=P,I;t[19]!==u||t[20]!==m?(I=e=>e||!un(m)?void 0:u(),t[19]=u,t[20]=m,t[21]=I):I=t[21];let L;t[22]===m?L=t[23]:(L=un(m),t[22]=m,t[23]=L);let R;t[24]!==a||t[25]!==r||t[26]!==l||t[27]!==u||t[28]!==c||t[29]!==s||t[30]!==N||t[31]!==F||t[32]!==k||t[33]!==d||t[34]!==_||t[35]!==m||t[36]!==x||t[37]!==C||t[38]!==i?(R=m.step===`quit`?(0,Q.jsx)(yn,{source:d,onCancel:u,onRechecked:N}):m.step===`fullDiskAccess`?(0,Q.jsx)(Sn,{source:d,onCancel:u,onOpenSettings:c,onCheck:l??(async()=>{let e=await s();return e!==void 0&&e.unavailable===void 0}),onGranted:m.resume===`import`?k:F,stillRequired:m.checked===!0}):m.step===`importing`?(0,Q.jsx)(Tn,{}):m.step===`checking`?(0,Q.jsx)(En,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(Dn,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(On,{source:d,reason:m.reason,onClose:u,onRetry:gn(m.reason)?k:void 0}):(0,Q.jsx)(Cn,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:v,target:x,onTargetChange:e=>{S(e),w(void 0)},targetError:C,onCancel:u,onImport:k}),t[24]=a,t[25]=r,t[26]=l,t[27]=u,t[28]=c,t[29]=s,t[30]=N,t[31]=F,t[32]=k,t[33]=d,t[34]=_,t[35]=m,t[36]=x,t[37]=C,t[38]=i,t[39]=R):R=t[39];let z;t[40]!==L||t[41]!==R?(z=(0,Q.jsx)(Be,{className:`max-w-lg`,showCloseButton:L,children:R}),t[40]=L,t[41]=R,t[42]=z):z=t[42];let B;return t[43]!==z||t[44]!==I?(B=(0,Q.jsx)(Ve,{open:!0,onOpenChange:I,children:z}),t[43]=z,t[44]=I,t[45]=B):B=t[45],B}function yn(e){let t=(0,Z.c)(12),{source:n,onCancel:r,onRechecked:i}=e,a;t[0]===n.name?a=t[1]:(a=(0,Q.jsxs)(Pe,{children:[(0,Q.jsxs)(Fe,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(ze,{children:[n.name,` is open, so its cookies can’t be read yet. Quit it, then continue.`]})]}),t[0]=n.name,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(b,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(b,{onClick:i,children:`I’ve quit it`}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(Ie,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function bn(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function xn(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function Sn(e){let t=(0,Z.c)(43),{source:n,onCancel:r,onOpenSettings:i,onGranted:a,stillRequired:o,onCheck:s}=e,[l,u]=(0,$.useState)(!1),[d,f]=(0,$.useState)(null),p;t[0]===s?p=t[1]:(p=async()=>({fullDiskAccess:await s()}),t[0]=s,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={fullDiskAccess:!1},t[2]=m):m=t[2];let h=Nt(p,m),g;t[3]!==i||t[4]!==l?(g=()=>{l||(u(!0),f(null),Promise.resolve().then(i).catch(()=>f(`Could not open System Settings. Try Allow again.`)).finally(()=>u(!1)))},t[3]=i,t[4]=l,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=(0,Q.jsxs)(Pe,{children:[(0,Q.jsxs)(Fe,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(ze,{children:[`To import cookies from `,n.name,`, P4 Code needs Full Disk Access. Turn it on in System Settings, then come back to finish the import — you can revoke it again once the import is done.`]})]}),t[6]=n.name,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(c,{className:`size-8 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[8]=y):y=t[8];let x=`Read ${n.name}'s cookies for this import.`,S;t[9]===_?S=t[10]:(S=()=>void _(),t[9]=_,t[10]=S);let C;t[11]!==h.status.fullDiskAccess||t[12]!==x||t[13]!==S?(C=[{id:`fullDiskAccess`,icon:y,title:`Full Disk Access`,description:x,granted:h.status.fullDiskAccess,onAllow:S}],t[11]=h.status.fullDiskAccess,t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]!==l||t[16]!==C?(w=(0,Q.jsx)(jt,{busy:l,permissions:C}),t[15]=l,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==d||t[19]!==h.error?(T=d||h.error?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:d??h.error}):null,t[18]=d,t[19]=h.error,t[20]=T):T=t[20];let E;t[21]!==h||t[22]!==o?(E=h.isReady([`fullDiskAccess`])?null:(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:o?`Access is still required. Quit and reopen P4 Code if you just allowed it, then retry the import.`:`If access doesn't update after you allow it, quit and reopen P4 Code, then retry the import.`}),t[21]=h,t[22]=o,t[23]=E):E=t[23];let D;t[24]!==T||t[25]!==E||t[26]!==w?(D=(0,Q.jsxs)(Re,{children:[w,T,E]}),t[24]=T,t[25]=E,t[26]=w,t[27]=D):D=t[27];let O;t[28]===r?O=t[29]:(O=(0,Q.jsx)(b,{variant:`outline`,onClick:r,children:`Cancel`}),t[28]=r,t[29]=O);let k;t[30]===h?k=t[31]:(k=h.isReady([`fullDiskAccess`]),t[30]=h,t[31]=k);let A;t[32]!==a||t[33]!==l||t[34]!==k?(A=(0,Q.jsx)(Mt,{ready:k,busy:l,onClick:a,children:`Continue`}),t[32]=a,t[33]=l,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==O||t[37]!==A?(j=(0,Q.jsxs)(Ie,{children:[O,A]}),t[36]=O,t[37]=A,t[38]=j):j=t[38];let M;return t[39]!==D||t[40]!==j||t[41]!==v?(M=(0,Q.jsxs)(Q.Fragment,{children:[v,D,j]}),t[39]=D,t[40]=j,t[41]=v,t[42]=M):M=t[42],M}function Cn(e){let t=(0,Z.c)(59),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:o,onSourceProfileChange:s,target:c,targetError:l,onTargetChange:u,onCancel:d,onImport:f}=e,p;t[0]!==c.kind||t[1]!==c.profileId||t[2]!==i?(p=c.kind===`existing`&&!i.some(e=>e.id===c.profileId),t[0]=c.kind,t[1]=c.profileId,t[2]=i,t[3]=p):p=t[3];let m=p,h=c.kind===`new`&&!a,g=l??(m?`That profile is no longer available. Choose where to import these cookies.`:h?`You've reached the profile limit. Choose an existing profile to import into.`:void 0),_;t[4]===n.name?_=t[5]:(_=(0,Q.jsxs)(Fe,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=_);let v;t[6]===r?v=t[7]:(v=(0,Q.jsxs)(ze,{children:[`Choose which cookies to import for `,r,`.`]}),t[6]=r,t[7]=v);let y;t[8]!==_||t[9]!==v?(y=(0,Q.jsxs)(Pe,{children:[_,v]}),t[8]=_,t[9]=v,t[10]=y):y=t[10];let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`From`}),t[11]=C):C=t[11];let w;if(t[12]!==s||t[13]!==n.profiles||t[14]!==o){let e;t[16]!==s||t[17]!==o?(e=e=>(0,Q.jsx)(wn,{selected:o===e.directory,title:e.name,subtitle:bn(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],w=n.profiles.map(e),t[12]=s,t[13]=n.profiles,t[14]=o,t[15]=w}else w=t[15];let T;t[19]===w?T=t[20]:(T=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[C,w]}),t[19]=w,t[20]=T);let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(S,{className:`size-4 sm:hidden`}),(0,Q.jsx)(x,{className:`hidden size-4 sm:block`})]}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Into`}),t[22]=D):D=t[22];let O;t[23]!==a||t[24]!==u||t[25]!==c.kind?(O=a?(0,Q.jsx)(wn,{selected:c.kind===`new`,title:`New profile`,subtitle:`Created for these cookies`,onSelect:()=>u({kind:`new`})}):null,t[23]=a,t[24]=u,t[25]=c.kind,t[26]=O):O=t[26];let k;if(t[27]!==u||t[28]!==c.kind||t[29]!==c.profileId||t[30]!==i){let e;t[32]!==u||t[33]!==c.kind||t[34]!==c.profileId?(e=e=>(0,Q.jsx)(wn,{selected:c.kind===`existing`&&c.profileId===e.id,title:e.name,subtitle:`Existing profile`,onSelect:()=>u({kind:`existing`,profileId:e.id})},e.id),t[32]=u,t[33]=c.kind,t[34]=c.profileId,t[35]=e):e=t[35],k=i.map(e),t[27]=u,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=k}else k=t[31];let A;t[36]!==O||t[37]!==k?(A=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[D,O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==A||t[40]!==T?(j=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[T,E,A]}),t[39]=A,t[40]=T,t[41]=j):j=t[41];let M;t[42]===g?M=t[43]:(M=g?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:g}):null,t[42]=g,t[43]=M);let N;t[44]!==j||t[45]!==M?(N=(0,Q.jsxs)(Re,{children:[j,M]}),t[44]=j,t[45]=M,t[46]=N):N=t[46];let P;t[47]===d?P=t[48]:(P=(0,Q.jsx)(b,{variant:`outline`,onClick:d,children:`Cancel`}),t[47]=d,t[48]=P);let F=o===``||m||h,I;t[49]!==f||t[50]!==F?(I=(0,Q.jsx)(b,{disabled:F,onClick:f,children:`Import`}),t[49]=f,t[50]=F,t[51]=I):I=t[51];let L;t[52]!==P||t[53]!==I?(L=(0,Q.jsxs)(Ie,{children:[P,I]}),t[52]=P,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==N||t[56]!==L||t[57]!==y?(R=(0,Q.jsxs)(Q.Fragment,{children:[y,N,L]}),t[55]=N,t[56]=L,t[57]=y,t[58]=R):R=t[58],R}function wn(e){let t=(0,Z.c)(22),{selected:n,title:r,subtitle:i,onSelect:a}=e,o=n?`border-primary bg-primary/8`:`border-border/60 hover:border-border hover:bg-muted/40`,s;t[0]===o?s=t[1]:(s=D(`flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:r}),t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=i?(0,Q.jsx)(`span`,{className:`block truncate text-xs tabular-nums text-muted-foreground`,children:i}):null,t[4]=i,t[5]=l);let d;t[6]!==c||t[7]!==l?(d=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=d):d=t[8];let f=n?`border-primary bg-primary text-primary-foreground`:`border-input`,p;t[9]===f?p=t[10]:(p=D(`grid size-4 shrink-0 place-items-center rounded-full border`,f),t[9]=f,t[10]=p);let m;t[11]===n?m=t[12]:(m=n?(0,Q.jsx)(u,{className:`size-2.5`}):null,t[11]=n,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Q.jsx)(`span`,{className:p,children:m}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==a||t[17]!==n||t[18]!==s||t[19]!==d||t[20]!==h?(g=(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:a,className:s,children:[d,h]}),t[16]=a,t[17]=n,t[18]=s,t[19]=d,t[20]=h,t[21]=g):g=t[21],g}function Tn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Fe,{children:`Importing cookies`}),(0,Q.jsx)(ze,{children:`This may take a moment.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[t,(0,Q.jsx)(Re,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(_e,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function En(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(Fe,{children:[`Checking `,n]}),t[0]=n,t[1]=i);let a=r===`fullDiskAccess`?`Checking Full Disk Access.`:`Checking whether the browser has closed.`,o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(ze,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(Pe,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6];let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(_e,{size:`md`,tone:`muted`}),t[7]=c):c=t[7];let l=r===`fullDiskAccess`?`Checking access…`:`Checking…`,u;t[8]===l?u=t[9]:(u=(0,Q.jsx)(Re,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[c,(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:l})]})}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function Dn(e){let t=(0,Z.c)(24),{imported:n,skipped:r,skippedDomains:i,targetName:a,destinationEnvironmentName:o,onClose:s}=e,c;t[0]!==n||t[1]!==r?(c=n>0?`Imported ${xn(n)}`:r>0?`Skipped ${xn(r)}`:`No cookies found`,t[0]=n,t[1]=r,t[2]=c):c=t[2];let l;t[3]===c?l=t[4]:(l=(0,Q.jsx)(Fe,{children:c}),t[3]=c,t[4]=l);let u;t[5]!==o||t[6]!==n||t[7]!==r||t[8]!==a?(u=n>0?`Added to ${a} for ${o}.${r>0?` ${xn(r)} skipped.`:``}`:r>0?`No cookies were imported for ${o}.`:`There were no cookies to import for ${o}.`,t[5]=o,t[6]=n,t[7]=r,t[8]=a,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,Q.jsx)(ze,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(Pe,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i.length>0?(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Skipped`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-foreground`,children:_n(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(b,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(Ie,{children:(0,Q.jsx)(Le,{render:m,onClick:s,children:`Done`})}),t[18]=s,t[19]=h);let g;return t[20]!==f||t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[f,p,h]}),t[20]=f,t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function On(e){let t=(0,Z.c)(17),{source:n,reason:r,onClose:i,onRetry:a}=e,o;t[0]===n.name?o=t[1]:(o=(0,Q.jsxs)(Fe,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=o);let s=I[r],c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(ze,{children:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c?(l=(0,Q.jsxs)(Pe,{children:[o,c]}),t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,Q.jsx)(b,{variant:`outline`,onClick:i,children:`Close`}),t[7]=i,t[8]=u);let d;t[9]===a?d=t[10]:(d=a?(0,Q.jsx)(b,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(Ie,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==l||t[15]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16],p}var kn=`fill`,An=`responsive`;async function jn(e,t,n,r){let i=e===null?[]:t,a=r?.environmentIds??[];if(i.length===0&&a.length===0)throw Error(`Browser profile data is not available to clear.`);await Promise.all([...i.flatMap(t=>[e.clearCookies(t,n),e.clearCache(t,n)]),...a.map(e=>r.clear(e,n))])}function Mn(e,t,n,r=0){return(e||r>0)&&t&&n>0}var Nn={width:1280,height:800},Pn={useGrouping:!1},Fn={system:`System`,light:`Light`,dark:`Dark`},In=e=>`${Math.round(e*100)}%`,Ln=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},Rn=e=>{let t=String(e?.message??``);return oe.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},zn=e=>e._tag===`fill`?kn:e._tag===`preset`&&Tt.some(t=>t.id===e.presetId)?e.presetId:An,Bn=e=>{let t=zn(e);return t===kn?`Fill panel`:t===An?`Responsive`:Tt.find(e=>e.id===t)?.label??`Responsive`},Vn=e=>Number.isInteger(e)&&e>=240&&e<=3840,Hn=e=>({...e,width:e.height,height:e.width});function Un(e){let t=(0,Z.c)(42),{disabled:n}=e,r=J(Gn),i=Y(),a=r._tag===`fill`?null:r,o=a?.width??Nn.width,s=a?.height??Nn.height,c;t[0]!==o||t[1]!==s?(c={width:o,height:s},t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]!==a?.height||t[4]!==a?.width||t[5]!==i?(u=e=>{if(e===kn){i({browserDefaultViewport:ae});return}if(e===An){i({browserDefaultViewport:{_tag:`freeform`,width:a?.width??Nn.width,height:a?.height??Nn.height}});return}let t=Tt.find(t=>t.id===e);t&&i({browserDefaultViewport:{_tag:`preset`,width:t.width,height:t.height,presetId:t.id}})},t[3]=a?.height,t[4]=a?.width,t[5]=i,t[6]=u):u=t[6];let d=u,f;t[7]!==l||t[8]!==a||t[9]!==i?(f=(e,t)=>{if(t===null||!Vn(t))return;let n={...l,[e]:t};n.width*n.height>8294400||a&&n.width===a.width&&n.height===a.height||i({browserDefaultViewport:{_tag:`freeform`,...n}})},t[7]=l,t[8]=a,t[9]=i,t[10]=f):f=t[10];let p=f,m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=St(`browser-default-viewport`),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i||t[14]!==r._tag?(h=!n&&r._tag!==re._tag?(0,Q.jsx)(vt,{label:`default browser viewport`,onClick:()=>i({browserDefaultViewport:re})}):null,t[12]=n,t[13]=i,t[14]=r._tag,t[15]=h):h=t[15];let g;t[16]===r?g=t[17]:(g=zn(r),t[16]=r,t[17]=g);let _;t[18]===r?_=t[19]:(_=Bn(r),t[18]=r,t[19]=_);let v;t[20]===_?v=t[21]:(v=(0,Q.jsx)(he,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(de,{children:_})}),t[20]=_,t[21]=v);let y,x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(K,{value:kn,children:`Fill panel`}),x=(0,Q.jsx)(K,{value:An,children:`Responsive`}),t[22]=y,t[23]=x):(y=t[22],x=t[23]);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(pe,{align:`end`,alignItemWithTrigger:!1,children:[y,x,(0,Q.jsxs)(me,{children:[(0,Q.jsx)(fe,{children:`Standard`}),Tt.map(Wn)]})]}),t[24]=S):S=t[24];let C;t[25]!==n||t[26]!==d||t[27]!==v||t[28]!==g?(C=(0,Q.jsxs)(ge,{value:g,onValueChange:d,disabled:n,children:[v,S]}),t[25]=n,t[26]=d,t[27]=v,t[28]=g,t[29]=C):C=t[29];let w;t[30]!==p||t[31]!==n||t[32]!==l||t[33]!==a||t[34]!==i?(w=a?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(G,{value:l.width,min:240,max:H,disabled:n,format:Pn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`width`,e),children:(0,Q.jsx)(ue,{children:(0,Q.jsx)(W,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(G,{value:l.height,min:240,max:H,disabled:n,format:Pn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`height`,e),children:(0,Q.jsx)(ue,{children:(0,Q.jsx)(W,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ae,{render:(0,Q.jsx)(b,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${l.height>=l.width?`landscape`:`portrait`}`,onClick:()=>i({browserDefaultViewport:Hn(a)}),children:(0,Q.jsx)(xt,{})})}),(0,Q.jsx)(je,{side:`top`,children:`Rotate`})]})]}):null,t[30]=p,t[31]=n,t[32]=l,t[33]=a,t[34]=i,t[35]=w):w=t[35];let T;t[36]!==C||t[37]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto`,children:[C,w]}),t[36]=C,t[37]=w,t[38]=T):T=t[38];let E;return t[39]!==T||t[40]!==h?(E=(0,Q.jsx)(X,{...m,description:`Tab size for you and agents. Fill fits the panel; other sizes show the device toolbar.`,resetAction:h,control:T}),t[39]=T,t[40]=h,t[41]=E):E=t[41],E}function Wn(e){return(0,Q.jsx)(K,{value:e.id,children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-5`,children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:e.detail})]})},e.id)}function Gn(e){return e.browserDefaultViewport}function Kn(e){let t=(0,Z.c)(20),{disabled:n}=e,r=J(Jn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=St(`browser-default-zoom`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==i||t[3]!==r?(o=!n&&r!==1?(0,Q.jsx)(vt,{label:`default browser zoom`,onClick:()=>i({browserDefaultZoomFactor:1})}):null,t[1]=n,t[2]=i,t[3]=r,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=V.find(t=>String(t)===e);t!==void 0&&i({browserDefaultZoomFactor:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=In(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(de,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:V.map(qn)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(ge,{disabled:n,value:s,onValueChange:c,children:[u,d]}),t[12]=n,t[13]=s,t[14]=c,t[15]=u,t[16]=f):f=t[16];let p;return t[17]!==o||t[18]!==f?(p=(0,Q.jsx)(X,{...a,description:`Page zoom applied to new browser tabs.`,resetAction:o,control:f}),t[17]=o,t[18]=f,t[19]=p):p=t[19],p}function qn(e){return(0,Q.jsx)(K,{hideIndicator:!0,value:String(e),children:In(e)},e)}function Jn(e){return e.browserDefaultZoomFactor}function Yn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(Zn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=St(`browser-default-appearance`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(vt,{label:`default browser appearance`,onClick:()=>i({browserDefaultAppearance:z})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`light`||e===`dark`)&&i({browserDefaultAppearance:e})},t[5]=i,t[6]=s);let c=Fn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(de,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(Fn).map(Xn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(ge,{disabled:n,value:r,onValueChange:s,children:[l,u]}),t[10]=r,t[11]=n,t[12]=s,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`The color scheme pages are told to prefer. System follows your OS setting.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function Xn(e){let[t,n]=e;return(0,Q.jsx)(K,{hideIndicator:!0,value:t,children:n},t)}function Zn(e){return e.browserDefaultAppearance}function Qn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=J(er),i=J($n),a=Y(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=St(`browser-recording-key-presses`),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=e=>a({browserRecordingShowKeyPresses:!!e}),t[1]=a,t[2]=s);let c;t[3]!==n||t[4]!==r||t[5]!==s?(c=(0,Q.jsx)(X,{...o,description:`Show pressed keys and shortcuts in new recordings. Password fields are excluded.`,control:(0,Q.jsx)(Ct,{disabled:n,checked:r,"aria-label":`Show key presses in recordings`,onCheckedChange:s})}),t[3]=n,t[4]=r,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=St(`browser-recording-mouse-presses`),t[7]=l):l=t[7];let u;t[8]===a?u=t[9]:(u=e=>a({browserRecordingShowMousePresses:!!e}),t[8]=a,t[9]=u);let d;t[10]!==n||t[11]!==i||t[12]!==u?(d=(0,Q.jsx)(X,{...l,description:`Highlight mouse presses and held buttons in new recordings.`,control:(0,Q.jsx)(Ct,{disabled:n,checked:i,"aria-label":`Show mouse presses in recordings`,onCheckedChange:u})}),t[10]=n,t[11]=i,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function $n(e){return e.browserRecordingShowMousePresses}function er(e){return e.browserRecordingShowKeyPresses}function tr(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(rr),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=St(`browser-recording-frame-rate`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==30?(0,Q.jsx)(vt,{label:`browser recording frame rate`,onClick:()=>i({browserRecordingFrameRate:30})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s=String(r),c;t[5]===i?c=t[6]:(c=e=>{let t=se.find(t=>String(t)===e);t!==void 0&&i({browserRecordingFrameRate:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(de,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:se.map(nr)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(ge,{disabled:n,value:s,onValueChange:c,children:[l,u]}),t[10]=n,t[11]=s,t[12]=c,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`Maximum recording rate. 30 fps saves CPU and storage; 60 fps is smoother.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function nr(e){return(0,Q.jsxs)(K,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function rr(e){return e.browserRecordingFrameRate}var ir={system:`Your default browser`,app:`P4 Code`};function ar(e){let t=(0,Z.c)(19),{disabled:n}=e,r=J(sr),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=St(`browser-link-target`),t[0]=a):a=t[0];let o;t[1]!==n||t[2]!==r||t[3]!==i?(o=!n&&r!==`system`?(0,Q.jsx)(vt,{label:`link target`,onClick:()=>i({browserLinkTarget:A})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`app`)&&i({browserLinkTarget:e})},t[5]=i,t[6]=s);let c=ir[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(de,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(ir),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:u.map(or)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(ge,{disabled:n,value:r,onValueChange:s,children:[l,d]}),t[11]=n,t[12]=r,t[13]=s,t[14]=l,t[15]=f):f=t[15];let p;return t[16]!==o||t[17]!==f?(p=(0,Q.jsx)(X,{...a,description:`Where links in the chat and terminal open. Hold ⌘ or Ctrl while clicking a link to open it in your default browser either way.`,resetAction:o,control:f}),t[16]=o,t[17]=f,t[18]=p):p=t[18],p}function or(e){return(0,Q.jsx)(K,{hideIndicator:!0,value:e,children:ir[e]},e)}function sr(e){return e.browserLinkTarget}var cr={duckduckgo:`DuckDuckGo`,google:`Google`,bing:`Bing`,brave:`Brave Search`,kagi:`Kagi`,ecosia:`Ecosia`,custom:`Custom`};function lr(){let e=(0,Z.c)(24),t=J(fr),n=J(dr),r=Y(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=St(`browser-search-engine`),e[0]=i):i=e[0];let a;e[1]!==n||e[2]!==t||e[3]!==r?(a=t!==`duckduckgo`||n!==``?(0,Q.jsx)(vt,{label:`search engine`,onClick:()=>r({browserSearchEngine:P,browserCustomSearchUrl:``})}):null,e[1]=n,e[2]=t,e[3]=r,e[4]=a):a=e[4];let o;e[5]===r?o=e[6]:(o=e=>{let t=B.literals.find(t=>t===e);t!==void 0&&r({browserSearchEngine:t})},e[5]=r,e[6]=o);let s=cr[t],c;e[7]===s?c=e[8]:(c=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Search engine`,children:(0,Q.jsx)(de,{children:s})}),e[7]=s,e[8]=c);let l;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:B.literals.map(ur)}),e[9]=l):l=e[9];let u;e[10]!==t||e[11]!==o||e[12]!==c?(u=(0,Q.jsxs)(ge,{value:t,onValueChange:o,children:[c,l]}),e[10]=t,e[11]=o,e[12]=c,e[13]=u):u=e[13];let d;e[14]!==a||e[15]!==u?(d=(0,Q.jsx)(X,{...i,description:`What the address bar searches when you type something that isn't a URL.`,resetAction:a,control:u}),e[14]=a,e[15]=u,e[16]=d):d=e[16];let f;e[17]!==n||e[18]!==t||e[19]!==r?(f=t===`custom`?(0,Q.jsx)(X,{title:`Custom search URL`,description:`Use %s where the search terms go.`,status:tt(n)?void 0:`Enter an http or https URL containing %s. Searches use DuckDuckGo until then.`,control:(0,Q.jsx)(Ot,{nativeInput:!0,size:`sm`,className:`w-full sm:w-64`,"aria-label":`Custom search URL`,placeholder:`https://example.com/search?q=%s`,autoCapitalize:`none`,spellCheck:!1,maxLength:R,value:n,onCommit:e=>r({browserCustomSearchUrl:e.trim()})})}):null,e[17]=n,e[18]=t,e[19]=r,e[20]=f):f=e[20];let p;return e[21]!==d||e[22]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[d,f]}),e[21]=d,e[22]=f,e[23]=p):p=e[23],p}function ur(e){return(0,Q.jsx)(K,{hideIndicator:!0,value:e,children:cr[e]},e)}function dr(e){return e.browserCustomSearchUrl}function fr(e){return e.browserSearchEngine}function pr(){let e=(0,Z.c)(12),t=J(mr),n=Y(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=St(`pull-request-links-open-in-app`),e[0]=r):r=e[0];let i;e[1]!==t||e[2]!==n?(i=t?null:(0,Q.jsx)(vt,{label:`open pull requests in P4 Code`,onClick:()=>n({pullRequestLinksOpenInApp:!0})}),e[1]=t,e[2]=n,e[3]=i):i=e[3];let a;e[4]===n?a=e[5]:(a=e=>n({pullRequestLinksOpenInApp:!!e}),e[4]=n,e[5]=a);let o;e[6]!==t||e[7]!==a?(o=(0,Q.jsx)(Ct,{checked:t,onCheckedChange:a,"aria-label":`Open pull requests in P4 Code`}),e[6]=t,e[7]=a,e[8]=o):o=e[8];let s;return e[9]!==i||e[10]!==o?(s=(0,Q.jsx)(X,{...r,description:`Clicking a pull request link opens it in P4 Code. Turn off to open pull request links like any other link, on GitHub or your git host.`,resetAction:i,control:o}),e[9]=i,e[10]=o,e[11]=s):s=e[11],s}function mr(e){return e.pullRequestLinksOpenInApp}function hr(){let e=(0,Z.c)(7),{search:t,environment:n}=ht(),r=pt(),i=n?.connection.phase===`connected`&&n.serverConfig!==null?n.environmentId:null,a;e[0]===t?a=e[1]:(a=JSON.stringify(t),e[0]=t,e[1]=a);let o=`${i}:${a}`,s;return e[2]!==i||e[3]!==r.enableAgentDeviceAccess||e[4]!==r.enableDeviceSupport||e[5]!==o?(s=(0,Q.jsx)(yt,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(gr,{environmentId:i,enabled:r.enableDeviceSupport,agentAccessEnabled:r.enableAgentDeviceAccess},o)}),e[2]=i,e[3]=r.enableAgentDeviceAccess,e[4]=r.enableDeviceSupport,e[5]=o,e[6]=s):s=e[6],s}function gr({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=Te(e,ne),{state:i,loaded:a}=He(e),{scope:o,environments:s,connectedEnvironments:c}=ht(),l=mt(),u=o.kind===`project`||o.kind===`checkout`,d=c.some(e=>e.serverConfig?.settings.enableDeviceSupport),f=Oe(Ue.configure,{reportFailure:!1}),p=Oe(Ue.list,{reportFailure:!1}),[m,h]=(0,$.useState)(null),g=i.hostStatus===`installing`||i.hostStatus===`starting`,_=i.hosts.some(e=>e.kind===`local`&&!e.platforms.some(e=>e.available)),[v,y]=(0,$.useState)(!1);v&&!t&&y(!1),t&&!v&&(i.hostStatus===`ready`||_)&&m!==`hub`&&y(!0);let x=async(t,n)=>{if(e&&Ee(e,`settings:write`)){h(t);try{let e=await Promise.allSettled(s.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Ee(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return f({environmentId:e.environmentId,input:{...n,...n.enabled?{onboardingCompleted:!0}:{}}})})),t=s.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});t.length>0&&q.add({type:`error`,title:`Device settings not saved on all environments`,description:`Could not update ${t.map(e=>e.label).join(`, `)}.`})}finally{h(null)}}},[S,C]=(0,$.useState)(null),w=i.hosts.find(e=>e.kind===`local`)?.tools,E=e=>{let t=w?.[e];return i.supportsToolUpdate&&t?!t.installedVersions.includes(t.requiredVersion):!1},D=(t,n=!1)=>{e&&(C(null),h(`update-${t}`),p({environmentId:e,input:{updateTool:t}}).then(e=>{if(e._tag===`Failure`){let r=De(e.cause);C({tool:t,message:r}),n&&q.add({type:`error`,title:r})}}).finally(()=>h(null)))},O=t=>{e&&(h(t),p({environmentId:e,input:{inspectOnly:!0}}).finally(()=>h(null)))},k=t=>{let n=E(t);if(!n&&!i.supportsToolInspection)return null;let r=m===`update-${t}`||m===`check-${t}`,a=n?`Update to v${w?.[t].requiredVersion}`:`Check ${t===`hub`?`device hub`:`agent device`} version`;return(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ae,{render:(0,Q.jsx)(b,{size:`icon-xs`,variant:`ghost-muted`,disabled:!e||m!==null||g,"aria-label":a,onClick:()=>n?D(t,!0):O(`check-${t}`)}),children:(0,Q.jsxs)(`span`,{className:`grid *:col-start-1 *:row-start-1 *:transition-[opacity,scale] *:duration-150 *:ease-out motion-reduce:*:transition-none`,children:[(0,Q.jsx)(`span`,{className:n&&!r?void 0:`scale-75 opacity-0`,children:(0,Q.jsx)(T,{"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:n&&!r?`scale-75 opacity-0`:void 0,children:(0,Q.jsx)(wt,{refreshing:r})})]})}),(0,Q.jsx)(je,{side:`top`,children:a})]})},A=t=>{let n=w?.[t];return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&E(t)?(0,Q.jsx)(b,{size:`sm`,disabled:!e||m!==null||g,onClick:()=>D(t),children:m===`update-${t}`?`Updating…`:`Update to v${n.requiredVersion}`}):null,i.supportsToolInspection?(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:!e||m!==null||g,onClick:()=>O(`check`),children:m===`check`?`Checking…`:`Check versions`}):null]}),S?.tool===t?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:S.message}):null]})};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{...St(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:Je,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pt,{action:A(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`hub`),m===`hub`?(0,Q.jsx)(qe,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(kt,{settingKeys:[`enableDeviceSupport`],checked:t,disabled:!r||u||!a||!e||g||m!==null,"aria-label":`Device hub`,onCheckedChange:e=>void x(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]})}),(0,Q.jsx)(Ze,{children:v?(0,Q.jsx)(X,{...St(`device-platform-support`),description:c.length>1?`Status for ${c.find(t=>t.environmentId===e)?.label}. Select an environment to inspect its simulator support.`:void 0,status:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,Q.jsx)(Ge,{compact:!0,platform:`iOS`,status:Ke(i,`ios`)}),(0,Q.jsx)(Ge,{compact:!0,platform:`Android`,status:Ke(i,`android`)})]}),control:(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:!e||!t||g||m!==null,onClick:()=>{e&&(h(`check`),p({environmentId:e,input:{}}).finally(()=>h(null)))},children:m===`check`?`Checking…`:`Refresh`})}):null}),(0,Q.jsx)(X,{...St(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:We,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pt,{action:A(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`agent`),m===`agent`?(0,Q.jsx)(Ye,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(kt,{settingKeys:[`enableAgentDeviceAccess`],checked:n,disabled:!r||c.length===0||!u&&(!a||!d||g)||m!==null,"aria-label":`Agent device access`,onCheckedChange:e=>u?l({enableAgentDeviceAccess:!!e}):void x(`agent`,{agentAccessEnabled:!!e})})]})}),e?(0,Q.jsx)(Xe,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(qt,{environmentId:e}),i.supportsEasHosts?(0,Q.jsx)(an,{environmentId:e}):null]})}function _r(e){let t=(0,Z.c)(14),{disabled:n}=e,r=J(vr),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=St(`browser-auto-show-floating-preview`),t[0]=a):a=t[0];let o;t[1]!==r||t[2]!==n||t[3]!==i?(o=!n&&r!==!0?(0,Q.jsx)(vt,{label:`auto-show floating preview`,onClick:()=>i({browserAutoShowFloatingPreview:!0})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>i({browserAutoShowFloatingPreview:!!e}),t[5]=i,t[6]=s);let c;t[7]!==r||t[8]!==n||t[9]!==s?(c=(0,Q.jsx)(Ct,{disabled:n,checked:r,onCheckedChange:s,"aria-label":`Auto-show floating preview`}),t[7]=r,t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==o||t[12]!==c?(l=(0,Q.jsx)(X,{...a,description:`Show the floating preview when an agent opens a browser or device unless the agent says otherwise.`,resetAction:o,control:c}),t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function vr(e){return e.browserAutoShowFloatingPreview}function yr({disabled:e}){let t=J(e=>e.browserProfiles),n=J(e=>e.browserDefaultProfileId),r=xe(),i=Y(),{environments:a,isReady:o}=ve(),c=be(),[l,u]=(0,$.useState)(null),[f,v]=(0,$.useState)(null),[x,S]=(0,$.useState)(null),[C,T]=(0,$.useState)(null),[k,A]=(0,$.useState)(null),[j,M]=(0,$.useState)(!1),N=le(),P=Oe(et.clearProfile,{reportFailure:!1}),F={environmentIds:a.map(e=>e.environmentId).filter(e=>N.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await P({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw ce(n)}},I=Mn(Et!==null,o,a.length,F.environmentIds.length),R=(0,$.useRef)(!1),[z,B]=(0,$.useState)(!1),ee=e||!r,V=U(t).filter(e=>e.kind!==`incognito`),ne=te(V,n)?.id??`default`,re=e=>{if(!r||R.current)return;let t=Ce().browserProfiles;if(t.length>=24)return;let n=U(t),a=new Set(n.map(e=>e.name)),o=e;for(let t=2;a.has(o);t+=1)o=`${e} ${t}`;let s={id:`profile-${y()}`,name:o,kind:`persistent`};return i({browserProfiles:[...t,s]}),s},ae=(e,t)=>{if(!r||R.current)return;let n=t.trim().slice(0,48);if(n===``)return;let a=Ce().browserProfiles;i({browserProfiles:a.map(t=>t.id===e?{...t,name:n}:t)})},H=(e,t)=>{r&&!R.current&&(I?jn(Et,a.map(e=>e.environmentId),e,F).then(()=>{q.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{q.add({type:`error`,title:`Could not clear ${t}'s data`})}):q.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`}))},oe=async e=>{if(!r||R.current)return;if(!I){A(`Connect to an environment before removing this profile.`);return}A(null),M(!0);try{await jn(Et,o?a.map(e=>e.environmentId):[],e,F)}catch{A(`Profile data could not be deleted. Try again.`),M(!1);return}let t=Ce();i({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:ie}:{}}),M(!1),S(null)},se=(l??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),W=(0,$.useCallback)(()=>{Et&&Et.listBrowserImportSources().then(u).catch(()=>u(e=>e??[]))},[]),ue=async(e,t,n)=>{if(!Et||!r)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!U(Ce().browserProfiles).some(e=>e.id===n.target.profileId)||R.current)return{kind:`blocked`,reason:`readFailed`};R.current=!0,B(!0);try{let r=await Et.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!U(Ce().browserProfiles).some(e=>e.id===n.target.profileId))return{kind:`blocked`,reason:`readFailed`};let i;if(n.target.kind===`new`){if(r.imported>0)try{i=(await Se(t=>{if(t.browserProfiles.find(e=>e.id===n.target.profileId))return t;if(t.browserProfiles.length>=24)throw new Ln;let r=new Set(U(t.browserProfiles).map(e=>e.name)),i=e.name;for(let t=2;r.has(i);t+=1)i=`${e.name} ${t}`;return{...t,browserProfiles:[...t.browserProfiles,{id:n.target.profileId,name:i,kind:`persistent`}]}})).browserProfiles.find(e=>e.id===n.target.profileId)?.name??e.name}catch(r){await jn(Et,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof Ln?`profileLimitReached`:`profileNotSaved`;throw Error(`Importing cookies from ${e.id} failed: ${i}.`,{cause:r})}else i=e.name}else i=n.target.name;return{kind:`imported`,imported:r.imported,skipped:r.skipped,skippedDomains:r.skippedDomains,targetName:i}}catch(e){return{kind:`blocked`,reason:Rn(e)}}finally{R.current=!1,B(!1)}},G=async e=>{if(Et)try{let t=await Et.listBrowserImportSources();return u(t),t.find(t=>t.id===e)}catch{return}},K=t.length>=24;return(0,Q.jsxs)(X,{...St(`browser-profiles`),description:`Profiles separate cookies and logins. Incognito data is cleared when the app closes.`,control:(0,Q.jsxs)(h,{onOpenChange:e=>e&&W(),children:[(0,Q.jsxs)(_,{render:(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:ee||z}),children:[(0,Q.jsx)(m,{}),`Add profile`]}),(0,Q.jsxs)(w,{align:`end`,children:[(0,Q.jsx)(O,{disabled:!r||K,onClick:()=>re(`New profile`),children:`Blank profile`}),K?(0,Q.jsx)(O,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(E,{}),(0,Q.jsxs)(s,{children:[(0,Q.jsx)(g,{children:`Import from`}),l===null?(0,Q.jsx)(O,{disabled:!0,children:`Looking for browsers…`}):se.length===0?(0,Q.jsx)(O,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[se.map(e=>(0,Q.jsx)(O,{disabled:!r||c==null,onClick:()=>{r&&c!=null&&v({source:e,environmentId:c.environmentId,environmentName:bt({isPrimary:!0,environmentId:c.environmentId,runtimeLabel:c.label})})},children:e.name},e.id)),c==null?(0,Q.jsx)(O,{disabled:!0,children:`Connect to an environment to import cookies`}):null]})]})]})]}),children:[(0,Q.jsx)(`div`,{className:`mt-2 mb-2 overflow-hidden rounded-lg border border-border/60`,children:V.map((e,t)=>{let n=L(e.id),a=e.id===ne;return(0,Q.jsxs)(`div`,{className:D(`flex items-center gap-3 px-3 py-2`,t>0&&`border-t border-border/60`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[n?(0,Q.jsx)(`span`,{className:D(`truncate text-sm text-foreground`,ee&&`opacity-64`),children:e.name}):(0,Q.jsx)(Ot,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:ee||z,maxLength:48,value:e.name,onCommit:t=>ae(e.id,t)}),a?(0,Q.jsx)(`span`,{className:D(`flex`,ee&&`opacity-64`),children:(0,Q.jsx)(p,{children:`Default`})}):null]}),(0,Q.jsxs)(h,{children:[(0,Q.jsx)(_,{render:(0,Q.jsx)(b,{size:`icon-xs`,variant:`ghost-muted`,disabled:ee||z,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(d,{})}),(0,Q.jsxs)(w,{align:`end`,children:[(0,Q.jsx)(O,{disabled:!r||a,onClick:()=>{r&&i({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(O,{disabled:!r||!I,onClick:()=>{F.environmentIds.length>0?T(e):H(e.id,e.name)},children:`Clear cookies and cache`}),n?null:(0,Q.jsx)(O,{variant:`destructive`,disabled:!r||!I,onClick:()=>{r&&S(e)},children:`Remove profile and data`}),I?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(E,{}),(0,Q.jsx)(O,{disabled:!0,children:o?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(ft,{open:x!==null,onOpenChange:e=>{!e&&!j&&(S(null),A(null))},children:(0,Q.jsxs)(lt,{children:[(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(dt,{children:[`Remove “`,x?.name,`”?`]}),(0,Q.jsx)(ut,{children:`Its cookies and logins are deleted. Desktop tabs already open in this profile stay open until you close them; server browser tabs close now.`}),k?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:k}):null,I?null:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect to an environment to remove this profile and its data.`})]}),(0,Q.jsxs)(st,{children:[(0,Q.jsx)(ct,{disabled:j,render:(0,Q.jsx)(b,{variant:`outline`,disabled:j}),children:`Cancel`}),(0,Q.jsx)(b,{variant:`destructive`,disabled:j||!r||!I,onClick:()=>{x&&r&&I&&oe(x.id)},children:j?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(ft,{open:C!==null,onOpenChange:e=>{e||T(null)},children:(0,Q.jsxs)(lt,{children:[(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(dt,{children:[`Clear “`,C?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(ut,{children:`You are signed out of its sites. Server browser tabs open in this profile close now.`})]}),(0,Q.jsxs)(st,{children:[(0,Q.jsx)(ct,{render:(0,Q.jsx)(b,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(b,{variant:`destructive`,onClick:()=>{C&&H(C.id,C.name),T(null)},children:`Clear data`})]})]})}),f?(0,Q.jsx)(vn,{source:f.source,destinationEnvironmentName:f.environmentName,targetProfiles:V.map(e=>({id:e.id,name:e.name})),canCreateProfile:r&&!K,onImport:e=>ue(f.source,f.environmentId,e),onRefreshSource:()=>G(f.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await ye()?.shell.openSystemSettings(`full-disk-access`).catch(()=>{q.add({type:`error`,title:`Could not open System Settings`,description:`Open Privacy & Security → Full Disk Access manually.`})})},onClose:()=>v(null)}):null]})}function br(){let e=(0,Z.c)(3),t=!ke,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(yr,{disabled:t}),(0,Q.jsx)(Un,{disabled:t}),(0,Q.jsx)(Kn,{disabled:t}),(0,Q.jsx)(Yn,{disabled:t}),(0,Q.jsx)(tr,{disabled:t}),(0,Q.jsx)(Qn,{disabled:t}),(0,Q.jsx)(ar,{disabled:t}),(0,Q.jsx)(_r,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Dt,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(_t,{children:[i,(0,Q.jsxs)(yt,{id:`browser`,title:`Browser`,children:[t?(0,Q.jsx)(gt,{message:`Only available in the desktop app.`,children:r}):r,(0,Q.jsx)(lr,{}),(0,Q.jsx)(pr,{})]}),(0,Q.jsx)(hr,{})]}),e[2]=a):a=e[2],a}var xr=br;export{xr as component};
|
|
2
|
-
//# sourceMappingURL=settings.integrations-CpUf4-MX.js.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Jd as i,Jo as a,Lf as o,Ol as s,Qd as c,Td as l,Xn as u,Yd as d,Zn as f,al as p,fr as m,l as h,lf as g,mr as _,pf as v,rf as y,rr as b,t as x,tr as S,ws as C,yl as w}from"./utils-Cs97wR6T.js";import{Hc as T,Up as E,aa as D,ca as O,ia as k,la as A,oa as j,ra as M,sa as N,sh as P,ua as F,w as I}from"./src-BZzGU-vc.js";import{n as L}from"./ChatMarkdown-LYkpVHJO.js";import{a as R,c as z,o as B,s as V,t as H}from"./select-BtqP8nTL.js";import{t as U}from"./spinner-DmRIQvmI.js";import{t as W}from"./useLocation-hVHAnHTx.js";import{m as G}from"./relay-CnLeC-mg.js";import{C as K}from"./useSettings-C6RmJr-q.js";import{f as q}from"./server-BYnv0CK4.js";import{n as ee}from"./query-DpmTmXUV.js";import{t as J}from"./use-atom-command-DMW6SFOx.js";import{c as te,d as ne}from"./providerSkills-yqPKKW6i.js";import{i as re}from"./usageFormat-Njxx7Q49.js";import{a as ie,n as ae,t as oe}from"./tooltip-CAzkzAoH.js";import{t as se}from"./skeleton-DxuQc9Kk.js";import{t as ce}from"./textarea-C_3SxeEV.js";import{n as le,t as ue}from"./toggle-group-D015gcqT.js";import{t as de}from"./input-K95B1E2P.js";import{c as fe,r as pe,s as me,t as he}from"./dialog-BzESHWgr.js";import{i as ge,o as _e,r as ve,t as ye}from"./empty-CeYEMFdG.js";import{n as be,r as xe,t as Se}from"./input-group-BAbOiIZs.js";import{a as Ce}from"./projectFilesQueryState-DpLF9eJd.js";import{a as we,i as Te,n as Ee,o as De,r as Oe,s as ke,t as Ae}from"./alert-dialog-Broi1wym.js";import{F as je,G as Me,V as Ne,a as Y,i as Pe,s as Fe}from"./settingsLayout-BijX6mlS.js";import{Lr as Ie,Po as Le,ba as X}from"./main-C8b9a0ht.js";import{i as Re}from"./selfImproveFindings-DZS7PCvJ.js";import{r as ze,t as Be}from"./SelfImproveSettingsSection-yFj7aCio.js";import{t as Ve}from"./SecretInput-CxJl9pux.js";var Z=n(),He={spawn:`Failed to start`,timeout:`Timed out`,protocol:`Not an MCP server`,http:`Can't connect`,auth:`Credentials rejected`};function Ue(e,t,n){if(!e.enabled)return{tone:`muted`,label:`Off`,needsSignIn:!1};if(n)return{tone:`muted`,label:`Checking…`,needsSignIn:!1};if(e.transport.type===`http`&&e.transport.auth===`oauth`&&t?.auth===`signed-out`)return{tone:`warning`,label:`Needs sign-in`,needsSignIn:!0};let r=t?.health;switch(r?.status){case`connected`:return{tone:`success`,label:`Connected · ${r.toolCount} ${r.toolCount===1?`tool`:`tools`}`,needsSignIn:!1};case`needs-auth`:return{tone:`warning`,label:`Needs sign-in`,needsSignIn:!0};case`error`:return{tone:`error`,label:He[r.category],detail:r.message,needsSignIn:!1};default:return t?.auth===`signed-in`?{tone:`success`,label:`Signed in`,needsSignIn:!1}:{tone:`muted`,label:`Not checked`,needsSignIn:!1}}}function We(e){let t=e.transport;if(t.type===`http`)try{let e=new URL(t.url);return`Remote · ${e.host}${e.pathname===`/`?``:e.pathname}`}catch{return`Remote`}return[t.command,...t.args].join(` `)}var Q=e(t(),1),Ge=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ke=e=>typeof e==`string`&&e.trim()?e:void 0,qe=e=>{if(e!==null)try{let t=JSON.parse(e);return Ge(t)?t:void 0}catch{return}},Je=e=>{let t=Ke(e)?.replace(/^\.\//,``);if(t!==void 0&&t.toLowerCase().endsWith(`.svg`)&&!(t.startsWith(`/`)||t.split(/[\\/]/).includes(`..`)))return t};function Ye(e,t){let n=qe(e),r=qe(t),i=Ge(r?.interface)?r.interface:void 0,a=n?.author??r?.author,o={displayName:Ke(n?.displayName)??Ke(i?.displayName),description:Ke(n?.description)??Ke(r?.description),publisher:Ke(a)??(Ge(a)?Ke(a.name):void 0),iconPath:Je(n?.icon)??Je(i?.logo)??Je(i?.composerIcon)};return Object.fromEntries(Object.entries(o).filter(([,e])=>e!==void 0))}function Xe(e){let t=qe(e)?.userConfig;return Ge(t)?Object.entries(t).map(([e,t])=>{let n=Ge(t)?t:{},r=Ke(n.description);return{key:e,title:Ke(n.title)??e,...r===void 0?{}:{description:r},required:n.required===!0}}):[]}var $=e(r(),1),Ze=e=>{let t=P(C(e));return t&&!t.truncated?t.contents:null};function Qe(e){let t=(0,Z.c)(48),{environmentId:n,plugin:r,enabled:i,disabled:o,onDetails:s,onToggle:u}=e,d;t[0]!==n||t[1]!==r.path?(d=Ce(n,r.path,`.claude-plugin/plugin.json`),t[0]=n,t[1]=r.path,t[2]=d):d=t[2];let p=a(d),h;t[3]!==n||t[4]!==r.path?(h=Ce(n,r.path,`.codex-plugin/plugin.json`),t[3]=n,t[4]=r.path,t[5]=h):h=t[5];let g=a(h),{displayName:v,description:y,publisher:x,iconPath:C}=Ye(Ze(p),Ze(g)),w=Ze(a(Ce(n,r.path,C??null))),T=C&&w?.trimStart().startsWith(`<`)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(w)}`:null,E=ne(n),D;t[6]===T?D=t[7]:(D=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`flex size-10 shrink-0 items-center justify-center rounded-xl border border-border/60 bg-muted`,children:T?(0,$.jsx)(`img`,{src:T,alt:``,className:`size-6 object-contain`}):(0,$.jsx)(c,{className:`size-5 text-muted-foreground`})}),t[6]=T,t[7]=D);let O=v??r.name,k;t[8]===O?k=t[9]:(k=(0,$.jsx)(`span`,{className:`break-words text-sm font-medium`,children:O}),t[8]=O,t[9]=k);let A;t[10]===x?A=t[11]:(A=x?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:x}):null,t[10]=x,t[11]=A);let j;t[12]!==k||t[13]!==A?(j=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[k,A]}),t[12]=k,t[13]=A,t[14]=j):j=t[14];let M=y??`Local plugin`,N;t[15]===M?N=t[16]:(N=(0,$.jsx)(`p`,{className:`break-words text-xs text-muted-foreground`,children:M}),t[15]=M,t[16]=N);let P;t[17]!==j||t[18]!==N?(P=(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-1`,children:[j,N]}),t[17]=j,t[18]=N,t[19]=P):P=t[19];let F=`More for ${r.name}`,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(l,{"aria-hidden":!0}),t[20]=I):I=t[20];let L;t[21]===F?L=t[22]:(L=(0,$.jsx)(ie,{render:(0,$.jsx)(m,{render:(0,$.jsx)(_,{variant:`ghost`,size:`icon-sm`,"aria-label":F,children:I})})}),t[21]=F,t[22]=L);let R;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(ae,{children:`Plugin actions`}),t[23]=R):R=t[23];let z;t[24]===L?z=t[25]:(z=(0,$.jsxs)(oe,{children:[L,R]}),t[24]=L,t[25]=z);let B;t[26]!==n||t[27]!==E||t[28]!==r.path?(B=E.capabilities.canOpenDefault?(0,$.jsx)(S,{onClick:()=>void E.activate(`open`,{environmentId:n,filePath:r.path,workspaceRoot:void 0}),children:`Open`}):null,t[26]=n,t[27]=E,t[28]=r.path,t[29]=B):B=t[29];let V;t[30]===s?V=t[31]:(V=(0,$.jsx)(S,{onClick:s,children:`Details`}),t[30]=s,t[31]=V);let H;t[32]!==B||t[33]!==V?(H=(0,$.jsxs)(b,{align:`end`,children:[B,V]}),t[32]=B,t[33]=V,t[34]=H):H=t[34];let U;t[35]!==z||t[36]!==H?(U=(0,$.jsxs)(f,{children:[z,H]}),t[35]=z,t[36]=H,t[37]=U):U=t[37];let W=`Load ${r.name}`,G;t[38]!==o||t[39]!==i||t[40]!==u||t[41]!==W?(G=(0,$.jsx)(Le,{"aria-label":W,checked:i,disabled:o,onCheckedChange:u}),t[38]=o,t[39]=i,t[40]=u,t[41]=W,t[42]=G):G=t[42];let K;return t[43]!==P||t[44]!==U||t[45]!==G||t[46]!==D?(K=(0,$.jsxs)(`li`,{className:`flex items-center gap-4 py-4`,children:[D,P,U,G]}),t[43]=P,t[44]=U,t[45]=G,t[46]=D,t[47]=K):K=t[47],K}var $e=[`Personal`,`Built-in`,`Project`,`Plugins`,`Other`];function et(e){switch(te(e)){case`personal`:return`Personal`;case`system`:return`Built-in`;case`repo`:case`project`:return`Project`;case`app`:return`Plugins`;default:return`Other`}}var tt=[[`codex`,`Codex`],[`claudeAgent`,`Claude`],[`cursor`,`Cursor`],[`grok`,`Grok`],[`antigravity`,`Antigravity`],[`opencode`,`OpenCode`],[`muse`,`Muse`],[`pi`,`Pi`]],nt={remote:`Remote servers aren't supported by this provider`,"working-directory":`Servers with a working directory aren't supported here`,provider:`Not supported by this provider yet`};function rt(e){return tt.find(([t])=>t===e)?.[1]??e}function it(e){switch(e){case`signed-in`:return`Signed in`;case`signed-out`:return`Not signed in`;case`unavailable`:return`Add this server to the provider's own MCP config to sign in.`;case`unknown`:return`Sign-in status unknown`}}function at(e,t){if(!O(e))return`unavailable`;let n=t.filter(t=>t.driver===e);if(n.some(e=>e.status===`signed-in`))return`signed-in`;if(n.some(e=>e.status===`signed-out`))return`needs-sign-in`}function ot(e){return tt.map(([t,n])=>{let r=j(t,e.transport),i=F.make(t);return{driver:i,label:n,enabled:r.supported&&!e.disabledProviders.includes(i),...r.supported?{}:{unsupported:nt[r.reason]}}})}var st={name:``,type:`stdio`,command:``,args:``,cwd:``,url:``,auth:`none`,values:[]};function ct(e){let t=e.transport;return t.type===`stdio`?{...st,name:e.name,type:`stdio`,command:t.command,args:t.args.join(`
|
|
2
|
-
`),cwd:t.cwd??``,values:Object.entries(t.env).map(([e,t])=>({key:e,value:t}))}:{...st,name:e.name,type:`http`,url:t.url,auth:t.auth,values:Object.entries(t.headers).map(([e,t])=>({key:e,value:t}))}}var lt=/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;function ut(e,t){let n=e.name.trim();if(!n)return`Enter a name.`;if(!lt.test(n)||n.length>64)return`Use letters, numbers, dashes, and underscores.`;if(n===`p4-code`)return`That name belongs to P4 Code's own server.`;if(t.has(n))return`Another server already uses that name.`;if(e.type===`stdio`&&!e.command.trim())return`Enter the command that starts it.`;if(e.type===`http`&&!/^https?:\/\/\S+$/i.test(e.url.trim()))return`Enter an http or https URL.`}function dt(e,t){let n=Object.fromEntries(e.values.map(e=>[e.key.trim(),e.value]).filter(([e])=>e.length>0)),r=e.type===`stdio`?{type:`stdio`,command:e.command.trim(),args:e.args.split(`
|
|
3
|
-
`).map(e=>e.trim()).filter(e=>e.length>0),env:n,...e.cwd.trim()?{cwd:e.cwd.trim()}:{}}:{type:`http`,url:e.url.trim(),headers:n,auth:e.auth};return{name:e.name.trim(),enabled:t?.enabled??!0,transport:r,disabledProviders:t?.disabledProviders??[],...t?.source===void 0?{}:{source:t.source}}}function ft(e){let t=new Map;for(let n of e){let e=n.displayName??n.driver;for(let r of n.skills){let n=`${r.scope??``}\u0000${r.name}`,i=t.get(n);i===void 0?t.set(n,{skill:r,providers:[e]}):i.providers.includes(e)||i.providers.push(e)}}return[...t.values()].toSorted((e,t)=>pt(e.skill).localeCompare(pt(t.skill)))}var pt=e=>e.displayName??e.name.split(/[-_\s]+/).filter(e=>e.length>0).map(e=>e[0].toUpperCase()+e.slice(1)).join(` `);function mt(e){switch(e){case void 0:return;case`user`:return`Personal`;case`project`:case`repo`:return`Project`;case`system`:return`Built-in`;default:return e[0].toUpperCase()+e.slice(1)}}function ht(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/.exec(e);return(t===null?e:e.slice(t[0].length)).trimStart()}function gt(e){let t=(0,Z.c)(14),{title:n,onBack:r,onUninstall:i,children:a}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(p,{"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===r?c=t[2]:(c=(0,$.jsxs)(_,{size:`xs`,variant:`ghost`,className:`w-fit`,onClick:r,children:[s,`Back`]}),t[1]=r,t[2]=c);let l;t[3]===n?l=t[4]:(l=(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-xl font-semibold text-foreground`,children:n}),t[3]=n,t[4]=l);let u;t[5]===i?u=t[6]:(u=i?(0,$.jsxs)(_,{size:`sm`,variant:`destructive-outline`,onClick:i,children:[(0,$.jsx)(o,{"aria-hidden":!0}),`Uninstall`]}):null,t[5]=i,t[6]=u);let d;t[7]!==l||t[8]!==u?(d=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[l,u]}),t[7]=l,t[8]=u,t[9]=d):d=t[9];let f;return t[10]!==a||t[11]!==c||t[12]!==d?(f=(0,$.jsxs)(`div`,{className:`grid gap-6`,children:[c,d,a]}),t[10]=a,t[11]=c,t[12]=d,t[13]=f):f=t[13],f}function _t(e){let t=(0,Z.c)(6),{label:n,htmlFor:r,children:i}=e,a;t[0]!==r||t[1]!==n?(a=(0,$.jsx)(X,{htmlFor:r,children:n}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,$.jsxs)(`div`,{className:`grid gap-2 px-4 py-4`,children:[a,i]}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function vt(e){let t=(0,Z.c)(69),{server:n,takenNames:r,onSave:i}=e,a;t[0]===n?a=t[1]:(a=n===void 0?st:ct(n),t[0]=n,t[1]=a);let s=a,[c,l]=(0,Q.useState)(s),u;t[2]===s?u=t[3]:(u=JSON.stringify(s),t[2]=s,t[3]=u);let f=u,[p,m]=(0,Q.useState)(f);f!==p&&(m(f),l(s));let h;t[4]!==c||t[5]!==r?(h=ut(c,r),t[4]=c,t[5]=r,t[6]=h):h=t[6];let g=h,v;t[7]===c?v=t[8]:(v=JSON.stringify(c),t[7]=c,t[8]=v);let y=v!==f,b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>l(t=>({...t,...e})),t[9]=b):b=t[9];let x=b,S=c.type===`stdio`?`Environment variables`:`Headers`,C;t[10]===c.values?C=t[11]:(C=(e,t)=>x({values:c.values.map((n,r)=>r===e?{...n,...t}:n)}),t[10]=c.values,t[11]=C);let w=C,T;t[12]!==y||t[13]!==c||t[14]!==i||t[15]!==g||t[16]!==n?(T=e=>{e.preventDefault(),y&&g===void 0&&i(dt(c,n))},t[12]=y,t[13]=c,t[14]=i,t[15]=g,t[16]=n,t[17]=T):T=t[17];let E;t[18]===n?E=t[19]:(E=n===void 0?null:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`To switch between a command and a URL, uninstall the server and add it again.`}),t[18]=n,t[19]=E);let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>x({name:e.target.value}),t[20]=D):D=t[20];let O;t[21]===c.name?O=t[22]:(O=(0,$.jsx)(_t,{label:`Name`,htmlFor:`mcp-server-name`,children:(0,$.jsx)(de,{id:`mcp-server-name`,placeholder:`github`,value:c.name,onChange:D})}),t[21]=c.name,t[22]=O);let k;t[23]!==c.type||t[24]!==n?(k=n===void 0?(0,$.jsx)(_t,{label:`Type`,children:(0,$.jsxs)(le,{"aria-label":`How P4 Code reaches the server`,value:[c.type],onValueChange:e=>{let t=e[0];(t===`stdio`||t===`http`)&&x({type:t,values:[]})},children:[(0,$.jsx)(ue,{value:`stdio`,children:`Command`}),(0,$.jsx)(ue,{value:`http`,children:`URL`})]})}):null,t[23]=c.type,t[24]=n,t[25]=k):k=t[25];let A;t[26]!==c.args||t[27]!==c.auth||t[28]!==c.command||t[29]!==c.cwd||t[30]!==c.type||t[31]!==c.url?(A=c.type===`stdio`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_t,{label:`Command`,htmlFor:`mcp-server-command`,children:(0,$.jsx)(de,{id:`mcp-server-command`,placeholder:`npx`,value:c.command,onChange:e=>x({command:e.target.value})})}),(0,$.jsx)(_t,{label:`Arguments, one per line`,htmlFor:`mcp-server-args`,children:(0,$.jsx)(ce,{id:`mcp-server-args`,placeholder:`-y
|
|
4
|
-
@modelcontextprotocol/server-postgres`,value:c.args,onChange:e=>x({args:e.target.value})})}),(0,$.jsx)(_t,{label:`Working directory (optional)`,htmlFor:`mcp-server-cwd`,children:(0,$.jsx)(de,{id:`mcp-server-cwd`,placeholder:`The session's project folder`,value:c.cwd,onChange:e=>x({cwd:e.target.value})})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_t,{label:`URL`,htmlFor:`mcp-server-url`,children:(0,$.jsx)(de,{id:`mcp-server-url`,placeholder:`https://mcp.example.com/mcp`,value:c.url,onChange:e=>x({url:e.target.value})})}),(0,$.jsx)(_t,{label:`Authentication`,children:(0,$.jsxs)(H,{value:c.auth,onValueChange:e=>{(e===`none`||e===`oauth`)&&x({auth:e})},children:[(0,$.jsx)(V,{"aria-label":`Authentication`,children:(0,$.jsx)(z,{children:yt})}),(0,$.jsxs)(B,{alignItemWithTrigger:!1,children:[(0,$.jsx)(R,{value:`none`,children:`None or headers`}),(0,$.jsx)(R,{value:`oauth`,children:`OAuth (sign in after saving)`})]})]})})]}),t[26]=c.args,t[27]=c.auth,t[28]=c.command,t[29]=c.cwd,t[30]=c.type,t[31]=c.url,t[32]=A):A=t[32];let j;t[33]!==c.type||t[34]!==c.values||t[35]!==w||t[36]!==S?(j=c.values.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(de,{"aria-label":`${S} name`,placeholder:c.type===`stdio`?`API_TOKEN`:`Authorization`,value:e.key,onChange:e=>w(t,{key:e.target.value})}),(0,$.jsx)(Ve,{"aria-label":`${S} value`,placeholder:`Value`,value:e.value,onChange:e=>w(t,{value:e.target.value})}),(0,$.jsx)(_,{size:`icon-sm`,variant:`ghost`,"aria-label":`Remove ${e.key||`row`}`,onClick:()=>x({values:c.values.filter((e,n)=>n!==t)}),children:(0,$.jsx)(o,{"aria-hidden":!0})})]},t)),t[33]=c.type,t[34]=c.values,t[35]=w,t[36]=S,t[37]=j):j=t[37];let M;t[38]===c.values?M=t[39]:(M=()=>x({values:[...c.values,{key:``,value:``}]}),t[38]=c.values,t[39]=M);let N;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(d,{"aria-hidden":!0}),t[40]=N):N=t[40];let P=c.type===`stdio`?`variable`:`header`,F;t[41]!==M||t[42]!==P?(F=(0,$.jsxs)(_,{variant:`soft`,onClick:M,children:[N,`Add `,P]}),t[41]=M,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==j||t[45]!==F?(I=(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[j,F]}),t[44]=j,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==I||t[48]!==S?(L=(0,$.jsx)(_t,{label:S,children:I}),t[47]=I,t[48]=S,t[49]=L):L=t[49];let U;t[50]!==O||t[51]!==k||t[52]!==A||t[53]!==L?(U=(0,$.jsxs)(Me,{children:[O,k,A,L]}),t[50]=O,t[51]=k,t[52]=A,t[53]=L,t[54]=U):U=t[54];let W;t[55]!==y||t[56]!==g?(W=y&&g!==void 0?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-foreground`,children:g}):null,t[55]=y,t[56]=g,t[57]=W):W=t[57];let G=!y||g!==void 0,K=n===void 0?`Add server`:`Save`,q;t[58]!==G||t[59]!==K?(q=(0,$.jsx)(_,{type:`submit`,disabled:G,children:K}),t[58]=G,t[59]=K,t[60]=q):q=t[60];let ee;t[61]!==W||t[62]!==q?(ee=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[W,q]}),t[61]=W,t[62]=q,t[63]=ee):ee=t[63];let J;return t[64]!==U||t[65]!==ee||t[66]!==T||t[67]!==E?(J=(0,$.jsxs)(`form`,{className:`grid gap-3`,onSubmit:T,children:[E,U,ee]}),t[64]=U,t[65]=ee,t[66]=T,t[67]=E,t[68]=J):J=t[68],J}function yt(e){return e===`oauth`?`OAuth (sign in after saving)`:`None or headers`}function bt(e){let t=(0,Z.c)(55),{environmentId:n,plugin:r,environmentLabel:i,onSave:o}=e,s=r?.path??``,c=r===void 0?null:`.claude-plugin/plugin.json`,l;t[0]!==n||t[1]!==s||t[2]!==c?(l=Ce(n,s,c),t[0]=n,t[1]=s,t[2]=c,t[3]=l):l=t[3];let u=P(C(a(l))),d=Xe(r!==void 0&&u!==null&&!u.truncated?u.contents:null),f;t[4]===r?.options?f=t[5]:(f=r?.options??{},t[4]=r?.options,t[5]=f);let p=f,m=[...d,...Object.keys(p).filter(e=>!d.some(t=>t.key===e)).map(St)],[h,g]=(0,Q.useState)(r?.name??``),[v,y]=(0,Q.useState)(r?.path??``),[b,x]=(0,Q.useState)(p),S;t[6]!==r?.name||t[7]!==r?.path||t[8]!==p?(S=JSON.stringify([r?.name??``,r?.path??``,p]),t[6]=r?.name,t[7]=r?.path,t[8]=p,t[9]=S):S=t[9];let w=S,[T,E]=(0,Q.useState)(w);w!==T&&(E(w),g(r?.name??``),y(r?.path??``),x(p));let D,O;t[10]!==h||t[11]!==b||t[12]!==v||t[13]!==r?.name||t[14]!==r?.path||t[15]!==p?(D=Object.fromEntries(Object.entries(b).filter(xt)),O=h!==(r?.name??``)||v!==(r?.path??``)||JSON.stringify(D)!==JSON.stringify(p),t[10]=h,t[11]=b,t[12]=v,t[13]=r?.name,t[14]=r?.path,t[15]=p,t[16]=D,t[17]=O):(D=t[16],O=t[17]);let k=O,A;t[18]!==h||t[19]!==v?(A=h.trim().length>0&&v.trim().startsWith(`/`),t[18]=h,t[19]=v,t[20]=A):A=t[20];let j=A,M;t[21]!==k||t[22]!==h||t[23]!==D||t[24]!==o||t[25]!==v||t[26]!==r?.enabled||t[27]!==j?(M=e=>{e.preventDefault(),k&&j&&o({name:h.trim(),path:v.trim(),enabled:r?.enabled??!0,options:D})},t[21]=k,t[22]=h,t[23]=D,t[24]=o,t[25]=v,t[26]=r?.enabled,t[27]=j,t[28]=M):M=t[28];let N;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>g(e.target.value),t[29]=N):N=t[29];let F;t[30]===h?F=t[31]:(F=(0,$.jsx)(_t,{label:`Name`,htmlFor:`plugin-name`,children:(0,$.jsx)(de,{id:`plugin-name`,value:h,onChange:N})}),t[30]=h,t[31]=F);let I=`Folder on ${i}`,L;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>y(e.target.value),t[32]=L):L=t[32];let R;t[33]===v?R=t[34]:(R=(0,$.jsx)(de,{id:`plugin-path`,placeholder:`/Users/me/plugins/my-plugin`,value:v,onChange:L}),t[33]=v,t[34]=R);let z;t[35]!==I||t[36]!==R?(z=(0,$.jsx)(_t,{label:I,htmlFor:`plugin-path`,children:R}),t[35]=I,t[36]=R,t[37]=z):z=t[37];let B=m.map(e=>(0,$.jsx)(_t,{label:e.required?e.title:`${e.title} (optional)`,htmlFor:`plugin-option-${e.key}`,children:(0,$.jsx)(Ve,{id:`plugin-option-${e.key}`,placeholder:`description`in e?e.description:void 0,value:b[e.key]??``,onChange:t=>x(n=>({...n,[e.key]:t.target.value}))})},e.key)),V;t[38]!==F||t[39]!==z||t[40]!==B?(V=(0,$.jsxs)(Me,{children:[F,z,B]}),t[38]=F,t[39]=z,t[40]=B,t[41]=V):V=t[41];let H;t[42]!==k||t[43]!==j?(H=k&&!j?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-foreground`,children:`Enter a name and the plugin folder's full path.`}):null,t[42]=k,t[43]=j,t[44]=H):H=t[44];let U=!k||!j,W=r===void 0?`Add plugin`:`Save`,G;t[45]!==U||t[46]!==W?(G=(0,$.jsx)(_,{type:`submit`,disabled:U,children:W}),t[45]=U,t[46]=W,t[47]=G):G=t[47];let K;t[48]!==H||t[49]!==G?(K=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[H,G]}),t[48]=H,t[49]=G,t[50]=K):K=t[50];let q;return t[51]!==V||t[52]!==K||t[53]!==M?(q=(0,$.jsxs)(`form`,{className:`grid gap-3`,onSubmit:M,children:[V,K]}),t[51]=V,t[52]=K,t[53]=M,t[54]=q):q=t[54],q}function xt(e){let[,t]=e;return t}function St(e){return{key:e,title:e,required:!1}}var Ct=e=>e.replace(/[\\/][^\\/]*$/,``)||`/`;function wt(e){let t=(0,Z.c)(69),{entry:n,environmentId:r,onClose:i}=e,{skill:o,providers:s}=n,c,u,d;t[0]!==r||t[1]!==o.path?(c=Ct(o.path),u=a,d=Ce(r,c,o.path),t[0]=r,t[1]=o.path,t[2]=c,t[3]=u,t[4]=d):(c=t[2],u=t[3],d=t[4]);let p=u(d),h;t[5]===p?h=t[6]:(h=P(C(p)),t[5]=p,t[6]=h);let g=h,v=ne(r),{copyToClipboard:y}=G(),x;t[7]!==r||t[8]!==o.path?(x={environmentId:r,filePath:o.path,workspaceRoot:void 0},t[7]=r,t[8]=o.path,t[9]=x):x=t[9];let T=x,E=o.shortDescription??o.description,D;t[10]===o.scope?D=t[11]:(D=mt(o.scope),t[10]=o.scope,t[11]=D);let O=D,k;t[12]===i?k=t[13]:(k=e=>!e&&i(),t[12]=i,t[13]=k);let A;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`flex size-12 shrink-0 items-center justify-center rounded-full border border-border/60 text-muted-foreground`,children:(0,$.jsx)(w,{className:`size-5`})}),t[14]=A):A=t[14];let j;t[15]===o?j=t[16]:(j=pt(o),t[15]=o,t[16]=j);let M=`More for ${j}`,N;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(l,{"aria-hidden":!0}),t[17]=N):N=t[17];let F;t[18]===M?F=t[19]:(F=(0,$.jsx)(m,{render:(0,$.jsx)(_,{size:`icon-sm`,variant:`ghost`,"aria-label":M,children:N})}),t[18]=M,t[19]=F);let I;t[20]!==v||t[21]!==T?(I=v.capabilities.canOpenDefault?(0,$.jsx)(S,{onClick:()=>void v.activate(`open`,T),children:`Open`}):null,t[20]=v,t[21]=T,t[22]=I):I=t[22];let R;t[23]!==v||t[24]!==T?(R=v.capabilities.revealLabel?(0,$.jsx)(S,{onClick:()=>void v.activate(`reveal-in-folder`,T),children:v.capabilities.revealLabel}):null,t[23]=v,t[24]=T,t[25]=R):R=t[25];let z=g===null,B;t[26]!==y||t[27]!==g?(B=()=>g&&y(g.contents,void 0),t[26]=y,t[27]=g,t[28]=B):B=t[28];let V;t[29]!==z||t[30]!==B?(V=(0,$.jsx)(S,{disabled:z,onClick:B,children:`Copy Markdown`}),t[29]=z,t[30]=B,t[31]=V):V=t[31];let H;t[32]!==I||t[33]!==R||t[34]!==V?(H=(0,$.jsxs)(b,{align:`end`,children:[I,R,V]}),t[32]=I,t[33]=R,t[34]=V,t[35]=H):H=t[35];let U;t[36]!==F||t[37]!==H?(U=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 pe-8`,children:[A,(0,$.jsxs)(f,{children:[F,H]})]}),t[36]=F,t[37]=H,t[38]=U):U=t[38];let W;t[39]===o?W=t[40]:(W=pt(o),t[39]=o,t[40]=W);let K;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`Skill`}),t[41]=K):K=t[41];let q;t[42]===W?q=t[43]:(q=(0,$.jsxs)(fe,{children:[W,` `,K]}),t[42]=W,t[43]=q);let ee;t[44]===E?ee=t[45]:(ee=E?(0,$.jsx)(pe,{children:E}):null,t[44]=E,t[45]=ee);let J;t[46]!==q||t[47]!==ee?(J=(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[q,ee]}),t[46]=q,t[47]=ee,t[48]=J):J=t[48];let te;t[49]!==c||t[50]!==r||t[51]!==g||t[52]!==p?(te=(0,$.jsx)(`div`,{className:`max-h-[50vh] min-h-24 overflow-y-auto rounded-xl border border-border/60 bg-card/40 px-5 py-4`,children:g===null?p._tag===`Failure`?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This skill's file could not be read. It may have moved since the provider last scanned it.`}):(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(se,{className:`h-4 w-3/4`}),(0,$.jsx)(se,{className:`h-4 w-full`}),(0,$.jsx)(se,{className:`h-4 w-2/3`})]}):(0,$.jsx)(L,{text:ht(g.contents),cwd:c,environmentId:r})}),t[49]=c,t[50]=r,t[51]=g,t[52]=p,t[53]=te):te=t[53];let re;t[54]===s?re=t[55]:(re=s.join(`, `),t[54]=s,t[55]=re);let ie=`Loaded by ${re}`,ae;t[56]!==O||t[57]!==ie?(ae=[O,ie].filter(Boolean),t[56]=O,t[57]=ie,t[58]=ae):ae=t[58];let oe=ae.join(` · `),ce;t[59]===oe?ce=t[60]:(ce=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:oe}),t[59]=oe,t[60]=ce);let le;t[61]!==U||t[62]!==J||t[63]!==te||t[64]!==ce?(le=(0,$.jsx)(me,{className:`max-w-2xl`,children:(0,$.jsxs)(`div`,{className:`grid min-h-0 gap-4 p-6`,children:[U,J,te,ce]})}),t[61]=U,t[62]=J,t[63]=te,t[64]=ce,t[65]=le):le=t[65];let ue;return t[66]!==le||t[67]!==k?(ue=(0,$.jsx)(he,{open:!0,onOpenChange:k,children:le}),t[66]=le,t[67]=k,t[68]=ue):ue=t[68],ue}var Tt={"edited-both-sides":`Changed here and on another machine since the last sync.`,"unmanaged-local-collision":`This machine has its own copy with the same name.`,"deleted-remotely-edited-locally":`Deleted on another machine, changed here.`,"mass-removal-held":`Most synced items vanished from the hub at once, so nothing was removed here.`,"hub-behind-manifest":`The hub has an older copy than this machine last synced.`,"not-writable-here":`This machine cannot hold this item.`,"write-failed":`Could not be written here. The next sync tries again.`,"has-credentials":`Has environment values, headers, or a key in its URL or arguments, which stay on this machine.`,"duplicate-name":`More than one MCP server here has this name.`};function Et(e){return Tt[e]??e}var Dt={skill:`Skill`,agent:`Subagent`,memory:`Memory`,mcp:`MCP server`,settings:`Settings`};function Ot(e){return`${Dt[e.kind]} ${e.name}`}function kt(e){if(e.running)return`Syncing…`;let t=e.lastRun;if(t===null)return`Not synced since the server started.`;let n=re(t.finishedAt);if(t.outcome===`unavailable`)return`Couldn't reach the hub at ${n}.`;let r=[t.received>0?`${t.received} received`:null,t.published>0?`${t.published} shared`:null,t.removed>0?`${t.removed} removed`:null].filter(e=>e!==null);return`Synced ${n}${r.length>0?` · ${r.join(` · `)}`:` · no changes`}.`}function At(){let e=(0,Z.c)(4),{scope:t,environment:n}=Ne(),r=t.environmentIds.length===1?n?.environmentId??null:null,i=n?.connection.phase===`connected`&&n.serverConfig!==null,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Ie(`hub-sync`),e[0]=a):a=e[0];let o;return e[1]!==i||e[2]!==r?(o=(0,$.jsx)(Fe,{...a,children:r&&i?(0,$.jsx)(Mt,{environmentId:r}):(0,$.jsx)(Y,{title:`Hub`,description:`Pick a single connected environment to sync its skills, subagents and memory.`})}),e[1]=i,e[2]=r,e[3]=o):o=e[3],o}function jt(e,t){let n=Re(e,t);return n.ok?null:n.message}function Mt(e){let t=(0,Z.c)(95),{environmentId:n}=e,r;t[0]===n?r=t[1]:(r=q.hubSyncLive({environmentId:n,input:void 0}),t[0]=n,t[1]=r);let i=ee(r),o;t[2]===n?o=t[3]:(o=q.connectHubSync.permissionAtom(n),t[2]=n,t[3]=o);let s=a(o),c;t[4]===n?c=t[5]:(c=q.runHubSyncNow.permissionAtom(n),t[4]=n,t[5]=c);let l=a(c),u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u={reportFailure:!1},t[6]=u):u=t[6];let d=u,f=J(q.disconnectHubSync,d),p=J(q.setHubSyncMode,d),m=J(q.runHubSyncNow,d),[h,g]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(null),b=i.data;if(!b){let e=i.error?`Couldn't load hub sync.`:`Loading…`,n;return t[7]===e?n=t[8]:(n=(0,$.jsx)(Y,{title:`Hub`,status:e}),t[7]=e,t[8]=n),n}let x=b.source!==`none`,S=b.source===`environment`,C;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(C=async e=>{g(!0),y(await e()),g(!1)},t[9]=C):C=t[9];let w=C,T,E,D,O,k,A,j,M,N,P;if(t[10]!==s||t[11]!==l||t[12]!==f||t[13]!==n||t[14]!==v||t[15]!==S||t[16]!==x||t[17]!==h||t[18]!==m||t[19]!==p||t[20]!==b){let e=b.lastRun?.conflicts??[],r=b.lastRun?.refused??[],i=!x,a=!s||x,o;t[31]!==n||t[32]!==a?(o=(0,$.jsx)(Pt,{environmentId:n,disabled:a}),t[31]=n,t[32]=a,t[33]=o):o=t[33],t[34]!==i||t[35]!==o?(k=(0,$.jsx)(Be,{open:i,children:o}),t[34]=i,t[35]=o,t[36]=k):k=t[36],E=Be,N=x;let c=S?` · set by P4CODE_HUB_URL on the server`:null,u;t[37]===v?u=t[38]:(u=(0,$.jsx)(ze,{text:v}),t[37]=v,t[38]=u);let d;t[39]!==b.baseUrl||t[40]!==c||t[41]!==u?(d=(0,$.jsxs)($.Fragment,{children:[b.baseUrl,c,u]}),t[39]=b.baseUrl,t[40]=c,t[41]=u,t[42]=d):d=t[42];let g;t[43]!==s||t[44]!==f||t[45]!==n||t[46]!==S||t[47]!==x||t[48]!==h?(g=S?null:(0,$.jsx)(_,{size:`sm`,variant:`outline`,disabled:!s||h||!x,onClick:()=>void w(async()=>jt(await f({environmentId:n,input:void 0}),`Couldn't disconnect.`)),children:`Disconnect`}),t[43]=s,t[44]=f,t[45]=n,t[46]=S,t[47]=x,t[48]=h,t[49]=g):g=t[49],t[50]!==d||t[51]!==g?(P=(0,$.jsx)(Y,{title:`Hub`,status:d,control:g}),t[50]=d,t[51]=g,t[52]=P):P=t[52];let y=`When the server starts and every ${b.intervalMinutes} minutes.`,C=b.syncMode===`auto`,F=!s||h||!x,I;t[53]!==n||t[54]!==p?(I=e=>void w(async()=>jt(await p({environmentId:n,input:{syncMode:e?`auto`:`paused`}}),`Couldn't change automatic sync.`)),t[53]=n,t[54]=p,t[55]=I):I=t[55];let L;t[56]!==C||t[57]!==F||t[58]!==I?(L=(0,$.jsx)(Le,{"aria-label":`Sync automatically`,checked:C,disabled:F,onCheckedChange:I}),t[56]=C,t[57]=F,t[58]=I,t[59]=L):L=t[59],t[60]!==y||t[61]!==L?(D=(0,$.jsx)(Y,{title:`Sync automatically`,description:y,control:L}),t[60]=y,t[61]=L,t[62]=D):D=t[62];let R;t[63]===b?R=t[64]:(R=kt(b),t[63]=b,t[64]=R);let z;t[65]===R?z=t[66]:(z=(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,children:R}),t[65]=R,t[66]=z);let B=!l||h||b.running||!x,V;t[67]!==n||t[68]!==m?(V=()=>void w(async()=>jt(await m({environmentId:n,input:void 0}),`Couldn't start a sync.`)),t[67]=n,t[68]=m,t[69]=V):V=t[69];let H;t[70]===b.running?H=t[71]:(H=b.running?(0,$.jsx)(U,{size:`xs`}):null,t[70]=b.running,t[71]=H);let W;t[72]!==B||t[73]!==V||t[74]!==H?(W=(0,$.jsxs)(_,{size:`sm`,variant:`outline`,disabled:B,onClick:V,children:[H,`Sync now`]}),t[72]=B,t[73]=V,t[74]=H,t[75]=W):W=t[75],t[76]!==z||t[77]!==W?(O=(0,$.jsx)(Y,{title:`Last sync`,status:z,control:W}),t[76]=z,t[77]=W,t[78]=O):O=t[78],T=Ft,A=n,j=[...e,...r],M=new Set(e.map(Nt)),t[10]=s,t[11]=l,t[12]=f,t[13]=n,t[14]=v,t[15]=S,t[16]=x,t[17]=h,t[18]=m,t[19]=p,t[20]=b,t[21]=T,t[22]=E,t[23]=D,t[24]=O,t[25]=k,t[26]=A,t[27]=j,t[28]=M,t[29]=N,t[30]=P}else T=t[21],E=t[22],D=t[23],O=t[24],k=t[25],A=t[26],j=t[27],M=t[28],N=t[29],P=t[30];let F=!l||b.running||!x,I;t[79]!==T||t[80]!==F||t[81]!==A||t[82]!==j||t[83]!==M?(I=(0,$.jsx)(T,{environmentId:A,issues:j,resolvable:M,disabled:F}),t[79]=T,t[80]=F,t[81]=A,t[82]=j,t[83]=M,t[84]=I):I=t[84];let L;t[85]!==E||t[86]!==D||t[87]!==O||t[88]!==I||t[89]!==N||t[90]!==P?(L=(0,$.jsxs)(E,{open:N,children:[P,D,O,I]}),t[85]=E,t[86]=D,t[87]=O,t[88]=I,t[89]=N,t[90]=P,t[91]=L):L=t[91];let R;return t[92]!==k||t[93]!==L?(R=(0,$.jsxs)($.Fragment,{children:[k,L]}),t[92]=k,t[93]=L,t[94]=R):R=t[94],R}var Nt=e=>`${e.kind}/${e.name}`;function Pt(e){let t=(0,Z.c)(34),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={reportFailure:!1},t[0]=u):u=t[0];let d=J(q.connectHubSync,u),f=e.disabled||o,p;t[1]!==n||t[2]!==i?(p=n.trim()!==``&&i.trim()!==``,t[1]=n,t[2]=i,t[3]=p):p=t[3];let m=p,h;t[4]===c?h=t[5]:(h=(0,$.jsx)(ze,{text:c}),t[4]=c,t[5]=h);let g;t[6]!==n||t[7]!==d||t[8]!==f||t[9]!==e.environmentId||t[10]!==m||t[11]!==i?(g=t=>{t.preventDefault(),m&&!f&&(s(!0),d({environmentId:e.environmentId,input:{baseUrl:n.trim(),token:i.trim()}}).then(e=>{let t=jt(e,`Couldn't link the hub.`);l(t),t===null&&a(``),s(!1)}))},t[6]=n,t[7]=d,t[8]=f,t[9]=e.environmentId,t[10]=m,t[11]=i,t[12]=g):g=t[12];let v;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>r(e.target.value),t[13]=v):v=t[13];let y;t[14]!==n||t[15]!==f?(y=(0,$.jsx)(`div`,{className:`min-w-48 flex-1`,children:(0,$.jsx)(de,{"aria-label":`Hub URL`,autoComplete:`off`,value:n,disabled:f,placeholder:`https://hub.example.ts.net`,onChange:v})}),t[14]=n,t[15]=f,t[16]=y):y=t[16];let b;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(b=e=>a(e.target.value),t[17]=b):b=t[17];let x;t[18]!==f||t[19]!==i?(x=(0,$.jsx)(`div`,{className:`min-w-40 flex-1`,children:(0,$.jsx)(de,{"aria-label":`Hub token`,type:`password`,autoComplete:`off`,value:i,disabled:f,placeholder:`Token`,onChange:b})}),t[18]=f,t[19]=i,t[20]=x):x=t[20];let S=f||!m,C;t[21]===o?C=t[22]:(C=o?(0,$.jsx)(U,{size:`xs`}):null,t[21]=o,t[22]=C);let w;t[23]!==S||t[24]!==C?(w=(0,$.jsxs)(_,{type:`submit`,size:`sm`,disabled:S,children:[C,`Connect`]}),t[23]=S,t[24]=C,t[25]=w):w=t[25];let T;t[26]!==w||t[27]!==g||t[28]!==y||t[29]!==x?(T=(0,$.jsxs)(`form`,{className:`flex max-w-xl flex-wrap items-center gap-2 pb-2`,onSubmit:g,children:[y,x,w]}),t[26]=w,t[27]=g,t[28]=y,t[29]=x,t[30]=T):T=t[30];let E;return t[31]!==T||t[32]!==h?(E=(0,$.jsx)(Y,{title:`Hub`,description:`Keep skills, subagents and memory the same on every machine linked to one hub. Mint a token on the hub host with p4c hub token add.`,status:h,children:T}),t[31]=T,t[32]=h,t[33]=E):E=t[33],E}function Ft(e){let t=(0,Z.c)(13),n;t[0]===e.issues?n=t[1]:(n=new Map(e.issues.map(It)),t[0]=e.issues,t[1]=n);let r=n,[i,a]=(0,Q.useState)(e.issues),o;if(t[2]!==e.issues||t[3]!==i){let n;t[5]===i?n=t[6]:(n=e=>!i.some(t=>Nt(t)===Nt(e)),t[5]=i,t[6]=n),o=[...i,...e.issues.filter(n)],t[2]=e.issues,t[3]=i,t[4]=o}else o=t[4];let s=o;s.length!==i.length&&a(s);let c;return t[7]!==r||t[8]!==s||t[9]!==e.disabled||t[10]!==e.environmentId||t[11]!==e.resolvable?(c=(0,$.jsx)($.Fragment,{children:s.map(t=>{let n=Nt(t),i=r.get(n);return(0,$.jsx)(`div`,{onTransitionEnd:e=>{e.target!==e.currentTarget.firstChild||i||a(e=>e.filter(e=>Nt(e)!==n))},children:(0,$.jsx)(Be,{open:i!==void 0,children:(0,$.jsx)(Lt,{environmentId:e.environmentId,issue:i??t,resolutions:e.resolvable.has(n)?I(t.reason):[],disabled:e.disabled||i===void 0})})},n)})}),t[7]=r,t[8]=s,t[9]=e.disabled,t[10]=e.environmentId,t[11]=e.resolvable,t[12]=c):c=t[12],c}function It(e){return[Nt(e),e]}function Lt(e){let t=(0,Z.c)(24),{issue:n}=e,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[0]=l):l=t[0];let u=J(q.resolveHubSyncConflict,l),d;t[1]===n?d=t[2]:(d=Ot(n),t[1]=n,t[2]=d);let f=d,p;t[3]!==n.kind||t[4]!==n.name||t[5]!==e.environmentId||t[6]!==u?(p=async t=>{i(!0),o(jt(await u({environmentId:e.environmentId,input:{kind:n.kind,name:n.name,resolution:t}}),`Couldn't apply that choice.`)),i(!1),c(!1)},t[3]=n.kind,t[4]=n.name,t[5]=e.environmentId,t[6]=u,t[7]=p):p=t[7];let m=p,h=e.disabled||r,g;t[8]===n.reason?g=t[9]:(g=Et(n.reason),t[8]=n.reason,t[9]=g);let v;t[10]===a?v=t[11]:(v=(0,$.jsx)(ze,{text:a}),t[10]=a,t[11]=v);let y;t[12]!==s||t[13]!==h||t[14]!==r||t[15]!==e.resolutions||t[16]!==m||t[17]!==f?(y=e.resolutions.length===0?null:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[e.resolutions.includes(`keep-local`)?(0,$.jsx)(_,{size:`sm`,variant:`outline`,disabled:h,onClick:()=>void m(`keep-local`),children:`Keep this machine's`}):null,e.resolutions.includes(`use-hub`)?(0,$.jsxs)(Ae,{open:s,onOpenChange:e=>{r||c(e)},children:[(0,$.jsx)(_,{size:`sm`,variant:`outline`,disabled:h,onClick:()=>c(!0),children:`Use hub's`}),(0,$.jsxs)(De,{children:[(0,$.jsxs)(we,{children:[(0,$.jsxs)(ke,{children:[`Replace this machine's `,f,`?`]}),(0,$.jsx)(Oe,{children:`The hub's copy overwrites the one here. Changes made only on this machine are lost.`})]}),(0,$.jsxs)(Te,{children:[(0,$.jsx)(Ee,{disabled:r,render:(0,$.jsx)(_,{variant:`outline`,disabled:r}),children:`Cancel`}),(0,$.jsxs)(_,{variant:`destructive`,disabled:r,onClick:()=>void m(`use-hub`),children:[r?(0,$.jsx)(U,{size:`sm`}):null,`Replace`]})]})]})]}):null]}),t[12]=s,t[13]=h,t[14]=r,t[15]=e.resolutions,t[16]=m,t[17]=f,t[18]=y):y=t[18];let b;return t[19]!==g||t[20]!==v||t[21]!==y||t[22]!==f?(b=(0,$.jsx)(Y,{title:f,description:g,status:v,control:y}),t[19]=g,t[20]=v,t[21]=y,t[22]=f,t[23]=b):b=t[23],b}var Rt={claude:`Claude`,codex:`Codex`,cursor:`Cursor`},zt={success:`bg-success`,warning:`bg-warning`,error:`bg-destructive`,muted:`bg-muted-foreground/40`},Bt={success:`text-success-foreground`,warning:`text-warning-foreground`,error:`text-destructive-foreground`,muted:`text-muted-foreground`},Vt=T(M);function Ht(e){let t=E(e);return Vt(t)&&t.reason===`rejected`?`This server only lets apps it has approved sign in, and it refused P4 Code. Sign in with a provider below instead.`:`Sign-in could not start. Check the server URL, then try again.`}function Ut(e,t,n){return e.transport.type===`http`&&(e.transport.auth===`oauth`||n?.auth===`signed-in`||t.needsSignIn)}function Wt(e){let t=(0,Z.c)(13),{status:n,className:r}=e,i=Bt[n.tone],a;t[0]!==r||t[1]!==i?(a=x(`flex min-w-0 items-center gap-1.5 text-xs`,i,r),t[0]=r,t[1]=i,t[2]=a):a=t[2];let o=zt[n.tone],s;t[3]===o?s=t[4]:(s=x(`size-1.5 shrink-0 rounded-full`,o),t[3]=o,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{"aria-hidden":!0,className:s}),t[5]=s,t[6]=c);let l;t[7]===n.label?l=t[8]:(l=(0,$.jsx)(`span`,{className:`truncate`,children:n.label}),t[7]=n.label,t[8]=l);let u;return t[9]!==a||t[10]!==c||t[11]!==l?(u=(0,$.jsxs)(`span`,{className:a,children:[c,l]}),t[9]=a,t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function Gt(){let e=(0,Z.c)(11),{environment:t,scope:n}=Ne(),r=t?.connection.phase===`connected`&&t.serverConfig!==null,i=r?t.environmentId:null,a=r&&t.serverConfig?.environment.capabilities.mcpRegistry===!0,o;e[0]!==r||e[1]!==t||e[2]!==i||e[3]!==n||e[4]!==a?(o=t===null||!r?(0,$.jsx)(ye,{children:(0,$.jsxs)(ge,{children:[(0,$.jsx)(_e,{children:`Connect to manage plugins and MCP servers`}),(0,$.jsx)(ve,{children:`They live on each environment. Choose a connected one above.`})]})}):!a||i===null?(0,$.jsx)(ye,{children:(0,$.jsxs)(ge,{children:[(0,$.jsxs)(_e,{children:[`Update `,t.label,` to manage plugins and MCP servers`]}),(0,$.jsx)(ve,{children:`This environment runs a version without them.`})]})}):(0,$.jsx)(Yt,{environmentId:i,environmentLabel:t.label,projectId:n.kind===`checkout`?n.checkout.id:n.kind===`project`?n.members.find(e=>e.environmentId===i)?.id:void 0,projectLabel:n.kind===`project`||n.kind===`checkout`?n.label:void 0},i),e[0]=r,e[1]=t,e[2]=i,e[3]=n,e[4]=a,e[5]=o):o=e[5];let s;e[6]===r?s=e[7]:(s=r?(0,$.jsx)(At,{}):null,e[6]=r,e[7]=s);let c;return e[8]!==o||e[9]!==s?(c=(0,$.jsxs)(Pe,{width:`wide`,children:[o,s]}),e[8]=o,e[9]=s,e[10]=c):c=e[10],c}var Kt={plugins:`Search plugins`,mcps:`Search MCP servers`,skills:`Search skills`},qt=(e,...t)=>e===``||t.some(t=>t.toLowerCase().includes(e));function Jt(e){let t=(0,Z.c)(9),{text:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(!1),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{let t=r.current;a(e&&t!==null&&t.scrollWidth>t.clientWidth)},t[0]=o):o=t[0];let s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`span`,{ref:r,tabIndex:0,className:`block truncate text-xs text-muted-foreground`}),t[1]=s):s=t[1];let c,l;t[2]===n?(c=t[3],l=t[4]):(c=(0,$.jsx)(ie,{render:s,children:n}),l=(0,$.jsx)(ae,{children:n}),t[2]=n,t[3]=c,t[4]=l);let u;return t[5]!==i||t[6]!==c||t[7]!==l?(u=(0,$.jsxs)(oe,{open:i,onOpenChange:o,children:[c,l]}),t[5]=i,t[6]=c,t[7]=l,t[8]=u):u=t[8],u}function Yt({environmentId:e,environmentLabel:t,projectId:n,projectLabel:r}){let o=W({select:e=>e.hash}),[u,d]=(0,Q.useState)(()=>o.replace(/^#/,``)===`mcp-servers`?`mcps`:o.replace(/^#/,``)===`skills`?`skills`:`plugins`),[p,x]=(0,Q.useState)(``),[C,T]=(0,Q.useState)(`All categories`),E=a(q.configValueAtom(e))?.providers,O=(0,Q.useMemo)(()=>ft(E??[]),[E]),[j,M]=(0,Q.useState)(null),P=je(e=>e.mcpServers),F=je(e=>e.plugins),I=je(e=>e.projectSettingsOverrides),L=je(e=>e.skillOverrides),U=ne(e),G=a(q.updateSettings.permissionAtom(e)),[ee,te]=(0,Q.useState)(null),re=a(q.mcpRegistryTest.permissionAtom(e)),se=K(e),ce=J(q.updateSettings,{label:`update MCP registry`,reportFailure:!0}),de=J(q.mcpRegistryState,{reportFailure:!1}),fe=J(q.mcpRegistryTest,{label:`check MCP server`,reportFailure:!0}),pe=J(q.mcpRegistryOAuthStart,{label:`start MCP sign-in`,reportFailure:!0}),me=J(q.mcpRegistryOAuthSignOut,{label:`sign out of MCP server`,reportFailure:!0}),he=J(q.mcpRegistryDiscover,{reportFailure:!1}),ge=J(q.mcpRegistryImport,{label:`import MCP servers`,reportFailure:!0}),[_e,ve]=(0,Q.useState)({}),[ye,Ce]=(0,Q.useState)(new Set),[Me,Ne]=(0,Q.useState)([]),[Y,Pe]=(0,Q.useState)({kind:`list`}),X=Y.kind!==`list`&&Y.id!==null&&(Y.kind===`server`?P[Y.id]===void 0:F[Y.id]===void 0)?{kind:`list`}:Y,[Re,ze]=(0,Q.useState)(o);if(o!==Re){ze(o);let e=o.replace(/^#/,``);(e===`mcp-servers`||e===`plugins`||e===`skills`)&&(d(e===`mcp-servers`?`mcps`:e),Pe({kind:`list`}))}let[Be,Ve]=(0,Q.useState)(null),Z=(0,Q.useRef)(new Map),[He,Ge]=(0,Q.useState)(null),[Ke,qe]=(0,Q.useState)({}),Je=(0,Q.useMemo)(()=>Object.entries(P).map(([e,t])=>[k.make(e),t]).toSorted(([,e],[,t])=>e.name.localeCompare(t.name)),[P]),Ye=(0,Q.useMemo)(()=>Object.entries(F).map(([e,t])=>[D.make(e),t]),[F]),Xe=(0,Q.useCallback)(async()=>{let t=await de({environmentId:e,input:{}});t._tag===`Success`&&ve(t.value.servers)},[e,de]),Ze=(0,Q.useCallback)(async()=>{if(!re)return;let t=await he({environmentId:e,input:n===void 0?{}:{projectId:n}});t._tag===`Success`&&Ne(t.value.servers)},[re,he,e,n]);(0,Q.useEffect)(()=>{Xe(),Ze()},[Xe,Ze]);let tt=e=>{d(`mcps`),Pe({kind:`server`,id:e})},nt=e=>{d(`plugins`),Pe({kind:`plugin`,id:e})},rt=t=>ce({environmentId:e,input:{patch:t}}),it=async t=>{Ce(e=>new Set(e).add(t));let n=await fe({environmentId:e,input:{serverId:t}});if(Ce(e=>{let n=new Set(e);return n.delete(t),n}),n._tag===`Success`)return ve(e=>({...e,[t]:n.value})),n.value},at=(0,Q.useEffectEvent)(async e=>{(await it(e))?.health.status===`connected`&&Ge(null)});(0,Q.useEffect)(()=>{if(He===null)return;let e=()=>void at(He);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[He]);let ot=async(e,t,n)=>{(await rt({mcpServers:{[e]:t}}))._tag===`Success`&&(n&&Pe({kind:`list`}),Ze(),t.enabled&&await it(e))},st=async(t,n=!1)=>{let r=Z.current.get(t);if(!n&&He===t&&r){window.open(r,`_blank`,`noopener,noreferrer`);return}let i=se??window.location.origin;qe(e=>{let n={...e};return delete n[t],n});let a=await pe({environmentId:e,input:{serverId:t,origin:new URL(i,window.location.href).origin,...n?{reauthenticate:n}:{}}});a._tag===`Success`?a.value.authorizationUrl===null?await it(t):(Z.current.set(t,a.value.authorizationUrl),Ge(t),window.open(a.value.authorizationUrl,`_blank`,`noopener,noreferrer`)):a._tag===`Failure`&&qe(e=>({...e,[t]:Ht(a.cause)}))},ct=async t=>{let n=await me({environmentId:e,input:{serverId:t}});n._tag===`Success`&&ve(e=>({...e,[t]:n.value}))},lt=(e,t,r)=>{if(n===void 0)return;let i=I[n]??{},a={...i[e]};r===void 0?delete a[t]:a[t]={enabled:r},rt({projectSettingsOverrides:{[n]:{...i,[e]:a}}})},ut=async()=>{let t=Be;if(Ve(null),t!==null){if(t.kind===`server`){let n=P[t.id];n?.transport.type===`http`&&n.transport.auth===`oauth`&&await me({environmentId:e,input:{serverId:t.id}}),await rt({mcpServers:{[t.id]:null}})}else await rt({plugins:{[t.id]:null}});Pe({kind:`list`})}},dt=Me.filter(e=>!e.alreadyAdded),mt=new Set(Je.filter(([e])=>X.kind!==`server`||e!==X.id).map(([,e])=>e.name)),ht=p.trim().toLowerCase(),_t=Je.filter(([,e])=>qt(ht,e.name,We(e))),yt=Ye.filter(([,e])=>qt(ht,e.name,e.path)),xt=dt.filter(e=>qt(ht,e.name,e.summary)),St=(e,t)=>N({mcpServers:P,plugins:F,projectSettingsOverrides:I},e,n??null,t),Ct=(e,t,r)=>{n===void 0?rt(e===`mcpServers`?{mcpServers:{[t]:{...P[t],enabled:r}}}:{plugins:{[t]:{...F[t],enabled:r}}}):lt(e,t,r)},Tt=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-1`,children:[(0,$.jsx)(`h1`,{className:`text-2xl font-semibold text-foreground`,children:`Plugins`}),(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Manage plugins, skills, and MCP servers given to agents on `,t,`.`]})]}),re?(0,$.jsxs)(f,{children:[(0,$.jsx)(m,{render:(0,$.jsxs)(_,{children:[`Add`,(0,$.jsx)(s,{"aria-hidden":!0})]})}),(0,$.jsxs)(b,{align:`end`,children:[(0,$.jsxs)(S,{onClick:()=>tt(null),children:[(0,$.jsx)(i,{"aria-hidden":!0}),`Add MCP server`]}),(0,$.jsxs)(S,{onClick:()=>nt(null),children:[(0,$.jsx)(c,{"aria-hidden":!0}),`Add plugin`]})]})]}):null]}),Et=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(le,{"aria-label":`Show`,variant:`default`,value:[u],onValueChange:e=>{let t=e[0];(t===`plugins`||t===`mcps`||t===`skills`)&&(d(t),Pe({kind:`list`}))},children:[(0,$.jsxs)(ue,{value:`plugins`,...Ie(`plugins`),children:[`Plugins `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:Ye.length})]}),(0,$.jsxs)(ue,{value:`mcps`,...Ie(`mcp-servers`),children:[`MCPs `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:Je.length})]}),(0,$.jsxs)(ue,{value:`skills`,...Ie(`skills`),children:[`Skills `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:O.length})]})]}),(0,$.jsxs)(`div`,{className:`flex w-full gap-2 sm:w-auto`,children:[u===`skills`?(0,$.jsx)(`div`,{className:`w-fit shrink-0`,children:(0,$.jsxs)(H,{value:C,onValueChange:e=>e&&T(e),children:[(0,$.jsx)(V,{"aria-label":`Skill category`,children:(0,$.jsx)(z,{})}),(0,$.jsxs)(B,{children:[(0,$.jsx)(R,{value:`All categories`,children:`All categories`}),$e.filter(e=>e===`Personal`||e===`Built-in`||O.some(({skill:t})=>et(t)===e)).map(e=>(0,$.jsx)(R,{value:e,children:e},e))]})]})}):null,(0,$.jsxs)(Se,{className:`min-w-0 flex-1 sm:w-56`,children:[(0,$.jsx)(be,{children:(0,$.jsx)(g,{"aria-hidden":!0})}),(0,$.jsx)(xe,{"aria-label":Kt[u],placeholder:Kt[u],value:p,onChange:e=>x(e.currentTarget.value)})]})]})]}),Dt=(e,t)=>(0,$.jsxs)(oe,{children:[(0,$.jsx)(ie,{render:(0,$.jsx)(_,{size:`icon-sm`,variant:`ghost`,"aria-label":e,onClick:t,children:(0,$.jsx)(v,{"aria-hidden":!0})})}),(0,$.jsx)(ae,{children:e})]}),Ot=yt.length===0?(0,$.jsx)(`p`,{className:`py-6 text-sm text-muted-foreground`,children:Ye.length===0?`No plugins yet. Add a Claude Code or Codex plugin folder to give its tools to your agents.`:`No plugins match your search.`}):(0,$.jsx)(`ul`,{className:`grid gap-1`,children:yt.map(([t,n])=>(0,$.jsx)(Qe,{environmentId:e,plugin:n,enabled:St(`plugins`,t),disabled:!G,onDetails:()=>nt(t),onToggle:e=>Ct(`plugins`,t,e)},t))}),kt=O.filter(({skill:e})=>(C===`All categories`||et(e)===C)&&qt(ht,pt(e),e.name,e.shortDescription??``,e.description??``)),At=kt.length===0?(0,$.jsx)(`p`,{className:`py-6 text-sm text-muted-foreground`,children:O.length===0?`No skills found. Providers report the skills they load when they start.`:`No skills match these filters.`}):(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Switches apply to new Claude and OpenCode sessions.`}),(0,$.jsx)(`ul`,{className:`grid gap-1`,children:kt.map(t=>{let r=et(t.skill),i=(E??[]).filter(e=>A(e.driver)&&e.skills.some(e=>e.name===t.skill.name)),a=i.length?i.map(e=>e.displayName??e.driver).join(`, `):`Native settings`;return(0,$.jsxs)(`li`,{className:`flex items-center gap-3 py-3`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`flex size-10 shrink-0 items-center justify-center rounded-full border border-border/60 text-muted-foreground`,children:(0,$.jsx)(w,{className:`size-4`})}),(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>M(t),className:`w-fit break-words text-left text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:pt(t.skill)}),(0,$.jsx)(Jt,{text:t.skill.shortDescription??t.skill.description??t.skill.path}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:[r,a].filter(Boolean).join(` · `)})]}),(0,$.jsxs)(f,{children:[(0,$.jsxs)(oe,{children:[(0,$.jsx)(ie,{render:(0,$.jsx)(m,{render:(0,$.jsx)(_,{variant:`ghost`,size:`icon-sm`,"aria-label":`More for ${pt(t.skill)}`,children:(0,$.jsx)(l,{"aria-hidden":!0})})})}),(0,$.jsx)(ae,{children:`Skill actions`})]}),(0,$.jsxs)(b,{align:`end`,children:[U.capabilities.canOpenDefault?(0,$.jsx)(S,{onClick:()=>void U.activate(`open`,{environmentId:e,filePath:t.skill.path,workspaceRoot:void 0}),children:`Open`}):null,(0,$.jsx)(S,{onClick:()=>M(t),children:`Details`}),n!==void 0&&I[n]?.skillOverrides?.[t.skill.name]!==void 0?(0,$.jsx)(S,{onClick:()=>{let e=I[n]??{},r={...e.skillOverrides};delete r[t.skill.name],rt({projectSettingsOverrides:{[n]:{...e,skillOverrides:r}}})},children:`Use environment setting`}):null]})]}),(0,$.jsx)(Le,{"aria-label":`Enable ${pt(t.skill)} for ${a}`,checked:(n===void 0?void 0:I[n]?.skillOverrides?.[t.skill.name])??L[t.skill.name]??t.skill.enabled,disabled:!G||ee!==null||i.length===0,onCheckedChange:e=>{te(t.skill.name),rt(n===void 0?{skillOverrides:{[t.skill.name]:e}}:{projectSettingsOverrides:{[n]:{...I[n],skillOverrides:{...I[n]?.skillOverrides,[t.skill.name]:e}}}}).finally(()=>te(null))}})]},t.skill.path)})})]}),jt=(0,$.jsxs)(`div`,{className:`grid gap-6`,children:[Je.length>0?(0,$.jsx)(Fe,{title:`Servers`,children:_t.length===0?(0,$.jsx)(`p`,{className:`px-3 text-sm text-muted-foreground sm:px-4`,children:`No MCP servers match your search.`}):(0,$.jsx)($.Fragment,{children:_t.map(([e,t])=>{let n=St(`mcpServers`,e),r=Ue({...t,enabled:n},_e[e],ye.has(e)),i=Ke[e],a=Ut(t,r,_e[e]);return(0,$.jsxs)(`div`,{className:`flex min-h-14 items-center gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,$.jsx)(`span`,{className:`break-words text-sm font-medium text-foreground`,children:t.name}),r.tone===`error`||a?(0,$.jsx)(Wt,{status:r}):null,i?(0,$.jsx)(`span`,{className:`text-xs text-destructive-foreground`,children:i}):null]}),r.needsSignIn&&re?(0,$.jsx)(_,{size:`xs`,variant:`outline`,onClick:()=>void st(e),children:`Authenticate`}):null,a&&!r.needsSignIn&&re?(0,$.jsxs)(f,{children:[(0,$.jsxs)(oe,{children:[(0,$.jsx)(ie,{render:(0,$.jsx)(m,{render:(0,$.jsx)(_,{variant:`ghost`,size:`icon-sm`,"aria-label":`More for ${t.name}`,children:(0,$.jsx)(l,{"aria-hidden":!0})})})}),(0,$.jsx)(ae,{children:`Sign-in actions`})]}),(0,$.jsxs)(b,{align:`end`,children:[(0,$.jsx)(S,{onClick:()=>void st(e,!0),children:`Re-authenticate`}),_e[e]?.auth===`signed-in`?(0,$.jsx)(S,{onClick:()=>void ct(e),children:`Sign out`}):null]})]}):null,Dt(`Settings for ${t.name}`,()=>tt(e)),(0,$.jsx)(Le,{"aria-label":`Give ${t.name} to agents`,checked:n,disabled:!re,onCheckedChange:t=>Ct(`mcpServers`,e,t)})]},e)})})}):null,re&&xt.length>0?(0,$.jsx)(Fe,{title:`Found in provider configs`,headerAction:(0,$.jsx)(_,{size:`icon-xs`,variant:`ghost`,"aria-label":`Look again`,onClick:()=>void Ze(),children:(0,$.jsx)(y,{"aria-hidden":!0})}),children:(0,$.jsx)($.Fragment,{children:xt.map(t=>(0,$.jsxs)(`div`,{className:`flex min-h-14 items-center gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,$.jsx)(`span`,{className:`break-words text-sm font-medium text-foreground`,children:t.name}),xt.filter(e=>e.name===t.name).length>1?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(t.providers??[t.provider]).map(e=>Rt[e]).join(`, `)}):null]}),(0,$.jsx)(_,{size:`xs`,variant:`outline`,onClick:async()=>{(await ge({environmentId:e,input:{...n===void 0?{}:{projectId:n},servers:[{provider:t.provider,path:t.path,name:t.name}]}}))._tag===`Success`&&(Ze(),Xe())},children:`Import`})]},`${t.provider}:${t.path}:${t.name}`))})}):null]}),Mt=X.kind===`server`?(0,$.jsxs)(gt,{title:X.id===null?`Add MCP server`:`Update ${P[X.id]?.name??`server`} MCP`,onBack:()=>Pe({kind:`list`}),onUninstall:X.id!==null&&re?()=>Ve({kind:`server`,id:X.id}):void 0,children:[(0,$.jsx)(vt,{server:X.id===null?void 0:P[X.id],takenNames:mt,onSave:e=>void ot(X.id??k.make(h()),e,X.id===null)},X.id??`new`),X.id!==null&&P[X.id]!==void 0?(0,$.jsx)(Zt,{environmentId:e,id:X.id,server:P[X.id],runtime:_e[X.id],checking:ye.has(X.id),canManage:re,projectLabel:r,projectOverride:n===void 0?void 0:I[n]?.mcpServers?.[X.id],awaitingSignIn:He===X.id,onProviderToggle:(e,t)=>{let n=P[X.id],r=t?n.disabledProviders.filter(t=>t!==e):[...n.disabledProviders,e];rt({mcpServers:{[X.id]:{...n,disabledProviders:r}}})},onProjectOverride:n===void 0?void 0:e=>lt(`mcpServers`,X.id,e),signInError:Ke[X.id],onTest:()=>void it(X.id),onSignIn:()=>void st(X.id),onReauthenticate:()=>void st(X.id,!0),onSignOut:()=>void ct(X.id)},`${e}:${X.id}`):null]}):null,Nt=X.kind===`plugin`?(0,$.jsxs)(gt,{title:X.id===null?`Add plugin`:`Update ${F[X.id]?.name??`plugin`}`,onBack:()=>Pe({kind:`list`}),onUninstall:X.id!==null&&re?()=>Ve({kind:`plugin`,id:X.id}):void 0,children:[(0,$.jsx)(bt,{environmentId:e,plugin:X.id===null?void 0:F[X.id],environmentLabel:t,onSave:async e=>{let t=X.id??D.make(h());(await rt({plugins:{[t]:e}}))._tag===`Success`&&X.id===null&&Pe({kind:`list`})}},X.id??`new`),X.id!==null&&F[X.id]!==void 0?(0,$.jsx)(on,{plugin:F[X.id],projectLabel:r,projectOverride:n===void 0?void 0:I[n]?.plugins?.[X.id],onProjectOverride:n===void 0?void 0:e=>lt(`plugins`,X.id,e)}):null]}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`grid gap-6`,children:[Tt,Et,Mt??Nt??(u===`plugins`?Ot:u===`mcps`?jt:At)]}),j===null?null:(0,$.jsx)(wt,{entry:j,environmentId:e,onClose:()=>M(null)}),(0,$.jsx)(Ae,{open:Be!==null,onOpenChange:e=>!e&&Ve(null),children:(0,$.jsxs)(De,{children:[(0,$.jsxs)(we,{children:[(0,$.jsxs)(ke,{children:[`Remove`,` `,Be?.kind===`server`?P[Be.id]?.name??`server`:Be?.kind===`plugin`?F[Be.id]?.name??`plugin`:``,`?`]}),(0,$.jsxs)(Oe,{children:[`New sessions on `,t,` stop getting it. Its stored values and sign-in are deleted. Provider config files are not changed.`]})]}),(0,$.jsxs)(Te,{children:[(0,$.jsx)(Ee,{render:(0,$.jsx)(_,{variant:`outline`,children:`Cancel`})}),(0,$.jsx)(_,{variant:`destructive`,onClick:()=>void ut(),children:`Remove`})]})]})})]})}function Xt(e){let t=(0,Z.c)(16),{projectLabel:n,override:r,inherited:i,onChange:a}=e,o=r?.enabled!==void 0,s=`In ${n}`,c=o?`Set for this project.`:`Follows the environment (${i?`on`:`off`}).`,l;t[0]!==a||t[1]!==o?(l=o?(0,$.jsx)(_,{size:`xs`,variant:`ghost`,onClick:()=>a(void 0),children:`Reset`}):null,t[0]=a,t[1]=o,t[2]=l):l=t[2];let u=`Use in ${n}`,d=r?.enabled??i,f;t[3]===a?f=t[4]:(f=e=>a(e),t[3]=a,t[4]=f);let p;t[5]!==u||t[6]!==d||t[7]!==f?(p=(0,$.jsx)(Le,{"aria-label":u,checked:d,onCheckedChange:f}),t[5]=u,t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==l||t[10]!==p?(m=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,p]}),t[9]=l,t[10]=p,t[11]=m):m=t[11];let h;return t[12]!==s||t[13]!==c||t[14]!==m?(h=(0,$.jsx)(Y,{title:s,description:c,control:m}),t[12]=s,t[13]=c,t[14]=m,t[15]=h):h=t[15],h}function Zt(e){let t=(0,Z.c)(108),{environmentId:n,id:r,server:i,runtime:a,checking:o,canManage:s,projectLabel:c,projectOverride:l,awaitingSignIn:d,signInError:f,onProviderToggle:p,onProjectOverride:m,onTest:h,onSignIn:g,onReauthenticate:v,onSignOut:y}=e,b=s&&i.transport.type===`http`&&i.transport.auth===`oauth`&&a?.auth===`signed-out`,x=tn(n,r,b),S=x.entries,C;t[0]!==o||t[1]!==a||t[2]!==i?(C=Ue(i,a,o),t[0]=o,t[1]=a,t[2]=i,t[3]=C):C=t[3];let w=C,T;t[4]===S?T=t[5]:(T=S?.filter($t).length??0,t[4]=S,t[5]=T);let E=T,D;t[6]!==w||t[7]!==E||t[8]!==S||t[9]!==b?(D=b?{...w,tone:`muted`,label:S===null?`Checking providers…`:E>0?`Available to ${E} ${E===1?`provider`:`providers`}`:`No providers connected`}:w,t[6]=w,t[7]=E,t[8]=S,t[9]=b,t[10]=D):D=t[10];let O=D,k,A,j,M,N,P,F;if(t[11]!==d||t[12]!==s||t[13]!==o||t[14]!==S||t[15]!==r||t[16]!==p||t[17]!==v||t[18]!==g||t[19]!==y||t[20]!==h||t[21]!==a?.auth||t[22]!==i||t[23]!==f||t[24]!==x||t[25]!==O||t[26]!==b){let e;t[34]===S?e=t[35]:(e=e=>({...e,badge:S===null||e.unsupported!==void 0?void 0:at(e.driver,S)}),t[34]=S,t[35]=e);let n=ot(i).map(e),c=i.transport.type===`http`&&a?.auth===`signed-in`,l=f??O.detail;N=`grid gap-6`,P=r;let m;t[36]===O?m=t[37]:(m=(0,$.jsx)(Wt,{status:O,className:`flex-1 text-sm`}),t[36]=O,t[37]=m);let C;t[38]!==d||t[39]!==s||t[40]!==g||t[41]!==O.needsSignIn||t[42]!==b?(C=O.needsSignIn&&s&&!b?(0,$.jsx)(_,{size:`xs`,onClick:g,children:d?`Open sign-in again`:`Authenticate`}):null,t[38]=d,t[39]=s,t[40]=g,t[41]=O.needsSignIn,t[42]=b,t[43]=C):C=t[43];let w;t[44]!==s||t[45]!==v||t[46]!==c||t[47]!==O.needsSignIn?(w=c&&!O.needsSignIn&&s?(0,$.jsx)(_,{size:`xs`,variant:`outline`,onClick:v,children:`Re-authenticate`}):null,t[44]=s,t[45]=v,t[46]=c,t[47]=O.needsSignIn,t[48]=w):w=t[48];let T;t[49]!==s||t[50]!==y||t[51]!==c?(T=c&&s?(0,$.jsx)(_,{size:`xs`,variant:`ghost`,onClick:y,children:`Sign out`}):null,t[49]=s,t[50]=y,t[51]=c,t[52]=T):T=t[52];let E;t[53]!==s||t[54]!==o||t[55]!==h||t[56]!==i.enabled?(E=s&&i.enabled?(0,$.jsx)(_,{size:`xs`,variant:`outline`,disabled:o,onClick:h,children:`Test connection`}):null,t[53]=s,t[54]=o,t[55]=h,t[56]=i.enabled,t[57]=E):E=t[57];let D;t[58]!==m||t[59]!==C||t[60]!==w||t[61]!==T||t[62]!==E?(D=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[m,C,w,T,E]}),t[58]=m,t[59]=C,t[60]=w,t[61]=T,t[62]=E,t[63]=D):D=t[63];let I;t[64]!==d||t[65]!==O.needsSignIn||t[66]!==b?(I=O.needsSignIn&&!b?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:d?`Finish signing in in your browser, then come back here.`:b?`Sign in here to give it to every provider.`:`Agents can't reach this server until you sign in.`}):null,t[64]=d,t[65]=O.needsSignIn,t[66]=b,t[67]=I):I=t[67];let L;t[68]!==l||t[69]!==b?(L=l&&!b?(0,$.jsx)(`p`,{className:`rounded-md bg-destructive/8 px-2.5 py-1.5 text-xs text-destructive-foreground`,children:l}):null,t[68]=l,t[69]=b,t[70]=L):L=t[70];let R;t[71]!==d||t[72]!==l||t[73]!==g||t[74]!==b?(R=b?(0,$.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:l?`Shared sign-in unavailable`:`Shared sign-in`}),(0,$.jsxs)(`div`,{className:`grid gap-2 pt-2`,children:[(0,$.jsx)(`p`,{children:l??`Sign in through P4 Code to share access with every enabled provider.`}),(0,$.jsx)(`div`,{children:(0,$.jsx)(_,{size:`xs`,variant:`outline`,onClick:g,children:d?`Open browser`:l?`Retry shared sign-in`:`Sign in through P4 Code`})})]})]}):null,t[71]=d,t[72]=l,t[73]=g,t[74]=b,t[75]=R):R=t[75];let z;t[76]===i.source?z=t[77]:(z=i.source?(0,$.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:`Import source`}),(0,$.jsx)(`p`,{className:`break-all pt-2`,children:i.source.path})]}):null,t[76]=i.source,t[77]=z);let B=b?(0,$.jsx)(rn,{serverName:i.name,signIns:x,blocked:n.filter(Qt).length}):null;t[78]!==D||t[79]!==I||t[80]!==L||t[81]!==R||t[82]!==z||t[83]!==B?(F=(0,$.jsx)(Fe,{title:`Status`,children:(0,$.jsx)(Me,{children:(0,$.jsxs)(`div`,{className:`grid gap-2 px-4 py-3`,children:[D,I,L,R,z,B]})})}),t[78]=D,t[79]=I,t[80]=L,t[81]=R,t[82]=z,t[83]=B,t[84]=F):F=t[84],A=Fe,M=`Providers`,k=Me;let V;t[85]!==s||t[86]!==p||t[87]!==i.name?(V=e=>(0,$.jsx)(Y,{title:e.label,...e.unsupported===void 0?{}:{description:e.unsupported},control:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.badge===void 0?null:(0,$.jsx)(u,{variant:an[e.badge].variant,children:an[e.badge].label}),(0,$.jsx)(Le,{"aria-label":`Give ${i.name} to ${e.label}`,checked:e.enabled&&e.badge!==`unavailable`,disabled:!s||e.unsupported!==void 0||e.badge===`unavailable`,onCheckedChange:t=>p(e.driver,t)})]})},e.driver),t[85]=s,t[86]=p,t[87]=i.name,t[88]=V):V=t[88],j=n.map(V),t[11]=d,t[12]=s,t[13]=o,t[14]=S,t[15]=r,t[16]=p,t[17]=v,t[18]=g,t[19]=y,t[20]=h,t[21]=a?.auth,t[22]=i,t[23]=f,t[24]=x,t[25]=O,t[26]=b,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N,t[32]=P,t[33]=F}else k=t[27],A=t[28],j=t[29],M=t[30],N=t[31],P=t[32],F=t[33];let I;t[89]!==k||t[90]!==j?(I=(0,$.jsx)(k,{children:j}),t[89]=k,t[90]=j,t[91]=I):I=t[91];let L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(`p`,{className:`px-3 text-xs text-muted-foreground sm:px-4`,children:`A change reaches a thread when its provider session next starts.`}),t[92]=L):L=t[92];let R;t[93]!==A||t[94]!==M||t[95]!==I?(R=(0,$.jsxs)(A,{title:M,children:[I,L]}),t[93]=A,t[94]=M,t[95]=I,t[96]=R):R=t[96];let z;t[97]!==m||t[98]!==c||t[99]!==l||t[100]!==i.enabled?(z=c!==void 0&&m!==void 0?(0,$.jsx)(Fe,{title:`Project`,children:(0,$.jsx)(Me,{children:(0,$.jsx)(Xt,{projectLabel:c,override:l,inherited:i.enabled,onChange:m})})}):null,t[97]=m,t[98]=c,t[99]=l,t[100]=i.enabled,t[101]=z):z=t[101];let B;return t[102]!==R||t[103]!==z||t[104]!==N||t[105]!==P||t[106]!==F?(B=(0,$.jsxs)(`div`,{className:N,"data-server-id":P,children:[F,R,z]}),t[102]=R,t[103]=z,t[104]=N,t[105]=P,t[106]=F,t[107]=B):B=t[107],B}function Qt(e){return e.enabled&&e.badge===`unavailable`}function $t(e){return e.status===`signed-in`}function en(e){let t=E(e);return Vt(t)&&t.detail!==void 0?t.detail:`Sign-in could not start. Try again.`}function tn(e,t,n){let r=J(q.mcpRegistryProviderSignInState,{reportFailure:!1}),i=J(q.mcpRegistryProviderSignInStart,{reportFailure:!1}),o=J(q.mcpRegistryProviderSignInWait,{reportFailure:!1}),s=J(q.mcpRegistryProviderSignInComplete,{reportFailure:!1}),c=J(q.mcpRegistryProviderSignInCancel,{reportFailure:!1}),l=J(q.mcpRegistryProviderSignOut,{reportFailure:!1}),u=a(q.mcpRegistryProviderSignInComplete.permissionAtom(e)),d=a(q.mcpRegistryProviderSignInCancel.permissionAtom(e)),[f,p]=(0,Q.useState)(null),[m,h]=(0,Q.useState)({}),[g,_]=(0,Q.useState)(new Set),v=(0,Q.useRef)(new Set),y=e=>p(t=>t?.map(t=>t.instanceId===e.instanceId?e:t)??null),b=(e,t)=>h(n=>{let r={...n};return t===void 0?delete r[e]:r[e]=t,r});return(0,Q.useEffect)(()=>{if(!n)return;let i=!1;return r({environmentId:e,input:{serverId:t}}).then(e=>{i||p(e._tag===`Success`?e.value.providers:[])}),()=>{i=!0}},[n,e,r,t]),(0,Q.useEffect)(()=>{if(!n)return;let r=!1;for(let n of f??[]){let i=n.pending;i&&o({environmentId:e,input:{serverId:t,instanceId:n.instanceId,flowId:i.flowId}}).then(e=>{r||(p(t=>t?.map(t=>{if(t.instanceId!==n.instanceId||t.pending?.flowId!==i.flowId)return t;if(e._tag===`Success`)return e.value;let{pending:r,...a}=t;return a})??null),e._tag===`Failure`?b(n.instanceId,en(e.cause)):e._tag===`Success`&&e.value.status!==`signed-in`&&!v.current.has(n.instanceId)&&b(n.instanceId,`Sign-in ended without connecting. Try again.`))})}return()=>{r=!0}},[n,f,e,t,o]),{entries:n?f:null,errors:m,busy:g,run:async(n,r,a)=>{if(!v.current.has(n.instanceId)){v.current.add(n.instanceId),_(new Set(v.current)),b(n.instanceId,void 0);try{let o={serverId:t,instanceId:n.instanceId};if(r===`start`){let t=await i({environmentId:e,input:o});t._tag===`Success`?(y({...n,pending:t.value}),window.open(t.value.authorizationUrl,`_blank`,`noopener,noreferrer`)):t._tag===`Failure`&&b(n.instanceId,en(t.cause));return}let u={...o,flowId:n.pending?.flowId??``},d=r===`complete`?await s({environmentId:e,input:{...u,callbackUrl:a.trim()}}):r===`cancel`?await c({environmentId:e,input:u}):await l({environmentId:e,input:o});d._tag===`Success`?y(d.value):d._tag===`Failure`&&b(n.instanceId,en(d.cause))}finally{v.current.delete(n.instanceId),_(new Set(v.current))}}},canComplete:u,canCancel:d}}function nn(e){let t=(0,Z.c)(39),{entry:n,signIns:r}=e,i;t[0]!==n.displayName||t[1]!==n.driver?(i=n.displayName??rt(n.driver),t[0]=n.displayName,t[1]=n.driver,t[2]=i):i=t[2];let a=i,[o,s]=(0,Q.useState)(``),c=n.pending,l;t[3]!==n.instanceId||t[4]!==r.busy?(l=r.busy.has(n.instanceId),t[3]=n.instanceId,t[4]=r.busy,t[5]=l):l=t[5];let u=l,d=r.errors[n.instanceId],f=`mcp-callback-${n.instanceId}`,p;t[6]===a?p=t[7]:(p=(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:a}),t[6]=a,t[7]=p);let m=c?`text-warning-foreground`:n.status===`signed-in`?`text-success-foreground`:`text-muted-foreground`,h;t[8]===m?h=t[9]:(h=x(`text-xs`,m),t[8]=m,t[9]=h);let g;t[10]!==n.status||t[11]!==c?(g=c?`Waiting for sign-in`:it(n.status),t[10]=n.status,t[11]=c,t[12]=g):g=t[12];let v;t[13]!==h||t[14]!==g?(v=(0,$.jsx)(`p`,{className:h,role:`status`,children:g}),t[13]=h,t[14]=g,t[15]=v):v=t[15];let y;t[16]!==p||t[17]!==v?(y=(0,$.jsxs)(`div`,{className:`grid gap-1`,children:[p,v]}),t[16]=p,t[17]=v,t[18]=y):y=t[18];let b;t[19]!==u||t[20]!==n||t[21]!==d||t[22]!==c||t[23]!==r?(b=!c&&n.status!==`unavailable`?(0,$.jsx)(_,{size:`xs`,variant:n.status===`signed-in`?`outline`:`default`,disabled:u,onClick:()=>void r.run(n,n.status===`signed-in`?`signOut`:`start`),children:u?`Please wait…`:n.status===`signed-in`?`Sign out`:d?`Start over`:`Sign in`}):null,t[19]=u,t[20]=n,t[21]=d,t[22]=c,t[23]=r,t[24]=b):b=t[24];let S;t[25]!==y||t[26]!==b?(S=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[y,b]}),t[25]=y,t[26]=b,t[27]=S):S=t[27];let C;t[28]!==u||t[29]!==o||t[30]!==n||t[31]!==d||t[32]!==f||t[33]!==c||t[34]!==r?(C=c?(0,$.jsxs)(`form`,{className:`grid gap-2`,onSubmit:e=>{e.preventDefault(),o.trim()&&!u&&r.canComplete&&r.run(n,`complete`,o)},children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Approve in your browser. If it ends on a callback URL, paste that URL here.`}),(0,$.jsx)(`label`,{htmlFor:f,className:`text-xs font-medium`,children:`Callback URL`}),(0,$.jsx)(de,{id:f,value:o,onChange:e=>s(e.target.value),placeholder:`http://localhost:…/callback?code=…&state=…`,autoComplete:`off`,spellCheck:!1,disabled:u||!r.canComplete,"aria-invalid":!!d,"aria-describedby":d?`${f}-error`:void 0}),d?(0,$.jsx)(`p`,{id:`${f}-error`,role:`alert`,className:`text-xs text-destructive-foreground`,children:d}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(_,{type:`submit`,size:`xs`,disabled:u||!o.trim()||!r.canComplete,children:u?`Please wait…`:`Finish sign-in`}),(0,$.jsx)(_,{type:`button`,size:`xs`,variant:`outline`,disabled:u,onClick:()=>window.open(c.authorizationUrl,`_blank`,`noopener,noreferrer`),children:`Open browser`}),(0,$.jsx)(_,{type:`button`,size:`xs`,variant:`ghost`,disabled:u||!r.canCancel,onClick:()=>void r.run(n,`cancel`),children:`Cancel`})]})]}):d?(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive-foreground`,children:d}):null,t[28]=u,t[29]=o,t[30]=n,t[31]=d,t[32]=f,t[33]=c,t[34]=r,t[35]=C):C=t[35];let w;return t[36]!==S||t[37]!==C?(w=(0,$.jsxs)(`div`,{className:`grid gap-2 border-t border-border pt-3`,children:[S,C]}),t[36]=S,t[37]=C,t[38]=w):w=t[38],w}function rn(e){let t=(0,Z.c)(8),{serverName:n,signIns:r,blocked:i}=e,a;t[0]===r?a=t[1]:(a=r.entries===null?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Checking providers…`}):r.entries.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No enabled provider here can sign in to MCP servers itself.`}):r.entries.map(e=>(0,$.jsx)(nn,{entry:e,signIns:r},`${e.instanceId}:${e.pending?.flowId??`idle`}`)),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n?(o=i>0?(0,$.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer`,children:[i,` other `,i===1?`provider`:`providers`,` unavailable`]}),(0,$.jsxs)(`p`,{className:`pt-2`,children:[`These providers need shared sign-in to use `,n,`.`]})]}):null,t[2]=i,t[3]=n,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}var an={"signed-in":{variant:`success`,label:`Signed in`},"needs-sign-in":{variant:`warning`,label:`Sign in needed`},unavailable:{variant:`secondary`,label:`Unavailable`}};function on(e){let t=(0,Z.c)(7),{plugin:n,projectLabel:r,projectOverride:i,onProjectOverride:a}=e,o;t[0]!==a||t[1]!==n||t[2]!==r||t[3]!==i?(o=r!==void 0&&a!==void 0?(0,$.jsx)(Fe,{title:`Project`,children:(0,$.jsx)(Me,{children:(0,$.jsx)(Xt,{projectLabel:r,override:i,inherited:n.enabled,onChange:a})})}):null,t[0]=a,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;return t[5]===o?s=t[6]:(s=(0,$.jsx)(`div`,{className:`grid gap-6`,children:o}),t[5]=o,t[6]=s),s}var sn=Gt;export{sn as component};
|
|
5
|
-
//# sourceMappingURL=settings.plugins-B6My9wD7.js.map
|