@p4code/cli 0.8.0 → 0.8.2
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-CfALMbjp.mjs → AcpMcpStdioBridge-DBONIB-w.mjs} +120 -19
- package/dist/AcpMcpStdioBridge-D_JnxPWS.mjs +4 -0
- package/dist/{Effect-zfMCY1g4.mjs → Effect-BahT0mOQ.mjs} +2 -2
- package/dist/bin.mjs +2 -2
- package/dist/{binCli-C3s3kGWK.mjs → binCli-C1tFongj.mjs} +7162 -5814
- package/dist/claude-history-worker.mjs +1 -1
- package/dist/{claudeHistoryWorker-CMjiofbZ.mjs → claudeHistoryWorker-v_0uyLGp.mjs} +2 -2
- package/dist/client/.vite/manifest.json +2154 -2122
- package/dist/client/assets/{AnimatedHeight-BwS0L5jd.js → AnimatedHeight-PJxVEp27.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell-B5dTwcVl.js → AuthSurfaceShell-BrPHaco9.js} +2 -2
- package/dist/client/assets/{CSPContext-B1m61J9R.js → CSPContext-C7uwFl6f.js} +2 -2
- package/dist/client/assets/ChatGptUsageButton-7IZqWaQq.js +2 -0
- package/dist/client/assets/ChatMarkdown-D3ITm4U-.js +65 -0
- package/dist/client/assets/CodexSetupSection.logic-DyTuN6tg.js +2 -0
- package/dist/client/assets/{ComboboxClear-CSnbXRcJ.js → ComboboxClear-BXGqqvsR.js} +2 -2
- package/dist/client/assets/{CommandBlock-DcgLBXYD.js → CommandBlock-JrUX9e8E.js} +2 -2
- package/dist/client/assets/{ComposerPromptEditor-oniaSNnQ.js → ComposerPromptEditor-Ba1dvqDN.js} +56 -56
- package/dist/client/assets/{CompositeRoot-ykxKqF8U.js → CompositeRoot-CW06ANMY.js} +2 -2
- package/dist/client/assets/{ConnectionStatusDot-BvfbN2Tp.js → ConnectionStatusDot-Cjh57o6i.js} +2 -2
- package/dist/client/assets/DevicePanel-zG3feCFw.js +2 -0
- package/dist/client/assets/{DeviceSetup-kaQqI-00.js → DeviceSetup-DccRVnjb.js} +2 -2
- package/dist/client/assets/{DialogTitle-Cwi7QOum.js → DialogTitle-7tvQYVxE.js} +2 -2
- package/dist/client/assets/{DiffCommentAnnotation-CnCPh4ot.js → DiffCommentAnnotation-DDBZcMFv.js} +3 -3
- package/dist/client/assets/DiffFileTree-BhSPT6m_.js +2 -0
- package/dist/client/assets/DiffPanel-D7QMWq_A.js +2 -0
- package/dist/client/assets/{DiffWorkerPoolProvider-C8TyWhmO.js → DiffWorkerPoolProvider-RcplgHGv.js} +3 -3
- package/dist/client/assets/{EnvironmentMachineIcon-CBS8TSmT.js → EnvironmentMachineIcon-DMZGa766.js} +2 -2
- package/dist/client/assets/{ExpandableText-CWbIeyDn.js → ExpandableText-DfY-qqRW.js} +3 -3
- package/dist/client/assets/{FieldControl-CWR3fEt0.js → FieldControl-C9UnFGZn.js} +2 -2
- package/dist/client/assets/{FileDiff-BiIVs0i-.js → FileDiff-BXlBWSxx.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-CXgaN8cb.js → FilePreviewPanel-CSKeM-xZ.js} +5 -5
- package/dist/client/assets/{FoldedSettingsSection-BimbnaOl.js → FoldedSettingsSection-BJm8ZaTy.js} +2 -2
- package/dist/client/assets/{FormContext-DyOeI4sU.js → FormContext-haYZgWIK.js} +2 -2
- package/dist/client/assets/{Icons-BlUgSxml.js → Icons-C12feMOO.js} +2 -2
- package/dist/client/assets/{KeybindingsSettings.logic-Dfld_XQx.js → KeybindingsSettings.logic-DhXMdk5O.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-ZE4gAFj0.js → NoProjectsHero-CDoSxJVV.js} +2 -2
- package/dist/client/assets/{PanelLayoutControls-x5a58Pdn.js → PanelLayoutControls-CCKUTh1H.js} +10 -10
- package/dist/client/assets/{PierreEntryIcon-DeBbijxO.js → PierreEntryIcon-7x50Pz_C.js} +2 -2
- package/dist/client/assets/{PreviewPanel-2vuw0skj.js → PreviewPanel-BEWZuH6o.js} +2 -2
- package/dist/client/assets/ProjectDefaultsSettings-BRRQlvgR.js +2 -0
- package/dist/client/assets/{ProjectFavicon-BhJj4G_1.js → ProjectFavicon-ExMHrN16.js} +3 -3
- package/dist/client/assets/ProjectIconPickerDialog-DXSyEGg8.js +2 -0
- package/dist/client/assets/{ProjectMonogram-BgobvHld.js → ProjectMonogram-um8sYqIi.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-CJSJcjB9.js → ProviderAuthTerminal-Tw3kH5vc.js} +2 -2
- package/dist/client/assets/ProviderModelPicker-CpgHpUCG.js +2 -0
- package/dist/client/assets/{ProviderSettingsForm-Dh_vspcE.js → ProviderSettingsForm-CaNO8FYK.js} +2 -2
- package/dist/client/assets/{PullRequestCodeTab-Do36z71f.js → PullRequestCodeTab-DwqL4aAJ.js} +3 -3
- package/dist/client/assets/{ReadOnlySourcePreview-BfLIaC5x.js → ReadOnlySourcePreview-Cw6lfMjA.js} +2 -2
- package/dist/client/assets/{RedactedSensitiveText-D5aX1wQs.js → RedactedSensitiveText-citJBx4E.js} +2 -2
- package/dist/client/assets/{RenderErrorBoundary-DTEG6arv.js → RenderErrorBoundary-D21mPr47.js} +2 -2
- package/dist/client/assets/ScheduledTasksSettings-BXOG7dPV.js +4 -0
- package/dist/client/assets/ScopedSwitch-2MBm4Srn.js +2 -0
- package/dist/client/assets/{SettingsPanels-Betza2Al.js → SettingsPanels-DjzXV7Dm.js} +7 -7
- package/dist/client/assets/{SettingsPanels.logic-Dn2Jcxyy.js → SettingsPanels.logic-DpdMN_lX.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-CAaNSKvu.js → SettingsScopeNotice-CdNfxmW3.js} +2 -2
- package/dist/client/assets/{T3ConnectAccountPages-DEqOE3hy.js → T3ConnectAccountPages-C6qHq26m.js} +2 -2
- package/dist/client/assets/{T3ConnectSidebarSignIn-C4jpzdPh.js → T3ConnectSidebarSignIn-DewmE1PI.js} +2 -2
- package/dist/client/assets/ThemeEditorPanel-aEsLfkYx.js +5 -0
- package/dist/client/assets/{ThreadTerminalDrawer-Z7ArIuq0.js → ThreadTerminalDrawer-C1NDkTSs.js} +4 -4
- package/dist/client/assets/{UsageLimits-7-_nKQT_.js → UsageLimits-BUS51Bjr.js} +2 -2
- package/dist/client/assets/{Virtualizer-EvXC5PAR.js → Virtualizer-B2BG0GB9.js} +2 -2
- package/dist/client/assets/WorkspaceBreadcrumb-DX3xH6tC.js +2 -0
- package/dist/client/assets/WorkspacePageContainer-BFo6qTGJ.js +2 -0
- package/dist/client/assets/{WorkspacePageHeader-DB9Z9OtR.js → WorkspacePageHeader-BCZXPSxj.js} +2 -2
- package/dist/client/assets/_chat-B3j3XTUJ.js +58 -0
- package/dist/client/assets/{_chat.index-CTfxLY4F.js → _chat.index-7o1_qjfU.js} +2 -2
- package/dist/client/assets/{_chat.new-B_FNmP8f.js → _chat.new-W2E0MZ4y.js} +3 -3
- package/dist/client/assets/_chat.pull-requests-DnQ-MKRG.js +2 -0
- package/dist/client/assets/{abnfDiagram-VCTEODGH-Du15a8Yu.js → abnfDiagram-VCTEODGH-DJY5x2uS.js} +2 -2
- package/dist/client/assets/{alert-DUQHh6vz.js → alert-yllEf0yh.js} +2 -2
- package/dist/client/assets/app-window-D2LBv8RE.js +2 -0
- package/dist/client/assets/architecture-7GRP2DOG-nO5xG-8k.js +1 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-DhXH9Bsf.js → architectureDiagram-5GKGNRK7-6YiKazHv.js} +2 -2
- package/dist/client/assets/arrow-left-yEW5WFYj.js +1 -0
- package/dist/client/assets/arrow-right-BzVZfSb7.js +1 -0
- package/dist/client/assets/arrow-up-down-DjL7trCL.js +1 -0
- package/dist/client/assets/assets-BxSVuao2.js +2 -0
- package/dist/client/assets/bell-ue7A6JFg.js +1 -0
- package/dist/client/assets/{blockDiagram-I7D4REHJ-CZ4PIO64.js → blockDiagram-I7D4REHJ-D_EURhbV.js} +2 -2
- package/dist/client/assets/blocks-De0WwZYY.js +1 -0
- package/dist/client/assets/bot-_T9E-nkd.js +1 -0
- package/dist/client/assets/brain-CQYem3Oz.js +2 -0
- package/dist/client/assets/{browserHistoryStore-D6A_83JY.js → browserHistoryStore-B-t3Vc_Z.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-BuFHp5RQ.js → browserLinkTarget-CiQS1wUg.js} +2 -2
- package/dist/client/assets/{c4Diagram-7LVT6UL2-tMXW_Jy8.js → c4Diagram-7LVT6UL2-CmfPrrIj.js} +2 -2
- package/dist/client/assets/calendar-clock-DXFNSdXM.js +1 -0
- package/dist/client/assets/channel-BE0ymtNV.js +2 -0
- package/dist/client/assets/chart-no-axes-column-Dx_cyfN9.js +1 -0
- package/dist/client/assets/checkbox-CIeee0-J.js +2 -0
- package/dist/client/assets/chromium-BusoCgri.js +2 -0
- package/dist/client/assets/{chunk-4HAMMTFA-gISFFADw.js → chunk-4HAMMTFA-BdvKUuii.js} +2 -2
- package/dist/client/assets/{chunk-75Z2AOVW-iWd1WVXJ.js → chunk-75Z2AOVW-DXz8BlJz.js} +2 -2
- package/dist/client/assets/{chunk-DU6HZSFF-hD69jU_T.js → chunk-DU6HZSFF-ebFBoLTT.js} +2 -2
- package/dist/client/assets/{chunk-F27PBJKO-DnDFIjHp.js → chunk-F27PBJKO-B1MlVcaX.js} +2 -2
- package/dist/client/assets/{chunk-GMAD6QVW-Chr0sR5B.js → chunk-GMAD6QVW-CEXqem_-.js} +2 -2
- package/dist/client/assets/{chunk-GVQU2GXP-D84Xc6Vy.js → chunk-GVQU2GXP-wsgr7T0u.js} +2 -2
- package/dist/client/assets/{chunk-IMKFNOWR-DOdemMNR.js → chunk-IMKFNOWR-Daxc_3WP.js} +2 -2
- package/dist/client/assets/{chunk-L3NEJ4N5-CILnb7VE.js → chunk-L3NEJ4N5-C4NnipZ0.js} +2 -2
- package/dist/client/assets/{chunk-OSK3NFVY-Bxpu9Oo4.js → chunk-OSK3NFVY-DDd2Ay5_.js} +2 -2
- package/dist/client/assets/{chunk-P2QGCYS3-75l6wJUu.js → chunk-P2QGCYS3-I9iEYMEJ.js} +2 -2
- package/dist/client/assets/{chunk-POPQ4Y6H-jYZ1RdM0.js → chunk-POPQ4Y6H-Cgwl0wkZ.js} +2 -2
- package/dist/client/assets/{chunk-PWAF6VOD-DtONZJrC.js → chunk-PWAF6VOD-kBB0Jquc.js} +2 -2
- package/dist/client/assets/{chunk-SHT3W25Y-NY6-WqgC.js → chunk-SHT3W25Y-gtUoMWd0.js} +2 -2
- package/dist/client/assets/{chunk-SVP7TREG-CGG6Z85U.js → chunk-SVP7TREG-CbL5vJ0z.js} +2 -2
- package/dist/client/assets/{chunk-TICWLB2K-DzB7PtXF.js → chunk-TICWLB2K-CMgrptzc.js} +2 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-YRduSbl9.js +2 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-YRduSbl9.js +2 -0
- package/dist/client/assets/{collapsible-CLujF6F7.js → collapsible-C3qenpEI.js} +2 -2
- package/dist/client/assets/{color-picker-BG3Rpy98.js → color-picker-Cj2frYnP.js} +2 -2
- package/dist/client/assets/{combobox-Cx4FP7Bk.js → combobox-DixSlhgy.js} +2 -2
- package/dist/client/assets/{command-CVKxjYiJ.js → command-B45LRbFT.js} +2 -2
- package/dist/client/assets/{connect-DeTNO4tO.js → connect-CYM5DIkv.js} +2 -2
- package/dist/client/assets/{connect-agent-CTLxG7lp.js → connect-agent-nn3QLMb4.js} +2 -2
- package/dist/client/assets/corner-left-up-DohBMTTI.js +1 -0
- package/dist/client/assets/{cynefin-OW5HDTMX-C3y7gjYM.js → cynefin-OW5HDTMX-CmLjrFzm.js} +1 -1
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-DEFegOUv.js → cynefinDiagram-5FMLGOSQ-xQBevUIj.js} +2 -2
- package/dist/client/assets/{dagre-GXQ25YYZ-C3YHw-ZL.js → dagre-GXQ25YYZ-Ck8BwJaT.js} +2 -2
- package/dist/client/assets/device-BRhRKysY.js +2 -0
- package/dist/client/assets/{diagram-S7CK7UJ4-B04fDyJ1.js → diagram-S7CK7UJ4-Bl0e661x.js} +2 -2
- package/dist/client/assets/{diagram-UQ7AKVKN-DJ5yQdqn.js → diagram-UQ7AKVKN-TO9a3uQI.js} +2 -2
- package/dist/client/assets/{diagram-VSXAHHWV-DwQn4LJH.js → diagram-VSXAHHWV-BZ7xQ8wz.js} +2 -2
- package/dist/client/assets/{diagram-VX7I27RA-BFeEJB2L.js → diagram-VX7I27RA-C4cA30qa.js} +2 -2
- package/dist/client/assets/{diagram-Z3DM3KII-DjNPPgna.js → diagram-Z3DM3KII-Hl3MmqeP.js} +2 -2
- package/dist/client/assets/{dialog-BBidAZq_.js → dialog-DhJeevKt.js} +2 -2
- package/dist/client/assets/{diffRendering-BcgWZBc6.js → diffRendering-QVeYVRDU.js} +2 -2
- package/dist/client/assets/{discovery-list-BOhsy2yk.js → discovery-list-VoilmsP7.js} +2 -2
- package/dist/client/assets/{dist-D-bAcBTo.js → dist-CxgL3edJ.js} +3 -3
- package/dist/client/assets/download-B587khDU.js +1 -0
- package/dist/client/assets/{draft-input-Dk-JXf0v.js → draft-input-BrEXLyuj.js} +2 -2
- package/dist/client/assets/{duoViewer-DELDCd_3.js → duoViewer-D-_bD3-L.js} +2 -2
- package/dist/client/assets/dynamic-R3OtJZHK.js +3 -0
- package/dist/client/assets/earth-26IFbzWm.js +1 -0
- package/dist/client/assets/{ebnfDiagram-PWID7BFC-R_zFp3Q4.js → ebnfDiagram-PWID7BFC-Bo_ALmgV.js} +2 -2
- package/dist/client/assets/ellipsis-BScTTB_n.js +1 -0
- package/dist/client/assets/{embeddedScripts-S6heIv6s.js → embeddedScripts-DKKE5k7D.js} +2 -2
- package/dist/client/assets/{empty-B3wHlMsI.js → empty-uoiaKPHo.js} +2 -2
- package/dist/client/assets/entities-DNKDCsf2.js +2 -0
- package/dist/client/assets/{erDiagram-RLTQ6QDP-DgSVOlTI.js → erDiagram-RLTQ6QDP-B38FLl2U.js} +2 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-6XFarcvj.js +1 -0
- package/dist/client/assets/eye-DTlv8Vet.js +1 -0
- package/dist/client/assets/file-search-gFHOfI6S.js +1 -0
- package/dist/client/assets/{fileLinks-M_i1pQMr.js → fileLinks-VfyxNu8P.js} +2 -2
- package/dist/client/assets/{fileTreeExpansion-BoH-LpwD.js → fileTreeExpansion-BfMZMaRV.js} +2 -2
- package/dist/client/assets/flowDiagram-HODETNUW-DQXavjl4.js +1 -0
- package/dist/client/assets/fold-vertical-BNQMJ6gu.js +1 -0
- package/dist/client/assets/folder-git-2-6ON-nxul.js +1 -0
- package/dist/client/assets/folder-open-Rja0vZjv.js +1 -0
- package/dist/client/assets/folder-plus-CfJ5c8wa.js +1 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-CsDp8eOV.js → ganttDiagram-EL5Y4UJY-Cj0Kstgh.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-y6l8uCrc.js → getDiffFileInput-XUe1xsym.js} +2 -2
- package/dist/client/assets/git-branch-BuWXMpmq.js +1 -0
- package/dist/client/assets/{gitGraph-4MIJSDKK-ByZ8Ddcu.js → gitGraph-4MIJSDKK-C84uaaYZ.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-QkPoZOxP.js → gitGraphDiagram-WWUBYQGX-CvyimLfZ.js} +2 -2
- package/dist/client/assets/grip-vertical-qjSy6wXX.js +1 -0
- package/dist/client/assets/{guideRunStore-Ca6LGvkb.js → guideRunStore-DwmmS8D0.js} +2 -2
- package/dist/client/assets/hard-drive-DAxFba08.js +1 -0
- package/dist/client/assets/history-CrY611k2.js +1 -0
- package/dist/client/assets/house-CKS51Vx8.js +1 -0
- package/dist/client/assets/{htmlRender-Bs_dTcPz.js → htmlRender-DRfZ8nFp.js} +2 -2
- package/dist/client/assets/index-G0rP4C-v.js +3 -0
- package/dist/client/assets/{info-A6RAGUB7-DWgAQmsU.js → info-A6RAGUB7-AXJa674d.js} +1 -1
- package/dist/client/assets/{infoDiagram-27XIBGKW-DqBsTg-0.js → infoDiagram-27XIBGKW-CgaIIar7.js} +2 -2
- package/dist/client/assets/{input-group-13zF6rZl.js → input-group-DIOgVvbV.js} +2 -2
- package/dist/client/assets/{input-BOT1WFGI.js → input-u5qjnfMr.js} +2 -2
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-DhvmZSIn.js → ishikawaDiagram-5VMMS53U-DSDzMD_t.js} +2 -2
- package/dist/client/assets/{journeyDiagram-3NMN7TZE-sBAsW8ZW.js → journeyDiagram-3NMN7TZE-Be6o5a7O.js} +2 -2
- package/dist/client/assets/{kanban-definition-UXKFOSKX-7pB8050L.js → kanban-definition-UXKFOSKX-Fpr0ne16.js} +2 -2
- package/dist/client/assets/kbd-D4mDfHPa.js +2 -0
- package/dist/client/assets/{keybindings-B4uuYLfE.js → keybindings-CzL-fWkh.js} +2 -2
- package/dist/client/assets/keyboard-Y7zJXIRo.js +1 -0
- package/dist/client/assets/{lazyRouteComponent-C2UuNVTE.js → lazyRouteComponent-dLOOuQ-r.js} +2 -2
- package/dist/client/assets/{line-CYcVbD9r.js → line-BXhbrPh0.js} +2 -2
- package/dist/client/assets/link-CbhoiCa8.js +1 -0
- package/dist/client/assets/{link-DnyZixWB.js → link-YLDgrmSN.js} +2 -2
- package/dist/client/assets/{linkedPrompt-Cjzkkr18.js → linkedPrompt-E32o3H76.js} +2 -2
- package/dist/client/assets/list-Cq4wtMwR.js +1 -0
- package/dist/client/assets/main-D9nJEeym.css +2 -0
- package/dist/client/assets/main-D9z9rMK1.js +27 -0
- package/dist/client/assets/{mediaReference-DCRMHOD7.js → mediaReference-C-grVzJf.js} +2 -2
- package/dist/client/assets/{mediaSource-C-YyAgza.js → mediaSource-CxVHZYDj.js} +2 -2
- package/dist/client/assets/{mermaid-parser.core-CUhkd3Km.js → mermaid-parser.core-BFPy42Wg.js} +4 -4
- package/dist/client/assets/{mermaid.core-7L34oYGP.js → mermaid.core-zK2u82e-.js} +5 -5
- package/dist/client/assets/message-circle-question-mark-BwzHSg4C.js +1 -0
- package/dist/client/assets/message-square-DcSgYDZ6.js +1 -0
- package/dist/client/assets/message-square-dashed-Cu56tC0F.js +1 -0
- package/dist/client/assets/{mindmap-definition-YA3MSWOX-CpfzOIsM.js → mindmap-definition-YA3MSWOX-RzkTvFrT.js} +2 -2
- package/dist/client/assets/mouse-pointer-2-DxhF1Woc.js +1 -0
- package/dist/client/assets/number-field-BLz8W5SU.js +2 -0
- package/dist/client/assets/{observeResize-CK9qVTLF.js → observeResize-WQaFQjbx.js} +2 -2
- package/dist/client/assets/{onboarding-DWVdcMTo.js → onboarding-DNafmm6s.js} +2 -2
- package/dist/client/assets/{openFileInPreview-DsWLDsnf.js → openFileInPreview-l6IXWIxV.js} +2 -2
- package/dist/client/assets/{p4ProjectFile-DVeZFEli.js → p4ProjectFile-BzCYJ8I-.js} +2 -2
- package/dist/client/assets/{packet-AYTQ26CC-TJIgXg7Z.js → packet-AYTQ26CC-rDYSbNWh.js} +1 -1
- package/dist/client/assets/{pair-Ds7MhGzA.js → pair-nG9A6oxp.js} +2 -2
- package/dist/client/assets/palette-B79srcx1.js +1 -0
- package/dist/client/assets/panel-left-Bp59PK2R.js +1 -0
- package/dist/client/assets/{panel-tab-close-button-CeVf2Cp1.js → panel-tab-close-button-B2GW1bDy.js} +2 -2
- package/dist/client/assets/panels-top-left-CC3HCiIs.js +1 -0
- package/dist/client/assets/{pegDiagram-XKGWAZYB-BWjyJv0r.js → pegDiagram-XKGWAZYB-8wodyYDi.js} +2 -2
- package/dist/client/assets/{phoneViewer-4yzlTfRU.js → phoneViewer-Bei8FsYJ.js} +2 -2
- package/dist/client/assets/{pie-WAS4IAKB-DI1xrBNC.js → pie-WAS4IAKB-Ce0_zpeP.js} +1 -1
- package/dist/client/assets/{pieDiagram-E7YTZNPT-D5BJ4dMD.js → pieDiagram-E7YTZNPT-C3QJYWCY.js} +2 -2
- package/dist/client/assets/{pierre-icons-C4_Is1e6.js → pierre-icons-CsjmRq9p.js} +2 -2
- package/dist/client/assets/popover-6BYEGLLK.js +2 -0
- package/dist/client/assets/{preview-BXSjnvc2.js → preview-BpTu6A2K.js} +2 -2
- package/dist/client/assets/{preview-ChiUlq6M.js → preview-DFDpDpup.js} +2 -2
- package/dist/client/assets/{previewMiniPlayerStore-BWBB4WZZ.js → previewMiniPlayerStore-BfMwexwO.js} +2 -2
- package/dist/client/assets/primary-Cc8Am8Ju.js +2 -0
- package/dist/client/assets/primaryCloudLinkState-N7pLty-_.js +2 -0
- package/dist/client/assets/{projectFilesQueryState-DLmHVuBp.js → projectFilesQueryState-CrGsc81w.js} +2 -2
- package/dist/client/assets/projectScriptEditor-RR3KkKhh.js +2 -0
- package/dist/client/assets/{pullRequestDetail.logic-CiIqeGLs.js → pullRequestDetail.logic-CE7fVOsp.js} +4 -4
- package/dist/client/assets/{pullRequestReviewStore-Ckm9o--D.js → pullRequestReviewStore-BHEIYvsP.js} +2 -2
- package/dist/client/assets/pullRequests-KhjrMCa0.js +2 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-USH3mFeD.js → quadrantDiagram-AXDQQJYC-Cqx4Dcqi.js} +2 -2
- package/dist/client/assets/queries-Cn1FJB1_.js +2 -0
- package/dist/client/assets/{query-DG-FU00d.js → query-CK8MOmXr.js} +2 -2
- package/dist/client/assets/{radar-RG4KPBEZ-BgwqseQY.js → radar-RG4KPBEZ-DsccxBWq.js} +1 -1
- package/dist/client/assets/radio-group-CM6Ra-QS.js +2 -0
- package/dist/client/assets/{railroad-74A4TZTK-lU1hozFq.js → railroad-74A4TZTK-B-UN2mSQ.js} +1 -1
- package/dist/client/assets/railroad-abnf-HS5TGJTU-CIxA0Vp4.js +1 -0
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-Czs81Kdn.js +1 -0
- package/dist/client/assets/railroad-peg-WCYAUIDC-B7O8OPsa.js +1 -0
- package/dist/client/assets/{railroadDiagram-O6MQD6OU-BX2DBjFX.js → railroadDiagram-O6MQD6OU-B_PdDy5r.js} +2 -2
- package/dist/client/assets/{renderScheduler-e5LS9_r8.js → renderScheduler-D1ml_j--.js} +2 -2
- package/dist/client/assets/{requirementDiagram-BXWQKSXE-Bp2BwkCA.js → requirementDiagram-BXWQKSXE-CKZ6HpQu.js} +2 -2
- package/dist/client/assets/{rightPanelStore-Dnc28mSJ.js → rightPanelStore-6LLb3GY0.js} +2 -2
- package/dist/client/assets/rotate-ccw-dcahmZQ2.js +1 -0
- package/dist/client/assets/rotate-cw-CIep6yNT.js +1 -0
- package/dist/client/assets/runtime-BVgeNXTV.js +2 -0
- package/dist/client/assets/runtime-CCr9UADV.js +6 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-BklNNjEB.js → sankeyDiagram-P5KCCOFB-BLF-VPcj.js} +2 -2
- package/dist/client/assets/scheduledTasksSettings.logic-ozIaTRfT.js +3 -0
- package/dist/client/assets/{scroll-area-Cj3OF_L_.js → scroll-area-CsrtHuL8.js} +2 -2
- package/dist/client/assets/{select-BDMo6Fqt.js → select-BiARKKgd.js} +2 -2
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-ufTHSg4p.js → sequenceDiagram-WJ2MYXX4-BpJGkNAx.js} +2 -2
- package/dist/client/assets/{server-DNo9AqHW.js → server-B26doYv6.js} +2 -2
- package/dist/client/assets/session-CQXL-cTI.js +2 -0
- package/dist/client/assets/session-logic-C0mrkZ0j.js +13 -0
- package/dist/client/assets/settings-2-C2dIdVBr.js +1 -0
- package/dist/client/assets/{settings-DxGY3RT5.js → settings-B5Dj0jhP.js} +2 -2
- package/dist/client/assets/settings-DiBtchmK.js +1 -0
- package/dist/client/assets/settings.appearance-Di8HZa2Q.js +2 -0
- package/dist/client/assets/settings.archived-By34XjbG.js +2 -0
- package/dist/client/assets/settings.computer-use-DuW-mXPO.js +2 -0
- package/dist/client/assets/settings.connections-BJuKrJhl.js +2 -0
- package/dist/client/assets/settings.decisions-BO8hfyYm.js +2 -0
- package/dist/client/assets/{settings.diagnostics-ByUhN_HC.js → settings.diagnostics-DSw1QN-I.js} +2 -2
- package/dist/client/assets/settings.general-RyWWgxqp.js +2 -0
- package/dist/client/assets/settings.integrations--N8SMmw7.js +2 -0
- package/dist/client/assets/{settings.keybindings-CITYXalz.js → settings.keybindings-BeQmUtKv.js} +2 -2
- package/dist/client/assets/{settings.open-source-licenses-CTznEYnQ.js → settings.open-source-licenses-BmgFSigO.js} +2 -2
- package/dist/client/assets/settings.projects--jLA2A5b.js +4 -0
- package/dist/client/assets/settings.providers-Cvt1-bmr.js +3 -0
- package/dist/client/assets/settings.scheduled-tasks-D5IG4nj_.js +2 -0
- package/dist/client/assets/settings.snap-shot-CUZNOX9M.js +2 -0
- package/dist/client/assets/{settings.source-control-BlHoYUC0.js → settings.source-control-R63Z9kEM.js} +2 -2
- package/dist/client/assets/{settings.storage-C4lRhJsq.js → settings.storage-J1kthey9.js} +2 -2
- package/dist/client/assets/settingsLayout-BzyY4qHt.js +3 -0
- package/dist/client/assets/shield-question-mark-l31p7uuJ.js +1 -0
- package/dist/client/assets/{sidebar-Bulbb3cX.js → sidebar-Dj0htG-5.js} +2 -2
- package/dist/client/assets/{sidebarProjectGrouping-DEvzxecx.js → sidebarProjectGrouping-DxzT7QCQ.js} +2 -2
- package/dist/client/assets/{skeleton-BFPHmDcq.js → skeleton-CtSxs1y1.js} +2 -2
- package/dist/client/assets/{sortable.esm-CHiRbsvI.js → sortable.esm-n8ce5zjO.js} +2 -2
- package/dist/client/assets/{sourceControl-DfhPxa0l.js → sourceControl-C3RSledt.js} +2 -2
- package/dist/client/assets/{spinner-rP6J82Of.js → spinner-BXr4m38K.js} +2 -2
- package/dist/client/assets/square-pen-CxvvUOOt.js +1 -0
- package/dist/client/assets/{standalone-page-BkHTM3MP.js → standalone-page-DSQDdNcR.js} +2 -2
- package/dist/client/assets/{stateDiagram-D77RDMKH-UnviM1_a.js → stateDiagram-D77RDMKH-DFGb4Fx3.js} +2 -2
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-BFcRJjAO.js +2 -0
- package/dist/client/assets/{swimlanes-42K2YHIH-CpD6LDbC.js → swimlanes-42K2YHIH-D0z9osG6.js} +2 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-B7z2b1Qv.js +9 -0
- package/dist/client/assets/{terminalSessions-C9u_KQdo.js → terminalSessions-3aynRXX1.js} +2 -2
- package/dist/client/assets/text-search-DsadxNJw.js +1 -0
- package/dist/client/assets/{textarea-D7qN_9_U.js → textarea-DZLyhzuZ.js} +2 -2
- package/dist/client/assets/{themePalette-au2ZXbqB.js → themePalette-BZeqG2Hu.js} +3 -3
- package/dist/client/assets/threadSort-BvhI6zOp.js +2 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-CNy-4Mtq.js → timeline-definition-24CTP7MA-oHM5IS4i.js} +2 -2
- package/dist/client/assets/toast-Bm36EaG6.js +2 -0
- package/dist/client/assets/{toggle-4i71sOFB.js → toggle-BzIEPTf7.js} +2 -2
- package/dist/client/assets/{toggle-group-BtpeJU3C.js → toggle-group-_C7nJPTT.js} +2 -2
- package/dist/client/assets/tooltip-Df-4YKs5.js +2 -0
- package/dist/client/assets/{treeView-Q6P3EWNA-fz73DkUg.js → treeView-Q6P3EWNA-ONHv8oqx.js} +1 -1
- package/dist/client/assets/{treemap-WGGIJYW6-CHp0lk61.js → treemap-WGGIJYW6-Go2hwkyn.js} +1 -1
- package/dist/client/assets/unfold-vertical--twzQtvn.js +1 -0
- package/dist/client/assets/{usage-BoYlRHNx.js → usage-B26GT0RK.js} +2 -2
- package/dist/client/assets/{usageAccess-BmfDNhp2.js → usageAccess-BNLOTFbF.js} +2 -2
- package/dist/client/assets/{usageFormat-DdjdHqj5.js → usageFormat-DKCO_wk0.js} +2 -2
- package/dist/client/assets/{usageShortcuts-RpypNfqZ.js → usageShortcuts-DxLRXv0W.js} +2 -2
- package/dist/client/assets/{use-atom-command-Bc7LgQy1.js → use-atom-command-CiEeUGsC.js} +2 -2
- package/dist/client/assets/{useAriaLabelledBy-B_3SmrJo.js → useAriaLabelledBy-CJjXf8Fd.js} +2 -2
- package/dist/client/assets/useHandleNewThread-DTz3ztCG.js +2 -0
- package/dist/client/assets/{useLocation-DaTcl6iI.js → useLocation-9axGTsrg.js} +2 -2
- package/dist/client/assets/useNavigate-BK_XZ1It.js +2 -0
- package/dist/client/assets/{useNavigateBack-C43_t49N.js → useNavigateBack-AIHPN0Oo.js} +2 -2
- package/dist/client/assets/{useParams-s9hrFQQQ.js → useParams-CCV3vN4E.js} +2 -2
- package/dist/client/assets/{usePermissionStatus-CCpQkKk1.js → usePermissionStatus-BnBF7CdE.js} +2 -2
- package/dist/client/assets/usePullRequestActions-aKrHzIiJ.js +3 -0
- package/dist/client/assets/{useRegisterFieldControl-BVraoamc.js → useRegisterFieldControl-Daf1iBkI.js} +2 -2
- package/dist/client/assets/useScopedModelAvailability-IKTxpeQL.js +2 -0
- package/dist/client/assets/useSettings-CckatJFa.js +3 -0
- package/dist/client/assets/{useT3ConnectAuthPrompt-D3ARnr92.js → useT3ConnectAuthPrompt-CK8il-7e.js} +2 -2
- package/dist/client/assets/utils-DmS758az.js +37 -0
- package/dist/client/assets/vcsRefInvalidation-lkYjTxah.js +2 -0
- package/dist/client/assets/{vennDiagram-4TSXK5OY-BBpGz6rf.js → vennDiagram-4TSXK5OY-BwVRZPOj.js} +2 -2
- package/dist/client/assets/{wardley-WFR3VGLG-M4Al1qCV.js → wardley-WFR3VGLG-CYl4h3U-.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-V-_mOkU8.js → wardleyDiagram-VM6X3IG4-yHMYVGhg.js} +2 -2
- package/dist/client/assets/{welcome-Bok5fRqT.js → welcome-CGBWwWzE.js} +2 -2
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-CZOR99Bj.js → xychartDiagram-S5SC5T6Z-Td7MQ_xN.js} +2 -2
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/AcpMcpStdioBridge-Ch5bMyss.mjs +0 -4
- package/dist/client/assets/ChatGptUsageButton-GxPReM3u.js +0 -2
- package/dist/client/assets/ChatMarkdown-DOdrk8tK.js +0 -65
- package/dist/client/assets/CodexSetupSection.logic-BpefaM8S.js +0 -2
- package/dist/client/assets/DevicePanel-wE6eEt9P.js +0 -2
- package/dist/client/assets/DiffFileTree-D3P47wbG.js +0 -2
- package/dist/client/assets/DiffPanel-cvlTVhB4.js +0 -2
- package/dist/client/assets/ProjectDefaultsSettings-Cu80XFdb.js +0 -2
- package/dist/client/assets/ProjectIconPickerDialog-Dwmv78OH.js +0 -2
- package/dist/client/assets/ProviderModelPicker-riIGf-PI.js +0 -2
- package/dist/client/assets/ScheduledTasksSettings-Cp8h_lNS.js +0 -4
- package/dist/client/assets/ScopedSwitch-CLAFXjj6.js +0 -2
- package/dist/client/assets/ThemeEditorPanel-BBkly3jP.js +0 -5
- package/dist/client/assets/WorkspaceBreadcrumb-fx0ZD7ay.js +0 -2
- package/dist/client/assets/WorkspacePageContainer-DFsaHi02.js +0 -2
- package/dist/client/assets/_chat-BerxDjpp.js +0 -58
- package/dist/client/assets/_chat.pull-requests-BwpBKnt3.js +0 -2
- package/dist/client/assets/app-window-CVIo0C1R.js +0 -2
- package/dist/client/assets/architecture-7GRP2DOG-CT4QCEL3.js +0 -1
- package/dist/client/assets/arrow-left-BiKrB-pT.js +0 -1
- package/dist/client/assets/arrow-right-DWAwZU0q.js +0 -1
- package/dist/client/assets/arrow-up-down-CfYH5v22.js +0 -1
- package/dist/client/assets/assets-DwywdbuJ.js +0 -2
- package/dist/client/assets/bell-C3RUvq1T.js +0 -1
- package/dist/client/assets/blocks-CoLUV11Q.js +0 -1
- package/dist/client/assets/bot-CjcO3F5G.js +0 -1
- package/dist/client/assets/brain-B_3rxsLd.js +0 -2
- package/dist/client/assets/calendar-clock-CJyS1C-x.js +0 -1
- package/dist/client/assets/channel-kQEwHVv9.js +0 -2
- package/dist/client/assets/chart-no-axes-column-B3ZqbY05.js +0 -1
- package/dist/client/assets/checkbox-Cw_SXlJ5.js +0 -2
- package/dist/client/assets/chromium-CvI58Z0o.js +0 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-BO_GIPO1.js +0 -2
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-BO_GIPO1.js +0 -2
- package/dist/client/assets/corner-left-up-D653FjvK.js +0 -1
- package/dist/client/assets/device-DrIICsXu.js +0 -2
- package/dist/client/assets/download-CNXPbBhc.js +0 -1
- package/dist/client/assets/dynamic-BRlOHH6g.js +0 -3
- package/dist/client/assets/earth-C1f0Qxwi.js +0 -1
- package/dist/client/assets/ellipsis-0J7zX441.js +0 -1
- package/dist/client/assets/entities-yblphBg3.js +0 -2
- package/dist/client/assets/eventmodeling-NTZA5JFV-bjJqzJYE.js +0 -1
- package/dist/client/assets/eye-CmsLgU-5.js +0 -1
- package/dist/client/assets/file-search-ClaIV60V.js +0 -1
- package/dist/client/assets/flowDiagram-HODETNUW-CsPXFMK4.js +0 -1
- package/dist/client/assets/fold-vertical-BMLbHh0a.js +0 -2
- package/dist/client/assets/folder-git-2-BxqGR5ht.js +0 -2
- package/dist/client/assets/folder-open-gQZmKQ4n.js +0 -1
- package/dist/client/assets/folder-plus-BVmedEeH.js +0 -1
- package/dist/client/assets/git-branch-Ba9jLbPu.js +0 -1
- package/dist/client/assets/grip-vertical-BmIJSASv.js +0 -1
- package/dist/client/assets/hard-drive-hWUfbbG9.js +0 -1
- package/dist/client/assets/history-jvN7Bdkc.js +0 -1
- package/dist/client/assets/house-ozmwce4p.js +0 -1
- package/dist/client/assets/index-FZqrCEhr.js +0 -3
- package/dist/client/assets/kbd-BR8-VeaN.js +0 -2
- package/dist/client/assets/keyboard-_YjrW4PX.js +0 -1
- package/dist/client/assets/link-BcMcYjHb.js +0 -1
- package/dist/client/assets/list-DEjg_Q5H.js +0 -1
- package/dist/client/assets/main-BQLZB-ZD.css +0 -2
- package/dist/client/assets/main-Ch0n0whg.js +0 -26
- package/dist/client/assets/message-circle-question-mark-DzWFFMDp.js +0 -1
- package/dist/client/assets/message-square-BqGKFtP8.js +0 -1
- package/dist/client/assets/message-square-dashed-FPkUUYSB.js +0 -1
- package/dist/client/assets/mouse-pointer-2-DbBU41il.js +0 -2
- package/dist/client/assets/number-field-DsVu9T6C.js +0 -2
- package/dist/client/assets/palette-JCVMAFVd.js +0 -1
- package/dist/client/assets/panel-left-STqObAvQ.js +0 -1
- package/dist/client/assets/panels-top-left-B90U_rdS.js +0 -1
- package/dist/client/assets/popover-UOfX8iZ4.js +0 -2
- package/dist/client/assets/primary-BubJSDIO.js +0 -2
- package/dist/client/assets/primaryCloudLinkState-CFnZkCiA.js +0 -2
- package/dist/client/assets/projectScriptEditor-_TwHfcHY.js +0 -2
- package/dist/client/assets/pullRequests-C0Gr2876.js +0 -2
- package/dist/client/assets/queries-DbiotSzd.js +0 -2
- package/dist/client/assets/radio-group-DhxCP5q0.js +0 -2
- package/dist/client/assets/railroad-abnf-HS5TGJTU-DRzBu_EH.js +0 -1
- package/dist/client/assets/railroad-ebnf-LZEXJU2U-BuQh-rCG.js +0 -1
- package/dist/client/assets/railroad-peg-WCYAUIDC-DH1f3-__.js +0 -1
- package/dist/client/assets/rotate-ccw-98iN1bsB.js +0 -1
- package/dist/client/assets/rotate-cw-DdW3sRx4.js +0 -1
- package/dist/client/assets/runtime-BUB2ex14.js +0 -2
- package/dist/client/assets/runtime-BoEmkhOe.js +0 -6
- package/dist/client/assets/scheduledTasksSettings.logic-Bk1lq8Ri.js +0 -3
- package/dist/client/assets/session-CyPECDtf.js +0 -2
- package/dist/client/assets/session-logic-BBZj8pNB.js +0 -13
- package/dist/client/assets/settings-2-C-KVP40_.js +0 -1
- package/dist/client/assets/settings-D62zpRkD.js +0 -1
- package/dist/client/assets/settings.appearance-C-MzWdtB.js +0 -2
- package/dist/client/assets/settings.archived-BZ0wU-2j.js +0 -2
- package/dist/client/assets/settings.connections-B-h_wi7q.js +0 -2
- package/dist/client/assets/settings.general-DodDmaXX.js +0 -2
- package/dist/client/assets/settings.integrations-Dq9yt9c-.js +0 -2
- package/dist/client/assets/settings.projects-Bj9oI9dE.js +0 -4
- package/dist/client/assets/settings.providers-BPb4TbH8.js +0 -3
- package/dist/client/assets/settings.scheduled-tasks-TxnTVd7r.js +0 -2
- package/dist/client/assets/settings.snap-shot-DZaxUAEE.js +0 -2
- package/dist/client/assets/settingsLayout-De_r3pyr.js +0 -3
- package/dist/client/assets/shield-question-mark-B5w7j5aC.js +0 -1
- package/dist/client/assets/square-pen-DYBPSam-.js +0 -1
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-CJW4DyfF.js +0 -2
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-Buz7ig8b.js +0 -9
- package/dist/client/assets/text-search-DrO_MCzY.js +0 -1
- package/dist/client/assets/threadSort-R2JvSO3D.js +0 -2
- package/dist/client/assets/toast-CIGvRti2.js +0 -2
- package/dist/client/assets/tooltip-Ciaezkl4.js +0 -2
- package/dist/client/assets/unfold-vertical-BLnEY4R7.js +0 -2
- package/dist/client/assets/useHandleNewThread-Csguf2GC.js +0 -2
- package/dist/client/assets/useNavigate-CnhAAl0Z.js +0 -2
- package/dist/client/assets/usePullRequestActions-CiF7znkV.js +0 -3
- package/dist/client/assets/useScopedModelAvailability-kFNRNx2C.js +0 -2
- package/dist/client/assets/useSettings-CNd8OM7A.js +0 -3
- package/dist/client/assets/utils-geC9CGP4.js +0 -37
- package/dist/client/assets/vcsRefInvalidation-DMpp-BNA.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{Sx as t,ma as n}from"./utils-geC9CGP4.js";import{t as r}from"./SettingsPanels-Betza2Al.js";var i=t(),a=e(n());function o(){let e=(0,i.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(r,{}),e[0]=t):t=e[0],t}export{o as component};
|
|
2
|
-
//# sourceMappingURL=settings.appearance-C-MzWdtB.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{$m as n,$o as r,Af as i,Cf as a,Df as o,Ef as s,Go as c,If as l,Im as u,Jb as d,Jn as f,Lo as p,Mf as m,Oc as h,Of as g,Qn as _,Sf as v,Sx as y,Tf as b,Vo as x,Wb as S,Wg as C,Wn as w,Wo as T,Xn as E,Xo as D,Zb as O,Zn as k,_f as A,af as j,al as M,ar as N,cv as P,er as ee,ff as te,fg as ne,hf as re,ip as ie,ir as ae,jf as oe,kf as se,lf as ce,ma as le,mf as ue,ng as F,nr as I,or as L,qb as de,rr as fe,sr as R,t as pe,vf as me,wf as he,yf as ge}from"./utils-geC9CGP4.js";import{t as _e}from"./chevron-right-NbahR9_s.js";import{t as ve}from"./chevrons-left-right-ellipsis-D2Qu5H2y.js";import{t as ye}from"./plus-Cr075-cy.js";import{t as be}from"./qr-code-D3ZNC-wH.js";import{t as xe}from"./route-CQ6wZzks.js";import{t as Se}from"./terminal-6kKaKv-Q.js";import{t as z}from"./x-CSwbgjBe.js";import{At as B,C as Ce,Dn as we,Dt as Te,Et as V,Ht as Ee,L as De,Ot as Oe,P as ke,Tt as Ae,U as je,Vt as Me,an as Ne,b as Pe,et as H,o as Fe}from"./runtime-BoEmkhOe.js";import{E as U,Et as W,F as Ie,S as Le,St as Re,Tt as ze,_ as Be,bt as Ve,t as He}from"./runtime-BUB2ex14.js";import{a as Ue,n as We,t as Ge}from"./tooltip-Ciaezkl4.js";import{a as G,c as Ke,o as qe,s as Je,t as Ye}from"./select-BDMo6Fqt.js";import{t as Xe}from"./spinner-rP6J82Of.js";import{i as K,p as Ze}from"./toast-CIGvRti2.js";import{A as Qe,D as $e,E as et,O as tt,b as q,c as nt,et as rt,s as it,v as at}from"./useSettings-CNd8OM7A.js";import{f as ot,h as st,s as ct}from"./server-DNo9AqHW.js";import{a as J,i as lt,n as ut,s as dt}from"./session-CyPECDtf.js";import{n as ft}from"./query-DG-FU00d.js";import{t as pt}from"./use-atom-command-Bc7LgQy1.js";import{n as Y}from"./toastHelpers-Dsph6LwL.js";import{i as mt,r as ht}from"./timestampFormat-wac2e_Jz.js";import{t as gt}from"./checkbox-Cw_SXlJ5.js";import{t as _t}from"./textarea-D7qN_9_U.js";import{_ as vt,b as yt,g as bt,h as xt,v as St,x as Ct,y as wt}from"./command-CVKxjYiJ.js";import{t as Tt}from"./input-BOT1WFGI.js";import{t as Et}from"./scroll-area-Cj3OF_L_.js";import{a as Dt,c as Ot,i as kt,l as At,n as jt,o as Mt,r as Nt,s as Pt,t as Ft}from"./dialog-BBidAZq_.js";import{n as It}from"./T3ConnectAccountPages-DEqOE3hy.js";import{a as Lt,i as Rt,o as zt,r as Bt,t as Vt}from"./empty-B3wHlMsI.js";import{t as Ht}from"./AnimatedHeight-BwS0L5jd.js";import{C as Ut,S as Wt,g as Gt,v as Kt}from"./keybindings-B4uuYLfE.js";import{i as qt,o as Jt,t as Yt}from"./popover-UOfX8iZ4.js";import{n as Xt,t as Zt}from"./EnvironmentMachineIcon-CBS8TSmT.js";import{a as Qt,b as $t,c as en,h as tn,i as nn,l as rn,m as an,n as on,o as sn,p as cn,s as ln,t as un,u as dn}from"./sortable.esm-CHiRbsvI.js";import{r as fn,t as pn}from"./alert-DUQHh6vz.js";import{a as mn,i as hn,s as gn,u as _n}from"./settingsLayout-De_r3pyr.js";import{t as vn}from"./ConnectionStatusDot-BvfbN2Tp.js";import{a as yn,n as X,o as bn,s as xn,t as Sn}from"./primary-BubJSDIO.js";import{n as Cn,t as wn}from"./onboarding-DWVdcMTo.js";import{$n as Tn,Ar as En,Cr as Dn,Dr as On,Er as kn,Jn as An,Or as jn,Qn as Mn,Sr as Nn,T as Pn,Tr as Fn,Xn as In,Yn as Ln,Zn as Rn,an as zn,bi as Bn,br as Vn,cr as Hn,dr as Un,er as Wn,in as Gn,jo as Kn,kr as qn,lr as Jn,nn as Yn,on as Xn,or as Zn,qn as Qn,ur as $n,wa as er,wr as tr,xi as nr,yo as rr,yr as ir}from"./main-Ch0n0whg.js";import{t as ar}from"./FoldedSettingsSection-BimbnaOl.js";var Z=y(),or=[{scope:a,title:`View environment`,description:`Read threads, status, checkpoints, and configuration.`},{scope:v,title:`Operate tasks`,description:`Start, update, and stop tasks.`},{scope:g,title:`Change environment settings`,description:`Edit environment preferences and keybindings.`},{scope:b,title:`Manage providers`,description:`Configure, install, sign in to, and update providers and usage sources.`},{scope:A,title:`Maintain environment`,description:`Update the server and control environment processes.`},{scope:he,title:`Control previews`,description:`Open browser previews and host browser automation.`},{scope:re,title:`View diagnostics and usage`,description:`Read process diagnostics, resource history, and usage totals.`},{scope:m,title:`View terminals`,description:`Read existing terminal output and status.`},{scope:oe,title:`Use terminals`,description:`Create terminals and send input to running shells.`},{scope:se,title:`Change source control`,description:`Commit, push, manage branches and repositories, and change pull requests.`},{scope:me,title:`Read files`,description:`Browse host files, search workspaces, and inspect local changes.`},{scope:ge,title:`Write files`,description:`Edit workspace files and save plans to disk.`},{scope:te,title:`View access`,description:`Inspect pairing links and authorized clients.`},{scope:ue,title:`Manage access`,description:`Issue and revoke credentials for other clients.`},{scope:s,title:`View relay`,description:`Inspect managed relay connectivity.`},{scope:o,title:`Manage relay`,description:`Change managed tunnel connectivity.`}],Q=e(le(),1);function sr(e){let t=(0,Z.c)(4),{environmentId:n,connected:r,routeContext:i}=e,a=i!==void 0&&i,o=J(n),s;return t[0]!==r||t[1]!==a||t[2]!==o?(s=r&&!o.hasError&&!o.isPending&&o.data?.authenticated?(0,Q.jsxs)(`div`,{className:`space-y-3 py-3 text-xs`,children:[(0,Q.jsx)(`p`,{className:`text-muted-foreground`,children:a?`These permissions apply to your active route. Other routes may have different permissions.`:`These permissions apply to this client’s current connection.`}),(0,Q.jsx)(`ul`,{className:`grid gap-x-6 gap-y-2 sm:grid-cols-2`,children:or.map(e=>{let{scope:t,title:n}=e;return(0,Q.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:l(o.data,t)?`Allowed`:`Not granted`})]},t)})})]}):(0,Q.jsx)(`p`,{className:`py-3 text-xs text-muted-foreground`,children:`Permissions not checked. Connect to this environment to view this session’s permissions.`}),t[0]=r,t[1]=a,t[2]=o,t[3]=s):s=t[3],s}var $=e(t(),1);function cr(e,t){let n=new URL(e);return n.pathname=`/pair`,W(n,t).toString()}function lr(e,t){return new URL(e).protocol===`https:`?Le({host:e,token:t}):null}function ur(){let e=(0,Z.c)(48),t=window.desktopBridge?.setLocalEnvironmentEnabled,[n]=(0,$.useState)(dr),[r,i]=(0,$.useState)(!1),[a,o]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null);if(!t)return null;let l;e[0]===n?l=e[1]:(l=async()=>{o(!0),c(null);try{await t(!n)}catch(e){let t=e;c(t instanceof Error?t.message:`Couldn't change this setting.`),o(!1)}},e[0]=n,e[1]=l);let u=l,d;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=Zn(`local-environment`),e[2]=d):d=e[2];let f=n?`Run agents on this computer. Turn off to use P4 Code only with remote environments.`:`Turned off. Agents only run in remote environments.`,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>i(!0),e[3]=p):p=e[3];let m;e[4]!==n||e[5]!==a?(m=(0,Q.jsx)(er,{checked:n,disabled:a,onCheckedChange:p,"aria-label":`Local environment`}),e[4]=n,e[5]=a,e[6]=m):m=e[6];let h;e[7]!==f||e[8]!==m?(h=(0,Q.jsx)(mn,{...d,description:f,control:m}),e[7]=f,e[8]=m,e[9]=h):h=e[9];let g;e[10]===a?g=e[11]:(g=e=>{a||(i(e),e||c(null))},e[10]=a,e[11]=g);let _=n?`Turn off local environment?`:`Turn on local environment?`,v;e[12]===_?v=e[13]:(v=(0,Q.jsx)(En,{children:_}),e[12]=_,e[13]=v);let y=n?`P4 Code will restart without running a server on this computer. Any agents and terminals running here will stop, and other devices will no longer be able to connect to this computer. Your projects, history, and remote environments are unaffected.`:`P4 Code will restart and start running a server on this computer again.`,b;e[14]===y?b=e[15]:(b=(0,Q.jsx)(kn,{children:y}),e[14]=y,e[15]=b);let x;e[16]!==b||e[17]!==v?(x=(0,Q.jsxs)(jn,{children:[v,b]}),e[16]=b,e[17]=v,e[18]=x):x=e[18];let S;e[19]===s?S=e[20]:(S=s?(0,Q.jsx)(`p`,{className:`px-6 pb-4 text-sm text-destructive`,children:s}):null,e[19]=s,e[20]=S);let C;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(L,{variant:`outline`}),e[21]=C):C=e[21];let w;e[22]===a?w=e[23]:(w=(0,Q.jsx)(Fn,{disabled:a,render:C,children:`Cancel`}),e[22]=a,e[23]=w);let T=n?`destructive`:`default`,E;e[24]===u?E=e[25]:(E=()=>void u(),e[24]=u,e[25]=E);let D;e[26]!==n||e[27]!==a?(D=a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xe,{size:`sm`}),`Restarting…`]}):n?`Restart and turn off`:`Restart and turn on`,e[26]=n,e[27]=a,e[28]=D):D=e[28];let O;e[29]!==a||e[30]!==T||e[31]!==E||e[32]!==D?(O=(0,Q.jsx)(L,{variant:T,disabled:a,onClick:E,children:D}),e[29]=a,e[30]=T,e[31]=E,e[32]=D,e[33]=O):O=e[33];let k;e[34]!==w||e[35]!==O?(k=(0,Q.jsxs)(On,{children:[w,O]}),e[34]=w,e[35]=O,e[36]=k):k=e[36];let A;e[37]!==x||e[38]!==S||e[39]!==k?(A=(0,Q.jsxs)(qn,{children:[x,S,k]}),e[37]=x,e[38]=S,e[39]=k,e[40]=A):A=e[40];let j;e[41]!==r||e[42]!==A||e[43]!==g?(j=(0,Q.jsx)(tr,{open:r,onOpenChange:g,children:A}),e[41]=r,e[42]=A,e[43]=g,e[44]=j):j=e[44];let M;return e[45]!==j||e[46]!==h?(M=(0,Q.jsxs)(Q.Fragment,{children:[h,j]}),e[45]=j,e[46]=h,e[47]=M):M=e[47],M}function dr(){return!Ce()}function fr(e){return e.serverConfig===null?`Connect to this environment to change its icon.`:e.serverConfig.environment.capabilities.environmentIcon===!0?e.operateAccess===`granted`?null:`Your session on this environment cannot change its settings.`:`This environment's server is too old to keep an icon. Update it to choose one.`}function pr(e){let t=(0,Z.c)(27),{environmentId:n,serverConfig:r}=e,i=q(n),a=lt(n,`settings:write`)?`granted`:`denied`,o;t[0]!==a||t[1]!==r?(o=fr({serverConfig:r,operateAccess:a}),t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c=r?.environment.platform.machine??`server`,l;t[3]===r?l=t[4]:(l=M(r),t[3]=r,t[4]=l);let u=l,d;t[5]===u?d=t[6]:(d=(0,Q.jsxs)(ae,{children:[(0,Q.jsx)(Xt,{kind:u}),`Icon`]}),t[5]=u,t[6]=d);let p;t[7]===s?p=t[8]:(p=s===null?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(f,{disabled:!0,className:`whitespace-normal`,children:s}),(0,Q.jsx)(ee,{})]}),t[7]=s,t[8]=p);let m;t[9]!==c||t[10]!==s||t[11]!==i?(m=e=>{s===null&&ce(e)&&i({environmentIcon:e===c?null:e})},t[9]=c,t[10]=s,t[11]=i,t[12]=m):m=t[12];let h;t[13]!==c||t[14]!==s||t[15]!==r?.environment?(h=j.map(e=>(0,Q.jsx)(_,{value:e,disabled:s!==null,children:(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(Xt,{kind:e,className:`size-3.5 shrink-0`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:Zt[e]}),e===c?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:r?.environment.platform.machine?`detected`:`default`}):null]})},e)),t[13]=c,t[14]=s,t[15]=r?.environment,t[16]=h):h=t[16];let g;t[17]!==u||t[18]!==m||t[19]!==h?(g=(0,Q.jsx)(k,{value:u,onValueChange:m,children:h}),t[17]=u,t[18]=m,t[19]=h,t[20]=g):g=t[20];let v;t[21]!==p||t[22]!==g?(v=(0,Q.jsxs)(fe,{children:[p,g]}),t[21]=p,t[22]=g,t[23]=v):v=t[23];let y;return t[24]!==d||t[25]!==v?(y=(0,Q.jsxs)(I,{children:[d,v]}),t[24]=d,t[25]=v,t[26]=y):y=t[26],y}function mr(e){let t=(0,Z.c)(31),{environment:n,onAddRoute:r}=e,i=Oe(n.entry),a=i.map(gr),[o,s]=(0,$.useState)(null),c=o!==null&&o.length===a.length&&o.some((e,t)=>e!==a[t])?[...o]:a,l=new Map(i.map(hr)),u=c.flatMap(e=>l.get(e)??[]),d=dt(n.environmentId),f;t[0]!==n.connection||t[1]!==d._tag||t[2]!==d.value?(f=d._tag===`Some`&&n.connection.phase===`connected`?V(d.value.target):null,t[0]=n.connection,t[1]=d._tag,t[2]=d.value,t[3]=f):f=t[3];let p=f,m=pt(st.reorderRoutes,`Reorder routes`),h=pt(st.removeRoute,`Remove route`),g;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(g={activationConstraint:{distance:4}},t[4]=g):g=t[4];let _;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(_={coordinateGetter:nn},t[5]=_):_=t[5];let v=an(cn(rn,g),cn(en,_)),y;t[6]!==n.environmentId||t[7]!==h?(y=async e=>{let t=Ae(e);await rt(`Remove ${Te(e)} route?${t===null?``:`\n${t}`}`,{variant:`destructive`})===!0&&await h({environmentId:n.environmentId,routeId:V(e.target)})},t[6]=n.environmentId,t[7]=h,t[8]=y):y=t[8];let b=y,x=e=>{if(e.over===null||e.active.id===e.over.id)return;let t=on(c,c.indexOf(String(e.active.id)),c.indexOf(String(e.over.id)));s(t),m({environmentId:n.environmentId,routeIds:t}).then(e=>{e._tag===`Failure`&&s(null)})},S=ln,C=dn,w;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=[nr,Bn],t[9]=w):w=t[9];let T=un,E=sn,D=`Routes to ${n.label}, preferred first`,O=u.map((e,t)=>(0,Q.jsx)(_r,{route:e,position:t+1,inUse:V(e.target)===p,removable:u.length>1&&!B(e),onRemove:()=>void b(e)},V(e.target))),k;t[10]!==O||t[11]!==D?(k=(0,Q.jsx)(`ol`,{"aria-label":D,children:O}),t[10]=O,t[11]=D,t[12]=k):k=t[12];let A;t[13]!==T||t[14]!==c||t[15]!==k||t[16]!==E?(A=(0,Q.jsx)(T,{items:c,strategy:E,children:k}),t[13]=T,t[14]=c,t[15]=k,t[16]=E,t[17]=A):A=t[17];let j;t[18]!==S||t[19]!==x||t[20]!==v||t[21]!==A||t[22]!==C||t[23]!==w?(j=(0,Q.jsx)(S,{sensors:v,collisionDetection:C,modifiers:w,onDragEnd:x,children:A}),t[18]=S,t[19]=x,t[20]=v,t[21]=A,t[22]=C,t[23]=w,t[24]=j):j=t[24];let M;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(ye,{className:`size-3`}),t[25]=M):M=t[25];let N;t[26]===r?N=t[27]:(N=(0,Q.jsx)(`div`,{className:`-ml-1.5 pt-1`,children:(0,Q.jsxs)(L,{size:`xs`,variant:`ghost-muted`,onClick:r,children:[M,`Add route`]})}),t[26]=r,t[27]=N);let P;return t[28]!==j||t[29]!==N?(P=(0,Q.jsxs)(`div`,{className:`mt-2 border-t border-border/50 py-2`,children:[j,N]}),t[28]=j,t[29]=N,t[30]=P):P=t[30],P}function hr(e){return[V(e.target),e]}function gr(e){return V(e.target)}function _r(e){let t=(0,Z.c)(43),{route:n,position:r,inUse:i,removable:a,onRemove:o}=e,s;t[0]===n.target?s=t[1]:(s=V(n.target),t[0]=n.target,t[1]=s);let c=s,l;t[2]===n?l=t[3]:(l=Te(n),t[2]=n,t[3]=l);let u=l,d;t[4]===n?d=t[5]:(d=Ae(n),t[4]=n,t[5]=d);let f=d,p;t[6]===c?p=t[7]:(p={id:c},t[6]=c,t[7]=p);let{attributes:m,listeners:h,setNodeRef:g,setActivatorNodeRef:_,transform:v,transition:y,isDragging:b}=Qt(p),x;t[8]===v?x=t[9]:(x=tn.Translate.toString(v),t[8]=v,t[9]=x);let S;t[10]!==x||t[11]!==y?(S={transform:x,transition:y},t[10]=x,t[11]=y,t[12]=S):S=t[12];let C=b&&`relative z-10 rounded-md bg-background shadow-md`,w;t[13]===C?w=t[14]:(w=pe(`flex items-center gap-2 py-2`,C),t[13]=C,t[14]=w);let T;t[15]===i?T=t[16]:(T=i?(0,Q.jsx)(`span`,{className:`rounded-sm bg-success/12 px-1 text-2xs font-normal text-success-foreground`,children:`In use`}):null,t[15]=i,t[16]=T);let E;t[17]!==u||t[18]!==T?(E=(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[u,T]}),t[17]=u,t[18]=T,t[19]=E):E=t[19];let D;t[20]!==f||t[21]!==n?(D=f===null?null:(0,Q.jsxs)(`p`,{className:`truncate text-2xs text-muted-foreground`,children:[f,B(n)?` · found automatically`:``]}),t[20]=f,t[21]=n,t[22]=D):D=t[22];let O;t[23]!==E||t[24]!==D?(O=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[E,D]}),t[23]=E,t[24]=D,t[25]=O):O=t[25];let k=`Reorder ${u}, position ${r}`,A;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(rr,{className:`size-3.5`}),t[26]=A):A=t[26];let j;t[27]!==m||t[28]!==h||t[29]!==_||t[30]!==k?(j=(0,Q.jsx)(`button`,{type:`button`,ref:_,...m,...h,"aria-label":k,className:`flex size-6 shrink-0 cursor-grab touch-none items-center justify-center rounded text-muted-foreground/70 outline-none hover:text-foreground focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring active:cursor-grabbing`,children:A}),t[27]=m,t[28]=h,t[29]=_,t[30]=k,t[31]=j):j=t[31];let M;t[32]!==u||t[33]!==o||t[34]!==a?(M=a?(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(Ue,{render:(0,Q.jsx)(L,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`Remove ${u} route`,onClick:o}),children:(0,Q.jsx)(z,{className:`size-3`})}),(0,Q.jsx)(We,{side:`top`,children:`Remove route`})]}):null,t[32]=u,t[33]=o,t[34]=a,t[35]=M):M=t[35];let N;return t[36]!==g||t[37]!==O||t[38]!==j||t[39]!==M||t[40]!==S||t[41]!==w?(N=(0,Q.jsxs)(`li`,{ref:g,style:S,className:w,children:[O,j,M]}),t[36]=g,t[37]=O,t[38]=j,t[39]=M,t[40]=S,t[41]=w,t[42]=N):N=t[42],N}function vr(e){let t=e.username?`${e.username}@${e.hostname}`:e.hostname;return e.port?`${t}:${e.port}`:t}function yr(e,t=null){let{entry:n}=e;if(n.target._tag===`PrimaryConnectionTarget`)return`This machine`;let r=Oe(n);if(r.length>1){let e=t===null?void 0:r.find(e=>V(e.target)===V(t));return e===void 0?Te(r[0]):`via ${Te(e)}`}return e.relayManaged?`P4 Connect`:Be(n.target)?`WSL`:n.target._tag===`SshConnectionTarget`&&d(n.profile)&&n.profile.value._tag===`SshConnectionProfile`?`SSH ${vr(n.profile.value.target)}`:e.displayUrl??`Remote link`}function br(e){let t=(0,Z.c)(23),{kind:n,label:r,subtitle:i,below:a,detail:o,dimmed:s,className:c,children:l}=e,u=s!==void 0&&s&&`opacity-60`,d;t[0]!==c||t[1]!==u?(d=pe(`grid grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-3 px-3 py-2.5 sm:px-4`,u,c),t[0]=c,t[1]=u,t[2]=d):d=t[2];let f;t[3]===n?f=t[4]:(f=(0,Q.jsx)(Xt,{"aria-hidden":!0,kind:n,className:`size-4 text-muted-foreground`}),t[3]=n,t[4]=f);let p;t[5]===r?p=t[6]:(p=(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium text-foreground`,children:r}),t[5]=r,t[6]=p);let m;t[7]===i?m=t[8]:(m=(0,Q.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==a||t[10]!==p||t[11]!==m?(h=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[p,m,a]}),t[9]=a,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]===l?g=t[14]:(g=(0,Q.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:l}),t[13]=l,t[14]=g);let _;t[15]===o?_=t[16]:(_=o?(0,Q.jsx)(`div`,{className:`col-span-2 col-start-2 min-w-0`,children:o}):null,t[15]=o,t[16]=_);let v;return t[17]!==d||t[18]!==f||t[19]!==h||t[20]!==g||t[21]!==_?(v=(0,Q.jsxs)(`div`,{className:d,children:[f,h,g,_]}),t[17]=d,t[18]=f,t[19]=h,t[20]=g,t[21]=_,t[22]=v):v=t[22],v}var xr=[{value:100,label:`Prefer`},{value:50,label:`Normal`},{value:25,label:`Less often`},{value:0,label:`Manual only`}];function Sr(e){return e===void 0||e===50?50:e===0?0:e<50?25:100}function Cr(e){return xr.find(t=>t.value===e).label}function wr(e,t){let n=e.flatMap(e=>{let n=Sr(t[e.environmentId]);return n===50?[]:[`${e.label} ${Cr(n).toLowerCase()}`]});return n.length===0?null:n.join(` · `)}function Tr(e){let t=(0,Z.c)(27),{environments:n}=e,r=it(),i=nt(),a=at();if(n.length<2)return null;let o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=Zn(`load-balancing`),t[0]=o):o=t[0];let{id:s,title:c}=o,l;t[1]!==n||t[2]!==r.loadBalancingEnabled||t[3]!==r.loadBalancingWeights?(l=r.loadBalancingEnabled?wr(n,r.loadBalancingWeights):`Off`,t[1]=n,t[2]=r.loadBalancingEnabled,t[3]=r.loadBalancingWeights,t[4]=l):l=t[4];let u=!i,d;t[5]===a?d=t[6]:(d=e=>a({loadBalancingEnabled:e}),t[5]=a,t[6]=d);let f;t[7]!==r.loadBalancingEnabled||t[8]!==u||t[9]!==d?(f=(0,Q.jsx)(er,{"aria-label":`Automatically balance load`,checked:r.loadBalancingEnabled,disabled:u,onCheckedChange:d}),t[7]=r.loadBalancingEnabled,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`New threads in shared projects start on the machine with the most free CPU and memory, weighted by each machine's preference.`}),t[11]=p):p=t[11];let m;if(t[12]!==n||t[13]!==r.loadBalancingEnabled||t[14]!==r.loadBalancingWeights||t[15]!==i||t[16]!==a){let e;t[18]!==r.loadBalancingEnabled||t[19]!==r.loadBalancingWeights||t[20]!==i||t[21]!==a?(e=e=>(0,Q.jsx)(br,{kind:M(e.serverConfig),label:e.label,subtitle:yr(e),children:(0,Q.jsxs)(Ye,{items:xr,value:Sr(r.loadBalancingWeights[e.environmentId]),disabled:!i||!r.loadBalancingEnabled,onValueChange:t=>{t!==null&&a({loadBalancingWeights:{...r.loadBalancingWeights,[e.environmentId]:t}})},children:[(0,Q.jsx)(Je,{size:`xs`,className:`w-32`,"aria-label":`${e.label} load preference`,children:(0,Q.jsx)(Ke,{})}),(0,Q.jsx)(qe,{align:`end`,alignItemWithTrigger:!1,children:xr.map(Er)})]})},e.environmentId),t[18]=r.loadBalancingEnabled,t[19]=r.loadBalancingWeights,t[20]=i,t[21]=a,t[22]=e):e=t[22],m=n.map(e),t[12]=n,t[13]=r.loadBalancingEnabled,t[14]=r.loadBalancingWeights,t[15]=i,t[16]=a,t[17]=m}else m=t[17];let h;return t[23]!==l||t[24]!==f||t[25]!==m?(h=(0,Q.jsxs)(ar,{id:s,title:c,summary:l,control:f,children:[p,m]}),t[23]=l,t[24]=f,t[25]=m,t[26]=h):h=t[26],h}function Er(e){let{value:t,label:n}=e;return(0,Q.jsx)(G,{value:t,children:n},t)}var Dr=[{value:`off`,label:`Off`},{value:`read`,label:`Read PRs`},{value:`read-write`,label:`Read and act`}],Or={"read-write":`read and act`,read:`read PRs`};function kr(e){let t=[`read-write`,`read`].flatMap(t=>{let n=e.filter(e=>e.permission===t);return n.length===0?[]:[`${n.map(e=>e.label).join(`, `)} ${Or[t]}`]});return t.length===0?null:t.join(` · `)}function Ar(e){let t=(0,Z.c)(19),{environments:n}=e,r=x(st.githubRoutingPermissionsValueAtom),i=x(st.catalogValueAtom),a=pt(st.setGitHubRoutingPermission),[o,s]=(0,$.useState)(!1);if(n.length<2)return null;let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=Zn(`github-routing`),t[0]=c):c=t[0];let{id:l,title:u}=c,d;t[1]!==n||t[2]!==r?(d=kr(n.map(e=>({label:e.label,permission:Ee(e.entry,r)})))??`Off`,t[1]=n,t[2]=r,t[3]=d):d=t[3];let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(`p`,{className:`px-3 py-2.5 text-xs text-muted-foreground sm:px-4`,children:`Machines you trust here can read PR data through each other's GitHub access. Enable both machines. Read and act may use broader permissions than the machine that owns them. This applies only to this device.`}),t[4]=f):f=t[4];let p;if(t[5]!==i||t[6]!==n||t[7]!==r||t[8]!==o||t[9]!==a){let e;t[11]!==i||t[12]!==r||t[13]!==o||t[14]!==a?(e=e=>(0,Q.jsx)(br,{kind:M(e.serverConfig),label:e.label,subtitle:yr(e),children:(0,Q.jsxs)(Ye,{items:Dr,value:Ee(e.entry,r),disabled:!i.isReady||o||Me(e.entry)===null,onValueChange:t=>{t!==null&&(s(!0),a({environmentId:e.environmentId,permission:t}).then(e=>{s(!1),e._tag===`Failure`&&K.add({type:`error`,title:`Could not save GitHub routing permission`})}))},children:[(0,Q.jsx)(Je,{size:`xs`,className:`w-32`,"aria-label":`${e.label} GitHub routing`,children:(0,Q.jsx)(Ke,{})}),(0,Q.jsx)(qe,{align:`end`,alignItemWithTrigger:!1,children:Dr.map(jr)})]})},e.environmentId),t[11]=i,t[12]=r,t[13]=o,t[14]=a,t[15]=e):e=t[15],p=n.map(e),t[5]=i,t[6]=n,t[7]=r,t[8]=o,t[9]=a,t[10]=p}else p=t[10];let m;return t[16]!==d||t[17]!==p?(m=(0,Q.jsxs)(ar,{id:l,title:u,summary:d,children:[f,p]}),t[16]=d,t[17]=p,t[18]=m):m=t[18],m}function jr(e){let{value:t,label:n}=e;return(0,Q.jsx)(G,{value:t,children:n},t)}function Mr(e){let t=(0,Z.c)(26),{environmentLabel:n,onCancel:r,onConfirm:i}=e,a=It(),[o,s]=(0,$.useState)(n);n!==null&&n!==o&&s(n);let c=a.open,l=n!==null,u;t[0]===r?u=t[1]:(u=e=>{e||r()},t[0]=r,t[1]=u);let d;t[2]===o?d=t[3]:(d=(0,Q.jsxs)(En,{children:[`Remove `,o,` from this device?`]}),t[2]=o,t[3]=d);let f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(kn,{children:`This forgets its pairing, credentials, and cached threads here.`}),t[4]=f):f=t[4];let p;t[5]!==r||t[6]!==c?(p=c?(0,Q.jsx)(R,{onClick:()=>{r(),c()},children:`P4 Connect settings`}):`P4 Connect settings`,t[5]=r,t[6]=c,t[7]=p):p=t[7];let m;t[8]===p?m=t[9]:(m=(0,Q.jsxs)(kn,{children:[`It stays on your P4 Connect account and keeps its host space. Deregister it in`,` `,p,` `,`to free it.`]}),t[8]=p,t[9]=m);let h;t[10]!==d||t[11]!==m?(h=(0,Q.jsxs)(jn,{children:[d,f,m]}),t[10]=d,t[11]=m,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Q.jsx)(Fn,{render:(0,Q.jsx)(L,{variant:`outline`}),children:`Cancel`}),t[13]=g):g=t[13];let _;t[14]===i?_=t[15]:(_=(0,Q.jsxs)(On,{children:[g,(0,Q.jsx)(L,{variant:`destructive`,onClick:i,children:`Remove from this device`})]}),t[14]=i,t[15]=_);let v;t[16]!==h||t[17]!==_?(v=(0,Q.jsxs)(qn,{children:[h,_]}),t[16]=h,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==l||t[20]!==v||t[21]!==u?(y=(0,Q.jsx)(tr,{open:l,onOpenChange:u,children:v}),t[19]=l,t[20]=v,t[21]=u,t[22]=y):y=t[22];let b;return t[23]!==a.portals||t[24]!==y?(b=(0,Q.jsxs)(Q.Fragment,{children:[y,a.portals]}),t[23]=a.portals,t[24]=y,t[25]=b):b=t[25],b}var Nr={pairingLinks:[],clientSessions:[]};function Pr(e,t,n){let r=n(t);return[...e.filter(e=>n(e)!==r),t]}function Fr(e,t){switch(t.type){case`snapshot`:return t.payload;case`pairingLinkUpserted`:return{...e,pairingLinks:Pr(e.pairingLinks,t.payload,e=>e.id)};case`pairingLinkRemoved`:return{...e,pairingLinks:e.pairingLinks.filter(e=>e.id!==t.payload.id)};case`clientUpserted`:return{...e,clientSessions:Pr(e.clientSessions,t.payload,e=>e.sessionId)};case`clientRemoved`:return{...e,clientSessions:e.clientSessions.filter(e=>e.sessionId!==t.payload.sessionId)}}}function Ir(e,t){let n=Fr(e,t);return[n,[{version:1,revision:t.revision,type:`snapshot`,payload:n}]]}function Lr(e){return{accessChanges:ke(e,{label:`environment-data:server:auth-access-changes`,subscribe:e=>H(h.subscribeAuthAccess,{}).pipe(ie(()=>Nr,Ir))})}}var Rr=Lr(He),zr=3e4,Br=class extends n()(`DesktopNetworkAccessUnavailableError`,{}){get message(){return`Desktop network access is unavailable.`}},Vr=class extends n()(`DesktopServerExposureStateLoadError`,{cause:u()}){get message(){return`Failed to load desktop server exposure state.`}},Hr=class extends n()(`DesktopAdvertisedEndpointsLoadError`,{cause:u()}){get message(){return`Failed to load advertised desktop endpoints.`}};function Ur(){return typeof window>`u`?void 0:window.desktopBridge}function Wr(e){let t=C(`loadDesktopNetworkAccess`)(function*(){let t=e();if(!t)return yield*new Br;let[n,r]=yield*ne([P({try:()=>t.getServerExposureState(),catch:e=>new Vr({cause:e})}),P({try:()=>t.getAdvertisedEndpoints(),catch:e=>new Hr({cause:e})})],{concurrency:`unbounded`});return{advertisedEndpoints:r,serverExposureState:n}});return c(t()).pipe(D({staleTime:zr,revalidateOnMount:!0}),T,r(`desktop:network-access`))}var Gr=Wr(Ur);function Kr(){p.refresh(Gr)}function qr(e,t){let n=t.trim().toLowerCase();if(n.length===0)return e;let r=[],i=[];for(let t of e){let e=t.alias.toLowerCase();e.startsWith(n)?r.push(t):e.includes(n)&&i.push(t)}return[...r,...i]}var Jr=class extends n()(`DesktopSshDiscoveryUnavailableError`,{}){get message(){return`Desktop SSH host discovery is unavailable.`}},Yr=class extends n()(`DesktopSshDiscoveryError`,{cause:u()}){get message(){return`Failed to discover SSH hosts.`}};function Xr(){return typeof window>`u`?void 0:window.desktopBridge}function Zr(e){let t=C(`discoverDesktopSshHosts`)(function*(){let t=e();return t?yield*P({try:()=>t.discoverSshHosts(),catch:e=>new Yr({cause:e})}):yield*new Jr});return c(t()).pipe(D({staleTime:3e4,revalidateOnMount:!0}),T,r(`desktop:ssh-hosts`))}var Qr=Zr(Xr),$r=443,ei=[],ti=[],ni=`backend:default-wsl`,ri=`backend:wsl-off`,ii=new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`short`});function ai(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:ii.format(t)}function oi(e){let t=(0,Z.c)(13),{scopes:n,label:r}=e,i=`${n.length} ${n.length===1?`scope`:`scopes`}`,a=`${r}: show ${i}`,o;t[0]===a?o=t[1]:(o=(0,Q.jsx)(`button`,{type:`button`,"aria-label":a,className:`cursor-help underline decoration-border underline-offset-2 outline-hidden hover:text-foreground focus-visible:text-foreground`}),t[0]=a,t[1]=o);let s;t[2]!==i||t[3]!==o?(s=(0,Q.jsx)(Jt,{openOnHover:!0,delay:250,closeDelay:100,render:o,children:i}),t[2]=i,t[3]=o,t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(`p`,{className:`mb-1 font-medium`,children:`Granted scopes`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=n.map(si),t[6]=n,t[7]=l);let u;t[8]===l?u=t[9]:(u=(0,Q.jsxs)(qt,{side:`top`,align:`start`,tooltipStyle:!0,className:`w-max max-w-80 whitespace-normal`,children:[c,(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l})]}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Yt,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function si(e){return(0,Q.jsx)(`code`,{className:`font-mono text-foreground/85`,children:e},e)}function ci(e){let t=e.host.trim();if(t.length===0)throw Error(`SSH host or alias is required.`);let n=t,r=e.username.trim()||null,i=null,a=n.lastIndexOf(`@`);if(a>0){let e=n.slice(0,a).trim();n=n.slice(a+1).trim(),!r&&e.length>0&&(r=e)}let o=/^\[([^\]]+)\](?::(\d+))?$/u.exec(n);if(o)n=o[1].trim(),o[2]&&(i=Number.parseInt(o[2],10));else{let e=n.split(`:`);e.length===2&&/^\d+$/u.test(e[1]??``)&&(n=e[0].trim(),i=Number.parseInt(e[1],10))}let s=e.port.trim();if(s.length>0&&(i=Number.parseInt(s,10)),n.length===0)throw Error(`SSH host or alias is required.`);if(i!==null&&(!Number.isInteger(i)||i<=0||i>65535))throw Error(`SSH port must be between 1 and 65535.`);return{alias:n,hostname:n,username:r,port:i}}function li(e){let t=e.trim();if(!t)return null;try{let e=/^[a-zA-Z][a-zA-Z\d+.-]*:\/\//u.test(t)||t.startsWith(`//`)?t:`https://${t}`,n=new URL(e,window.location.origin),r=U(n);if(r)return{host:r.host,pairingCode:r.token};let i=ze(n);return i?{host:n.origin,pairingCode:i}:null}catch{return null}}function ui(e){let t=li(e.host);if(t)return t;let n=e.host.trim(),r=e.pairingCode.trim();if(!n)throw Error(`Enter a backend host.`);if(!r)throw Error(`Enter a pairing code.`);return{host:n,pairingCode:r}}function di(e){let t=`Failed to connect SSH host.`;return(e instanceof Error?e.message:t).replace(/^Error invoking remote method 'desktop:ensure-ssh-environment':\s*/u,``).replace(/^Ssh[A-Za-z]+Error:\s*/u,``).trim()||t}var fi=`first:rounded-t-xl last:rounded-b-xl px-3 py-2.5 sm:px-4`;function pi(e){return Gn}function mi(e,t){return e===`endpoint-rail`?pe(`relative first:rounded-t-xl last:rounded-b-xl px-3 py-3 sm:px-4`,!t&&`bg-muted/15`):pe(fi,!t&&`bg-muted/24`)}function hi(e){return[...e].toSorted((e,t)=>new Date(t.createdAt).getTime()-new Date(e.createdAt).getTime())}function gi(e,t){return[`${e.length} ${e.length===1?`client`:`clients`}`,t.length>0?`${t.length} ${t.length===1?`pairing link`:`pairing links`}`:null].filter(e=>e!==null).join(` · `)}function _i(e){return[...e].toSorted((e,t)=>e.current===t.current?e.connected===t.connected?new Date(t.issuedAt).getTime()-new Date(e.issuedAt).getTime():e.connected?-1:1:e.current?-1:1)}function vi(e){return{...e,scopes:e.permissions??e.scopes,createdAt:F(e.createdAt),expiresAt:F(e.expiresAt)}}function yi(e){return{...e,scopes:e.permissions??e.scopes,issuedAt:F(e.issuedAt),expiresAt:F(e.expiresAt),lastConnectedAt:e.lastConnectedAt===null?null:F(e.lastConnectedAt)}}function bi(e,t){let n=e.filter(e=>e.status!==`unavailable`);if(t){let e=n.find(e=>Si(e)===t);if(e)return e}return n.find(e=>e.isDefault)??n.find(e=>e.reachability!==`loopback`)??n.find(e=>e.compatibility.hostedHttpsApp===`compatible`)??null}function xi(e){return e.id.startsWith(`tailscale-magicdns:`)}function Si(e){if(e.id.startsWith(`desktop-loopback:`))return`desktop-core:loopback:http`;if(e.id.startsWith(`desktop-lan:`))return`desktop-core:lan:http`;if(e.id.startsWith(`tailscale-ip:`))return`tailscale:ip:http`;if(xi(e))return`tailscale:magicdns:https`;let t=`unknown`;try{t=new URL(e.httpBaseUrl).protocol.replace(/:$/u,``)}catch{}return`${e.provider.id}:${e.reachability}:${t}:${e.label}`}function Ci(e,t){return e.compatibility.hostedHttpsApp===`compatible`?lr(e.httpBaseUrl,t)??cr(e.httpBaseUrl,t):cr(e.httpBaseUrl,t)}function wi(e){let t=new URL(`/pair`,window.location.href);return W(t,e).toString()}function Ti(e){try{let t=new URL(e);return t.pathname===`/pair`&&t.searchParams.has(`host`)}catch{return!1}}function Ei(e,t){if(Ti(t))return`Opens the hosted app, no install needed`;switch(e.reachability){case`lan`:return`Devices on the same network`;case`private-network`:return`Devices on your private network`;case`public`:return`Reachable from anywhere`;case`loopback`:return`Clients on this machine`}}var Di=(0,$.memo)(function(e){let t=(0,Z.c)(131),{pairingLink:n,credential:r,endpointUrl:i,endpoints:a,defaultEndpointKey:o,presentation:s,revokingPairingLinkId:c,onRevoke:l,canRevoke:u}=e,d=s===void 0?`current`:s,f=_n(1e3),p=new Date(n.expiresAt).getTime(),[m,h]=(0,$.useState)(!1),[g,_]=(0,$.useState)(!1),[v,y]=(0,$.useState)(null),b=(0,$.useId)(),x;t[0]===r?x=t[1]:(x=r?wi(r):null,t[0]=r,t[1]=x);let S=x,C;t[2]!==r||t[3]!==i?(C=r&&i!=null&&i!==``?lr(i,r):null,t[2]=r,t[3]=i,t[4]=C):C=t[4];let w=C,T;if(t[5]!==r||t[6]!==o||t[7]!==a){let e=bi(a,o);T=e&&r?Ci(e,r):null,t[5]=r,t[6]=o,t[7]=a,t[8]=T}else T=t[8];let E=T,D;if(t[9]!==r||t[10]!==a){bb0:{let e=[];if(!r){D=e;break bb0}for(let t of a){if(t.status===`unavailable`)continue;let n=Ci(t,r);e.push({id:t.id,preferenceKey:Si(t),label:t.label,url:n,detail:Ei(t,n),qrShareable:Ln(t)})}D=e}t[9]=r,t[10]=a,t[11]=D}else D=t[11];let O=D,k;t[12]!==r||t[13]!==S||t[14]!==E||t[15]!==i||t[16]!==w?(k=E??(r&&i!=null&&i!==``?w??cr(i,r):Pe(window.location.hostname)?null:S),t[12]=r,t[13]=S,t[14]=E,t[15]=i,t[16]=w,t[17]=k):k=t[17];let A=k,[j,M]=(0,$.useState)(null),N=j??A??r??``,P=N!==r,ee=P&&Ti(N),te=O.find(e=>e.url===N)?.qrShareable??!0,ne=typeof window<`u`&&window.isSecureContext&&navigator.clipboard?.writeText!=null,re;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(re={onCopy:Yi,onError:(e,t)=>{let{value:n,kind:r}=t;M(n),h(!0),K.add(Y({type:`error`,title:ne?r===`hosted-link`?`Could not copy hosted app link`:r===`link`?`Could not copy pairing URL`:`Could not copy pairing code`:`Clipboard copy unavailable`,description:ne?e.message:`Showing the full value instead.`}))}},t[18]=re):re=t[18];let{copyToClipboard:ie}=Ze(re),ae;t[19]===ie?ae=t[20]:(ae=(e,t)=>{ie(e,{value:e,kind:t})},t[19]=ie,t[20]=ae);let oe=ae,se=Xi,ce;t[21]!==oe||t[22]!==r?(ce=()=>{r&&oe(r,`code`)},t[21]=oe,t[22]=r,t[23]=ce):ce=t[23];let le=ce,ue;t[24]===n.expiresAt?ue=t[25]:(ue=ai(n.expiresAt),t[24]=n.expiresAt,t[25]=ue);let F=ue,I=n.label??`Pairing link`,de;t[26]!==o||t[27]!==O||t[28]!==v?(de=Rn(O,v,o),t[26]=o,t[27]=O,t[28]=v,t[29]=de):de=t[29];let fe=de,R=fe?.url??A,me=fe?.qrShareable??!0;if(p<=f)return null;let he;t[30]===d?he=t[31]:(he=pi(d),t[30]=d,t[31]=he);let ge;t[32]===n.createdAt?ge=t[33]:(ge=ai(n.createdAt),t[32]=n.createdAt,t[33]=ge);let _e=`Link created at ${ge}`,ve;t[34]===_e?ve=t[35]:(ve=(0,Q.jsx)(vn,{tooltipText:_e,dotClassName:`bg-warning`}),t[34]=_e,t[35]=ve);let ye;t[36]===I?ye=t[37]:(ye=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:I}),t[36]=I,t[37]=ye);let xe;t[38]!==ve||t[39]!==ye?(xe=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[ve,ye]}),t[38]=ve,t[39]=ye,t[40]=xe):xe=t[40];let Se;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Q.jsx)(`span`,{}),t[41]=Se):Se=t[41];let z;t[42]!==f||t[43]!==n.expiresAt?(z=mt(n.expiresAt,f),t[42]=f,t[43]=n.expiresAt,t[44]=z):z=t[44];let B;t[45]===z?B=t[46]:(B=(0,Q.jsx)(Ue,{render:Se,children:z}),t[45]=z,t[46]=B);let Ce;t[47]===F?Ce=t[48]:(Ce=(0,Q.jsx)(We,{side:`top`,children:F}),t[47]=F,t[48]=Ce);let we;t[49]!==B||t[50]!==Ce?(we=(0,Q.jsxs)(Ge,{children:[B,Ce]}),t[49]=B,t[50]=Ce,t[51]=we):we=t[51];let Te;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Te=(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `}),t[52]=Te):Te=t[52];let V;t[53]===n.scopes?V=t[54]:(V=(0,Q.jsx)(oi,{scopes:n.scopes,label:`Pairing link scopes`}),t[53]=n.scopes,t[54]=V);let Ee;t[55]!==we||t[56]!==V?(Ee=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[we,Te,V]}),t[55]=we,t[56]=V,t[57]=Ee):Ee=t[57];let De;t[58]!==r||t[59]!==A?(De=r?A===null?(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Copy the token and pair from another client using this backend's reachable host.`}):null:(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Create a new link to share from this client.`}),t[58]=r,t[59]=A,t[60]=De):De=t[60];let Oe;t[61]!==xe||t[62]!==Ee||t[63]!==De?(Oe=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[xe,Ee,De]}),t[61]=xe,t[62]=Ee,t[63]=De,t[64]=Oe):Oe=t[64];let ke;t[65]!==g||t[66]!==b||t[67]!==A?(ke=A&&ne?(0,Q.jsxs)(L,{size:`xs`,variant:`outline`,"aria-expanded":g,"aria-controls":b,onClick:()=>_(Zi),children:[(0,Q.jsx)(be,{"aria-hidden":!0}),`Share`]}):null,t[65]=g,t[66]=b,t[67]=A,t[68]=ke):ke=t[68];let Ae=r!==void 0&&m,je;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(je=e=>{h(e),e||M(null)},t[69]=je):je=t[69];let Me;t[70]!==r||t[71]!==le||t[72]!==A?(Me=r?ne?A?null:(0,Q.jsx)(L,{size:`xs`,variant:`outline`,onClick:le,children:`Copy code`}):(0,Q.jsx)(At,{render:(0,Q.jsx)(L,{size:`xs`,variant:`outline`}),children:A?`Show link`:`Show code`}):null,t[70]=r,t[71]=le,t[72]=A,t[73]=Me):Me=t[73];let Ne=P?ee?`Hosted app pairing link`:`Pairing link`:`Pairing code`,H;t[74]===Ne?H=t[75]:(H=(0,Q.jsx)(Ot,{children:Ne}),t[74]=Ne,t[75]=H);let Fe=P?ee?`Clipboard copy is unavailable here. Open or manually copy this hosted app link on the device you want to connect.`:`Clipboard copy is unavailable here. Open or manually copy this full pairing URL on the device you want to connect.`:`Clipboard copy is unavailable here. Manually copy this code into another client.`,U;t[76]===Fe?U=t[77]:(U=(0,Q.jsx)(Nt,{children:Fe}),t[76]=Fe,t[77]=U);let W;t[78]!==H||t[79]!==U?(W=(0,Q.jsxs)(Dt,{children:[H,U]}),t[78]=H,t[79]=U,t[80]=W):W=t[80];let Ie=P?4:3,Le;t[81]!==N||t[82]!==Ie?(Le=(0,Q.jsx)(_t,{readOnly:!0,value:N,rows:Ie,onFocus:Qi,onClick:$i}),t[81]=N,t[82]=Ie,t[83]=Le):Le=t[83];let Re;t[84]!==te||t[85]!==P||t[86]!==N?(Re=P&&te?(0,Q.jsx)(`div`,{className:`flex justify-center rounded-xl border border-border/60 bg-muted/30 p-4`,children:(0,Q.jsx)(Pn,{value:N,size:132,level:`M`,marginSize:2,title:`Pairing link — scan to open on another device`})}):null,t[84]=te,t[85]=P,t[86]=N,t[87]=Re):Re=t[87];let ze;t[88]!==Le||t[89]!==Re?(ze=(0,Q.jsxs)(Mt,{children:[Le,Re]}),t[88]=Le,t[89]=Re,t[90]=ze):ze=t[90];let Be;t[91]===Symbol.for(`react.memo_cache_sentinel`)?(Be=(0,Q.jsx)(L,{variant:`outline`,onClick:()=>h(!1),children:`Done`}),t[91]=Be):Be=t[91];let Ve;t[92]===le?Ve=t[93]:(Ve=ne?(0,Q.jsx)(L,{variant:`outline`,onClick:le,children:`Copy code`}):null,t[92]=le,t[93]=Ve);let He;t[94]===Ve?He=t[95]:(He=(0,Q.jsxs)(kt,{variant:`bare`,children:[Be,Ve]}),t[94]=Ve,t[95]=He);let G;t[96]!==W||t[97]!==ze||t[98]!==He?(G=(0,Q.jsxs)(Pt,{className:`max-w-md`,children:[W,ze,He]}),t[96]=W,t[97]=ze,t[98]=He,t[99]=G):G=t[99];let Ke;t[100]!==Ae||t[101]!==Me||t[102]!==G?(Ke=(0,Q.jsxs)(Ft,{open:Ae,onOpenChange:je,children:[Me,G]}),t[100]=Ae,t[101]=Me,t[102]=G,t[103]=Ke):Ke=t[103];let qe=!u||c===n.id,Je;t[104]!==l||t[105]!==n.id?(Je=()=>void l(n.id),t[104]=l,t[105]=n.id,t[106]=Je):Je=t[106];let Ye=c===n.id?`Revoking…`:`Revoke`,Xe;t[107]!==qe||t[108]!==Je||t[109]!==Ye?(Xe=(0,Q.jsx)(L,{size:`xs`,variant:`destructive-outline`,disabled:qe,onClick:Je,children:Ye}),t[107]=qe,t[108]=Je,t[109]=Ye,t[110]=Xe):Xe=t[110];let Qe;t[111]!==ke||t[112]!==Ke||t[113]!==Xe?(Qe=(0,Q.jsxs)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:[ke,Ke,Xe]}),t[111]=ke,t[112]=Ke,t[113]=Xe,t[114]=Qe):Qe=t[114];let $e;t[115]!==Oe||t[116]!==Qe?($e=(0,Q.jsxs)(`div`,{className:zn,children:[Oe,Qe]}),t[115]=Oe,t[116]=Qe,t[117]=$e):$e=t[117];let et;t[118]!==me||t[119]!==oe||t[120]!==O||t[121]!==le||t[122]!==g||t[123]!==R||t[124]!==b||t[125]!==fe?.id?(et=g&&R!==null?(0,Q.jsxs)(`div`,{id:b,className:`mt-3 flex flex-col gap-4 border-t border-border/50 pt-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-3`,children:[O.length>1?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,role:`radiogroup`,"aria-label":`Endpoint the pairing QR code and URL use`,children:[(0,Q.jsx)(`p`,{className:`text-2xs text-muted-foreground/70`,children:`Reach this machine via`}),O.map(e=>{let t=e.id===fe?.id;return(0,Q.jsxs)(`button`,{type:`button`,role:`radio`,"aria-checked":t,className:pe(`flex w-full items-baseline gap-2 rounded-lg border px-2.5 py-1.5 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,t?`border-foreground/60 bg-muted/30`:`border-border/50 hover:bg-muted/20`),onClick:()=>y(e.id),children:[(0,Q.jsx)(`span`,{className:pe(`text-xs font-medium`,t?`text-foreground`:`text-muted-foreground`),children:e.label}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-2xs text-muted-foreground/70`,children:e.detail})]},e.id)})]}):null,(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border/60 bg-muted/30 px-2.5 py-1.5`,children:[(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(Ue,{render:(0,Q.jsx)(`code`,{className:`min-w-0 flex-1 truncate font-mono text-2xs text-muted-foreground`,children:R})}),(0,Q.jsx)(We,{side:`top`,children:R})]}),(0,Q.jsx)(L,{size:`xs`,variant:`ghost`,className:`shrink-0`,onClick:()=>oe(R,se(R)),children:`Copy link`})]}),(0,Q.jsx)(L,{size:`xs`,variant:`ghost`,onClick:le,children:`Copy code only`})]}),me?(0,Q.jsx)(`div`,{className:`w-fit shrink-0 self-center rounded-xl bg-white p-3 sm:self-start`,children:(0,Q.jsx)(Pn,{value:R,size:168,level:`M`,marginSize:1,title:`Pairing link — scan to open on another device`})}):(0,Q.jsx)(`div`,{className:`flex size-[192px] shrink-0 items-center justify-center self-center rounded-xl border border-border/50 p-4 sm:self-start`,children:(0,Q.jsx)(`p`,{className:`text-center text-2xs text-muted-foreground/70`,children:`No QR for this endpoint. Another device scanning a loopback link would dial itself; copy the URL for use on this machine instead.`})})]}):null,t[118]=me,t[119]=oe,t[120]=O,t[121]=le,t[122]=g,t[123]=R,t[124]=b,t[125]=fe?.id,t[126]=et):et=t[126];let tt;return t[127]!==he||t[128]!==$e||t[129]!==et?(tt=(0,Q.jsxs)(`div`,{className:he,children:[$e,et]}),t[127]=he,t[128]=$e,t[129]=et,t[130]=tt):tt=t[130],tt}),Oi=(0,$.memo)(function(e){let t=(0,Z.c)(54),{clientSession:n,presentation:r,revokingClientSessionId:i,onRevokeSession:a,canRevoke:o}=e,s=r===void 0?`current`:r,c=_n(1e3),l=n.current||n.connected,u=n.lastConnectedAt,d;t[0]!==l||t[1]!==u||t[2]!==c?(d=l?u?`Connected for ${ht(u,c)}`:`Connected`:u?`Last connected at ${ai(u)}`:`Not connected yet.`,t[0]=l,t[1]=u,t[2]=c,t[3]=d):d=t[3];let f=d,p;t[4]===n.client.deviceType?p=t[5]:(p=n.client.deviceType===`unknown`?null:n.client.deviceType[0]?.toUpperCase()+n.client.deviceType.slice(1),t[4]=n.client.deviceType,t[5]=p);let m=n.client.os??null,h=n.client.browser??null,g=n.client.ipAddress??null,_;t[6]!==p||t[7]!==m||t[8]!==h||t[9]!==g?(_=[p,m,h,g].filter(ea),t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=_):_=t[10];let v=_,y;t[11]!==n.client.browser||t[12]!==n.client.label||t[13]!==n.client.os||t[14]!==n.subject?(y=n.client.label??([n.client.os,n.client.browser].filter(Boolean).join(` · `)||n.subject),t[11]=n.client.browser,t[12]=n.client.label,t[13]=n.client.os,t[14]=n.subject,t[15]=y):y=t[15];let b=y,x;t[16]===s?x=t[17]:(x=pi(s),t[16]=s,t[17]=x);let S=l?`bg-success`:`bg-muted-foreground/30`,C=l?`bg-success/60 duration-2000`:null,w;t[18]!==f||t[19]!==S||t[20]!==C?(w=(0,Q.jsx)(vn,{tooltipText:f,dotClassName:S,pingClassName:C}),t[18]=f,t[19]=S,t[20]=C,t[21]=w):w=t[21];let T;t[22]===b?T=t[23]:(T=(0,Q.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:b}),t[22]=b,t[23]=T);let E;t[24]===n.current?E=t[25]:(E=n.current?(0,Q.jsx)(`span`,{className:`text-3xs text-muted-foreground/80 rounded-md border border-border/50 bg-muted/50 px-1 py-0.5`,children:`This device`}):null,t[24]=n.current,t[25]=E);let D;t[26]!==w||t[27]!==T||t[28]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex min-h-5 items-center gap-1.5`,children:[w,T,E]}),t[26]=w,t[27]=T,t[28]=E,t[29]=D):D=t[29];let O;t[30]===v?O=t[31]:(O=v.length>0?(0,Q.jsxs)(Q.Fragment,{children:[v.join(` · `),(0,Q.jsx)(`span`,{"aria-hidden":!0,children:` · `})]}):null,t[30]=v,t[31]=O);let k;t[32]===n.scopes?k=t[33]:(k=(0,Q.jsx)(oi,{scopes:n.scopes,label:`Client scopes`}),t[32]=n.scopes,t[33]=k);let A;t[34]!==O||t[35]!==k?(A=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[O,k]}),t[34]=O,t[35]=k,t[36]=A):A=t[36];let j;t[37]!==D||t[38]!==A?(j=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[D,A]}),t[37]=D,t[38]=A,t[39]=j):j=t[39];let M;t[40]!==o||t[41]!==n.current||t[42]!==n.sessionId||t[43]!==a||t[44]!==i?(M=n.current?null:(0,Q.jsx)(L,{size:`xs`,variant:`destructive-outline`,disabled:!o||i===n.sessionId,onClick:()=>void a(n.sessionId),children:i===n.sessionId?`Revoking…`:`Revoke`}),t[40]=o,t[41]=n.current,t[42]=n.sessionId,t[43]=a,t[44]=i,t[45]=M):M=t[45];let N;t[46]===M?N=t[47]:(N=(0,Q.jsx)(`div`,{className:`flex w-full shrink-0 items-center gap-2 sm:w-auto sm:justify-end`,children:M}),t[46]=M,t[47]=N);let P;t[48]!==j||t[49]!==N?(P=(0,Q.jsxs)(`div`,{className:zn,children:[j,N]}),t[48]=j,t[49]=N,t[50]=P):P=t[50];let ee;return t[51]!==P||t[52]!==x?(ee=(0,Q.jsx)(`div`,{className:x,children:P}),t[51]=P,t[52]=x,t[53]=ee):ee=t[53],ee}),ki=(0,$.memo)(function({onPairingLinkCreated:e,clientSessions:t,isRevokingOtherClients:n,onRevokeOtherClients:r,delegatableScopes:o}){let s=tt(),[c,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(``),[f,p]=(0,$.useState)([...i]),h=f.filter(e=>o.includes(e)),[g,_]=(0,$.useState)(!1),v=(0,$.useCallback)(async()=>{if(s!==null&&h.length!==0&&ut(s,`access:write`)&&h.every(e=>ut(s,e))){_(!0);try{e(await X({label:u,scopes:h})),d(``),p(i.filter(e=>o.includes(e))),l(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to create pairing URL.`;K.add(Y({type:`error`,title:`Could not create pairing URL`,description:t}))}finally{_(!1)}}},[o,e,u,s,h]),y=(0,$.useCallback)((e,t)=>{p(n=>Mn(n,e,t))},[]);return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(L,{size:`xs`,variant:`destructive-outline`,disabled:n||!An(t),onClick:()=>void r(),children:n?`Revoking…`:`Revoke others`}),(0,Q.jsxs)(Ft,{open:c,onOpenChange:e=>{l(e),e||(d(``),p(i.filter(e=>o.includes(e))))},children:[(0,Q.jsx)(At,{render:(0,Q.jsxs)(L,{size:`xs`,variant:`default`,children:[(0,Q.jsx)(ye,{className:`size-3`}),`Create link`]})}),(0,Q.jsxs)(Pt,{className:`max-w-md`,children:[(0,Q.jsxs)(Dt,{children:[(0,Q.jsx)(Ot,{children:`Create pairing link`}),(0,Q.jsx)(Nt,{children:`Generate a one-time link that another device can use to pair with this backend as an authorized client.`})]}),(0,Q.jsxs)(Mt,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Client label (optional)`}),(0,Q.jsx)(Tt,{value:u,onChange:e=>d(e.target.value),placeholder:`e.g. Living room iPad`,disabled:g,autoFocus:!0})]}),(0,Q.jsxs)(`section`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h3`,{className:`text-xs font-medium text-foreground`,children:`Permissions`}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Limit what the paired client can do.`})]}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(L,{size:`xs`,variant:`outline`,disabled:g,onClick:()=>p([a,me,re,m].filter(e=>o.includes(e))),children:`Read only`}),(0,Q.jsx)(L,{size:`xs`,variant:`outline`,disabled:g,onClick:()=>p(i.filter(e=>o.includes(e))),children:`Standard`})]})]}),(0,Q.jsx)(`div`,{className:`divide-y divide-border/60 rounded-lg border border-input bg-muted/25`,children:or.filter(({scope:e})=>o.includes(e)).map(({scope:e,title:t,description:n})=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-3 py-2.5 transition-colors hover:bg-muted/40`,children:[(0,Q.jsx)(gt,{className:`mt-0.5`,checked:f.includes(e),disabled:g,onCheckedChange:t=>y(e,t===!0)}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-xs font-medium text-foreground`,children:t}),(0,Q.jsx)(`span`,{className:`block text-xs leading-snug text-muted-foreground`,children:n})]})]},e))}),h.length===0?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:`Select at least one permission.`}):h.includes(`access:write`)?(0,Q.jsx)(`p`,{className:`text-xs text-warning`,children:`This client can create or revoke access for other devices.`}):null]})]}),(0,Q.jsxs)(kt,{variant:`bare`,children:[(0,Q.jsx)(L,{variant:`outline`,disabled:g,onClick:()=>l(!1),children:`Cancel`}),(0,Q.jsx)(L,{disabled:g||h.length===0,onClick:()=>void v(),children:g?`Creating…`:`Create link`})]})]})]})]})}),Ai=(0,$.memo)(function(e){let t=(0,Z.c)(39),{endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:a,isLoading:o,pairingLinks:s,createdPairingCredentials:c,clientSessions:l,revokingPairingLinkId:u,revokingClientSessionId:d,onRevokePairingLink:f,onRevokeClientSession:p,canRevoke:m}=e,h=a===void 0?`current`:a,g;if(t[0]!==m||t[1]!==c||t[2]!==i||t[3]!==n||t[4]!==r||t[5]!==f||t[6]!==s||t[7]!==h||t[8]!==u){let e;t[10]!==m||t[11]!==c||t[12]!==i||t[13]!==n||t[14]!==r||t[15]!==f||t[16]!==h||t[17]!==u?(e=e=>(0,Q.jsx)(Di,{pairingLink:e,credential:c.get(e.id),endpointUrl:n,endpoints:r,defaultEndpointKey:i,presentation:h,revokingPairingLinkId:u,onRevoke:f,canRevoke:m},e.id),t[10]=m,t[11]=c,t[12]=i,t[13]=n,t[14]=r,t[15]=f,t[16]=h,t[17]=u,t[18]=e):e=t[18],g=s.map(e),t[0]=m,t[1]=c,t[2]=i,t[3]=n,t[4]=r,t[5]=f,t[6]=s,t[7]=h,t[8]=u,t[9]=g}else g=t[9];let _;if(t[19]!==m||t[20]!==l||t[21]!==p||t[22]!==h||t[23]!==d){let e;t[25]!==m||t[26]!==p||t[27]!==h||t[28]!==d?(e=e=>(0,Q.jsx)(Oi,{clientSession:e,presentation:h,revokingClientSessionId:d,onRevokeSession:p,canRevoke:m},e.sessionId),t[25]=m,t[26]=p,t[27]=h,t[28]=d,t[29]=e):e=t[29],_=l.map(e),t[19]=m,t[20]=l,t[21]=p,t[22]=h,t[23]=d,t[24]=_}else _=t[24];let v;t[30]!==l.length||t[31]!==o||t[32]!==s.length||t[33]!==h?(v=s.length===0&&l.length===0&&!o?(0,Q.jsx)(`div`,{className:pi(h),children:(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground/60`,children:`No pairing links or client sessions.`})}):null,t[30]=l.length,t[31]=o,t[32]=s.length,t[33]=h,t[34]=v):v=t[34];let y;return t[35]!==g||t[36]!==_||t[37]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[g,_,v]}),t[35]=g,t[36]=_,t[37]=v,t[38]=y):y=t[38],y}),ji=(0,$.memo)(function(e){let t=(0,Z.c)(50),{endpoint:n,isDefault:r,presentation:i,onSetDefault:a,onSetupTailscaleServe:o,onDisableTailscaleServe:s,isUpdatingTailscaleServe:c}=e,l=i===void 0?`current`:i,u=n.status===`available`,d;t[0]===n?d=t[1]:(d=xi(n)&&n.status!==`available`,t[0]=n,t[1]=d);let f=d,p;t[2]===n?p=t[3]:(p=xi(n)&&n.status===`available`,t[2]=n,t[3]=p);let m=p,h=!f,g=l===`endpoint-rail`,_;t[4]!==u||t[5]!==l?(_=mi(l,u),t[4]=u,t[5]=l,t[6]=_):_=t[6];let v;t[7]!==r||t[8]!==g?(v=g&&r?(0,Q.jsx)(`span`,{className:`absolute inset-y-2 left-0 w-1 rounded-r-full bg-primary`,"aria-hidden":!0}):null,t[7]=r,t[8]=g,t[9]=v):v=t[9];let y;t[10]===n.label?y=t[11]:(y=(0,Q.jsx)(`h3`,{className:`shrink-0 text-sm leading-5 font-medium text-foreground`,children:n.label}),t[10]=n.label,t[11]=y);let b;t[12]!==n.httpBaseUrl||t[13]!==h?(b=h?(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(Ue,{render:(0,Q.jsx)(`p`,{className:`min-w-0 truncate text-xs leading-5 text-muted-foreground`,children:n.httpBaseUrl})}),(0,Q.jsx)(We,{side:`top`,children:n.httpBaseUrl})]}):null,t[12]=n.httpBaseUrl,t[13]=h,t[14]=b):b=t[14];let x;t[15]===u?x=t[16]:(x=u?null:(0,Q.jsx)(`span`,{className:`shrink-0 rounded-md border border-border/70 px-1 py-0.5 text-3xs text-muted-foreground`,children:`Setup required`}),t[15]=u,t[16]=x);let S;t[17]!==y||t[18]!==b||t[19]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-3`,children:[y,b,x]}),t[17]=y,t[18]=b,t[19]=x,t[20]=S):S=t[20];let C;t[21]===r?C=t[22]:(C=r?(0,Q.jsx)(`span`,{className:`rounded-md border border-primary/30 bg-primary/10 px-1 py-0.5 text-3xs text-primary`,children:`Default`}):null,t[21]=r,t[22]=C);let w;t[23]!==n||t[24]!==c||t[25]!==f||t[26]!==o?(w=f?(0,Q.jsx)(L,{size:`xs`,variant:`outline`,onClick:()=>o(n),disabled:c,children:c?`Restarting…`:`Setup`}):null,t[23]=n,t[24]=c,t[25]=f,t[26]=o,t[27]=w):w=t[27];let T;t[28]!==m||t[29]!==n||t[30]!==c||t[31]!==s?(T=m?(0,Q.jsx)(L,{size:`xs`,variant:`destructive-outline`,onClick:()=>s(n),disabled:c,children:c?`Restarting…`:`Disable`}):null,t[28]=m,t[29]=n,t[30]=c,t[31]=s,t[32]=T):T=t[32];let E;t[33]!==n||t[34]!==r||t[35]!==f||t[36]!==a?(E=!f&&!r?(0,Q.jsx)(L,{size:`xs`,variant:`outline`,onClick:()=>a(n),children:`Set as default`}):null,t[33]=n,t[34]=r,t[35]=f,t[36]=a,t[37]=E):E=t[37];let D;t[38]!==C||t[39]!==w||t[40]!==T||t[41]!==E?(D=(0,Q.jsxs)(`div`,{className:`ml-auto flex min-h-6 shrink-0 items-center justify-end gap-2`,children:[C,w,T,E]}),t[38]=C,t[39]=w,t[40]=T,t[41]=E,t[42]=D):D=t[42];let O;t[43]!==D||t[44]!==S?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-6 min-w-0 flex-col gap-2 sm:-my-0.5 sm:flex-row sm:items-center`,children:[S,D]}),t[43]=D,t[44]=S,t[45]=O):O=t[45];let k;return t[46]!==O||t[47]!==_||t[48]!==v?(k=(0,Q.jsxs)(`div`,{className:_,children:[v,O]}),t[46]=O,t[47]=_,t[48]=v,t[49]=k):k=t[49],k});function Mi(e){let t=(0,Z.c)(14),{endpoint:n,hiddenEndpointCount:r,expanded:i,onToggleExpanded:a,fallback:o}=e;if(!n)return o;let s;t[0]===n.httpBaseUrl?s=t[1]:(s=(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:n.httpBaseUrl}),t[0]=n.httpBaseUrl,t[1]=s);let c;t[2]!==i||t[3]!==r?(c=r>0?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-medium`,children:i?`Hide`:`+${r}`}):null,t[2]=i,t[3]=r,t[4]=c):c=t[4];let l;t[5]!==s||t[6]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[s,c]}),t[5]=s,t[6]=c,t[7]=l):l=t[7];let u=l,d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Reachable at`}),t[8]=d):d=t[8];let f;return t[9]!==i||t[10]!==r||t[11]!==a||t[12]!==u?(f=(0,Q.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-1`,children:[d,r>0?(0,Q.jsx)(`button`,{type:`button`,className:`inline-flex min-w-0 max-w-full items-baseline gap-2 border-b border-dotted border-muted-foreground/60 text-left text-muted-foreground underline-offset-4 hover:border-foreground hover:text-foreground`,onClick:a,"aria-expanded":i,children:u}):(0,Q.jsx)(`span`,{className:`inline-flex min-w-0 max-w-full items-baseline gap-2`,children:u})]}),t[9]=i,t[10]=r,t[11]=a,t[12]=u,t[13]=f):f=t[13],f}function Ni(e){if(!e.entry.enabled&&e.connection.phase!==`unsupported`)return{text:`Off`,tone:`muted`};let{connection:t}=e;switch(t.phase){case`connected`:return{text:`Connected`,tone:`muted`};case`connecting`:return{text:`Connecting`,tone:`muted`};case`reconnecting`:return{text:t.error?`Reconnecting: ${t.error}`:`Reconnecting`,tone:`error`};case`unsupported`:return{text:`Client not supported`,tone:`muted`};case`error`:return{text:t.error?`Connection failed: ${t.error}`:`Connection failed`,tone:`error`};case`offline`:return{text:`Offline`,tone:`muted`};case`available`:return{text:`Not connected`,tone:`muted`}}}function Pi(e){let t=(0,Z.c)(161),{environment:n,removingEnvironmentId:r,onSetEnabled:i,onRemove:a,onAddRoute:o}=e,[s,c]=(0,$.useState)(!1),[l,u]=(0,$.useState)(!1),d=n.environmentId,p=n.connection.phase===`unsupported`,m=n.entry.enabled&&!p,h=n.connection.phase===`connected`,g=r===d,_=n.connection.traceId,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(v={target:`trace ID`,onCopy:Hi,onError:Vi},t[0]=v):v=t[0];let{copyToClipboard:y}=Ze(v),b;t[1]===y?b=t[2]:(b=e=>{y(e,{traceId:e})},t[1]=y,t[2]=b);let C=b,T;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(T={target:`MCP URL`,onCopy:Bi,onError:zi},t[3]=T):T=t[3];let{copyToClipboard:D}=Ze(T),k;t[4]===n.serverConfig?k=t[5]:(k=ir(n.serverConfig),t[4]=n.serverConfig,t[5]=k);let A=k,j;t[6]===d?j=t[7]:(j=ot.updateStateAtom(d),t[6]=d,t[7]=j);let P=x(j),te=P.status===`running`&&P.stage===`resuming`,ne;t[8]===n?ne=t[9]:(ne=Ni(n),t[8]=n,t[9]=ne);let re=ne,ie=n.serverConfig?.environment.serverVersion??null,ae=Qe(),oe;t[10]!==d||t[11]!==ae.environments?(oe=S(ae.environments.get(d)?.status??O())?.descriptor,t[10]=d,t[11]=ae.environments,t[12]=oe):oe=t[12];let se=oe,[ce,le]=(0,$.useState)(se);se!==void 0&&se!==ce&&le(se);let ue;t[13]!==d||t[14]!==ae.environments?(ue=ae.environments.get(d)?.environment.endpoint.httpBaseUrl,t[13]=d,t[14]=ae.environments,t[15]=ue):ue=t[15];let F=ue,[I,de]=(0,$.useState)(F);F!==void 0&&F!==I&&de(F);let fe=dt(d),R=h&&fe._tag===`Some`?fe.value.target:null,me=F??I,he;t[16]!==R||t[17]!==n.entry||t[18]!==me?(he=Re({entry:n.entry,relayHttpBaseUrl:me,connectedTarget:R}),t[16]=R,t[17]=n.entry,t[18]=me,t[19]=he):he=t[19];let ge=he,ve;t[20]!==n.serverConfig||t[21]!==ce?(ve=n.serverConfig??(ce===void 0?null:{environment:ce}),t[20]=n.serverConfig,t[21]=ce,t[22]=ve):ve=t[22];let ye;t[23]===ve?ye=t[24]:(ye=M(ve),t[23]=ve,t[24]=ye);let be=ye,Se;t[25]===n.entry?Se=t[26]:(Se=Oe(n.entry),t[25]=n.entry,t[26]=Se);let z=Se.length,B;t[27]!==R||t[28]!==n?(B=yr(n,R),t[27]=R,t[28]=n,t[29]=B):B=t[29];let Ce=te?`Restarting`:re.text,we=m&&A?ie:null,Te;t[30]!==B||t[31]!==Ce||t[32]!==we?(Te=[B,Ce,we].filter(Ri),t[30]=B,t[31]=Ce,t[32]=we,t[33]=Te):Te=t[33];let V=Te.join(` · `),Ee=m&&h&&A!==null&&(P.status===`idle`||P.status===`failed`),De;t[34]!==m||t[35]!==n.connection||t[36]!==p?(De=p?n.connection.error??Ve(n.connection):m?Ve(n.connection):`Switched off`,t[34]=m,t[35]=n.connection,t[36]=p,t[37]=De):De=t[37];let ke=`${De}${A?`\nUpdate available: ${A.serverVersion} → ${A.clientVersion}`:``}`,Ae=n.label,je=!m,Me=m&&re.tone===`error`&&!te&&`text-destructive`,Ne;t[38]===Me?Ne=t[39]:(Ne=pe(`min-w-0 truncate`,Me),t[38]=Me,t[39]=Ne);let Pe;t[40]===Ne?Pe=t[41]:(Pe=(0,Q.jsx)(`span`,{className:Ne}),t[40]=Ne,t[41]=Pe);let H;t[42]!==ke||t[43]!==V||t[44]!==Pe?(H=(0,Q.jsx)(Ue,{payload:ke,render:Pe,children:V}),t[42]=ke,t[43]=V,t[44]=Pe,t[45]=H):H=t[45];let Fe;t[46]===ke?Fe=t[47]:(Fe=(0,Q.jsx)(We,{side:`top`,className:`whitespace-pre-wrap`,children:ke}),t[46]=ke,t[47]=Fe);let U;t[48]!==H||t[49]!==Fe?(U=(0,Q.jsxs)(Ge,{children:[H,Fe]}),t[48]=H,t[49]=Fe,t[50]=U):U=t[50];let W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[51]=W):W=t[51];let Le;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(Le=()=>c(Li),t[52]=Le):Le=t[52];let ze=z===1?`Routes`:`${z} routes`,Be=s&&`rotate-90`,He;t[53]===Be?He=t[54]:(He=pe(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,Be),t[53]=Be,t[54]=He);let G;t[55]===He?G=t[56]:(G=(0,Q.jsx)(_e,{"aria-hidden":!0,className:He}),t[55]=He,t[56]=G);let Ke;t[57]!==s||t[58]!==ze||t[59]!==G?(Ke=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":s,onClick:Le,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[ze,G]}),t[57]=s,t[58]=ze,t[59]=G,t[60]=Ke):Ke=t[60];let qe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`shrink-0`,children:`·`}),t[61]=qe):qe=t[61];let Je=`remote-permissions-${d}`,Ye;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=()=>u(Ii),t[62]=Ye):Ye=t[62];let Xe=l&&`rotate-90`,K;t[63]===Xe?K=t[64]:(K=pe(`size-3 shrink-0 transition-transform duration-150 motion-reduce:transition-none`,Xe),t[63]=Xe,t[64]=K);let $e;t[65]===K?$e=t[66]:($e=(0,Q.jsx)(_e,{"aria-hidden":!0,className:K}),t[65]=K,t[66]=$e);let et;t[67]!==l||t[68]!==Je||t[69]!==$e?(et=(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":l,"aria-controls":Je,onClick:Ye,className:`inline-flex shrink-0 items-center gap-0.5 rounded-sm text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring`,children:[`Permissions`,$e]}),t[67]=l,t[68]=Je,t[69]=$e,t[70]=et):et=t[70];let tt;t[71]!==U||t[72]!==Ke||t[73]!==et?(tt=(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1`,children:[U,W,Ke,qe,et]}),t[71]=U,t[72]=Ke,t[73]=et,t[74]=tt):tt=t[74];let q;t[75]===P?q=t[76]:(q=P.status===`idle`?null:(0,Q.jsx)(`div`,{className:`mt-1 max-w-md`,children:(0,Q.jsx)($n,{state:P})}),t[75]=P,t[76]=q);let nt;t[77]!==n||t[78]!==o||t[79]!==s?(nt=s&&(0,Q.jsx)(mr,{environment:n,onAddRoute:()=>o(n)}),t[77]=n,t[78]=o,t[79]=s,t[80]=nt):nt=t[80];let rt;t[81]!==d||t[82]!==h||t[83]!==l?(rt=l&&(0,Q.jsx)(`div`,{id:`remote-permissions-${d}`,className:`mt-2 border-t border-border/50`,children:(0,Q.jsx)(sr,{environmentId:d,connected:h,routeContext:!0})}),t[81]=d,t[82]=h,t[83]=l,t[84]=rt):rt=t[84];let it;t[85]!==nt||t[86]!==rt?(it=(0,Q.jsxs)(Q.Fragment,{children:[nt,rt]}),t[85]=nt,t[86]=rt,t[87]=it):it=t[87];let at;t[88]!==n.entry.serverUpdateRequired||t[89]!==n.label||t[90]!==d||t[91]!==ce?.serverVersion||t[92]!==P.status||t[93]!==p?(at=p&&n.entry.serverUpdateRequired===!0&&P.status!==`running`?(0,Q.jsx)(Hn,{environmentId:d,serverLabel:`${n.label} server`,fromVersion:ce?.serverVersion,targetVersion:Ie,label:P.status===`failed`?`Retry update`:`Update`}):null,t[88]=n.entry.serverUpdateRequired,t[89]=n.label,t[90]=d,t[91]=ce?.serverVersion,t[92]=P.status,t[93]=p,t[94]=at):at=t[94];let st;t[95]!==n.label||t[96]!==n.serverConfig||t[97]!==d||t[98]!==P.status||t[99]!==Ee||t[100]!==A?(st=Ee?(0,Q.jsx)(Jn,{environmentId:d,serverLabel:`${n.label} server`,selfUpdate:Vn(n.serverConfig),installation:n.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:Nn(n.serverConfig),threadContinuation:Dn(n.serverConfig),targetVersion:A.clientVersion,label:P.status===`failed`?`Retry update`:`Update`,appearance:`icon`}):null,t[95]=n.label,t[96]=n.serverConfig,t[97]=d,t[98]=P.status,t[99]=Ee,t[100]=A,t[101]=st):st=t[101];let ct=g||p,J=`${m?`Switch off`:`Switch on`} ${n.label}`,lt;t[102]!==d||t[103]!==i?(lt=e=>i(d,e),t[102]=d,t[103]=i,t[104]=lt):lt=t[104];let ut;t[105]!==m||t[106]!==ct||t[107]!==J||t[108]!==lt?(ut=(0,Q.jsx)(Ue,{render:(0,Q.jsx)(er,{size:`sm`,checked:m,disabled:ct,"aria-label":J,onCheckedChange:lt})}),t[105]=m,t[106]=ct,t[107]=J,t[108]=lt,t[109]=ut):ut=t[109];let ft=p?`Client not supported`:m?`Switch off`:`Switch on`,pt;t[110]===ft?pt=t[111]:(pt=(0,Q.jsx)(We,{side:`top`,children:ft}),t[110]=ft,t[111]=pt);let Y;t[112]!==ut||t[113]!==pt?(Y=(0,Q.jsxs)(Ge,{children:[ut,pt]}),t[112]=ut,t[113]=pt,t[114]=Y):Y=t[114];let mt=`More actions for ${n.label}`,ht;t[115]!==g||t[116]!==mt?(ht=(0,Q.jsx)(L,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,disabled:g,"aria-label":mt}),t[115]=g,t[116]=mt,t[117]=ht):ht=t[117];let gt;t[118]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,Q.jsx)(Kn,{className:`size-3.5`}),t[118]=gt):gt=t[118];let _t;t[119]===ht?_t=t[120]:(_t=(0,Q.jsx)(N,{render:ht,children:gt}),t[119]=ht,t[120]=_t);let vt;t[121]!==n.serverConfig||t[122]!==d?(vt=(0,Q.jsx)(pr,{environmentId:d,serverConfig:n.serverConfig}),t[121]=n.serverConfig,t[122]=d,t[123]=vt):vt=t[123];let yt,bt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(yt=()=>c(Fi),bt=(0,Q.jsx)(xe,{}),t[124]=yt,t[125]=bt):(yt=t[124],bt=t[125]);let xt=s?`Hide routes`:`Routes`,St;t[126]===xt?St=t[127]:(St=(0,Q.jsxs)(f,{onClick:yt,children:[bt,xt]}),t[126]=xt,t[127]=St);let Ct;t[128]!==D||t[129]!==ge?(Ct=ge?(0,Q.jsx)(f,{onClick:()=>D(ge,{url:ge}),children:`Copy MCP URL`}):null,t[128]=D,t[129]=ge,t[130]=Ct):Ct=t[130];let wt;t[131]!==C||t[132]!==_?(wt=_?(0,Q.jsx)(f,{onClick:()=>C(_),children:`Copy trace ID`}):null,t[131]=C,t[132]=_,t[133]=wt):wt=t[133];let Tt;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(Tt=(0,Q.jsx)(ee,{}),t[134]=Tt):Tt=t[134];let Et;t[135]!==n||t[136]!==a?(Et=()=>a(n),t[135]=n,t[136]=a,t[137]=Et):Et=t[137];let Dt=g?`Removing…`:`Remove from this device…`,Ot;t[138]!==Et||t[139]!==Dt?(Ot=(0,Q.jsx)(f,{variant:`destructive`,onClick:Et,children:Dt}),t[138]=Et,t[139]=Dt,t[140]=Ot):Ot=t[140];let kt;t[141]!==vt||t[142]!==St||t[143]!==Ct||t[144]!==wt||t[145]!==Ot?(kt=(0,Q.jsxs)(E,{align:`end`,children:[vt,St,Ct,wt,Tt,Ot]}),t[141]=vt,t[142]=St,t[143]=Ct,t[144]=wt,t[145]=Ot,t[146]=kt):kt=t[146];let At;t[147]!==_t||t[148]!==kt?(At=(0,Q.jsxs)(w,{children:[_t,kt]}),t[147]=_t,t[148]=kt,t[149]=At):At=t[149];let jt;return t[150]!==n.label||t[151]!==be||t[152]!==je||t[153]!==tt||t[154]!==q||t[155]!==it||t[156]!==at||t[157]!==st||t[158]!==Y||t[159]!==At?(jt=(0,Q.jsxs)(br,{kind:be,label:Ae,dimmed:je,subtitle:tt,below:q,detail:it,children:[at,st,Y,At]}),t[150]=n.label,t[151]=be,t[152]=je,t[153]=tt,t[154]=q,t[155]=it,t[156]=at,t[157]=st,t[158]=Y,t[159]=At,t[160]=jt):jt=t[160],jt}function Fi(e){return!e}function Ii(e){return!e}function Li(e){return!e}function Ri(e){return e!==null}function zi(e){K.add(Y({type:`error`,title:`Could not copy MCP URL`,description:e.message}))}function Bi(e){let{url:t}=e;K.add({type:`success`,title:`MCP URL copied`,description:`Add it to an agent, e.g. claude mcp add --transport http t3 ${t}`})}function Vi(e){K.add(Y({type:`error`,title:`Could not copy trace ID`,description:e.message}))}function Hi(e){let{traceId:t}=e;K.add({type:`success`,title:`Trace ID copied`,description:t})}function Ui(e){let t=(0,Z.c)(10),{checked:n,disabled:r,disabledReason:i,onCheckedChange:a,ariaLabel:o}=e,s=o===void 0?`Enable P4 Connect`:o,c;t[0]===a?c=t[1]:(c=a?{onCheckedChange:a}:{},t[0]=a,t[1]=c);let l;t[2]!==s||t[3]!==n||t[4]!==r||t[5]!==c?(l=(0,Q.jsx)(er,{"aria-label":s,checked:n,disabled:r,...c}),t[2]=s,t[3]=n,t[4]=r,t[5]=c,t[6]=l):l=t[6];let u=l,d;return t[7]!==u||t[8]!==i?(d=i?(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(Ue,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:u})}),(0,Q.jsx)(We,{side:`top`,children:i})]}):u,t[7]=u,t[8]=i,t[9]=d):d=t[9],d}function Wi(e){let t=(0,Z.c)(44),{canManageRelay:n}=e,r=tt(),{isSignedIn:i,linkState:a,linkRevoked:o,managedTunnelActive:s,managedTunnelOutOfSync:c,publishAgentActivity:l,holdWebhooksWhileOffline:u,operationError:d,reconcileCloudState:f}=Xn(),[p,m]=(0,$.useState)(!1),[h,g]=(0,$.useState)(!1),_=i?n?null:`Your session does not have permission to manage P4 Connect access.`:`Sign in to P4 Connect to manage this environment.`,v=p||h,y;t[0]!==r||t[1]!==l||t[2]!==f?(y=async e=>{r!==null&&ut(r,`relay:write`)&&(m(!0),await f({managedTunnel:e,publish:l})&&K.add({type:`success`,title:e?`P4 Connect linked`:l?`P4 Connect tunnel disabled`:`P4 Connect unlinked`,description:e?`This environment is available through P4 Connect.`:l?`The managed tunnel was removed. Agent activity publishing stays on.`:`This environment is no longer available through P4 Connect.`}),m(!1))},t[0]=r,t[1]=l,t[2]=f,t[3]=y):y=t[3];let b=y,x;t[4]!==s||t[5]!==r||t[6]!==f?(x=async e=>{r!==null&&ut(r,`relay:write`)&&(g(!0),await f({managedTunnel:s,publish:e})&&K.add({type:`success`,title:e?`Agent activity enabled`:`Agent activity disabled`,description:e?`This environment publishes agent activity to your mobile clients.`:`This environment will stop publishing agent activity.`}),g(!1))},t[4]=s,t[5]=r,t[6]=f,t[7]=x):x=t[7];let S=x,C;t[8]!==s||t[9]!==l||t[10]!==f?(C=async e=>{g(!0),await f({managedTunnel:s,publish:l,holdWebhooksWhileOffline:e})&&K.add({type:`success`,title:e?`Webhooks held while offline`:`Webhooks no longer held`,description:e?`P4 Connect keeps webhook requests for up to 24 hours while this environment is offline.`:`Requests to an offline environment now fail. Anything already held is still delivered.`}),g(!1)},t[8]=s,t[9]=l,t[10]=f,t[11]=C):C=t[11];let w=C,T;t[12]!==n||t[13]!==_||t[14]!==v||t[15]!==i||t[16]!==o||t[17]!==s||t[18]!==c||t[19]!==d||t[20]!==a||t[21]!==b?(T=window.desktopBridge?(0,Q.jsx)(mn,{title:Zn(`t3-connect`).title,description:o?`This environment was removed from P4 Connect. Turn it on to link it again.`:s?`This environment is available to your other devices through P4 Connect.`:c?`P4 Connect is out of sync. This environment is linked only to publish agent activity, so other devices cannot connect. Turn P4 Connect on to repair it.`:`Make this environment available to your other devices through P4 Connect.`,status:d??a.error,control:(0,Q.jsx)(Ui,{checked:s,disabled:!n||!i||a.data===null||a.isPending||v,disabledReason:_,onCheckedChange:e=>void b(e)})}):o?(0,Q.jsx)(mn,{title:Zn(`t3-connect`).title,description:"This environment was removed from P4 Connect. Run `p4c connect link` on the host to link it again."}):null,t[12]=n,t[13]=_,t[14]=v,t[15]=i,t[16]=o,t[17]=s,t[18]=c,t[19]=d,t[20]=a,t[21]=b,t[22]=T):T=t[22];let E;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(E=Zn(`publish-agent-activity`),t[23]=E):E=t[23];let D=!n||!i||a.data===null||a.isPending||v,O;t[24]===S?O=t[25]:(O=e=>void S(e),t[24]=S,t[25]=O);let k;t[26]!==_||t[27]!==l||t[28]!==D||t[29]!==O?(k=(0,Q.jsx)(mn,{title:E.title,description:`Send activity to mobile notifications and Live Activities without P4 Connect.`,control:(0,Q.jsx)(Ui,{ariaLabel:`Publish agent activity to mobile clients`,checked:l,disabled:D,disabledReason:_,onCheckedChange:O})}),t[26]=_,t[27]=l,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]!==n||t[32]!==_||t[33]!==u||t[34]!==v||t[35]!==i||t[36]!==s||t[37]!==a||t[38]!==w?(A=s?(0,Q.jsx)(mn,{title:Zn(`hold-webhooks-while-offline`).title,description:`Keep webhook requests for up to 24 hours while this environment is offline, then deliver them. Off: P4 Connect only forwards requests and stores nothing.`,control:(0,Q.jsx)(Ui,{ariaLabel:`Hold webhook requests while this environment is offline`,checked:u,disabled:!n||!i||a.isPending||v,disabledReason:_,onCheckedChange:e=>void w(e)})}):null,t[31]=n,t[32]=_,t[33]=u,t[34]=v,t[35]=i,t[36]=s,t[37]=a,t[38]=w,t[39]=A):A=t[39];let j;return t[40]!==T||t[41]!==k||t[42]!==A?(j=(0,Q.jsxs)(Q.Fragment,{children:[T,k,A]}),t[40]=T,t[41]=k,t[42]=A,t[43]=j):j=t[43],j}function Gi(e){let t=(0,Z.c)(3),{canReadRelay:n,canManageRelay:r}=e;if(!Fe())return null;if(!n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(mn,{title:`P4 Connect`,description:`To edit these settings, pair this connection with both View relay and Manage relay permissions.`}),t[0]=e):e=t[0],e}let i;return t[1]===r?i=t[2]:(i=(0,Q.jsx)(Wi,{canManageRelay:r}),t[1]=r,t[2]=i),i}function Ki(e){let t=(0,Z.c)(4),{cloudEnabled:n}=e,r=n===void 0||n,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Lt,{variant:`icon`,children:(0,Q.jsx)(ve,{})}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(zt,{children:`No saved remote environments`}),t[1]=a):a=t[1];let o=r?`Click “Add environment” to pair another environment, or connect one from P4 Connect.`:`Click “Add environment” to pair another environment.`,s;return t[2]===o?s=t[3]:(s=(0,Q.jsxs)(Vt,{className:`min-h-52`,children:[i,(0,Q.jsxs)(Rt,{children:[a,(0,Q.jsx)(Bt,{children:o})]})]}),t[2]=o,t[3]=s),s}function qi(e){let t=(0,Z.c)(3),{primaryEnvironmentId:n,savedEnvironments:r}=e,i;return t[0]!==n||t[1]!==r?(i=Fe()?(0,Q.jsx)(Yn,{primaryEnvironmentId:n,savedEnvironments:r,empty:(0,Q.jsx)(Ki,{})}):r.length===0?(0,Q.jsx)(Ki,{cloudEnabled:!1}):null,t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Ji(){let e=window.desktopBridge,t=x(ct),{environments:n}=et(),r=$e(),i=pt(wn,{reportFailure:!1}),a=pt(Cn,{reportFailure:!1}),l=pt(st.remove,{reportFailure:!1}),u=pt(st.register,{reportFailure:!1}),d=Qe(),f=pt(st.setEnabled,{reportFailure:!1}),p=r?.environmentId??null,m=Sn(),h=m.data?.authenticated?m.data.permissions??m.data.scopes??null:null,g=e?null:m.data?.auth.policy??null,_=(0,$.useMemo)(()=>n.filter(e=>e.entry.target._tag!==`PrimaryConnectionTarget`),[n]),v=(0,$.useMemo)(()=>_.filter(e=>!Be(e.entry.target)),[_]),y=(0,$.useMemo)(()=>c(e=>_.map(t=>({environment:t,updateStatus:e(ot.updateStateAtom(t.environmentId)).status}))),[_]),b=x(y),S=(0,$.useMemo)(()=>b.flatMap(({environment:e,updateStatus:t})=>{let n=ir(e.serverConfig),r=Vn(e.serverConfig),i=Nn(e.serverConfig);return!n||t===`running`||!e.entry.enabled||e.connection.phase!==`connected`||Be(e.entry.target)||r===null||r===`desktop-managed`&&!i?[]:[{environmentId:e.environmentId,serverLabel:e.label,selfUpdate:r,installation:e.serverConfig?.environment.capabilities.serverInstallation,desktopAppUpdate:i,threadContinuation:Dn(e.serverConfig),continueThreadsAfterServerUpdate:e.serverConfig?.settings.continueThreadsAfterServerUpdate??!1,targetVersion:n.clientVersion}]}),[b]),C=(0,$.useMemo)(()=>[...r?[r]:[],..._.filter(e=>e.entry.enabled)],[r,_]),T=(0,$.useMemo)(()=>{let e=new Set;for(let t of _){let n=t.entry.profile;if(t.entry.target._tag!==`SshConnectionTarget`||de(n)||n.value._tag!==`SshConnectionProfile`)continue;let r=n.value.target;e.add(r.alias),e.add(vr(r))}return e},[_]),[D,O]=(0,$.useState)(null),[k,j]=(0,$.useState)(null),[P,ee]=(0,$.useState)(()=>new Map),ne=(0,$.useCallback)(e=>{ee(t=>new Map(t).set(e.id,e.credential))},[]),[re,ie]=(0,$.useState)(null),[ae,oe]=(0,$.useState)(null),[se,ce]=(0,$.useState)(!1),[le,F]=(0,$.useState)(!1),[I,fe]=(0,$.useState)(null),[R,me]=(0,$.useState)(`remote`),[he,ge]=(0,$.useState)(``),[be,xe]=(0,$.useState)(``),[z,B]=(0,$.useState)(``),[Te,V]=(0,$.useState)(``),[Ee,Oe]=(0,$.useState)(``),[ke,Ae]=(0,$.useState)(!1),Me=(0,$.useRef)(void 0),[Pe,H]=(0,$.useState)(null),[U,W]=(0,$.useState)(!1),[Ie,Le]=(0,$.useState)(null),[Re,ze]=(0,$.useState)(!1),[Ve,He]=(0,$.useState)(!1),[Ze,tt]=(0,$.useState)(!1),[q,nt]=(0,$.useState)(!1),[it,at]=(0,$.useState)(null),[J,dt]=(0,$.useState)(null),mt=J!==null,[ht,gt]=(0,$.useState)(null),[_t,It]=(0,$.useState)(!1),[Lt,Rt]=(0,$.useState)(String($r)),[zt,Bt]=(0,$.useState)(null),Vt=r?.serverConfig??null,qt=ir(Vt),Jt=x(ot.updateStateAtom(p)),[Yt,Zt]=(0,$.useState)(!1),Qt=$t(e=>e.defaultAdvertisedEndpointKey),en=$t(e=>e.setDefaultAdvertisedEndpointKey),tn=lt(p,te),nn=lt(p,ue),rn=lt(p,s),an=lt(p,A),on=lt(p,o),sn=!Ce()&&an,cn=ft(tn&&p!==null?Rr.accessChanges({environmentId:p,input:null}):null),ln=ft(sn&&e?Gr:null),un=e!==void 0&&le&&R===`ssh`,dn=ft(un?Qr:null),_n=dn.refresh;(0,$.useEffect)(()=>{un&&_n()},[un,_n]);let vn=ft(sn&&e?Tn:null),X=vn.data,An=it??vn.error,Mn=vn.isPending&&vn.data===null,Pn=dn.data??ti,Ln=(0,$.useMemo)(()=>Pn.filter(e=>{let t=vr(e);return!T.has(e.alias)&&!T.has(t)}),[Pn,T]),Rn=(0,$.useMemo)(()=>qr(Ln,z),[z,Ln]),zn=dn.isPending&&dn.data===null,Bn=dn.error,Hn=e!==void 0&&(zn||Ln.length>0),Gn=ln.data?.serverExposureState??null,Yn=ln.data?.advertisedEndpoints??ei,Xn=D??ln.error,nr=k??cn.error,rr=cn.isPending&&cn.data===null,Z=(0,$.useMemo)(()=>{let e=cn.data;return e?.type===`snapshot`?hi(e.payload.pairingLinks.map(e=>vi(e))):[]},[cn.data]),or=(0,$.useMemo)(()=>{let e=cn.data;return e?.type===`snapshot`?_i(e.payload.clientSessions.map(e=>yi(e))):[]},[cn.data]),cr=e?Gn?.mode===`network-accessible`:g===`remote-reachable`,lr=Lt.trim(),dr=Number(lr),fr=/^\d+$/u.test(lr)&&Number.isInteger(dr)&&dr>=1&&dr<=65535,mr=(0,$.useMemo)(()=>{if(!ht)return null;if(!fr||dr===$r)return ht.httpBaseUrl;try{let e=new URL(ht.httpBaseUrl);return e.port=String(dr),e.toString().replace(/\/$/u,``)}catch{return ht.httpBaseUrl}},[fr,dr,ht]),hr=(0,$.useCallback)(async t=>{if(e&&p!==null&&ut(p,`environment:maintain`)){ze(!0),O(null);try{await e.setServerExposureMode(t?`network-accessible`:`local-only`),Kr(),He(!1),ze(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to update network exposure.`;He(!1),O(t),K.add(Y({type:`error`,title:`Could not update network access`,description:t})),ze(!1)}}},[e,p]),gr=(0,$.useCallback)(()=>{zt!==null&&hr(zt===`network-accessible`)},[hr,zt]),_r=(0,$.useCallback)(async()=>{if(e&&p!==null&&ut(p,`environment:maintain`)&&fr){tt(!0),O(null);try{await e.setTailscaleServeEnabled({enabled:!0,port:dr}),Kr(),gt(null)}catch(e){let t=e instanceof Error?e.message:`Failed to configure Tailscale HTTPS.`;O(t),K.add(Y({type:`error`,title:`Could not set up Tailscale HTTPS`,description:t}))}finally{tt(!1)}}},[e,fr,dr,p]),yr=(0,$.useCallback)(e=>{Rt(String(Gn?.tailscaleServePort??$r)),gt(e)},[Gn?.tailscaleServePort]),br=(0,$.useCallback)(async()=>{if(e&&p!==null&&ut(p,`environment:maintain`)){tt(!0),O(null);try{await e.setTailscaleServeEnabled({enabled:!1,port:Gn?.tailscaleServePort??$r}),Kr(),It(!1)}catch(e){let t=e instanceof Error?e.message:`Failed to disable Tailscale HTTPS.`;O(t),K.add(Y({type:`error`,title:`Could not disable Tailscale HTTPS`,description:t}))}finally{tt(!1)}}},[e,Gn,p]),xr=(0,$.useCallback)(e=>{It(!0)},[]),Sr=(0,$.useCallback)(async e=>{if(p!==null&&ut(p,`access:write`)){ie(e),j(null);try{await xn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke pairing link.`;j(t),K.add(Y({type:`error`,title:`Could not revoke pairing link`,description:t}))}finally{ie(null)}}},[p]),Cr=(0,$.useCallback)(async e=>{if(p!==null&&ut(p,`access:write`)){oe(e),j(null);try{await bn(e)}catch(e){let t=e instanceof Error?e.message:`Failed to revoke client access.`;j(t),K.add(Y({type:`error`,title:`Could not revoke client access`,description:t}))}finally{oe(null)}}},[p]),wr=(0,$.useCallback)(async()=>{if(p!==null&&ut(p,`access:write`)){ce(!0),j(null);try{let e=await yn();K.add({type:`success`,title:e===1?`Revoked 1 other client`:`Revoked ${e} clients`,description:`Other paired clients will need a new pairing link before reconnecting.`})}catch(e){let t=e instanceof Error?e.message:`Failed to revoke other clients.`;j(t),K.add(Y({type:`error`,title:`Could not revoke other clients`,description:t}))}finally{ce(!1)}}},[p]),Er=(0,$.useCallback)(async e=>{W(!0),H(null);let t=await a({target:e,label:``,...I?{expectedEnvironmentId:I.environmentId}:{}});if(t._tag===`Failure`){De(t)||H(di(je(t))),W(!1);return}ge(``),xe(``),B(``),V(``),Oe(``),F(!1),K.add({type:`success`,title:I?`Route added`:`Environment connected`,description:I?`${I.label} can now be reached over SSH ${e.alias}.`:`${e.alias} is ready over an SSH-managed tunnel.`}),W(!1)},[a,I]),Dr=(0,$.useCallback)(async()=>{if(R===`ssh`){let e;try{e=ci({host:z,username:Te,port:Ee})}catch(e){H(di(e));return}await Er(e);return}W(!0),H(null);let e;try{e=ui({host:he,pairingCode:be})}catch(e){let t=e instanceof Error?e.message:`Failed to add backend.`;H(t),K.add(Y({type:`error`,title:`Could not add backend`,description:t})),W(!1);return}let t=await i({...e,...I?{expectedEnvironmentId:I.environmentId}:{}});if(t._tag===`Failure`){if(!De(t)){let e=je(t),n=e instanceof Error?e.message:`Failed to add backend.`;H(n),K.add(Y({type:`error`,title:`Could not add backend`,description:n}))}W(!1);return}ge(``),xe(``),B(``),V(``),Oe(``),F(!1),K.add(I?{type:`success`,title:`Route added`,description:`${I.label} now has another way to connect.`}:{type:`success`,title:`Backend added`,description:`The environment is saved and will reconnect on app startup.`}),W(!1)},[I,i,Er,he,R,be,z,Ee,Te]),Or=(0,$.useCallback)(e=>{e.nativeEvent.isComposing||e.keyCode===229||e.key===`Enter`&&z.trim().length>0&&(e.preventDefault(),Dr())},[Dr,z]),kr=(0,$.useCallback)(async t=>{if(U||!e)return;W(!0),H(null),B(t.alias);let n;try{n=await e.resolveSshHost(t.alias)}catch(e){H(di(e)),W(!1);return}V(n.username??``),Oe(n.port===null?``:String(n.port)),await Er(n)},[Er,e,U]),jr=(0,$.useCallback)(e=>{if(e.nativeEvent.isComposing||e.keyCode===229)return;let n=ke&&Hn;if(n){let n=Gt(e,t,{platform:navigator.platform,context:{modelPickerOpen:!1}}),r=Ut(n??``),i=r===null?void 0:Rn[r];if(i){e.preventDefault(),e.stopPropagation(),Ae(!1),kr(i);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation();return}}let r=n&&Me.current!==void 0;!e.defaultPrevented&&!r&&e.key===`Enter`&&z.trim().length>0&&(e.preventDefault(),Dr())},[Rn,Dr,kr,Hn,t,z,ke]),Nr=(0,$.useCallback)(async(e,t)=>{H(null);let n=await f({environmentId:e,enabled:t});if(n._tag===`Failure`&&!De(n)){let e=je(n),r=e instanceof Error?e.message:`Failed to switch the backend ${t?`on`:`off`}.`;H(r),K.add(Y({type:`error`,title:`Could not switch backend ${t?`on`:`off`}`,description:r}))}},[f]),Pr=(0,$.useCallback)(async e=>{let t=e.environmentId;Le(t),H(null);let n=await l(t);if(Le(null),n._tag===`Failure`&&!De(n)){let e=je(n),t=e instanceof Error?e.message:`Failed to remove backend.`;H(t),K.add(Y({type:`error`,title:`Could not remove backend`,description:t}))}},[l]),[Fr,Ir]=(0,$.useState)(null),Lr=(0,$.useCallback)(async e=>{if(e.relayManaged&&Fe()){Ir(e);return}await rt(`Remove ${e.label} from this device?\nThis forgets its pairing, credentials, and cached threads here. Switch it off instead to keep it saved.`,{variant:`destructive`})===!0&&await Pr(e)},[Pr]),zr=Z,Br=(0,$.useMemo)(()=>Yn.find(xi)??null,[Yn]),Vr=(0,$.useMemo)(()=>cr?Yn.filter(e=>!xi(e)):[],[Yn,cr]),Hr=(0,$.useMemo)(()=>Br?[...Vr,Br]:Vr,[Br,Vr]),Ur=(0,$.useMemo)(()=>bi(Vr,Qt),[Qt,Vr]),Wr=(0,$.useMemo)(()=>Ur??bi(Br?[Br]:[],Qt),[Qt,Ur,Br]),Jr=Wr?Si(Wr):null,Yr=(0,$.useCallback)(e=>{en(Si(e))},[en]),Xr=(0,$.useCallback)(e=>{let t=li(e);if(t){ge(t.host),xe(t.pairingCode);return}ge(e)},[]),Zr=e=>{let t=R===e.mode;return(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":t,className:pe(`group flex min-h-24 items-start gap-3 rounded-lg border p-4 text-left`,t?`border-primary/50 bg-primary/5`:`border-border/60 hover:bg-muted/40`),disabled:U,onClick:()=>{me(e.mode)},children:[e.icon?(0,Q.jsx)(`span`,{className:pe(`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-md border`,t?`border-primary/30 bg-primary/10 text-primary`:`border-border/70 bg-background text-muted-foreground group-hover:text-foreground`),children:e.icon}):null,(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:e.title}),(0,Q.jsx)(`span`,{className:`mt-1 block text-xs leading-relaxed text-muted-foreground`,children:e.description})]})]})},ii=()=>(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_10rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Host`}),(0,Q.jsx)(Tt,{value:he,onChange:e=>Xr(e.target.value),placeholder:`backend.example.com`,disabled:U,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Pairing code`}),(0,Q.jsx)(Tt,{value:be,onChange:e=>xe(e.target.value),placeholder:`PAIRCODE`,disabled:U,spellCheck:!1})]})]}),(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`span`,{className:`mt-1 block text-2xs text-muted-foreground`,children:`Paste a full pairing URL here to fill both fields automatically.`})})]}),ai=I!==null&&!I.relayManaged&&d.environments.has(I.environmentId)?d.environments.get(I.environmentId).environment:null,oi=async()=>{if(ai===null||I===null)return;W(!0);let e=await u(new Ne({target:new we({environmentId:ai.environmentId,label:I.label})}));if(W(!1),e._tag===`Failure`){if(!De(e)){let t=je(e);H(t instanceof Error?t.message:`Could not add the route.`)}return}F(!1),K.add({type:`success`,title:`Route added`,description:`${I.label} falls back to P4 Connect when its other routes are unreachable.`})},si=()=>(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[ai===null?null:(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`This machine is on your P4 Connect account. Use it as a fallback route.`}),(0,Q.jsx)(L,{size:`xs`,variant:`outline`,disabled:U,onClick:()=>void oi(),children:`Add P4 Connect`})]}),ii(),Pe?(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:Pe}):null,(0,Q.jsxs)(L,{variant:`outline`,className:`w-full`,disabled:U,onClick:()=>void Dr(),children:[(0,Q.jsx)(ye,{className:`size-3.5`}),U?`Adding…`:I?`Add route`:`Add environment`]})]}),fi=()=>(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsxs)(`div`,{className:`space-y-3`,children:[(0,Q.jsxs)(`div`,{className:`block`,children:[(0,Q.jsx)(`label`,{htmlFor:`saved-backend-ssh-host`,className:`mb-1.5 block text-xs font-medium text-foreground`,children:`SSH host or alias`}),(0,Q.jsxs)(bt,{items:Rn,itemToStringValue:e=>e.alias,mode:`none`,openOnInputClick:!0,open:ke,onOpenChange:Ae,onItemHighlighted:e=>{Me.current=e},value:z,onValueChange:(e,t)=>{if(B(e),t.reason!==`item-press`)return;let n=Rn.find(t=>t.alias===e);n&&kr(n)},children:[(0,Q.jsx)(St,{id:`saved-backend-ssh-host`,onKeyDown:jr,placeholder:`Search hosts or type devbox`,disabled:U,spellCheck:!1}),Hn?(0,Q.jsx)(Ct,{children:zn?(0,Q.jsx)(`div`,{className:`px-3 py-2 text-xs text-muted-foreground`,children:`Loading hosts…`}):Rn.length>0?(0,Q.jsx)(yt,{className:`max-h-72`,children:Rn.map((e,n)=>{let r=vr(e),i=n<9?Wt(n):null,a=i?Kt(t,i,navigator.platform):null;return(0,Q.jsxs)(wt,{value:e,className:`h-8 min-h-8 whitespace-nowrap`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium`,children:e.alias}),r===e.alias?(0,Q.jsx)(`span`,{className:`flex-1`}):(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-muted-foreground`,children:r}),a?(0,Q.jsx)(xt,{className:`shrink-0`,children:a}):null]},`${e.alias}:${e.hostname}:${e.port??``}`)})}):(0,Q.jsxs)(vt,{className:`break-all`,children:[`No hosts match "`,z.trim(),`".`]})}):null]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-[minmax(0,1fr)_7rem]`,children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Username`}),(0,Q.jsx)(Tt,{value:Te,onChange:e=>V(e.target.value),onKeyDown:Or,placeholder:`root`,disabled:U,spellCheck:!1})]}),(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`mb-1.5 block text-xs font-medium text-foreground`,children:`Port`}),(0,Q.jsx)(Tt,{value:Ee,onChange:e=>Oe(e.target.value),onKeyDown:Or,placeholder:`22`,inputMode:`numeric`,disabled:U,spellCheck:!1})]})]}),Pe||Bn?(0,Q.jsx)(pn,{variant:`error`,children:(0,Q.jsx)(fn,{children:Pe??Bn})}):null,(0,Q.jsxs)(L,{variant:`outline`,className:`w-full`,disabled:U,onClick:()=>void Dr(),children:[(0,Q.jsx)(ye,{className:`size-3.5`}),U?`Adding…`:I?`Add route`:`Add environment`]})]})}),mi=()=>(0,Q.jsx)(er,{checked:Gn?.mode===`network-accessible`,disabled:!Gn||Re,onCheckedChange:e=>{Bt(e?`network-accessible`:`local-only`),He(!0)},"aria-label":`Enable network access`}),Ci=e=>Yt?Vr.map(t=>{let n=Si(t);return(0,Q.jsx)(ji,{endpoint:t,isDefault:n===Jr,presentation:e,onSetDefault:Yr,onSetupTailscaleServe:yr,onDisableTailscaleServe:xr,isUpdatingTailscaleServe:Ze},t.id)}):null,wi=(0,$.useCallback)(async t=>{if(e&&p!==null&&ut(p,`environment:maintain`)){nt(!0),at(null);try{await t(),Wn()}catch(e){let t=e instanceof Error?e.message:`Failed to update WSL backend.`;at(t),K.add(Y({type:`error`,title:`Could not change WSL backend`,description:t})),Wn()}finally{nt(!1)}}},[e,p]),Ti=(0,$.useCallback)(()=>{at(null),Wn()},[]),Ei=(0,$.useMemo)(()=>n.some(e=>Be(e.entry.target)),[n]),Di=(0,$.useCallback)(t=>{if(!e||!X)return;let n=X.distros.find(e=>e.isDefault)?.name??null;if(t===ri){if(!X.enabled&&!X.wslOnly)return;let t=X.wslOnly;if(Ei||t){dt({kind:`disable`,wasWslOnly:t});return}wi(()=>e.setWslBackendEnabled(!1));return}let r=t===ni?null:t,i=r??n;if(!X.enabled){dt({kind:`enable`,nextDistro:r});return}if((X.distro??n)!==i){if(Ei||X.wslOnly){dt({kind:`distro`,nextDistro:r});return}wi(()=>e.setWslDistro(r))}},[wi,e,X,Ei]),Oi=(0,$.useCallback)(t=>{if(!e||!J||J.kind!==`enable`)return;let n=J.nextDistro;dt(null);let r=X?.distro??null;wi(()=>Qn({bridge:e,mode:t,nextDistro:n,persistedDistro:r}))},[wi,e,X,J]),Ni=(0,$.useCallback)(t=>{e&&X&&X.wslOnly!==t&&dt({kind:`wsl-only`,nextValue:t})},[e,X]),Fi=(0,$.useCallback)(()=>{if(!e||!J)return;let t=J;if(t.kind!==`enable`){if(dt(null),t.kind===`disable`){wi(async()=>{let n=await e.setWslBackendEnabled(!1);return t.wasWslOnly?await e.setWslOnly(!1):n});return}if(t.kind===`distro`){wi(()=>e.setWslDistro(t.nextDistro));return}wi(()=>e.setWslOnly(t.nextValue))}},[wi,e,J]),Ii=()=>{if(!X)return In({state:null,error:An})&&sn?(0,Q.jsx)(mn,{...Zn(`wsl-backend`),description:`Couldn't load the WSL backend state.`,status:(0,Q.jsx)(`span`,{className:`block text-destructive`,children:An}),control:(0,Q.jsx)(L,{size:`sm`,variant:`outline`,onClick:Ti,disabled:Mn,children:Mn?`Retrying…`:`Retry`})}):null;if(!In({state:X,error:An}))return null;if(!X.available)return(0,Q.jsx)(mn,{...Zn(`wsl-backend`),description:`WSL is unavailable, so Windows is running instead. Turn WSL off to clear this preference.`,status:An?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:An}):null,control:(0,Q.jsx)(L,{size:`sm`,variant:`outline`,disabled:q,onClick:()=>Di(ri),children:`Switch to Windows`})});let e=X.distros.find(e=>e.isDefault)?.name??null,t=X.enabled?X.distro??e??ni:ri,n=t===ri?`Off`:t===ni?`Default distro`:t;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(mn,{...Zn(`wsl-backend`),description:`Run the selected WSL distro alongside Windows. Projects remain on their current filesystem.`,status:An?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:An}):X.preflightError?(0,Q.jsxs)(`span`,{className:`block text-destructive`,children:[`WSL backend couldn't start: `,X.preflightError]}):null,control:(0,Q.jsxs)(Ye,{value:t,onValueChange:e=>{typeof e==`string`&&Di(e)},children:[(0,Q.jsx)(Je,{size:`sm`,className:`w-full sm:w-56`,"aria-label":`WSL backend`,disabled:q,children:(0,Q.jsx)(Ke,{children:n})}),(0,Q.jsxs)(qe,{align:`end`,alignItemWithTrigger:!1,children:[(0,Q.jsx)(G,{hideIndicator:!0,value:ri,children:`Off`}),X.distros.length===0?(0,Q.jsx)(G,{hideIndicator:!0,value:ni,children:`Default distro`}):X.distros.map(e=>(0,Q.jsxs)(G,{hideIndicator:!0,value:e.name,children:[e.name,e.isDefault?` (default)`:``]},e.name))]})]})}),X.enabled?(0,Q.jsx)(mn,{title:`WSL only`,description:`Run only the WSL backend. P4 Code restarts when this changes.`,className:`bg-muted/20 pl-7 sm:pl-8`,control:(0,Q.jsx)(er,{checked:X.wslOnly,disabled:q,onCheckedChange:e=>Ni(e),"aria-label":`Run WSL only`})}):null]})},Li=()=>(0,Q.jsx)(mn,{title:Zn(`tailscale-https`).title,description:Br?Br.status===`available`?Br.httpBaseUrl:`Use Tailscale Serve to expose this backend through a MagicDNS HTTPS URL.`:`Start Tailscale to set up HTTPS access through MagicDNS.`,control:Br?(0,Q.jsx)(er,{checked:Br.status===`available`,disabled:Ze,onCheckedChange:e=>{if(e){yr(Br);return}xr(Br)},"aria-label":`Enable Tailscale HTTPS`}):null}),Ri=e=>(0,Q.jsxs)(Q.Fragment,{children:[nr?(0,Q.jsx)(`div`,{className:pi(e),children:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,children:nr})}):null,(0,Q.jsx)(Ai,{endpointUrl:Gn?.endpointUrl,endpoints:Hr,defaultEndpointKey:Jr,presentation:e,isLoading:rr,pairingLinks:zr,createdPairingCredentials:P,clientSessions:or,revokingPairingLinkId:re,revokingClientSessionId:ae,onRevokePairingLink:Sr,onRevokeClientSession:Cr,canRevoke:nn})]}),zi=()=>(0,Q.jsx)(mn,{title:Zn(`network-access`).title,description:cr?(0,Q.jsx)(Mi,{endpoint:Ur,hiddenEndpointCount:Math.max(Vr.length-1,0),expanded:Yt,onToggleExpanded:()=>Zt(e=>!e),fallback:Gn?.endpointUrl?`Reachable at ${Gn.endpointUrl}`:Gn?.advertisedHost?`Exposed on all interfaces. Pairing links use ${Gn.advertisedHost}.`:`Exposed on all interfaces.`}):Gn?`Limited to this machine.`:`Loading…`,status:Xn?(0,Q.jsx)(`span`,{className:`block text-destructive`,children:Xn}):null,control:mi()}),Bi=()=>(0,Q.jsx)(mn,{title:Zn(`network-access`).title,description:e?`This connection cannot view or change network exposure.`:g===`remote-reachable`?`Remote access is already configured. Change network exposure where the server starts.`:g===`loopback-browser`?`Only this machine can connect. Restart with a non-loopback host for remote pairing.`:`Network exposure information is unavailable.`,control:!e&&(g===`remote-reachable`||g===`loopback-browser`)?(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(Ue,{render:(0,Q.jsx)(`span`,{className:`inline-flex`,children:(0,Q.jsx)(er,{checked:cr,disabled:!0,"aria-label":`Enable network access`})})}),(0,Q.jsx)(We,{side:`top`,children:`Network exposure changes restart the backend and must be controlled where the server process is launched.`})]}):void 0}),Vi=(0,Q.jsx)(Q.Fragment,{children:p===null?(0,Q.jsxs)(gn,{...Zn(`connections-environment`),children:[(0,Q.jsx)(mn,{title:`No environment selected`,description:`Connect an environment to view its settings and access.`}),(0,Q.jsx)(ur,{}),rn||on?(0,Q.jsx)(Gi,{canReadRelay:rn,canManageRelay:on}):null]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(gn,{...Zn(`connections-environment`),title:r?.label??(e?`This machine`:`Primary environment`),icon:(0,Q.jsx)(Xt,{"aria-hidden":!0,kind:Vt?M(Vt):`desktop`,className:`size-4`}),headerAction:p===null?null:(0,Q.jsxs)(w,{children:[(0,Q.jsx)(N,{render:(0,Q.jsx)(L,{type:`button`,variant:`ghost-muted`,size:`icon-xs`,"aria-label":`More actions for this machine`}),children:(0,Q.jsx)(Kn,{className:`size-3.5`})}),(0,Q.jsx)(E,{align:`end`,children:(0,Q.jsx)(pr,{environmentId:p,serverConfig:Vt})})]}),children:[(0,Q.jsx)(ur,{}),sn?(0,Q.jsx)(mn,{title:`Version`,description:Jt.status===`idle`?[Vt?.environment.serverVersion??null,r?.displayUrl??null].filter(e=>e!==null).join(` · `)||`Loading…`:(0,Q.jsx)($n,{state:Jt}),control:qt&&p!==null&&Jt.status!==`running`?(0,Q.jsx)(Jn,{size:`sm`,environmentId:p,serverLabel:r?`${r.label} server`:`server`,selfUpdate:Vn(Vt),installation:Vt?.environment.capabilities.serverInstallation,desktopAppUpdate:Nn(Vt),threadContinuation:Dn(Vt),targetVersion:qt.clientVersion,label:Jt.status===`failed`?`Retry update`:`Update to ${qt.clientVersion}`}):Jt.status===`idle`&&Vt?(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Up to date`}):void 0}):null,sn&&e?(0,Q.jsxs)(Q.Fragment,{children:[zi(),Ci(`endpoint-rail`),Li(),Ii(),rn||on?(0,Q.jsx)(Gi,{canReadRelay:rn,canManageRelay:on}):null]}):sn?(0,Q.jsxs)(Q.Fragment,{children:[Bi(),rn||on?(0,Q.jsx)(Gi,{canReadRelay:rn,canManageRelay:on}):null]}):null,r?(0,Q.jsxs)(`details`,{className:`group px-3 sm:px-4`,children:[(0,Q.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-2 rounded-md text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring [&::-webkit-details-marker]:hidden`,children:[`Permissions`,(0,Q.jsx)(_e,{"aria-hidden":!0,className:`size-3 text-muted-foreground group-open:rotate-90`})]}),(0,Q.jsx)(sr,{environmentId:r.environmentId,connected:r.connection.phase===`connected`})]}):null]}),tn||nn?(0,Q.jsx)(ar,{id:`authorized-clients`,title:`Authorized clients`,summary:gi(or,zr),control:nn?(0,Q.jsx)(ki,{delegatableScopes:h??[],onPairingLinkCreated:ne,clientSessions:tn&&cn.error===null&&cn.data?.type===`snapshot`?or:null,isRevokingOtherClients:se,onRevokeOtherClients:wr}):void 0,children:(0,Q.jsx)(Et,{scrollFade:!0,chainVerticalScroll:!0,className:`max-h-[22.5rem]`,"data-testid":`authorized-clients-scroll-area`,children:tn?Ri(`current`):(0,Q.jsx)(`p`,{className:`px-4 py-3 text-xs text-muted-foreground`,children:`This connection can create access links but cannot view authorized clients.`})})}):null,(0,Q.jsx)(tr,{open:Ve&&sn,onOpenChange:e=>{Re||He(e)},onOpenChangeComplete:e=>{e||Bt(null)},children:(0,Q.jsxs)(qn,{children:[(0,Q.jsxs)(jn,{children:[(0,Q.jsx)(En,{children:zt===`network-accessible`?`Enable network access?`:`Disable network access?`}),(0,Q.jsx)(kn,{children:zt===`network-accessible`?`Let your other devices connect to P4 Code over the network. Pair devices to give them access. P4 Code will restart.`:`Devices connected over your local network will disconnect. Existing tunnels, such as P4 Connect or Tailscale HTTPS, keep working. P4 Code will restart.`})]}),(0,Q.jsxs)(On,{children:[(0,Q.jsx)(Fn,{disabled:Re,render:(0,Q.jsx)(L,{variant:`outline`,disabled:Re}),children:(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:`Cancel`})}),(0,Q.jsxs)(L,{variant:`default`,onClick:gr,disabled:!sn||zt===null||Re,children:[Re&&(0,Q.jsx)(Xe,{size:`sm`}),(0,Q.jsx)(`span`,{className:`[text-box:trim-both_cap_alphabetic]`,children:Re?`Restarting…`:zt===`network-accessible`?`Restart and enable`:`Restart and disable`})]})]})]})}),(0,Q.jsx)(tr,{open:mt&&sn,onOpenChange:e=>{q||e||dt(null)},children:(0,Q.jsxs)(qn,{children:[(0,Q.jsxs)(jn,{children:[(0,Q.jsx)(En,{children:J?.kind===`disable`?J.wasWslOnly?`Turn off WSL and switch back to Windows?`:`Disable WSL backend?`:J?.kind===`distro`?`Switch WSL distro?`:J?.kind===`enable`?`Start the WSL backend`:J?.nextValue?`Run only the WSL backend?`:`Re-enable the Windows backend?`}),(0,Q.jsx)(kn,{children:J?.kind===`disable`?J.wasWslOnly?`P4 Code will restart on the Windows backend. Threads and projects opened against WSL stay safe inside the distro and become available again when you re-enable WSL.`:`The WSL backend will stop. Threads and projects opened against WSL stay safe inside the distro, but they'll be unavailable in P4 Code until you re-enable WSL.`:J?.kind===`distro`?`P4 Code will restart the WSL backend on the new distro. Sessions still running on the current distro will be interrupted.`:J?.kind===`enable`?`Run the WSL backend alongside the Windows one, or stop the Windows backend and use only WSL? You can change this later from Settings.`:J?.nextValue?`P4 Code will restart and start only the WSL backend. Your Windows-side projects won't be accessible until you turn this off again.`:`P4 Code will restart and bring the Windows backend back up alongside WSL.`})]}),(0,Q.jsxs)(On,{children:[(0,Q.jsx)(Fn,{disabled:q,render:(0,Q.jsx)(L,{variant:`outline`,disabled:q}),children:`Cancel`}),J?.kind===`enable`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{variant:`outline`,onClick:()=>Oi(`wsl-only`),disabled:q||!sn,children:q?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xe,{size:`sm`}),`Applying…`]}):`Use only WSL`}),(0,Q.jsx)(L,{variant:`default`,onClick:()=>Oi(`both`),disabled:q||!sn,children:q?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xe,{size:`sm`}),`Applying…`]}):`Run both backends`})]}):(0,Q.jsx)(L,{variant:J?.kind===`disable`||J?.kind===`wsl-only`&&J.nextValue?`destructive`:`default`,onClick:Fi,disabled:q||!sn,children:q?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xe,{size:`sm`}),`Applying…`]}):J?.kind===`disable`?J.wasWslOnly?`Switch to Windows`:`Disable WSL`:J?.kind===`distro`?`Switch distro`:J?.nextValue?`Restart and enable`:`Restart and disable`})]})]})}),(0,Q.jsx)(tr,{open:_t&&sn,onOpenChange:e=>{Ze||It(e)},children:(0,Q.jsxs)(qn,{children:[(0,Q.jsxs)(jn,{children:[(0,Q.jsx)(En,{children:`Disable Tailscale HTTPS?`}),(0,Q.jsx)(kn,{children:`P4 Code will restart the local backend without Tailscale Serve.`})]}),(0,Q.jsxs)(On,{children:[(0,Q.jsx)(Fn,{disabled:Ze,render:(0,Q.jsx)(L,{variant:`outline`,disabled:Ze}),children:`Cancel`}),(0,Q.jsx)(L,{variant:`destructive`,onClick:()=>void br(),disabled:Ze||!sn,children:Ze?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xe,{size:`sm`}),`Restarting…`]}):`Restart and disable`})]})]})}),(0,Q.jsx)(Ft,{open:ht!==null,onOpenChange:e=>{Ze||e||gt(null)},children:(0,Q.jsxs)(Pt,{className:`max-w-md`,children:[(0,Q.jsxs)(Dt,{children:[(0,Q.jsx)(Ot,{children:`Set up Tailscale HTTPS?`}),(0,Q.jsx)(Nt,{children:`P4 Code will restart the local backend with Tailscale Serve enabled and ask Tailscale to proxy HTTPS traffic to this backend.`})]}),(0,Q.jsxs)(Mt,{children:[(0,Q.jsxs)(`label`,{className:`block`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:`HTTPS port`}),(0,Q.jsx)(Tt,{className:`mt-2`,type:`number`,inputMode:`numeric`,min:1,max:65535,step:1,value:Lt,onChange:e=>Rt(e.target.value),disabled:Ze})]}),fr?null:(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-destructive`,children:`Enter a port from 1 to 65535.`}),(0,Q.jsxs)(`div`,{className:`rounded-md border border-border/70 bg-muted/20 px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground`,children:`HTTPS endpoint`}),(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(Ue,{render:(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm text-foreground`,children:mr??`Pending MagicDNS endpoint`})}),mr?(0,Q.jsx)(We,{side:`top`,children:mr}):null]})]})]}),(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(jt,{disabled:Ze,render:(0,Q.jsx)(L,{variant:`outline`,disabled:Ze}),children:`Cancel`}),(0,Q.jsx)(L,{onClick:()=>void _r(),disabled:Ze||!fr,children:Ze?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Xe,{size:`sm`}),`Restarting…`]}):`Enable`})]})]})})]})});return(0,Q.jsxs)(hn,{children:[Vi,(0,Q.jsxs)(gn,{...Zn(`remote-environments`),title:`Environments`,headerAction:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[S.length>0?(0,Q.jsx)(Un,{targets:S,variant:`ghost-muted`}):null,(0,Q.jsxs)(Ft,{open:le,onOpenChange:e=>{F(e),e?fe(null):H(null)},children:[(0,Q.jsxs)(Ge,{children:[(0,Q.jsx)(Ue,{render:(0,Q.jsx)(At,{render:(0,Q.jsxs)(L,{size:`xs`,variant:`ghost-muted`,"aria-label":`Add environment`,children:[(0,Q.jsx)(ye,{className:`size-3`}),(0,Q.jsx)(`span`,{children:`Add environment`})]})})}),(0,Q.jsx)(We,{side:`top`,children:`Add environment`})]}),(0,Q.jsxs)(Pt,{className:`max-h-[80dvh] sm:max-w-3xl`,children:[(0,Q.jsxs)(Dt,{children:[(0,Q.jsx)(Ot,{children:I?`Add a route to ${I.label}`:`Add Environment`}),(0,Q.jsx)(Nt,{children:I?`Pair this machine again over another address, such as its Tailscale name. It joins the existing routes instead of adding a second machine.`:`Pair another environment to this client.`})]}),(0,Q.jsx)(Mt,{children:(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[Zr({mode:`remote`,title:`Remote link`,description:`Enter a backend host and pairing code.`,icon:(0,Q.jsx)(ve,{"aria-hidden":!0,className:`size-4`})}),e?Zr({mode:`ssh`,title:`SSH`,description:`Use local SSH config, agent, and tunnels for the backend.`,icon:(0,Q.jsx)(Se,{"aria-hidden":!0,className:`size-4`})}):null]}),(0,Q.jsx)(Ht,{children:R===`ssh`?fi():si()})]})})]})]})]}),children:[v.map(e=>(0,Q.jsx)(Pi,{environment:e,removingEnvironmentId:Ie,onSetEnabled:Nr,onRemove:Lr,onAddRoute:e=>{fe(e),H(null),F(!0)}},e.environmentId)),(0,Q.jsx)(qi,{primaryEnvironmentId:p,savedEnvironments:_})]}),Fe()?(0,Q.jsx)(Mr,{environmentLabel:Fr?.label??null,onCancel:()=>Ir(null),onConfirm:()=>{Fr&&(Ir(null),Pr(Fr))}}):null,(0,Q.jsx)(Tr,{environments:C}),(0,Q.jsx)(Ar,{environments:C})]})}function Yi(e){let{kind:t}=e;K.add({type:`success`,title:t===`hosted-link`?`Hosted app link copied`:t===`link`?`Pairing URL copied`:`Pairing code copied`,description:t===`hosted-link`?`Open it in the browser on the device you want to connect.`:t===`link`?`Open it in the client you want to pair to this environment.`:`Paste it into another client to finish pairing.`})}function Xi(e){return Ti(e)?`hosted-link`:`link`}function Zi(e){return!e}function Qi(e){return e.currentTarget.select()}function $i(e){return e.currentTarget.select()}function ea(e){return e!==null}var ta=Ji;export{ta as component};
|
|
2
|
-
//# sourceMappingURL=settings.connections-B-h_wi7q.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{Sx as t,ma as n}from"./utils-geC9CGP4.js";import{r}from"./SettingsPanels-Betza2Al.js";var i=t(),a=e(n());function o(){let e=(0,i.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,a.jsx)(r,{}),e[0]=t):t=e[0],t}export{o as component};
|
|
2
|
-
//# sourceMappingURL=settings.general-DodDmaXX.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{r as t}from"./Icon-l19w4AjM.js";import{Jb as n,Jl as r,Jn as i,Kn as a,Lc as o,Of as s,Ql as c,Rc as l,Sx as u,Tl as d,Un as f,Wn as p,Xn as m,_l as h,_u as g,ar as _,bu as v,er as y,eu as b,ey as x,fh as S,l as C,ma as w,or as T,ql as E,qn as D,sr as O,su as k,t as A,wl as j,xu as M,yu as N}from"./utils-geC9CGP4.js";import{t as P}from"./arrow-down-DvRecXuy.js";import{t as F}from"./check-Cmy7pM2Y.js";import{t as I}from"./ellipsis-vertical-fYTS1grT.js";import{t as L}from"./minus-C7W28oE7.js";import{t as ee}from"./monitor-Ddj8MK6z.js";import{t as R}from"./plus-Cr075-cy.js";import{t as z}from"./x-CSwbgjBe.js";import{U as te}from"./runtime-BoEmkhOe.js";import{w as ne}from"./entities-yblphBg3.js";import{a as B,n as re,t as ie}from"./tooltip-Ciaezkl4.js";import{a as V,r as ae,t as oe}from"./number-field-DsVu9T6C.js";import{a as H,c as se,i as ce,o as U,r as le,s as W,t as G}from"./select-BDMo6Fqt.js";import{t as ue}from"./spinner-rP6J82Of.js";import{i as K}from"./toast-CIGvRti2.js";import{D as de,E as fe,J as pe,c as me,o as he,r as ge,s as q,x as J}from"./useSettings-CNd8OM7A.js";import{f as _e}from"./server-DNo9AqHW.js";import{i as ve,n as ye}from"./session-CyPECDtf.js";import{t as be}from"./use-atom-command-Bc7LgQy1.js";import{t as xe}from"./env-wK1YYxA8.js";import{t as Se}from"./input-BOT1WFGI.js";import{a as Ce,c as we,i as Te,n as Ee,o as De,r as Oe,s as ke,t as Ae}from"./dialog-BBidAZq_.js";import{i as je,t as Me}from"./device-DrIICsXu.js";import{a as Ne,c as Pe,i as Fe,n as Ie,o as Le,s as Re,t as ze}from"./DeviceSetup-kaQqI-00.js";import{t as Be}from"./AnimatedHeight-BwS0L5jd.js";import{i as Ve,n as He}from"./Icons-BlUgSxml.js";import{t as Ue}from"./preview-ChiUlq6M.js";import{a as We,i as Ge,o as Ke,t as qe}from"./popover-UOfX8iZ4.js";import{C as Je,I as Ye,N as Xe,a as Y,c as Ze,i as Qe,r as $e,s as et,z as tt}from"./settingsLayout-De_r3pyr.js";import{Ar as nt,Dr as rt,Er as it,Ji as at,Or as ot,Tr as st,Yi as ct,Zo as lt,_o as ut,kr as dt,na as ft,or as X,wa as pt,wr as mt}from"./main-Ch0n0whg.js";import{t as ht}from"./ProjectDefaultsSettings-Cu80XFdb.js";import{t as gt}from"./draft-input-Dk-JXf0v.js";import{t as _t}from"./ScopedSwitch-CLAFXjj6.js";import{n as vt,r as yt,t as bt}from"./usePermissionStatus-CCpQkKk1.js";var Z=u(),Q=e(w(),1);function xt(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(St).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)(O,{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)(Ke,{"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)(We,{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 v=a?`Managed by ${a}. `:``,y;t[12]===v?y=t[13]:(y=(0,Q.jsxs)(`p`,{className:`mt-4 border-t border-border/50 pt-3 text-xs text-muted-foreground`,children:[v,`Tools update automatically on this host when needed.`]}),t[12]=v,t[13]=y);let b;t[14]===o?b=t[15]:(b=o?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-destructive`,children:o}):null,t[14]=o,t[15]=b);let x;t[16]===r?x=t[17]:(x=r?(0,Q.jsx)(`div`,{className:`mt-3`,children:r}):null,t[16]=r,t[17]=x);let S;t[18]!==y||t[19]!==b||t[20]!==x||t[21]!==g||t[22]!==_?(S=(0,Q.jsxs)(Ge,{align:`end`,width:`md`,children:[g,_,y,b,x]}),t[18]=y,t[19]=b,t[20]=x,t[21]=g,t[22]=_,t[23]=S):S=t[23];let C;return t[24]!==S||t[25]!==m?(C=(0,Q.jsxs)(qe,{children:[m,S]}),t[24]=S,t[25]=m,t[26]=C):C=t[26],C}function St(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function Ct(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 wt(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Tt),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 Tt(e){return(0,Q.jsxs)(ie,{children:[(0,Q.jsxs)(B,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(F,{className:`size-3`}):(0,Q.jsx)(L,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(re,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var Et=S(k);function Dt(e){let{identityFile:t,...n}=e;return Et({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function Ot(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function kt(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 At(e){let t=be(Me.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=Ot(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await kt(e,n,async(e,n)=>{if(!ye(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(x(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 jt(e){let t=(0,Z.c)(107),{host:r,isNew:i,targets:a,busy:o,onSave:s,onClose:c}=e,[l,u]=(0,$.useState)(r),{checks:d,testConnection:f}=At(a),p=d[Ot(l)],m=Object.values(p??{}).some(Nt),h,g;t[0]===l?(h=t[1],g=t[2]):(h=Dt({...l,label:l.label.trim()||l.target}),g=n(h),t[0]=l,t[1]=h,t[2]=g);let _=g,v;t[3]===p?v=t[4]:(v=Object.values(p??{}).filter(Mt),t[3]=p,t[4]=v);let y=v.length,b;t[5]!==o||t[6]!==c?(b=e=>{!e&&!o&&c()},t[5]=o,t[6]=c,t[7]=b):b=t[7];let x=!o,S;t[8]!==o||t[9]!==m||t[10]!==l.label||t[11]!==h||t[12]!==s?(S=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),n(h)&&l.label.trim()&&!o&&!m&&s(h.value)}}),t[8]=o,t[9]=m,t[10]=l.label,t[11]=h,t[12]=s,t[13]=S):S=t[13];let C=i?`Add device host`:`Edit device host`,w;t[14]===C?w=t[15]:(w=(0,Q.jsx)(we,{children:C}),t[14]=C,t[15]=w);let E=a.length===1?`Connect from ${a[0]?.label}.`:`Connect from ${a.length} selected environments.`,D;t[16]===E?D=t[17]:(D=(0,Q.jsxs)(Oe,{children:[E,` `,`Hosts on the same machine are skipped.`]}),t[16]=E,t[17]=D);let O;t[18]!==w||t[19]!==D?(O=(0,Q.jsxs)(Ce,{children:[w,D]}),t[18]=w,t[19]=D,t[20]=O):O=t[20];let k;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(`span`,{children:`Name`}),t[21]=k):k=t[21];let A;t[22]===l?A=t[23]:(A=e=>u({...l,label:e.target.value}),t[22]=l,t[23]=A);let j;t[24]!==o||t[25]!==l.label||t[26]!==A?(j=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[k,(0,Q.jsx)(Se,{autoFocus:!0,required:!0,value:l.label,disabled:o,onChange:A,placeholder:`Mac mini`})]}),t[24]=o,t[25]=l.label,t[26]=A,t[27]=j):j=t[27];let M;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(`span`,{children:`SSH target`}),t[28]=M):M=t[28];let N;t[29]===l?N=t[30]:(N=e=>u({...l,target:e.target.value}),t[29]=l,t[30]=N);let P;t[31]!==o||t[32]!==l.target||t[33]!==N?(P=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[M,(0,Q.jsx)(Se,{required:!0,value:l.target,disabled:o,onChange:N,placeholder:`user@host or SSH alias`})]}),t[31]=o,t[32]=l.target,t[33]=N,t[34]=P):P=t[34];let I=r.port!==void 0||r.identityFile!==void 0||void 0,L;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`SSH options`}),t[35]=L):L=t[35];let R;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(`span`,{children:`Identity file`}),t[36]=R):R=t[36];let te=l.identityFile??``,ne;t[37]===l?ne=t[38]:(ne=e=>{let{identityFile:t,...n}=l;u(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=l,t[38]=ne);let B;t[39]!==o||t[40]!==te||t[41]!==ne?(B=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[R,(0,Q.jsx)(Se,{value:te,disabled:o,onChange:ne,placeholder:`SSH config default`})]}),t[39]=o,t[40]=te,t[41]=ne,t[42]=B):B=t[42];let re;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=re):re=t[43];let ie=l.port??``,V;t[44]===l?V=t[45]:(V=e=>{let{port:t,...n}=l;u(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=l,t[45]=V);let ae;t[46]!==o||t[47]!==ie||t[48]!==V?(ae=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[re,(0,Q.jsx)(Se,{type:`number`,min:1,max:65535,value:ie,disabled:o,onChange:V,placeholder:`Default`})]}),t[46]=o,t[47]=ie,t[48]=V,t[49]=ae):ae=t[49];let oe;t[50]!==B||t[51]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[B,ae]}),t[50]=B,t[51]=ae,t[52]=oe):oe=t[52];let H;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=H):H=t[53];let se;t[54]!==I||t[55]!==oe?(se=(0,Q.jsxs)(`details`,{open:I,className:`text-sm`,children:[L,oe,H]}),t[54]=I,t[55]=oe,t[56]=se):se=t[56];let ce=m?`Checking environments…`:p?y?`${y} of ${a.length} failed`:`Connection checks passed`:`Check access before saving`,U;t[57]===ce?U=t[58]:(U=(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:ce}),t[57]=ce,t[58]=U);let le=o||m||!_,W;t[59]!==h||t[60]!==f?(W=()=>{n(h)&&f(h.value)},t[59]=h,t[60]=f,t[61]=W):W=t[61];let G;t[62]===m?G=t[63]:(G=m?(0,Q.jsx)(ue,{size:`xs`}):null,t[62]=m,t[63]=G);let K;t[64]!==le||t[65]!==W||t[66]!==G?(K=(0,Q.jsxs)(T,{type:`button`,size:`sm`,variant:`outline`,disabled:le,onClick:W,children:[G,` Test connection`]}),t[64]=le,t[65]=W,t[66]=G,t[67]=K):K=t[67];let de;t[68]!==U||t[69]!==K?(de=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[U,K]}),t[68]=U,t[69]=K,t[70]=de):de=t[70];let fe;t[71]!==p||t[72]!==a?(fe=p?(0,Q.jsx)(`ul`,{className:`border-t border-border/60 divide-y divide-border/40`,children:a.map(e=>{let t=p[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)(ue,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ee,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(z,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(wt,{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]=p,t[72]=a,t[73]=fe):fe=t[73];let pe;t[74]!==de||t[75]!==fe?(pe=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/60`,children:[de,fe]}),t[74]=de,t[75]=fe,t[76]=pe):pe=t[76];let me;t[77]!==j||t[78]!==P||t[79]!==se||t[80]!==pe?(me=(0,Q.jsxs)(De,{children:[j,P,se,pe]}),t[77]=j,t[78]=P,t[79]=se,t[80]=pe,t[81]=me):me=t[81];let he;t[82]!==o||t[83]!==c?(he=(0,Q.jsx)(T,{type:`button`,variant:`ghost`,disabled:o,onClick:c,children:`Cancel`}),t[82]=o,t[83]=c,t[84]=he):he=t[84];let ge;t[85]!==o||t[86]!==m||t[87]!==l.label||t[88]!==_?(ge=o||m||!_||!l.label.trim(),t[85]=o,t[86]=m,t[87]=l.label,t[88]=_,t[89]=ge):ge=t[89];let q;t[90]===o?q=t[91]:(q=o?(0,Q.jsx)(ue,{size:`xs`}):null,t[90]=o,t[91]=q);let J;t[92]!==ge||t[93]!==q?(J=(0,Q.jsxs)(T,{type:`submit`,disabled:ge,children:[q,` Save host`]}),t[92]=ge,t[93]=q,t[94]=J):J=t[94];let _e;t[95]!==he||t[96]!==J?(_e=(0,Q.jsxs)(Te,{children:[he,J]}),t[95]=he,t[96]=J,t[97]=_e):_e=t[97];let ve;t[98]!==O||t[99]!==me||t[100]!==x||t[101]!==_e||t[102]!==S?(ve=(0,Q.jsxs)(ke,{showCloseButton:x,render:S,children:[O,me,_e]}),t[98]=O,t[99]=me,t[100]=x,t[101]=_e,t[102]=S,t[103]=ve):ve=t[103];let ye;return t[104]!==b||t[105]!==ve?(ye=(0,Q.jsx)(Ae,{open:!0,onOpenChange:b,children:ve}),t[104]=b,t[105]=ve,t[106]=ye):ye=t[106],ye}function Mt(e){return e.status===`failed`}function Nt(e){return e.status===`pending`}function Pt(e){let{scope:t,environments:n,connectedEnvironments:r}=tt(),i=ve(e.environmentId,s),a=t.kind===`project`||t.kind===`checkout`,o=be(_e.updateSettings,{reportFailure:!1}),[c,l]=(0,$.useState)(null),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=n.map(e=>({environmentId:e.environmentId,label:e.label,connected:e.connection.phase===`connected`})),{checks:h,testConnection:g}=At(m),_=async(t,r=!1,i=t)=>{if(e.environmentId&&!a){p(!0);try{let e=await Promise.allSettled(n.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!ye(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return o({environmentId:e.environmentId,input:{patch:{deviceHosts:Ct(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?l(null):K.add({type:`error`,title:`Device hosts not saved on all environments`,description:`Could not update ${a.map(e=>e.label).join(`, `)}.`})}finally{p(!1)}}};return(0,Q.jsx)(Y,{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)(T,{size:`sm`,variant:`outline`,disabled:!i||a||f||!e.environmentId||c!==null,onClick:()=>{d(null),l({id:C(),label:``,target:``})},children:[(0,Q.jsx)(R,{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)(Ft,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!i||a||f,checks:h,testConnection:async e=>{let t=await g(e);if(!t)return;let n=m.filter(e=>t[e.environmentId]?.status===`failed`);return K.add({type:n.length?`error`:`success`,title:n.length?`${e.label}: ${n.length} of ${m.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=>{d(e),l(e)},onRemove:e=>void _(e,!0)})]},e.environmentId)),c?(0,Q.jsx)(jt,{host:c,isNew:u===null,targets:m,busy:f,onSave:e=>void _(e,!1,u??e),onClose:()=>l(null)},c.id):null]}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect a selected environment to manage device hosts.`})})})}function Ft(e){let t=(0,Z.c)(28),{environmentLabel:n,environmentId:r,hosts:a,busy:o,onEdit:s,onRemove:c,checks:l,testConnection:u}=e,{state:d}=je(r),f=be(Me.list),[h,g]=(0,$.useState)(null),v;t[0]===a.length?v=t[1]:(v=a.length===0?(0,Q.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No device hosts.`}):null,t[0]=a.length,t[1]=v);let y;if(t[2]!==o||t[3]!==l||t[4]!==r||t[5]!==n||t[6]!==a||t[7]!==s||t[8]!==c||t[9]!==f||t[10]!==h||t[11]!==d||t[12]!==u){let e;t[14]!==o||t[15]!==l||t[16]!==r||t[17]!==n||t[18]!==s||t[19]!==c||t[20]!==f||t[21]!==h||t[22]!==d||t[23]!==u?(e=e=>{let t=d.hostStatuses[e.id],a=l[Ot(e)]?.[r],v=(a?.status===`connected`?a.platforms:void 0)??d.hosts.find(t=>t.id===e.id)?.platforms??[],y=a?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,b=a?.status===`failed`?a.error:a?.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}),v.filter(Lt).map(It)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(xt,{owner:n,error:d.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:d.hosts.find(t=>t.id===e.id)?.tools??(a?.status===`connected`?a.tools:void 0)}),a?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,b?(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:b})]})}):null]}),y?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(ue,{size:`xs`}),y]}):null,(0,Q.jsxs)(p,{children:[(0,Q.jsx)(_,{render:(0,Q.jsx)(T,{size:`icon-sm`,variant:`ghost-muted`,disabled:o,"aria-label":e.label+` options`}),children:(0,Q.jsx)(I,{})}),(0,Q.jsxs)(m,{align:`end`,children:[(0,Q.jsx)(i,{onClick:()=>{s(e)},children:`Edit`}),(0,Q.jsx)(i,{variant:`destructive`,onClick:()=>c(e),children:`Remove`})]})]}),t?.status===`failed`&&d.supportsHostRetry&&d.hostStatus!==`disabled`?(0,Q.jsx)(T,{size:`sm`,variant:`outline`,disabled:o||h!==null,onClick:()=>{g(e.id),f({environmentId:r,input:{retryHostId:e.id}}).finally(()=>g(null))},children:h===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(T,{size:`sm`,variant:`outline`,disabled:o||y!==null,onClick:()=>void u(e),children:`Test connection`})]},e.id)},t[14]=o,t[15]=l,t[16]=r,t[17]=n,t[18]=s,t[19]=c,t[20]=f,t[21]=h,t[22]=d,t[23]=u,t[24]=e):e=t[24],y=a.map(e),t[2]=o,t[3]=l,t[4]=r,t[5]=n,t[6]=a,t[7]=s,t[8]=c,t[9]=f,t[10]=h,t[11]=d,t[12]=u,t[13]=y}else y=t[13];let b;return t[25]!==v||t[26]!==y?(b=(0,Q.jsxs)(Q.Fragment,{children:[v,y]}),t[25]=v,t[26]=y,t[27]=b):b=t[27],b}function It(e){return(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(B,{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)(Ve,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)(He,{className:`size-3.5`})}),(0,Q.jsx)(re,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function Lt(e){return e.available}function Rt(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function zt(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 Bt(e){return e.step!==`importing`}function Vt(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 Ht(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 Ut(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:Vt(e)}function Wt(e){let t=Ut(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function Gt(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function Kt(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function qt(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 Jt(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=()=>Vt(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),y;t[4]!==a||t[5]!==i?(y=()=>Rt(a,i),t[4]=a,t[5]=i,t[6]=y):y=t[6];let[b,x]=(0,$.useState)(y),[S,w]=(0,$.useState)(),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=C(),t[7]=T):T=t[7];let E=(0,$.useRef)(`profile-${T}`),D=(0,$.useRef)(!1),O;t[8]!==o||t[9]!==_||t[10]!==b||t[11]!==i?(O=()=>{if(D.current)return;let e=zt(b,E.current,i);if(e===void 0){w(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`});return}w(void 0),D.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(Ht(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{D.current=!1})},t[8]=o,t[9]=_,t[10]=b,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=>Gt(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`,Ut),t[15]=j,t[16]=M);let N=M,P;t[17]===j?P=t[18]:(P=()=>j(`fullDiskAccess`,Wt),t[17]=j,t[18]=P);let F=P,I;t[19]!==u||t[20]!==m?(I=e=>e||!Bt(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=Bt(m),t[22]=m,t[23]=L);let ee;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]!==b||t[37]!==S||t[38]!==i?(ee=m.step===`quit`?(0,Q.jsx)(Yt,{source:d,onCancel:u,onRechecked:N}):m.step===`fullDiskAccess`?(0,Q.jsx)(Qt,{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)(nn,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(rn,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(an,{source:d,reason:m.reason,onClose:u,onRetry:Kt(m.reason)?k:void 0}):(0,Q.jsx)($t,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:v,target:b,onTargetChange:e=>{x(e),w(void 0)},targetError:S,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]=b,t[37]=S,t[38]=i,t[39]=ee):ee=t[39];let R;t[40]!==L||t[41]!==ee?(R=(0,Q.jsx)(ke,{className:`max-w-lg`,showCloseButton:L,children:ee}),t[40]=L,t[41]=ee,t[42]=R):R=t[42];let z;return t[43]!==R||t[44]!==I?(z=(0,Q.jsx)(Ae,{open:!0,onOpenChange:I,children:R}),t[43]=R,t[44]=I,t[45]=z):z=t[45],z}function Yt(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)(Ce,{children:[(0,Q.jsxs)(we,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(Oe,{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)(T,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(T,{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)(Te,{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 Xt(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function Zt(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function Qt(e){let t=(0,Z.c)(43),{source:n,onCancel:r,onOpenSettings:i,onGranted:a,stillRequired:o,onCheck:s}=e,[c,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),f;t[0]===s?f=t[1]:(f=async()=>({fullDiskAccess:await s()}),t[0]=s,t[1]=f);let p;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(p={fullDiskAccess:!1},t[2]=p):p=t[2];let m=bt(f,p),h;t[3]!==i||t[4]!==c?(h=()=>{c||(l(!0),d(null),Promise.resolve().then(i).catch(()=>d(`Could not open System Settings. Try Allow again.`)).finally(()=>l(!1)))},t[3]=i,t[4]=c,t[5]=h):h=t[5];let g=h,_;t[6]===n.name?_=t[7]:(_=(0,Q.jsxs)(Ce,{children:[(0,Q.jsxs)(we,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(Oe,{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]=_);let v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(ut,{className:`size-8 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[8]=v):v=t[8];let y=`Read ${n.name}'s cookies for this import.`,b;t[9]===g?b=t[10]:(b=()=>void g(),t[9]=g,t[10]=b);let x;t[11]!==m.status.fullDiskAccess||t[12]!==y||t[13]!==b?(x=[{id:`fullDiskAccess`,icon:v,title:`Full Disk Access`,description:y,granted:m.status.fullDiskAccess,onAllow:b}],t[11]=m.status.fullDiskAccess,t[12]=y,t[13]=b,t[14]=x):x=t[14];let S;t[15]!==c||t[16]!==x?(S=(0,Q.jsx)(vt,{busy:c,permissions:x}),t[15]=c,t[16]=x,t[17]=S):S=t[17];let C;t[18]!==u||t[19]!==m.error?(C=u||m.error?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:u??m.error}):null,t[18]=u,t[19]=m.error,t[20]=C):C=t[20];let w;t[21]!==m||t[22]!==o?(w=m.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]=m,t[22]=o,t[23]=w):w=t[23];let E;t[24]!==C||t[25]!==w||t[26]!==S?(E=(0,Q.jsxs)(De,{children:[S,C,w]}),t[24]=C,t[25]=w,t[26]=S,t[27]=E):E=t[27];let D;t[28]===r?D=t[29]:(D=(0,Q.jsx)(T,{variant:`outline`,onClick:r,children:`Cancel`}),t[28]=r,t[29]=D);let O;t[30]===m?O=t[31]:(O=m.isReady([`fullDiskAccess`]),t[30]=m,t[31]=O);let k;t[32]!==a||t[33]!==c||t[34]!==O?(k=(0,Q.jsx)(yt,{ready:O,busy:c,onClick:a,children:`Continue`}),t[32]=a,t[33]=c,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==D||t[37]!==k?(A=(0,Q.jsxs)(Te,{children:[D,k]}),t[36]=D,t[37]=k,t[38]=A):A=t[38];let j;return t[39]!==E||t[40]!==A||t[41]!==_?(j=(0,Q.jsxs)(Q.Fragment,{children:[_,E,A]}),t[39]=E,t[40]=A,t[41]=_,t[42]=j):j=t[42],j}function $t(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)(we,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=_);let v;t[6]===r?v=t[7]:(v=(0,Q.jsxs)(Oe,{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)(Ce,{children:[_,v]}),t[8]=_,t[9]=v,t[10]=y):y=t[10];let b;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`From`}),t[11]=b):b=t[11];let x;if(t[12]!==s||t[13]!==n.profiles||t[14]!==o){let e;t[16]!==s||t[17]!==o?(e=e=>(0,Q.jsx)(en,{selected:o===e.directory,title:e.name,subtitle:Xt(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],x=n.profiles.map(e),t[12]=s,t[13]=n.profiles,t[14]=o,t[15]=x}else x=t[15];let S;t[19]===x?S=t[20]:(S=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[b,x]}),t[19]=x,t[20]=S);let C;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(P,{className:`size-4 sm:hidden`}),(0,Q.jsx)(lt,{className:`hidden size-4 sm:block`})]}),t[21]=C):C=t[21];let w;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Into`}),t[22]=w):w=t[22];let E;t[23]!==a||t[24]!==u||t[25]!==c.kind?(E=a?(0,Q.jsx)(en,{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]=E):E=t[26];let D;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)(en,{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],D=i.map(e),t[27]=u,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=D}else D=t[31];let O;t[36]!==E||t[37]!==D?(O=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[w,E,D]}),t[36]=E,t[37]=D,t[38]=O):O=t[38];let k;t[39]!==O||t[40]!==S?(k=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[S,C,O]}),t[39]=O,t[40]=S,t[41]=k):k=t[41];let A;t[42]===g?A=t[43]:(A=g?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:g}):null,t[42]=g,t[43]=A);let j;t[44]!==k||t[45]!==A?(j=(0,Q.jsxs)(De,{children:[k,A]}),t[44]=k,t[45]=A,t[46]=j):j=t[46];let M;t[47]===d?M=t[48]:(M=(0,Q.jsx)(T,{variant:`outline`,onClick:d,children:`Cancel`}),t[47]=d,t[48]=M);let N=o===``||m||h,F;t[49]!==f||t[50]!==N?(F=(0,Q.jsx)(T,{disabled:N,onClick:f,children:`Import`}),t[49]=f,t[50]=N,t[51]=F):F=t[51];let I;t[52]!==M||t[53]!==F?(I=(0,Q.jsxs)(Te,{children:[M,F]}),t[52]=M,t[53]=F,t[54]=I):I=t[54];let L;return t[55]!==j||t[56]!==I||t[57]!==y?(L=(0,Q.jsxs)(Q.Fragment,{children:[y,j,I]}),t[55]=j,t[56]=I,t[57]=y,t[58]=L):L=t[58],L}function en(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=A(`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 u;t[6]!==c||t[7]!==l?(u=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d=n?`border-primary bg-primary text-primary-foreground`:`border-input`,f;t[9]===d?f=t[10]:(f=A(`grid size-4 shrink-0 place-items-center rounded-full border`,d),t[9]=d,t[10]=f);let p;t[11]===n?p=t[12]:(p=n?(0,Q.jsx)(F,{className:`size-2.5`}):null,t[11]=n,t[12]=p);let m;t[13]!==f||t[14]!==p?(m=(0,Q.jsx)(`span`,{className:f,children:p}),t[13]=f,t[14]=p,t[15]=m):m=t[15];let h;return t[16]!==a||t[17]!==n||t[18]!==s||t[19]!==u||t[20]!==m?(h=(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:a,className:s,children:[u,m]}),t[16]=a,t[17]=n,t[18]=s,t[19]=u,t[20]=m,t[21]=h):h=t[21],h}function tn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(Ce,{children:[(0,Q.jsx)(we,{children:`Importing cookies`}),(0,Q.jsx)(Oe,{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)(De,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(ue,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function nn(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(we,{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)(Oe,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(Ce,{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)(ue,{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)(De,{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 rn(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 ${Zt(n)}`:r>0?`Skipped ${Zt(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)(we,{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?` ${Zt(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)(Oe,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(Ce,{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)(De,{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:qt(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(T,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(Te,{children:(0,Q.jsx)(Ee,{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 an(e){let t=(0,Z.c)(17),{source:n,reason:r,onClose:i,onRetry:a}=e,s;t[0]===n.name?s=t[1]:(s=(0,Q.jsxs)(we,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=s);let c=o[r],l;t[2]===c?l=t[3]:(l=(0,Q.jsx)(Oe,{children:c}),t[2]=c,t[3]=l);let u;t[4]!==s||t[5]!==l?(u=(0,Q.jsxs)(Ce,{children:[s,l]}),t[4]=s,t[5]=l,t[6]=u):u=t[6];let d;t[7]===i?d=t[8]:(d=(0,Q.jsx)(T,{variant:`outline`,onClick:i,children:`Close`}),t[7]=i,t[8]=d);let f;t[9]===a?f=t[10]:(f=a?(0,Q.jsx)(T,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=f);let p;t[11]!==d||t[12]!==f?(p=(0,Q.jsxs)(Te,{children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;return t[14]!==u||t[15]!==p?(m=(0,Q.jsxs)(Q.Fragment,{children:[u,p]}),t[14]=u,t[15]=p,t[16]=m):m=t[16],m}var on=`fill`,sn=`responsive`;async function cn(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 ln(e,t,n,r=0){return(e||r>0)&&t&&n>0}var un={width:1280,height:800},dn={useGrouping:!1},fn={system:`System`,light:`Light`,dark:`Dark`},pn=e=>`${Math.round(e*100)}%`,mn=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},hn=e=>{let t=String(e?.message??``);return l.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},gn=e=>e._tag===`fill`?on:e._tag===`preset`&&ct.some(t=>t.id===e.presetId)?e.presetId:sn,_n=e=>{let t=gn(e);return t===on?`Fill panel`:t===sn?`Responsive`:ct.find(e=>e.id===t)?.label??`Responsive`},vn=e=>Number.isInteger(e)&&e>=240&&e<=3840,yn=e=>({...e,width:e.height,height:e.width});function bn(e){let t=(0,Z.c)(42),{disabled:n}=e,i=q(Sn),a=J(),o=i._tag===`fill`?null:i,s=o?.width??un.width,l=o?.height??un.height,u;t[0]!==s||t[1]!==l?(u={width:s,height:l},t[0]=s,t[1]=l,t[2]=u):u=t[2];let f=u,p;t[3]!==o?.height||t[4]!==o?.width||t[5]!==a?(p=e=>{if(e===on){a({browserDefaultViewport:r});return}if(e===sn){a({browserDefaultViewport:{_tag:`freeform`,width:o?.width??un.width,height:o?.height??un.height}});return}let t=ct.find(t=>t.id===e);t&&a({browserDefaultViewport:{_tag:`preset`,width:t.width,height:t.height,presetId:t.id}})},t[3]=o?.height,t[4]=o?.width,t[5]=a,t[6]=p):p=t[6];let m=p,h;t[7]!==f||t[8]!==o||t[9]!==a?(h=(e,t)=>{if(t===null||!vn(t))return;let n={...f,[e]:t};n.width*n.height>8294400||o&&n.width===o.width&&n.height===o.height||a({browserDefaultViewport:{_tag:`freeform`,...n}})},t[7]=f,t[8]=o,t[9]=a,t[10]=h):h=t[10];let g=h,_;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(_=X(`browser-default-viewport`),t[11]=_):_=t[11];let v;t[12]!==n||t[13]!==a||t[14]!==i._tag?(v=!n&&i._tag!==d._tag?(0,Q.jsx)($e,{label:`default browser viewport`,onClick:()=>a({browserDefaultViewport:d})}):null,t[12]=n,t[13]=a,t[14]=i._tag,t[15]=v):v=t[15];let y;t[16]===i?y=t[17]:(y=gn(i),t[16]=i,t[17]=y);let b;t[18]===i?b=t[19]:(b=_n(i),t[18]=i,t[19]=b);let x;t[20]===b?x=t[21]:(x=(0,Q.jsx)(W,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(se,{children:b})}),t[20]=b,t[21]=x);let S,C;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(H,{value:on,children:`Fill panel`}),C=(0,Q.jsx)(H,{value:sn,children:`Responsive`}),t[22]=S,t[23]=C):(S=t[22],C=t[23]);let w;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsxs)(U,{align:`end`,alignItemWithTrigger:!1,children:[S,C,(0,Q.jsxs)(le,{children:[(0,Q.jsx)(ce,{children:`Standard`}),ct.map(xn)]})]}),t[24]=w):w=t[24];let E;t[25]!==n||t[26]!==m||t[27]!==x||t[28]!==y?(E=(0,Q.jsxs)(G,{value:y,onValueChange:m,disabled:n,children:[x,w]}),t[25]=n,t[26]=m,t[27]=x,t[28]=y,t[29]=E):E=t[29];let D;t[30]!==g||t[31]!==n||t[32]!==f||t[33]!==o||t[34]!==a?(D=o?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(oe,{value:f.width,min:240,max:c,disabled:n,format:dn,size:`sm`,className:`w-20`,onValueCommitted:e=>g(`width`,e),children:(0,Q.jsx)(ae,{children:(0,Q.jsx)(V,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(oe,{value:f.height,min:240,max:c,disabled:n,format:dn,size:`sm`,className:`w-20`,onValueCommitted:e=>g(`height`,e),children:(0,Q.jsx)(ae,{children:(0,Q.jsx)(V,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(ie,{children:[(0,Q.jsx)(B,{render:(0,Q.jsx)(T,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${f.height>=f.width?`landscape`:`portrait`}`,onClick:()=>a({browserDefaultViewport:yn(o)}),children:(0,Q.jsx)(at,{})})}),(0,Q.jsx)(re,{side:`top`,children:`Rotate`})]})]}):null,t[30]=g,t[31]=n,t[32]=f,t[33]=o,t[34]=a,t[35]=D):D=t[35];let O;t[36]!==E||t[37]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto`,children:[E,D]}),t[36]=E,t[37]=D,t[38]=O):O=t[38];let k;return t[39]!==O||t[40]!==v?(k=(0,Q.jsx)(Y,{..._,description:`Tab size for you and agents. Fill fits the panel; other sizes show the device toolbar.`,resetAction:v,control:O}),t[39]=O,t[40]=v,t[41]=k):k=t[41],k}function xn(e){return(0,Q.jsx)(H,{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 Sn(e){return e.browserDefaultViewport}function Cn(e){let t=(0,Z.c)(20),{disabled:n}=e,r=q(Tn),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=X(`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)($e,{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=b.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=pn(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(W,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(se,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(U,{align:`end`,alignItemWithTrigger:!1,children:b.map(wn)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(G,{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)(Y,{...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 wn(e){return(0,Q.jsx)(H,{hideIndicator:!0,value:String(e),children:pn(e)},e)}function Tn(e){return e.browserDefaultZoomFactor}function En(e){let t=(0,Z.c)(18),{disabled:n}=e,r=q(On),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=X(`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)($e,{label:`default browser appearance`,onClick:()=>i({browserDefaultAppearance:E})}):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)(W,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(se,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(U,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(fn).map(Dn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(G,{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)(Y,{...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 Dn(e){let[t,n]=e;return(0,Q.jsx)(H,{hideIndicator:!0,value:t,children:n},t)}function On(e){return e.browserDefaultAppearance}function kn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=q(jn),i=q(An),a=J(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=X(`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)(Y,{...o,description:`Show pressed keys and shortcuts in new recordings. Password fields are excluded.`,control:(0,Q.jsx)(pt,{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=X(`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)(Y,{...l,description:`Highlight mouse presses and held buttons in new recordings.`,control:(0,Q.jsx)(pt,{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 An(e){return e.browserRecordingShowMousePresses}function jn(e){return e.browserRecordingShowKeyPresses}function Mn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=q(Pn),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=X(`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)($e,{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=h.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)(W,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(se,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(U,{align:`end`,alignItemWithTrigger:!1,children:h.map(Nn)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(G,{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)(Y,{...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 Nn(e){return(0,Q.jsxs)(H,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function Pn(e){return e.browserRecordingFrameRate}var Fn={system:`Your default browser`,app:`P4 Code`};function In(e){let t=(0,Z.c)(19),{disabled:n}=e,r=q(Rn),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=X(`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)($e,{label:`link target`,onClick:()=>i({browserLinkTarget:j})}):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=Fn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(W,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(se,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(Fn),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(U,{align:`end`,alignItemWithTrigger:!1,children:u.map(Ln)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(G,{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)(Y,{...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 Ln(e){return(0,Q.jsx)(H,{hideIndicator:!0,value:e,children:Fn[e]},e)}function Rn(e){return e.browserLinkTarget}function zn(){let e=(0,Z.c)(7),{search:t,environment:n}=tt(),r=Xe(),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)(et,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(Bn,{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 Bn({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=ve(e,s),{state:i,loaded:a}=je(e),{scope:o,environments:c,connectedEnvironments:l}=tt(),u=Ye(),d=o.kind===`project`||o.kind===`checkout`,f=l.some(e=>e.serverConfig?.settings.enableDeviceSupport),p=be(Me.configure,{reportFailure:!1}),m=be(Me.list,{reportFailure:!1}),[h,g]=(0,$.useState)(null),_=i.hostStatus===`installing`||i.hostStatus===`starting`,v=i.hosts.some(e=>e.kind===`local`&&!e.platforms.some(e=>e.available)),[y,b]=(0,$.useState)(!1);y&&!t&&b(!1),t&&!y&&(i.hostStatus===`ready`||v)&&h!==`hub`&&b(!0);let x=async(t,n)=>{if(e&&ye(e,`settings:write`)){g(t);try{let e=await Promise.allSettled(c.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!ye(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return p({environmentId:e.environmentId,input:{...n,...n.enabled?{onboardingCompleted:!0}:{}}})})),t=c.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});t.length>0&&K.add({type:`error`,title:`Device settings not saved on all environments`,description:`Could not update ${t.map(e=>e.label).join(`, `)}.`})}finally{g(null)}}},[S,C]=(0,$.useState)(null),w=i.hosts.find(e=>e.kind===`local`)?.tools,E=t=>{let n=w?.[t],r=n&&!n.installedVersions.includes(n.requiredVersion);return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[i.supportsToolUpdate&&r?(0,Q.jsx)(T,{size:`sm`,disabled:!e||h!==null||_,onClick:()=>{e&&(C(null),g(`update-${t}`),m({environmentId:e,input:{updateTool:t}}).then(e=>{e._tag===`Failure`&&C({tool:t,message:`Update failed. Check this host's network connection and try again.`})}).finally(()=>g(null)))},children:h===`update-${t}`?`Updating…`:`Update to v${n.requiredVersion}`}):null,i.supportsToolInspection?(0,Q.jsx)(T,{size:`sm`,variant:`outline`,disabled:!e||h!==null||_,onClick:()=>{e&&(g(`check`),m({environmentId:e,input:{inspectOnly:!0}}).finally(()=>g(null)))},children:h===`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)(Y,{...X(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:Le,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xt,{action:E(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),h===`hub`?(0,Q.jsx)(Ie,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(_t,{settingKeys:[`enableDeviceSupport`],checked:t,disabled:!r||d||!a||!e||_||h!==null,"aria-label":`Device hub`,onCheckedChange:e=>void x(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]})}),(0,Q.jsx)(Be,{children:y?(0,Q.jsx)(Y,{...X(`device-platform-support`),description:l.length>1?`Status for ${l.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)(Fe,{compact:!0,platform:`iOS`,status:Re(i,`ios`)}),(0,Q.jsx)(Fe,{compact:!0,platform:`Android`,status:Re(i,`android`)})]}),control:(0,Q.jsx)(T,{size:`sm`,variant:`outline`,disabled:!e||!t||_||h!==null,onClick:()=>{e&&(g(`check`),m({environmentId:e,input:{}}).finally(()=>g(null)))},children:h===`check`?`Checking…`:`Refresh`})}):null}),(0,Q.jsx)(Y,{...X(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:Ne,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xt,{action:E(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),h===`agent`?(0,Q.jsx)(ze,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(_t,{settingKeys:[`enableAgentDeviceAccess`],checked:n,disabled:!r||l.length===0||!d&&(!a||!f||_)||h!==null,"aria-label":`Agent device access`,onCheckedChange:e=>d?u({enableAgentDeviceAccess:!!e}):void x(`agent`,{agentAccessEnabled:!!e})})]})}),e?(0,Q.jsx)(Pe,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(Pt,{environmentId:e})]})}function Vn(e){let t=(0,Z.c)(14),{disabled:n}=e,r=q(Hn),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=X(`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)($e,{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)(pt,{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)(Y,{...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 Hn(e){return e.browserAutoShowFloatingPreview}function Un({disabled:e}){let t=q(e=>e.browserProfiles),n=q(e=>e.browserDefaultProfileId),r=me(),o=J(),{environments:s,isReady:c}=fe(),l=de(),[u,d]=(0,$.useState)(null),[h,b]=(0,$.useState)(null),[x,S]=(0,$.useState)(null),[w,E]=(0,$.useState)(null),[O,k]=(0,$.useState)(null),[j,P]=(0,$.useState)(!1),F=ne(),L=be(Ue.clearProfile,{reportFailure:!1}),ee={environmentIds:s.map(e=>e.environmentId).filter(e=>F.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await L({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw te(n)}},z=ln(ft!==null,c,s.length,ee.environmentIds.length),B=(0,$.useRef)(!1),[re,ie]=(0,$.useState)(!1),V=e||!r,ae=M(t).filter(e=>e.kind!==`incognito`),oe=N(ae,n)?.id??`default`,H=e=>{if(!r||B.current)return;let t=ge().browserProfiles;if(t.length>=24)return;let n=M(t),i=new Set(n.map(e=>e.name)),a=e;for(let t=2;i.has(a);t+=1)a=`${e} ${t}`;let s={id:`profile-${C()}`,name:a,kind:`persistent`};return o({browserProfiles:[...t,s]}),s},se=(e,t)=>{if(!r||B.current)return;let n=t.trim().slice(0,48);if(n===``)return;let i=ge().browserProfiles;o({browserProfiles:i.map(t=>t.id===e?{...t,name:n}:t)})},ce=(e,t)=>{if(r&&!B.current){if(!z){K.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`});return}cn(ft,s.map(e=>e.environmentId),e,ee).then(()=>{K.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{K.add({type:`error`,title:`Could not clear ${t}'s data`})})}},U=async e=>{if(!r||B.current)return;if(!z){k(`Connect to an environment before removing this profile.`);return}k(null),P(!0);try{await cn(ft,c?s.map(e=>e.environmentId):[],e,ee)}catch{k(`Profile data could not be deleted. Try again.`),P(!1);return}let t=ge();o({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:g}:{}}),P(!1),S(null)},le=(u??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),W=(0,$.useCallback)(()=>{ft&&ft.listBrowserImportSources().then(d).catch(()=>d(e=>e??[]))},[]),G=async(e,t,n)=>{if(!ft||!r)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!M(ge().browserProfiles).some(e=>e.id===n.target.profileId)||B.current)return{kind:`blocked`,reason:`readFailed`};B.current=!0,ie(!0);try{let r=await ft.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!M(ge().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 he(t=>{if(t.browserProfiles.find(e=>e.id===n.target.profileId))return t;if(t.browserProfiles.length>=24)throw new mn;let r=new Set(M(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 cn(ft,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof mn?`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:hn(e)}}finally{B.current=!1,ie(!1)}},ue=async e=>{if(ft)try{let t=await ft.listBrowserImportSources();return d(t),t.find(t=>t.id===e)}catch{return}},_e=t.length>=24;return(0,Q.jsxs)(Y,{...X(`browser-profiles`),description:`Profiles separate cookies and logins. Incognito data is cleared when the app closes.`,control:(0,Q.jsxs)(p,{onOpenChange:e=>e&&W(),children:[(0,Q.jsxs)(_,{render:(0,Q.jsx)(T,{size:`sm`,variant:`outline`,disabled:V||re}),children:[(0,Q.jsx)(R,{}),`Add profile`]}),(0,Q.jsxs)(m,{align:`end`,children:[(0,Q.jsx)(i,{disabled:!r||_e,onClick:()=>H(`New profile`),children:`Blank profile`}),_e?(0,Q.jsx)(i,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(y,{}),(0,Q.jsxs)(a,{children:[(0,Q.jsx)(D,{children:`Import from`}),u===null?(0,Q.jsx)(i,{disabled:!0,children:`Looking for browsers…`}):le.length===0?(0,Q.jsx)(i,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[le.map(e=>(0,Q.jsx)(i,{disabled:!r||l==null,onClick:()=>{r&&l!=null&&b({source:e,environmentId:l.environmentId,environmentName:Je({isPrimary:!0,environmentId:l.environmentId,runtimeLabel:l.label})})},children:e.name},e.id)),l==null?(0,Q.jsx)(i,{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:ae.map((e,t)=>{let n=v(e.id),a=e.id===oe;return(0,Q.jsxs)(`div`,{className:A(`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:A(`truncate text-sm text-foreground`,V&&`opacity-64`),children:e.name}):(0,Q.jsx)(gt,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:V||re,maxLength:48,value:e.name,onCommit:t=>se(e.id,t)}),a?(0,Q.jsx)(`span`,{className:A(`flex`,V&&`opacity-64`),children:(0,Q.jsx)(f,{children:`Default`})}):null]}),(0,Q.jsxs)(p,{children:[(0,Q.jsx)(_,{render:(0,Q.jsx)(T,{size:`icon-xs`,variant:`ghost-muted`,disabled:V||re,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(I,{})}),(0,Q.jsxs)(m,{align:`end`,children:[(0,Q.jsx)(i,{disabled:!r||a,onClick:()=>{r&&o({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(i,{disabled:!r||!z,onClick:()=>{ee.environmentIds.length>0?E(e):ce(e.id,e.name)},children:`Clear cookies and cache`}),n?null:(0,Q.jsx)(i,{variant:`destructive`,disabled:!r||!z,onClick:()=>{r&&S(e)},children:`Remove profile and data`}),z?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(y,{}),(0,Q.jsx)(i,{disabled:!0,children:c?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(mt,{open:x!==null,onOpenChange:e=>{!e&&!j&&(S(null),k(null))},children:(0,Q.jsxs)(dt,{children:[(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(nt,{children:[`Remove “`,x?.name,`”?`]}),(0,Q.jsx)(it,{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.`}),O?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:O}):null,z?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)(rt,{children:[(0,Q.jsx)(st,{disabled:j,render:(0,Q.jsx)(T,{variant:`outline`,disabled:j}),children:`Cancel`}),(0,Q.jsx)(T,{variant:`destructive`,disabled:j||!r||!z,onClick:()=>{x&&r&&z&&U(x.id)},children:j?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(mt,{open:w!==null,onOpenChange:e=>{e||E(null)},children:(0,Q.jsxs)(dt,{children:[(0,Q.jsxs)(ot,{children:[(0,Q.jsxs)(nt,{children:[`Clear “`,w?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(it,{children:`You are signed out of its sites. Server browser tabs open in this profile close now.`})]}),(0,Q.jsxs)(rt,{children:[(0,Q.jsx)(st,{render:(0,Q.jsx)(T,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(T,{variant:`destructive`,onClick:()=>{w&&ce(w.id,w.name),E(null)},children:`Clear data`})]})]})}),h?(0,Q.jsx)(Jt,{source:h.source,destinationEnvironmentName:h.environmentName,targetProfiles:ae.map(e=>({id:e.id,name:e.name})),canCreateProfile:r&&!_e,onImport:e=>G(h.source,h.environmentId,e),onRefreshSource:()=>ue(h.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await pe()?.shell.openSystemSettings(`full-disk-access`).catch(()=>{K.add({type:`error`,title:`Could not open System Settings`,description:`Open Privacy & Security → Full Disk Access manually.`})})},onClose:()=>b(null)}):null]})}function Wn(){let e=(0,Z.c)(3),t=!xe,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Un,{disabled:t}),(0,Q.jsx)(bn,{disabled:t}),(0,Q.jsx)(Cn,{disabled:t}),(0,Q.jsx)(En,{disabled:t}),(0,Q.jsx)(Mn,{disabled:t}),(0,Q.jsx)(kn,{disabled:t}),(0,Q.jsx)(In,{disabled:t}),(0,Q.jsx)(Vn,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(ht,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(Qe,{children:[i,(0,Q.jsx)(et,{id:`browser`,title:`Browser`,children:t?(0,Q.jsx)(Ze,{message:`Only available in the desktop app.`,children:r}):r}),(0,Q.jsx)(zn,{})]}),e[2]=a):a=e[2],a}var Gn=Wn;export{Gn as component};
|
|
2
|
-
//# sourceMappingURL=settings.integrations-Dq9yt9c-.js.map
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectIconPickerDialog-Dwmv78OH.js","assets/rolldown-runtime-Dd_uD5pT.js","assets/Icon-l19w4AjM.js","assets/utils-geC9CGP4.js","assets/brain-B_3rxsLd.js","assets/createLucideIcon-CacG5mZC.js","assets/check-Cmy7pM2Y.js","assets/chevron-down-DHV04o66.js","assets/chevron-right-NbahR9_s.js","assets/toggle-group-BtpeJU3C.js","assets/CompositeRoot-ykxKqF8U.js","assets/toggle-4i71sOFB.js","assets/input-BOT1WFGI.js","assets/FieldControl-CWR3fEt0.js","assets/useRegisterFieldControl-BVraoamc.js","assets/scroll-area-Cj3OF_L_.js","assets/CSPContext-B1m61J9R.js","assets/dialog-BBidAZq_.js","assets/x-CSwbgjBe.js","assets/DialogTitle-Cwi7QOum.js","assets/ProjectMonogram-BgobvHld.js","assets/dynamic-BRlOHH6g.js","assets/index-FZqrCEhr.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-Dd_uD5pT.js";import{t}from"./index-FZqrCEhr.js";import{r as n}from"./Icon-l19w4AjM.js";import{Cm as r,E as i,Jn as a,Kn as o,Ls as s,Of as c,Pf as l,Rs as u,Sf as d,Sx as f,Vo as p,Wn as m,Xn as h,ar as g,er as _,gc as v,ma as y,n as b,or as x,os as S,ps as C,qn as w,r as T,rn as E,zv as D}from"./utils-geC9CGP4.js";import{t as ee}from"./chevron-down-DHV04o66.js";import{t as te}from"./info-BHB-83EA.js";import{t as ne}from"./plus-Cr075-cy.js";import{t as O}from"./trash-2-CiyAV2xI.js";import{H as k,L as re,R as A,U as ie}from"./runtime-BoEmkhOe.js";import{C as j,P as ae,W as M,k as N}from"./entities-yblphBg3.js";import{yn as P}from"./runtime-BUB2ex14.js";import{t as F}from"./useNavigate-CnhAAl0Z.js";import{t as I}from"./useLocation-DaTcl6iI.js";import{i as L}from"./toast-CIGvRti2.js";import{E as oe,J as R,K as z,O as B}from"./useSettings-CNd8OM7A.js";import{f as V,s as H}from"./server-DNo9AqHW.js";import{n as U,o as W}from"./session-CyPECDtf.js";import{t as G}from"./use-atom-command-Bc7LgQy1.js";import{n as K}from"./toastHelpers-Dsph6LwL.js";import{i as q,o as J,r as Y}from"./command-CVKxjYiJ.js";import{t as X}from"./input-BOT1WFGI.js";import{A as se,D as ce,E as le,T as ue,v as de}from"./keybindings-B4uuYLfE.js";import{t as fe}from"./PierreEntryIcon-DeBbijxO.js";import{t as pe}from"./ProjectFavicon-BhJj4G_1.js";import{u as me}from"./projectFilesQueryState-DLmHVuBp.js";import{n as he}from"./p4ProjectFile-DVeZFEli.js";import{r as ge,t as _e}from"./alert-DUQHh6vz.js";import{F as ve,V as ye,a as Z,i as be,r as xe,s as Se,z as Ce}from"./settingsLayout-De_r3pyr.js";import{Sn as we,Va as Te,hn as Ee,ni as De,oi as Oe,wn as ke}from"./main-Ch0n0whg.js";import{c as Ae,f as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./projectScriptEditor-_TwHfcHY.js";import{t as Re}from"./ProjectDefaultsSettings-Cu80XFdb.js";import{t as ze}from"./SettingsScopeNotice-CAaNSKvu.js";var Be=f(),Q=e(n(),1),$=e(y(),1);function Ve(e,t,n){return t||(n?e.trim()?`Searching project files…`:`Indexing project files…`:e.trim()?`No matching image files.`:`No image files found.`)}function He(e,t){return!T(t)||P(e)}function Ue(e){let[t,n]=(0,Q.useState)(``),[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),s=me(e.environmentId,e.cwd,t,200,{imageOnly:!0}),{resolvedTheme:c}=z(),l=p(H),u=e.onPickExternal,d=b(typeof navigator>`u`?``:navigator.platform),f=(0,Q.useMemo)(()=>Ee(s.entries,s.matchedQuery).map(t=>({kind:`action`,value:`project-favicon:${t.path}`,searchTerms:[t.name,t.path],title:t.name,description:t.path,icon:(0,$.jsx)(fe,{pathValue:t.path,kind:`file`,theme:c}),run:async()=>e.onSelect(t.path)})),[e.onSelect,c,s.entries,s.matchedQuery]);return(0,$.jsx)(Y,{open:e.open,onOpenChange:e.onOpenChange,children:e.open?(0,$.jsx)(q,{"aria-label":`Choose project icon`,className:`overflow-hidden`,onBackdropPointerDown:()=>e.onOpenChange(!1),children:(0,$.jsx)(ke,{"aria-label":`Choose project icon`,autoHighlight:`always`,escapeLabel:`Close`,footerActionLabel:`Select icon`,footerTrailing:u?(0,$.jsx)(J,{disabled:a,onClick:()=>{o(!0),u().then(t=>{t&&(e.onOpenChange(!1),e.onSelect(t))}).catch(e=>{L.add({type:`error`,title:`Could not open image picker`,description:e instanceof Error?e.message:`An error occurred.`})}).finally(()=>o(!1))},children:`Open in ${d}`}):null,inputProps:{placeholder:`Search image files…`},mode:`none`,onItemHighlighted:e=>{i(typeof e==`string`?e:null)},onValueChange:e=>{i(null),n(e)},panelSize:`tall-list`,testId:`project-favicon-picker`,value:t,children:(0,$.jsx)(we,{groups:f.length>0?[{value:`project-favicon-files`,label:e.projectName,items:f}]:[],highlightedItemValue:r,isActionsOnly:!1,keybindings:l,onExecuteItem:t=>{t.kind===`action`&&(e.onOpenChange(!1),t.run())},emptyStateMessage:Ve(t,s.error,s.isPending)})})}):null})}function We(e){let t=(0,Be.c)(10),{scripts:n,keybindings:r,disabled:i,onEdit:a}=e;if(n.length===0){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{className:`px-3 py-2 text-base text-muted-foreground sm:px-4 sm:text-sm`,children:`No actions configured.`}),t[0]=e):e=t[0],e}let o;if(t[1]!==i||t[2]!==r||t[3]!==a||t[4]!==n){let e;t[6]!==i||t[7]!==r||t[8]!==a?(e=e=>{let t=de(r,le(e.id));return(0,$.jsx)(Z,{className:`group py-2`,title:(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Fe,{icon:e.icon,className:`size-4 shrink-0 text-muted-foreground`}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),e.runOnWorktreeCreate?(0,$.jsx)(`span`,{className:`shrink-0 rounded-sm border border-border/60 px-1.5 py-px text-2xs font-normal text-muted-foreground`,children:`setup`}):null,e.runOnSettle?(0,$.jsx)(`span`,{className:`shrink-0 rounded-sm border border-border/60 px-1.5 py-px text-2xs font-normal text-muted-foreground`,children:`on settle`}):null,e.previewUrl?(0,$.jsx)(`span`,{className:`shrink-0 rounded-sm border border-border/60 px-1.5 py-px text-2xs font-normal text-muted-foreground max-sm:hidden`,children:`preview · desktop only`}):null]}),description:(0,$.jsx)(`code`,{className:`block max-w-full truncate font-mono`,children:e.command}),control:(0,$.jsxs)($.Fragment,{children:[t?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t}):null,(0,$.jsx)(`span`,{className:`flex shrink-0 opacity-0 group-focus-within:opacity-100 group-hover:opacity-100`,children:(0,$.jsx)(x,{size:`icon-xs`,variant:`ghost-muted`,"aria-label":`Edit ${e.name}`,disabled:i,onClick:()=>a(e),children:(0,$.jsx)(Te,{className:`size-3.5`})})})]})},e.id)},t[6]=i,t[7]=r,t[8]=a,t[9]=e):e=t[9],o=n.map(e),t[1]=i,t[2]=r,t[3]=a,t[4]=n,t[5]=o}else o=t[5];return o}function Ge(e){if(e._tag===`Failure`&&!re(e)){let t=ie(e);L.add({type:`error`,title:`Failed to save project actions`,description:t instanceof Error?t.message:`An error occurred.`})}return A(e,()=>void 0)}function Ke(e){let t=j(),[n,r]=(0,Q.useState)(!1),i=(0,Q.useRef)(!1),a=G(V.updateSettings,`project actions update`),o=G(V.upsertKeybinding,`action shortcut update`),s=G(V.removeKeybinding,`action shortcut removal`);async function u(n,u,d){if(i.current||e.length===0){let e=`No available machine, or another action change is saving.`;return L.add({type:`error`,title:`Actions not saved`,description:e}),S(D(Error(e)))}if(e.some(({environmentId:e})=>!U(e,`settings:write`)))return Ge(S(D(new l({requiredScope:c,message:`This connection cannot change environment settings.`}))));i.current=!0,r(!0);try{for(let{environmentId:r,settings:i,keybindings:c,project:l}of e){let e=l?je(i,l):i.defaultProjectScripts,f=n(e),p=f??i.defaultProjectScripts,m=await a({environmentId:r,input:{patch:l?{projectSettingsOverrides:{[l.id]:f===null?he(i,l.id,[`defaultProjectScripts`]):{...i.projectSettingsOverrides[l.id],defaultProjectScripts:f}}}:{defaultProjectScripts:f??[]}}});if(m._tag===`Failure`)return Ge(m);let h=u?[u]:e.filter(e=>!p.some(t=>t.id===e.id)).map(e=>e.id);for(let e of h){let n=le(e),a=Ae(c,n),u=a?Ie({keybinding:a,command:n}):null,p=Ie({keybinding:d,command:n}),m=!f?.some(t=>t.id===e)&&(l&&i.defaultProjectScripts.some(t=>t.id===e)||Object.entries(i.projectSettingsOverrides).some(([t,n])=>t!==l?.id&&n.defaultProjectScripts?.some(t=>t.id===e))||t.some(t=>t.environmentId===r&&t.id!==l?.id&&(l?je(i,t):t.scripts).some(t=>t.id===e))),h=p?await o({environmentId:r,input:u&&u.key!==p.key?{...p,replace:u}:p}):u&&!m?await s({environmentId:r,input:u}):null;if(h?._tag===`Failure`)return Ge(h)}}return C(void 0)}finally{i.current=!1,r(!1)}}function d(n,r){let i=[...t.flatMap(e=>e.scripts.map(e=>e.id)),...e.flatMap(({settings:e,project:t})=>[...e.defaultProjectScripts,...Object.values(e.projectSettingsOverrides).flatMap(e=>e.defaultProjectScripts??[]),...t?.scripts??[]].map(e=>e.id))],a=n??ce(r.name,i),o=ue(a,r);return u(e=>{let t=e.map(e=>e.id===a?o:se(e,r));return n===null?[...t,o]:t},a,r.keybinding)}return{saving:n,persist:u,submit:d}}function qe(){let e=(0,Be.c)(67),{scope:t,targets:n,target:i}=Ce(),{environments:s}=oe(),c=t.kind===`project`||t.kind===`checkout`,l;e[0]!==s||e[1]!==i?(l=i?s.find(e=>e.environmentId===i.environmentId)?.serverConfig:void 0,e[0]=s,e[1]=i,e[2]=l):l=e[2];let u=l,d;e[3]===i?.settings.defaultProjectScripts?d=e[4]:(d=i?.settings.defaultProjectScripts??[],e[3]=i?.settings.defaultProjectScripts,e[4]=d);let f=d,p=u?.keybindings??v,y;if(e[5]!==f||e[6]!==n){let t;e[8]===f?t=e[9]:(t=e=>JSON.stringify(e.settings.defaultProjectScripts)!==JSON.stringify(f),e[8]=f,e[9]=t),y=n.some(t),e[5]=f,e[6]=n,e[7]=y}else y=e[7];let b=y,S=ve(),[C,T]=(0,Q.useState)(null),E,D,te;e[10]!==s||e[11]!==c||e[12]!==t.members||e[13]!==n?(E=new Map(c?t.members.map(Ye):[]),D=Ke,te=n.flatMap(e=>{let t=s.find(t=>t.environmentId===e.environmentId);if(!t?.serverConfig)return[];let n=e.projectId?E.get(e.projectId):void 0;return n&&t.serverConfig.environment?.capabilities.projectSettingsOverrides!==!0?[]:[{environmentId:e.environmentId,settings:t.serverConfig.settings,keybindings:t.serverConfig.keybindings,...n?{project:n}:{}}]}),e[10]=s,e[11]=c,e[12]=t.members,e[13]=n,e[14]=E,e[15]=D,e[16]=te):(E=e[14],D=e[15],te=e[16]);let{saving:O,persist:k,submit:A}=D(te),j;e[17]!==E||e[18]!==i?(j=i?.projectId?E.get(i.projectId):void 0,e[17]=E,e[18]=i,e[19]=j):j=e[19];let ae=j,M;e[20]===ae?.environmentId?M=e[21]:(M=ae?.environmentId??r.make(`none`),e[20]=ae?.environmentId,e[21]=M);let N=Pe(M,ae?.workspaceRoot??null),P;if(e[22]!==f||e[23]!==N.scripts){let t;e[25]===f?t=e[26]:(t=e=>!f.some(t=>t.command===e.command||t.name.toLowerCase()===e.name.toLowerCase()),e[25]=f,e[26]=t),P=N.scripts.filter(t),e[22]=f,e[23]=N.scripts,e[24]=P}else P=e[24];let F=P,I;e[27]===A?I=e[28]:(I=async e=>{let t={name:e.name,command:e.command,icon:e.icon??`play`,runOnWorktreeCreate:e.runOnWorktreeCreate??!1,waitForSetup:e.runOnWorktreeCreate===!0&&e.async===!1,runOnSettle:e.runOnSettle??!1,keybinding:null,previewUrl:e.previewUrl??null,autoOpenPreview:e.previewUrl?e.autoOpenPreview??!1:!1},n=await A(null,t);if(n._tag===`Failure`&&!re(n)){let e=ie(n);T({scriptId:null,initial:t,error:e instanceof Error?e.message:`Failed to import action.`})}},e[27]=A,e[28]=I);let L=I,R;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(R=[`defaultProjectScripts`],e[29]=R):R=e[29];let z;e[30]===k?z=e[31]:(z=()=>void k(Je),e[30]=k,e[31]=z);let B;e[32]!==S||e[33]!==L||e[34]!==F||e[35]!==O?(B=F.length>0?(0,$.jsxs)(m,{children:[(0,$.jsxs)(g,{render:(0,$.jsx)(x,{id:`import-scripts`,size:`xs`,variant:`ghost`,disabled:O||!S,type:`button`}),children:[`Import scripts`,(0,$.jsx)(ee,{className:`size-3.5`})]}),(0,$.jsxs)(h,{align:`end`,children:[(0,$.jsxs)(o,{children:[(0,$.jsx)(w,{children:`Import from p4.json`}),(0,$.jsx)(`p`,{className:`px-2 pb-2 text-pretty text-sm text-muted-foreground`,children:`Add actions declared by this checkout without editing them first.`})]}),(0,$.jsx)(_,{}),F.map(e=>(0,$.jsxs)(a,{onClick:()=>void L(e),children:[(0,$.jsx)(Fe,{icon:e.icon??`play`,className:`size-4 shrink-0`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`div`,{className:`truncate font-medium`,children:e.name}),(0,$.jsx)(`div`,{className:`truncate font-mono text-muted-foreground`,children:e.command})]})]},`${e.name} ${e.command}`))]})]}):null,e[32]=S,e[33]=L,e[34]=F,e[35]=O,e[36]=B):B=e[36];let V=O||!S||n.length===0,H,U;e[37]===Symbol.for(`react.memo_cache_sentinel`)?(H=()=>T({scriptId:null,initial:Le}),U=(0,$.jsx)(ne,{className:`size-3.5`}),e[37]=H,e[38]=U):(H=e[37],U=e[38]);let W;e[39]===V?W=e[40]:(W=(0,$.jsxs)(x,{size:`xs`,variant:`outline`,disabled:V,onClick:H,children:[U,`Add action`]}),e[39]=V,e[40]=W);let G;e[41]!==B||e[42]!==W?(G=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[B,W]}),e[41]=B,e[42]=W,e[43]=G):G=e[43];let K;e[44]!==b||e[45]!==z||e[46]!==G?(K=(0,$.jsx)(Z,{serverScoped:!0,settingKeys:R,mixed:b,title:`Actions`,description:`Commands that run in this project's checkout or its worktree, with optional shortcuts.`,onResetOverride:z,control:G}),e[44]=b,e[45]=z,e[46]=G,e[47]=K):K=e[47];let q;e[48]!==S||e[49]!==p||e[50]!==b||e[51]!==O||e[52]!==f?(q=b?(0,$.jsx)(Z,{title:`Different actions across environments`,description:`Choose one environment to edit its list. Adding an action here adds it on every selected environment.`}):(0,$.jsx)(We,{scripts:f,keybindings:p,disabled:O||!S,onEdit:e=>T(Me(e,p))}),e[48]=S,e[49]=p,e[50]=b,e[51]=O,e[52]=f,e[53]=q):q=e[53];let J;e[54]===N.status?J=e[55]:(J=N.status===`invalid`?(0,$.jsx)(Z,{title:`p4.json is invalid`,description:`A p4.json exists in this checkout but fails to parse, so every action and icon it declares is ignored. Check the JSON syntax and icon values.`,className:`text-warning`}):null,e[54]=N.status,e[55]=J);let Y;e[56]!==k||e[57]!==C||e[58]!==f||e[59]!==A||e[60]!==i?(Y=i&&(0,$.jsx)(Ne,{environmentId:i.environmentId,editScope:`settings:write`,request:C,scripts:f,onSubmit:A,onDelete:e=>void k(t=>t.filter(t=>t.id!==e),e,null),onClose:()=>T(null)}),e[56]=k,e[57]=C,e[58]=f,e[59]=A,e[60]=i,e[61]=Y):Y=e[61];let X;return e[62]!==K||e[63]!==q||e[64]!==J||e[65]!==Y?(X=(0,$.jsxs)(Se,{id:`project-actions`,title:`Actions`,children:[K,q,J,Y]}),e[62]=K,e[63]=q,e[64]=J,e[65]=Y,e[66]=X):X=e[66],X}function Je(){return null}function Ye(e){return[e.id,e]}function Xe(e,t,n){return n&&e.some(e=>e!==t)}var Ze=(0,Q.lazy)(()=>t(()=>import(`./ProjectIconPickerDialog-Dwmv78OH.js`).then(e=>({default:e.ProjectIconPickerDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22])));function Qe(e){return`${e.environmentId}:${e.id}`}function $e(e){let t=(0,Be.c)(34),{projectKey:n,environmentId:r,checkoutKey:i}=e,a=r===void 0?null:r,o=i===void 0?null:i,s=ye(),c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={from:`/settings`},t[0]=c):c=t[0];let l=F(c),u;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(u={select:tt},t[1]=u):u=t[1];let d=I(u),f;t[2]!==s||t[3]!==n?(f=s.find(e=>e.projectKey===n)??null,t[2]=s,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]!==o||t[6]!==a||t[7]!==p?.memberProjects?(m=p?.memberProjects.filter(e=>(a===null||e.environmentId===a)&&(o===null||e.physicalProjectKey===o))??[],t[5]=o,t[6]=a,t[7]=p?.memberProjects,t[8]=m):m=t[8];let h=m,g=(0,Q.useRef)(null),_,v;t[9]!==o||t[10]!==a||t[11]!==h||t[12]!==p?(_=()=>{p&&h.length!==0&&(g.current={key:p.projectKey,environmentId:a,checkoutKey:o,memberKeys:h.map(et)})},v=[p,h,a,o],t[9]=o,t[10]=a,t[11]=h,t[12]=p,t[13]=_,t[14]=v):(_=t[13],v=t[14]),(0,Q.useEffect)(_,v);let y,b;if(t[15]!==o||t[16]!==a||t[17]!==s||t[18]!==h.length||t[19]!==l||t[20]!==d||t[21]!==n?(b=()=>{if(h.length>0)return;let e=g.current;if(e?.key!==n||e.environmentId!==a||e.checkoutKey!==o)return;let t=s.find(t=>t.memberProjects.some(t=>e.memberKeys.includes(t.physicalProjectKey)));t&&l({to:d,search:()=>({project:t.projectKey,machine:a??void 0,checkout:o??void 0}),replace:!0,hashScrollIntoView:!1})},y=[s,l,d,n,h.length,a,o],t[15]=o,t[16]=a,t[17]=s,t[18]=h.length,t[19]=l,t[20]=d,t[21]=n,t[22]=y,t[23]=b):(y=t[22],b=t[23]),(0,Q.useEffect)(b,y),!p){let e=s.length===0?`Add a project from the sidebar to configure it here.`:`This project is no longer available.`,n;return t[24]===e?n=t[25]:(n=(0,$.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-8 text-sm text-muted-foreground`,children:e}),t[24]=e,t[25]=n),n}if(h.length===0){let e;return t[26]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(`p`,{className:`p-8 text-sm text-muted-foreground`,children:`This checkout is no longer available in the selected project and environment.`}),t[26]=e):e=t[26],e}let x;t[27]!==h||t[28]!==p?(x={...p,memberProjects:h,environmentId:h[0].environmentId,id:h[0].id},t[27]=h,t[28]=p,t[29]=x):x=t[29];let S=x,C=`${p.projectKey}:${a??`all`}:${o??`all`}`,w=h.length<p.memberProjects.length,T;return t[30]!==S||t[31]!==C||t[32]!==w?(T=(0,$.jsx)(nt,{group:S,hasOtherMembers:w},C),t[30]=S,t[31]=C,t[32]=w,t[33]=T):T=t[33],T}function et(e){return e.physicalProjectKey}function tt(e){return e.pathname}function nt({group:e,hasOtherMembers:t}){let n=F({from:`/settings`}),r=B(),{environments:a}=oe(),o=(0,Q.useMemo)(()=>new Map(a.map(e=>[e.environmentId,e])),[a]),c=W(e.memberProjects,d),l=e.memberProjects.every(e=>c.has(e.environmentId)),f=e.memberProjects.find(e=>o.get(e.environmentId)?.serverConfig!=null)??e.memberProjects[0],p=N(),m=De(M.update,{reportFailure:!1}),h=De(M.delete,{reportFailure:!1}),g=(0,Q.useRef)(!1),_=f.faviconPath??null,v=f.projectIcon??null,y=typeof window<`u`&&e.memberProjects.every(e=>e.environmentId===r&&He(e.workspaceRoot,navigator.platform))?window.desktopBridge?.pickProjectFavicon:void 0,b=(0,Q.useCallback)((e,t)=>{if(t._tag!==`Failure`||re(t))return;let n=ie(t);L.add(K({type:`error`,title:e,description:n instanceof Error?n.message:`An error occurred.`}))},[]),w=(0,Q.useCallback)((e,t)=>{let n=e.find(e=>!U(e.environmentId,d));if(!n)return null;let r=S(D(Error(`This connection cannot change projects in ${n.environmentLabel??`this environment`}.`)));return b(t,r),r},[b]),T=(0,Q.useCallback)(async(t,n)=>{let r=w(e.memberProjects,n);if(r)return r;let i=e.memberProjects.find(e=>{let t=o.get(e.environmentId);return t?.connection.phase!==`connected`||!t.serverConfig});if(i){let e=Error(`Connect ${i.environmentLabel??`the selected environment`} and try again.`),t=S(D(e));return b(n,t),t}for(let r of e.memberProjects){let i=w([r],n);if(i)return i;let a=A(await m({environmentId:r.environmentId,input:{projectId:r.id,...t}}),()=>void 0);if(a._tag===`Failure`)return b(e.memberProjects.length>1?`${n} on ${r.environmentLabel??`the current environment`}`:n,a),a}return C(void 0)},[w,o,e.memberProjects,b,m]),ee=(0,Q.useCallback)(async(t,n)=>{let r=t.trim();if(!r){L.add({type:`warning`,title:`Project title cannot be empty`});return}Xe(e.memberProjects.map(e=>e.title),r,n)&&await T({title:r},`Failed to rename project`)},[e.memberProjects,T]),[ne,j]=E(!l),[P,I]=E(!l),[z,V]=(0,Q.useState)(!1),H=(0,Q.useRef)(!1),G=(0,Q.useCallback)(async e=>{if(!H.current){H.current=!0,V(!0);try{await T(e,`Failed to update project icon`)}finally{H.current=!1,V(!1)}}},[T]),q=e.memberProjects.length>1,J=(0,Q.useCallback)(async r=>{if(w(r,`Failed to remove project`))return;let a=R();if(!a)return;let o=new Set(r.map(Qe)),c=p.filter(e=>o.has(`${e.environmentId}:${e.projectId}`)),l=r.length===e.memberProjects.length,d=t||!l?`checkout`:`project`,f=r.length===1?r[0]:null,m=f?.title??e.displayName,g=await k(()=>a.dialogs.confirm([c.length>0?`Remove ${d} "${m}" and delete its ${c.length} thread${c.length===1?``:`s`}?`:`Remove ${d} "${m}"?`,...f?[`Path: ${f.workspaceRoot}`,...f.environmentLabel?[`Environment: ${f.environmentLabel}`]:[]]:[`This removes ${r.length} grouped project entries.`],...c.length>0?[`This permanently clears conversation history for those threads and any archived threads.`]:[`This permanently clears any archived conversation history.`],l&&!t?`This removes only the project entries, not the files on disk.`:`Other entries in this grouped project are unaffected.`,`This action cannot be undone.`].join(`
|
|
3
|
-
`),{variant:`destructive`}));if(g._tag===`Failure`||!g.value||w(r,`Failed to remove project`))return;let _=i.getState();for(let e of r){if(w([e],`Failed to remove project`))return;let t=c.filter(t=>t.environmentId===e.environmentId&&t.projectId===e.id),n=A(await h({environmentId:e.environmentId,input:{projectId:e.id,force:!0}}),()=>void 0);if(n._tag===`Failure`){b(`Failed to remove "${e.title}"`,n);return}let r=s(e.environmentId,e.id);await ae(r),Oe(r,t.map(e=>u(e.environmentId,e.id)));let i=_.getDraftThreadByProjectRef(r);i&&_.clearDraftThread(i.draftId),_.clearProjectDraftThreadId(r)}l&&!t&&n({to:`/`,replace:!0})},[w,h,e.displayName,e.memberProjects.length,t,n,b,p]),Y=(0,$.jsx)(Se,{title:`Checkouts`,children:e.memberProjects.map(e=>(0,$.jsx)(Z,{title:e.environmentLabel??`Environment`,description:e.workspaceRoot,control:(0,$.jsx)(x,{size:`sm`,variant:`outline`,disabled:!c.has(e.environmentId),onClick:()=>void J([e]),"aria-label":`Remove checkout ${e.workspaceRoot}`,children:`Remove`})},e.physicalProjectKey))});return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(be,{className:`gap-6`,children:[(0,$.jsxs)(_e,{variant:`info`,children:[(0,$.jsx)(te,{"aria-hidden":!0}),(0,$.jsx)(ge,{children:`Can't find a setting? Keep this project picked above and hop to any other settings page.`})]}),(0,$.jsxs)(Se,{id:`project-overview`,title:`Project`,hideTitle:!0,children:[l?null:(0,$.jsx)(`p`,{className:`px-3 py-2 text-sm text-muted-foreground sm:px-4`,children:e.memberProjects.length>1?`Shared settings require permission to change every checkout in this group.`:`This connection cannot change this project.`}),(0,$.jsx)(Z,{title:`Name`,description:`The shared name for this project group in the sidebar and thread lists.`,control:(0,$.jsx)(X,{size:`sm`,className:`w-full sm:w-64`,"aria-label":`Project name`,disabled:!l,defaultValue:e.displayName,onChange:()=>{g.current=!0},onBlur:e=>{let t=g.current;g.current=!1,ee(e.currentTarget.value,t)},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()}},`${e.projectKey}:${e.displayName}`)}),(0,$.jsx)(Z,{title:`Project icon`,description:v?.kind===`lucide`?`${v.name} · ${v.color}`:v?.kind===`monogram`?`${v.text} · ${v.color}`:v?.kind===`emoji`?v.emoji:_??`Automatic`,resetAction:e.memberProjects.some(e=>e.faviconPath!=null||e.projectIcon!=null)?(0,$.jsx)(xe,{label:`project icon`,disabled:z||!l,onClick:()=>void G({faviconPath:null,projectIcon:null})}):null,control:(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(pe,{project:f,className:`size-6`}),(0,$.jsx)(x,{size:`sm`,variant:`outline`,type:`button`,"aria-label":`Choose a project icon`,disabled:z||!l,onClick:()=>I(!0),children:`Choose icon`}),(0,$.jsx)(x,{size:`sm`,variant:`outline`,type:`button`,"aria-label":`Choose a project icon file`,disabled:z||!l,onClick:()=>j(!0),children:`Choose file`})]})})]}),(0,$.jsx)(Re,{category:`project`}),(0,$.jsx)(qe,{}),q?Y:null,(0,$.jsx)(Se,{title:`Danger`,children:(0,$.jsx)(Z,{title:t?`Remove checkout`:e.memberProjects.length>1?`Remove this project everywhere`:`Remove project`,description:t?`Deletes the selected machine's checkout entries and their threads. Other machines and files on disk are not touched.`:e.memberProjects.length>1?`Deletes all ${e.memberProjects.length} checkout entries and their threads on every machine. Files on disk are not touched.`:`Deletes the project entry and its threads. Files on disk are not touched.`,control:(0,$.jsxs)(x,{size:`sm`,variant:`destructive-outline`,disabled:!l,onClick:()=>void J(e.memberProjects),children:[(0,$.jsx)(O,{}),t?`Remove checkout`:e.memberProjects.length>1?`Remove all entries`:`Remove project`]})})})]}),(0,$.jsx)(Ue,{cwd:f.workspaceRoot,environmentId:f.environmentId,onOpenChange:j,...y?{onPickExternal:()=>y(f.workspaceRoot)}:{},onSelect:e=>void G({faviconPath:e,projectIcon:null}),open:ne&&l,projectName:e.displayName},`${f.environmentId}:${f.workspaceRoot}:${ne}`),P&&l?(0,$.jsx)(Q.Suspense,{fallback:null,children:(0,$.jsx)(Ze,{current:v,projectName:f.title,open:!0,onOpenChange:I,onSelect:e=>void G({faviconPath:null,projectIcon:e})})}):null]})}function rt(){let e=(0,Be.c)(7),{search:t,scope:n}=Ce(),i=n.kind===`project`||n.kind===`checkout`||n.kind===`unavailable`&&(n.reason===`project-missing`||n.reason===`checkout-missing`),a;return e[0]!==i||e[1]!==n.kind||e[2]!==n.message||e[3]!==t.checkout||e[4]!==t.machine||e[5]!==t.project?(a=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:t.project&&i?(0,$.jsx)($e,{projectKey:t.project,environmentId:t.machine?r.make(t.machine):null,checkoutKey:t.checkout??null}):n.kind===`unavailable`?(0,$.jsx)(be,{children:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.message})}):(0,$.jsx)(ze,{target:`project`,children:`Choose a project to manage its name, icon, checkouts and actions.`})}),e[0]=i,e[1]=n.kind,e[2]=n.message,e[3]=t.checkout,e[4]=t.machine,e[5]=t.project,e[6]=a):a=e[6],a}var it=rt;export{it as component};
|
|
4
|
-
//# sourceMappingURL=settings.projects-Bj9oI9dE.js.map
|