@p4code/cli 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +1 -1
- package/dist/{binCli-k72_SR2Z.mjs → binCli-B8_9WRM7.mjs} +10 -3
- package/dist/client/.vite/manifest.json +1120 -1120
- package/dist/client/assets/{2NI2N5EU-DPAxyySd.js → 2NI2N5EU-Cc9Gs6p1.js} +2 -2
- package/dist/client/assets/{4UO7MD6I-C0aflwpw.js → 4UO7MD6I--tXEX5R9.js} +2 -2
- package/dist/client/assets/{5B3SVYGG-hhn6T1ru.js → 5B3SVYGG-CPRAqyzZ.js} +2 -2
- package/dist/client/assets/{5GK6JWQ2-BQ0OdoZ6.js → 5GK6JWQ2-OC2-LRPx.js} +2 -2
- package/dist/client/assets/{5N7A7DKN-BR8rdHwZ.js → 5N7A7DKN-BUa1-OZ6.js} +2 -2
- package/dist/client/assets/{5OC2THR4-DVDBlcjJ.js → 5OC2THR4-DKcwc3u1.js} +2 -2
- package/dist/client/assets/{5S6HY5KT-CjtOXys8.js → 5S6HY5KT-Dqth6iG8.js} +2 -2
- package/dist/client/assets/{6IMQ5BUJ-Bpy1Geo9.js → 6IMQ5BUJ-DmEcg0r1.js} +2 -2
- package/dist/client/assets/{6OLKWJ4F-D2naWV4i.js → 6OLKWJ4F-W-G6qP3r.js} +2 -2
- package/dist/client/assets/{74OO7NKP-CceNos-7.js → 74OO7NKP-u02yiNi7.js} +2 -2
- package/dist/client/assets/{75O6YZUN-CnXm_L8w.js → 75O6YZUN-xx4y2KbP.js} +2 -2
- package/dist/client/assets/{77XECAW3-ECBcD47O.js → 77XECAW3-SIARa2Fi.js} +2 -2
- package/dist/client/assets/{ABYRPUBD-B4F4wZam.js → ABYRPUBD-B_0r9NT4.js} +2 -2
- package/dist/client/assets/{AuthSurfaceShell-DR9yRrzS.js → AuthSurfaceShell-DPlJfFlL.js} +2 -2
- package/dist/client/assets/{BB2UYUI2-Cae7rC8c.js → BB2UYUI2-CujjjZN9.js} +2 -2
- package/dist/client/assets/{BUM34MOA-DBDboDOb.js → BUM34MOA-NuuTH6rj.js} +2 -2
- package/dist/client/assets/{CEQABKGZ-C6UutqUy.js → CEQABKGZ-DDaGayTm.js} +2 -2
- package/dist/client/assets/{CXAC5362-BnZlf1Fg.js → CXAC5362-CB6ETtV8.js} +2 -2
- package/dist/client/assets/{ChatGptUsageButton-3K5PpaVk.js → ChatGptUsageButton-DqJ-vZMe.js} +2 -2
- package/dist/client/assets/{ChatMarkdown-EK5C8Dje.js → ChatMarkdown-C94Vrzqf.js} +5 -5
- package/dist/client/assets/{CodexSetupSection.logic-BepCZ25p.js → CodexSetupSection.logic-DOe05Yxb.js} +2 -2
- package/dist/client/assets/{CommandBlock-C967hvdK.js → CommandBlock-BUY_4yYG.js} +2 -2
- package/dist/client/assets/{ComposerPromptEditor-kPs79YCA.js → ComposerPromptEditor-BXlsIVOQ.js} +4 -4
- package/dist/client/assets/{ConnectionDiagnosisDetails-B5VXf5lv.js → ConnectionDiagnosisDetails-DoemNrMF.js} +2 -2
- package/dist/client/assets/{DRLTVNUE-Du8kYl_L.js → DRLTVNUE-D0oW6kzx.js} +2 -2
- package/dist/client/assets/{DYY6UVD2-DxjEuWNy.js → DYY6UVD2-DBOhEG0-.js} +2 -2
- package/dist/client/assets/{DevicePanel-YEBH-Vqd.js → DevicePanel-B5VTFku5.js} +2 -2
- package/dist/client/assets/{DeviceSetup-CAlj40rJ.js → DeviceSetup-C7hesHao.js} +2 -2
- package/dist/client/assets/{DiffCommentAnnotation-BOk2MTlv.js → DiffCommentAnnotation-DDYXWdY5.js} +2 -2
- package/dist/client/assets/{DiffFileTree-Dg3cvfi5.js → DiffFileTree-SBs4YWHB.js} +2 -2
- package/dist/client/assets/{DiffPanel-fTHMPAQJ.js → DiffPanel-Cd7uZSwI.js} +2 -2
- package/dist/client/assets/{DiffWorkerPoolProvider-CqmToECA.js → DiffWorkerPoolProvider-elvn0oLt.js} +2 -2
- package/dist/client/assets/{EmbeddedDesign-BXKBSCcw.js → EmbeddedDesign-BDMR5UJo.js} +2 -2
- package/dist/client/assets/{FNOVOB4O-BeMBYVRF.js → FNOVOB4O-C55ATzH6.js} +2 -2
- package/dist/client/assets/{FileDiff-DW1zPAn5.js → FileDiff-DpQM5r9o.js} +2 -2
- package/dist/client/assets/{FilePreviewPanel-CTTCKfik.js → FilePreviewPanel-DWeewVws.js} +2 -2
- package/dist/client/assets/{FoldedSettingsSection-ClboCRR4.js → FoldedSettingsSection-KMTLX6MR.js} +2 -2
- package/dist/client/assets/{HDGCDEEZ-DtsLNbcM.js → HDGCDEEZ-BhXkP8CI.js} +2 -2
- package/dist/client/assets/{HSJLKHB7-Cj1_K-Mg.js → HSJLKHB7-ad9jby8d.js} +2 -2
- package/dist/client/assets/JZOYTAAL-CifPXszn.js +1 -0
- package/dist/client/assets/{K3MD6TGW-SNOidZ8r.js → K3MD6TGW-CG-BXshu.js} +2 -2
- package/dist/client/assets/{K7RP3OMA-CpajkG5B.js → K7RP3OMA-Dvs72E71.js} +2 -2
- package/dist/client/assets/{LHDIQX7Q-CAyO0Nv9.js → LHDIQX7Q-DBbVLdBb.js} +2 -2
- package/dist/client/assets/{LUXOKEGN-Dp60gO-M.js → LUXOKEGN-B8HcSY56.js} +2 -2
- package/dist/client/assets/{MathTypeset-DG9QDH3a.js → MathTypeset-D0cDlCZy.js} +2 -2
- package/dist/client/assets/{N3JZAHOW-CPZZhC9o.js → N3JZAHOW-BXwh9_vP.js} +2 -2
- package/dist/client/assets/{NUIALGQ3-Bapg3pv1.js → NUIALGQ3-ClxnUm8B.js} +2 -2
- package/dist/client/assets/{NoProjectsHero-DunzHVd0.js → NoProjectsHero-Bn4v5ofT.js} +2 -2
- package/dist/client/assets/{O65XPQGZ-BmLVfB2-.js → O65XPQGZ-BEEpAP2l.js} +2 -2
- package/dist/client/assets/{O7XIQ6OM-BzZlSmaP.js → O7XIQ6OM-CkSDwviv.js} +2 -2
- package/dist/client/assets/{OFQON5FD-Ciy1Dfj8.js → OFQON5FD-4EbpxjZS.js} +2 -2
- package/dist/client/assets/{P4ConnectAccountPages-DO-fCpTN.js → P4ConnectAccountPages-DgxvyIGG.js} +2 -2
- package/dist/client/assets/{P4ConnectSidebarSignIn-7hkM7xr7.js → P4ConnectSidebarSignIn-Bn9hP_6_.js} +2 -2
- package/dist/client/assets/{PJQHF43J-CTTmTIhc.js → PJQHF43J-D_j27v4O.js} +2 -2
- package/dist/client/assets/{PanelLayoutControls-clP6N7xc.js → PanelLayoutControls-BHEJEPDp.js} +4 -4
- package/dist/client/assets/{PierreEntryIcon-wm-IkF2y.js → PierreEntryIcon-BCv2OXDn.js} +2 -2
- package/dist/client/assets/{PreviewPanel-fTwWXayK.js → PreviewPanel-D3CQGyTY.js} +2 -2
- package/dist/client/assets/{ProjectDefaultsSettings-DABlQCRQ.js → ProjectDefaultsSettings-CqigWqDQ.js} +2 -2
- package/dist/client/assets/{ProjectFavicon-zExdjKgc.js → ProjectFavicon-BzkwZEKX.js} +3 -3
- package/dist/client/assets/{ProjectIconPickerDialog-D4Br81iW.js → ProjectIconPickerDialog-Bl7a1F6c.js} +2 -2
- package/dist/client/assets/{ProviderAuthTerminal-Gf_5AaPE.js → ProviderAuthTerminal-BxyDTl04.js} +2 -2
- package/dist/client/assets/{ProviderModelPicker-DrfK42fH.js → ProviderModelPicker-BjWN45iR.js} +2 -2
- package/dist/client/assets/{ProviderSettingsForm-CXVYrIzw.js → ProviderSettingsForm-9qRf6JzH.js} +2 -2
- package/dist/client/assets/{PullRequestCodeTab-DaXxo4Bs.js → PullRequestCodeTab-2fq1MIQq.js} +2 -2
- package/dist/client/assets/{RHNBAITX-DKMeuR6R.js → RHNBAITX-DaSH9fj2.js} +2 -2
- package/dist/client/assets/{ReadOnlySourcePreview-DPJWK3HJ.js → ReadOnlySourcePreview-CUL87R5C.js} +2 -2
- package/dist/client/assets/{RenderErrorBoundary-BI5KBtsb.js → RenderErrorBoundary-CEX4aXRH.js} +2 -2
- package/dist/client/assets/{SLD4V6NK-CR4aIcpx.js → SLD4V6NK-BPOaMXu1.js} +2 -2
- package/dist/client/assets/{ScheduledTasksSettings-CTHyd4UX.js → ScheduledTasksSettings-BEw_vC1N.js} +2 -2
- package/dist/client/assets/{ScopedSwitch-De6GoQiO.js → ScopedSwitch-DPPAQKgb.js} +2 -2
- package/dist/client/assets/{SettingsPanels-D6e2byZQ.js → SettingsPanels-wkOx3NMK.js} +2 -2
- package/dist/client/assets/{SettingsPanels.logic-BSXSdFru.js → SettingsPanels.logic-BwMoKlP_.js} +2 -2
- package/dist/client/assets/{SettingsScopeNotice-MbxDDMZ9.js → SettingsScopeNotice-5BIXPKKZ.js} +2 -2
- package/dist/client/assets/{SidebarStageBackdrop-B0F--sat.js → SidebarStageBackdrop-Cc8Os5aB.js} +2 -2
- package/dist/client/assets/{T3PCR2KE-C0_7R2Oa.js → T3PCR2KE-DF_ihTb_.js} +2 -2
- package/dist/client/assets/{TKWO2OVW-DqJmzuhq.js → TKWO2OVW-BpYa7JbN.js} +2 -2
- package/dist/client/assets/{TSHNXIZL-CmCl4WMk.js → TSHNXIZL-icuUBQJZ.js} +2 -2
- package/dist/client/assets/{ThemeEditorPanel-IhSXPcO9.js → ThemeEditorPanel-K5Z_cKr_.js} +2 -2
- package/dist/client/assets/{ThreadTerminalDrawer-DnOstFPr.js → ThreadTerminalDrawer-BEzEKbGr.js} +2 -2
- package/dist/client/assets/{UQJE5E4I-U1f_Qxq0.js → UQJE5E4I-jTtBmXGD.js} +2 -2
- package/dist/client/assets/{USNYFO5S-BFU1s0-x.js → USNYFO5S-COMhBWxE.js} +2 -2
- package/dist/client/assets/{Virtualizer-CI2uidEs.js → Virtualizer-3W_tqqHL.js} +2 -2
- package/dist/client/assets/{WEVWDWVA-DVuH1I8D.js → WEVWDWVA-DoGSbgZU.js} +2 -2
- package/dist/client/assets/{X5RFHQXM-DhiPjZ2I.js → X5RFHQXM-pFbOarC5.js} +2 -2
- package/dist/client/assets/{X62E3GBT-BoEmDIYA.js → X62E3GBT-CSXB08Iw.js} +2 -2
- package/dist/client/assets/{XBNEOJTC-ACchb7zJ.js → XBNEOJTC-CvXlFTiB.js} +2 -2
- package/dist/client/assets/{YHV2MVVZ-WIW1NclZ.js → YHV2MVVZ-BxyA2-Iu.js} +2 -2
- package/dist/client/assets/{YURCZMG2-D8PyipKA.js → YURCZMG2-WkhL6rVs.js} +2 -2
- package/dist/client/assets/{YVG2LODB-BQvBC9bF.js → YVG2LODB-BlCOW5Bm.js} +2 -2
- package/dist/client/assets/{_chat-DDGjgFMR.js → _chat-B72aqP_1.js} +14 -14
- package/dist/client/assets/{_chat.design-DjIqnlVZ.js → _chat.design-BzS-6FDR.js} +2 -2
- package/dist/client/assets/{_chat.index-Dku1iZH1.js → _chat.index-DyO0DElX.js} +2 -2
- package/dist/client/assets/{_chat.new-8-cjg5K7.js → _chat.new-Dy39C0PE.js} +2 -2
- package/dist/client/assets/{_chat.pull-requests-DVfSewSZ.js → _chat.pull-requests-Bzb1CyG6.js} +2 -2
- package/dist/client/assets/{assetUrls-BOJMUK_1.js → assetUrls-DSeSTRY1.js} +2 -2
- package/dist/client/assets/{assets-6zZLBDZw.js → assets-B_r3wLhD.js} +2 -2
- package/dist/client/assets/{browserHistoryStore-TJXTYA-V.js → browserHistoryStore-BG8TrOnZ.js} +2 -2
- package/dist/client/assets/{browserLinkTarget-DRbX4L_9.js → browserLinkTarget-jRu1-WRM.js} +2 -2
- package/dist/client/assets/{connect-Dp9BB7ev.js → connect-a25FIa26.js} +2 -2
- package/dist/client/assets/{connect-agent-DkbIqI-8.js → connect-agent-C1UODlly.js} +2 -2
- package/dist/client/assets/{design-Dn5DzqF2.js → design-C7HRMO73.js} +2 -2
- package/dist/client/assets/{device-dylO5xoO.js → device-BNK9g-io.js} +2 -2
- package/dist/client/assets/{diffRendering-MXukhqw1.js → diffRendering-UEl_19xa.js} +2 -2
- package/dist/client/assets/{dist-ceTe_mn7.js → dist-ATiHSdUa.js} +2 -2
- package/dist/client/assets/{duoViewer-C0aL6Kyr.js → duoViewer-C7BduYuF.js} +2 -2
- package/dist/client/assets/{dynamic-DTzzXo3L.js → dynamic-CFqi-4NG.js} +2 -2
- package/dist/client/assets/{embeddedScripts-DcWCyBxX.js → embeddedScripts-BNfDELW_.js} +2 -2
- package/dist/client/assets/{entities-eRiwvW2F.js → entities-pafv-XUM.js} +2 -2
- package/dist/client/assets/{fileLinks-CYejoXPq.js → fileLinks-pJLWwULO.js} +2 -2
- package/dist/client/assets/{fileTreeExpansion-wG1G7D6R.js → fileTreeExpansion-CXgwpUPc.js} +2 -2
- package/dist/client/assets/{getDiffFileInput-CzeweGHs.js → getDiffFileInput-eTK8du_O.js} +2 -2
- package/dist/client/assets/{guideRunStore-DAYN2Zd7.js → guideRunStore-83fw4RPw.js} +2 -2
- package/dist/client/assets/{index-DA9og9YW.js → index-C0oEvzQc.js} +3 -3
- package/dist/client/assets/{lazy-Ccs3klKO.js → lazy-B292152Q.js} +4 -4
- package/dist/client/assets/{linkedPrompt-BJh0Yqud.js → linkedPrompt-BOQDb8-o.js} +2 -2
- package/dist/client/assets/{main-DleJeMZO.js → main-Cywp3EWc.js} +7 -7
- package/dist/client/assets/{mediaReference-BbSbhpkR.js → mediaReference-onv8z3Oz.js} +2 -2
- package/dist/client/assets/{mediaSource-B_75uvyp.js → mediaSource-BhEv5iyl.js} +2 -2
- package/dist/client/assets/{onboarding-1Zg3fM0A.js → onboarding-y217_KQL.js} +2 -2
- package/dist/client/assets/{openFileInPreview-CiPuDrfB.js → openFileInPreview-DeuqxJFn.js} +2 -2
- package/dist/client/assets/{p4ProjectFile-BVKW5TIA.js → p4ProjectFile-BuzidL5M.js} +2 -2
- package/dist/client/assets/{pair-DUv1mY4i.js → pair-BjRq2ZHP.js} +2 -2
- package/dist/client/assets/{phoneViewer-CStYy_tX.js → phoneViewer-DYOR2qAi.js} +2 -2
- package/dist/client/assets/{pierre-icons-D3vWvKqU.js → pierre-icons-BDVVO9cA.js} +2 -2
- package/dist/client/assets/{preview-ipLyyv_l.js → preview-BoTHkmVi.js} +2 -2
- package/dist/client/assets/{primary-CMBPxKMH.js → primary-DiwDV4KJ.js} +2 -2
- package/dist/client/assets/{primaryCloudLinkState-CER468V5.js → primaryCloudLinkState-BgmcA0C5.js} +2 -2
- package/dist/client/assets/{projectFilesQueryState-D4FdR3Xm.js → projectFilesQueryState-C_yH-05-.js} +2 -2
- package/dist/client/assets/{projectScriptEditor-4wQTbXvz.js → projectScriptEditor-Cu65VaAw.js} +2 -2
- package/dist/client/assets/{providerSkills-D3rxPB_g.js → providerSkills-CgtkB3rc.js} +2 -2
- package/dist/client/assets/{pullRequestDetail.logic-Bkh57WzV.js → pullRequestDetail.logic-FUlKz34F.js} +2 -2
- package/dist/client/assets/{pullRequests-DggtcbhA.js → pullRequests-C8-SkuQU.js} +2 -2
- package/dist/client/assets/{queries-DJfKGsHe.js → queries-BZGM6AjA.js} +2 -2
- package/dist/client/assets/{renderScheduler-BgGYA97h.js → renderScheduler-CGMZZETC.js} +2 -2
- package/dist/client/assets/{runtime-BOlBBevr.js → runtime-BBIAfWJY.js} +3 -3
- package/dist/client/assets/{runtime-CeFhsGnm.js → runtime-CABaKt1A.js} +3 -3
- package/dist/client/assets/{scheduledTasksSettings.logic-BpOBCcOk.js → scheduledTasksSettings.logic-DFlgKyt2.js} +2 -2
- package/dist/client/assets/{server-DvWrfyUO.js → server-mIR8e8Vz.js} +2 -2
- package/dist/client/assets/{session-D3gY-tOR.js → session-BlCBDyVn.js} +2 -2
- package/dist/client/assets/{session-logic-OeNFZd_V.js → session-logic-CwBN7BBv.js} +2 -2
- package/dist/client/assets/{settings-C6gUwixG.js → settings-fTPmNkCr.js} +2 -2
- package/dist/client/assets/{settings.appearance-BdGq8dkT.js → settings.appearance-D96WohbH.js} +2 -2
- package/dist/client/assets/settings.archived-CnXEwX0Z.js +2 -0
- package/dist/client/assets/{settings.computer-use-DTAvnNqQ.js → settings.computer-use-DZTx8sD-.js} +2 -2
- package/dist/client/assets/{settings.connections-CZD-0BNX.js → settings.connections-Rl7zwQ75.js} +2 -2
- package/dist/client/assets/{settings.data-controls-CTVHY8Rd.js → settings.data-controls-DuyfuMcN.js} +2 -2
- package/dist/client/assets/{settings.decisions-D3zMITNw.js → settings.decisions-eRAu1hqY.js} +2 -2
- package/dist/client/assets/{settings.designs-DWeI1d2s.js → settings.designs-C0RxEgfD.js} +2 -2
- package/dist/client/assets/{settings.diagnostics-CqC6fhz6.js → settings.diagnostics-BDo1Ma1e.js} +2 -2
- package/dist/client/assets/{settings.general-BDEcQVI4.js → settings.general-CpbG8_Ml.js} +2 -2
- package/dist/client/assets/{settings.integrations-BmqNoylk.js → settings.integrations-CujbsXfc.js} +2 -2
- package/dist/client/assets/{settings.keybindings-Mt7J5TKC.js → settings.keybindings-CQ5xk9v3.js} +2 -2
- package/dist/client/assets/{settings.open-source-licenses-Dvex7Jce.js → settings.open-source-licenses-DIBdHSDB.js} +2 -2
- package/dist/client/assets/{settings.plugins-BAFed2wY.js → settings.plugins-BbsrwhRq.js} +2 -2
- package/dist/client/assets/{settings.projects-DhuXD_vx.js → settings.projects-BeNHSNe9.js} +3 -3
- package/dist/client/assets/{settings.providers-D_-kNRqH.js → settings.providers-DQT6izvS.js} +3 -3
- package/dist/client/assets/{settings.scheduled-tasks-Z4aprmEO.js → settings.scheduled-tasks-vKCtN-OC.js} +2 -2
- package/dist/client/assets/{settings.snap-shot-o0bdbS5t.js → settings.snap-shot-DgPUS-Zo.js} +2 -2
- package/dist/client/assets/{settings.source-control-CwJzBnSu.js → settings.source-control-B87geXn3.js} +2 -2
- package/dist/client/assets/{settings.storage-B4ahmlhx.js → settings.storage-BYfdzwhk.js} +2 -2
- package/dist/client/assets/{settingsLayout-DrhqvTJ8.js → settingsLayout-vgYGia0Q.js} +2 -2
- package/dist/client/assets/{sidebarProjectGrouping-DDt6qTcu.js → sidebarProjectGrouping-DaMfJpqc.js} +2 -2
- package/dist/client/assets/{sourceControl-Dqo9EYNC.js → sourceControl-CcPqr0UX.js} +2 -2
- package/dist/client/assets/{sourceControlClients-DGnHi6Rd.js → sourceControlClients-DtjbXUDt.js} +2 -2
- package/dist/client/assets/{terminalSessions-BykgTNwT.js → terminalSessions-0YYscaVr.js} +2 -2
- package/dist/client/assets/{toast-C61oyZY1.js → toast-D26NINYU.js} +2 -2
- package/dist/client/assets/{uiStateStore-DL8OsPjd.js → uiStateStore-CKKy2mq4.js} +2 -2
- package/dist/client/assets/{usage-DATBL2Du.js → usage-BDFFNkIV.js} +2 -2
- package/dist/client/assets/{use-atom-command-Bt7x9oO0.js → use-atom-command-C4y634Qy.js} +2 -2
- package/dist/client/assets/{useHandleNewThread-BOKOo2wA.js → useHandleNewThread-C7ynA68A.js} +2 -2
- package/dist/client/assets/{useP4ConnectAuthPrompt-D63n-MFC.js → useP4ConnectAuthPrompt-5uCMQUT1.js} +2 -2
- package/dist/client/assets/{usePullRequestActions-D53oZord.js → usePullRequestActions-cmzmOrJ-.js} +2 -2
- package/dist/client/assets/{useScopedModelAvailability-CeAUx0qZ.js → useScopedModelAvailability-kczZtr1M.js} +2 -2
- package/dist/client/assets/{useSettings-VTow9ZEM.js → useSettings-CHt2_4He.js} +2 -2
- package/dist/client/assets/{vcsRefInvalidation-B2f3qDSR.js → vcsRefInvalidation-CytQodoP.js} +2 -2
- package/dist/client/assets/{welcome-CQgOocvj.js → welcome-pbssrwWd.js} +2 -2
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/dist/client/assets/JZOYTAAL-BrzaFmLe.js +0 -1
- package/dist/client/assets/settings.archived-DobN7ZtC.js +0 -2
package/dist/client/assets/{settings.integrations-BmqNoylk.js → settings.integrations-CujbsXfc.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{t as i}from"./cloud-Cnpuf424.js";import{t as a}from"./plus-BFikiw2m.js";import{t as o}from"./x-CJgPyqpa.js";import{$_ as s,$n as c,Ch as l,Cp as u,Ep as d,Ey as f,Fg as p,Jg as m,Jn as h,Kg as g,Ng as _,Og as v,Qn as y,Qw as b,Sh as x,Sp as S,Ty as C,Vf as w,Xg as T,Yg as E,Yn as D,Yp as O,Yw as k,Zn as A,aE as j,al as M,ar as N,dr as P,fh as F,fr as I,hh as L,id as R,if as z,il as B,kd as ee,kg as te,l as ne,ph as re,rh as ie,sd as ae,t as V,tr as H,ur as oe,wh as U,xb as se}from"./utils-CBe1bHL7.js";import{W as ce}from"./runtime-CeFhsGnm.js";import{T as le}from"./entities-eRiwvW2F.js";import{a as W,r as ue,t as G}from"./number-field-qEfih146.js";import{a as K,c as de,i as fe,o as pe,r as me,s as he,t as ge}from"./select-Cbpdz6n3.js";import{t as _e}from"./spinner-BZh9P0sD.js";import{i as q}from"./toast-C61oyZY1.js";import{E as ve,T as ye,b as J,c as be,o as xe,q as Se,r as Ce,s as Y}from"./useSettings-VTow9ZEM.js";import{f as we}from"./server-DvWrfyUO.js";import{i as Te,n as Ee}from"./session-D3gY-tOR.js";import{t as De}from"./query-B3Zo1YOE.js";import{t as Oe}from"./use-atom-command-Bt7x9oO0.js";import{t as ke}from"./env-wK1YYxA8.js";import{a as Ae,n as je,t as Me}from"./tooltip-ChmjT8Ns.js";import{t as Ne}from"./input-DXGWoa4O.js";import{a as Pe,c as Fe,i as Ie,n as Le,o as Re,r as ze,s as Be,t as Ve}from"./dialog-_vbB7RKH.js";import{i as He,t as Ue}from"./device-dylO5xoO.js";import{a as We,i as Ge,l as Ke,n as qe,o as Je,t as Ye,u as Xe}from"./DeviceSetup-CAlj40rJ.js";import{t as Ze}from"./AnimatedHeight-BZhIfVtA.js";import{i as Qe,n as $e}from"./Icons-B1qw9fnR.js";import{t as et}from"./preview-ipLyyv_l.js";import{n as tt}from"./preview-O1ZL8Awg.js";import{a as nt,i as rt,o as it,t as at}from"./popover-CogH2zM4.js";import{F as ot,R as st,V as ct,a as X,c as lt,i as ut,r as dt,s as ft,w as pt}from"./settingsLayout-DrhqvTJ8.js";import{Ba as mt,Gr as ht,Jr as gt,Kr as _t,Ma as vt,Na as yt,Xr as bt,Yr as xt,Zr as St,do as Ct,qr as wt,xo as Tt,yr as Et}from"./main-DleJeMZO.js";import{t as Dt}from"./ProjectDefaultsSettings-DABlQCRQ.js";import{t as Ot}from"./draft-input-C-u_3cDw.js";import{t as kt}from"./ScopedSwitch-De6GoQiO.js";import{t as At}from"./SecretInput-Dg6ZsU9p.js";import{n as jt,r as Mt,t as Nt}from"./usePermissionStatus-CKmeNk61.js";var Z=n(),Q=e(r(),1);function Pt(e){let t=(0,Z.c)(27),{tools:n,action:r,kind:i,owner:a,error:o}=e,s=i?n?.[i]:void 0,c;t[0]===s?c=t[1]:(c=s?.runningVersion??(s?.installedVersions.includes(s.requiredVersion)?s.requiredVersion:s?.installedVersions.toSorted(Ft).at(-1)),t[0]=s,t[1]=c);let l=c,u=i===`hub`?`Device hub`:`Agent device`,d=i?`${u}: ${l?`version ${l}`:s?`not installed`:`version unknown`}. Show details`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(I,{tone:`muted`}),t[2]=f):f=t[2];let p=i?l?`v${l}`:s?`Not installed`:`Version unknown`:o?`Versions unavailable`:`Versions`,m;t[3]!==d||t[4]!==p?(m=(0,Q.jsx)(it,{"aria-label":d,render:f,children:p}),t[3]=d,t[4]=p,t[5]=m):m=t[5];let h=i?u:`Device tools`,g;t[6]===h?g=t[7]:(g=(0,Q.jsx)(nt,{children:h}),t[6]=h,t[7]=g);let _;t[8]!==i||t[9]!==u||t[10]!==n?(_=n?(0,Q.jsx)(`div`,{className:`mt-4 divide-y divide-border/50`,children:[[`Device hub`,n.hub],[`Agent device`,n.agent]].filter(e=>{let[t]=e;return!i||t===u}).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`space-y-2 py-3 first:pt-0 last:pb-0`,children:[i?null:(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:t}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Running`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.runningVersion??`Not running`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Required`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.requiredVersion}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Installed`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono break-words`,children:n.installedVersions.join(`, `)||`None`})]})]},t)})}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Versions have not been checked.`}),t[8]=i,t[9]=u,t[10]=n,t[11]=_):_=t[11];let 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)(rt,{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)(at,{children:[m,S]}),t[24]=S,t[25]=m,t[26]=C):C=t[26],C}function Ft(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function It(e,t,n,r=t){let i=(e,t)=>e.target===t.target&&e.port===t.port&&e.identityFile===t.identityFile,a=t=>{let n=e.filter(e=>i(e,t));if(n.length>1)throw Error(`Multiple hosts match this SSH destination. Select the environment to edit its hosts.`);return n[0]},o=e.find(e=>e.id===r.id)??a(r)??(n?void 0:a(t));return n?e.filter(e=>e.id!==o?.id):o?e.map(e=>e.id===o.id?{...t,id:o.id}:e):[...e,t]}function Lt(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Rt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:r}),t[2]=r,t[3]=i),i}function Rt(e){return(0,Q.jsxs)(Me,{children:[(0,Q.jsxs)(Ae,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(ee,{className:`size-3`}):(0,Q.jsx)(S,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(je,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var zt=se(f);function Bt(e){let{identityFile:t,...n}=e;return zt({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function Vt(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function Ht(e,t,n,r){await Promise.all(e.map(async e=>{r(e.environmentId,{status:`pending`});try{if(!e.connected)throw Error(`Environment disconnected`);let i=await n(e.environmentId,t);r(e.environmentId,i.kind===`local`?{status:`local`}:{status:`connected`,platforms:i.platforms,...i.tools?{tools:i.tools}:{}})}catch(t){r(e.environmentId,{status:`failed`,error:t instanceof Error?t.message:String(t)})}}))}function Ut(e){let t=Oe(Ue.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=Vt(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await Ht(e,n,async(e,n)=>{if(!Ee(e,`settings:write`))throw Error(`This connection cannot test device hosts.`);let r=await t({environmentId:e,input:n});if(r._tag===`Failure`)throw Error(k(r.cause));return r.value},(e,t)=>{o[e]=t,r(n=>({...n,[a]:{...n[a],[e]:t}}))}),o}finally{i.current.delete(a)}}}}function Wt(e){let t=(0,Z.c)(107),{host:n,isNew:r,targets:i,busy:a,onSave:o,onClose:s}=e,[c,l]=(0,$.useState)(n),{checks:d,testConnection:f}=Ut(i),p=d[Vt(c)],m=Object.values(p??{}).some(Kt),h,g;t[0]===c?(h=t[1],g=t[2]):(h=Bt({...c,label:c.label.trim()||c.target}),g=j(h),t[0]=c,t[1]=h,t[2]=g);let _=g,v;t[3]===p?v=t[4]:(v=Object.values(p??{}).filter(Gt),t[3]=p,t[4]=v);let y=v.length,b;t[5]!==a||t[6]!==s?(b=e=>{!e&&!a&&s()},t[5]=a,t[6]=s,t[7]=b):b=t[7];let x=!a,S;t[8]!==a||t[9]!==m||t[10]!==c.label||t[11]!==h||t[12]!==o?(S=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),j(h)&&c.label.trim()&&!a&&!m&&o(h.value)}}),t[8]=a,t[9]=m,t[10]=c.label,t[11]=h,t[12]=o,t[13]=S):S=t[13];let C=r?`Add device host`:`Edit device host`,w;t[14]===C?w=t[15]:(w=(0,Q.jsx)(Fe,{children:C}),t[14]=C,t[15]=w);let T=i.length===1?`Connect from ${i[0]?.label}.`:`Connect from ${i.length} selected environments.`,E;t[16]===T?E=t[17]:(E=(0,Q.jsxs)(ze,{children:[T,` `,`Hosts on the same machine are skipped.`]}),t[16]=T,t[17]=E);let D;t[18]!==w||t[19]!==E?(D=(0,Q.jsxs)(Pe,{children:[w,E]}),t[18]=w,t[19]=E,t[20]=D):D=t[20];let O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(`span`,{children:`Name`}),t[21]=O):O=t[21];let k;t[22]===c?k=t[23]:(k=e=>l({...c,label:e.target.value}),t[22]=c,t[23]=k);let A;t[24]!==a||t[25]!==c.label||t[26]!==k?(A=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[O,(0,Q.jsx)(Ne,{autoFocus:!0,required:!0,value:c.label,disabled:a,onChange:k,placeholder:`Mac mini`})]}),t[24]=a,t[25]=c.label,t[26]=k,t[27]=A):A=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]===c?N=t[30]:(N=e=>l({...c,target:e.target.value}),t[29]=c,t[30]=N);let F;t[31]!==a||t[32]!==c.target||t[33]!==N?(F=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[M,(0,Q.jsx)(Ne,{required:!0,value:c.target,disabled:a,onChange:N,placeholder:`user@host or SSH alias`})]}),t[31]=a,t[32]=c.target,t[33]=N,t[34]=F):F=t[34];let I=n.port!==void 0||n.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 z=c.identityFile??``,B;t[37]===c?B=t[38]:(B=e=>{let{identityFile:t,...n}=c;l(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=c,t[38]=B);let te;t[39]!==a||t[40]!==z||t[41]!==B?(te=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[R,(0,Q.jsx)(Ne,{value:z,disabled:a,onChange:B,placeholder:`SSH config default`})]}),t[39]=a,t[40]=z,t[41]=B,t[42]=te):te=t[42];let ne;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=ne):ne=t[43];let re=c.port??``,ae;t[44]===c?ae=t[45]:(ae=e=>{let{port:t,...n}=c;l(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=c,t[45]=ae);let V;t[46]!==a||t[47]!==re||t[48]!==ae?(V=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[ne,(0,Q.jsx)(Ne,{type:`number`,min:1,max:65535,value:re,disabled:a,onChange:ae,placeholder:`Default`})]}),t[46]=a,t[47]=re,t[48]=ae,t[49]=V):V=t[49];let H;t[50]!==te||t[51]!==V?(H=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[te,V]}),t[50]=te,t[51]=V,t[52]=H):H=t[52];let oe;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=oe):oe=t[53];let U;t[54]!==I||t[55]!==H?(U=(0,Q.jsxs)(`details`,{open:I,className:`text-sm`,children:[L,H,oe]}),t[54]=I,t[55]=H,t[56]=U):U=t[56];let se=m?`Checking environments…`:p?y?`${y} of ${i.length} failed`:`Connection checks passed`:`Check access before saving`,ce;t[57]===se?ce=t[58]:(ce=(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:se}),t[57]=se,t[58]=ce);let le=a||m||!_,W;t[59]!==h||t[60]!==f?(W=()=>{j(h)&&f(h.value)},t[59]=h,t[60]=f,t[61]=W):W=t[61];let ue;t[62]===m?ue=t[63]:(ue=m?(0,Q.jsx)(_e,{size:`xs`}):null,t[62]=m,t[63]=ue);let G;t[64]!==le||t[65]!==W||t[66]!==ue?(G=(0,Q.jsxs)(P,{type:`button`,size:`sm`,variant:`outline`,disabled:le,onClick:W,children:[ue,` Test connection`]}),t[64]=le,t[65]=W,t[66]=ue,t[67]=G):G=t[67];let K;t[68]!==ce||t[69]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[ce,G]}),t[68]=ce,t[69]=G,t[70]=K):K=t[70];let de;t[71]!==p||t[72]!==i?(de=p?(0,Q.jsx)(`ul`,{className:`border-t border-border/60 divide-y divide-border/40`,children:i.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)(_e,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(u,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ie,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ee,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(Lt,{platforms:t.platforms})}):null,t.status===`failed`?(0,Q.jsxs)(`details`,{className:`mt-1.5 text-muted-foreground`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:`Show error`}),(0,Q.jsx)(`p`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words`,children:t.error})]}):null]},e.environmentId):null})}):null,t[71]=p,t[72]=i,t[73]=de):de=t[73];let fe;t[74]!==K||t[75]!==de?(fe=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/60`,children:[K,de]}),t[74]=K,t[75]=de,t[76]=fe):fe=t[76];let pe;t[77]!==A||t[78]!==F||t[79]!==U||t[80]!==fe?(pe=(0,Q.jsxs)(Re,{children:[A,F,U,fe]}),t[77]=A,t[78]=F,t[79]=U,t[80]=fe,t[81]=pe):pe=t[81];let me;t[82]!==a||t[83]!==s?(me=(0,Q.jsx)(P,{type:`button`,variant:`ghost`,disabled:a,onClick:s,children:`Cancel`}),t[82]=a,t[83]=s,t[84]=me):me=t[84];let he;t[85]!==a||t[86]!==m||t[87]!==c.label||t[88]!==_?(he=a||m||!_||!c.label.trim(),t[85]=a,t[86]=m,t[87]=c.label,t[88]=_,t[89]=he):he=t[89];let ge;t[90]===a?ge=t[91]:(ge=a?(0,Q.jsx)(_e,{size:`xs`}):null,t[90]=a,t[91]=ge);let q;t[92]!==he||t[93]!==ge?(q=(0,Q.jsxs)(P,{type:`submit`,disabled:he,children:[ge,` Save host`]}),t[92]=he,t[93]=ge,t[94]=q):q=t[94];let ve;t[95]!==me||t[96]!==q?(ve=(0,Q.jsxs)(Ie,{children:[me,q]}),t[95]=me,t[96]=q,t[97]=ve):ve=t[97];let ye;t[98]!==D||t[99]!==pe||t[100]!==x||t[101]!==ve||t[102]!==S?(ye=(0,Q.jsxs)(Be,{showCloseButton:x,render:S,children:[D,pe,ve]}),t[98]=D,t[99]=pe,t[100]=x,t[101]=ve,t[102]=S,t[103]=ye):ye=t[103];let J;return t[104]!==b||t[105]!==ye?(J=(0,Q.jsx)(Ve,{open:!0,onOpenChange:b,children:ye}),t[104]=b,t[105]=ye,t[106]=J):J=t[106],J}function Gt(e){return e.status===`failed`}function Kt(e){return e.status===`pending`}function qt(e){let{scope:t,environments:n,connectedEnvironments:r}=ct(),i=Te(e.environmentId,s),a=t.kind===`project`||t.kind===`checkout`,o=Oe(we.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}=Ut(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(!Ee(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return o({environmentId:e.environmentId,input:{patch:{deviceHosts:It(e.serverConfig.settings.deviceHosts,t,r,i)}}})})),a=n.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});a.length===0?l(null):q.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)(X,{id:`device-hosts`,title:`Device hosts`,serverScoped:!0,settingKeys:[`deviceHosts`],description:`Add remote machines with simulator or emulator runtimes installed, and the selected environments will connect over SSH and set up device tools automatically.`,control:(0,Q.jsxs)(P,{size:`sm`,variant:`outline`,disabled:!i||a||f||!e.environmentId||c!==null,onClick:()=>{d(null),l({kind:`ssh`,id:ne(),label:``,target:``})},children:[(0,Q.jsx)(O,{className:`size-3.5`}),` Add host`]}),children:(0,Q.jsx)(`div`,{className:`pt-3 pb-2`,children:e.environmentId?(0,Q.jsxs)(Q.Fragment,{children:[r.map(e=>(0,Q.jsxs)(`div`,{children:[r.length>1?(0,Q.jsx)(`p`,{className:`pt-3 pb-1 text-xs font-medium text-muted-foreground`,children:e.label}):null,(0,Q.jsx)(Jt,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!i||a||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 q.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)(Wt,{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 Jt(e){let t=(0,Z.c)(28),{environmentLabel:n,environmentId:r,hosts:i,busy:a,onEdit:o,onRemove:s,checks:l,testConnection:u}=e,{state:f}=He(r),p=Oe(Ue.list),[m,h]=(0,$.useState)(null),g;t[0]===i.length?g=t[1]:(g=i.length===0?(0,Q.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No device hosts.`}):null,t[0]=i.length,t[1]=g);let _;if(t[2]!==a||t[3]!==l||t[4]!==r||t[5]!==n||t[6]!==i||t[7]!==o||t[8]!==s||t[9]!==p||t[10]!==m||t[11]!==f||t[12]!==u){let e;t[14]!==a||t[15]!==l||t[16]!==r||t[17]!==n||t[18]!==o||t[19]!==s||t[20]!==p||t[21]!==m||t[22]!==f||t[23]!==u?(e=e=>{let t=f.hostStatuses[e.id],i=l[Vt(e)]?.[r],g=(i?.status===`connected`?i.platforms:void 0)??f.hosts.find(t=>t.id===e.id)?.platforms??[],_=i?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,v=i?.status===`failed`?i.error:i?.status===`local`?void 0:t?.status===`failed`?t.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/50 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label}),g.filter(Xt).map(Yt)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(Pt,{owner:n,error:f.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:f.hosts.find(t=>t.id===e.id)?.tools??(i?.status===`connected`?i.tools:void 0)}),i?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,v?(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:v})]})}):null]}),_?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(_e,{size:`xs`}),_]}):null,(0,Q.jsxs)(D,{children:[(0,Q.jsx)(oe,{render:(0,Q.jsx)(P,{size:`icon-sm`,variant:`ghost-muted`,disabled:a,"aria-label":e.label+` options`}),children:(0,Q.jsx)(d,{})}),(0,Q.jsxs)(H,{align:`end`,children:[(0,Q.jsx)(c,{onClick:()=>{o(e)},children:`Edit`}),(0,Q.jsx)(c,{variant:`destructive`,onClick:()=>s(e),children:`Remove`})]})]}),t?.status===`failed`&&f.supportsHostRetry&&f.hostStatus!==`disabled`?(0,Q.jsx)(P,{size:`sm`,variant:`outline`,disabled:a||m!==null,onClick:()=>{h(e.id),p({environmentId:r,input:{retryHostId:e.id}}).finally(()=>h(null))},children:m===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(P,{size:`sm`,variant:`outline`,disabled:a||_!==null,onClick:()=>void u(e),children:`Test connection`})]},e.id)},t[14]=a,t[15]=l,t[16]=r,t[17]=n,t[18]=o,t[19]=s,t[20]=p,t[21]=m,t[22]=f,t[23]=u,t[24]=e):e=t[24],_=i.map(e),t[2]=a,t[3]=l,t[4]=r,t[5]=n,t[6]=i,t[7]=o,t[8]=s,t[9]=p,t[10]=m,t[11]=f,t[12]=u,t[13]=_}else _=t[13];let v;return t[25]!==g||t[26]!==_?(v=(0,Q.jsxs)(Q.Fragment,{children:[g,_]}),t[25]=g,t[26]=_,t[27]=v):v=t[27],v}function Yt(e){return(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ae,{render:(0,Q.jsx)(`span`,{tabIndex:0,role:`img`,"aria-label":e.platform===`ios`?`iOS available`:`Android available`,className:`shrink-0 text-muted-foreground`}),children:e.platform===`ios`?(0,Q.jsx)(Qe,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)($e,{className:`size-3.5`})}),(0,Q.jsx)(je,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function Xt(e){return e.available}var Zt=se(C),Qt=e=>({kind:`eas`,id:e,label:`EAS Simulator`,accessToken:``,maxSessionMinutes:30,idleMinutes:10,maxConcurrentSessions:2});function $t(e,t,n){return n?e.filter(e=>e.id!==t.id):e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t]}function en(e){return`Up to ${e.maxConcurrentSessions===1?`1 session`:`${e.maxConcurrentSessions} sessions`} at once, each stopped after ${e.maxSessionMinutes} min or ${e.idleMinutes} idle min`}var tn=`thread-project`,nn={settings:`the access token saved here`,env:`EXPO_TOKEN on the server`,"eas-login":`the server's eas login`},rn=e=>{let t=b(e);return t instanceof Error?t.message:String(t)};function an(e){let t=(0,Z.c)(24),{scope:n,connectedEnvironments:r}=ct(),o=Te(e.environmentId,s),c=n.kind===`project`||n.kind===`checkout`,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[0]=l):l=t[0];let u=Oe(we.updateSettings,l),d;t[1]===e.environmentId?d=t[2]:(d=t=>t.environmentId===e.environmentId,t[1]=e.environmentId,t[2]=d);let f=r.find(d)?.serverConfig?.settings.easDeviceHosts??[],[p,m]=(0,$.useState)(null),[h,g]=(0,$.useState)(!1),_=!o||c||h||!e.environmentId,v=async(t,n)=>{if(!e.environmentId||!Ee(e.environmentId,`settings:write`))return;g(!0);let r=await u({environmentId:e.environmentId,input:{patch:{easDeviceHosts:$t(f,t,n)}}});g(!1),r._tag===`Success`?m(null):q.add({type:`error`,title:n?`EAS host not removed`:`EAS host not saved`,description:rn(r.cause)})},y=X,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=[`easDeviceHosts`],t[3]=b):b=t[3];let x=_||p!==null,S;t[4]===m?S=t[5]:(S=()=>m({host:Qt(ne()),isNew:!0}),t[4]=m,t[5]=S);let C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(a,{className:`size-3.5`}),t[6]=C):C=t[6];let w;t[7]!==x||t[8]!==S?(w=(0,Q.jsxs)(P,{size:`sm`,variant:`outline`,disabled:x,onClick:S,children:[C,` Add EAS host`]}),t[7]=x,t[8]=S,t[9]=w):w=t[9];let T=f.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No EAS hosts.`}):(0,Q.jsx)(`ul`,{className:`divide-y divide-border/40`,children:f.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate font-medium`,children:[(0,Q.jsx)(i,{className:`size-3.5 shrink-0`}),` `,e.label]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:en(e)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(P,{size:`sm`,variant:`ghost`,disabled:_,onClick:()=>m({host:e,isNew:!1}),children:`Edit`}),(0,Q.jsx)(P,{size:`sm`,variant:`ghost-destructive`,disabled:_,onClick:()=>void v(e,!0),children:`Remove`})]})]},e.id))}),E;t[10]!==h||t[11]!==p||t[12]!==e.environmentId||t[13]!==v||t[14]!==m?(E=p&&e.environmentId?(0,Q.jsx)(on,{environmentId:e.environmentId,host:p.host,isNew:p.isNew,busy:h,onSave:e=>void v(e,!1),onClose:()=>m(null)},p.host.id):null,t[10]=h,t[11]=p,t[12]=e.environmentId,t[13]=v,t[14]=m,t[15]=E):E=t[15];let D;t[16]!==T||t[17]!==E?(D=(0,Q.jsxs)(`div`,{className:`pt-3 pb-2`,children:[T,E]}),t[16]=T,t[17]=E,t[18]=D):D=t[18];let O;return t[19]!==y||t[20]!==w||t[21]!==D||t[22]!==b?(O=(0,Q.jsx)(y,{id:`eas-device-hosts`,title:`EAS Simulator`,serverScoped:!0,settingKeys:b,description:`Run iOS Simulators in Expo's cloud from this environment. Sessions bill the Expo account until they stop, so each host limits how many run and for how long. Editing or removing a host stops its running sessions.`,control:w,children:D}),t[19]=y,t[20]=w,t[21]=D,t[22]=b,t[23]=O):O=t[23],O}function on(e){let t=(0,Z.c)(135),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=Oe(Ue.easAccount,n),[i,a]=(0,$.useState)(e.host),s=(0,$.useId)(),c;t[1]===e.host.accessToken?c=t[2]:(c=e.host.accessToken?{kind:`saved`}:{kind:`cleared`},t[1]=e.host.accessToken,t[2]=c);let[l,u]=(0,$.useState)(c),d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d={status:`checking`},t[3]=d):d=t[3];let[f,p]=(0,$.useState)(d),m,h;t[4]!==i||t[5]!==e.host.accessToken||t[6]!==l.kind||t[7]!==l.value?(m={...i,label:i.label.trim(),accessToken:l.kind===`saved`?e.host.accessToken:l.kind===`new`?l.value:``},h=j(Zt(m)),t[4]=i,t[5]=e.host.accessToken,t[6]=l.kind,t[7]=l.value,t[8]=m,t[9]=h):(m=t[8],h=t[9]);let g=h,_=g?null:i.maxSessionMinutes>0&&i.idleMinutes>=i.maxSessionMinutes?`Idle minutes must be smaller than session minutes.`:`Give the host a label and limits within the ranges shown.`,v;t[10]!==f.account||t[11]!==f.status?(v=f.status===`signed-in`?f.account.apps:[],t[10]=f.account,t[11]=f.status,t[12]=v):v=t[12];let y=v,b=(0,$.useRef)(0),x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{b.current+=1,p({status:`idle`})},t[13]=x):x=t[13];let S=x,C;t[14]!==r||t[15]!==e.environmentId||t[16]!==e.host.id||t[17]!==e.isNew||t[18]!==l.kind||t[19]!==l.value?(C=async()=>{let t=b.current+=1,n=await r({environmentId:e.environmentId,input:{...l.kind===`saved`&&!e.isNew?{hostId:e.host.id}:{},...l.kind===`new`?{accessToken:l.value}:l.kind===`cleared`?{accessToken:``}:{}}});t===b.current&&p(n._tag===`Success`?{status:`signed-in`,account:n.value}:{status:`failed`,error:rn(n.cause)})},t[14]=r,t[15]=e.environmentId,t[16]=e.host.id,t[17]=e.isNew,t[18]=l.kind,t[19]=l.value,t[20]=C):C=t[20];let w=C,T;t[21]===w?T=t[22]:(T=()=>{p({status:`checking`}),w()},t[21]=w,t[22]=T);let E=T,D;t[23]===w?D=t[24]:(D=()=>void w(),t[23]=w,t[24]=D);let O=(0,$.useEffectEvent)(D),k;t[25]===O?k=t[26]:(k=()=>{O()},t[25]=O,t[26]=k);let A;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(A=[],t[27]=A):A=t[27],(0,$.useEffect)(k,A);let M;t[28]!==i||t[29]!==e.busy?(M=(t,n,r)=>(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(Ne,{type:`number`,min:1,max:r,value:i[t],disabled:e.busy,onChange:e=>{let n=Number(e.target.value);a(e=>({...e,[t]:n}))}})]}),t[28]=i,t[29]=e.busy,t[30]=M):M=t[30];let N=M,F;t[31]===e?F=t[32]:(F=t=>{!t&&!e.busy&&e.onClose()},t[31]=e,t[32]=F);let I=!e.busy,L;t[33]!==m||t[34]!==e||t[35]!==g?(L=t=>{t.preventDefault(),g&&!e.busy&&e.onSave(m)},t[33]=m,t[34]=e,t[35]=g,t[36]=L):L=t[36];let R=e.isNew?`Add EAS host`:`Edit EAS host`,z;t[37]===R?z=t[38]:(z=(0,Q.jsx)(Fe,{children:R}),t[37]=R,t[38]=z);let B;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(ze,{children:`The environment's server signs in to Expo and starts the sessions. Without a token here it uses EXPO_TOKEN, then its eas login.`}),t[39]=B):B=t[39];let ee;t[40]===z?ee=t[41]:(ee=(0,Q.jsxs)(Pe,{children:[z,B]}),t[40]=z,t[41]=ee);let te;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(`span`,{children:`Name`}),t[42]=te):te=t[42];let ne;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>{let t=e.target.value;a(e=>({...e,label:t}))},t[43]=ne):ne=t[43];let re;t[44]!==i.label||t[45]!==e.busy?(re=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[te,(0,Q.jsx)(Ne,{autoFocus:!0,required:!0,value:i.label,disabled:e.busy,onChange:ne})]}),t[44]=i.label,t[45]=e.busy,t[46]=re):re=t[46];let ie;t[47]===s?ie=t[48]:(ie=(0,Q.jsx)(`label`,{htmlFor:s,className:`block`,children:`Expo access token`}),t[47]=s,t[48]=ie);let ae=l.kind===`saved`,V=l.kind===`new`?l.value:``,H;t[49]===e.host.accessToken?H=t[50]:(H=t=>{let n=t.target.value;u(n?{kind:`new`,value:n}:e.host.accessToken?{kind:`saved`}:{kind:`cleared`}),S()},t[49]=e.host.accessToken,t[50]=H);let oe;t[51]!==e.busy||t[52]!==ae||t[53]!==V||t[54]!==H||t[55]!==s?(oe=(0,Q.jsx)(At,{id:s,className:`min-w-0 flex-1`,configured:ae,value:V,disabled:e.busy,placeholder:`Optional`,onChange:H}),t[51]=e.busy,t[52]=ae,t[53]=V,t[54]=H,t[55]=s,t[56]=oe):oe=t[56];let U;t[57]===l.kind?U=t[58]:(U=l.kind===`cleared`?null:(0,Q.jsx)(P,{type:`button`,size:`icon-sm`,variant:`ghost-destructive`,"aria-label":`Clear access token`,onClick:()=>{u({kind:`cleared`}),S()},children:(0,Q.jsx)(o,{className:`size-3.5`})}),t[57]=l.kind,t[58]=U);let se;t[59]!==oe||t[60]!==U?(se=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[oe,U]}),t[59]=oe,t[60]=U,t[61]=se):se=t[61];let ce;t[62]!==ie||t[63]!==se?(ce=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ie,se]}),t[62]=ie,t[63]=se,t[64]=ce):ce=t[64];let le=f.status===`signed-in`?`Signed in as ${f.account.signedInAs} with ${nn[f.account.credentialSource]}.`:f.status===`failed`?f.error:f.status===`checking`?`Checking the Expo account…`:`Check the Expo account before choosing a project.`,W;t[65]===le?W=t[66]:(W=(0,Q.jsx)(`p`,{role:`status`,className:`min-w-0 text-xs text-muted-foreground`,children:le}),t[65]=le,t[66]=W);let ue=e.busy||f.status===`checking`,G;t[67]===E?G=t[68]:(G=()=>void E(),t[67]=E,t[68]=G);let fe;t[69]===f.status?fe=t[70]:(fe=f.status===`checking`?(0,Q.jsx)(_e,{size:`xs`}):null,t[69]=f.status,t[70]=fe);let me;t[71]!==ue||t[72]!==G||t[73]!==fe?(me=(0,Q.jsxs)(P,{type:`button`,size:`sm`,variant:`outline`,disabled:ue,onClick:G,children:[fe,` Check account`]}),t[71]=ue,t[72]=G,t[73]=fe,t[74]=me):me=t[74];let q;t[75]!==W||t[76]!==me?(q=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2.5`,children:[W,me]}),t[75]=W,t[76]=me,t[77]=q):q=t[77];let ve;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(`span`,{children:`EAS project`}),t[78]=ve):ve=t[78];let ye=i.appId??tn,J=e.busy,be;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(be=e=>{typeof e==`string`&&a(t=>{let{appId:n,...r}=t;return e===tn?r:{...r,appId:e}})},t[79]=be):be=t[79];let xe;t[80]===y?xe=t[81]:(xe=(0,Q.jsx)(he,{size:`sm`,"aria-label":`EAS project`,children:(0,Q.jsx)(de,{children:e=>e===tn?`From the thread's project`:y.find(t=>t.id===e)?.fullName??e})}),t[80]=y,t[81]=xe);let Se;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Q.jsx)(K,{value:tn,children:`From the thread's project`}),t[82]=Se):Se=t[82];let Ce;t[83]!==y||t[84]!==i.appId?(Ce=i.appId&&!y.some(e=>e.id===i.appId)?(0,Q.jsx)(K,{value:i.appId,children:i.appId}):null,t[83]=y,t[84]=i.appId,t[85]=Ce):Ce=t[85];let Y;t[86]===y?Y=t[87]:(Y=y.map(sn),t[86]=y,t[87]=Y);let we;t[88]!==Ce||t[89]!==Y?(we=(0,Q.jsxs)(pe,{children:[Se,Ce,Y]}),t[88]=Ce,t[89]=Y,t[90]=we):we=t[90];let Te;t[91]!==e.busy||t[92]!==ye||t[93]!==xe||t[94]!==we?(Te=(0,Q.jsxs)(ge,{value:ye,disabled:J,onValueChange:be,children:[xe,we]}),t[91]=e.busy,t[92]=ye,t[93]=xe,t[94]=we,t[95]=Te):Te=t[95];let Ee;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sessions bill the project's Expo account. "From the thread's project" reads extra.eas.projectId from the project's app config.`}),t[96]=Ee):Ee=t[96];let De;t[97]===Te?De=t[98]:(De=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ve,Te,Ee]}),t[97]=Te,t[98]=De);let ke;t[99]===N?ke=t[100]:(ke=(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[N(`maxConcurrentSessions`,`Sessions at once`,20),N(`maxSessionMinutes`,`Session minutes`,115),N(`idleMinutes`,`Idle minutes`,60)]}),t[99]=N,t[100]=ke);let Ae=e.isNew?null:` Saving restarts this host, which stops its running sessions.`,je;t[101]===Ae?je=t[102]:(je=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Expo allows sessions of up to 40 minutes on free accounts and 115 on paid ones, and ends one after the idle minutes without activity, so idle minutes must be smaller than session minutes.`,Ae]}),t[101]=Ae,t[102]=je);let Me;t[103]===_?Me=t[104]:(Me=_===null?null:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:_}),t[103]=_,t[104]=Me);let Le;t[105]!==re||t[106]!==ce||t[107]!==q||t[108]!==De||t[109]!==ke||t[110]!==je||t[111]!==Me?(Le=(0,Q.jsxs)(Re,{children:[re,ce,q,De,ke,je,Me]}),t[105]=re,t[106]=ce,t[107]=q,t[108]=De,t[109]=ke,t[110]=je,t[111]=Me,t[112]=Le):Le=t[112];let He;t[113]!==e.busy||t[114]!==e.onClose?(He=(0,Q.jsx)(P,{type:`button`,variant:`ghost`,disabled:e.busy,onClick:e.onClose,children:`Cancel`}),t[113]=e.busy,t[114]=e.onClose,t[115]=He):He=t[115];let We=e.busy||!g,Ge;t[116]===e.busy?Ge=t[117]:(Ge=e.busy?(0,Q.jsx)(_e,{size:`xs`}):null,t[116]=e.busy,t[117]=Ge);let Ke;t[118]!==We||t[119]!==Ge?(Ke=(0,Q.jsxs)(P,{type:`submit`,disabled:We,children:[Ge,` Save host`]}),t[118]=We,t[119]=Ge,t[120]=Ke):Ke=t[120];let qe;t[121]!==He||t[122]!==Ke?(qe=(0,Q.jsxs)(Ie,{children:[He,Ke]}),t[121]=He,t[122]=Ke,t[123]=qe):qe=t[123];let Je;t[124]!==L||t[125]!==ee||t[126]!==Le||t[127]!==qe?(Je=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-col`,onSubmit:L,children:[ee,Le,qe]}),t[124]=L,t[125]=ee,t[126]=Le,t[127]=qe,t[128]=Je):Je=t[128];let Ye;t[129]!==I||t[130]!==Je?(Ye=(0,Q.jsx)(Be,{showCloseButton:I,children:Je}),t[129]=I,t[130]=Je,t[131]=Ye):Ye=t[131];let Xe;return t[132]!==F||t[133]!==Ye?(Xe=(0,Q.jsx)(Ve,{open:!0,onOpenChange:F,children:Ye}),t[132]=F,t[133]=Ye,t[134]=Xe):Xe=t[134],Xe}function sn(e){return(0,Q.jsx)(K,{value:e.id,children:e.fullName},e.id)}function cn(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function ln(e,t,n){if(e.kind===`new`)return{kind:`new`,profileId:t};let r=n.find(t=>t.id===e.profileId);if(r!==void 0)return{kind:`existing`,profileId:e.profileId,name:r.name}}function un(e){return e.step!==`importing`}function dn(e){return e.unavailable===`browserRunning`?{step:`quit`}:e.unavailable===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`configure`}:e.unavailable===void 0?e.profiles.length===0?{step:`blocked`,reason:`unknownSourceProfile`}:{step:`configure`}:{step:`blocked`,reason:e.unavailable}}function fn(e){return e.kind===`imported`?{step:`done`,imported:e.imported,skipped:e.skipped,skippedDomains:e.skippedDomains,targetName:e.targetName}:e.reason===`browserRunning`?{step:`quit`}:e.reason===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`import`,checked:!0}:{step:`blocked`,reason:e.reason}}function pn(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:dn(e)}function mn(e){let t=pn(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function hn(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function gn(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function _n(e){return e.length===0?``:e.length===1?e[0]:e.length<=3?`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`:`${e.slice(0,3).join(`, `)} and ${e.length-3} more`}function vn(e){let t=(0,Z.c)(46),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,onImport:o,onRefreshSource:s,onOpenFullDiskAccessSettings:c,onCheckFullDiskAccess:l,onClose:u}=e,[d,f]=(0,$.useState)(n),p;t[0]===n?p=t[1]:(p=()=>dn(n),t[0]=n,t[1]=p);let[m,h]=(0,$.useState)(p),g;t[2]===n.profiles[0]?.directory?g=t[3]:(g=()=>n.profiles[0]?.directory??``,t[2]=n.profiles[0]?.directory,t[3]=g);let[_,v]=(0,$.useState)(g),y;t[4]!==a||t[5]!==i?(y=()=>cn(a,i),t[4]=a,t[5]=i,t[6]=y):y=t[6];let[b,x]=(0,$.useState)(y),[S,C]=(0,$.useState)(),w;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=ne(),t[7]=w):w=t[7];let T=(0,$.useRef)(`profile-${w}`),E=(0,$.useRef)(!1),D;t[8]!==o||t[9]!==_||t[10]!==b||t[11]!==i?(D=()=>{if(E.current)return;let e=ln(b,T.current,i);if(e===void 0){C(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`});return}C(void 0),E.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(fn(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{E.current=!1})},t[8]=o,t[9]=_,t[10]=b,t[11]=i,t[12]=D):D=t[12];let O=D,k;t[13]===s?k=t[14]:(k=(e,t)=>{h({step:`checking`,check:e}),s().then(e=>{e&&(f(e),v(t=>hn(t,e))),h(t(e))}).catch(()=>h({step:`blocked`,reason:`readFailed`}))},t[13]=s,t[14]=k);let A=k,j;t[15]===A?j=t[16]:(j=()=>A(`browser`,pn),t[15]=A,t[16]=j);let M=j,N;t[17]===A?N=t[18]:(N=()=>A(`fullDiskAccess`,mn),t[17]=A,t[18]=N);let P=N,F;t[19]!==u||t[20]!==m?(F=e=>e||!un(m)?void 0:u(),t[19]=u,t[20]=m,t[21]=F):F=t[21];let I;t[22]===m?I=t[23]:(I=un(m),t[22]=m,t[23]=I);let L;t[24]!==a||t[25]!==r||t[26]!==l||t[27]!==u||t[28]!==c||t[29]!==s||t[30]!==M||t[31]!==P||t[32]!==O||t[33]!==d||t[34]!==_||t[35]!==m||t[36]!==b||t[37]!==S||t[38]!==i?(L=m.step===`quit`?(0,Q.jsx)(yn,{source:d,onCancel:u,onRechecked:M}):m.step===`fullDiskAccess`?(0,Q.jsx)(Sn,{source:d,onCancel:u,onOpenSettings:c,onCheck:l??(async()=>{let e=await s();return e!==void 0&&e.unavailable===void 0}),onGranted:m.resume===`import`?O:P,stillRequired:m.checked===!0}):m.step===`importing`?(0,Q.jsx)(Tn,{}):m.step===`checking`?(0,Q.jsx)(En,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(Dn,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(On,{source:d,reason:m.reason,onClose:u,onRetry:gn(m.reason)?O:void 0}):(0,Q.jsx)(Cn,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:v,target:b,onTargetChange:e=>{x(e),C(void 0)},targetError:S,onCancel:u,onImport:O}),t[24]=a,t[25]=r,t[26]=l,t[27]=u,t[28]=c,t[29]=s,t[30]=M,t[31]=P,t[32]=O,t[33]=d,t[34]=_,t[35]=m,t[36]=b,t[37]=S,t[38]=i,t[39]=L):L=t[39];let R;t[40]!==I||t[41]!==L?(R=(0,Q.jsx)(Be,{className:`max-w-lg`,showCloseButton:I,children:L}),t[40]=I,t[41]=L,t[42]=R):R=t[42];let z;return t[43]!==R||t[44]!==F?(z=(0,Q.jsx)(Ve,{open:!0,onOpenChange:F,children:R}),t[43]=R,t[44]=F,t[45]=z):z=t[45],z}function yn(e){let t=(0,Z.c)(12),{source:n,onCancel:r,onRechecked:i}=e,a;t[0]===n.name?a=t[1]:(a=(0,Q.jsxs)(Pe,{children:[(0,Q.jsxs)(Fe,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(ze,{children:[n.name,` is open, so its cookies can’t be read yet. Quit it, then continue.`]})]}),t[0]=n.name,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(P,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(P,{onClick:i,children:`I’ve quit it`}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(Ie,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function bn(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function xn(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function Sn(e){let t=(0,Z.c)(43),{source:n,onCancel:r,onOpenSettings:i,onGranted:a,stillRequired:o,onCheck:s}=e,[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=Nt(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)(Pe,{children:[(0,Q.jsxs)(Fe,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(ze,{children:[`To import cookies from `,n.name,`, P4 Code needs Full Disk Access. Turn it on in System Settings, then come back to finish the import — you can revoke it again once the import is done.`]})]}),t[6]=n.name,t[7]=_);let v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(w,{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)(jt,{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 T;t[21]!==m||t[22]!==o?(T=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]=T):T=t[23];let E;t[24]!==C||t[25]!==T||t[26]!==S?(E=(0,Q.jsxs)(Re,{children:[S,C,T]}),t[24]=C,t[25]=T,t[26]=S,t[27]=E):E=t[27];let D;t[28]===r?D=t[29]:(D=(0,Q.jsx)(P,{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)(Mt,{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)(Ie,{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 Cn(e){let t=(0,Z.c)(59),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:o,onSourceProfileChange:s,target:c,targetError:l,onTargetChange:u,onCancel:d,onImport:f}=e,p;t[0]!==c.kind||t[1]!==c.profileId||t[2]!==i?(p=c.kind===`existing`&&!i.some(e=>e.id===c.profileId),t[0]=c.kind,t[1]=c.profileId,t[2]=i,t[3]=p):p=t[3];let m=p,h=c.kind===`new`&&!a,g=l??(m?`That profile is no longer available. Choose where to import these cookies.`:h?`You've reached the profile limit. Choose an existing profile to import into.`:void 0),_;t[4]===n.name?_=t[5]:(_=(0,Q.jsxs)(Fe,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=_);let v;t[6]===r?v=t[7]:(v=(0,Q.jsxs)(ze,{children:[`Choose which cookies to import for `,r,`.`]}),t[6]=r,t[7]=v);let y;t[8]!==_||t[9]!==v?(y=(0,Q.jsxs)(Pe,{children:[_,v]}),t[8]=_,t[9]=v,t[10]=y):y=t[10];let 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)(wn,{selected:o===e.directory,title:e.name,subtitle:bn(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],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)(R,{className:`size-4 sm:hidden`}),(0,Q.jsx)(ae,{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 T;t[23]!==a||t[24]!==u||t[25]!==c.kind?(T=a?(0,Q.jsx)(wn,{selected:c.kind===`new`,title:`New profile`,subtitle:`Created for these cookies`,onSelect:()=>u({kind:`new`})}):null,t[23]=a,t[24]=u,t[25]=c.kind,t[26]=T):T=t[26];let E;if(t[27]!==u||t[28]!==c.kind||t[29]!==c.profileId||t[30]!==i){let e;t[32]!==u||t[33]!==c.kind||t[34]!==c.profileId?(e=e=>(0,Q.jsx)(wn,{selected:c.kind===`existing`&&c.profileId===e.id,title:e.name,subtitle:`Existing profile`,onSelect:()=>u({kind:`existing`,profileId:e.id})},e.id),t[32]=u,t[33]=c.kind,t[34]=c.profileId,t[35]=e):e=t[35],E=i.map(e),t[27]=u,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=E}else E=t[31];let D;t[36]!==T||t[37]!==E?(D=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[w,T,E]}),t[36]=T,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==S?(O=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[S,C,D]}),t[39]=D,t[40]=S,t[41]=O):O=t[41];let k;t[42]===g?k=t[43]:(k=g?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:g}):null,t[42]=g,t[43]=k);let A;t[44]!==O||t[45]!==k?(A=(0,Q.jsxs)(Re,{children:[O,k]}),t[44]=O,t[45]=k,t[46]=A):A=t[46];let j;t[47]===d?j=t[48]:(j=(0,Q.jsx)(P,{variant:`outline`,onClick:d,children:`Cancel`}),t[47]=d,t[48]=j);let M=o===``||m||h,N;t[49]!==f||t[50]!==M?(N=(0,Q.jsx)(P,{disabled:M,onClick:f,children:`Import`}),t[49]=f,t[50]=M,t[51]=N):N=t[51];let F;t[52]!==j||t[53]!==N?(F=(0,Q.jsxs)(Ie,{children:[j,N]}),t[52]=j,t[53]=N,t[54]=F):F=t[54];let I;return t[55]!==A||t[56]!==F||t[57]!==y?(I=(0,Q.jsxs)(Q.Fragment,{children:[y,A,F]}),t[55]=A,t[56]=F,t[57]=y,t[58]=I):I=t[58],I}function wn(e){let t=(0,Z.c)(22),{selected:n,title:r,subtitle:i,onSelect:a}=e,o=n?`border-primary bg-primary/8`:`border-border/60 hover:border-border hover:bg-muted/40`,s;t[0]===o?s=t[1]:(s=V(`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=V(`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)(ee,{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)(Pe,{children:[(0,Q.jsx)(Fe,{children:`Importing cookies`}),(0,Q.jsx)(ze,{children:`This may take a moment.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[t,(0,Q.jsx)(Re,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(_e,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function En(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(Fe,{children:[`Checking `,n]}),t[0]=n,t[1]=i);let a=r===`fullDiskAccess`?`Checking Full Disk Access.`:`Checking whether the browser has closed.`,o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(ze,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(Pe,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6];let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(_e,{size:`md`,tone:`muted`}),t[7]=c):c=t[7];let l=r===`fullDiskAccess`?`Checking access…`:`Checking…`,u;t[8]===l?u=t[9]:(u=(0,Q.jsx)(Re,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[c,(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:l})]})}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function Dn(e){let t=(0,Z.c)(24),{imported:n,skipped:r,skippedDomains:i,targetName:a,destinationEnvironmentName:o,onClose:s}=e,c;t[0]!==n||t[1]!==r?(c=n>0?`Imported ${xn(n)}`:r>0?`Skipped ${xn(r)}`:`No cookies found`,t[0]=n,t[1]=r,t[2]=c):c=t[2];let l;t[3]===c?l=t[4]:(l=(0,Q.jsx)(Fe,{children:c}),t[3]=c,t[4]=l);let u;t[5]!==o||t[6]!==n||t[7]!==r||t[8]!==a?(u=n>0?`Added to ${a} for ${o}.${r>0?` ${xn(r)} skipped.`:``}`:r>0?`No cookies were imported for ${o}.`:`There were no cookies to import for ${o}.`,t[5]=o,t[6]=n,t[7]=r,t[8]=a,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,Q.jsx)(ze,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(Pe,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i.length>0?(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Skipped`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-foreground`,children:_n(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(P,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(Ie,{children:(0,Q.jsx)(Le,{render:m,onClick:s,children:`Done`})}),t[18]=s,t[19]=h);let g;return t[20]!==f||t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[f,p,h]}),t[20]=f,t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function On(e){let t=(0,Z.c)(17),{source:n,reason:r,onClose:i,onRetry:a}=e,o;t[0]===n.name?o=t[1]:(o=(0,Q.jsxs)(Fe,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=o);let s=B[r],c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(ze,{children:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c?(l=(0,Q.jsxs)(Pe,{children:[o,c]}),t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,Q.jsx)(P,{variant:`outline`,onClick:i,children:`Close`}),t[7]=i,t[8]=u);let d;t[9]===a?d=t[10]:(d=a?(0,Q.jsx)(P,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(Ie,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==l||t[15]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16],p}var kn=`fill`,An=`responsive`;async function jn(e,t,n,r){let i=e===null?[]:t,a=r?.environmentIds??[];if(i.length===0&&a.length===0)throw Error(`Browser profile data is not available to clear.`);await Promise.all([...i.flatMap(t=>[e.clearCookies(t,n),e.clearCache(t,n)]),...a.map(e=>r.clear(e,n))])}function Mn(e,t,n,r=0){return(e||r>0)&&t&&n>0}var Nn={width:1280,height:800},Pn={useGrouping:!1},Fn={system:`System`,light:`Light`,dark:`Dark`},In=e=>`${Math.round(e*100)}%`,Ln=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},Rn=e=>{let t=String(e?.message??``);return M.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},zn=e=>e._tag===`fill`?kn:e._tag===`preset`&&yt.some(t=>t.id===e.presetId)?e.presetId:An,Bn=e=>{let t=zn(e);return t===kn?`Fill panel`:t===An?`Responsive`:yt.find(e=>e.id===t)?.label??`Responsive`},Vn=e=>Number.isInteger(e)&&e>=240&&e<=3840,Hn=e=>({...e,width:e.height,height:e.width});function Un(e){let t=(0,Z.c)(42),{disabled:n}=e,r=Y(Gn),i=J(),a=r._tag===`fill`?null:r,o=a?.width??Nn.width,s=a?.height??Nn.height,c;t[0]!==o||t[1]!==s?(c={width:o,height:s},t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]!==a?.height||t[4]!==a?.width||t[5]!==i?(u=e=>{if(e===kn){i({browserDefaultViewport:te});return}if(e===An){i({browserDefaultViewport:{_tag:`freeform`,width:a?.width??Nn.width,height:a?.height??Nn.height}});return}let t=yt.find(t=>t.id===e);t&&i({browserDefaultViewport:{_tag:`preset`,width:t.width,height:t.height,presetId:t.id}})},t[3]=a?.height,t[4]=a?.width,t[5]=i,t[6]=u):u=t[6];let d=u,f;t[7]!==l||t[8]!==a||t[9]!==i?(f=(e,t)=>{if(t===null||!Vn(t))return;let n={...l,[e]:t};n.width*n.height>8294400||a&&n.width===a.width&&n.height===a.height||i({browserDefaultViewport:{_tag:`freeform`,...n}})},t[7]=l,t[8]=a,t[9]=i,t[10]=f):f=t[10];let p=f,m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=Et(`browser-default-viewport`),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i||t[14]!==r._tag?(h=!n&&r._tag!==U._tag?(0,Q.jsx)(dt,{label:`default browser viewport`,onClick:()=>i({browserDefaultViewport:U})}):null,t[12]=n,t[13]=i,t[14]=r._tag,t[15]=h):h=t[15];let g;t[16]===r?g=t[17]:(g=zn(r),t[16]=r,t[17]=g);let v;t[18]===r?v=t[19]:(v=Bn(r),t[18]=r,t[19]=v);let y;t[20]===v?y=t[21]:(y=(0,Q.jsx)(he,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(de,{children:v})}),t[20]=v,t[21]=y);let b,x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(K,{value:kn,children:`Fill panel`}),x=(0,Q.jsx)(K,{value:An,children:`Responsive`}),t[22]=b,t[23]=x):(b=t[22],x=t[23]);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(pe,{align:`end`,alignItemWithTrigger:!1,children:[b,x,(0,Q.jsxs)(me,{children:[(0,Q.jsx)(fe,{children:`Standard`}),yt.map(Wn)]})]}),t[24]=S):S=t[24];let C;t[25]!==n||t[26]!==d||t[27]!==y||t[28]!==g?(C=(0,Q.jsxs)(ge,{value:g,onValueChange:d,disabled:n,children:[y,S]}),t[25]=n,t[26]=d,t[27]=y,t[28]=g,t[29]=C):C=t[29];let w;t[30]!==p||t[31]!==n||t[32]!==l||t[33]!==a||t[34]!==i?(w=a?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(G,{value:l.width,min:240,max:_,disabled:n,format:Pn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`width`,e),children:(0,Q.jsx)(ue,{children:(0,Q.jsx)(W,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(G,{value:l.height,min:240,max:_,disabled:n,format:Pn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`height`,e),children:(0,Q.jsx)(ue,{children:(0,Q.jsx)(W,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ae,{render:(0,Q.jsx)(P,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${l.height>=l.width?`landscape`:`portrait`}`,onClick:()=>i({browserDefaultViewport:Hn(a)}),children:(0,Q.jsx)(vt,{})})}),(0,Q.jsx)(je,{side:`top`,children:`Rotate`})]})]}):null,t[30]=p,t[31]=n,t[32]=l,t[33]=a,t[34]=i,t[35]=w):w=t[35];let T;t[36]!==C||t[37]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto`,children:[C,w]}),t[36]=C,t[37]=w,t[38]=T):T=t[38];let E;return t[39]!==T||t[40]!==h?(E=(0,Q.jsx)(X,{...m,description:`Tab size for you and agents. Fill fits the panel; other sizes show the device toolbar.`,resetAction:h,control:T}),t[39]=T,t[40]=h,t[41]=E):E=t[41],E}function Wn(e){return(0,Q.jsx)(K,{value:e.id,children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-5`,children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:e.detail})]})},e.id)}function Gn(e){return e.browserDefaultViewport}function Kn(e){let t=(0,Z.c)(20),{disabled:n}=e,r=Y(Jn),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Et(`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)(dt,{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=p.find(t=>String(t)===e);t!==void 0&&i({browserDefaultZoomFactor:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=In(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(de,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:p.map(qn)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(ge,{disabled:n,value:s,onValueChange:c,children:[u,d]}),t[12]=n,t[13]=s,t[14]=c,t[15]=u,t[16]=f):f=t[16];let m;return t[17]!==o||t[18]!==f?(m=(0,Q.jsx)(X,{...a,description:`Page zoom applied to new browser tabs.`,resetAction:o,control:f}),t[17]=o,t[18]=f,t[19]=m):m=t[19],m}function qn(e){return(0,Q.jsx)(K,{hideIndicator:!0,value:String(e),children:In(e)},e)}function Jn(e){return e.browserDefaultZoomFactor}function Yn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=Y(Zn),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Et(`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)(dt,{label:`default browser appearance`,onClick:()=>i({browserDefaultAppearance:v})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`light`||e===`dark`)&&i({browserDefaultAppearance:e})},t[5]=i,t[6]=s);let c=Fn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(de,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(Fn).map(Xn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(ge,{disabled:n,value:r,onValueChange:s,children:[l,u]}),t[10]=r,t[11]=n,t[12]=s,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`The color scheme pages are told to prefer. System follows your OS setting.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function Xn(e){let[t,n]=e;return(0,Q.jsx)(K,{hideIndicator:!0,value:t,children:n},t)}function Zn(e){return e.browserDefaultAppearance}function Qn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=Y(er),i=Y($n),a=J(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=Et(`browser-recording-key-presses`),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=e=>a({browserRecordingShowKeyPresses:!!e}),t[1]=a,t[2]=s);let c;t[3]!==n||t[4]!==r||t[5]!==s?(c=(0,Q.jsx)(X,{...o,description:`Show pressed keys and shortcuts in new recordings. Password fields are excluded.`,control:(0,Q.jsx)(Ct,{disabled:n,checked:r,"aria-label":`Show key presses in recordings`,onCheckedChange:s})}),t[3]=n,t[4]=r,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=Et(`browser-recording-mouse-presses`),t[7]=l):l=t[7];let u;t[8]===a?u=t[9]:(u=e=>a({browserRecordingShowMousePresses:!!e}),t[8]=a,t[9]=u);let d;t[10]!==n||t[11]!==i||t[12]!==u?(d=(0,Q.jsx)(X,{...l,description:`Highlight mouse presses and held buttons in new recordings.`,control:(0,Q.jsx)(Ct,{disabled:n,checked:i,"aria-label":`Show mouse presses in recordings`,onCheckedChange:u})}),t[10]=n,t[11]=i,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function $n(e){return e.browserRecordingShowMousePresses}function er(e){return e.browserRecordingShowKeyPresses}function tr(e){let t=(0,Z.c)(18),{disabled:n}=e,r=Y(rr),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Et(`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)(dt,{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=re.find(t=>String(t)===e);t!==void 0&&i({browserRecordingFrameRate:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(de,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:re.map(nr)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(ge,{disabled:n,value:s,onValueChange:c,children:[l,u]}),t[10]=n,t[11]=s,t[12]=c,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`Maximum recording rate. 30 fps saves CPU and storage; 60 fps is smoother.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function nr(e){return(0,Q.jsxs)(K,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function rr(e){return e.browserRecordingFrameRate}var ir={system:`Your default browser`,app:`P4 Code`};function ar(e){let t=(0,Z.c)(19),{disabled:n}=e,r=Y(sr),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Et(`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)(dt,{label:`link target`,onClick:()=>i({browserLinkTarget:x})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`app`)&&i({browserLinkTarget:e})},t[5]=i,t[6]=s);let c=ir[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(de,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(ir),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:u.map(or)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(ge,{disabled:n,value:r,onValueChange:s,children:[l,d]}),t[11]=n,t[12]=r,t[13]=s,t[14]=l,t[15]=f):f=t[15];let p;return t[16]!==o||t[17]!==f?(p=(0,Q.jsx)(X,{...a,description:`Where links in the chat and terminal open. Hold ⌘ or Ctrl while clicking a link to open it in your default browser either way.`,resetAction:o,control:f}),t[16]=o,t[17]=f,t[18]=p):p=t[18],p}function or(e){return(0,Q.jsx)(K,{hideIndicator:!0,value:e,children:ir[e]},e)}function sr(e){return e.browserLinkTarget}var cr={duckduckgo:`DuckDuckGo`,google:`Google`,bing:`Bing`,brave:`Brave Search`,kagi:`Kagi`,ecosia:`Ecosia`,custom:`Custom`};function lr(){let e=(0,Z.c)(24),t=Y(fr),n=Y(dr),r=J(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Et(`browser-search-engine`),e[0]=i):i=e[0];let a;e[1]!==n||e[2]!==t||e[3]!==r?(a=t!==`duckduckgo`||n!==``?(0,Q.jsx)(dt,{label:`search engine`,onClick:()=>r({browserSearchEngine:l,browserCustomSearchUrl:``})}):null,e[1]=n,e[2]=t,e[3]=r,e[4]=a):a=e[4];let o;e[5]===r?o=e[6]:(o=e=>{let t=L.literals.find(t=>t===e);t!==void 0&&r({browserSearchEngine:t})},e[5]=r,e[6]=o);let s=cr[t],c;e[7]===s?c=e[8]:(c=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Search engine`,children:(0,Q.jsx)(de,{children:s})}),e[7]=s,e[8]=c);let u;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:L.literals.map(ur)}),e[9]=u):u=e[9];let d;e[10]!==t||e[11]!==o||e[12]!==c?(d=(0,Q.jsxs)(ge,{value:t,onValueChange:o,children:[c,u]}),e[10]=t,e[11]=o,e[12]=c,e[13]=d):d=e[13];let f;e[14]!==a||e[15]!==d?(f=(0,Q.jsx)(X,{...i,description:`What the address bar searches when you type something that isn't a URL.`,resetAction:a,control:d}),e[14]=a,e[15]=d,e[16]=f):f=e[16];let p;e[17]!==n||e[18]!==t||e[19]!==r?(p=t===`custom`?(0,Q.jsx)(X,{title:`Custom search URL`,description:`Use %s where the search terms go.`,status:tt(n)?void 0:`Enter an http or https URL containing %s. Searches use DuckDuckGo until then.`,control:(0,Q.jsx)(Ot,{nativeInput:!0,size:`sm`,className:`w-full sm:w-64`,"aria-label":`Custom search URL`,placeholder:`https://example.com/search?q=%s`,autoCapitalize:`none`,spellCheck:!1,maxLength:F,value:n,onCommit:e=>r({browserCustomSearchUrl:e.trim()})})}):null,e[17]=n,e[18]=t,e[19]=r,e[20]=p):p=e[20];let m;return e[21]!==f||e[22]!==p?(m=(0,Q.jsxs)(Q.Fragment,{children:[f,p]}),e[21]=f,e[22]=p,e[23]=m):m=e[23],m}function ur(e){return(0,Q.jsx)(K,{hideIndicator:!0,value:e,children:cr[e]},e)}function dr(e){return e.browserCustomSearchUrl}function fr(e){return e.browserSearchEngine}function pr(){let e=(0,Z.c)(12),t=Y(mr),n=J(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Et(`pull-request-links-open-in-app`),e[0]=r):r=e[0];let i;e[1]!==t||e[2]!==n?(i=t?null:(0,Q.jsx)(dt,{label:`open pull requests in P4 Code`,onClick:()=>n({pullRequestLinksOpenInApp:!0})}),e[1]=t,e[2]=n,e[3]=i):i=e[3];let a;e[4]===n?a=e[5]:(a=e=>n({pullRequestLinksOpenInApp:!!e}),e[4]=n,e[5]=a);let o;e[6]!==t||e[7]!==a?(o=(0,Q.jsx)(Ct,{checked:t,onCheckedChange:a,"aria-label":`Open pull requests in P4 Code`}),e[6]=t,e[7]=a,e[8]=o):o=e[8];let s;return e[9]!==i||e[10]!==o?(s=(0,Q.jsx)(X,{...r,description:`Clicking a pull request link opens it in P4 Code. Turn off to open pull request links like any other link, on GitHub or your git host.`,resetAction:i,control:o}),e[9]=i,e[10]=o,e[11]=s):s=e[11],s}function mr(e){return e.pullRequestLinksOpenInApp}function hr(){let e=(0,Z.c)(7),{search:t,environment:n}=ct(),r=ot(),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)(ft,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(gr,{environmentId:i,enabled:r.enableDeviceSupport,agentAccessEnabled:r.enableAgentDeviceAccess},o)}),e[2]=i,e[3]=r.enableAgentDeviceAccess,e[4]=r.enableDeviceSupport,e[5]=o,e[6]=s):s=e[6],s}function gr({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=Te(e,s),{state:i,loaded:a}=He(e),{scope:o,environments:c,connectedEnvironments:l}=ct(),u=st(),d=o.kind===`project`||o.kind===`checkout`,f=l.some(e=>e.serverConfig?.settings.enableDeviceSupport),p=Oe(Ue.configure,{reportFailure:!1}),m=Oe(Ue.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&&Ee(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(!Ee(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&&q.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,T=e=>{let t=w?.[e];return i.supportsToolUpdate&&t?!t.installedVersions.includes(t.requiredVersion):!1},E=(t,n=!1)=>{e&&(C(null),g(`update-${t}`),m({environmentId:e,input:{updateTool:t}}).then(e=>{if(e._tag===`Failure`){let r=De(e.cause);C({tool:t,message:r}),n&&q.add({type:`error`,title:r})}}).finally(()=>g(null)))},D=t=>{e&&(g(t),m({environmentId:e,input:{inspectOnly:!0}}).finally(()=>g(null)))},O=t=>{let n=T(t);if(!n&&!i.supportsToolInspection)return null;let r=h===`update-${t}`||h===`check-${t}`,a=n?`Update to v${w?.[t].requiredVersion}`:`Check ${t===`hub`?`device hub`:`agent device`} version`;return(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ae,{render:(0,Q.jsx)(P,{size:`icon-xs`,variant:`ghost-muted`,disabled:!e||h!==null||_,"aria-label":a,onClick:()=>n?E(t,!0):D(`check-${t}`)}),children:(0,Q.jsxs)(`span`,{className:`grid *:col-start-1 *:row-start-1 *:transition-[opacity,scale] *:duration-150 *:ease-out motion-reduce:*:transition-none`,children:[(0,Q.jsx)(`span`,{className:n&&!r?void 0:`scale-75 opacity-0`,children:(0,Q.jsx)(z,{"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:n&&!r?`scale-75 opacity-0`:void 0,children:(0,Q.jsx)(Tt,{refreshing:r})})]})}),(0,Q.jsx)(je,{side:`top`,children:a})]})},k=t=>{let n=w?.[t];return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&T(t)?(0,Q.jsx)(P,{size:`sm`,disabled:!e||h!==null||_,onClick:()=>E(t),children:h===`update-${t}`?`Updating…`:`Update to v${n.requiredVersion}`}):null,i.supportsToolInspection?(0,Q.jsx)(P,{size:`sm`,variant:`outline`,disabled:!e||h!==null||_,onClick:()=>D(`check`),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)(X,{...Et(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:Je,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pt,{action:k(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),O(`hub`),h===`hub`?(0,Q.jsx)(qe,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(kt,{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)(Ze,{children:y?(0,Q.jsx)(X,{...Et(`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)(Ge,{compact:!0,platform:`iOS`,status:Ke(i,`ios`)}),(0,Q.jsx)(Ge,{compact:!0,platform:`Android`,status:Ke(i,`android`)})]}),control:(0,Q.jsx)(P,{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)(X,{...Et(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:We,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pt,{action:k(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),O(`agent`),h===`agent`?(0,Q.jsx)(Ye,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(kt,{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)(Xe,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(qt,{environmentId:e}),i.supportsEasHosts?(0,Q.jsx)(an,{environmentId:e}):null]})}function _r(e){let t=(0,Z.c)(14),{disabled:n}=e,r=Y(vr),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Et(`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)(dt,{label:`auto-show floating preview`,onClick:()=>i({browserAutoShowFloatingPreview:!0})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>i({browserAutoShowFloatingPreview:!!e}),t[5]=i,t[6]=s);let c;t[7]!==r||t[8]!==n||t[9]!==s?(c=(0,Q.jsx)(Ct,{disabled:n,checked:r,onCheckedChange:s,"aria-label":`Auto-show floating preview`}),t[7]=r,t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==o||t[12]!==c?(l=(0,Q.jsx)(X,{...a,description:`Show the floating preview when an agent opens a browser or device unless the agent says otherwise.`,resetAction:o,control:c}),t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function vr(e){return e.browserAutoShowFloatingPreview}function yr({disabled:e}){let t=Y(e=>e.browserProfiles),n=Y(e=>e.browserDefaultProfileId),r=be(),i=J(),{environments:a,isReady:o}=ye(),s=ve(),[l,u]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[_,v]=(0,$.useState)(null),[b,x]=(0,$.useState)(null),[S,C]=(0,$.useState)(null),[w,k]=(0,$.useState)(!1),j=le(),M=Oe(et.clearProfile,{reportFailure:!1}),F={environmentIds:a.map(e=>e.environmentId).filter(e=>j.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await M({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw ce(n)}},I=Mn(mt!==null,o,a.length,F.environmentIds.length),L=(0,$.useRef)(!1),[R,z]=(0,$.useState)(!1),B=e||!r,ee=T(t).filter(e=>e.kind!==`incognito`),te=m(ee,n)?.id??`default`,re=e=>{if(!r||L.current)return;let t=Ce().browserProfiles;if(t.length>=24)return;let n=T(t),a=new Set(n.map(e=>e.name)),o=e;for(let t=2;a.has(o);t+=1)o=`${e} ${t}`;let s={id:`profile-${ne()}`,name:o,kind:`persistent`};return i({browserProfiles:[...t,s]}),s},ie=(e,t)=>{if(!r||L.current)return;let n=t.trim().slice(0,48);if(n===``)return;let a=Ce().browserProfiles;i({browserProfiles:a.map(t=>t.id===e?{...t,name:n}:t)})},ae=(e,t)=>{if(r&&!L.current){if(!I){q.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`});return}jn(mt,a.map(e=>e.environmentId),e,F).then(()=>{q.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{q.add({type:`error`,title:`Could not clear ${t}'s data`})})}},U=async e=>{if(!r||L.current)return;if(!I){C(`Connect to an environment before removing this profile.`);return}C(null),k(!0);try{await jn(mt,o?a.map(e=>e.environmentId):[],e,F)}catch{C(`Profile data could not be deleted. Try again.`),k(!1);return}let t=Ce();i({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:g}:{}}),k(!1),v(null)},se=(l??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),W=(0,$.useCallback)(()=>{mt&&mt.listBrowserImportSources().then(u).catch(()=>u(e=>e??[]))},[]),ue=async(e,t,n)=>{if(!mt||!r)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!T(Ce().browserProfiles).some(e=>e.id===n.target.profileId)||L.current)return{kind:`blocked`,reason:`readFailed`};L.current=!0,z(!0);try{let r=await mt.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!T(Ce().browserProfiles).some(e=>e.id===n.target.profileId))return{kind:`blocked`,reason:`readFailed`};let i;if(n.target.kind===`new`){if(r.imported>0)try{i=(await xe(t=>{if(t.browserProfiles.find(e=>e.id===n.target.profileId))return t;if(t.browserProfiles.length>=24)throw new Ln;let r=new Set(T(t.browserProfiles).map(e=>e.name)),i=e.name;for(let t=2;r.has(i);t+=1)i=`${e.name} ${t}`;return{...t,browserProfiles:[...t.browserProfiles,{id:n.target.profileId,name:i,kind:`persistent`}]}})).browserProfiles.find(e=>e.id===n.target.profileId)?.name??e.name}catch(r){await jn(mt,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof Ln?`profileLimitReached`:`profileNotSaved`;throw Error(`Importing cookies from ${e.id} failed: ${i}.`,{cause:r})}else i=e.name}else i=n.target.name;return{kind:`imported`,imported:r.imported,skipped:r.skipped,skippedDomains:r.skippedDomains,targetName:i}}catch(e){return{kind:`blocked`,reason:Rn(e)}}finally{L.current=!1,z(!1)}},G=async e=>{if(mt)try{let t=await mt.listBrowserImportSources();return u(t),t.find(t=>t.id===e)}catch{return}},K=t.length>=24;return(0,Q.jsxs)(X,{...Et(`browser-profiles`),description:`Profiles separate cookies and logins. Incognito data is cleared when the app closes.`,control:(0,Q.jsxs)(D,{onOpenChange:e=>e&&W(),children:[(0,Q.jsxs)(oe,{render:(0,Q.jsx)(P,{size:`sm`,variant:`outline`,disabled:B||R}),children:[(0,Q.jsx)(O,{}),`Add profile`]}),(0,Q.jsxs)(H,{align:`end`,children:[(0,Q.jsx)(c,{disabled:!r||K,onClick:()=>re(`New profile`),children:`Blank profile`}),K?(0,Q.jsx)(c,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(N,{}),(0,Q.jsxs)(A,{children:[(0,Q.jsx)(y,{children:`Import from`}),l===null?(0,Q.jsx)(c,{disabled:!0,children:`Looking for browsers…`}):se.length===0?(0,Q.jsx)(c,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[se.map(e=>(0,Q.jsx)(c,{disabled:!r||s==null,onClick:()=>{r&&s!=null&&p({source:e,environmentId:s.environmentId,environmentName:pt({isPrimary:!0,environmentId:s.environmentId,runtimeLabel:s.label})})},children:e.name},e.id)),s==null?(0,Q.jsx)(c,{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:ee.map((e,t)=>{let n=E(e.id),a=e.id===te;return(0,Q.jsxs)(`div`,{className:V(`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:V(`truncate text-sm text-foreground`,B&&`opacity-64`),children:e.name}):(0,Q.jsx)(Ot,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:B||R,maxLength:48,value:e.name,onCommit:t=>ie(e.id,t)}),a?(0,Q.jsx)(`span`,{className:V(`flex`,B&&`opacity-64`),children:(0,Q.jsx)(h,{children:`Default`})}):null]}),(0,Q.jsxs)(D,{children:[(0,Q.jsx)(oe,{render:(0,Q.jsx)(P,{size:`icon-xs`,variant:`ghost-muted`,disabled:B||R,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(d,{})}),(0,Q.jsxs)(H,{align:`end`,children:[(0,Q.jsx)(c,{disabled:!r||a,onClick:()=>{r&&i({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(c,{disabled:!r||!I,onClick:()=>{F.environmentIds.length>0?x(e):ae(e.id,e.name)},children:`Clear cookies and cache`}),n?null:(0,Q.jsx)(c,{variant:`destructive`,disabled:!r||!I,onClick:()=>{r&&v(e)},children:`Remove profile and data`}),I?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{}),(0,Q.jsx)(c,{disabled:!0,children:o?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(ht,{open:_!==null,onOpenChange:e=>{!e&&!w&&(v(null),C(null))},children:(0,Q.jsxs)(bt,{children:[(0,Q.jsxs)(xt,{children:[(0,Q.jsxs)(St,{children:[`Remove “`,_?.name,`”?`]}),(0,Q.jsx)(wt,{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.`}),S?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:S}):null,I?null:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect to an environment to remove this profile and its data.`})]}),(0,Q.jsxs)(gt,{children:[(0,Q.jsx)(_t,{disabled:w,render:(0,Q.jsx)(P,{variant:`outline`,disabled:w}),children:`Cancel`}),(0,Q.jsx)(P,{variant:`destructive`,disabled:w||!r||!I,onClick:()=>{_&&r&&I&&U(_.id)},children:w?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(ht,{open:b!==null,onOpenChange:e=>{e||x(null)},children:(0,Q.jsxs)(bt,{children:[(0,Q.jsxs)(xt,{children:[(0,Q.jsxs)(St,{children:[`Clear “`,b?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(wt,{children:`You are signed out of its sites. Server browser tabs open in this profile close now.`})]}),(0,Q.jsxs)(gt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(P,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(P,{variant:`destructive`,onClick:()=>{b&&ae(b.id,b.name),x(null)},children:`Clear data`})]})]})}),f?(0,Q.jsx)(vn,{source:f.source,destinationEnvironmentName:f.environmentName,targetProfiles:ee.map(e=>({id:e.id,name:e.name})),canCreateProfile:r&&!K,onImport:e=>ue(f.source,f.environmentId,e),onRefreshSource:()=>G(f.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await Se()?.shell.openSystemSettings(`full-disk-access`).catch(()=>{q.add({type:`error`,title:`Could not open System Settings`,description:`Open Privacy & Security → Full Disk Access manually.`})})},onClose:()=>p(null)}):null]})}function br(){let e=(0,Z.c)(3),t=!ke,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(yr,{disabled:t}),(0,Q.jsx)(Un,{disabled:t}),(0,Q.jsx)(Kn,{disabled:t}),(0,Q.jsx)(Yn,{disabled:t}),(0,Q.jsx)(tr,{disabled:t}),(0,Q.jsx)(Qn,{disabled:t}),(0,Q.jsx)(ar,{disabled:t}),(0,Q.jsx)(_r,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Dt,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(ut,{children:[i,(0,Q.jsxs)(ft,{id:`browser`,title:`Browser`,children:[t?(0,Q.jsx)(lt,{message:`Only available in the desktop app.`,children:r}):r,(0,Q.jsx)(lr,{}),(0,Q.jsx)(pr,{})]}),(0,Q.jsx)(hr,{})]}),e[2]=a):a=e[2],a}var xr=br;export{xr as component};
|
|
2
|
-
//# sourceMappingURL=settings.integrations-
|
|
1
|
+
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{t as i}from"./cloud-Cnpuf424.js";import{t as a}from"./plus-BFikiw2m.js";import{t as o}from"./x-CJgPyqpa.js";import{$_ as s,$n as c,Ch as l,Cp as u,Ep as d,Ey as f,Fg as p,Jg as m,Jn as h,Kg as g,Ng as _,Og as v,Qn as y,Qw as b,Sh as x,Sp as S,Ty as C,Vf as w,Xg as T,Yg as E,Yn as D,Yp as O,Yw as k,Zn as A,aE as j,al as M,ar as N,dr as P,fh as F,fr as I,hh as L,id as R,if as z,il as B,kd as ee,kg as te,l as ne,ph as re,rh as ie,sd as ae,t as V,tr as H,ur as oe,wh as U,xb as se}from"./utils-CBe1bHL7.js";import{W as ce}from"./runtime-CABaKt1A.js";import{T as le}from"./entities-pafv-XUM.js";import{a as W,r as ue,t as G}from"./number-field-qEfih146.js";import{a as K,c as de,i as fe,o as pe,r as me,s as he,t as ge}from"./select-Cbpdz6n3.js";import{t as _e}from"./spinner-BZh9P0sD.js";import{i as q}from"./toast-D26NINYU.js";import{E as ve,T as ye,b as J,c as be,o as xe,q as Se,r as Ce,s as Y}from"./useSettings-CHt2_4He.js";import{f as we}from"./server-mIR8e8Vz.js";import{i as Te,n as Ee}from"./session-BlCBDyVn.js";import{t as De}from"./query-B3Zo1YOE.js";import{t as Oe}from"./use-atom-command-C4y634Qy.js";import{t as ke}from"./env-wK1YYxA8.js";import{a as Ae,n as je,t as Me}from"./tooltip-ChmjT8Ns.js";import{t as Ne}from"./input-DXGWoa4O.js";import{a as Pe,c as Fe,i as Ie,n as Le,o as Re,r as ze,s as Be,t as Ve}from"./dialog-_vbB7RKH.js";import{i as He,t as Ue}from"./device-BNK9g-io.js";import{a as We,i as Ge,l as Ke,n as qe,o as Je,t as Ye,u as Xe}from"./DeviceSetup-C7hesHao.js";import{t as Ze}from"./AnimatedHeight-BZhIfVtA.js";import{i as Qe,n as $e}from"./Icons-B1qw9fnR.js";import{t as et}from"./preview-BoTHkmVi.js";import{n as tt}from"./preview-O1ZL8Awg.js";import{a as nt,i as rt,o as it,t as at}from"./popover-CogH2zM4.js";import{F as ot,R as st,V as ct,a as X,c as lt,i as ut,r as dt,s as ft,w as pt}from"./settingsLayout-vgYGia0Q.js";import{Ba as mt,Gr as ht,Jr as gt,Kr as _t,Ma as vt,Na as yt,Xr as bt,Yr as xt,Zr as St,do as Ct,qr as wt,xo as Tt,yr as Et}from"./main-Cywp3EWc.js";import{t as Dt}from"./ProjectDefaultsSettings-CqigWqDQ.js";import{t as Ot}from"./draft-input-C-u_3cDw.js";import{t as kt}from"./ScopedSwitch-DPPAQKgb.js";import{t as At}from"./SecretInput-Dg6ZsU9p.js";import{n as jt,r as Mt,t as Nt}from"./usePermissionStatus-CKmeNk61.js";var Z=n(),Q=e(r(),1);function Pt(e){let t=(0,Z.c)(27),{tools:n,action:r,kind:i,owner:a,error:o}=e,s=i?n?.[i]:void 0,c;t[0]===s?c=t[1]:(c=s?.runningVersion??(s?.installedVersions.includes(s.requiredVersion)?s.requiredVersion:s?.installedVersions.toSorted(Ft).at(-1)),t[0]=s,t[1]=c);let l=c,u=i===`hub`?`Device hub`:`Agent device`,d=i?`${u}: ${l?`version ${l}`:s?`not installed`:`version unknown`}. Show details`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(I,{tone:`muted`}),t[2]=f):f=t[2];let p=i?l?`v${l}`:s?`Not installed`:`Version unknown`:o?`Versions unavailable`:`Versions`,m;t[3]!==d||t[4]!==p?(m=(0,Q.jsx)(it,{"aria-label":d,render:f,children:p}),t[3]=d,t[4]=p,t[5]=m):m=t[5];let h=i?u:`Device tools`,g;t[6]===h?g=t[7]:(g=(0,Q.jsx)(nt,{children:h}),t[6]=h,t[7]=g);let _;t[8]!==i||t[9]!==u||t[10]!==n?(_=n?(0,Q.jsx)(`div`,{className:`mt-4 divide-y divide-border/50`,children:[[`Device hub`,n.hub],[`Agent device`,n.agent]].filter(e=>{let[t]=e;return!i||t===u}).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`space-y-2 py-3 first:pt-0 last:pb-0`,children:[i?null:(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:t}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Running`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.runningVersion??`Not running`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Required`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.requiredVersion}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Installed`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono break-words`,children:n.installedVersions.join(`, `)||`None`})]})]},t)})}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Versions have not been checked.`}),t[8]=i,t[9]=u,t[10]=n,t[11]=_):_=t[11];let 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)(rt,{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)(at,{children:[m,S]}),t[24]=S,t[25]=m,t[26]=C):C=t[26],C}function Ft(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function It(e,t,n,r=t){let i=(e,t)=>e.target===t.target&&e.port===t.port&&e.identityFile===t.identityFile,a=t=>{let n=e.filter(e=>i(e,t));if(n.length>1)throw Error(`Multiple hosts match this SSH destination. Select the environment to edit its hosts.`);return n[0]},o=e.find(e=>e.id===r.id)??a(r)??(n?void 0:a(t));return n?e.filter(e=>e.id!==o?.id):o?e.map(e=>e.id===o.id?{...t,id:o.id}:e):[...e,t]}function Lt(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Rt),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:r}),t[2]=r,t[3]=i),i}function Rt(e){return(0,Q.jsxs)(Me,{children:[(0,Q.jsxs)(Ae,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(ee,{className:`size-3`}):(0,Q.jsx)(S,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(je,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var zt=se(f);function Bt(e){let{identityFile:t,...n}=e;return zt({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function Vt(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function Ht(e,t,n,r){await Promise.all(e.map(async e=>{r(e.environmentId,{status:`pending`});try{if(!e.connected)throw Error(`Environment disconnected`);let i=await n(e.environmentId,t);r(e.environmentId,i.kind===`local`?{status:`local`}:{status:`connected`,platforms:i.platforms,...i.tools?{tools:i.tools}:{}})}catch(t){r(e.environmentId,{status:`failed`,error:t instanceof Error?t.message:String(t)})}}))}function Ut(e){let t=Oe(Ue.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=Vt(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await Ht(e,n,async(e,n)=>{if(!Ee(e,`settings:write`))throw Error(`This connection cannot test device hosts.`);let r=await t({environmentId:e,input:n});if(r._tag===`Failure`)throw Error(k(r.cause));return r.value},(e,t)=>{o[e]=t,r(n=>({...n,[a]:{...n[a],[e]:t}}))}),o}finally{i.current.delete(a)}}}}function Wt(e){let t=(0,Z.c)(107),{host:n,isNew:r,targets:i,busy:a,onSave:o,onClose:s}=e,[c,l]=(0,$.useState)(n),{checks:d,testConnection:f}=Ut(i),p=d[Vt(c)],m=Object.values(p??{}).some(Kt),h,g;t[0]===c?(h=t[1],g=t[2]):(h=Bt({...c,label:c.label.trim()||c.target}),g=j(h),t[0]=c,t[1]=h,t[2]=g);let _=g,v;t[3]===p?v=t[4]:(v=Object.values(p??{}).filter(Gt),t[3]=p,t[4]=v);let y=v.length,b;t[5]!==a||t[6]!==s?(b=e=>{!e&&!a&&s()},t[5]=a,t[6]=s,t[7]=b):b=t[7];let x=!a,S;t[8]!==a||t[9]!==m||t[10]!==c.label||t[11]!==h||t[12]!==o?(S=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),j(h)&&c.label.trim()&&!a&&!m&&o(h.value)}}),t[8]=a,t[9]=m,t[10]=c.label,t[11]=h,t[12]=o,t[13]=S):S=t[13];let C=r?`Add device host`:`Edit device host`,w;t[14]===C?w=t[15]:(w=(0,Q.jsx)(Fe,{children:C}),t[14]=C,t[15]=w);let T=i.length===1?`Connect from ${i[0]?.label}.`:`Connect from ${i.length} selected environments.`,E;t[16]===T?E=t[17]:(E=(0,Q.jsxs)(ze,{children:[T,` `,`Hosts on the same machine are skipped.`]}),t[16]=T,t[17]=E);let D;t[18]!==w||t[19]!==E?(D=(0,Q.jsxs)(Pe,{children:[w,E]}),t[18]=w,t[19]=E,t[20]=D):D=t[20];let O;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(`span`,{children:`Name`}),t[21]=O):O=t[21];let k;t[22]===c?k=t[23]:(k=e=>l({...c,label:e.target.value}),t[22]=c,t[23]=k);let A;t[24]!==a||t[25]!==c.label||t[26]!==k?(A=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[O,(0,Q.jsx)(Ne,{autoFocus:!0,required:!0,value:c.label,disabled:a,onChange:k,placeholder:`Mac mini`})]}),t[24]=a,t[25]=c.label,t[26]=k,t[27]=A):A=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]===c?N=t[30]:(N=e=>l({...c,target:e.target.value}),t[29]=c,t[30]=N);let F;t[31]!==a||t[32]!==c.target||t[33]!==N?(F=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[M,(0,Q.jsx)(Ne,{required:!0,value:c.target,disabled:a,onChange:N,placeholder:`user@host or SSH alias`})]}),t[31]=a,t[32]=c.target,t[33]=N,t[34]=F):F=t[34];let I=n.port!==void 0||n.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 z=c.identityFile??``,B;t[37]===c?B=t[38]:(B=e=>{let{identityFile:t,...n}=c;l(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=c,t[38]=B);let te;t[39]!==a||t[40]!==z||t[41]!==B?(te=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[R,(0,Q.jsx)(Ne,{value:z,disabled:a,onChange:B,placeholder:`SSH config default`})]}),t[39]=a,t[40]=z,t[41]=B,t[42]=te):te=t[42];let ne;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=ne):ne=t[43];let re=c.port??``,ae;t[44]===c?ae=t[45]:(ae=e=>{let{port:t,...n}=c;l(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=c,t[45]=ae);let V;t[46]!==a||t[47]!==re||t[48]!==ae?(V=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[ne,(0,Q.jsx)(Ne,{type:`number`,min:1,max:65535,value:re,disabled:a,onChange:ae,placeholder:`Default`})]}),t[46]=a,t[47]=re,t[48]=ae,t[49]=V):V=t[49];let H;t[50]!==te||t[51]!==V?(H=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[te,V]}),t[50]=te,t[51]=V,t[52]=H):H=t[52];let oe;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=oe):oe=t[53];let U;t[54]!==I||t[55]!==H?(U=(0,Q.jsxs)(`details`,{open:I,className:`text-sm`,children:[L,H,oe]}),t[54]=I,t[55]=H,t[56]=U):U=t[56];let se=m?`Checking environments…`:p?y?`${y} of ${i.length} failed`:`Connection checks passed`:`Check access before saving`,ce;t[57]===se?ce=t[58]:(ce=(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:se}),t[57]=se,t[58]=ce);let le=a||m||!_,W;t[59]!==h||t[60]!==f?(W=()=>{j(h)&&f(h.value)},t[59]=h,t[60]=f,t[61]=W):W=t[61];let ue;t[62]===m?ue=t[63]:(ue=m?(0,Q.jsx)(_e,{size:`xs`}):null,t[62]=m,t[63]=ue);let G;t[64]!==le||t[65]!==W||t[66]!==ue?(G=(0,Q.jsxs)(P,{type:`button`,size:`sm`,variant:`outline`,disabled:le,onClick:W,children:[ue,` Test connection`]}),t[64]=le,t[65]=W,t[66]=ue,t[67]=G):G=t[67];let K;t[68]!==ce||t[69]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[ce,G]}),t[68]=ce,t[69]=G,t[70]=K):K=t[70];let de;t[71]!==p||t[72]!==i?(de=p?(0,Q.jsx)(`ul`,{className:`border-t border-border/60 divide-y divide-border/40`,children:i.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)(_e,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(u,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ie,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ee,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(Lt,{platforms:t.platforms})}):null,t.status===`failed`?(0,Q.jsxs)(`details`,{className:`mt-1.5 text-muted-foreground`,children:[(0,Q.jsx)(`summary`,{className:`cursor-pointer`,children:`Show error`}),(0,Q.jsx)(`p`,{className:`mt-1 max-h-32 overflow-auto whitespace-pre-wrap break-words`,children:t.error})]}):null]},e.environmentId):null})}):null,t[71]=p,t[72]=i,t[73]=de):de=t[73];let fe;t[74]!==K||t[75]!==de?(fe=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-border/60`,children:[K,de]}),t[74]=K,t[75]=de,t[76]=fe):fe=t[76];let pe;t[77]!==A||t[78]!==F||t[79]!==U||t[80]!==fe?(pe=(0,Q.jsxs)(Re,{children:[A,F,U,fe]}),t[77]=A,t[78]=F,t[79]=U,t[80]=fe,t[81]=pe):pe=t[81];let me;t[82]!==a||t[83]!==s?(me=(0,Q.jsx)(P,{type:`button`,variant:`ghost`,disabled:a,onClick:s,children:`Cancel`}),t[82]=a,t[83]=s,t[84]=me):me=t[84];let he;t[85]!==a||t[86]!==m||t[87]!==c.label||t[88]!==_?(he=a||m||!_||!c.label.trim(),t[85]=a,t[86]=m,t[87]=c.label,t[88]=_,t[89]=he):he=t[89];let ge;t[90]===a?ge=t[91]:(ge=a?(0,Q.jsx)(_e,{size:`xs`}):null,t[90]=a,t[91]=ge);let q;t[92]!==he||t[93]!==ge?(q=(0,Q.jsxs)(P,{type:`submit`,disabled:he,children:[ge,` Save host`]}),t[92]=he,t[93]=ge,t[94]=q):q=t[94];let ve;t[95]!==me||t[96]!==q?(ve=(0,Q.jsxs)(Ie,{children:[me,q]}),t[95]=me,t[96]=q,t[97]=ve):ve=t[97];let ye;t[98]!==D||t[99]!==pe||t[100]!==x||t[101]!==ve||t[102]!==S?(ye=(0,Q.jsxs)(Be,{showCloseButton:x,render:S,children:[D,pe,ve]}),t[98]=D,t[99]=pe,t[100]=x,t[101]=ve,t[102]=S,t[103]=ye):ye=t[103];let J;return t[104]!==b||t[105]!==ye?(J=(0,Q.jsx)(Ve,{open:!0,onOpenChange:b,children:ye}),t[104]=b,t[105]=ye,t[106]=J):J=t[106],J}function Gt(e){return e.status===`failed`}function Kt(e){return e.status===`pending`}function qt(e){let{scope:t,environments:n,connectedEnvironments:r}=ct(),i=Te(e.environmentId,s),a=t.kind===`project`||t.kind===`checkout`,o=Oe(we.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}=Ut(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(!Ee(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return o({environmentId:e.environmentId,input:{patch:{deviceHosts:It(e.serverConfig.settings.deviceHosts,t,r,i)}}})})),a=n.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});a.length===0?l(null):q.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)(X,{id:`device-hosts`,title:`Device hosts`,serverScoped:!0,settingKeys:[`deviceHosts`],description:`Add remote machines with simulator or emulator runtimes installed, and the selected environments will connect over SSH and set up device tools automatically.`,control:(0,Q.jsxs)(P,{size:`sm`,variant:`outline`,disabled:!i||a||f||!e.environmentId||c!==null,onClick:()=>{d(null),l({kind:`ssh`,id:ne(),label:``,target:``})},children:[(0,Q.jsx)(O,{className:`size-3.5`}),` Add host`]}),children:(0,Q.jsx)(`div`,{className:`pt-3 pb-2`,children:e.environmentId?(0,Q.jsxs)(Q.Fragment,{children:[r.map(e=>(0,Q.jsxs)(`div`,{children:[r.length>1?(0,Q.jsx)(`p`,{className:`pt-3 pb-1 text-xs font-medium text-muted-foreground`,children:e.label}):null,(0,Q.jsx)(Jt,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!i||a||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 q.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)(Wt,{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 Jt(e){let t=(0,Z.c)(28),{environmentLabel:n,environmentId:r,hosts:i,busy:a,onEdit:o,onRemove:s,checks:l,testConnection:u}=e,{state:f}=He(r),p=Oe(Ue.list),[m,h]=(0,$.useState)(null),g;t[0]===i.length?g=t[1]:(g=i.length===0?(0,Q.jsx)(`p`,{className:`py-2 text-sm text-muted-foreground`,children:`No device hosts.`}):null,t[0]=i.length,t[1]=g);let _;if(t[2]!==a||t[3]!==l||t[4]!==r||t[5]!==n||t[6]!==i||t[7]!==o||t[8]!==s||t[9]!==p||t[10]!==m||t[11]!==f||t[12]!==u){let e;t[14]!==a||t[15]!==l||t[16]!==r||t[17]!==n||t[18]!==o||t[19]!==s||t[20]!==p||t[21]!==m||t[22]!==f||t[23]!==u?(e=e=>{let t=f.hostStatuses[e.id],i=l[Vt(e)]?.[r],g=(i?.status===`connected`?i.platforms:void 0)??f.hosts.find(t=>t.id===e.id)?.platforms??[],_=i?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,v=i?.status===`failed`?i.error:i?.status===`local`?void 0:t?.status===`failed`?t.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/50 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label}),g.filter(Xt).map(Yt)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(Pt,{owner:n,error:f.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:f.hosts.find(t=>t.id===e.id)?.tools??(i?.status===`connected`?i.tools:void 0)}),i?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,v?(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:v})]})}):null]}),_?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(_e,{size:`xs`}),_]}):null,(0,Q.jsxs)(D,{children:[(0,Q.jsx)(oe,{render:(0,Q.jsx)(P,{size:`icon-sm`,variant:`ghost-muted`,disabled:a,"aria-label":e.label+` options`}),children:(0,Q.jsx)(d,{})}),(0,Q.jsxs)(H,{align:`end`,children:[(0,Q.jsx)(c,{onClick:()=>{o(e)},children:`Edit`}),(0,Q.jsx)(c,{variant:`destructive`,onClick:()=>s(e),children:`Remove`})]})]}),t?.status===`failed`&&f.supportsHostRetry&&f.hostStatus!==`disabled`?(0,Q.jsx)(P,{size:`sm`,variant:`outline`,disabled:a||m!==null,onClick:()=>{h(e.id),p({environmentId:r,input:{retryHostId:e.id}}).finally(()=>h(null))},children:m===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(P,{size:`sm`,variant:`outline`,disabled:a||_!==null,onClick:()=>void u(e),children:`Test connection`})]},e.id)},t[14]=a,t[15]=l,t[16]=r,t[17]=n,t[18]=o,t[19]=s,t[20]=p,t[21]=m,t[22]=f,t[23]=u,t[24]=e):e=t[24],_=i.map(e),t[2]=a,t[3]=l,t[4]=r,t[5]=n,t[6]=i,t[7]=o,t[8]=s,t[9]=p,t[10]=m,t[11]=f,t[12]=u,t[13]=_}else _=t[13];let v;return t[25]!==g||t[26]!==_?(v=(0,Q.jsxs)(Q.Fragment,{children:[g,_]}),t[25]=g,t[26]=_,t[27]=v):v=t[27],v}function Yt(e){return(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ae,{render:(0,Q.jsx)(`span`,{tabIndex:0,role:`img`,"aria-label":e.platform===`ios`?`iOS available`:`Android available`,className:`shrink-0 text-muted-foreground`}),children:e.platform===`ios`?(0,Q.jsx)(Qe,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)($e,{className:`size-3.5`})}),(0,Q.jsx)(je,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function Xt(e){return e.available}var Zt=se(C),Qt=e=>({kind:`eas`,id:e,label:`EAS Simulator`,accessToken:``,maxSessionMinutes:30,idleMinutes:10,maxConcurrentSessions:2});function $t(e,t,n){return n?e.filter(e=>e.id!==t.id):e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?t:e):[...e,t]}function en(e){return`Up to ${e.maxConcurrentSessions===1?`1 session`:`${e.maxConcurrentSessions} sessions`} at once, each stopped after ${e.maxSessionMinutes} min or ${e.idleMinutes} idle min`}var tn=`thread-project`,nn={settings:`the access token saved here`,env:`EXPO_TOKEN on the server`,"eas-login":`the server's eas login`},rn=e=>{let t=b(e);return t instanceof Error?t.message:String(t)};function an(e){let t=(0,Z.c)(24),{scope:n,connectedEnvironments:r}=ct(),o=Te(e.environmentId,s),c=n.kind===`project`||n.kind===`checkout`,l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[0]=l):l=t[0];let u=Oe(we.updateSettings,l),d;t[1]===e.environmentId?d=t[2]:(d=t=>t.environmentId===e.environmentId,t[1]=e.environmentId,t[2]=d);let f=r.find(d)?.serverConfig?.settings.easDeviceHosts??[],[p,m]=(0,$.useState)(null),[h,g]=(0,$.useState)(!1),_=!o||c||h||!e.environmentId,v=async(t,n)=>{if(!e.environmentId||!Ee(e.environmentId,`settings:write`))return;g(!0);let r=await u({environmentId:e.environmentId,input:{patch:{easDeviceHosts:$t(f,t,n)}}});g(!1),r._tag===`Success`?m(null):q.add({type:`error`,title:n?`EAS host not removed`:`EAS host not saved`,description:rn(r.cause)})},y=X,b;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(b=[`easDeviceHosts`],t[3]=b):b=t[3];let x=_||p!==null,S;t[4]===m?S=t[5]:(S=()=>m({host:Qt(ne()),isNew:!0}),t[4]=m,t[5]=S);let C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(a,{className:`size-3.5`}),t[6]=C):C=t[6];let w;t[7]!==x||t[8]!==S?(w=(0,Q.jsxs)(P,{size:`sm`,variant:`outline`,disabled:x,onClick:S,children:[C,` Add EAS host`]}),t[7]=x,t[8]=S,t[9]=w):w=t[9];let T=f.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No EAS hosts.`}):(0,Q.jsx)(`ul`,{className:`divide-y divide-border/40`,children:f.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate font-medium`,children:[(0,Q.jsx)(i,{className:`size-3.5 shrink-0`}),` `,e.label]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:en(e)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(P,{size:`sm`,variant:`ghost`,disabled:_,onClick:()=>m({host:e,isNew:!1}),children:`Edit`}),(0,Q.jsx)(P,{size:`sm`,variant:`ghost-destructive`,disabled:_,onClick:()=>void v(e,!0),children:`Remove`})]})]},e.id))}),E;t[10]!==h||t[11]!==p||t[12]!==e.environmentId||t[13]!==v||t[14]!==m?(E=p&&e.environmentId?(0,Q.jsx)(on,{environmentId:e.environmentId,host:p.host,isNew:p.isNew,busy:h,onSave:e=>void v(e,!1),onClose:()=>m(null)},p.host.id):null,t[10]=h,t[11]=p,t[12]=e.environmentId,t[13]=v,t[14]=m,t[15]=E):E=t[15];let D;t[16]!==T||t[17]!==E?(D=(0,Q.jsxs)(`div`,{className:`pt-3 pb-2`,children:[T,E]}),t[16]=T,t[17]=E,t[18]=D):D=t[18];let O;return t[19]!==y||t[20]!==w||t[21]!==D||t[22]!==b?(O=(0,Q.jsx)(y,{id:`eas-device-hosts`,title:`EAS Simulator`,serverScoped:!0,settingKeys:b,description:`Run iOS Simulators in Expo's cloud from this environment. Sessions bill the Expo account until they stop, so each host limits how many run and for how long. Editing or removing a host stops its running sessions.`,control:w,children:D}),t[19]=y,t[20]=w,t[21]=D,t[22]=b,t[23]=O):O=t[23],O}function on(e){let t=(0,Z.c)(135),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={reportFailure:!1},t[0]=n):n=t[0];let r=Oe(Ue.easAccount,n),[i,a]=(0,$.useState)(e.host),s=(0,$.useId)(),c;t[1]===e.host.accessToken?c=t[2]:(c=e.host.accessToken?{kind:`saved`}:{kind:`cleared`},t[1]=e.host.accessToken,t[2]=c);let[l,u]=(0,$.useState)(c),d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d={status:`checking`},t[3]=d):d=t[3];let[f,p]=(0,$.useState)(d),m,h;t[4]!==i||t[5]!==e.host.accessToken||t[6]!==l.kind||t[7]!==l.value?(m={...i,label:i.label.trim(),accessToken:l.kind===`saved`?e.host.accessToken:l.kind===`new`?l.value:``},h=j(Zt(m)),t[4]=i,t[5]=e.host.accessToken,t[6]=l.kind,t[7]=l.value,t[8]=m,t[9]=h):(m=t[8],h=t[9]);let g=h,_=g?null:i.maxSessionMinutes>0&&i.idleMinutes>=i.maxSessionMinutes?`Idle minutes must be smaller than session minutes.`:`Give the host a label and limits within the ranges shown.`,v;t[10]!==f.account||t[11]!==f.status?(v=f.status===`signed-in`?f.account.apps:[],t[10]=f.account,t[11]=f.status,t[12]=v):v=t[12];let y=v,b=(0,$.useRef)(0),x;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>{b.current+=1,p({status:`idle`})},t[13]=x):x=t[13];let S=x,C;t[14]!==r||t[15]!==e.environmentId||t[16]!==e.host.id||t[17]!==e.isNew||t[18]!==l.kind||t[19]!==l.value?(C=async()=>{let t=b.current+=1,n=await r({environmentId:e.environmentId,input:{...l.kind===`saved`&&!e.isNew?{hostId:e.host.id}:{},...l.kind===`new`?{accessToken:l.value}:l.kind===`cleared`?{accessToken:``}:{}}});t===b.current&&p(n._tag===`Success`?{status:`signed-in`,account:n.value}:{status:`failed`,error:rn(n.cause)})},t[14]=r,t[15]=e.environmentId,t[16]=e.host.id,t[17]=e.isNew,t[18]=l.kind,t[19]=l.value,t[20]=C):C=t[20];let w=C,T;t[21]===w?T=t[22]:(T=()=>{p({status:`checking`}),w()},t[21]=w,t[22]=T);let E=T,D;t[23]===w?D=t[24]:(D=()=>void w(),t[23]=w,t[24]=D);let O=(0,$.useEffectEvent)(D),k;t[25]===O?k=t[26]:(k=()=>{O()},t[25]=O,t[26]=k);let A;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(A=[],t[27]=A):A=t[27],(0,$.useEffect)(k,A);let M;t[28]!==i||t[29]!==e.busy?(M=(t,n,r)=>(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(Ne,{type:`number`,min:1,max:r,value:i[t],disabled:e.busy,onChange:e=>{let n=Number(e.target.value);a(e=>({...e,[t]:n}))}})]}),t[28]=i,t[29]=e.busy,t[30]=M):M=t[30];let N=M,F;t[31]===e?F=t[32]:(F=t=>{!t&&!e.busy&&e.onClose()},t[31]=e,t[32]=F);let I=!e.busy,L;t[33]!==m||t[34]!==e||t[35]!==g?(L=t=>{t.preventDefault(),g&&!e.busy&&e.onSave(m)},t[33]=m,t[34]=e,t[35]=g,t[36]=L):L=t[36];let R=e.isNew?`Add EAS host`:`Edit EAS host`,z;t[37]===R?z=t[38]:(z=(0,Q.jsx)(Fe,{children:R}),t[37]=R,t[38]=z);let B;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,Q.jsx)(ze,{children:`The environment's server signs in to Expo and starts the sessions. Without a token here it uses EXPO_TOKEN, then its eas login.`}),t[39]=B):B=t[39];let ee;t[40]===z?ee=t[41]:(ee=(0,Q.jsxs)(Pe,{children:[z,B]}),t[40]=z,t[41]=ee);let te;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(`span`,{children:`Name`}),t[42]=te):te=t[42];let ne;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(ne=e=>{let t=e.target.value;a(e=>({...e,label:t}))},t[43]=ne):ne=t[43];let re;t[44]!==i.label||t[45]!==e.busy?(re=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[te,(0,Q.jsx)(Ne,{autoFocus:!0,required:!0,value:i.label,disabled:e.busy,onChange:ne})]}),t[44]=i.label,t[45]=e.busy,t[46]=re):re=t[46];let ie;t[47]===s?ie=t[48]:(ie=(0,Q.jsx)(`label`,{htmlFor:s,className:`block`,children:`Expo access token`}),t[47]=s,t[48]=ie);let ae=l.kind===`saved`,V=l.kind===`new`?l.value:``,H;t[49]===e.host.accessToken?H=t[50]:(H=t=>{let n=t.target.value;u(n?{kind:`new`,value:n}:e.host.accessToken?{kind:`saved`}:{kind:`cleared`}),S()},t[49]=e.host.accessToken,t[50]=H);let oe;t[51]!==e.busy||t[52]!==ae||t[53]!==V||t[54]!==H||t[55]!==s?(oe=(0,Q.jsx)(At,{id:s,className:`min-w-0 flex-1`,configured:ae,value:V,disabled:e.busy,placeholder:`Optional`,onChange:H}),t[51]=e.busy,t[52]=ae,t[53]=V,t[54]=H,t[55]=s,t[56]=oe):oe=t[56];let U;t[57]===l.kind?U=t[58]:(U=l.kind===`cleared`?null:(0,Q.jsx)(P,{type:`button`,size:`icon-sm`,variant:`ghost-destructive`,"aria-label":`Clear access token`,onClick:()=>{u({kind:`cleared`}),S()},children:(0,Q.jsx)(o,{className:`size-3.5`})}),t[57]=l.kind,t[58]=U);let se;t[59]!==oe||t[60]!==U?(se=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[oe,U]}),t[59]=oe,t[60]=U,t[61]=se):se=t[61];let ce;t[62]!==ie||t[63]!==se?(ce=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ie,se]}),t[62]=ie,t[63]=se,t[64]=ce):ce=t[64];let le=f.status===`signed-in`?`Signed in as ${f.account.signedInAs} with ${nn[f.account.credentialSource]}.`:f.status===`failed`?f.error:f.status===`checking`?`Checking the Expo account…`:`Check the Expo account before choosing a project.`,W;t[65]===le?W=t[66]:(W=(0,Q.jsx)(`p`,{role:`status`,className:`min-w-0 text-xs text-muted-foreground`,children:le}),t[65]=le,t[66]=W);let ue=e.busy||f.status===`checking`,G;t[67]===E?G=t[68]:(G=()=>void E(),t[67]=E,t[68]=G);let fe;t[69]===f.status?fe=t[70]:(fe=f.status===`checking`?(0,Q.jsx)(_e,{size:`xs`}):null,t[69]=f.status,t[70]=fe);let me;t[71]!==ue||t[72]!==G||t[73]!==fe?(me=(0,Q.jsxs)(P,{type:`button`,size:`sm`,variant:`outline`,disabled:ue,onClick:G,children:[fe,` Check account`]}),t[71]=ue,t[72]=G,t[73]=fe,t[74]=me):me=t[74];let q;t[75]!==W||t[76]!==me?(q=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2.5`,children:[W,me]}),t[75]=W,t[76]=me,t[77]=q):q=t[77];let ve;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(`span`,{children:`EAS project`}),t[78]=ve):ve=t[78];let ye=i.appId??tn,J=e.busy,be;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(be=e=>{typeof e==`string`&&a(t=>{let{appId:n,...r}=t;return e===tn?r:{...r,appId:e}})},t[79]=be):be=t[79];let xe;t[80]===y?xe=t[81]:(xe=(0,Q.jsx)(he,{size:`sm`,"aria-label":`EAS project`,children:(0,Q.jsx)(de,{children:e=>e===tn?`From the thread's project`:y.find(t=>t.id===e)?.fullName??e})}),t[80]=y,t[81]=xe);let Se;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,Q.jsx)(K,{value:tn,children:`From the thread's project`}),t[82]=Se):Se=t[82];let Ce;t[83]!==y||t[84]!==i.appId?(Ce=i.appId&&!y.some(e=>e.id===i.appId)?(0,Q.jsx)(K,{value:i.appId,children:i.appId}):null,t[83]=y,t[84]=i.appId,t[85]=Ce):Ce=t[85];let Y;t[86]===y?Y=t[87]:(Y=y.map(sn),t[86]=y,t[87]=Y);let we;t[88]!==Ce||t[89]!==Y?(we=(0,Q.jsxs)(pe,{children:[Se,Ce,Y]}),t[88]=Ce,t[89]=Y,t[90]=we):we=t[90];let Te;t[91]!==e.busy||t[92]!==ye||t[93]!==xe||t[94]!==we?(Te=(0,Q.jsxs)(ge,{value:ye,disabled:J,onValueChange:be,children:[xe,we]}),t[91]=e.busy,t[92]=ye,t[93]=xe,t[94]=we,t[95]=Te):Te=t[95];let Ee;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sessions bill the project's Expo account. "From the thread's project" reads extra.eas.projectId from the project's app config.`}),t[96]=Ee):Ee=t[96];let De;t[97]===Te?De=t[98]:(De=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ve,Te,Ee]}),t[97]=Te,t[98]=De);let ke;t[99]===N?ke=t[100]:(ke=(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-3 text-sm`,children:[N(`maxConcurrentSessions`,`Sessions at once`,20),N(`maxSessionMinutes`,`Session minutes`,115),N(`idleMinutes`,`Idle minutes`,60)]}),t[99]=N,t[100]=ke);let Ae=e.isNew?null:` Saving restarts this host, which stops its running sessions.`,je;t[101]===Ae?je=t[102]:(je=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Expo allows sessions of up to 40 minutes on free accounts and 115 on paid ones, and ends one after the idle minutes without activity, so idle minutes must be smaller than session minutes.`,Ae]}),t[101]=Ae,t[102]=je);let Me;t[103]===_?Me=t[104]:(Me=_===null?null:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:_}),t[103]=_,t[104]=Me);let Le;t[105]!==re||t[106]!==ce||t[107]!==q||t[108]!==De||t[109]!==ke||t[110]!==je||t[111]!==Me?(Le=(0,Q.jsxs)(Re,{children:[re,ce,q,De,ke,je,Me]}),t[105]=re,t[106]=ce,t[107]=q,t[108]=De,t[109]=ke,t[110]=je,t[111]=Me,t[112]=Le):Le=t[112];let He;t[113]!==e.busy||t[114]!==e.onClose?(He=(0,Q.jsx)(P,{type:`button`,variant:`ghost`,disabled:e.busy,onClick:e.onClose,children:`Cancel`}),t[113]=e.busy,t[114]=e.onClose,t[115]=He):He=t[115];let We=e.busy||!g,Ge;t[116]===e.busy?Ge=t[117]:(Ge=e.busy?(0,Q.jsx)(_e,{size:`xs`}):null,t[116]=e.busy,t[117]=Ge);let Ke;t[118]!==We||t[119]!==Ge?(Ke=(0,Q.jsxs)(P,{type:`submit`,disabled:We,children:[Ge,` Save host`]}),t[118]=We,t[119]=Ge,t[120]=Ke):Ke=t[120];let qe;t[121]!==He||t[122]!==Ke?(qe=(0,Q.jsxs)(Ie,{children:[He,Ke]}),t[121]=He,t[122]=Ke,t[123]=qe):qe=t[123];let Je;t[124]!==L||t[125]!==ee||t[126]!==Le||t[127]!==qe?(Je=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-col`,onSubmit:L,children:[ee,Le,qe]}),t[124]=L,t[125]=ee,t[126]=Le,t[127]=qe,t[128]=Je):Je=t[128];let Ye;t[129]!==I||t[130]!==Je?(Ye=(0,Q.jsx)(Be,{showCloseButton:I,children:Je}),t[129]=I,t[130]=Je,t[131]=Ye):Ye=t[131];let Xe;return t[132]!==F||t[133]!==Ye?(Xe=(0,Q.jsx)(Ve,{open:!0,onOpenChange:F,children:Ye}),t[132]=F,t[133]=Ye,t[134]=Xe):Xe=t[134],Xe}function sn(e){return(0,Q.jsx)(K,{value:e.id,children:e.fullName},e.id)}function cn(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function ln(e,t,n){if(e.kind===`new`)return{kind:`new`,profileId:t};let r=n.find(t=>t.id===e.profileId);if(r!==void 0)return{kind:`existing`,profileId:e.profileId,name:r.name}}function un(e){return e.step!==`importing`}function dn(e){return e.unavailable===`browserRunning`?{step:`quit`}:e.unavailable===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`configure`}:e.unavailable===void 0?e.profiles.length===0?{step:`blocked`,reason:`unknownSourceProfile`}:{step:`configure`}:{step:`blocked`,reason:e.unavailable}}function fn(e){return e.kind===`imported`?{step:`done`,imported:e.imported,skipped:e.skipped,skippedDomains:e.skippedDomains,targetName:e.targetName}:e.reason===`browserRunning`?{step:`quit`}:e.reason===`needsFullDiskAccess`?{step:`fullDiskAccess`,resume:`import`,checked:!0}:{step:`blocked`,reason:e.reason}}function pn(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:dn(e)}function mn(e){let t=pn(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function hn(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function gn(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function _n(e){return e.length===0?``:e.length===1?e[0]:e.length<=3?`${e.slice(0,-1).join(`, `)} and ${e.at(-1)}`:`${e.slice(0,3).join(`, `)} and ${e.length-3} more`}function vn(e){let t=(0,Z.c)(46),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,onImport:o,onRefreshSource:s,onOpenFullDiskAccessSettings:c,onCheckFullDiskAccess:l,onClose:u}=e,[d,f]=(0,$.useState)(n),p;t[0]===n?p=t[1]:(p=()=>dn(n),t[0]=n,t[1]=p);let[m,h]=(0,$.useState)(p),g;t[2]===n.profiles[0]?.directory?g=t[3]:(g=()=>n.profiles[0]?.directory??``,t[2]=n.profiles[0]?.directory,t[3]=g);let[_,v]=(0,$.useState)(g),y;t[4]!==a||t[5]!==i?(y=()=>cn(a,i),t[4]=a,t[5]=i,t[6]=y):y=t[6];let[b,x]=(0,$.useState)(y),[S,C]=(0,$.useState)(),w;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(w=ne(),t[7]=w):w=t[7];let T=(0,$.useRef)(`profile-${w}`),E=(0,$.useRef)(!1),D;t[8]!==o||t[9]!==_||t[10]!==b||t[11]!==i?(D=()=>{if(E.current)return;let e=ln(b,T.current,i);if(e===void 0){C(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`});return}C(void 0),E.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(fn(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{E.current=!1})},t[8]=o,t[9]=_,t[10]=b,t[11]=i,t[12]=D):D=t[12];let O=D,k;t[13]===s?k=t[14]:(k=(e,t)=>{h({step:`checking`,check:e}),s().then(e=>{e&&(f(e),v(t=>hn(t,e))),h(t(e))}).catch(()=>h({step:`blocked`,reason:`readFailed`}))},t[13]=s,t[14]=k);let A=k,j;t[15]===A?j=t[16]:(j=()=>A(`browser`,pn),t[15]=A,t[16]=j);let M=j,N;t[17]===A?N=t[18]:(N=()=>A(`fullDiskAccess`,mn),t[17]=A,t[18]=N);let P=N,F;t[19]!==u||t[20]!==m?(F=e=>e||!un(m)?void 0:u(),t[19]=u,t[20]=m,t[21]=F):F=t[21];let I;t[22]===m?I=t[23]:(I=un(m),t[22]=m,t[23]=I);let L;t[24]!==a||t[25]!==r||t[26]!==l||t[27]!==u||t[28]!==c||t[29]!==s||t[30]!==M||t[31]!==P||t[32]!==O||t[33]!==d||t[34]!==_||t[35]!==m||t[36]!==b||t[37]!==S||t[38]!==i?(L=m.step===`quit`?(0,Q.jsx)(yn,{source:d,onCancel:u,onRechecked:M}):m.step===`fullDiskAccess`?(0,Q.jsx)(Sn,{source:d,onCancel:u,onOpenSettings:c,onCheck:l??(async()=>{let e=await s();return e!==void 0&&e.unavailable===void 0}),onGranted:m.resume===`import`?O:P,stillRequired:m.checked===!0}):m.step===`importing`?(0,Q.jsx)(Tn,{}):m.step===`checking`?(0,Q.jsx)(En,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(Dn,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(On,{source:d,reason:m.reason,onClose:u,onRetry:gn(m.reason)?O:void 0}):(0,Q.jsx)(Cn,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:v,target:b,onTargetChange:e=>{x(e),C(void 0)},targetError:S,onCancel:u,onImport:O}),t[24]=a,t[25]=r,t[26]=l,t[27]=u,t[28]=c,t[29]=s,t[30]=M,t[31]=P,t[32]=O,t[33]=d,t[34]=_,t[35]=m,t[36]=b,t[37]=S,t[38]=i,t[39]=L):L=t[39];let R;t[40]!==I||t[41]!==L?(R=(0,Q.jsx)(Be,{className:`max-w-lg`,showCloseButton:I,children:L}),t[40]=I,t[41]=L,t[42]=R):R=t[42];let z;return t[43]!==R||t[44]!==F?(z=(0,Q.jsx)(Ve,{open:!0,onOpenChange:F,children:R}),t[43]=R,t[44]=F,t[45]=z):z=t[45],z}function yn(e){let t=(0,Z.c)(12),{source:n,onCancel:r,onRechecked:i}=e,a;t[0]===n.name?a=t[1]:(a=(0,Q.jsxs)(Pe,{children:[(0,Q.jsxs)(Fe,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(ze,{children:[n.name,` is open, so its cookies can’t be read yet. Quit it, then continue.`]})]}),t[0]=n.name,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(P,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(P,{onClick:i,children:`I’ve quit it`}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(Ie,{children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(Q.Fragment,{children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function bn(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function xn(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function Sn(e){let t=(0,Z.c)(43),{source:n,onCancel:r,onOpenSettings:i,onGranted:a,stillRequired:o,onCheck:s}=e,[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=Nt(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)(Pe,{children:[(0,Q.jsxs)(Fe,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(ze,{children:[`To import cookies from `,n.name,`, P4 Code needs Full Disk Access. Turn it on in System Settings, then come back to finish the import — you can revoke it again once the import is done.`]})]}),t[6]=n.name,t[7]=_);let v;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(w,{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)(jt,{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 T;t[21]!==m||t[22]!==o?(T=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]=T):T=t[23];let E;t[24]!==C||t[25]!==T||t[26]!==S?(E=(0,Q.jsxs)(Re,{children:[S,C,T]}),t[24]=C,t[25]=T,t[26]=S,t[27]=E):E=t[27];let D;t[28]===r?D=t[29]:(D=(0,Q.jsx)(P,{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)(Mt,{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)(Ie,{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 Cn(e){let t=(0,Z.c)(59),{source:n,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:o,onSourceProfileChange:s,target:c,targetError:l,onTargetChange:u,onCancel:d,onImport:f}=e,p;t[0]!==c.kind||t[1]!==c.profileId||t[2]!==i?(p=c.kind===`existing`&&!i.some(e=>e.id===c.profileId),t[0]=c.kind,t[1]=c.profileId,t[2]=i,t[3]=p):p=t[3];let m=p,h=c.kind===`new`&&!a,g=l??(m?`That profile is no longer available. Choose where to import these cookies.`:h?`You've reached the profile limit. Choose an existing profile to import into.`:void 0),_;t[4]===n.name?_=t[5]:(_=(0,Q.jsxs)(Fe,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=_);let v;t[6]===r?v=t[7]:(v=(0,Q.jsxs)(ze,{children:[`Choose which cookies to import for `,r,`.`]}),t[6]=r,t[7]=v);let y;t[8]!==_||t[9]!==v?(y=(0,Q.jsxs)(Pe,{children:[_,v]}),t[8]=_,t[9]=v,t[10]=y):y=t[10];let 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)(wn,{selected:o===e.directory,title:e.name,subtitle:bn(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],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)(R,{className:`size-4 sm:hidden`}),(0,Q.jsx)(ae,{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 T;t[23]!==a||t[24]!==u||t[25]!==c.kind?(T=a?(0,Q.jsx)(wn,{selected:c.kind===`new`,title:`New profile`,subtitle:`Created for these cookies`,onSelect:()=>u({kind:`new`})}):null,t[23]=a,t[24]=u,t[25]=c.kind,t[26]=T):T=t[26];let E;if(t[27]!==u||t[28]!==c.kind||t[29]!==c.profileId||t[30]!==i){let e;t[32]!==u||t[33]!==c.kind||t[34]!==c.profileId?(e=e=>(0,Q.jsx)(wn,{selected:c.kind===`existing`&&c.profileId===e.id,title:e.name,subtitle:`Existing profile`,onSelect:()=>u({kind:`existing`,profileId:e.id})},e.id),t[32]=u,t[33]=c.kind,t[34]=c.profileId,t[35]=e):e=t[35],E=i.map(e),t[27]=u,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=E}else E=t[31];let D;t[36]!==T||t[37]!==E?(D=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[w,T,E]}),t[36]=T,t[37]=E,t[38]=D):D=t[38];let O;t[39]!==D||t[40]!==S?(O=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[S,C,D]}),t[39]=D,t[40]=S,t[41]=O):O=t[41];let k;t[42]===g?k=t[43]:(k=g?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:g}):null,t[42]=g,t[43]=k);let A;t[44]!==O||t[45]!==k?(A=(0,Q.jsxs)(Re,{children:[O,k]}),t[44]=O,t[45]=k,t[46]=A):A=t[46];let j;t[47]===d?j=t[48]:(j=(0,Q.jsx)(P,{variant:`outline`,onClick:d,children:`Cancel`}),t[47]=d,t[48]=j);let M=o===``||m||h,N;t[49]!==f||t[50]!==M?(N=(0,Q.jsx)(P,{disabled:M,onClick:f,children:`Import`}),t[49]=f,t[50]=M,t[51]=N):N=t[51];let F;t[52]!==j||t[53]!==N?(F=(0,Q.jsxs)(Ie,{children:[j,N]}),t[52]=j,t[53]=N,t[54]=F):F=t[54];let I;return t[55]!==A||t[56]!==F||t[57]!==y?(I=(0,Q.jsxs)(Q.Fragment,{children:[y,A,F]}),t[55]=A,t[56]=F,t[57]=y,t[58]=I):I=t[58],I}function wn(e){let t=(0,Z.c)(22),{selected:n,title:r,subtitle:i,onSelect:a}=e,o=n?`border-primary bg-primary/8`:`border-border/60 hover:border-border hover:bg-muted/40`,s;t[0]===o?s=t[1]:(s=V(`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=V(`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)(ee,{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)(Pe,{children:[(0,Q.jsx)(Fe,{children:`Importing cookies`}),(0,Q.jsx)(ze,{children:`This may take a moment.`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[t,(0,Q.jsx)(Re,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(_e,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function En(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(Fe,{children:[`Checking `,n]}),t[0]=n,t[1]=i);let a=r===`fullDiskAccess`?`Checking Full Disk Access.`:`Checking whether the browser has closed.`,o;t[2]===a?o=t[3]:(o=(0,Q.jsx)(ze,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(Pe,{children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6];let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(_e,{size:`md`,tone:`muted`}),t[7]=c):c=t[7];let l=r===`fullDiskAccess`?`Checking access…`:`Checking…`,u;t[8]===l?u=t[9]:(u=(0,Q.jsx)(Re,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[c,(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:l})]})}),t[8]=l,t[9]=u);let d;return t[10]!==s||t[11]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[s,u]}),t[10]=s,t[11]=u,t[12]=d):d=t[12],d}function Dn(e){let t=(0,Z.c)(24),{imported:n,skipped:r,skippedDomains:i,targetName:a,destinationEnvironmentName:o,onClose:s}=e,c;t[0]!==n||t[1]!==r?(c=n>0?`Imported ${xn(n)}`:r>0?`Skipped ${xn(r)}`:`No cookies found`,t[0]=n,t[1]=r,t[2]=c):c=t[2];let l;t[3]===c?l=t[4]:(l=(0,Q.jsx)(Fe,{children:c}),t[3]=c,t[4]=l);let u;t[5]!==o||t[6]!==n||t[7]!==r||t[8]!==a?(u=n>0?`Added to ${a} for ${o}.${r>0?` ${xn(r)} skipped.`:``}`:r>0?`No cookies were imported for ${o}.`:`There were no cookies to import for ${o}.`,t[5]=o,t[6]=n,t[7]=r,t[8]=a,t[9]=u):u=t[9];let d;t[10]===u?d=t[11]:(d=(0,Q.jsx)(ze,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(Pe,{children:[l,d]}),t[12]=l,t[13]=d,t[14]=f):f=t[14];let p;t[15]===i?p=t[16]:(p=i.length>0?(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Skipped`}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-foreground`,children:_n(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(P,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(Ie,{children:(0,Q.jsx)(Le,{render:m,onClick:s,children:`Done`})}),t[18]=s,t[19]=h);let g;return t[20]!==f||t[21]!==p||t[22]!==h?(g=(0,Q.jsxs)(Q.Fragment,{children:[f,p,h]}),t[20]=f,t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function On(e){let t=(0,Z.c)(17),{source:n,reason:r,onClose:i,onRetry:a}=e,o;t[0]===n.name?o=t[1]:(o=(0,Q.jsxs)(Fe,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=o);let s=B[r],c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(ze,{children:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c?(l=(0,Q.jsxs)(Pe,{children:[o,c]}),t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,Q.jsx)(P,{variant:`outline`,onClick:i,children:`Close`}),t[7]=i,t[8]=u);let d;t[9]===a?d=t[10]:(d=a?(0,Q.jsx)(P,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(Ie,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;return t[14]!==l||t[15]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[l,f]}),t[14]=l,t[15]=f,t[16]=p):p=t[16],p}var kn=`fill`,An=`responsive`;async function jn(e,t,n,r){let i=e===null?[]:t,a=r?.environmentIds??[];if(i.length===0&&a.length===0)throw Error(`Browser profile data is not available to clear.`);await Promise.all([...i.flatMap(t=>[e.clearCookies(t,n),e.clearCache(t,n)]),...a.map(e=>r.clear(e,n))])}function Mn(e,t,n,r=0){return(e||r>0)&&t&&n>0}var Nn={width:1280,height:800},Pn={useGrouping:!1},Fn={system:`System`,light:`Light`,dark:`Dark`},In=e=>`${Math.round(e*100)}%`,Ln=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},Rn=e=>{let t=String(e?.message??``);return M.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},zn=e=>e._tag===`fill`?kn:e._tag===`preset`&&yt.some(t=>t.id===e.presetId)?e.presetId:An,Bn=e=>{let t=zn(e);return t===kn?`Fill panel`:t===An?`Responsive`:yt.find(e=>e.id===t)?.label??`Responsive`},Vn=e=>Number.isInteger(e)&&e>=240&&e<=3840,Hn=e=>({...e,width:e.height,height:e.width});function Un(e){let t=(0,Z.c)(42),{disabled:n}=e,r=Y(Gn),i=J(),a=r._tag===`fill`?null:r,o=a?.width??Nn.width,s=a?.height??Nn.height,c;t[0]!==o||t[1]!==s?(c={width:o,height:s},t[0]=o,t[1]=s,t[2]=c):c=t[2];let l=c,u;t[3]!==a?.height||t[4]!==a?.width||t[5]!==i?(u=e=>{if(e===kn){i({browserDefaultViewport:te});return}if(e===An){i({browserDefaultViewport:{_tag:`freeform`,width:a?.width??Nn.width,height:a?.height??Nn.height}});return}let t=yt.find(t=>t.id===e);t&&i({browserDefaultViewport:{_tag:`preset`,width:t.width,height:t.height,presetId:t.id}})},t[3]=a?.height,t[4]=a?.width,t[5]=i,t[6]=u):u=t[6];let d=u,f;t[7]!==l||t[8]!==a||t[9]!==i?(f=(e,t)=>{if(t===null||!Vn(t))return;let n={...l,[e]:t};n.width*n.height>8294400||a&&n.width===a.width&&n.height===a.height||i({browserDefaultViewport:{_tag:`freeform`,...n}})},t[7]=l,t[8]=a,t[9]=i,t[10]=f):f=t[10];let p=f,m;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(m=Et(`browser-default-viewport`),t[11]=m):m=t[11];let h;t[12]!==n||t[13]!==i||t[14]!==r._tag?(h=!n&&r._tag!==U._tag?(0,Q.jsx)(dt,{label:`default browser viewport`,onClick:()=>i({browserDefaultViewport:U})}):null,t[12]=n,t[13]=i,t[14]=r._tag,t[15]=h):h=t[15];let g;t[16]===r?g=t[17]:(g=zn(r),t[16]=r,t[17]=g);let v;t[18]===r?v=t[19]:(v=Bn(r),t[18]=r,t[19]=v);let y;t[20]===v?y=t[21]:(y=(0,Q.jsx)(he,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(de,{children:v})}),t[20]=v,t[21]=y);let b,x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(K,{value:kn,children:`Fill panel`}),x=(0,Q.jsx)(K,{value:An,children:`Responsive`}),t[22]=b,t[23]=x):(b=t[22],x=t[23]);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(pe,{align:`end`,alignItemWithTrigger:!1,children:[b,x,(0,Q.jsxs)(me,{children:[(0,Q.jsx)(fe,{children:`Standard`}),yt.map(Wn)]})]}),t[24]=S):S=t[24];let C;t[25]!==n||t[26]!==d||t[27]!==y||t[28]!==g?(C=(0,Q.jsxs)(ge,{value:g,onValueChange:d,disabled:n,children:[y,S]}),t[25]=n,t[26]=d,t[27]=y,t[28]=g,t[29]=C):C=t[29];let w;t[30]!==p||t[31]!==n||t[32]!==l||t[33]!==a||t[34]!==i?(w=a?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(G,{value:l.width,min:240,max:_,disabled:n,format:Pn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`width`,e),children:(0,Q.jsx)(ue,{children:(0,Q.jsx)(W,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(G,{value:l.height,min:240,max:_,disabled:n,format:Pn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`height`,e),children:(0,Q.jsx)(ue,{children:(0,Q.jsx)(W,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ae,{render:(0,Q.jsx)(P,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${l.height>=l.width?`landscape`:`portrait`}`,onClick:()=>i({browserDefaultViewport:Hn(a)}),children:(0,Q.jsx)(vt,{})})}),(0,Q.jsx)(je,{side:`top`,children:`Rotate`})]})]}):null,t[30]=p,t[31]=n,t[32]=l,t[33]=a,t[34]=i,t[35]=w):w=t[35];let T;t[36]!==C||t[37]!==w?(T=(0,Q.jsxs)(`div`,{className:`flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto`,children:[C,w]}),t[36]=C,t[37]=w,t[38]=T):T=t[38];let E;return t[39]!==T||t[40]!==h?(E=(0,Q.jsx)(X,{...m,description:`Tab size for you and agents. Fill fits the panel; other sizes show the device toolbar.`,resetAction:h,control:T}),t[39]=T,t[40]=h,t[41]=E):E=t[41],E}function Wn(e){return(0,Q.jsx)(K,{value:e.id,children:(0,Q.jsxs)(`span`,{className:`flex w-full items-center justify-between gap-5`,children:[(0,Q.jsx)(`span`,{children:e.label}),(0,Q.jsx)(`span`,{className:`text-xs tabular-nums text-muted-foreground`,children:e.detail})]})},e.id)}function Gn(e){return e.browserDefaultViewport}function Kn(e){let t=(0,Z.c)(20),{disabled:n}=e,r=Y(Jn),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Et(`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)(dt,{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=p.find(t=>String(t)===e);t!==void 0&&i({browserDefaultZoomFactor:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=In(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(de,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:p.map(qn)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(ge,{disabled:n,value:s,onValueChange:c,children:[u,d]}),t[12]=n,t[13]=s,t[14]=c,t[15]=u,t[16]=f):f=t[16];let m;return t[17]!==o||t[18]!==f?(m=(0,Q.jsx)(X,{...a,description:`Page zoom applied to new browser tabs.`,resetAction:o,control:f}),t[17]=o,t[18]=f,t[19]=m):m=t[19],m}function qn(e){return(0,Q.jsx)(K,{hideIndicator:!0,value:String(e),children:In(e)},e)}function Jn(e){return e.browserDefaultZoomFactor}function Yn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=Y(Zn),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Et(`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)(dt,{label:`default browser appearance`,onClick:()=>i({browserDefaultAppearance:v})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`light`||e===`dark`)&&i({browserDefaultAppearance:e})},t[5]=i,t[6]=s);let c=Fn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(de,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(Fn).map(Xn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(ge,{disabled:n,value:r,onValueChange:s,children:[l,u]}),t[10]=r,t[11]=n,t[12]=s,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`The color scheme pages are told to prefer. System follows your OS setting.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function Xn(e){let[t,n]=e;return(0,Q.jsx)(K,{hideIndicator:!0,value:t,children:n},t)}function Zn(e){return e.browserDefaultAppearance}function Qn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=Y(er),i=Y($n),a=J(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=Et(`browser-recording-key-presses`),t[0]=o):o=t[0];let s;t[1]===a?s=t[2]:(s=e=>a({browserRecordingShowKeyPresses:!!e}),t[1]=a,t[2]=s);let c;t[3]!==n||t[4]!==r||t[5]!==s?(c=(0,Q.jsx)(X,{...o,description:`Show pressed keys and shortcuts in new recordings. Password fields are excluded.`,control:(0,Q.jsx)(Ct,{disabled:n,checked:r,"aria-label":`Show key presses in recordings`,onCheckedChange:s})}),t[3]=n,t[4]=r,t[5]=s,t[6]=c):c=t[6];let l;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(l=Et(`browser-recording-mouse-presses`),t[7]=l):l=t[7];let u;t[8]===a?u=t[9]:(u=e=>a({browserRecordingShowMousePresses:!!e}),t[8]=a,t[9]=u);let d;t[10]!==n||t[11]!==i||t[12]!==u?(d=(0,Q.jsx)(X,{...l,description:`Highlight mouse presses and held buttons in new recordings.`,control:(0,Q.jsx)(Ct,{disabled:n,checked:i,"aria-label":`Show mouse presses in recordings`,onCheckedChange:u})}),t[10]=n,t[11]=i,t[12]=u,t[13]=d):d=t[13];let f;return t[14]!==c||t[15]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[c,d]}),t[14]=c,t[15]=d,t[16]=f):f=t[16],f}function $n(e){return e.browserRecordingShowMousePresses}function er(e){return e.browserRecordingShowKeyPresses}function tr(e){let t=(0,Z.c)(18),{disabled:n}=e,r=Y(rr),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Et(`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)(dt,{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=re.find(t=>String(t)===e);t!==void 0&&i({browserRecordingFrameRate:t})},t[5]=i,t[6]=c);let l;t[7]===r?l=t[8]:(l=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(de,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:re.map(nr)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(ge,{disabled:n,value:s,onValueChange:c,children:[l,u]}),t[10]=n,t[11]=s,t[12]=c,t[13]=l,t[14]=d):d=t[14];let f;return t[15]!==o||t[16]!==d?(f=(0,Q.jsx)(X,{...a,description:`Maximum recording rate. 30 fps saves CPU and storage; 60 fps is smoother.`,resetAction:o,control:d}),t[15]=o,t[16]=d,t[17]=f):f=t[17],f}function nr(e){return(0,Q.jsxs)(K,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function rr(e){return e.browserRecordingFrameRate}var ir={system:`Your default browser`,app:`P4 Code`};function ar(e){let t=(0,Z.c)(19),{disabled:n}=e,r=Y(sr),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Et(`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)(dt,{label:`link target`,onClick:()=>i({browserLinkTarget:x})}):null,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>{(e===`system`||e===`app`)&&i({browserLinkTarget:e})},t[5]=i,t[6]=s);let c=ir[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(de,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(ir),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:u.map(or)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(ge,{disabled:n,value:r,onValueChange:s,children:[l,d]}),t[11]=n,t[12]=r,t[13]=s,t[14]=l,t[15]=f):f=t[15];let p;return t[16]!==o||t[17]!==f?(p=(0,Q.jsx)(X,{...a,description:`Where links in the chat and terminal open. Hold ⌘ or Ctrl while clicking a link to open it in your default browser either way.`,resetAction:o,control:f}),t[16]=o,t[17]=f,t[18]=p):p=t[18],p}function or(e){return(0,Q.jsx)(K,{hideIndicator:!0,value:e,children:ir[e]},e)}function sr(e){return e.browserLinkTarget}var cr={duckduckgo:`DuckDuckGo`,google:`Google`,bing:`Bing`,brave:`Brave Search`,kagi:`Kagi`,ecosia:`Ecosia`,custom:`Custom`};function lr(){let e=(0,Z.c)(24),t=Y(fr),n=Y(dr),r=J(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=Et(`browser-search-engine`),e[0]=i):i=e[0];let a;e[1]!==n||e[2]!==t||e[3]!==r?(a=t!==`duckduckgo`||n!==``?(0,Q.jsx)(dt,{label:`search engine`,onClick:()=>r({browserSearchEngine:l,browserCustomSearchUrl:``})}):null,e[1]=n,e[2]=t,e[3]=r,e[4]=a):a=e[4];let o;e[5]===r?o=e[6]:(o=e=>{let t=L.literals.find(t=>t===e);t!==void 0&&r({browserSearchEngine:t})},e[5]=r,e[6]=o);let s=cr[t],c;e[7]===s?c=e[8]:(c=(0,Q.jsx)(he,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Search engine`,children:(0,Q.jsx)(de,{children:s})}),e[7]=s,e[8]=c);let u;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(pe,{align:`end`,alignItemWithTrigger:!1,children:L.literals.map(ur)}),e[9]=u):u=e[9];let d;e[10]!==t||e[11]!==o||e[12]!==c?(d=(0,Q.jsxs)(ge,{value:t,onValueChange:o,children:[c,u]}),e[10]=t,e[11]=o,e[12]=c,e[13]=d):d=e[13];let f;e[14]!==a||e[15]!==d?(f=(0,Q.jsx)(X,{...i,description:`What the address bar searches when you type something that isn't a URL.`,resetAction:a,control:d}),e[14]=a,e[15]=d,e[16]=f):f=e[16];let p;e[17]!==n||e[18]!==t||e[19]!==r?(p=t===`custom`?(0,Q.jsx)(X,{title:`Custom search URL`,description:`Use %s where the search terms go.`,status:tt(n)?void 0:`Enter an http or https URL containing %s. Searches use DuckDuckGo until then.`,control:(0,Q.jsx)(Ot,{nativeInput:!0,size:`sm`,className:`w-full sm:w-64`,"aria-label":`Custom search URL`,placeholder:`https://example.com/search?q=%s`,autoCapitalize:`none`,spellCheck:!1,maxLength:F,value:n,onCommit:e=>r({browserCustomSearchUrl:e.trim()})})}):null,e[17]=n,e[18]=t,e[19]=r,e[20]=p):p=e[20];let m;return e[21]!==f||e[22]!==p?(m=(0,Q.jsxs)(Q.Fragment,{children:[f,p]}),e[21]=f,e[22]=p,e[23]=m):m=e[23],m}function ur(e){return(0,Q.jsx)(K,{hideIndicator:!0,value:e,children:cr[e]},e)}function dr(e){return e.browserCustomSearchUrl}function fr(e){return e.browserSearchEngine}function pr(){let e=(0,Z.c)(12),t=Y(mr),n=J(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=Et(`pull-request-links-open-in-app`),e[0]=r):r=e[0];let i;e[1]!==t||e[2]!==n?(i=t?null:(0,Q.jsx)(dt,{label:`open pull requests in P4 Code`,onClick:()=>n({pullRequestLinksOpenInApp:!0})}),e[1]=t,e[2]=n,e[3]=i):i=e[3];let a;e[4]===n?a=e[5]:(a=e=>n({pullRequestLinksOpenInApp:!!e}),e[4]=n,e[5]=a);let o;e[6]!==t||e[7]!==a?(o=(0,Q.jsx)(Ct,{checked:t,onCheckedChange:a,"aria-label":`Open pull requests in P4 Code`}),e[6]=t,e[7]=a,e[8]=o):o=e[8];let s;return e[9]!==i||e[10]!==o?(s=(0,Q.jsx)(X,{...r,description:`Clicking a pull request link opens it in P4 Code. Turn off to open pull request links like any other link, on GitHub or your git host.`,resetAction:i,control:o}),e[9]=i,e[10]=o,e[11]=s):s=e[11],s}function mr(e){return e.pullRequestLinksOpenInApp}function hr(){let e=(0,Z.c)(7),{search:t,environment:n}=ct(),r=ot(),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)(ft,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(gr,{environmentId:i,enabled:r.enableDeviceSupport,agentAccessEnabled:r.enableAgentDeviceAccess},o)}),e[2]=i,e[3]=r.enableAgentDeviceAccess,e[4]=r.enableDeviceSupport,e[5]=o,e[6]=s):s=e[6],s}function gr({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=Te(e,s),{state:i,loaded:a}=He(e),{scope:o,environments:c,connectedEnvironments:l}=ct(),u=st(),d=o.kind===`project`||o.kind===`checkout`,f=l.some(e=>e.serverConfig?.settings.enableDeviceSupport),p=Oe(Ue.configure,{reportFailure:!1}),m=Oe(Ue.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&&Ee(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(!Ee(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&&q.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,T=e=>{let t=w?.[e];return i.supportsToolUpdate&&t?!t.installedVersions.includes(t.requiredVersion):!1},E=(t,n=!1)=>{e&&(C(null),g(`update-${t}`),m({environmentId:e,input:{updateTool:t}}).then(e=>{if(e._tag===`Failure`){let r=De(e.cause);C({tool:t,message:r}),n&&q.add({type:`error`,title:r})}}).finally(()=>g(null)))},D=t=>{e&&(g(t),m({environmentId:e,input:{inspectOnly:!0}}).finally(()=>g(null)))},O=t=>{let n=T(t);if(!n&&!i.supportsToolInspection)return null;let r=h===`update-${t}`||h===`check-${t}`,a=n?`Update to v${w?.[t].requiredVersion}`:`Check ${t===`hub`?`device hub`:`agent device`} version`;return(0,Q.jsxs)(Me,{children:[(0,Q.jsx)(Ae,{render:(0,Q.jsx)(P,{size:`icon-xs`,variant:`ghost-muted`,disabled:!e||h!==null||_,"aria-label":a,onClick:()=>n?E(t,!0):D(`check-${t}`)}),children:(0,Q.jsxs)(`span`,{className:`grid *:col-start-1 *:row-start-1 *:transition-[opacity,scale] *:duration-150 *:ease-out motion-reduce:*:transition-none`,children:[(0,Q.jsx)(`span`,{className:n&&!r?void 0:`scale-75 opacity-0`,children:(0,Q.jsx)(z,{"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:n&&!r?`scale-75 opacity-0`:void 0,children:(0,Q.jsx)(Tt,{refreshing:r})})]})}),(0,Q.jsx)(je,{side:`top`,children:a})]})},k=t=>{let n=w?.[t];return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&T(t)?(0,Q.jsx)(P,{size:`sm`,disabled:!e||h!==null||_,onClick:()=>E(t),children:h===`update-${t}`?`Updating…`:`Update to v${n.requiredVersion}`}):null,i.supportsToolInspection?(0,Q.jsx)(P,{size:`sm`,variant:`outline`,disabled:!e||h!==null||_,onClick:()=>D(`check`),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)(X,{...Et(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:Je,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pt,{action:k(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),O(`hub`),h===`hub`?(0,Q.jsx)(qe,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(kt,{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)(Ze,{children:y?(0,Q.jsx)(X,{...Et(`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)(Ge,{compact:!0,platform:`iOS`,status:Ke(i,`ios`)}),(0,Q.jsx)(Ge,{compact:!0,platform:`Android`,status:Ke(i,`android`)})]}),control:(0,Q.jsx)(P,{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)(X,{...Et(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:We,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Pt,{action:k(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),O(`agent`),h===`agent`?(0,Q.jsx)(Ye,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(kt,{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)(Xe,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(qt,{environmentId:e}),i.supportsEasHosts?(0,Q.jsx)(an,{environmentId:e}):null]})}function _r(e){let t=(0,Z.c)(14),{disabled:n}=e,r=Y(vr),i=J(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Et(`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)(dt,{label:`auto-show floating preview`,onClick:()=>i({browserAutoShowFloatingPreview:!0})}):null,t[1]=r,t[2]=n,t[3]=i,t[4]=o):o=t[4];let s;t[5]===i?s=t[6]:(s=e=>i({browserAutoShowFloatingPreview:!!e}),t[5]=i,t[6]=s);let c;t[7]!==r||t[8]!==n||t[9]!==s?(c=(0,Q.jsx)(Ct,{disabled:n,checked:r,onCheckedChange:s,"aria-label":`Auto-show floating preview`}),t[7]=r,t[8]=n,t[9]=s,t[10]=c):c=t[10];let l;return t[11]!==o||t[12]!==c?(l=(0,Q.jsx)(X,{...a,description:`Show the floating preview when an agent opens a browser or device unless the agent says otherwise.`,resetAction:o,control:c}),t[11]=o,t[12]=c,t[13]=l):l=t[13],l}function vr(e){return e.browserAutoShowFloatingPreview}function yr({disabled:e}){let t=Y(e=>e.browserProfiles),n=Y(e=>e.browserDefaultProfileId),r=be(),i=J(),{environments:a,isReady:o}=ye(),s=ve(),[l,u]=(0,$.useState)(null),[f,p]=(0,$.useState)(null),[_,v]=(0,$.useState)(null),[b,x]=(0,$.useState)(null),[S,C]=(0,$.useState)(null),[w,k]=(0,$.useState)(!1),j=le(),M=Oe(et.clearProfile,{reportFailure:!1}),F={environmentIds:a.map(e=>e.environmentId).filter(e=>j.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await M({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw ce(n)}},I=Mn(mt!==null,o,a.length,F.environmentIds.length),L=(0,$.useRef)(!1),[R,z]=(0,$.useState)(!1),B=e||!r,ee=T(t).filter(e=>e.kind!==`incognito`),te=m(ee,n)?.id??`default`,re=e=>{if(!r||L.current)return;let t=Ce().browserProfiles;if(t.length>=24)return;let n=T(t),a=new Set(n.map(e=>e.name)),o=e;for(let t=2;a.has(o);t+=1)o=`${e} ${t}`;let s={id:`profile-${ne()}`,name:o,kind:`persistent`};return i({browserProfiles:[...t,s]}),s},ie=(e,t)=>{if(!r||L.current)return;let n=t.trim().slice(0,48);if(n===``)return;let a=Ce().browserProfiles;i({browserProfiles:a.map(t=>t.id===e?{...t,name:n}:t)})},ae=(e,t)=>{if(r&&!L.current){if(!I){q.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`});return}jn(mt,a.map(e=>e.environmentId),e,F).then(()=>{q.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{q.add({type:`error`,title:`Could not clear ${t}'s data`})})}},U=async e=>{if(!r||L.current)return;if(!I){C(`Connect to an environment before removing this profile.`);return}C(null),k(!0);try{await jn(mt,o?a.map(e=>e.environmentId):[],e,F)}catch{C(`Profile data could not be deleted. Try again.`),k(!1);return}let t=Ce();i({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:g}:{}}),k(!1),v(null)},se=(l??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),W=(0,$.useCallback)(()=>{mt&&mt.listBrowserImportSources().then(u).catch(()=>u(e=>e??[]))},[]),ue=async(e,t,n)=>{if(!mt||!r)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!T(Ce().browserProfiles).some(e=>e.id===n.target.profileId)||L.current)return{kind:`blocked`,reason:`readFailed`};L.current=!0,z(!0);try{let r=await mt.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!T(Ce().browserProfiles).some(e=>e.id===n.target.profileId))return{kind:`blocked`,reason:`readFailed`};let i;if(n.target.kind===`new`){if(r.imported>0)try{i=(await xe(t=>{if(t.browserProfiles.find(e=>e.id===n.target.profileId))return t;if(t.browserProfiles.length>=24)throw new Ln;let r=new Set(T(t.browserProfiles).map(e=>e.name)),i=e.name;for(let t=2;r.has(i);t+=1)i=`${e.name} ${t}`;return{...t,browserProfiles:[...t.browserProfiles,{id:n.target.profileId,name:i,kind:`persistent`}]}})).browserProfiles.find(e=>e.id===n.target.profileId)?.name??e.name}catch(r){await jn(mt,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof Ln?`profileLimitReached`:`profileNotSaved`;throw Error(`Importing cookies from ${e.id} failed: ${i}.`,{cause:r})}else i=e.name}else i=n.target.name;return{kind:`imported`,imported:r.imported,skipped:r.skipped,skippedDomains:r.skippedDomains,targetName:i}}catch(e){return{kind:`blocked`,reason:Rn(e)}}finally{L.current=!1,z(!1)}},G=async e=>{if(mt)try{let t=await mt.listBrowserImportSources();return u(t),t.find(t=>t.id===e)}catch{return}},K=t.length>=24;return(0,Q.jsxs)(X,{...Et(`browser-profiles`),description:`Profiles separate cookies and logins. Incognito data is cleared when the app closes.`,control:(0,Q.jsxs)(D,{onOpenChange:e=>e&&W(),children:[(0,Q.jsxs)(oe,{render:(0,Q.jsx)(P,{size:`sm`,variant:`outline`,disabled:B||R}),children:[(0,Q.jsx)(O,{}),`Add profile`]}),(0,Q.jsxs)(H,{align:`end`,children:[(0,Q.jsx)(c,{disabled:!r||K,onClick:()=>re(`New profile`),children:`Blank profile`}),K?(0,Q.jsx)(c,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(N,{}),(0,Q.jsxs)(A,{children:[(0,Q.jsx)(y,{children:`Import from`}),l===null?(0,Q.jsx)(c,{disabled:!0,children:`Looking for browsers…`}):se.length===0?(0,Q.jsx)(c,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[se.map(e=>(0,Q.jsx)(c,{disabled:!r||s==null,onClick:()=>{r&&s!=null&&p({source:e,environmentId:s.environmentId,environmentName:pt({isPrimary:!0,environmentId:s.environmentId,runtimeLabel:s.label})})},children:e.name},e.id)),s==null?(0,Q.jsx)(c,{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:ee.map((e,t)=>{let n=E(e.id),a=e.id===te;return(0,Q.jsxs)(`div`,{className:V(`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:V(`truncate text-sm text-foreground`,B&&`opacity-64`),children:e.name}):(0,Q.jsx)(Ot,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:B||R,maxLength:48,value:e.name,onCommit:t=>ie(e.id,t)}),a?(0,Q.jsx)(`span`,{className:V(`flex`,B&&`opacity-64`),children:(0,Q.jsx)(h,{children:`Default`})}):null]}),(0,Q.jsxs)(D,{children:[(0,Q.jsx)(oe,{render:(0,Q.jsx)(P,{size:`icon-xs`,variant:`ghost-muted`,disabled:B||R,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(d,{})}),(0,Q.jsxs)(H,{align:`end`,children:[(0,Q.jsx)(c,{disabled:!r||a,onClick:()=>{r&&i({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(c,{disabled:!r||!I,onClick:()=>{F.environmentIds.length>0?x(e):ae(e.id,e.name)},children:`Clear cookies and cache`}),n?null:(0,Q.jsx)(c,{variant:`destructive`,disabled:!r||!I,onClick:()=>{r&&v(e)},children:`Remove profile and data`}),I?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{}),(0,Q.jsx)(c,{disabled:!0,children:o?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(ht,{open:_!==null,onOpenChange:e=>{!e&&!w&&(v(null),C(null))},children:(0,Q.jsxs)(bt,{children:[(0,Q.jsxs)(xt,{children:[(0,Q.jsxs)(St,{children:[`Remove “`,_?.name,`”?`]}),(0,Q.jsx)(wt,{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.`}),S?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:S}):null,I?null:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect to an environment to remove this profile and its data.`})]}),(0,Q.jsxs)(gt,{children:[(0,Q.jsx)(_t,{disabled:w,render:(0,Q.jsx)(P,{variant:`outline`,disabled:w}),children:`Cancel`}),(0,Q.jsx)(P,{variant:`destructive`,disabled:w||!r||!I,onClick:()=>{_&&r&&I&&U(_.id)},children:w?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(ht,{open:b!==null,onOpenChange:e=>{e||x(null)},children:(0,Q.jsxs)(bt,{children:[(0,Q.jsxs)(xt,{children:[(0,Q.jsxs)(St,{children:[`Clear “`,b?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(wt,{children:`You are signed out of its sites. Server browser tabs open in this profile close now.`})]}),(0,Q.jsxs)(gt,{children:[(0,Q.jsx)(_t,{render:(0,Q.jsx)(P,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(P,{variant:`destructive`,onClick:()=>{b&&ae(b.id,b.name),x(null)},children:`Clear data`})]})]})}),f?(0,Q.jsx)(vn,{source:f.source,destinationEnvironmentName:f.environmentName,targetProfiles:ee.map(e=>({id:e.id,name:e.name})),canCreateProfile:r&&!K,onImport:e=>ue(f.source,f.environmentId,e),onRefreshSource:()=>G(f.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await Se()?.shell.openSystemSettings(`full-disk-access`).catch(()=>{q.add({type:`error`,title:`Could not open System Settings`,description:`Open Privacy & Security → Full Disk Access manually.`})})},onClose:()=>p(null)}):null]})}function br(){let e=(0,Z.c)(3),t=!ke,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(yr,{disabled:t}),(0,Q.jsx)(Un,{disabled:t}),(0,Q.jsx)(Kn,{disabled:t}),(0,Q.jsx)(Yn,{disabled:t}),(0,Q.jsx)(tr,{disabled:t}),(0,Q.jsx)(Qn,{disabled:t}),(0,Q.jsx)(ar,{disabled:t}),(0,Q.jsx)(_r,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Dt,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(ut,{children:[i,(0,Q.jsxs)(ft,{id:`browser`,title:`Browser`,children:[t?(0,Q.jsx)(lt,{message:`Only available in the desktop app.`,children:r}):r,(0,Q.jsx)(lr,{}),(0,Q.jsx)(pr,{})]}),(0,Q.jsx)(hr,{})]}),e[2]=a):a=e[2],a}var xr=br;export{xr as component};
|
|
2
|
+
//# sourceMappingURL=settings.integrations-CujbsXfc.js.map
|
package/dist/client/assets/{settings.keybindings-Mt7J5TKC.js → settings.keybindings-CQ5xk9v3.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{$_ as i,$n as a,Ad as o,Bm as s,Ic as c,Jn as l,Sp as u,Wd as d,Yn as f,Yp as p,af as m,dr as h,ff as g,lm as _,q_ as v,rh as y,t as b,tr as x,ur as S}from"./utils-CBe1bHL7.js";import{R as C,W as w}from"./runtime-CeFhsGnm.js";import{a as T,c as E,o as D,s as O,t as k}from"./select-Cbpdz6n3.js";import{t as A}from"./useLocation-Cwv1HZ3K.js";import{i as j}from"./toast-C61oyZY1.js";import{f as M}from"./server-DvWrfyUO.js";import{i as ee,n as N,o as te}from"./session-D3gY-tOR.js";import{t as P}from"./use-atom-command-Bt7x9oO0.js";import{t as ne}from"./env-wK1YYxA8.js";import{a as F,n as I,t as L}from"./tooltip-ChmjT8Ns.js";import{t as R}from"./toggle-B03MQDgB.js";import{t as re}from"./input-DXGWoa4O.js";import{i as ie}from"./keybindings-DAHl8jIl.js";import{i as ae,o as oe,t as z}from"./popover-CogH2zM4.js";import{n as se,r as ce,t as B}from"./input-group-De0xZXfc.js";import{n as le,t as ue}from"./kbd-WWNLIkTn.js";import{V as de,W as fe,a as pe,i as me,s as he}from"./settingsLayout-DrhqvTJ8.js";import{a as V,c as ge,f as _e,i as ve,l as ye,m as H,n as be,o as xe,p as U,r as Se,s as Ce,t as we,u as Te}from"./KeybindingsSettings.logic-BA5WG7V2.js";import{vo as Ee,vr as De,yr as Oe}from"./main-DleJeMZO.js";var W=n(),G=e(t(),1),K=e(r(),1);function q(e){let t=(0,W.c)(6),{value:n}=e,r,i;if(t[0]!==n){let e=new Map,a=n.split(`+`).map(t=>{let n=e.get(t)??0;return e.set(t,n+1),{part:t,key:n===0?t:`${t}-${n}`}});r=le,i=a.map(ke),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a;return t[3]!==r||t[4]!==i?(a=(0,K.jsx)(r,{children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function ke(e){let{part:t,key:n}=e;return(0,K.jsx)(ue,{children:t===`mod`?navigator.platform.toLowerCase().includes(`mac`)?`⌘`:`Ctrl`:t===`shift`?`⇧`:t===`alt`?navigator.platform.toLowerCase().includes(`mac`)?`⌥`:`Alt`:t===`ctrl`?`⌃`:t.length===1?t.toUpperCase():t},n)}function Ae(e){let t=(0,W.c)(11),{query:n,onChange:r,inputRef:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(se,{children:(0,K.jsx)(_,{"aria-hidden":!0,className:`size-3.5`})}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=e=>r(e.currentTarget.value),t[1]=r,t[2]=o);let s;t[3]!==r||t[4]!==n?(s=e=>{e.key===`Escape`&&(e.preventDefault(),n.length>0?r(``):e.currentTarget.blur())},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==s?(c=(0,K.jsxs)(B,{className:`min-w-0 basis-full **:[input]:h-9 sm:basis-0 sm:flex-1 sm:**:[input]:h-8`,children:[a,(0,K.jsx)(ce,{ref:i,type:`search`,value:n,onChange:o,onKeyDown:s,placeholder:`Search keybindings`,"aria-label":`Search keybindings`,size:`sm`})]}),t[6]=i,t[7]=n,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function je(e,t){return e.type===t?[...je(e.left,t),...je(e.right,t)]:[e]}function J(e,t){let n=e[0];if(n)return e.slice(1).reduce((e,n)=>({type:t,left:e,right:n}),n)}function Me(e){return e.type===`identifier`?{identifier:e.name,negated:!1}:e.type===`not`&&e.node.type===`identifier`?{identifier:e.node.name,negated:!0}:null}function Ne(e,t){let n=Me(e);if(!n)return e;let r={type:`identifier`,name:t};return n.negated?{type:`not`,node:r}:r}function Pe(e,t){let n=Me(e);if(!n)return t?{type:`not`,node:e}:e;let r={type:`identifier`,name:n.identifier};return t?{type:`not`,node:r}:r}function Y(){return{type:`identifier`,name:we}}function Fe(e=`and`){return{type:e,left:Y(),right:{type:`not`,node:Y()}}}function Ie(e){let t=(0,W.c)(14),{label:n,focusable:r,className:i,children:a}=e,o=r===void 0||r?0:void 0,c;t[0]===i?c=t[1]:(c=b(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-warning outline-none transition-colors hover:bg-warning/10 focus-visible:ring-3 focus-visible:ring-inset focus-visible:ring-warning/25`,i),t[0]=i,t[1]=c);let l;t[2]!==n||t[3]!==o||t[4]!==c?(l=(0,K.jsx)(`span`,{tabIndex:o,"aria-label":n,className:c}),t[2]=n,t[3]=o,t[4]=c,t[5]=l):l=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(s,{className:`size-3.5`}),t[6]=u):u=t[6];let d;t[7]===l?d=t[8]:(d=(0,K.jsx)(F,{render:l,children:u}),t[7]=l,t[8]=d);let f;t[9]===a?f=t[10]:(f=(0,K.jsx)(I,{side:`top`,children:a}),t[9]=a,t[10]=f);let p;return t[11]!==d||t[12]!==f?(p=(0,K.jsxs)(L,{children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function Le(e){let t=(0,W.c)(5),{identifiers:n,focusable:r}=e,i=r===void 0||r;if(n.length===0)return null;let a;t[0]===n?a=t[1]:(a=n.length===1?`Unknown condition: ${n[0]}`:`Unknown conditions: ${n.join(`, `)}`,t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==o?(s=(0,K.jsx)(Ie,{label:o,focusable:i,className:`size-4.5`,children:`P4 Code does not recognize this condition yet. It can still be saved, but it may not match unless the runtime provides it.`}),t[2]=i,t[3]=o,t[4]=s):s=t[4],s}function X(e){let t=(0,W.c)(4),{labels:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.length===1?`Conflicts with ${n[0]}.`:`Conflicts with ${n.slice(0,3).join(`, `)}${n.length>3?`, and more`:``}.`,t[0]=n,t[1]=r);let i=r,a;return t[2]===i?a=t[3]:(a=(0,K.jsxs)(Ie,{label:i,children:[i,` The most recent matching binding wins when both conditions can apply.`]}),t[2]=i,t[3]=a),a}function Re(e){let t=(0,W.c)(25),{value:n,variables:r,unknownIdentifiers:i,onChange:a}=e,o;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>e===n,t[3]=n,t[4]=e),o=r.find(e),t[0]=n,t[1]=r,t[2]=o}else o=t[2];let s=o,c;t[5]!==s||t[6]!==n||t[7]!==r?(c=s||r.some(e=>e===n)?r:[n,...r],t[5]=s,t[6]=n,t[7]=r,t[8]=c):c=t[8];let l=c,u;t[9]===a?u=t[10]:(u=e=>e&&a(e),t[9]=a,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(E,{placeholder:`Condition`}),t[11]=d):d=t[11];let f;t[12]===i?f=t[13]:(f=i&&i.length>0?(0,K.jsx)(Le,{identifiers:i,focusable:!1}):null,t[12]=i,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,K.jsxs)(O,{size:`compact`,className:`min-w-0 flex-1`,children:[d,f]}),t[14]=f,t[15]=p);let m;t[16]===l?m=t[17]:(m=l.map(ze),t[16]=l,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,K.jsx)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:m}),t[18]=m,t[19]=h);let g;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==n?(g=(0,K.jsxs)(k,{value:n,onValueChange:u,children:[p,h]}),t[20]=u,t[21]=p,t[22]=h,t[23]=n,t[24]=g):g=t[24],g}function ze(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:e})},e)}function Be(e){let t=(0,W.c)(14),{label:n,className:r,onRemove:i}=e,a;t[0]===r?a=t[1]:(a=b(`size-7`,r),t[0]=r,t[1]=a);let o;t[2]!==n||t[3]!==i||t[4]!==a?(o=(0,K.jsx)(h,{type:`button`,variant:`ghost`,size:`icon-sm`,className:a,"aria-label":n,onClick:i}),t[2]=n,t[3]=i,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(u,{"aria-hidden":!0,className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]===o?c=t[8]:(c=(0,K.jsx)(F,{delay:200,render:o,children:s}),t[7]=o,t[8]=c);let l;t[9]===n?l=t[10]:(l=(0,K.jsx)(I,{side:`top`,children:n}),t[9]=n,t[10]=l);let d;return t[11]!==c||t[12]!==l?(d=(0,K.jsxs)(L,{children:[c,l]}),t[11]=c,t[12]=l,t[13]=d):d=t[13],d}function Z(e){let t=(0,W.c)(81),{node:n,variables:r,depth:i,onChange:a,onRemove:o}=e,s=i===void 0?0:i,c;if(t[0]!==s||t[1]!==n||t[2]!==a||t[3]!==o||t[4]!==r){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Me(n);if(e){let i=Ce(e.identifier)?[]:[e.identifier],l;t[6]!==n||t[7]!==a?(l=e=>a(Pe(n,e)),t[6]=n,t[7]=a,t[8]=l):l=t[8];let u=`Negate ${e.identifier}`,d;t[9]!==e||t[10]!==l||t[11]!==u?(d=(0,K.jsx)(R,{pressed:e.negated,onPressedChange:l,"aria-label":u,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[9]=e,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==n||t[14]!==a?(f=e=>a(Ne(n,e)),t[13]=n,t[14]=a,t[15]=f):f=t[15];let p;t[16]!==e||t[17]!==f||t[18]!==i||t[19]!==r?(p=(0,K.jsx)(Re,{value:e.identifier,variables:r,unknownIdentifiers:i,onChange:f}),t[16]=e,t[17]=f,t[18]=i,t[19]=r,t[20]=p):p=t[20];let m;t[21]!==s||t[22]!==n||t[23]!==o?(m=o?(0,K.jsx)(Be,{label:H(n,s),onRemove:o}):null,t[21]=s,t[22]=n,t[23]=o,t[24]=m):m=t[24];let h;t[25]!==d||t[26]!==p||t[27]!==m?(h=(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border/70 bg-background/60 px-2 py-2`,children:[d,p,m]}),t[25]=d,t[26]=p,t[27]=m,t[28]=h):h=t[28],c=h;break bb0}}t[0]=s,t[1]=n,t[2]=a,t[3]=o,t[4]=r,t[5]=c}else c=t[5];if(c!==Symbol.for(`react.early_return_sentinel`))return c;if(n.type===`not`){let e=s>0&&`border-border/50 bg-background/50`,i;t[29]===e?i=t[30]:(i=b(`space-y-2 rounded-lg border border-border/70 bg-muted/20 p-2`,e),t[29]=e,t[30]=i);let c;t[31]!==n||t[32]!==a?(c=(0,K.jsx)(R,{pressed:!0,onPressedChange:e=>a(e?n:n.node),"aria-label":`Negate group`,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[31]=n,t[32]=a,t[33]=c):c=t[33];let l;t[34]!==s||t[35]!==n||t[36]!==o?(l=o?(0,K.jsx)(Be,{label:H(n,s),className:`ml-auto`,onRemove:o}):null,t[34]=s,t[35]=n,t[36]=o,t[37]=l):l=t[37];let u;t[38]!==c||t[39]!==l?(u=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c,l]}),t[38]=c,t[39]=l,t[40]=u):u=t[40];let d,f;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(`span`,{className:`absolute top-0 bottom-0 left-1.5 w-px bg-border/70`,"aria-hidden":!0}),f=(0,K.jsx)(`span`,{className:`absolute top-4 left-1.5 h-px w-2.5 bg-border/70`,"aria-hidden":!0}),t[41]=d,t[42]=f):(d=t[41],f=t[42]);let p=s+1,m;t[43]===a?m=t[44]:(m=e=>a({type:`not`,node:e}),t[43]=a,t[44]=m);let h;t[45]!==n.node||t[46]!==p||t[47]!==m||t[48]!==r?(h=(0,K.jsxs)(`div`,{className:`relative pl-4`,children:[d,f,(0,K.jsx)(Z,{node:n.node,variables:r,depth:p,onChange:m})]}),t[45]=n.node,t[46]=p,t[47]=m,t[48]=r,t[49]=h):h=t[49];let g;return t[50]!==h||t[51]!==i||t[52]!==u?(g=(0,K.jsxs)(`div`,{className:i,children:[u,h]}),t[50]=h,t[51]=i,t[52]=u,t[53]=g):g=t[53],g}let l=n.type===`or`?`or`:`and`,u,d,f,m;if(t[54]!==s||t[55]!==n||t[56]!==a||t[57]!==o||t[58]!==l||t[59]!==r){let e=je(n,l),i=new Map,c=e.map(e=>{let t=`${e.type}-${U(e)}`,n=i.get(t)??0;return i.set(t,n+1),{child:e,key:n===0?t:`${t}-${n}`}}),g=(t,n)=>{let r=!1,i=J(e.map(e=>!r&&e===t?(r=!0,n):e),l);i&&a(i)},_=t=>{let n=!1,r=J(e.filter(e=>!n&&e===t?(n=!0,!1):!0),l);a(r||Y())},v=t=>{if(t===l)return;let n=J(e,t);n&&a(n)},y=()=>{let t=J([...e,Y()],l);t&&a(t)},x=()=>{let t={type:l===`and`?`or`:`and`,left:Y(),right:{type:`not`,node:Y()}},n=J([...e,t],l);n&&a(n)},S=s>0&&`border-border/70 bg-background/55`;t[64]===S?f=t[65]:(f=b(`space-y-2 rounded-lg border border-border/60 bg-muted/10 p-2`,S),t[64]=S,t[65]=f);let C;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,K.jsx)(O,{size:`compact`,className:`w-24`,children:(0,K.jsx)(E,{})}),t[66]=C):C=t[66];let w;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsxs)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,children:[(0,K.jsx)(T,{value:`and`,children:`and`}),(0,K.jsx)(T,{value:`or`,children:`or`})]}),t[67]=w):w=t[67];let A;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,K.jsx)(p,{className:`size-3.5`}),t[68]=A):A=t[68];let j;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,K.jsx)(p,{className:`size-3.5`}),t[69]=j):j=t[69];let M;t[70]!==s||t[71]!==n||t[72]!==o?(M=o?(0,K.jsx)(Be,{label:H(n,s),className:`ml-auto`,onRemove:o}):null,t[70]=s,t[71]=n,t[72]=o,t[73]=M):M=t[73],m=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(k,{value:l,onValueChange:e=>v(e),children:[C,w]}),(0,K.jsxs)(h,{type:`button`,variant:`outline`,size:`compact`,onClick:y,children:[A,`Condition`]}),(0,K.jsxs)(h,{type:`button`,variant:`outline`,size:`compact`,onClick:x,children:[j,`Group`]}),M]}),u=`space-y-2`,d=c.map(e=>{let{child:t,key:n}=e;return(0,K.jsxs)(`div`,{className:`relative pl-4`,children:[(0,K.jsx)(`span`,{className:b(`absolute top-0 bottom-0 left-1.5 w-px`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,K.jsx)(`span`,{className:b(`absolute top-4 left-1.5 h-px w-2.5`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,K.jsx)(Z,{node:t,variables:r,depth:s+1,onChange:e=>g(t,e),onRemove:()=>_(t)})]},n)}),t[54]=s,t[55]=n,t[56]=a,t[57]=o,t[58]=l,t[59]=r,t[60]=u,t[61]=d,t[62]=f,t[63]=m}else u=t[60],d=t[61],f=t[62],m=t[63];let g;t[74]!==u||t[75]!==d?(g=(0,K.jsx)(`div`,{className:u,children:d}),t[74]=u,t[75]=d,t[76]=g):g=t[76];let _;return t[77]!==f||t[78]!==m||t[79]!==g?(_=(0,K.jsxs)(`div`,{className:f,children:[m,g]}),t[77]=f,t[78]=m,t[79]=g,t[80]=_):_=t[80],_}function Ve(e){let t=(0,W.c)(60),{value:n,variables:r,onChange:i,onValidityChange:a}=e,o;t[0]===n?o=t[1]:(o=U(n),t[0]=n,t[1]=o);let[s,c]=(0,G.useState)(o),l;t[2]===s?l=t[3]:(l=Te(s),t[2]=s,t[3]=l);let u=l,f=u.ok?null:u.message,m;t[4]!==u.ok||t[5]!==u.value?(m=u.ok?_e(u.value):[],t[4]=u.ok,t[5]=u.value,t[6]=m):m=t[6];let g=m,_;t[7]!==i||t[8]!==a?(_=e=>{c(e);let t=Te(e);a?.(t.ok),t.ok&&i(t.value)},t[7]=i,t[8]=a,t[9]=_):_=t[9];let v=_,y;t[10]!==i||t[11]!==a?(y=e=>{c(U(e)),a?.(!0),i(e)},t[10]=i,t[11]=a,t[12]=y):y=t[12];let b=y,x;t[13]!==b||t[14]!==n?(x=()=>{if(!n){b(Y());return}b({type:`and`,left:n,right:Y()})},t[13]=b,t[14]=n,t[15]=x):x=t[15];let S=x,C;t[16]!==b||t[17]!==n?(C=()=>{let e=Fe(`or`);if(!n){b(e);return}b({type:`and`,left:n,right:e})},t[16]=b,t[17]=n,t[18]=C):C=t[18];let w=C,T;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,K.jsx)(`div`,{className:`min-w-0`,children:(0,K.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`When`})}),t[19]=T):T=t[19];let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,K.jsx)(p,{className:`size-3.5`}),t[20]=E):E=t[20];let D;t[21]===S?D=t[22]:(D=(0,K.jsxs)(h,{type:`button`,variant:`outline`,size:`compact`,onClick:S,children:[E,`Condition`]}),t[21]=S,t[22]=D);let O;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,K.jsx)(p,{className:`size-3.5`}),t[23]=O):O=t[23];let k;t[24]===w?k=t[25]:(k=(0,K.jsxs)(h,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[O,`Group`]}),t[24]=w,t[25]=k);let A;t[26]!==D||t[27]!==k?(A=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[D,k]})]}),t[26]=D,t[27]=k,t[28]=A):A=t[28];let j;t[29]===v?j=t[30]:(j=e=>v(e.currentTarget.value),t[29]=v,t[30]=j);let M=!!f,ee;t[31]!==s||t[32]!==j||t[33]!==M?(ee=(0,K.jsx)(ce,{value:s,onChange:j,placeholder:`Always`,"aria-invalid":M,"aria-label":`When expression`,size:`compact`,font:`mono`}),t[31]=s,t[32]=j,t[33]=M,t[34]=ee):ee=t[34];let N;t[35]===g?N=t[36]:(N=g.length>0?(0,K.jsx)(se,{align:`inline-end`,children:(0,K.jsx)(Le,{identifiers:g})}):null,t[35]=g,t[36]=N);let te;t[37]!==ee||t[38]!==N?(te=(0,K.jsxs)(B,{children:[ee,N]}),t[37]=ee,t[38]=N,t[39]=te):te=t[39];let P;t[40]===f?P=t[41]:(P=f?(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-2xs text-destructive`,children:[(0,K.jsx)(d,{className:`size-3.5`}),f]}):null,t[40]=f,t[41]=P);let ne;t[42]!==te||t[43]!==P?(ne=(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[te,P]}),t[42]=te,t[43]=P,t[44]=ne):ne=t[44];let F;t[45]!==S||t[46]!==w||t[47]!==b||t[48]!==n||t[49]!==r?(F=n?(0,K.jsx)(Z,{node:n,variables:r,onChange:b,onRemove:()=>b(void 0)}):(0,K.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/15 p-3`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(h,{type:`button`,size:`compact`,onClick:S,children:[(0,K.jsx)(p,{className:`size-3.5`}),`Condition`]}),(0,K.jsxs)(h,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[(0,K.jsx)(p,{className:`size-3.5`}),`Group`]})]})}),t[45]=S,t[46]=w,t[47]=b,t[48]=n,t[49]=r,t[50]=F):F=t[50];let I;t[51]===f?I=t[52]:(I=f?(0,K.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center rounded-lg border border-destructive/30 bg-background/75 p-4 text-center text-xs text-destructive backdrop-blur-xs`,children:`Fix the expression above to continue editing visually.`}):null,t[51]=f,t[52]=I);let L;t[53]!==F||t[54]!==I?(L=(0,K.jsxs)(`div`,{className:`relative`,children:[F,I]}),t[53]=F,t[54]=I,t[55]=L):L=t[55];let R;return t[56]!==A||t[57]!==ne||t[58]!==L?(R=(0,K.jsxs)(`div`,{className:`w-[min(34rem,calc(100vw-2rem))] space-y-3`,children:[A,ne,L]}),t[56]=A,t[57]=ne,t[58]=L,t[59]=R):R=t[59],R}function He(e){return{keyDraft:e.key,whenDraft:e.binding.whenAst,isRecording:!1,isWhenDraftValid:!0}}function Q(e,t){return{...e,...t}}function Ue(e){return{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}}function We(e){let t=(0,W.c)(27),{row:n,allRows:r,onSave:i}=e,[a,o]=(0,G.useReducer)(Q,n,He),{keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u}=a,d,f,p;t[0]!==r||t[1]!==s||t[2]!==n.id||t[3]!==n.key||t[4]!==n.when||t[5]!==c?(p=U(c),d=s!==n.key||p!==n.when,f=ge(r,{rowId:n.id,key:s,when:p}),t[0]=r,t[1]=s,t[2]=n.id,t[3]=n.key,t[4]=n.when,t[5]=c,t[6]=d,t[7]=f,t[8]=p):(d=t[6],f=t[7],p=t[8]);let m=f,h;t[9]!==s||t[10]!==i||t[11]!==n||t[12]!==p?(h=()=>{i({command:n.command,key:s,when:p.trim().length>0?p:void 0,replace:Ue(n)})},t[9]=s,t[10]=i,t[11]=n,t[12]=p,t[13]=h):h=t[13];let g=h,_;t[14]!==l||t[15]!==n.key?(_=e=>{if(e.key===`Tab`&&!l)return;if(e.preventDefault(),e.key===`Escape`){o({keyDraft:n.key,isRecording:!1});return}let t=ye(e.nativeEvent,navigator.platform);t&&o({keyDraft:t,isRecording:!1})},t[14]=l,t[15]=n.key,t[16]=_):_=t[16];let v=_,y;return t[17]!==v||t[18]!==m||t[19]!==d||t[20]!==l||t[21]!==u||t[22]!==s||t[23]!==g||t[24]!==c||t[25]!==p?(y={keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u,whenDraftExpression:p,isDirty:d,conflictLabels:m,setDraft:o,save:g,captureKeybinding:v},t[17]=v,t[18]=m,t[19]=d,t[20]=l,t[21]=u,t[22]=s,t[23]=g,t[24]=c,t[25]=p,t[26]=y):y=t[26],y}function Ge(e){let t=(0,W.c)(19),{row:n,editor:r,isSaving:i,pillClassName:a}=e,{keyDraft:o,isRecording:s,isDirty:c,isWhenDraftValid:l,setDraft:u,save:d,captureKeybinding:f}=r,p=!s&&o===n.key&&n.key.length>0&&!c,m;t[0]!==c||t[1]!==i||t[2]!==l||t[3]!==o||t[4]!==d?(m=c?(0,K.jsx)(h,{size:`sm`,disabled:i||o.trim().length===0||!l,onClick:d,children:i?`Saving`:`Save`}):null,t[0]=c,t[1]=i,t[2]=l,t[3]=o,t[4]=d,t[5]=m):m=t[5];let g;t[6]!==f||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==n.binding||t[11]!==n.command||t[12]!==n.key||t[13]!==u||t[14]!==p?(g=p?(0,K.jsx)(`button`,{type:`button`,onClick:()=>u({isRecording:!0}),"aria-label":`Edit shortcut for ${V(n.command)}: ${ie(n.binding.shortcut)}`,className:b(`inline-flex h-8 cursor-pointer items-center rounded-md border border-transparent px-1.5 sm:h-7 outline-none transition-colors hover:border-border/70 hover:bg-accent focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-inset focus-visible:ring-ring/24`,a),children:(0,K.jsx)(q,{value:n.key})}):(0,K.jsx)(re,{"data-keybinding-capture":``,autoFocus:s,"aria-label":`Keybinding for ${V(n.command)}`,value:s?``:o,placeholder:s?`Press shortcut`:`Unassigned`,size:`sm`,font:`mono`,className:`w-44`,onFocus:()=>u({isRecording:!0}),onBlur:()=>u({isRecording:!1}),onChange:e=>u({keyDraft:e.currentTarget.value}),onKeyDown:f}),t[6]=f,t[7]=s,t[8]=o,t[9]=a,t[10]=n.binding,t[11]=n.command,t[12]=n.key,t[13]=u,t[14]=p,t[15]=g):g=t[15];let _;return t[16]!==m||t[17]!==g?(_=(0,K.jsxs)(K.Fragment,{children:[m,g]}),t[16]=m,t[17]=g,t[18]=_):_=t[18],_}function $(e){let t=(0,W.c)(17),{label:n,expression:r,value:i,variables:a,onChange:s,onValidityChange:c}=e,l=r?`ghost`:`ghost-muted`,u;t[0]===l?u=t[1]:(u=(0,K.jsx)(h,{variant:l,size:`micro`,className:`min-w-0 shrink`}),t[0]=l,t[1]=u);let d=`Edit when clause for ${n}`,f=r||`Always`,p;t[2]===f?p=t[3]:(p=(0,K.jsx)(`span`,{className:`truncate font-mono`,children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,K.jsx)(o,{className:`size-3.5 shrink-0 opacity-60`}),t[4]=m):m=t[4];let g;t[5]!==u||t[6]!==d||t[7]!==p?(g=(0,K.jsxs)(oe,{render:u,"aria-label":d,children:[p,m]}),t[5]=u,t[6]=d,t[7]=p,t[8]=g):g=t[8];let _;t[9]!==s||t[10]!==c||t[11]!==i||t[12]!==a?(_=(0,K.jsx)(ae,{align:`start`,sideOffset:6,children:(0,K.jsx)(Ve,{value:i,variables:a,onChange:s,onValidityChange:c})}),t[9]=s,t[10]=c,t[11]=i,t[12]=a,t[13]=_):_=t[13];let v;return t[14]!==g||t[15]!==_?(v=(0,K.jsxs)(z,{children:[g,_]}),t[14]=g,t[15]=_,t[16]=v):v=t[16],v}function Ke(e){let t=(0,W.c)(24),{row:n,isSaving:r,onReset:i,onRemove:o}=e,s=n.source===`Custom`&&n.defaultKey!==null,c=n.source!==`Default`;if(!s&&!c)return null;let l;t[0]===n.command?l=t[1]:(l=V(n.command),t[0]=n.command,t[1]=l);let u=`Actions for ${l}`,d;t[2]!==r||t[3]!==u?(d=(0,K.jsx)(h,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:r,"aria-label":u}),t[2]=r,t[3]=u,t[4]=d):d=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,K.jsx)(m,{className:`size-3.5`}),t[5]=p):p=t[5];let g;t[6]===d?g=t[7]:(g=(0,K.jsx)(S,{render:d,children:p}),t[6]=d,t[7]=g);let _;t[8]!==s||t[9]!==r||t[10]!==i||t[11]!==n?(_=s?(0,K.jsx)(a,{disabled:r,onClick:()=>i(n),children:`Reset to default`}):null,t[8]=s,t[9]=r,t[10]=i,t[11]=n,t[12]=_):_=t[12];let v;t[13]!==c||t[14]!==r||t[15]!==o||t[16]!==n?(v=c?(0,K.jsx)(a,{variant:`destructive`,disabled:r,onClick:()=>o(n),children:`Remove`}):null,t[13]=c,t[14]=r,t[15]=o,t[16]=n,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,K.jsxs)(x,{align:`end`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==g||t[22]!==y?(b=(0,K.jsxs)(f,{children:[g,y]}),t[21]=g,t[22]=y,t[23]=b):b=t[23],b}function qe(e){let t=(0,W.c)(2),{source:n}=e;if(n===`Default`)return null;let r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(l,{variant:`outline`,size:`sm`,children:n}),t[0]=n,t[1]=r),r}function Je(e){let t=(0,W.c)(13),{row:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsx)(`span`,{className:`flex items-center gap-2`}),t[0]=r):r=t[0];let i;t[1]===n.command?i=t[2]:(i=V(n.command),t[1]=n.command,t[2]=i);let a;t[3]===n.source?a=t[4]:(a=(0,K.jsx)(qe,{source:n.source}),t[3]=n.source,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,K.jsxs)(F,{render:r,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7];let s;t[8]===n.command?s=t[9]:(s=(0,K.jsx)(I,{side:`top`,children:n.command}),t[8]=n.command,t[9]=s);let c;return t[10]!==o||t[11]!==s?(c=(0,K.jsxs)(L,{children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Ye(e){let t=(0,W.c)(13),{row:n,editor:r,variables:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[0]=a):a=t[0];let o;t[1]===n.command?o=t[2]:(o=V(n.command),t[1]=n.command,t[2]=o);let s,c;t[3]===r?(s=t[4],c=t[5]):(s=e=>r.setDraft({whenDraft:e}),c=e=>r.setDraft({isWhenDraftValid:e}),t[3]=r,t[4]=s,t[5]=c);let l;return t[6]!==r.whenDraft||t[7]!==r.whenDraftExpression||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==i?(l=(0,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[a,(0,K.jsx)($,{label:o,expression:r.whenDraftExpression,value:r.whenDraft,variables:i,onChange:s,onValidityChange:c})]}),t[6]=r.whenDraft,t[7]=r.whenDraftExpression,t[8]=o,t[9]=s,t[10]=c,t[11]=i,t[12]=l):l=t[12],l}function Xe(e){let t=(0,W.c)(2),n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(`span`,{className:`flex items-center opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100 has-data-popup-open:opacity-100 pointer-coarse:opacity-100`,children:(0,K.jsx)(Ke,{...e})}),t[0]=e,t[1]=n),n}function Ze(e){let t=(0,W.c)(30),{row:n,isSaving:r,anchorId:i,allRows:a,variables:o,onSave:s,onReset:c,onRemove:l}=e,u;t[0]!==a||t[1]!==s||t[2]!==n?(u={row:n,allRows:a,onSave:s},t[0]=a,t[1]=s,t[2]=n,t[3]=u):u=t[3];let d=We(u),f;t[4]===n?f=t[5]:(f=(0,K.jsx)(Je,{row:n}),t[4]=n,t[5]=f);let p;t[6]!==d||t[7]!==n||t[8]!==o?(p=(0,K.jsx)(Ye,{row:n,editor:d,variables:o}),t[6]=d,t[7]=n,t[8]=o,t[9]=p):p=t[9];let m;t[10]===d.conflictLabels?m=t[11]:(m=(0,K.jsx)(X,{labels:d.conflictLabels}),t[10]=d.conflictLabels,t[11]=m);let h;t[12]!==r||t[13]!==l||t[14]!==c||t[15]!==n?(h=(0,K.jsx)(Xe,{row:n,isSaving:r,onReset:c,onRemove:l}),t[12]=r,t[13]=l,t[14]=c,t[15]=n,t[16]=h):h=t[16];let g;t[17]!==d||t[18]!==r||t[19]!==n?(g=(0,K.jsx)(Ge,{row:n,editor:d,isSaving:r,pillClassName:`-mr-1.5`}),t[17]=d,t[18]=r,t[19]=n,t[20]=g):g=t[20];let _;t[21]!==m||t[22]!==h||t[23]!==g?(_=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[m,h,g]}),t[21]=m,t[22]=h,t[23]=g,t[24]=_):_=t[24];let v;return t[25]!==i||t[26]!==f||t[27]!==p||t[28]!==_?(v=(0,K.jsx)(pe,{id:i,className:`group/row rounded-none`,title:f,description:p,control:_}),t[25]=i,t[26]=f,t[27]=p,t[28]=_,t[29]=v):v=t[29],v}function Qe(e){let t=(0,W.c)(30),{allRows:n,onSave:r}=e,[i,a]=(0,G.useState)(``),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={keyDraft:``,whenDraft:void 0,isRecording:!1,isWhenDraftValid:!0},t[0]=o):o=t[0];let[s,c]=(0,G.useReducer)(Q,o),{keyDraft:l,whenDraft:u,isRecording:d,isWhenDraftValid:f}=s,p,m;t[1]!==n||t[2]!==l||t[3]!==u?(m=U(u),p=ge(n,{rowId:`new`,key:l,when:m}),t[1]=n,t[2]=l,t[3]=u,t[4]=p,t[5]=m):(p=t[4],m=t[5]);let h=p,g;t[6]===i?g=t[7]:(g=i?V(i):`new keybinding`,t[6]=i,t[7]=g);let _=g,v;t[8]!==i||t[9]!==f||t[10]!==l?(v=!!i&&l.trim().length>0&&f,t[8]=i,t[9]=f,t[10]=l,t[11]=v):v=t[11];let y=v,b;t[12]!==i||t[13]!==l||t[14]!==r||t[15]!==m?(b=()=>{i&&r({command:i,key:l,...m.trim().length>0?{when:m}:{}})},t[12]=i,t[13]=l,t[14]=r,t[15]=m,t[16]=b):b=t[16];let x=b,S;t[17]===d?S=t[18]:(S=e=>{if(e.key===`Tab`&&!d)return;if(e.preventDefault(),e.key===`Escape`){c({keyDraft:``,isRecording:!1});return}let t=ye(e.nativeEvent,navigator.platform);t&&c({keyDraft:t,isRecording:!1})},t[17]=d,t[18]=S);let C=S,w;return t[19]!==y||t[20]!==C||t[21]!==i||t[22]!==_||t[23]!==h||t[24]!==d||t[25]!==l||t[26]!==x||t[27]!==u||t[28]!==m?(w={commandDraft:i,setCommandDraft:a,keyDraft:l,whenDraft:u,whenDraftExpression:m,isRecording:d,conflictLabels:h,commandLabelText:_,canSave:y,setDraft:c,save:x,captureKeybinding:C},t[19]=y,t[20]=C,t[21]=i,t[22]=_,t[23]=h,t[24]=d,t[25]=l,t[26]=x,t[27]=u,t[28]=m,t[29]=w):w=t[29],w}function $e(e){let t=(0,W.c)(14),{draft:n,commandOptions:r,className:i}=e,a=n.commandDraft,o;t[0]===n?o=t[1]:(o=e=>n.setCommandDraft(e),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(E,{placeholder:`Command`}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,K.jsx)(O,{size:`sm`,className:i,children:s}),t[3]=i,t[4]=c);let l;t[5]===r?l=t[6]:(l=r.map(et),t[5]=r,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,K.jsx)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n.commandDraft||t[10]!==o||t[11]!==c||t[12]!==u?(d=(0,K.jsxs)(k,{value:a,onValueChange:o,children:[c,u]}),t[9]=n.commandDraft,t[10]=o,t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function et(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:V(e)})},e)}function tt(e){let t=(0,W.c)(14),{draft:n,autoFocus:r,className:i}=e,a=r!==void 0&&r,o=`Keybinding for ${n.commandLabelText}`,s=n.isRecording?``:n.keyDraft,c=n.isRecording?`Press shortcut`:`Unassigned`,l,u,d;t[0]===n?(l=t[1],u=t[2],d=t[3]):(l=()=>n.setDraft({isRecording:!0}),u=()=>n.setDraft({isRecording:!1}),d=e=>n.setDraft({keyDraft:e.currentTarget.value}),t[0]=n,t[1]=l,t[2]=u,t[3]=d);let f;return t[4]!==a||t[5]!==i||t[6]!==n.captureKeybinding||t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,K.jsx)(re,{"data-keybinding-capture":``,autoFocus:a,"aria-label":o,value:s,placeholder:c,size:`sm`,font:`mono`,className:i,onFocus:l,onBlur:u,onChange:d,onKeyDown:n.captureKeybinding}),t[4]=a,t[5]=i,t[6]=n.captureKeybinding,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function nt(e){let t=(0,W.c)(10),{draft:n,variables:r}=e,i,a;t[0]===n?(i=t[1],a=t[2]):(i=e=>n.setDraft({whenDraft:e}),a=e=>n.setDraft({isWhenDraftValid:e}),t[0]=n,t[1]=i,t[2]=a);let o;return t[3]!==n.commandLabelText||t[4]!==n.whenDraft||t[5]!==n.whenDraftExpression||t[6]!==i||t[7]!==a||t[8]!==r?(o=(0,K.jsx)($,{label:n.commandLabelText,expression:n.whenDraftExpression,value:n.whenDraft,variables:r,onChange:i,onValidityChange:a}),t[3]=n.commandLabelText,t[4]=n.whenDraft,t[5]=n.whenDraftExpression,t[6]=i,t[7]=a,t[8]=r,t[9]=o):o=t[9],o}function rt(e){let t=(0,W.c)(9),{isSaving:n,onCancel:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,K.jsx)(h,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:n,"aria-label":`Cancel new keybinding`,onClick:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(y,{className:`size-3.5`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,K.jsx)(F,{render:i,children:a}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(I,{side:`top`,children:`Cancel`}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,K.jsxs)(L,{children:[o,s]}),t[7]=o,t[8]=c),c}function it(e){let t=(0,W.c)(30),{commandOptions:n,allRows:r,variables:i,isSaving:a,onSave:o,onCancel:s}=e,c;t[0]!==r||t[1]!==o?(c={allRows:r,onSave:o},t[0]=r,t[1]=o,t[2]=c):c=t[2];let l=Qe(c),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[3]=u):u=t[3];let d;t[4]!==l||t[5]!==i?(d=(0,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[u,(0,K.jsx)(nt,{draft:l,variables:i})]}),t[4]=l,t[5]=i,t[6]=d):d=t[6];let f;t[7]!==n||t[8]!==l?(f=(0,K.jsx)($e,{draft:l,commandOptions:n,className:`w-56`}),t[7]=n,t[8]=l,t[9]=f):f=t[9];let p;t[10]===l.conflictLabels?p=t[11]:(p=(0,K.jsx)(X,{labels:l.conflictLabels}),t[10]=l.conflictLabels,t[11]=p);let m;t[12]===l?m=t[13]:(m=(0,K.jsx)(tt,{draft:l,className:`w-44`}),t[12]=l,t[13]=m);let g=a||!l.canSave,_=a?`Saving`:`Save`,v;t[14]!==l.save||t[15]!==g||t[16]!==_?(v=(0,K.jsx)(h,{size:`sm`,disabled:g,onClick:l.save,children:_}),t[14]=l.save,t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==s?(y=(0,K.jsx)(rt,{isSaving:a,onCancel:s}),t[18]=a,t[19]=s,t[20]=y):y=t[20];let b;t[21]!==f||t[22]!==p||t[23]!==m||t[24]!==v||t[25]!==y?(b=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f,p,m,v,y]}),t[21]=f,t[22]=p,t[23]=m,t[24]=v,t[25]=y,t[26]=b):b=t[26];let x;return t[27]!==b||t[28]!==d?(x=(0,K.jsx)(pe,{className:`bg-muted/15`,title:`New keybinding`,description:d,control:b}),t[27]=b,t[28]=d,t[29]=x):x=t[29],x}function at(e){let{groups:t,anchorIds:n,savingCommand:r,...i}=e;return t.map(e=>(0,K.jsx)(he,{id:`keybindings-${e.id}`,title:e.title,children:e.rows.map(e=>(0,K.jsx)(Ze,{row:e,anchorId:n.get(e.id),isSaving:r===e.command,...i},e.id))},e.id))}function ot(){let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{delay:200,render:(0,K.jsx)(h,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":`The browser may claim some shortcuts first. The desktop app receives them all.`,children:(0,K.jsx)(s,{className:`size-3.5 text-warning`})})}),(0,K.jsx)(I,{side:`top`,className:`max-w-72`,children:`The browser may claim some shortcuts first. The desktop app receives them all.`})]}),e[0]=t):t=e[0],t}function st(){let e=(0,W.c)(83),{environment:t,connectedEnvironments:n}=de(),r=ee(t?.environmentId??null,v),a=te(n,i),o;e[0]!==n||e[1]!==a?(o=n.length>0&&n.every(e=>a.has(e.environmentId)),e[0]=n,e[1]=a,e[2]=o):o=e[2];let s=o,l=t?.serverConfig?.keybindings,u;e[3]===l?u=e[4]:(u=l??[],e[3]=l,e[4]=u);let d;e[5]===u?d=e[6]:(d=c(u),e[5]=u,e[6]=d);let f=d,m=t?.serverConfig?.keybindingsConfigPath??null,_;e[7]===t?.serverConfig?.availableEditors?_=e[8]:(_=t?.serverConfig?.availableEditors??[],e[7]=t?.serverConfig?.availableEditors,e[8]=_);let y=_,b;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},e[9]=b):b=e[9];let x=P(M.upsertKeybinding,b),S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S={reportFailure:!1},e[10]=S):S=e[10];let T=P(M.removeKeybinding,S),E=Ee(t?.environmentId??null,y),[D,O]=(0,G.useState)(``),k=(0,G.useRef)(null),[R,re]=(0,G.useState)(null),[ie,ae]=(0,G.useState)(!1),oe;e[11]!==f||e[12]!==D?(oe=Se(f,D),e[11]=f,e[12]=D,e[13]=oe):oe=e[13];let z=oe,se;e[14]===z?se=e[15]:(se=xe(z),e[14]=z,e[15]=se);let ce=se,B;if(e[16]!==z){B=new Map;let t=new Set;for(let e of z)t.has(e.command)||(t.add(e.command),B.set(e.id,De(e.command)));e[16]=z,e[17]=B}else B=e[17];let le=B,ue;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(ue={select:ft},e[18]=ue):ue=e[18];let pe=A(ue),[V,ge]=(0,G.useState)(pe);pe!==V&&(ge(pe),pe.startsWith(`keybinding-`)&&O(``));let _e;e[19]===f?_e=e[20]:(_e=be(f),e[19]=f,e[20]=_e);let ye=_e,H;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(H=ve(),e[21]=H):H=e[21];let U=H,Ce;e[22]!==m||e[23]!==E||e[24]!==t?(Ce=()=>{m&&t&&N(t.environmentId,`orchestration:operate`)&&(async()=>{let e=await E(m);if(e._tag===`Success`||C(e))return;let t=w(e);j.add({title:`Unable to open keybindings file`,description:t instanceof Error?t.message:`The keybindings file was not opened.`,type:`error`})})()},e[22]=m,e[23]=E,e[24]=t,e[25]=Ce):Ce=e[25];let we=Ce,Te;e[26]!==n||e[27]!==t||e[28]!==x?(Te=e=>{if(!t||!n.every(dt))return;re(e.command);let r={command:e.command,key:e.key.trim(),...e.when?.trim()?{when:e.when.trim()}:{},...e.replace?{replace:e.replace}:{}};(async()=>{let e=await Promise.all(n.map(e=>x({environmentId:e.environmentId,input:r})));re(null);let t=e.find(ut);if(!t){ae(!1);return}if(!C(t)){let e=w(t);j.add({title:`Unable to save keybinding`,description:e instanceof Error?e.message:`The keybinding was not saved.`,type:`error`})}})()},e[26]=n,e[27]=t,e[28]=x,e[29]=Te):Te=e[29];let q=Te,ke;e[30]!==n||e[31]!==t||e[32]!==T?(ke=e=>{t&&n.every(lt)&&(re(e.command),(async()=>{let t=await Promise.all(n.map(t=>T({environmentId:t.environmentId,input:Ue(e)})));re(null);let r=t.find(ct)??t[0];if(r?._tag===`Failure`&&!C(r)){let e=w(r);j.add({title:`Unable to remove keybinding`,description:e instanceof Error?e.message:`The keybinding was not removed.`,type:`error`})}})())},e[30]=n,e[31]=t,e[32]=T,e[33]=ke):ke=e[33];let je=ke,J;e[34]===q?J=e[35]:(J=e=>{e.defaultKey&&q({command:e.command,key:e.defaultKey,when:e.defaultWhen.trim().length>0?e.defaultWhen:void 0,replace:{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}})},e[34]=q,e[35]=J);let Me=J,Ne;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>ae(!1),e[36]=Ne):Ne=e[36];let Pe=Ne,Y;e[37]!==je||e[38]!==Me||e[39]!==z||e[40]!==q?(Y={allRows:z,variables:U,onSave:q,onReset:Me,onRemove:je},e[37]=je,e[38]=Me,e[39]=z,e[40]=q,e[41]=Y):Y=e[41];let Fe=Y,Ie,Le;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=Oe(`keybindings`),Le=ne?null:(0,K.jsx)(ot,{}),e[42]=Ie,e[43]=Le):(Ie=e[42],Le=e[43]);let X;e[44]===D?X=e[45]:(X=(0,K.jsx)(Ae,{query:D,onChange:O,inputRef:k}),e[44]=D,e[45]=X);let Re=ie||!s,ze,Be;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>ae(!0),Be=(0,K.jsx)(p,{"aria-hidden":!0,className:`size-4`}),e[46]=ze,e[47]=Be):(ze=e[46],Be=e[47]);let Z;e[48]===Re?Z=e[49]:(Z=(0,K.jsxs)(h,{type:`button`,variant:`outline`,disabled:Re,onClick:ze,children:[Be,`Add keybinding`]}),e[48]=Re,e[49]=Z);let Ve=!m||!r,He;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,K.jsx)(g,{"aria-hidden":!0,className:`size-4`}),e[50]=He):He=e[50];let Q;e[51]!==we||e[52]!==Ve?(Q=(0,K.jsx)(F,{render:(0,K.jsx)(h,{type:`button`,variant:`outline`,size:`icon`,disabled:Ve,onClick:we,"aria-label":`Open keybindings.json`,children:He})}),e[51]=we,e[52]=Ve,e[53]=Q):Q=e[53];let We;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,K.jsx)(I,{side:`top`,children:`Open keybindings.json`}),e[54]=We):We=e[54];let Ge;e[55]===Q?Ge=e[56]:(Ge=(0,K.jsxs)(L,{children:[Q,We]}),e[55]=Q,e[56]=Ge);let $;e[57]!==X||e[58]!==Z||e[59]!==Ge?($=(0,K.jsx)(he,{...Ie,headerAction:Le,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[X,Z,Ge]})}),e[57]=X,e[58]=Z,e[59]=Ge,e[60]=$):$=e[60];let Ke;e[61]!==s||e[62]!==n?(Ke=s?null:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.length===0?`Connect an environment to change keybindings.`:`This connection can view keybindings but cannot change them.`}),e[61]=s,e[62]=n,e[63]=Ke):Ke=e[63];let qe=!s,Je;e[64]!==ye||e[65]!==ie||e[66]!==z||e[67]!==q||e[68]!==R?(Je=ie?(0,K.jsx)(fe,{children:(0,K.jsx)(it,{commandOptions:ye,allRows:z,variables:U,isSaving:R!==null,onSave:q,onCancel:Pe})}):null,e[64]=ye,e[65]=ie,e[66]=z,e[67]=q,e[68]=R,e[69]=Je):Je=e[69];let Ye;e[70]!==le||e[71]!==ce||e[72]!==Fe||e[73]!==R?(Ye=ce.length>0?(0,K.jsx)(at,{groups:ce,anchorIds:le,savingCommand:R,...Fe}):(0,K.jsx)(fe,{children:(0,K.jsx)(`div`,{className:`px-4 py-12 text-center text-sm text-muted-foreground`,children:`No keybindings match your search.`})}),e[70]=le,e[71]=ce,e[72]=Fe,e[73]=R,e[74]=Ye):Ye=e[74];let Xe;e[75]!==qe||e[76]!==Je||e[77]!==Ye?(Xe=(0,K.jsxs)(`div`,{inert:qe,className:`flex flex-col gap-8`,children:[Je,Ye]}),e[75]=qe,e[76]=Je,e[77]=Ye,e[78]=Xe):Xe=e[78];let Ze;return e[79]!==$||e[80]!==Ke||e[81]!==Xe?(Ze=(0,K.jsxs)(me,{children:[$,Ke,Xe]}),e[79]=$,e[80]=Ke,e[81]=Xe,e[82]=Ze):Ze=e[82],Ze}function ct(e){return e._tag===`Failure`}function lt(e){return N(e.environmentId,i)}function ut(e){return e._tag===`Failure`}function dt(e){return N(e.environmentId,i)}function ft(e){return e.hash.replace(/^#/,``)}var pt=st;export{pt as component};
|
|
2
|
-
//# sourceMappingURL=settings.keybindings-
|
|
1
|
+
import{a as e,t}from"./react-DH3P2YXY.js";import{n,t as r}from"./jsx-runtime-BnjsACtP.js";import{$_ as i,$n as a,Ad as o,Bm as s,Ic as c,Jn as l,Sp as u,Wd as d,Yn as f,Yp as p,af as m,dr as h,ff as g,lm as _,q_ as v,rh as y,t as b,tr as x,ur as S}from"./utils-CBe1bHL7.js";import{R as C,W as w}from"./runtime-CABaKt1A.js";import{a as T,c as E,o as D,s as O,t as k}from"./select-Cbpdz6n3.js";import{t as A}from"./useLocation-Cwv1HZ3K.js";import{i as j}from"./toast-D26NINYU.js";import{f as M}from"./server-mIR8e8Vz.js";import{i as ee,n as N,o as te}from"./session-BlCBDyVn.js";import{t as P}from"./use-atom-command-C4y634Qy.js";import{t as ne}from"./env-wK1YYxA8.js";import{a as F,n as I,t as L}from"./tooltip-ChmjT8Ns.js";import{t as R}from"./toggle-B03MQDgB.js";import{t as re}from"./input-DXGWoa4O.js";import{i as ie}from"./keybindings-DAHl8jIl.js";import{i as ae,o as oe,t as z}from"./popover-CogH2zM4.js";import{n as se,r as ce,t as B}from"./input-group-De0xZXfc.js";import{n as le,t as ue}from"./kbd-WWNLIkTn.js";import{V as de,W as fe,a as pe,i as me,s as he}from"./settingsLayout-vgYGia0Q.js";import{a as V,c as ge,f as _e,i as ve,l as ye,m as H,n as be,o as xe,p as U,r as Se,s as Ce,t as we,u as Te}from"./KeybindingsSettings.logic-BA5WG7V2.js";import{vo as Ee,vr as De,yr as Oe}from"./main-Cywp3EWc.js";var W=n(),G=e(t(),1),K=e(r(),1);function q(e){let t=(0,W.c)(6),{value:n}=e,r,i;if(t[0]!==n){let e=new Map,a=n.split(`+`).map(t=>{let n=e.get(t)??0;return e.set(t,n+1),{part:t,key:n===0?t:`${t}-${n}`}});r=le,i=a.map(ke),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a;return t[3]!==r||t[4]!==i?(a=(0,K.jsx)(r,{children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function ke(e){let{part:t,key:n}=e;return(0,K.jsx)(ue,{children:t===`mod`?navigator.platform.toLowerCase().includes(`mac`)?`⌘`:`Ctrl`:t===`shift`?`⇧`:t===`alt`?navigator.platform.toLowerCase().includes(`mac`)?`⌥`:`Alt`:t===`ctrl`?`⌃`:t.length===1?t.toUpperCase():t},n)}function Ae(e){let t=(0,W.c)(11),{query:n,onChange:r,inputRef:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(se,{children:(0,K.jsx)(_,{"aria-hidden":!0,className:`size-3.5`})}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=e=>r(e.currentTarget.value),t[1]=r,t[2]=o);let s;t[3]!==r||t[4]!==n?(s=e=>{e.key===`Escape`&&(e.preventDefault(),n.length>0?r(``):e.currentTarget.blur())},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==s?(c=(0,K.jsxs)(B,{className:`min-w-0 basis-full **:[input]:h-9 sm:basis-0 sm:flex-1 sm:**:[input]:h-8`,children:[a,(0,K.jsx)(ce,{ref:i,type:`search`,value:n,onChange:o,onKeyDown:s,placeholder:`Search keybindings`,"aria-label":`Search keybindings`,size:`sm`})]}),t[6]=i,t[7]=n,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function je(e,t){return e.type===t?[...je(e.left,t),...je(e.right,t)]:[e]}function J(e,t){let n=e[0];if(n)return e.slice(1).reduce((e,n)=>({type:t,left:e,right:n}),n)}function Me(e){return e.type===`identifier`?{identifier:e.name,negated:!1}:e.type===`not`&&e.node.type===`identifier`?{identifier:e.node.name,negated:!0}:null}function Ne(e,t){let n=Me(e);if(!n)return e;let r={type:`identifier`,name:t};return n.negated?{type:`not`,node:r}:r}function Pe(e,t){let n=Me(e);if(!n)return t?{type:`not`,node:e}:e;let r={type:`identifier`,name:n.identifier};return t?{type:`not`,node:r}:r}function Y(){return{type:`identifier`,name:we}}function Fe(e=`and`){return{type:e,left:Y(),right:{type:`not`,node:Y()}}}function Ie(e){let t=(0,W.c)(14),{label:n,focusable:r,className:i,children:a}=e,o=r===void 0||r?0:void 0,c;t[0]===i?c=t[1]:(c=b(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-warning outline-none transition-colors hover:bg-warning/10 focus-visible:ring-3 focus-visible:ring-inset focus-visible:ring-warning/25`,i),t[0]=i,t[1]=c);let l;t[2]!==n||t[3]!==o||t[4]!==c?(l=(0,K.jsx)(`span`,{tabIndex:o,"aria-label":n,className:c}),t[2]=n,t[3]=o,t[4]=c,t[5]=l):l=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(s,{className:`size-3.5`}),t[6]=u):u=t[6];let d;t[7]===l?d=t[8]:(d=(0,K.jsx)(F,{render:l,children:u}),t[7]=l,t[8]=d);let f;t[9]===a?f=t[10]:(f=(0,K.jsx)(I,{side:`top`,children:a}),t[9]=a,t[10]=f);let p;return t[11]!==d||t[12]!==f?(p=(0,K.jsxs)(L,{children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function Le(e){let t=(0,W.c)(5),{identifiers:n,focusable:r}=e,i=r===void 0||r;if(n.length===0)return null;let a;t[0]===n?a=t[1]:(a=n.length===1?`Unknown condition: ${n[0]}`:`Unknown conditions: ${n.join(`, `)}`,t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==o?(s=(0,K.jsx)(Ie,{label:o,focusable:i,className:`size-4.5`,children:`P4 Code does not recognize this condition yet. It can still be saved, but it may not match unless the runtime provides it.`}),t[2]=i,t[3]=o,t[4]=s):s=t[4],s}function X(e){let t=(0,W.c)(4),{labels:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.length===1?`Conflicts with ${n[0]}.`:`Conflicts with ${n.slice(0,3).join(`, `)}${n.length>3?`, and more`:``}.`,t[0]=n,t[1]=r);let i=r,a;return t[2]===i?a=t[3]:(a=(0,K.jsxs)(Ie,{label:i,children:[i,` The most recent matching binding wins when both conditions can apply.`]}),t[2]=i,t[3]=a),a}function Re(e){let t=(0,W.c)(25),{value:n,variables:r,unknownIdentifiers:i,onChange:a}=e,o;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>e===n,t[3]=n,t[4]=e),o=r.find(e),t[0]=n,t[1]=r,t[2]=o}else o=t[2];let s=o,c;t[5]!==s||t[6]!==n||t[7]!==r?(c=s||r.some(e=>e===n)?r:[n,...r],t[5]=s,t[6]=n,t[7]=r,t[8]=c):c=t[8];let l=c,u;t[9]===a?u=t[10]:(u=e=>e&&a(e),t[9]=a,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(E,{placeholder:`Condition`}),t[11]=d):d=t[11];let f;t[12]===i?f=t[13]:(f=i&&i.length>0?(0,K.jsx)(Le,{identifiers:i,focusable:!1}):null,t[12]=i,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,K.jsxs)(O,{size:`compact`,className:`min-w-0 flex-1`,children:[d,f]}),t[14]=f,t[15]=p);let m;t[16]===l?m=t[17]:(m=l.map(ze),t[16]=l,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,K.jsx)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:m}),t[18]=m,t[19]=h);let g;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==n?(g=(0,K.jsxs)(k,{value:n,onValueChange:u,children:[p,h]}),t[20]=u,t[21]=p,t[22]=h,t[23]=n,t[24]=g):g=t[24],g}function ze(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:e})},e)}function Be(e){let t=(0,W.c)(14),{label:n,className:r,onRemove:i}=e,a;t[0]===r?a=t[1]:(a=b(`size-7`,r),t[0]=r,t[1]=a);let o;t[2]!==n||t[3]!==i||t[4]!==a?(o=(0,K.jsx)(h,{type:`button`,variant:`ghost`,size:`icon-sm`,className:a,"aria-label":n,onClick:i}),t[2]=n,t[3]=i,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(u,{"aria-hidden":!0,className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]===o?c=t[8]:(c=(0,K.jsx)(F,{delay:200,render:o,children:s}),t[7]=o,t[8]=c);let l;t[9]===n?l=t[10]:(l=(0,K.jsx)(I,{side:`top`,children:n}),t[9]=n,t[10]=l);let d;return t[11]!==c||t[12]!==l?(d=(0,K.jsxs)(L,{children:[c,l]}),t[11]=c,t[12]=l,t[13]=d):d=t[13],d}function Z(e){let t=(0,W.c)(81),{node:n,variables:r,depth:i,onChange:a,onRemove:o}=e,s=i===void 0?0:i,c;if(t[0]!==s||t[1]!==n||t[2]!==a||t[3]!==o||t[4]!==r){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Me(n);if(e){let i=Ce(e.identifier)?[]:[e.identifier],l;t[6]!==n||t[7]!==a?(l=e=>a(Pe(n,e)),t[6]=n,t[7]=a,t[8]=l):l=t[8];let u=`Negate ${e.identifier}`,d;t[9]!==e||t[10]!==l||t[11]!==u?(d=(0,K.jsx)(R,{pressed:e.negated,onPressedChange:l,"aria-label":u,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[9]=e,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==n||t[14]!==a?(f=e=>a(Ne(n,e)),t[13]=n,t[14]=a,t[15]=f):f=t[15];let p;t[16]!==e||t[17]!==f||t[18]!==i||t[19]!==r?(p=(0,K.jsx)(Re,{value:e.identifier,variables:r,unknownIdentifiers:i,onChange:f}),t[16]=e,t[17]=f,t[18]=i,t[19]=r,t[20]=p):p=t[20];let m;t[21]!==s||t[22]!==n||t[23]!==o?(m=o?(0,K.jsx)(Be,{label:H(n,s),onRemove:o}):null,t[21]=s,t[22]=n,t[23]=o,t[24]=m):m=t[24];let h;t[25]!==d||t[26]!==p||t[27]!==m?(h=(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border/70 bg-background/60 px-2 py-2`,children:[d,p,m]}),t[25]=d,t[26]=p,t[27]=m,t[28]=h):h=t[28],c=h;break bb0}}t[0]=s,t[1]=n,t[2]=a,t[3]=o,t[4]=r,t[5]=c}else c=t[5];if(c!==Symbol.for(`react.early_return_sentinel`))return c;if(n.type===`not`){let e=s>0&&`border-border/50 bg-background/50`,i;t[29]===e?i=t[30]:(i=b(`space-y-2 rounded-lg border border-border/70 bg-muted/20 p-2`,e),t[29]=e,t[30]=i);let c;t[31]!==n||t[32]!==a?(c=(0,K.jsx)(R,{pressed:!0,onPressedChange:e=>a(e?n:n.node),"aria-label":`Negate group`,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[31]=n,t[32]=a,t[33]=c):c=t[33];let l;t[34]!==s||t[35]!==n||t[36]!==o?(l=o?(0,K.jsx)(Be,{label:H(n,s),className:`ml-auto`,onRemove:o}):null,t[34]=s,t[35]=n,t[36]=o,t[37]=l):l=t[37];let u;t[38]!==c||t[39]!==l?(u=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c,l]}),t[38]=c,t[39]=l,t[40]=u):u=t[40];let d,f;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(`span`,{className:`absolute top-0 bottom-0 left-1.5 w-px bg-border/70`,"aria-hidden":!0}),f=(0,K.jsx)(`span`,{className:`absolute top-4 left-1.5 h-px w-2.5 bg-border/70`,"aria-hidden":!0}),t[41]=d,t[42]=f):(d=t[41],f=t[42]);let p=s+1,m;t[43]===a?m=t[44]:(m=e=>a({type:`not`,node:e}),t[43]=a,t[44]=m);let h;t[45]!==n.node||t[46]!==p||t[47]!==m||t[48]!==r?(h=(0,K.jsxs)(`div`,{className:`relative pl-4`,children:[d,f,(0,K.jsx)(Z,{node:n.node,variables:r,depth:p,onChange:m})]}),t[45]=n.node,t[46]=p,t[47]=m,t[48]=r,t[49]=h):h=t[49];let g;return t[50]!==h||t[51]!==i||t[52]!==u?(g=(0,K.jsxs)(`div`,{className:i,children:[u,h]}),t[50]=h,t[51]=i,t[52]=u,t[53]=g):g=t[53],g}let l=n.type===`or`?`or`:`and`,u,d,f,m;if(t[54]!==s||t[55]!==n||t[56]!==a||t[57]!==o||t[58]!==l||t[59]!==r){let e=je(n,l),i=new Map,c=e.map(e=>{let t=`${e.type}-${U(e)}`,n=i.get(t)??0;return i.set(t,n+1),{child:e,key:n===0?t:`${t}-${n}`}}),g=(t,n)=>{let r=!1,i=J(e.map(e=>!r&&e===t?(r=!0,n):e),l);i&&a(i)},_=t=>{let n=!1,r=J(e.filter(e=>!n&&e===t?(n=!0,!1):!0),l);a(r||Y())},v=t=>{if(t===l)return;let n=J(e,t);n&&a(n)},y=()=>{let t=J([...e,Y()],l);t&&a(t)},x=()=>{let t={type:l===`and`?`or`:`and`,left:Y(),right:{type:`not`,node:Y()}},n=J([...e,t],l);n&&a(n)},S=s>0&&`border-border/70 bg-background/55`;t[64]===S?f=t[65]:(f=b(`space-y-2 rounded-lg border border-border/60 bg-muted/10 p-2`,S),t[64]=S,t[65]=f);let C;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,K.jsx)(O,{size:`compact`,className:`w-24`,children:(0,K.jsx)(E,{})}),t[66]=C):C=t[66];let w;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsxs)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,children:[(0,K.jsx)(T,{value:`and`,children:`and`}),(0,K.jsx)(T,{value:`or`,children:`or`})]}),t[67]=w):w=t[67];let A;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,K.jsx)(p,{className:`size-3.5`}),t[68]=A):A=t[68];let j;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,K.jsx)(p,{className:`size-3.5`}),t[69]=j):j=t[69];let M;t[70]!==s||t[71]!==n||t[72]!==o?(M=o?(0,K.jsx)(Be,{label:H(n,s),className:`ml-auto`,onRemove:o}):null,t[70]=s,t[71]=n,t[72]=o,t[73]=M):M=t[73],m=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(k,{value:l,onValueChange:e=>v(e),children:[C,w]}),(0,K.jsxs)(h,{type:`button`,variant:`outline`,size:`compact`,onClick:y,children:[A,`Condition`]}),(0,K.jsxs)(h,{type:`button`,variant:`outline`,size:`compact`,onClick:x,children:[j,`Group`]}),M]}),u=`space-y-2`,d=c.map(e=>{let{child:t,key:n}=e;return(0,K.jsxs)(`div`,{className:`relative pl-4`,children:[(0,K.jsx)(`span`,{className:b(`absolute top-0 bottom-0 left-1.5 w-px`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,K.jsx)(`span`,{className:b(`absolute top-4 left-1.5 h-px w-2.5`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,K.jsx)(Z,{node:t,variables:r,depth:s+1,onChange:e=>g(t,e),onRemove:()=>_(t)})]},n)}),t[54]=s,t[55]=n,t[56]=a,t[57]=o,t[58]=l,t[59]=r,t[60]=u,t[61]=d,t[62]=f,t[63]=m}else u=t[60],d=t[61],f=t[62],m=t[63];let g;t[74]!==u||t[75]!==d?(g=(0,K.jsx)(`div`,{className:u,children:d}),t[74]=u,t[75]=d,t[76]=g):g=t[76];let _;return t[77]!==f||t[78]!==m||t[79]!==g?(_=(0,K.jsxs)(`div`,{className:f,children:[m,g]}),t[77]=f,t[78]=m,t[79]=g,t[80]=_):_=t[80],_}function Ve(e){let t=(0,W.c)(60),{value:n,variables:r,onChange:i,onValidityChange:a}=e,o;t[0]===n?o=t[1]:(o=U(n),t[0]=n,t[1]=o);let[s,c]=(0,G.useState)(o),l;t[2]===s?l=t[3]:(l=Te(s),t[2]=s,t[3]=l);let u=l,f=u.ok?null:u.message,m;t[4]!==u.ok||t[5]!==u.value?(m=u.ok?_e(u.value):[],t[4]=u.ok,t[5]=u.value,t[6]=m):m=t[6];let g=m,_;t[7]!==i||t[8]!==a?(_=e=>{c(e);let t=Te(e);a?.(t.ok),t.ok&&i(t.value)},t[7]=i,t[8]=a,t[9]=_):_=t[9];let v=_,y;t[10]!==i||t[11]!==a?(y=e=>{c(U(e)),a?.(!0),i(e)},t[10]=i,t[11]=a,t[12]=y):y=t[12];let b=y,x;t[13]!==b||t[14]!==n?(x=()=>{if(!n){b(Y());return}b({type:`and`,left:n,right:Y()})},t[13]=b,t[14]=n,t[15]=x):x=t[15];let S=x,C;t[16]!==b||t[17]!==n?(C=()=>{let e=Fe(`or`);if(!n){b(e);return}b({type:`and`,left:n,right:e})},t[16]=b,t[17]=n,t[18]=C):C=t[18];let w=C,T;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,K.jsx)(`div`,{className:`min-w-0`,children:(0,K.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`When`})}),t[19]=T):T=t[19];let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,K.jsx)(p,{className:`size-3.5`}),t[20]=E):E=t[20];let D;t[21]===S?D=t[22]:(D=(0,K.jsxs)(h,{type:`button`,variant:`outline`,size:`compact`,onClick:S,children:[E,`Condition`]}),t[21]=S,t[22]=D);let O;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,K.jsx)(p,{className:`size-3.5`}),t[23]=O):O=t[23];let k;t[24]===w?k=t[25]:(k=(0,K.jsxs)(h,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[O,`Group`]}),t[24]=w,t[25]=k);let A;t[26]!==D||t[27]!==k?(A=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[D,k]})]}),t[26]=D,t[27]=k,t[28]=A):A=t[28];let j;t[29]===v?j=t[30]:(j=e=>v(e.currentTarget.value),t[29]=v,t[30]=j);let M=!!f,ee;t[31]!==s||t[32]!==j||t[33]!==M?(ee=(0,K.jsx)(ce,{value:s,onChange:j,placeholder:`Always`,"aria-invalid":M,"aria-label":`When expression`,size:`compact`,font:`mono`}),t[31]=s,t[32]=j,t[33]=M,t[34]=ee):ee=t[34];let N;t[35]===g?N=t[36]:(N=g.length>0?(0,K.jsx)(se,{align:`inline-end`,children:(0,K.jsx)(Le,{identifiers:g})}):null,t[35]=g,t[36]=N);let te;t[37]!==ee||t[38]!==N?(te=(0,K.jsxs)(B,{children:[ee,N]}),t[37]=ee,t[38]=N,t[39]=te):te=t[39];let P;t[40]===f?P=t[41]:(P=f?(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-2xs text-destructive`,children:[(0,K.jsx)(d,{className:`size-3.5`}),f]}):null,t[40]=f,t[41]=P);let ne;t[42]!==te||t[43]!==P?(ne=(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[te,P]}),t[42]=te,t[43]=P,t[44]=ne):ne=t[44];let F;t[45]!==S||t[46]!==w||t[47]!==b||t[48]!==n||t[49]!==r?(F=n?(0,K.jsx)(Z,{node:n,variables:r,onChange:b,onRemove:()=>b(void 0)}):(0,K.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/15 p-3`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(h,{type:`button`,size:`compact`,onClick:S,children:[(0,K.jsx)(p,{className:`size-3.5`}),`Condition`]}),(0,K.jsxs)(h,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[(0,K.jsx)(p,{className:`size-3.5`}),`Group`]})]})}),t[45]=S,t[46]=w,t[47]=b,t[48]=n,t[49]=r,t[50]=F):F=t[50];let I;t[51]===f?I=t[52]:(I=f?(0,K.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center rounded-lg border border-destructive/30 bg-background/75 p-4 text-center text-xs text-destructive backdrop-blur-xs`,children:`Fix the expression above to continue editing visually.`}):null,t[51]=f,t[52]=I);let L;t[53]!==F||t[54]!==I?(L=(0,K.jsxs)(`div`,{className:`relative`,children:[F,I]}),t[53]=F,t[54]=I,t[55]=L):L=t[55];let R;return t[56]!==A||t[57]!==ne||t[58]!==L?(R=(0,K.jsxs)(`div`,{className:`w-[min(34rem,calc(100vw-2rem))] space-y-3`,children:[A,ne,L]}),t[56]=A,t[57]=ne,t[58]=L,t[59]=R):R=t[59],R}function He(e){return{keyDraft:e.key,whenDraft:e.binding.whenAst,isRecording:!1,isWhenDraftValid:!0}}function Q(e,t){return{...e,...t}}function Ue(e){return{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}}function We(e){let t=(0,W.c)(27),{row:n,allRows:r,onSave:i}=e,[a,o]=(0,G.useReducer)(Q,n,He),{keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u}=a,d,f,p;t[0]!==r||t[1]!==s||t[2]!==n.id||t[3]!==n.key||t[4]!==n.when||t[5]!==c?(p=U(c),d=s!==n.key||p!==n.when,f=ge(r,{rowId:n.id,key:s,when:p}),t[0]=r,t[1]=s,t[2]=n.id,t[3]=n.key,t[4]=n.when,t[5]=c,t[6]=d,t[7]=f,t[8]=p):(d=t[6],f=t[7],p=t[8]);let m=f,h;t[9]!==s||t[10]!==i||t[11]!==n||t[12]!==p?(h=()=>{i({command:n.command,key:s,when:p.trim().length>0?p:void 0,replace:Ue(n)})},t[9]=s,t[10]=i,t[11]=n,t[12]=p,t[13]=h):h=t[13];let g=h,_;t[14]!==l||t[15]!==n.key?(_=e=>{if(e.key===`Tab`&&!l)return;if(e.preventDefault(),e.key===`Escape`){o({keyDraft:n.key,isRecording:!1});return}let t=ye(e.nativeEvent,navigator.platform);t&&o({keyDraft:t,isRecording:!1})},t[14]=l,t[15]=n.key,t[16]=_):_=t[16];let v=_,y;return t[17]!==v||t[18]!==m||t[19]!==d||t[20]!==l||t[21]!==u||t[22]!==s||t[23]!==g||t[24]!==c||t[25]!==p?(y={keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u,whenDraftExpression:p,isDirty:d,conflictLabels:m,setDraft:o,save:g,captureKeybinding:v},t[17]=v,t[18]=m,t[19]=d,t[20]=l,t[21]=u,t[22]=s,t[23]=g,t[24]=c,t[25]=p,t[26]=y):y=t[26],y}function Ge(e){let t=(0,W.c)(19),{row:n,editor:r,isSaving:i,pillClassName:a}=e,{keyDraft:o,isRecording:s,isDirty:c,isWhenDraftValid:l,setDraft:u,save:d,captureKeybinding:f}=r,p=!s&&o===n.key&&n.key.length>0&&!c,m;t[0]!==c||t[1]!==i||t[2]!==l||t[3]!==o||t[4]!==d?(m=c?(0,K.jsx)(h,{size:`sm`,disabled:i||o.trim().length===0||!l,onClick:d,children:i?`Saving`:`Save`}):null,t[0]=c,t[1]=i,t[2]=l,t[3]=o,t[4]=d,t[5]=m):m=t[5];let g;t[6]!==f||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==n.binding||t[11]!==n.command||t[12]!==n.key||t[13]!==u||t[14]!==p?(g=p?(0,K.jsx)(`button`,{type:`button`,onClick:()=>u({isRecording:!0}),"aria-label":`Edit shortcut for ${V(n.command)}: ${ie(n.binding.shortcut)}`,className:b(`inline-flex h-8 cursor-pointer items-center rounded-md border border-transparent px-1.5 sm:h-7 outline-none transition-colors hover:border-border/70 hover:bg-accent focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-inset focus-visible:ring-ring/24`,a),children:(0,K.jsx)(q,{value:n.key})}):(0,K.jsx)(re,{"data-keybinding-capture":``,autoFocus:s,"aria-label":`Keybinding for ${V(n.command)}`,value:s?``:o,placeholder:s?`Press shortcut`:`Unassigned`,size:`sm`,font:`mono`,className:`w-44`,onFocus:()=>u({isRecording:!0}),onBlur:()=>u({isRecording:!1}),onChange:e=>u({keyDraft:e.currentTarget.value}),onKeyDown:f}),t[6]=f,t[7]=s,t[8]=o,t[9]=a,t[10]=n.binding,t[11]=n.command,t[12]=n.key,t[13]=u,t[14]=p,t[15]=g):g=t[15];let _;return t[16]!==m||t[17]!==g?(_=(0,K.jsxs)(K.Fragment,{children:[m,g]}),t[16]=m,t[17]=g,t[18]=_):_=t[18],_}function $(e){let t=(0,W.c)(17),{label:n,expression:r,value:i,variables:a,onChange:s,onValidityChange:c}=e,l=r?`ghost`:`ghost-muted`,u;t[0]===l?u=t[1]:(u=(0,K.jsx)(h,{variant:l,size:`micro`,className:`min-w-0 shrink`}),t[0]=l,t[1]=u);let d=`Edit when clause for ${n}`,f=r||`Always`,p;t[2]===f?p=t[3]:(p=(0,K.jsx)(`span`,{className:`truncate font-mono`,children:f}),t[2]=f,t[3]=p);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,K.jsx)(o,{className:`size-3.5 shrink-0 opacity-60`}),t[4]=m):m=t[4];let g;t[5]!==u||t[6]!==d||t[7]!==p?(g=(0,K.jsxs)(oe,{render:u,"aria-label":d,children:[p,m]}),t[5]=u,t[6]=d,t[7]=p,t[8]=g):g=t[8];let _;t[9]!==s||t[10]!==c||t[11]!==i||t[12]!==a?(_=(0,K.jsx)(ae,{align:`start`,sideOffset:6,children:(0,K.jsx)(Ve,{value:i,variables:a,onChange:s,onValidityChange:c})}),t[9]=s,t[10]=c,t[11]=i,t[12]=a,t[13]=_):_=t[13];let v;return t[14]!==g||t[15]!==_?(v=(0,K.jsxs)(z,{children:[g,_]}),t[14]=g,t[15]=_,t[16]=v):v=t[16],v}function Ke(e){let t=(0,W.c)(24),{row:n,isSaving:r,onReset:i,onRemove:o}=e,s=n.source===`Custom`&&n.defaultKey!==null,c=n.source!==`Default`;if(!s&&!c)return null;let l;t[0]===n.command?l=t[1]:(l=V(n.command),t[0]=n.command,t[1]=l);let u=`Actions for ${l}`,d;t[2]!==r||t[3]!==u?(d=(0,K.jsx)(h,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:r,"aria-label":u}),t[2]=r,t[3]=u,t[4]=d):d=t[4];let p;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,K.jsx)(m,{className:`size-3.5`}),t[5]=p):p=t[5];let g;t[6]===d?g=t[7]:(g=(0,K.jsx)(S,{render:d,children:p}),t[6]=d,t[7]=g);let _;t[8]!==s||t[9]!==r||t[10]!==i||t[11]!==n?(_=s?(0,K.jsx)(a,{disabled:r,onClick:()=>i(n),children:`Reset to default`}):null,t[8]=s,t[9]=r,t[10]=i,t[11]=n,t[12]=_):_=t[12];let v;t[13]!==c||t[14]!==r||t[15]!==o||t[16]!==n?(v=c?(0,K.jsx)(a,{variant:`destructive`,disabled:r,onClick:()=>o(n),children:`Remove`}):null,t[13]=c,t[14]=r,t[15]=o,t[16]=n,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,K.jsxs)(x,{align:`end`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let b;return t[21]!==g||t[22]!==y?(b=(0,K.jsxs)(f,{children:[g,y]}),t[21]=g,t[22]=y,t[23]=b):b=t[23],b}function qe(e){let t=(0,W.c)(2),{source:n}=e;if(n===`Default`)return null;let r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(l,{variant:`outline`,size:`sm`,children:n}),t[0]=n,t[1]=r),r}function Je(e){let t=(0,W.c)(13),{row:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsx)(`span`,{className:`flex items-center gap-2`}),t[0]=r):r=t[0];let i;t[1]===n.command?i=t[2]:(i=V(n.command),t[1]=n.command,t[2]=i);let a;t[3]===n.source?a=t[4]:(a=(0,K.jsx)(qe,{source:n.source}),t[3]=n.source,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,K.jsxs)(F,{render:r,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7];let s;t[8]===n.command?s=t[9]:(s=(0,K.jsx)(I,{side:`top`,children:n.command}),t[8]=n.command,t[9]=s);let c;return t[10]!==o||t[11]!==s?(c=(0,K.jsxs)(L,{children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Ye(e){let t=(0,W.c)(13),{row:n,editor:r,variables:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[0]=a):a=t[0];let o;t[1]===n.command?o=t[2]:(o=V(n.command),t[1]=n.command,t[2]=o);let s,c;t[3]===r?(s=t[4],c=t[5]):(s=e=>r.setDraft({whenDraft:e}),c=e=>r.setDraft({isWhenDraftValid:e}),t[3]=r,t[4]=s,t[5]=c);let l;return t[6]!==r.whenDraft||t[7]!==r.whenDraftExpression||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==i?(l=(0,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[a,(0,K.jsx)($,{label:o,expression:r.whenDraftExpression,value:r.whenDraft,variables:i,onChange:s,onValidityChange:c})]}),t[6]=r.whenDraft,t[7]=r.whenDraftExpression,t[8]=o,t[9]=s,t[10]=c,t[11]=i,t[12]=l):l=t[12],l}function Xe(e){let t=(0,W.c)(2),n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(`span`,{className:`flex items-center opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100 has-data-popup-open:opacity-100 pointer-coarse:opacity-100`,children:(0,K.jsx)(Ke,{...e})}),t[0]=e,t[1]=n),n}function Ze(e){let t=(0,W.c)(30),{row:n,isSaving:r,anchorId:i,allRows:a,variables:o,onSave:s,onReset:c,onRemove:l}=e,u;t[0]!==a||t[1]!==s||t[2]!==n?(u={row:n,allRows:a,onSave:s},t[0]=a,t[1]=s,t[2]=n,t[3]=u):u=t[3];let d=We(u),f;t[4]===n?f=t[5]:(f=(0,K.jsx)(Je,{row:n}),t[4]=n,t[5]=f);let p;t[6]!==d||t[7]!==n||t[8]!==o?(p=(0,K.jsx)(Ye,{row:n,editor:d,variables:o}),t[6]=d,t[7]=n,t[8]=o,t[9]=p):p=t[9];let m;t[10]===d.conflictLabels?m=t[11]:(m=(0,K.jsx)(X,{labels:d.conflictLabels}),t[10]=d.conflictLabels,t[11]=m);let h;t[12]!==r||t[13]!==l||t[14]!==c||t[15]!==n?(h=(0,K.jsx)(Xe,{row:n,isSaving:r,onReset:c,onRemove:l}),t[12]=r,t[13]=l,t[14]=c,t[15]=n,t[16]=h):h=t[16];let g;t[17]!==d||t[18]!==r||t[19]!==n?(g=(0,K.jsx)(Ge,{row:n,editor:d,isSaving:r,pillClassName:`-mr-1.5`}),t[17]=d,t[18]=r,t[19]=n,t[20]=g):g=t[20];let _;t[21]!==m||t[22]!==h||t[23]!==g?(_=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[m,h,g]}),t[21]=m,t[22]=h,t[23]=g,t[24]=_):_=t[24];let v;return t[25]!==i||t[26]!==f||t[27]!==p||t[28]!==_?(v=(0,K.jsx)(pe,{id:i,className:`group/row rounded-none`,title:f,description:p,control:_}),t[25]=i,t[26]=f,t[27]=p,t[28]=_,t[29]=v):v=t[29],v}function Qe(e){let t=(0,W.c)(30),{allRows:n,onSave:r}=e,[i,a]=(0,G.useState)(``),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={keyDraft:``,whenDraft:void 0,isRecording:!1,isWhenDraftValid:!0},t[0]=o):o=t[0];let[s,c]=(0,G.useReducer)(Q,o),{keyDraft:l,whenDraft:u,isRecording:d,isWhenDraftValid:f}=s,p,m;t[1]!==n||t[2]!==l||t[3]!==u?(m=U(u),p=ge(n,{rowId:`new`,key:l,when:m}),t[1]=n,t[2]=l,t[3]=u,t[4]=p,t[5]=m):(p=t[4],m=t[5]);let h=p,g;t[6]===i?g=t[7]:(g=i?V(i):`new keybinding`,t[6]=i,t[7]=g);let _=g,v;t[8]!==i||t[9]!==f||t[10]!==l?(v=!!i&&l.trim().length>0&&f,t[8]=i,t[9]=f,t[10]=l,t[11]=v):v=t[11];let y=v,b;t[12]!==i||t[13]!==l||t[14]!==r||t[15]!==m?(b=()=>{i&&r({command:i,key:l,...m.trim().length>0?{when:m}:{}})},t[12]=i,t[13]=l,t[14]=r,t[15]=m,t[16]=b):b=t[16];let x=b,S;t[17]===d?S=t[18]:(S=e=>{if(e.key===`Tab`&&!d)return;if(e.preventDefault(),e.key===`Escape`){c({keyDraft:``,isRecording:!1});return}let t=ye(e.nativeEvent,navigator.platform);t&&c({keyDraft:t,isRecording:!1})},t[17]=d,t[18]=S);let C=S,w;return t[19]!==y||t[20]!==C||t[21]!==i||t[22]!==_||t[23]!==h||t[24]!==d||t[25]!==l||t[26]!==x||t[27]!==u||t[28]!==m?(w={commandDraft:i,setCommandDraft:a,keyDraft:l,whenDraft:u,whenDraftExpression:m,isRecording:d,conflictLabels:h,commandLabelText:_,canSave:y,setDraft:c,save:x,captureKeybinding:C},t[19]=y,t[20]=C,t[21]=i,t[22]=_,t[23]=h,t[24]=d,t[25]=l,t[26]=x,t[27]=u,t[28]=m,t[29]=w):w=t[29],w}function $e(e){let t=(0,W.c)(14),{draft:n,commandOptions:r,className:i}=e,a=n.commandDraft,o;t[0]===n?o=t[1]:(o=e=>n.setCommandDraft(e),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(E,{placeholder:`Command`}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,K.jsx)(O,{size:`sm`,className:i,children:s}),t[3]=i,t[4]=c);let l;t[5]===r?l=t[6]:(l=r.map(et),t[5]=r,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,K.jsx)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n.commandDraft||t[10]!==o||t[11]!==c||t[12]!==u?(d=(0,K.jsxs)(k,{value:a,onValueChange:o,children:[c,u]}),t[9]=n.commandDraft,t[10]=o,t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function et(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:V(e)})},e)}function tt(e){let t=(0,W.c)(14),{draft:n,autoFocus:r,className:i}=e,a=r!==void 0&&r,o=`Keybinding for ${n.commandLabelText}`,s=n.isRecording?``:n.keyDraft,c=n.isRecording?`Press shortcut`:`Unassigned`,l,u,d;t[0]===n?(l=t[1],u=t[2],d=t[3]):(l=()=>n.setDraft({isRecording:!0}),u=()=>n.setDraft({isRecording:!1}),d=e=>n.setDraft({keyDraft:e.currentTarget.value}),t[0]=n,t[1]=l,t[2]=u,t[3]=d);let f;return t[4]!==a||t[5]!==i||t[6]!==n.captureKeybinding||t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,K.jsx)(re,{"data-keybinding-capture":``,autoFocus:a,"aria-label":o,value:s,placeholder:c,size:`sm`,font:`mono`,className:i,onFocus:l,onBlur:u,onChange:d,onKeyDown:n.captureKeybinding}),t[4]=a,t[5]=i,t[6]=n.captureKeybinding,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function nt(e){let t=(0,W.c)(10),{draft:n,variables:r}=e,i,a;t[0]===n?(i=t[1],a=t[2]):(i=e=>n.setDraft({whenDraft:e}),a=e=>n.setDraft({isWhenDraftValid:e}),t[0]=n,t[1]=i,t[2]=a);let o;return t[3]!==n.commandLabelText||t[4]!==n.whenDraft||t[5]!==n.whenDraftExpression||t[6]!==i||t[7]!==a||t[8]!==r?(o=(0,K.jsx)($,{label:n.commandLabelText,expression:n.whenDraftExpression,value:n.whenDraft,variables:r,onChange:i,onValidityChange:a}),t[3]=n.commandLabelText,t[4]=n.whenDraft,t[5]=n.whenDraftExpression,t[6]=i,t[7]=a,t[8]=r,t[9]=o):o=t[9],o}function rt(e){let t=(0,W.c)(9),{isSaving:n,onCancel:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,K.jsx)(h,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:n,"aria-label":`Cancel new keybinding`,onClick:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(y,{className:`size-3.5`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,K.jsx)(F,{render:i,children:a}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(I,{side:`top`,children:`Cancel`}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,K.jsxs)(L,{children:[o,s]}),t[7]=o,t[8]=c),c}function it(e){let t=(0,W.c)(30),{commandOptions:n,allRows:r,variables:i,isSaving:a,onSave:o,onCancel:s}=e,c;t[0]!==r||t[1]!==o?(c={allRows:r,onSave:o},t[0]=r,t[1]=o,t[2]=c):c=t[2];let l=Qe(c),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[3]=u):u=t[3];let d;t[4]!==l||t[5]!==i?(d=(0,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[u,(0,K.jsx)(nt,{draft:l,variables:i})]}),t[4]=l,t[5]=i,t[6]=d):d=t[6];let f;t[7]!==n||t[8]!==l?(f=(0,K.jsx)($e,{draft:l,commandOptions:n,className:`w-56`}),t[7]=n,t[8]=l,t[9]=f):f=t[9];let p;t[10]===l.conflictLabels?p=t[11]:(p=(0,K.jsx)(X,{labels:l.conflictLabels}),t[10]=l.conflictLabels,t[11]=p);let m;t[12]===l?m=t[13]:(m=(0,K.jsx)(tt,{draft:l,className:`w-44`}),t[12]=l,t[13]=m);let g=a||!l.canSave,_=a?`Saving`:`Save`,v;t[14]!==l.save||t[15]!==g||t[16]!==_?(v=(0,K.jsx)(h,{size:`sm`,disabled:g,onClick:l.save,children:_}),t[14]=l.save,t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==s?(y=(0,K.jsx)(rt,{isSaving:a,onCancel:s}),t[18]=a,t[19]=s,t[20]=y):y=t[20];let b;t[21]!==f||t[22]!==p||t[23]!==m||t[24]!==v||t[25]!==y?(b=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f,p,m,v,y]}),t[21]=f,t[22]=p,t[23]=m,t[24]=v,t[25]=y,t[26]=b):b=t[26];let x;return t[27]!==b||t[28]!==d?(x=(0,K.jsx)(pe,{className:`bg-muted/15`,title:`New keybinding`,description:d,control:b}),t[27]=b,t[28]=d,t[29]=x):x=t[29],x}function at(e){let{groups:t,anchorIds:n,savingCommand:r,...i}=e;return t.map(e=>(0,K.jsx)(he,{id:`keybindings-${e.id}`,title:e.title,children:e.rows.map(e=>(0,K.jsx)(Ze,{row:e,anchorId:n.get(e.id),isSaving:r===e.command,...i},e.id))},e.id))}function ot(){let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{delay:200,render:(0,K.jsx)(h,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":`The browser may claim some shortcuts first. The desktop app receives them all.`,children:(0,K.jsx)(s,{className:`size-3.5 text-warning`})})}),(0,K.jsx)(I,{side:`top`,className:`max-w-72`,children:`The browser may claim some shortcuts first. The desktop app receives them all.`})]}),e[0]=t):t=e[0],t}function st(){let e=(0,W.c)(83),{environment:t,connectedEnvironments:n}=de(),r=ee(t?.environmentId??null,v),a=te(n,i),o;e[0]!==n||e[1]!==a?(o=n.length>0&&n.every(e=>a.has(e.environmentId)),e[0]=n,e[1]=a,e[2]=o):o=e[2];let s=o,l=t?.serverConfig?.keybindings,u;e[3]===l?u=e[4]:(u=l??[],e[3]=l,e[4]=u);let d;e[5]===u?d=e[6]:(d=c(u),e[5]=u,e[6]=d);let f=d,m=t?.serverConfig?.keybindingsConfigPath??null,_;e[7]===t?.serverConfig?.availableEditors?_=e[8]:(_=t?.serverConfig?.availableEditors??[],e[7]=t?.serverConfig?.availableEditors,e[8]=_);let y=_,b;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},e[9]=b):b=e[9];let x=P(M.upsertKeybinding,b),S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S={reportFailure:!1},e[10]=S):S=e[10];let T=P(M.removeKeybinding,S),E=Ee(t?.environmentId??null,y),[D,O]=(0,G.useState)(``),k=(0,G.useRef)(null),[R,re]=(0,G.useState)(null),[ie,ae]=(0,G.useState)(!1),oe;e[11]!==f||e[12]!==D?(oe=Se(f,D),e[11]=f,e[12]=D,e[13]=oe):oe=e[13];let z=oe,se;e[14]===z?se=e[15]:(se=xe(z),e[14]=z,e[15]=se);let ce=se,B;if(e[16]!==z){B=new Map;let t=new Set;for(let e of z)t.has(e.command)||(t.add(e.command),B.set(e.id,De(e.command)));e[16]=z,e[17]=B}else B=e[17];let le=B,ue;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(ue={select:ft},e[18]=ue):ue=e[18];let pe=A(ue),[V,ge]=(0,G.useState)(pe);pe!==V&&(ge(pe),pe.startsWith(`keybinding-`)&&O(``));let _e;e[19]===f?_e=e[20]:(_e=be(f),e[19]=f,e[20]=_e);let ye=_e,H;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(H=ve(),e[21]=H):H=e[21];let U=H,Ce;e[22]!==m||e[23]!==E||e[24]!==t?(Ce=()=>{m&&t&&N(t.environmentId,`orchestration:operate`)&&(async()=>{let e=await E(m);if(e._tag===`Success`||C(e))return;let t=w(e);j.add({title:`Unable to open keybindings file`,description:t instanceof Error?t.message:`The keybindings file was not opened.`,type:`error`})})()},e[22]=m,e[23]=E,e[24]=t,e[25]=Ce):Ce=e[25];let we=Ce,Te;e[26]!==n||e[27]!==t||e[28]!==x?(Te=e=>{if(!t||!n.every(dt))return;re(e.command);let r={command:e.command,key:e.key.trim(),...e.when?.trim()?{when:e.when.trim()}:{},...e.replace?{replace:e.replace}:{}};(async()=>{let e=await Promise.all(n.map(e=>x({environmentId:e.environmentId,input:r})));re(null);let t=e.find(ut);if(!t){ae(!1);return}if(!C(t)){let e=w(t);j.add({title:`Unable to save keybinding`,description:e instanceof Error?e.message:`The keybinding was not saved.`,type:`error`})}})()},e[26]=n,e[27]=t,e[28]=x,e[29]=Te):Te=e[29];let q=Te,ke;e[30]!==n||e[31]!==t||e[32]!==T?(ke=e=>{t&&n.every(lt)&&(re(e.command),(async()=>{let t=await Promise.all(n.map(t=>T({environmentId:t.environmentId,input:Ue(e)})));re(null);let r=t.find(ct)??t[0];if(r?._tag===`Failure`&&!C(r)){let e=w(r);j.add({title:`Unable to remove keybinding`,description:e instanceof Error?e.message:`The keybinding was not removed.`,type:`error`})}})())},e[30]=n,e[31]=t,e[32]=T,e[33]=ke):ke=e[33];let je=ke,J;e[34]===q?J=e[35]:(J=e=>{e.defaultKey&&q({command:e.command,key:e.defaultKey,when:e.defaultWhen.trim().length>0?e.defaultWhen:void 0,replace:{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}})},e[34]=q,e[35]=J);let Me=J,Ne;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>ae(!1),e[36]=Ne):Ne=e[36];let Pe=Ne,Y;e[37]!==je||e[38]!==Me||e[39]!==z||e[40]!==q?(Y={allRows:z,variables:U,onSave:q,onReset:Me,onRemove:je},e[37]=je,e[38]=Me,e[39]=z,e[40]=q,e[41]=Y):Y=e[41];let Fe=Y,Ie,Le;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=Oe(`keybindings`),Le=ne?null:(0,K.jsx)(ot,{}),e[42]=Ie,e[43]=Le):(Ie=e[42],Le=e[43]);let X;e[44]===D?X=e[45]:(X=(0,K.jsx)(Ae,{query:D,onChange:O,inputRef:k}),e[44]=D,e[45]=X);let Re=ie||!s,ze,Be;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>ae(!0),Be=(0,K.jsx)(p,{"aria-hidden":!0,className:`size-4`}),e[46]=ze,e[47]=Be):(ze=e[46],Be=e[47]);let Z;e[48]===Re?Z=e[49]:(Z=(0,K.jsxs)(h,{type:`button`,variant:`outline`,disabled:Re,onClick:ze,children:[Be,`Add keybinding`]}),e[48]=Re,e[49]=Z);let Ve=!m||!r,He;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,K.jsx)(g,{"aria-hidden":!0,className:`size-4`}),e[50]=He):He=e[50];let Q;e[51]!==we||e[52]!==Ve?(Q=(0,K.jsx)(F,{render:(0,K.jsx)(h,{type:`button`,variant:`outline`,size:`icon`,disabled:Ve,onClick:we,"aria-label":`Open keybindings.json`,children:He})}),e[51]=we,e[52]=Ve,e[53]=Q):Q=e[53];let We;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,K.jsx)(I,{side:`top`,children:`Open keybindings.json`}),e[54]=We):We=e[54];let Ge;e[55]===Q?Ge=e[56]:(Ge=(0,K.jsxs)(L,{children:[Q,We]}),e[55]=Q,e[56]=Ge);let $;e[57]!==X||e[58]!==Z||e[59]!==Ge?($=(0,K.jsx)(he,{...Ie,headerAction:Le,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[X,Z,Ge]})}),e[57]=X,e[58]=Z,e[59]=Ge,e[60]=$):$=e[60];let Ke;e[61]!==s||e[62]!==n?(Ke=s?null:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.length===0?`Connect an environment to change keybindings.`:`This connection can view keybindings but cannot change them.`}),e[61]=s,e[62]=n,e[63]=Ke):Ke=e[63];let qe=!s,Je;e[64]!==ye||e[65]!==ie||e[66]!==z||e[67]!==q||e[68]!==R?(Je=ie?(0,K.jsx)(fe,{children:(0,K.jsx)(it,{commandOptions:ye,allRows:z,variables:U,isSaving:R!==null,onSave:q,onCancel:Pe})}):null,e[64]=ye,e[65]=ie,e[66]=z,e[67]=q,e[68]=R,e[69]=Je):Je=e[69];let Ye;e[70]!==le||e[71]!==ce||e[72]!==Fe||e[73]!==R?(Ye=ce.length>0?(0,K.jsx)(at,{groups:ce,anchorIds:le,savingCommand:R,...Fe}):(0,K.jsx)(fe,{children:(0,K.jsx)(`div`,{className:`px-4 py-12 text-center text-sm text-muted-foreground`,children:`No keybindings match your search.`})}),e[70]=le,e[71]=ce,e[72]=Fe,e[73]=R,e[74]=Ye):Ye=e[74];let Xe;e[75]!==qe||e[76]!==Je||e[77]!==Ye?(Xe=(0,K.jsxs)(`div`,{inert:qe,className:`flex flex-col gap-8`,children:[Je,Ye]}),e[75]=qe,e[76]=Je,e[77]=Ye,e[78]=Xe):Xe=e[78];let Ze;return e[79]!==$||e[80]!==Ke||e[81]!==Xe?(Ze=(0,K.jsxs)(me,{children:[$,Ke,Xe]}),e[79]=$,e[80]=Ke,e[81]=Xe,e[82]=Ze):Ze=e[82],Ze}function ct(e){return e._tag===`Failure`}function lt(e){return N(e.environmentId,i)}function ut(e){return e._tag===`Failure`}function dt(e){return N(e.environmentId,i)}function ft(e){return e.hash.replace(/^#/,``)}var pt=st;export{pt as component};
|
|
2
|
+
//# sourceMappingURL=settings.keybindings-CQ5xk9v3.js.map
|