@p4code/cli 0.9.20 → 0.9.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. package/dist/{TraceDiagnostics-BYrlvKdA.mjs → TraceDiagnostics-DE0N1Yf6.mjs} +2 -2
  2. package/dist/bin.mjs +1 -1
  3. package/dist/{binCli-DReuiGmk.mjs → binCli-DC5fHnhS.mjs} +5 -5
  4. package/dist/client/.vite/manifest.json +1107 -1107
  5. package/dist/client/assets/{2NI2N5EU-DjM2qwkD.js → 2NI2N5EU-CgpeJ5KT.js} +2 -2
  6. package/dist/client/assets/{4UO7MD6I-BJdq41GZ.js → 4UO7MD6I-BZfVOqtM.js} +2 -2
  7. package/dist/client/assets/{5B3SVYGG-D21CBy6j.js → 5B3SVYGG-B5V3_tzl.js} +2 -2
  8. package/dist/client/assets/{5GK6JWQ2-DOIdqlC8.js → 5GK6JWQ2-DRzSVTZ0.js} +2 -2
  9. package/dist/client/assets/{5N7A7DKN-Bckll9rH.js → 5N7A7DKN-BX-IFKkJ.js} +2 -2
  10. package/dist/client/assets/{5OC2THR4-skJPz5iO.js → 5OC2THR4-CGiKcStE.js} +2 -2
  11. package/dist/client/assets/{5S6HY5KT-CRwXaSb1.js → 5S6HY5KT-B5Smgpiz.js} +2 -2
  12. package/dist/client/assets/{6IMQ5BUJ-sJYhkmUL.js → 6IMQ5BUJ-BSWEueVD.js} +2 -2
  13. package/dist/client/assets/{6OLKWJ4F-DY2aNKk1.js → 6OLKWJ4F-0nUReGo5.js} +2 -2
  14. package/dist/client/assets/{74OO7NKP-DpZyVE6P.js → 74OO7NKP-BZ5SCLUX.js} +2 -2
  15. package/dist/client/assets/{75O6YZUN-8DIThGtQ.js → 75O6YZUN-NifBwMlS.js} +2 -2
  16. package/dist/client/assets/{77XECAW3-BE-MTjvu.js → 77XECAW3-_XJOQitm.js} +2 -2
  17. package/dist/client/assets/{ABYRPUBD-DB_eiHX6.js → ABYRPUBD-B5mFmY4q.js} +2 -2
  18. package/dist/client/assets/{AuthSurfaceShell-BM3c1qJe.js → AuthSurfaceShell-DesOxtee.js} +2 -2
  19. package/dist/client/assets/{BB2UYUI2-BhRNS6b8.js → BB2UYUI2-CxFyfwSJ.js} +2 -2
  20. package/dist/client/assets/{BUM34MOA-RvYWUXux.js → BUM34MOA-Kk83QSsb.js} +2 -2
  21. package/dist/client/assets/{CEQABKGZ-byct14yE.js → CEQABKGZ-DLcBenqs.js} +2 -2
  22. package/dist/client/assets/{CXAC5362-YcQsQFwj.js → CXAC5362-BcvLk6NG.js} +2 -2
  23. package/dist/client/assets/{ChatGptUsageButton-BQOZ260S.js → ChatGptUsageButton-C9D5JFWr.js} +2 -2
  24. package/dist/client/assets/{ChatMarkdown-BdoTEVpd.js → ChatMarkdown-Ck4FJs_Q.js} +5 -5
  25. package/dist/client/assets/{CodexSetupSection.logic-CseyxFgK.js → CodexSetupSection.logic-DzEO1qoo.js} +2 -2
  26. package/dist/client/assets/{CommandBlock-Cg8P2GXg.js → CommandBlock-C15Q987N.js} +2 -2
  27. package/dist/client/assets/{ConnectAgentSurface-D9MYjA6g.js → ConnectAgentSurface-6FVydN17.js} +2 -2
  28. package/dist/client/assets/{DRLTVNUE-BZ7eTlHc.js → DRLTVNUE-CkNId4Pz.js} +2 -2
  29. package/dist/client/assets/{DYY6UVD2-DIWnFjlV.js → DYY6UVD2-B4516qT_.js} +2 -2
  30. package/dist/client/assets/{DevicePanel-CpWnw2HZ.js → DevicePanel-B3CR7kGX.js} +2 -2
  31. package/dist/client/assets/{DeviceSetup-C02U1yvN.js → DeviceSetup-Lxy9dmqi.js} +2 -2
  32. package/dist/client/assets/{DiffCommentAnnotation-CHYeyesq.js → DiffCommentAnnotation-CSzNea6G.js} +2 -2
  33. package/dist/client/assets/{DiffFileTree-zq0G5Jq3.js → DiffFileTree-CDnFut1y.js} +2 -2
  34. package/dist/client/assets/{DiffPanel-ghqOrQdi.js → DiffPanel-KfudIZct.js} +2 -2
  35. package/dist/client/assets/{DiffWorkerPoolProvider-QbRiMHeR.js → DiffWorkerPoolProvider-zgaFe3TY.js} +2 -2
  36. package/dist/client/assets/{EmbeddedDesign-ExUecHKZ.js → EmbeddedDesign-BI3VZqZl.js} +4 -4
  37. package/dist/client/assets/{FNOVOB4O-Cch7VyQQ.js → FNOVOB4O-Uc8FDPv8.js} +2 -2
  38. package/dist/client/assets/{FileDiff-C1_8HZ7T.js → FileDiff-B4Yf4fFg.js} +2 -2
  39. package/dist/client/assets/{FilePreviewPanel-DERxofVe.js → FilePreviewPanel-u1jxtxzb.js} +2 -2
  40. package/dist/client/assets/{FoldedSettingsSection-okCu3zVD.js → FoldedSettingsSection-DvzfFn5A.js} +2 -2
  41. package/dist/client/assets/{HDGCDEEZ-CJ_9BjZ0.js → HDGCDEEZ-DVkQN-82.js} +2 -2
  42. package/dist/client/assets/{HSJLKHB7-BvfNYUiJ.js → HSJLKHB7-txH19TCj.js} +2 -2
  43. package/dist/client/assets/{IntervalSecondsField-S7jLIub2.js → IntervalSecondsField-xqmFxAii.js} +2 -2
  44. package/dist/client/assets/JZOYTAAL-BqUoPKcz.js +1 -0
  45. package/dist/client/assets/{K3MD6TGW-C513S1_s.js → K3MD6TGW-4d2yDOzZ.js} +2 -2
  46. package/dist/client/assets/{K7RP3OMA-zhgZmSWl.js → K7RP3OMA-B8vKr81f.js} +2 -2
  47. package/dist/client/assets/{LHDIQX7Q-BmjYN5gQ.js → LHDIQX7Q-DAyTfuTY.js} +2 -2
  48. package/dist/client/assets/{LUXOKEGN-B0Kwi43W.js → LUXOKEGN-C67XJj3F.js} +2 -2
  49. package/dist/client/assets/{LinkMachineSelect-GyKAeGYQ.js → LinkMachineSelect-DoqwB0AR.js} +2 -2
  50. package/dist/client/assets/{MathTypeset-DfU_zRMI.js → MathTypeset-CMO1aCZc.js} +2 -2
  51. package/dist/client/assets/{ModelLiveLayer-DjtYQpVe.js → ModelLiveLayer-DqW0VhFG.js} +3 -3
  52. package/dist/client/assets/{N3JZAHOW-BXB2c-Us.js → N3JZAHOW-Bp1sdK_N.js} +2 -2
  53. package/dist/client/assets/{NUIALGQ3-BkehuL9A.js → NUIALGQ3-D427dlgt.js} +2 -2
  54. package/dist/client/assets/{NoProjectsHero-C-VNr8Ui.js → NoProjectsHero-BL0Jsc_V.js} +2 -2
  55. package/dist/client/assets/{O65XPQGZ-CPn-XJue.js → O65XPQGZ-BxqHRP3n.js} +2 -2
  56. package/dist/client/assets/{O7XIQ6OM-DAQPVVnq.js → O7XIQ6OM-CKRD1aP5.js} +2 -2
  57. package/dist/client/assets/{OFQON5FD-BKoNBxEK.js → OFQON5FD-CzS9a25C.js} +2 -2
  58. package/dist/client/assets/{P4ConnectAccountPages-C_7SfUQ2.js → P4ConnectAccountPages-Ca1o0JuS.js} +2 -2
  59. package/dist/client/assets/{P4ConnectSidebarSignIn-B6e-wkqI.js → P4ConnectSidebarSignIn-29st82gY.js} +2 -2
  60. package/dist/client/assets/{PJQHF43J-Byb4NdRa.js → PJQHF43J-Ww7-2BqY.js} +2 -2
  61. package/dist/client/assets/{PanelLayoutControls-BpjspxNc.js → PanelLayoutControls-CoWjUmx7.js} +4 -4
  62. package/dist/client/assets/{PierreEntryIcon-h4qT502J.js → PierreEntryIcon-UO6zY_i-.js} +2 -2
  63. package/dist/client/assets/{PreviewPanel-lT6UT8SC.js → PreviewPanel-BHj7Mvmn.js} +2 -2
  64. package/dist/client/assets/{ProjectDefaultsSettings-nqWOPUBM.js → ProjectDefaultsSettings-DN1mhFNf.js} +2 -2
  65. package/dist/client/assets/{ProjectFavicon-wwkvNTYJ.js → ProjectFavicon-CyXd4lSF.js} +3 -3
  66. package/dist/client/assets/{ProjectIconPickerDialog-CAEx0HQF.js → ProjectIconPickerDialog-B_D_9SAb.js} +2 -2
  67. package/dist/client/assets/{ProviderAuthTerminal-Seln-0IQ.js → ProviderAuthTerminal-B0GzUrya.js} +2 -2
  68. package/dist/client/assets/{ProviderModelPicker-p5oWTfTD.js → ProviderModelPicker-DQ3N8RWz.js} +2 -2
  69. package/dist/client/assets/{ProviderSettingsForm-DP5cO9tc.js → ProviderSettingsForm-DefAmKv_.js} +2 -2
  70. package/dist/client/assets/{PullRequestCodeTab-BhWK4Zqq.js → PullRequestCodeTab-BTwbK3zR.js} +2 -2
  71. package/dist/client/assets/{RHNBAITX-ZKmIoa8f.js → RHNBAITX-BsGO-vJB.js} +2 -2
  72. package/dist/client/assets/{ReadOnlySourcePreview-C8hhN481.js → ReadOnlySourcePreview-COho36OD.js} +2 -2
  73. package/dist/client/assets/{RenderErrorBoundary-CYWiIuBa.js → RenderErrorBoundary-CYsCxleQ.js} +2 -2
  74. package/dist/client/assets/{SLD4V6NK-BW_1--rc.js → SLD4V6NK-BZEKTqDY.js} +2 -2
  75. package/dist/client/assets/{ScheduledTasksSettings-D6cHBUhW.js → ScheduledTasksSettings-CpfGXMow.js} +2 -2
  76. package/dist/client/assets/{ScopedSwitch-BzU8Hn6s.js → ScopedSwitch-Cq7B0T7B.js} +2 -2
  77. package/dist/client/assets/{SelfImproveSettingsSection--Dcxxm73.js → SelfImproveSettingsSection-DZUf-jb0.js} +2 -2
  78. package/dist/client/assets/{SettingsPanels-C79826rW.js → SettingsPanels-Bk_YhHLm.js} +2 -2
  79. package/dist/client/assets/{SettingsPanels.logic-DPfiTtgf.js → SettingsPanels.logic-UhRGlGN1.js} +2 -2
  80. package/dist/client/assets/{SettingsScopeNotice-C9OAfACb.js → SettingsScopeNotice-Cja-hHOp.js} +2 -2
  81. package/dist/client/assets/{SidebarStageBackdrop-syJ1VaYP.js → SidebarStageBackdrop-DL1ZzaTz.js} +2 -2
  82. package/dist/client/assets/{T3PCR2KE-Bc51hYDo.js → T3PCR2KE-D049x5K8.js} +2 -2
  83. package/dist/client/assets/{TKWO2OVW-mV-gJkJw.js → TKWO2OVW-Du9gxVgn.js} +2 -2
  84. package/dist/client/assets/{TSHNXIZL-Bs_azRDw.js → TSHNXIZL-pUPHV4Qd.js} +2 -2
  85. package/dist/client/assets/{ThemeEditorPanel-DvlDdC-r.js → ThemeEditorPanel-CcFVvJlQ.js} +2 -2
  86. package/dist/client/assets/{ThreadDetailsItemsMenu-DFAwPwtf.js → ThreadDetailsItemsMenu-C4wfbepv.js} +4 -4
  87. package/dist/client/assets/{ThreadTerminalDrawer-CBRpijGu.js → ThreadTerminalDrawer-PkBB7D3Z.js} +2 -2
  88. package/dist/client/assets/{UQJE5E4I-DL8IPyLr.js → UQJE5E4I-BN56DsgT.js} +2 -2
  89. package/dist/client/assets/{USNYFO5S-CxX5m2eb.js → USNYFO5S-DVfAs9Gy.js} +2 -2
  90. package/dist/client/assets/{Virtualizer-hL0IrPqB.js → Virtualizer-Cn_zq3uH.js} +2 -2
  91. package/dist/client/assets/{WEVWDWVA-CCg7BLOe.js → WEVWDWVA-Cz36fo-k.js} +2 -2
  92. package/dist/client/assets/{X5RFHQXM-CoEhAoaG.js → X5RFHQXM-CUB_vKAl.js} +2 -2
  93. package/dist/client/assets/{X62E3GBT-v3am3MF5.js → X62E3GBT-C0wKfqHq.js} +2 -2
  94. package/dist/client/assets/{XBNEOJTC-CNH8QiJb.js → XBNEOJTC-CkYPODhO.js} +2 -2
  95. package/dist/client/assets/{YHV2MVVZ-BAtBSLld.js → YHV2MVVZ-Cf82W2em.js} +2 -2
  96. package/dist/client/assets/{YURCZMG2-B0qIfRPW.js → YURCZMG2-C9tzKn90.js} +2 -2
  97. package/dist/client/assets/{YVG2LODB-7yKJRNqu.js → YVG2LODB-DEZWhxa8.js} +2 -2
  98. package/dist/client/assets/{_chat-CPyEKO_k.js → _chat-PsMoIPUC.js} +5 -5
  99. package/dist/client/assets/{_chat.design-BkPz6B_R.js → _chat.design-CWE-keji.js} +2 -2
  100. package/dist/client/assets/{_chat.index-DGRldHwy.js → _chat.index-YmI2iiCN.js} +2 -2
  101. package/dist/client/assets/{_chat.new-Be-FWv3w.js → _chat.new-BQY5ktA8.js} +2 -2
  102. package/dist/client/assets/{_chat.pull-requests-Csb_f8e_.js → _chat.pull-requests-C90JBKAN.js} +2 -2
  103. package/dist/client/assets/{assetUrls-CsEDCYyh.js → assetUrls-C78a94Xu.js} +2 -2
  104. package/dist/client/assets/{assets-CA-ZYmQr.js → assets-5kUNv3CS.js} +2 -2
  105. package/dist/client/assets/{browserHistoryStore-BVGoot2u.js → browserHistoryStore-DHI-0j5y.js} +2 -2
  106. package/dist/client/assets/{browserLinkTarget-zjhG9Lyg.js → browserLinkTarget-D8HUAQg-.js} +2 -2
  107. package/dist/client/assets/{connect-BdyG6QZP.js → connect-Dl6MuR2C.js} +2 -2
  108. package/dist/client/assets/connect-agent-B22xdP4o.js +2 -0
  109. package/dist/client/assets/{design-9PZeJvkV.js → design-BoZx445P.js} +2 -2
  110. package/dist/client/assets/{device-B_zaE4OU.js → device-Ku4cbgo-.js} +2 -2
  111. package/dist/client/assets/{diffRendering-aGA2PUMV.js → diffRendering-yxIsTMie.js} +2 -2
  112. package/dist/client/assets/{dist-DQanjDEK.js → dist-CkH9xVVz.js} +2 -2
  113. package/dist/client/assets/{duoViewer-WUHHsw83.js → duoViewer-_3Xk2sTq.js} +2 -2
  114. package/dist/client/assets/{dynamic-BrZIqKQ1.js → dynamic-CwQ-caG2.js} +2 -2
  115. package/dist/client/assets/{embeddedScripts-Bjon5VEq.js → embeddedScripts-Cn7aGTAj.js} +2 -2
  116. package/dist/client/assets/{entities-iVR9hStG.js → entities-DOpLfnwX.js} +2 -2
  117. package/dist/client/assets/{fileLinks-ZsyrXe-F.js → fileLinks-CJ9SYNL6.js} +2 -2
  118. package/dist/client/assets/{fileTreeExpansion-CZA6X0sP.js → fileTreeExpansion-CdWOFpa-.js} +2 -2
  119. package/dist/client/assets/{getDiffFileInput-C973oCCO.js → getDiffFileInput-hLtjvhYr.js} +2 -2
  120. package/dist/client/assets/{index-ColdECgE.js → index-etcfxnIt.js} +3 -3
  121. package/dist/client/assets/{lazy-BWBxhQ9c.js → lazy--Qcevr63.js} +4 -4
  122. package/dist/client/assets/{linkedPrompt-CN5vzMKu.js → linkedPrompt-D4M9Fbja.js} +2 -2
  123. package/dist/client/assets/{main-xeaL6Ue7.js → main-C04YJQbN.js} +7 -7
  124. package/dist/client/assets/{mediaReference-D4xASAKr.js → mediaReference-D4rhlY-i.js} +2 -2
  125. package/dist/client/assets/{mediaSource-DJf0a3Hm.js → mediaSource-B03Ykm6c.js} +2 -2
  126. package/dist/client/assets/{modelScene-Dg2T9WKU.js → modelScene-CX8s0IGN.js} +2 -2
  127. package/dist/client/assets/{onboarding-7dyWHc7v.js → onboarding-BZ01kUjR.js} +2 -2
  128. package/dist/client/assets/{openFileInPreview-l71la8rp.js → openFileInPreview-XKgvCQ1z.js} +2 -2
  129. package/dist/client/assets/{p4ProjectFile-CC8L8IBq.js → p4ProjectFile-y2CDxOaL.js} +2 -2
  130. package/dist/client/assets/{pair-CjGF7d0N.js → pair-PXvf9qqC.js} +2 -2
  131. package/dist/client/assets/{phoneViewer-CpRP0Ylg.js → phoneViewer-F9Wt5VkW.js} +2 -2
  132. package/dist/client/assets/{pierre-icons-CX8MNnZC.js → pierre-icons-BTVgApcG.js} +2 -2
  133. package/dist/client/assets/{preview-DX0t2QY_.js → preview-5pSBET3P.js} +2 -2
  134. package/dist/client/assets/{primary-BvBZk3BL.js → primary-BXI66byW.js} +2 -2
  135. package/dist/client/assets/{primaryCloudLinkState-CHXPTqr2.js → primaryCloudLinkState-DswWb__m.js} +2 -2
  136. package/dist/client/assets/{projectFilesQueryState-D1KYNZXm.js → projectFilesQueryState-B6AeAhgL.js} +2 -2
  137. package/dist/client/assets/{projectScriptEditor-Dy8U6TBl.js → projectScriptEditor-DvKvgTs-.js} +2 -2
  138. package/dist/client/assets/{providerSkills-CpjiWlTj.js → providerSkills-D-ytsJU9.js} +2 -2
  139. package/dist/client/assets/{pullRequestDetail.logic-CHJRE71s.js → pullRequestDetail.logic-DQj9l9DL.js} +2 -2
  140. package/dist/client/assets/{pullRequests-DjzqqdNY.js → pullRequests-DrQJ8zM2.js} +2 -2
  141. package/dist/client/assets/{queries-D2fZuj-t.js → queries-BA_altUI.js} +2 -2
  142. package/dist/client/assets/{relay-aZlRxOWS.js → relay-CTdDIWLg.js} +2 -2
  143. package/dist/client/assets/{renderScheduler-BLaTctiX.js → renderScheduler-eNIG8tB_.js} +2 -2
  144. package/dist/client/assets/{runtime-D5AfNyNA.js → runtime-BvdQMwVb.js} +3 -3
  145. package/dist/client/assets/{scheduledTasksSettings.logic-BjvsiCPJ.js → scheduledTasksSettings.logic-CKzZuci7.js} +2 -2
  146. package/dist/client/assets/{server-B2y_yoz_.js → server-DthHkqkT.js} +2 -2
  147. package/dist/client/assets/{session-Dt_Dt-Og.js → session-CxeYe0sJ.js} +2 -2
  148. package/dist/client/assets/{session-logic-CPQJM-gL.js → session-logic-2ZMapwqV.js} +2 -2
  149. package/dist/client/assets/{settings-BIR_Igib.js → settings-DAe5Z4UG.js} +2 -2
  150. package/dist/client/assets/{settings.appearance-D0uNLG6m.js → settings.appearance-wfb5oCmC.js} +2 -2
  151. package/dist/client/assets/settings.archived-BF0zdtbV.js +2 -0
  152. package/dist/client/assets/{settings.computer-use-CNVg4Kl5.js → settings.computer-use-DJQcngZ4.js} +2 -2
  153. package/dist/client/assets/{settings.connections-Bt5upKXR.js → settings.connections-CoxujVuf.js} +2 -2
  154. package/dist/client/assets/{settings.data-controls-Bu-fCPHf.js → settings.data-controls-DUI06j8l.js} +2 -2
  155. package/dist/client/assets/{settings.decisions-B9lckxtw.js → settings.decisions-BY4z-aRM.js} +2 -2
  156. package/dist/client/assets/{settings.designs-CLLnQttY.js → settings.designs-O0d1vzoU.js} +2 -2
  157. package/dist/client/assets/{settings.diagnostics-Bl2X85nQ.js → settings.diagnostics-CwCeo1mG.js} +2 -2
  158. package/dist/client/assets/{settings.general-CJSdSR2k.js → settings.general-CAOwfHEb.js} +2 -2
  159. package/dist/client/assets/{settings.integrations-DRpNV9D5.js → settings.integrations-2RsLmeUi.js} +2 -2
  160. package/dist/client/assets/{settings.keybindings-BPtpYe84.js → settings.keybindings-CwvrmKin.js} +2 -2
  161. package/dist/client/assets/{settings.open-source-licenses-DYpshDh1.js → settings.open-source-licenses-DCBCu3U3.js} +2 -2
  162. package/dist/client/assets/{settings.plugins-C9ZOoiar.js → settings.plugins-8R8eV7IR.js} +2 -2
  163. package/dist/client/assets/{settings.projects-CMHQJUvG.js → settings.projects-Cy_93LuA.js} +3 -3
  164. package/dist/client/assets/{settings.providers-Bfr9fIiF.js → settings.providers-4HI8om0T.js} +3 -3
  165. package/dist/client/assets/{settings.scheduled-tasks-BEYOe2xs.js → settings.scheduled-tasks-CHnjcJx8.js} +2 -2
  166. package/dist/client/assets/{settings.secrets-DIyDPOQx.js → settings.secrets-BgQSmFWY.js} +2 -2
  167. package/dist/client/assets/{settings.snap-shot-DmjWtA3x.js → settings.snap-shot-C0J6pItQ.js} +2 -2
  168. package/dist/client/assets/{settings.source-control-DvaOZ7kM.js → settings.source-control-B3kcm55_.js} +2 -2
  169. package/dist/client/assets/{settings.storage-B4XbjYVO.js → settings.storage-Cy6oX7X3.js} +2 -2
  170. package/dist/client/assets/{settingsLayout-Ds1fJJk7.js → settingsLayout-YTaL8Lym.js} +2 -2
  171. package/dist/client/assets/{sidebarProjectGrouping-RQlsFe56.js → sidebarProjectGrouping-BaiZoO-A.js} +2 -2
  172. package/dist/client/assets/{sourceControl-BhvxhaEx.js → sourceControl-j8xaTHat.js} +2 -2
  173. package/dist/client/assets/{sourceControlClients-Bs5R87fg.js → sourceControlClients-BxzlzQxJ.js} +2 -2
  174. package/dist/client/assets/{terminal-links-BohHFDfc.js → terminal-links-BdsGDJ3O.js} +2 -2
  175. package/dist/client/assets/{terminalSessions-Cnj30QDx.js → terminalSessions-yZRa64tn.js} +2 -2
  176. package/dist/client/assets/{uiStateStore-BZ4RuLIL.js → uiStateStore-CX-sbFiq.js} +2 -2
  177. package/dist/client/assets/{usage-GID8Ml88.js → usage-CdxC8YNe.js} +2 -2
  178. package/dist/client/assets/{use-atom-command-QDd_NqJQ.js → use-atom-command-Bsfu4mja.js} +2 -2
  179. package/dist/client/assets/{useHandleNewThread-ClgC6Lcw.js → useHandleNewThread-Cv_08eER.js} +2 -2
  180. package/dist/client/assets/{useP4ConnectAuthPrompt-DMl-0U53.js → useP4ConnectAuthPrompt-CW-hut92.js} +2 -2
  181. package/dist/client/assets/{usePullRequestActions-CJvtylIq.js → usePullRequestActions-BHv9tRFF.js} +2 -2
  182. package/dist/client/assets/{useScopedModelAvailability-DGPFTMHL.js → useScopedModelAvailability-J0i-Sj4p.js} +2 -2
  183. package/dist/client/assets/{useSettings-BJR7Rf97.js → useSettings-BhGGZc98.js} +2 -2
  184. package/dist/client/assets/{vcsRefInvalidation-Bnup-5J0.js → vcsRefInvalidation-71d-99uY.js} +2 -2
  185. package/dist/client/assets/{welcome-CMuTnFAm.js → welcome-Ytf7jmR7.js} +2 -2
  186. package/dist/client/index.html +1 -1
  187. package/dist/{preview-DcFC_OYY.mjs → preview-CmCyL-Tc.mjs} +2 -2
  188. package/dist/{runtimeLayer-D4LpzNmS.mjs → runtimeLayer-BnJcJFjY.mjs} +4 -4
  189. package/dist/{runtimeLayer-B6H9jZgZ.mjs → runtimeLayer-DnNbGwAf.mjs} +1 -1
  190. package/dist/{server-4nWc1d6L.mjs → server-DXfSgbuj.mjs} +4 -4
  191. package/package.json +1 -1
  192. package/dist/client/assets/JZOYTAAL-RUIcMwMn.js +0 -1
  193. package/dist/client/assets/connect-agent-BZgF1WVU.js +0 -2
  194. package/dist/client/assets/settings.archived-DHE_0aGh.js +0 -2
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{t as i}from"./cloud-BhcSs4Ie.js";import{t as a}from"./plus-B2sOrZDk.js";import{t as o}from"./x-C35beONT.js";import{$n as s,Cd as c,Dd as l,Dl as u,Vu as d,Xd as f,Xn as p,Zn as m,ap as h,er as g,fr as _,hr as v,l as y,mr as b,ol as x,rl as S,rr as C,ru as w,sr as T,t as E,tr as D,wd as O}from"./utils-DkKLB01I.js";import{An as k,Gp as A,Ic as j,Ma as M,Ns as N,On as P,Ps as F,_ as I,_i as L,di as R,hi as z,kn as B,mh as ee,oi as V,pi as H,si as te,v as ne,vi as re,vn as ie,xn as U,yi as W,yn as ae}from"./src-R7EkrVcv.js";import{Dr as oe}from"./runtime-D5AfNyNA.js";import{w as se}from"./entities-iVR9hStG.js";import{a as ce,r as le,t as ue}from"./number-field-BkDsfSCt.js";import{a as G,c as K,i as de,o as fe,r as pe,s as me,t as he}from"./select-CE2f-g-3.js";import{t as ge}from"./spinner-C-qDE4WQ.js";import{a as q}from"./relay-aZlRxOWS.js";import{D as _e,J as ve,O as ye,c as be,o as xe,r as Se,s as J,x as Y}from"./useSettings-BJR7Rf97.js";import{f as Ce}from"./server-B2y_yoz_.js";import{i as we,n as Te}from"./session-Dt_Dt-Og.js";import{t as Ee}from"./query-CeIgbVxh.js";import{t as De}from"./use-atom-command-QDd_NqJQ.js";import{t as Oe}from"./env-BfPir1X4.js";import{a as ke,n as Ae,t as je}from"./tooltip-CCYU8XGM.js";import{t as Me}from"./input-CiPGmOLv.js";import{a as Ne,c as Pe,i as Fe,n as Ie,o as Le,r as Re,s as ze,t as Be}from"./dialog-5OaxRXCC.js";import{i as Ve,t as He}from"./device-B_zaE4OU.js";import{a as Ue,i as We,l as Ge,n as Ke,o as qe,t as Je,u as Ye}from"./DeviceSetup-C02U1yvN.js";import{t as Xe}from"./AnimatedHeight-BoS1RBdk.js";import{i as Ze,n as Qe}from"./Icons-DmQwwfAN.js";import{t as $e}from"./preview-DX0t2QY_.js";import{r as et}from"./preview-DnCP9Q0k.js";import{a as tt,i as nt,o as rt,t as it}from"./popover-hyDlWUPU.js";import{a as at,i as ot,n as st,o as ct,r as lt,s as ut,t as dt}from"./alert-dialog-DsMTn0ZK.js";import{F as ft,R as pt,V as mt,a as X,c as ht,i as gt,r as _t,s as vt,w as yt}from"./settingsLayout-Ds1fJJk7.js";import{Ho as bt,Lr as xt,Mo as St,Qa as Ct,Za as wt,ao as Tt}from"./main-xeaL6Ue7.js";import{t as Et}from"./ProjectDefaultsSettings-nqWOPUBM.js";import{t as Dt}from"./draft-input-DM7mC5ty.js";import{t as Ot}from"./ScopedSwitch-BzU8Hn6s.js";import{t as kt}from"./SecretInput-CRgvNUgU.js";import{n as At,r as jt,t as Mt}from"./usePermissionStatus-C5YvHVz-.js";var Z=n(),Q=e(r(),1);function Nt(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(Pt).at(-1)),t[0]=s,t[1]=c);let l=c,u=i===`hub`?`Device hub`:`Agent device`,d=i?`${u}: ${l?`version ${l}`:s?`not installed`:`version unknown`}. Show details`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(v,{tone:`muted`}),t[2]=f):f=t[2];let p=i?l?`v${l}`:s?`Not installed`:`Version unknown`:o?`Versions unavailable`:`Versions`,m;t[3]!==d||t[4]!==p?(m=(0,Q.jsx)(rt,{"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)(tt,{children:h}),t[6]=h,t[7]=g);let _;t[8]!==i||t[9]!==u||t[10]!==n?(_=n?(0,Q.jsx)(`div`,{className:`mt-4 divide-y divide-border/50`,children:[[`Device hub`,n.hub],[`Agent device`,n.agent]].filter(e=>{let[t]=e;return!i||t===u}).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`space-y-2 py-3 first:pt-0 last:pb-0`,children:[i?null:(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:t}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Running`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.runningVersion??`Not running`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Required`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.requiredVersion}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Installed`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono break-words`,children:n.installedVersions.join(`, `)||`None`})]})]},t)})}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Versions have not been checked.`}),t[8]=i,t[9]=u,t[10]=n,t[11]=_):_=t[11];let y=a?`Managed by ${a}. `:``,b;t[12]===y?b=t[13]:(b=(0,Q.jsxs)(`p`,{className:`mt-4 border-t border-border/50 pt-3 text-xs text-muted-foreground`,children:[y,`Tools update automatically on this host when needed.`]}),t[12]=y,t[13]=b);let x;t[14]===o?x=t[15]:(x=o?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-destructive`,children:o}):null,t[14]=o,t[15]=x);let S;t[16]===r?S=t[17]:(S=r?(0,Q.jsx)(`div`,{className:`mt-3`,children:r}):null,t[16]=r,t[17]=S);let C;t[18]!==b||t[19]!==x||t[20]!==S||t[21]!==g||t[22]!==_?(C=(0,Q.jsxs)(nt,{align:`end`,width:`md`,children:[g,_,b,x,S]}),t[18]=b,t[19]=x,t[20]=S,t[21]=g,t[22]=_,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==m?(w=(0,Q.jsxs)(it,{children:[m,C]}),t[24]=C,t[25]=m,t[26]=w):w=t[26],w}function Pt(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function Ft(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 It(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Lt),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 Lt(e){return(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(ke,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(u,{className:`size-3`}):(0,Q.jsx)(c,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(Ae,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var Rt=j(F);function zt(e){let{identityFile:t,...n}=e;return Rt({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function Bt(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function Vt(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 Ht(e){let t=De(He.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=Bt(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await Vt(e,n,async(e,n)=>{if(!Te(e,`settings:write`))throw Error(`This connection cannot test device hosts.`);let r=await t({environmentId:e,input:n});if(r._tag===`Failure`)throw oe(r);return r.value},(e,t)=>{o[e]=t,r(n=>({...n,[a]:{...n[a],[e]:t}}))}),o}finally{i.current.delete(a)}}}}function Ut(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}=Ht(i),p=d[Bt(c)],m=Object.values(p??{}).some(Gt),g,_;t[0]===c?(g=t[1],_=t[2]):(g=zt({...c,label:c.label.trim()||c.target}),_=ee(g),t[0]=c,t[1]=g,t[2]=_);let v=_,y;t[3]===p?y=t[4]:(y=Object.values(p??{}).filter(Wt),t[3]=p,t[4]=y);let x=y.length,S;t[5]!==a||t[6]!==s?(S=e=>{!e&&!a&&s()},t[5]=a,t[6]=s,t[7]=S):S=t[7];let C=!a,w;t[8]!==a||t[9]!==m||t[10]!==c.label||t[11]!==g||t[12]!==o?(w=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),ee(g)&&c.label.trim()&&!a&&!m&&o(g.value)}}),t[8]=a,t[9]=m,t[10]=c.label,t[11]=g,t[12]=o,t[13]=w):w=t[13];let T=r?`Add device host`:`Edit device host`,E;t[14]===T?E=t[15]:(E=(0,Q.jsx)(Pe,{children:T}),t[14]=T,t[15]=E);let D=i.length===1?`Connect from ${i[0]?.label}.`:`Connect from ${i.length} selected environments.`,k;t[16]===D?k=t[17]:(k=(0,Q.jsxs)(Re,{children:[D,` `,`Hosts on the same machine are skipped.`]}),t[16]=D,t[17]=k);let A;t[18]!==E||t[19]!==k?(A=(0,Q.jsxs)(Ne,{children:[E,k]}),t[18]=E,t[19]=k,t[20]=A):A=t[20];let j;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(`span`,{children:`Name`}),t[21]=j):j=t[21];let M;t[22]===c?M=t[23]:(M=e=>l({...c,label:e.target.value}),t[22]=c,t[23]=M);let N;t[24]!==a||t[25]!==c.label||t[26]!==M?(N=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[j,(0,Q.jsx)(Me,{autoFocus:!0,required:!0,value:c.label,disabled:a,onChange:M,placeholder:`Mac mini`})]}),t[24]=a,t[25]=c.label,t[26]=M,t[27]=N):N=t[27];let P;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(`span`,{children:`SSH target`}),t[28]=P):P=t[28];let F;t[29]===c?F=t[30]:(F=e=>l({...c,target:e.target.value}),t[29]=c,t[30]=F);let I;t[31]!==a||t[32]!==c.target||t[33]!==F?(I=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[P,(0,Q.jsx)(Me,{required:!0,value:c.target,disabled:a,onChange:F,placeholder:`user@host or SSH alias`})]}),t[31]=a,t[32]=c.target,t[33]=F,t[34]=I):I=t[34];let L=n.port!==void 0||n.identityFile!==void 0||void 0,R;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`SSH options`}),t[35]=R):R=t[35];let z;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(`span`,{children:`Identity file`}),t[36]=z):z=t[36];let B=c.identityFile??``,V;t[37]===c?V=t[38]:(V=e=>{let{identityFile:t,...n}=c;l(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=c,t[38]=V);let H;t[39]!==a||t[40]!==B||t[41]!==V?(H=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[z,(0,Q.jsx)(Me,{value:B,disabled:a,onChange:V,placeholder:`SSH config default`})]}),t[39]=a,t[40]=B,t[41]=V,t[42]=H):H=t[42];let te;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=te):te=t[43];let ne=c.port??``,re;t[44]===c?re=t[45]:(re=e=>{let{port:t,...n}=c;l(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=c,t[45]=re);let ie;t[46]!==a||t[47]!==ne||t[48]!==re?(ie=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[te,(0,Q.jsx)(Me,{type:`number`,min:1,max:65535,value:ne,disabled:a,onChange:re,placeholder:`Default`})]}),t[46]=a,t[47]=ne,t[48]=re,t[49]=ie):ie=t[49];let U;t[50]!==H||t[51]!==ie?(U=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[H,ie]}),t[50]=H,t[51]=ie,t[52]=U):U=t[52];let W;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=W):W=t[53];let ae;t[54]!==L||t[55]!==U?(ae=(0,Q.jsxs)(`details`,{open:L,className:`text-sm`,children:[R,U,W]}),t[54]=L,t[55]=U,t[56]=ae):ae=t[56];let oe=m?`Checking environments…`:p?x?`${x} of ${i.length} failed`:`Connection checks passed`:`Check access before saving`,se;t[57]===oe?se=t[58]:(se=(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:oe}),t[57]=oe,t[58]=se);let ce=a||m||!v,le;t[59]!==g||t[60]!==f?(le=()=>{ee(g)&&f(g.value)},t[59]=g,t[60]=f,t[61]=le):le=t[61];let ue;t[62]===m?ue=t[63]:(ue=m?(0,Q.jsx)(ge,{size:`xs`}):null,t[62]=m,t[63]=ue);let G;t[64]!==ce||t[65]!==le||t[66]!==ue?(G=(0,Q.jsxs)(b,{type:`button`,size:`sm`,variant:`outline`,disabled:ce,onClick:le,children:[ue,` Test connection`]}),t[64]=ce,t[65]=le,t[66]=ue,t[67]=G):G=t[67];let K;t[68]!==se||t[69]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[se,G]}),t[68]=se,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)(ge,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(O,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(h,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(u,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(It,{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]!==N||t[78]!==I||t[79]!==ae||t[80]!==fe?(pe=(0,Q.jsxs)(Le,{children:[N,I,ae,fe]}),t[77]=N,t[78]=I,t[79]=ae,t[80]=fe,t[81]=pe):pe=t[81];let me;t[82]!==a||t[83]!==s?(me=(0,Q.jsx)(b,{type:`button`,variant:`ghost`,disabled:a,onClick:s,children:`Cancel`}),t[82]=a,t[83]=s,t[84]=me):me=t[84];let he;t[85]!==a||t[86]!==m||t[87]!==c.label||t[88]!==v?(he=a||m||!v||!c.label.trim(),t[85]=a,t[86]=m,t[87]=c.label,t[88]=v,t[89]=he):he=t[89];let q;t[90]===a?q=t[91]:(q=a?(0,Q.jsx)(ge,{size:`xs`}):null,t[90]=a,t[91]=q);let _e;t[92]!==he||t[93]!==q?(_e=(0,Q.jsxs)(b,{type:`submit`,disabled:he,children:[q,` Save host`]}),t[92]=he,t[93]=q,t[94]=_e):_e=t[94];let ve;t[95]!==me||t[96]!==_e?(ve=(0,Q.jsxs)(Fe,{children:[me,_e]}),t[95]=me,t[96]=_e,t[97]=ve):ve=t[97];let ye;t[98]!==A||t[99]!==pe||t[100]!==C||t[101]!==ve||t[102]!==w?(ye=(0,Q.jsxs)(ze,{showCloseButton:C,render:w,children:[A,pe,ve]}),t[98]=A,t[99]=pe,t[100]=C,t[101]=ve,t[102]=w,t[103]=ye):ye=t[103];let be;return t[104]!==S||t[105]!==ye?(be=(0,Q.jsx)(Be,{open:!0,onOpenChange:S,children:ye}),t[104]=S,t[105]=ye,t[106]=be):be=t[106],be}function Wt(e){return e.status===`failed`}function Gt(e){return e.status===`pending`}function Kt(e){let{scope:t,environments:n,connectedEnvironments:r}=mt(),i=we(e.environmentId,M),a=t.kind===`project`||t.kind===`checkout`,o=De(Ce.updateSettings,{reportFailure:!1}),[s,c]=(0,$.useState)(null),[l,u]=(0,$.useState)(null),[d,p]=(0,$.useState)(!1),m=n.map(e=>({environmentId:e.environmentId,label:e.label,connected:e.connection.phase===`connected`})),{checks:h,testConnection:g}=Ht(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(!Te(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return o({environmentId:e.environmentId,input:{patch:{deviceHosts:Ft(e.serverConfig.settings.deviceHosts,t,r,i)}}})})),a=n.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});a.length===0?c(null):q.add({type:`error`,title:`Device hosts not saved on all environments`,description:`Could not update ${a.map(e=>e.label).join(`, `)}.`})}finally{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)(b,{size:`sm`,variant:`outline`,disabled:!i||a||d||!e.environmentId||s!==null,onClick:()=>{u(null),c({kind:`ssh`,id:y(),label:``,target:``})},children:[(0,Q.jsx)(f,{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)(qt,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!i||a||d,checks:h,testConnection:async e=>{let t=await g(e);if(!t)return;let n=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=>{u(e),c(e)},onRemove:e=>void _(e,!0)})]},e.environmentId)),s?(0,Q.jsx)(Ut,{host:s,isNew:l===null,targets:m,busy:d,onSave:e=>void _(e,!1,l??e),onClose:()=>c(null)},s.id):null]}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect a selected environment to manage device hosts.`})})})}function qt(e){let t=(0,Z.c)(28),{environmentLabel:n,environmentId:r,hosts:i,busy:a,onEdit:o,onRemove:s,checks:c,testConnection:u}=e,{state:d}=Ve(r),f=De(He.list),[p,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 v;if(t[2]!==a||t[3]!==c||t[4]!==r||t[5]!==n||t[6]!==i||t[7]!==o||t[8]!==s||t[9]!==f||t[10]!==p||t[11]!==d||t[12]!==u){let e;t[14]!==a||t[15]!==c||t[16]!==r||t[17]!==n||t[18]!==o||t[19]!==s||t[20]!==f||t[21]!==p||t[22]!==d||t[23]!==u?(e=e=>{let t=d.hostStatuses[e.id],i=c[Bt(e)]?.[r],g=(i?.status===`connected`?i.platforms:void 0)??d.hosts.find(t=>t.id===e.id)?.platforms??[],v=i?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,y=i?.status===`failed`?i.error:i?.status===`local`?void 0:t?.status===`failed`?t.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/50 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label}),g.filter(Yt).map(Jt)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(Nt,{owner:n,error:d.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:d.hosts.find(t=>t.id===e.id)?.tools??(i?.status===`connected`?i.tools:void 0)}),i?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,y?(0,Q.jsx)(`div`,{className:`mt-1`,role:`status`,children:(0,Q.jsxs)(`details`,{className:`text-xs text-destructive`,children:[(0,Q.jsx)(`summary`,{children:`Connection failed`}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:y})]})}):null]}),v?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(ge,{size:`xs`}),v]}):null,(0,Q.jsxs)(m,{children:[(0,Q.jsx)(_,{render:(0,Q.jsx)(b,{size:`icon-sm`,variant:`ghost-muted`,disabled:a,"aria-label":e.label+` options`}),children:(0,Q.jsx)(l,{})}),(0,Q.jsxs)(C,{align:`end`,children:[(0,Q.jsx)(D,{onClick:()=>{o(e)},children:`Edit`}),(0,Q.jsx)(D,{variant:`destructive`,onClick:()=>s(e),children:`Remove`})]})]}),t?.status===`failed`&&d.supportsHostRetry&&d.hostStatus!==`disabled`?(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:a||p!==null,onClick:()=>{h(e.id),f({environmentId:r,input:{retryHostId:e.id}}).finally(()=>h(null))},children:p===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:a||v!==null,onClick:()=>void u(e),children:`Test connection`})]},e.id)},t[14]=a,t[15]=c,t[16]=r,t[17]=n,t[18]=o,t[19]=s,t[20]=f,t[21]=p,t[22]=d,t[23]=u,t[24]=e):e=t[24],v=i.map(e),t[2]=a,t[3]=c,t[4]=r,t[5]=n,t[6]=i,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=d,t[12]=u,t[13]=v}else v=t[13];let y;return t[25]!==g||t[26]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[g,v]}),t[25]=g,t[26]=v,t[27]=y):y=t[27],y}function Jt(e){return(0,Q.jsxs)(je,{children:[(0,Q.jsx)(ke,{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)(Ze,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)(Qe,{className:`size-3.5`})}),(0,Q.jsx)(Ae,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function Yt(e){return e.available}var Xt=j(N),Zt=e=>({kind:`eas`,id:e,label:`EAS Simulator`,accessToken:``,maxSessionMinutes:30,idleMinutes:10,maxConcurrentSessions:2});function Qt(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 $t(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 en=`thread-project`,tn={settings:`the access token saved here`,env:`EXPO_TOKEN on the server`,"eas-login":`the server's eas login`},nn=e=>{let t=A(e);return t instanceof Error?t.message:String(t)};function rn(e){let t=(0,Z.c)(24),{scope:n,connectedEnvironments:r}=mt(),o=we(e.environmentId,M),s=n.kind===`project`||n.kind===`checkout`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={reportFailure:!1},t[0]=c):c=t[0];let l=De(Ce.updateSettings,c),u;t[1]===e.environmentId?u=t[2]:(u=t=>t.environmentId===e.environmentId,t[1]=e.environmentId,t[2]=u);let d=r.find(u)?.serverConfig?.settings.easDeviceHosts??[],[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(!1),g=!o||s||m||!e.environmentId,_=async(t,n)=>{if(!e.environmentId||!Te(e.environmentId,`settings:write`))return;h(!0);let r=await l({environmentId:e.environmentId,input:{patch:{easDeviceHosts:Qt(d,t,n)}}});h(!1),r._tag===`Success`?p(null):q.add({type:`error`,title:n?`EAS host not removed`:`EAS host not saved`,description:nn(r.cause)})},v=X,x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=[`easDeviceHosts`],t[3]=x):x=t[3];let S=g||f!==null,C;t[4]===p?C=t[5]:(C=()=>p({host:Zt(y()),isNew:!0}),t[4]=p,t[5]=C);let w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(a,{className:`size-3.5`}),t[6]=w):w=t[6];let T;t[7]!==S||t[8]!==C?(T=(0,Q.jsxs)(b,{size:`sm`,variant:`outline`,disabled:S,onClick:C,children:[w,` Add EAS host`]}),t[7]=S,t[8]=C,t[9]=T):T=t[9];let E=d.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No EAS hosts.`}):(0,Q.jsx)(`ul`,{className:`divide-y divide-border/40`,children:d.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate font-medium`,children:[(0,Q.jsx)(i,{className:`size-3.5 shrink-0`}),` `,e.label]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:$t(e)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(b,{size:`sm`,variant:`ghost`,disabled:g,onClick:()=>p({host:e,isNew:!1}),children:`Edit`}),(0,Q.jsx)(b,{size:`sm`,variant:`ghost-destructive`,disabled:g,onClick:()=>void _(e,!0),children:`Remove`})]})]},e.id))}),D;t[10]!==m||t[11]!==f||t[12]!==e.environmentId||t[13]!==_||t[14]!==p?(D=f&&e.environmentId?(0,Q.jsx)(an,{environmentId:e.environmentId,host:f.host,isNew:f.isNew,busy:m,onSave:e=>void _(e,!1),onClose:()=>p(null)},f.host.id):null,t[10]=m,t[11]=f,t[12]=e.environmentId,t[13]=_,t[14]=p,t[15]=D):D=t[15];let O;t[16]!==E||t[17]!==D?(O=(0,Q.jsxs)(`div`,{className:`pt-3 pb-2`,children:[E,D]}),t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;return t[19]!==v||t[20]!==T||t[21]!==O||t[22]!==x?(k=(0,Q.jsx)(v,{id:`eas-device-hosts`,title:`EAS Simulator`,serverScoped:!0,settingKeys:x,description:`Run iOS Simulators and Android emulators in Expo's cloud from this environment. Sessions bill the Expo account until they stop, so each host limits how many run and for how long. Editing or removing a host stops its running sessions.`,control:T,children:O}),t[19]=v,t[20]=T,t[21]=O,t[22]=x,t[23]=k):k=t[23],k}function an(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=De(He.easAccount,n),[i,a]=(0,$.useState)(e.host),s=(0,$.useId)(),c;t[1]===e.host.accessToken?c=t[2]:(c=e.host.accessToken?{kind:`saved`}:{kind:`cleared`},t[1]=e.host.accessToken,t[2]=c);let[l,u]=(0,$.useState)(c),d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d={status:`checking`},t[3]=d):d=t[3];let[f,p]=(0,$.useState)(d),m,h;t[4]!==i||t[5]!==e.host.accessToken||t[6]!==l.kind||t[7]!==l.value?(m={...i,label:i.label.trim(),accessToken:l.kind===`saved`?e.host.accessToken:l.kind===`new`?l.value:``},h=ee(Xt(m)),t[4]=i,t[5]=e.host.accessToken,t[6]=l.kind,t[7]=l.value,t[8]=m,t[9]=h):(m=t[8],h=t[9]);let g=h,_=g?null:i.maxSessionMinutes>0&&i.idleMinutes>=i.maxSessionMinutes?`Idle minutes must be smaller than session minutes.`:`Give the host a label and limits within the ranges shown.`,v;t[10]!==f.account||t[11]!==f.status?(v=f.status===`signed-in`?f.account.apps:[],t[10]=f.account,t[11]=f.status,t[12]=v):v=t[12];let y=v,x=(0,$.useRef)(0),S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{x.current+=1,p({status:`idle`})},t[13]=S):S=t[13];let C=S,w;t[14]!==r||t[15]!==e.environmentId||t[16]!==e.host.id||t[17]!==e.isNew||t[18]!==l.kind||t[19]!==l.value?(w=async()=>{let t=x.current+=1,n=await r({environmentId:e.environmentId,input:{...l.kind===`saved`&&!e.isNew?{hostId:e.host.id}:{},...l.kind===`new`?{accessToken:l.value}:l.kind===`cleared`?{accessToken:``}:{}}});t===x.current&&p(n._tag===`Success`?{status:`signed-in`,account:n.value}:{status:`failed`,error:nn(n.cause)})},t[14]=r,t[15]=e.environmentId,t[16]=e.host.id,t[17]=e.isNew,t[18]=l.kind,t[19]=l.value,t[20]=w):w=t[20];let T=w,E;t[21]===T?E=t[22]:(E=()=>{p({status:`checking`}),T()},t[21]=T,t[22]=E);let D=E,O;t[23]===T?O=t[24]:(O=()=>void T(),t[23]=T,t[24]=O);let k=(0,$.useEffectEvent)(O),A;t[25]===k?A=t[26]:(A=()=>{k()},t[25]=k,t[26]=A);let j;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(j=[],t[27]=j):j=t[27],(0,$.useEffect)(A,j);let M;t[28]!==i||t[29]!==e.busy?(M=(t,n,r)=>(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(Me,{type:`number`,min:1,max:r,value:i[t],disabled:e.busy,onChange:e=>{let n=Number(e.target.value);a(e=>({...e,[t]:n}))}})]}),t[28]=i,t[29]=e.busy,t[30]=M):M=t[30];let N=M,P;t[31]===e?P=t[32]:(P=t=>{!t&&!e.busy&&e.onClose()},t[31]=e,t[32]=P);let F=!e.busy,I;t[33]!==m||t[34]!==e||t[35]!==g?(I=t=>{t.preventDefault(),g&&!e.busy&&e.onSave(m)},t[33]=m,t[34]=e,t[35]=g,t[36]=I):I=t[36];let L=e.isNew?`Add EAS host`:`Edit EAS host`,R;t[37]===L?R=t[38]:(R=(0,Q.jsx)(Pe,{children:L}),t[37]=L,t[38]=R);let z;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(Re,{children:`The environment's server signs in to Expo and starts the sessions. Without a token here it uses EXPO_TOKEN, then its eas login.`}),t[39]=z):z=t[39];let B;t[40]===R?B=t[41]:(B=(0,Q.jsxs)(Ne,{children:[R,z]}),t[40]=R,t[41]=B);let V;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(`span`,{children:`Name`}),t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{let t=e.target.value;a(e=>({...e,label:t}))},t[43]=H):H=t[43];let te;t[44]!==i.label||t[45]!==e.busy?(te=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[V,(0,Q.jsx)(Me,{autoFocus:!0,required:!0,value:i.label,disabled:e.busy,onChange:H})]}),t[44]=i.label,t[45]=e.busy,t[46]=te):te=t[46];let ne;t[47]===s?ne=t[48]:(ne=(0,Q.jsx)(`label`,{htmlFor:s,className:`block`,children:`Expo access token`}),t[47]=s,t[48]=ne);let re=l.kind===`saved`,ie=l.kind===`new`?l.value:``,U;t[49]===e.host.accessToken?U=t[50]:(U=t=>{let n=t.target.value;u(n?{kind:`new`,value:n}:e.host.accessToken?{kind:`saved`}:{kind:`cleared`}),C()},t[49]=e.host.accessToken,t[50]=U);let W;t[51]!==e.busy||t[52]!==re||t[53]!==ie||t[54]!==U||t[55]!==s?(W=(0,Q.jsx)(kt,{id:s,className:`min-w-0 flex-1`,configured:re,value:ie,disabled:e.busy,placeholder:`Optional`,onChange:U}),t[51]=e.busy,t[52]=re,t[53]=ie,t[54]=U,t[55]=s,t[56]=W):W=t[56];let ae;t[57]===l.kind?ae=t[58]:(ae=l.kind===`cleared`?null:(0,Q.jsx)(b,{type:`button`,size:`icon-sm`,variant:`ghost-destructive`,"aria-label":`Clear access token`,onClick:()=>{u({kind:`cleared`}),C()},children:(0,Q.jsx)(o,{className:`size-3.5`})}),t[57]=l.kind,t[58]=ae);let oe;t[59]!==W||t[60]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[W,ae]}),t[59]=W,t[60]=ae,t[61]=oe):oe=t[61];let se;t[62]!==ne||t[63]!==oe?(se=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ne,oe]}),t[62]=ne,t[63]=oe,t[64]=se):se=t[64];let ce=f.status===`signed-in`?`Signed in as ${f.account.signedInAs} with ${tn[f.account.credentialSource]}.`:f.status===`failed`?f.error:f.status===`checking`?`Checking the Expo account…`:`Check the Expo account before choosing a project.`,le;t[65]===ce?le=t[66]:(le=(0,Q.jsx)(`p`,{role:`status`,className:`min-w-0 text-xs text-muted-foreground`,children:ce}),t[65]=ce,t[66]=le);let ue=e.busy||f.status===`checking`,de;t[67]===D?de=t[68]:(de=()=>void D(),t[67]=D,t[68]=de);let pe;t[69]===f.status?pe=t[70]:(pe=f.status===`checking`?(0,Q.jsx)(ge,{size:`xs`}):null,t[69]=f.status,t[70]=pe);let q;t[71]!==ue||t[72]!==de||t[73]!==pe?(q=(0,Q.jsxs)(b,{type:`button`,size:`sm`,variant:`outline`,disabled:ue,onClick:de,children:[pe,` Check account`]}),t[71]=ue,t[72]=de,t[73]=pe,t[74]=q):q=t[74];let _e;t[75]!==le||t[76]!==q?(_e=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2.5`,children:[le,q]}),t[75]=le,t[76]=q,t[77]=_e):_e=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??en,be=e.busy,xe;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>{typeof e==`string`&&a(t=>{let{appId:n,...r}=t;return e===en?r:{...r,appId:e}})},t[79]=xe):xe=t[79];let Se;t[80]===y?Se=t[81]:(Se=(0,Q.jsx)(me,{size:`sm`,"aria-label":`EAS project`,children:(0,Q.jsx)(K,{children:e=>e===en?`From the thread's project`:y.find(t=>t.id===e)?.fullName??e})}),t[80]=y,t[81]=Se);let J;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(G,{value:en,children:`From the thread's project`}),t[82]=J):J=t[82];let Y;t[83]!==y||t[84]!==i.appId?(Y=i.appId&&!y.some(e=>e.id===i.appId)?(0,Q.jsx)(G,{value:i.appId,children:i.appId}):null,t[83]=y,t[84]=i.appId,t[85]=Y):Y=t[85];let Ce;t[86]===y?Ce=t[87]:(Ce=y.map(on),t[86]=y,t[87]=Ce);let we;t[88]!==Y||t[89]!==Ce?(we=(0,Q.jsxs)(fe,{children:[J,Y,Ce]}),t[88]=Y,t[89]=Ce,t[90]=we):we=t[90];let Te;t[91]!==e.busy||t[92]!==ye||t[93]!==Se||t[94]!==we?(Te=(0,Q.jsxs)(he,{value:ye,disabled:be,onValueChange:xe,children:[Se,we]}),t[91]=e.busy,t[92]=ye,t[93]=Se,t[94]=we,t[95]=Te):Te=t[95];let Ee;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sessions bill the project's Expo account. "From the thread's project" reads extra.eas.projectId from the project's app config.`}),t[96]=Ee):Ee=t[96];let Oe;t[97]===Te?Oe=t[98]:(Oe=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ve,Te,Ee]}),t[97]=Te,t[98]=Oe);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 Ie;t[103]===_?Ie=t[104]:(Ie=_===null?null:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:_}),t[103]=_,t[104]=Ie);let Ve;t[105]!==te||t[106]!==se||t[107]!==_e||t[108]!==Oe||t[109]!==ke||t[110]!==je||t[111]!==Ie?(Ve=(0,Q.jsxs)(Le,{children:[te,se,_e,Oe,ke,je,Ie]}),t[105]=te,t[106]=se,t[107]=_e,t[108]=Oe,t[109]=ke,t[110]=je,t[111]=Ie,t[112]=Ve):Ve=t[112];let Ue;t[113]!==e.busy||t[114]!==e.onClose?(Ue=(0,Q.jsx)(b,{type:`button`,variant:`ghost`,disabled:e.busy,onClick:e.onClose,children:`Cancel`}),t[113]=e.busy,t[114]=e.onClose,t[115]=Ue):Ue=t[115];let We=e.busy||!g,Ge;t[116]===e.busy?Ge=t[117]:(Ge=e.busy?(0,Q.jsx)(ge,{size:`xs`}):null,t[116]=e.busy,t[117]=Ge);let Ke;t[118]!==We||t[119]!==Ge?(Ke=(0,Q.jsxs)(b,{type:`submit`,disabled:We,children:[Ge,` Save host`]}),t[118]=We,t[119]=Ge,t[120]=Ke):Ke=t[120];let qe;t[121]!==Ue||t[122]!==Ke?(qe=(0,Q.jsxs)(Fe,{children:[Ue,Ke]}),t[121]=Ue,t[122]=Ke,t[123]=qe):qe=t[123];let Je;t[124]!==I||t[125]!==B||t[126]!==Ve||t[127]!==qe?(Je=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-col`,onSubmit:I,children:[B,Ve,qe]}),t[124]=I,t[125]=B,t[126]=Ve,t[127]=qe,t[128]=Je):Je=t[128];let Ye;t[129]!==F||t[130]!==Je?(Ye=(0,Q.jsx)(ze,{showCloseButton:F,children:Je}),t[129]=F,t[130]=Je,t[131]=Ye):Ye=t[131];let Xe;return t[132]!==P||t[133]!==Ye?(Xe=(0,Q.jsx)(Be,{open:!0,onOpenChange:P,children:Ye}),t[132]=P,t[133]=Ye,t[134]=Xe):Xe=t[134],Xe}function on(e){return(0,Q.jsx)(G,{value:e.id,children:e.fullName},e.id)}function sn(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function cn(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 ln(e){return e.step!==`importing`}function un(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 dn(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 fn(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:un(e)}function pn(e){let t=fn(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function mn(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function hn(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function gn(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 _n(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=()=>un(n),t[0]=n,t[1]=p);let[m,h]=(0,$.useState)(p),g;t[2]===n.profiles[0]?.directory?g=t[3]:(g=()=>n.profiles[0]?.directory??``,t[2]=n.profiles[0]?.directory,t[3]=g);let[_,v]=(0,$.useState)(g),b;t[4]!==a||t[5]!==i?(b=()=>sn(a,i),t[4]=a,t[5]=i,t[6]=b):b=t[6];let[x,S]=(0,$.useState)(b),[C,w]=(0,$.useState)(),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=y(),t[7]=T):T=t[7];let E=(0,$.useRef)(`profile-${T}`),D=(0,$.useRef)(!1),O;t[8]!==o||t[9]!==_||t[10]!==x||t[11]!==i?(O=()=>{if(D.current)return;let e=cn(x,E.current,i);e===void 0?(w(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`})):(w(void 0),D.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(dn(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{D.current=!1}))},t[8]=o,t[9]=_,t[10]=x,t[11]=i,t[12]=O):O=t[12];let k=O,A;t[13]===s?A=t[14]:(A=(e,t)=>{h({step:`checking`,check:e}),s().then(e=>{e&&(f(e),v(t=>mn(t,e))),h(t(e))}).catch(()=>h({step:`blocked`,reason:`readFailed`}))},t[13]=s,t[14]=A);let j=A,M;t[15]===j?M=t[16]:(M=()=>j(`browser`,fn),t[15]=j,t[16]=M);let N=M,P;t[17]===j?P=t[18]:(P=()=>j(`fullDiskAccess`,pn),t[17]=j,t[18]=P);let F=P,I;t[19]!==u||t[20]!==m?(I=e=>e||!ln(m)?void 0:u(),t[19]=u,t[20]=m,t[21]=I):I=t[21];let L;t[22]===m?L=t[23]:(L=ln(m),t[22]=m,t[23]=L);let R;t[24]!==a||t[25]!==r||t[26]!==l||t[27]!==u||t[28]!==c||t[29]!==s||t[30]!==N||t[31]!==F||t[32]!==k||t[33]!==d||t[34]!==_||t[35]!==m||t[36]!==x||t[37]!==C||t[38]!==i?(R=m.step===`quit`?(0,Q.jsx)(vn,{source:d,onCancel:u,onRechecked:N}):m.step===`fullDiskAccess`?(0,Q.jsx)(xn,{source:d,onCancel:u,onOpenSettings:c,onCheck:l??(async()=>{let e=await s();return e!==void 0&&e.unavailable===void 0}),onGranted:m.resume===`import`?k:F,stillRequired:m.checked===!0}):m.step===`importing`?(0,Q.jsx)(wn,{}):m.step===`checking`?(0,Q.jsx)(Tn,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(En,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(Dn,{source:d,reason:m.reason,onClose:u,onRetry:hn(m.reason)?k:void 0}):(0,Q.jsx)(Sn,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:v,target:x,onTargetChange:e=>{S(e),w(void 0)},targetError:C,onCancel:u,onImport:k}),t[24]=a,t[25]=r,t[26]=l,t[27]=u,t[28]=c,t[29]=s,t[30]=N,t[31]=F,t[32]=k,t[33]=d,t[34]=_,t[35]=m,t[36]=x,t[37]=C,t[38]=i,t[39]=R):R=t[39];let z;t[40]!==L||t[41]!==R?(z=(0,Q.jsx)(ze,{className:`max-w-lg`,showCloseButton:L,children:R}),t[40]=L,t[41]=R,t[42]=z):z=t[42];let B;return t[43]!==z||t[44]!==I?(B=(0,Q.jsx)(Be,{open:!0,onOpenChange:I,children:z}),t[43]=z,t[44]=I,t[45]=B):B=t[45],B}function vn(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)(Ne,{children:[(0,Q.jsxs)(Pe,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(Re,{children:[n.name,` is open, so its cookies can’t be read yet. Quit it, then continue.`]})]}),t[0]=n.name,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(b,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(b,{onClick:i,children:`I’ve quit it`}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(Fe,{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 yn(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function bn(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function xn(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,f]=(0,$.useState)(null),p;t[0]===s?p=t[1]:(p=async()=>({fullDiskAccess:await s()}),t[0]=s,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={fullDiskAccess:!1},t[2]=m):m=t[2];let h=Mt(p,m),g;t[3]!==i||t[4]!==c?(g=()=>{c||(l(!0),f(null),Promise.resolve().then(i).catch(()=>f(`Could not open System Settings. Try Allow again.`)).finally(()=>l(!1)))},t[3]=i,t[4]=c,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=(0,Q.jsxs)(Ne,{children:[(0,Q.jsxs)(Pe,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(Re,{children:[`To import cookies from `,n.name,`, P4 Code needs Full Disk Access. Turn it on in System Settings, then come back to finish the import — you can revoke it again once the import is done.`]})]}),t[6]=n.name,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(d,{className:`size-8 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[8]=y):y=t[8];let x=`Read ${n.name}'s cookies for this import.`,S;t[9]===_?S=t[10]:(S=()=>void _(),t[9]=_,t[10]=S);let C;t[11]!==h.status.fullDiskAccess||t[12]!==x||t[13]!==S?(C=[{id:`fullDiskAccess`,icon:y,title:`Full Disk Access`,description:x,granted:h.status.fullDiskAccess,onAllow:S}],t[11]=h.status.fullDiskAccess,t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]!==c||t[16]!==C?(w=(0,Q.jsx)(At,{busy:c,permissions:C}),t[15]=c,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==u||t[19]!==h.error?(T=u||h.error?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:u??h.error}):null,t[18]=u,t[19]=h.error,t[20]=T):T=t[20];let E;t[21]!==h||t[22]!==o?(E=h.isReady([`fullDiskAccess`])?null:(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:o?`Access is still required. Quit and reopen P4 Code if you just allowed it, then retry the import.`:`If access doesn't update after you allow it, quit and reopen P4 Code, then retry the import.`}),t[21]=h,t[22]=o,t[23]=E):E=t[23];let D;t[24]!==T||t[25]!==E||t[26]!==w?(D=(0,Q.jsxs)(Le,{children:[w,T,E]}),t[24]=T,t[25]=E,t[26]=w,t[27]=D):D=t[27];let O;t[28]===r?O=t[29]:(O=(0,Q.jsx)(b,{variant:`outline`,onClick:r,children:`Cancel`}),t[28]=r,t[29]=O);let k;t[30]===h?k=t[31]:(k=h.isReady([`fullDiskAccess`]),t[30]=h,t[31]=k);let A;t[32]!==a||t[33]!==c||t[34]!==k?(A=(0,Q.jsx)(jt,{ready:k,busy:c,onClick:a,children:`Continue`}),t[32]=a,t[33]=c,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==O||t[37]!==A?(j=(0,Q.jsxs)(Fe,{children:[O,A]}),t[36]=O,t[37]=A,t[38]=j):j=t[38];let M;return t[39]!==D||t[40]!==j||t[41]!==v?(M=(0,Q.jsxs)(Q.Fragment,{children:[v,D,j]}),t[39]=D,t[40]=j,t[41]=v,t[42]=M):M=t[42],M}function Sn(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)(Pe,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=_);let v;t[6]===r?v=t[7]:(v=(0,Q.jsxs)(Re,{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)(Ne,{children:[_,v]}),t[8]=_,t[9]=v,t[10]=y):y=t[10];let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`From`}),t[11]=C):C=t[11];let w;if(t[12]!==s||t[13]!==n.profiles||t[14]!==o){let e;t[16]!==s||t[17]!==o?(e=e=>(0,Q.jsx)(Cn,{selected:o===e.directory,title:e.name,subtitle:yn(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],w=n.profiles.map(e),t[12]=s,t[13]=n.profiles,t[14]=o,t[15]=w}else w=t[15];let T;t[19]===w?T=t[20]:(T=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[C,w]}),t[19]=w,t[20]=T);let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(S,{className:`size-4 sm:hidden`}),(0,Q.jsx)(x,{className:`hidden size-4 sm:block`})]}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Into`}),t[22]=D):D=t[22];let O;t[23]!==a||t[24]!==u||t[25]!==c.kind?(O=a?(0,Q.jsx)(Cn,{selected:c.kind===`new`,title:`New profile`,subtitle:`Created for these cookies`,onSelect:()=>u({kind:`new`})}):null,t[23]=a,t[24]=u,t[25]=c.kind,t[26]=O):O=t[26];let k;if(t[27]!==u||t[28]!==c.kind||t[29]!==c.profileId||t[30]!==i){let e;t[32]!==u||t[33]!==c.kind||t[34]!==c.profileId?(e=e=>(0,Q.jsx)(Cn,{selected:c.kind===`existing`&&c.profileId===e.id,title:e.name,subtitle:`Existing profile`,onSelect:()=>u({kind:`existing`,profileId:e.id})},e.id),t[32]=u,t[33]=c.kind,t[34]=c.profileId,t[35]=e):e=t[35],k=i.map(e),t[27]=u,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=k}else k=t[31];let A;t[36]!==O||t[37]!==k?(A=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[D,O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==A||t[40]!==T?(j=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[T,E,A]}),t[39]=A,t[40]=T,t[41]=j):j=t[41];let M;t[42]===g?M=t[43]:(M=g?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:g}):null,t[42]=g,t[43]=M);let N;t[44]!==j||t[45]!==M?(N=(0,Q.jsxs)(Le,{children:[j,M]}),t[44]=j,t[45]=M,t[46]=N):N=t[46];let P;t[47]===d?P=t[48]:(P=(0,Q.jsx)(b,{variant:`outline`,onClick:d,children:`Cancel`}),t[47]=d,t[48]=P);let F=o===``||m||h,I;t[49]!==f||t[50]!==F?(I=(0,Q.jsx)(b,{disabled:F,onClick:f,children:`Import`}),t[49]=f,t[50]=F,t[51]=I):I=t[51];let L;t[52]!==P||t[53]!==I?(L=(0,Q.jsxs)(Fe,{children:[P,I]}),t[52]=P,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==N||t[56]!==L||t[57]!==y?(R=(0,Q.jsxs)(Q.Fragment,{children:[y,N,L]}),t[55]=N,t[56]=L,t[57]=y,t[58]=R):R=t[58],R}function Cn(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=E(`flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:r}),t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=i?(0,Q.jsx)(`span`,{className:`block truncate text-xs tabular-nums text-muted-foreground`,children:i}):null,t[4]=i,t[5]=l);let d;t[6]!==c||t[7]!==l?(d=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=d):d=t[8];let f=n?`border-primary bg-primary text-primary-foreground`:`border-input`,p;t[9]===f?p=t[10]:(p=E(`grid size-4 shrink-0 place-items-center rounded-full border`,f),t[9]=f,t[10]=p);let m;t[11]===n?m=t[12]:(m=n?(0,Q.jsx)(u,{className:`size-2.5`}):null,t[11]=n,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Q.jsx)(`span`,{className:p,children:m}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==a||t[17]!==n||t[18]!==s||t[19]!==d||t[20]!==h?(g=(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:a,className:s,children:[d,h]}),t[16]=a,t[17]=n,t[18]=s,t[19]=d,t[20]=h,t[21]=g):g=t[21],g}function wn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Pe,{children:`Importing cookies`}),(0,Q.jsx)(Re,{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)(Le,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(ge,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function Tn(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(Pe,{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)(Re,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(Ne,{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)(ge,{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)(Le,{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 En(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 ${bn(n)}`:r>0?`Skipped ${bn(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)(Pe,{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?` ${bn(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)(Re,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(Ne,{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)(Le,{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:gn(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(b,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(Fe,{children:(0,Q.jsx)(Ie,{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 Dn(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)(Pe,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=o);let s=I[r],c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(Re,{children:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c?(l=(0,Q.jsxs)(Ne,{children:[o,c]}),t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,Q.jsx)(b,{variant:`outline`,onClick:i,children:`Close`}),t[7]=i,t[8]=u);let d;t[9]===a?d=t[10]:(d=a?(0,Q.jsx)(b,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(Fe,{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 On=`fill`,kn=`responsive`;async function An(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 jn(e,t,n,r=0){return(e||r>0)&&t&&n>0}var Mn={width:1280,height:800},Nn={useGrouping:!1},Pn={system:`System`,light:`Light`,dark:`Dark`},Fn=e=>`${Math.round(e*100)}%`,In=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},Ln=e=>{let t=String(e?.message??``);return ne.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},Rn=e=>e._tag===`fill`?On:e._tag===`preset`&&Ct.some(t=>t.id===e.presetId)?e.presetId:kn,zn=e=>{let t=Rn(e);return t===On?`Fill panel`:t===kn?`Responsive`:Ct.find(e=>e.id===t)?.label??`Responsive`},Bn=e=>Number.isInteger(e)&&e>=240&&e<=3840,Vn=e=>({...e,width:e.height,height:e.width});function Hn(e){let t=(0,Z.c)(42),{disabled:n}=e,r=J(Wn),i=Y(),a=r._tag===`fill`?null:r,o=a?.width??Mn.width,s=a?.height??Mn.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===On){i({browserDefaultViewport:te});return}if(e===kn){i({browserDefaultViewport:{_tag:`freeform`,width:a?.width??Mn.width,height:a?.height??Mn.height}});return}let t=Ct.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||!Bn(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=xt(`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!==k._tag?(0,Q.jsx)(_t,{label:`default browser viewport`,onClick:()=>i({browserDefaultViewport:k})}):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=Rn(r),t[16]=r,t[17]=g);let _;t[18]===r?_=t[19]:(_=zn(r),t[18]=r,t[19]=_);let v;t[20]===_?v=t[21]:(v=(0,Q.jsx)(me,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(K,{children:_})}),t[20]=_,t[21]=v);let y,x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(G,{value:On,children:`Fill panel`}),x=(0,Q.jsx)(G,{value:kn,children:`Responsive`}),t[22]=y,t[23]=x):(y=t[22],x=t[23]);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(fe,{align:`end`,alignItemWithTrigger:!1,children:[y,x,(0,Q.jsxs)(pe,{children:[(0,Q.jsx)(de,{children:`Standard`}),Ct.map(Un)]})]}),t[24]=S):S=t[24];let C;t[25]!==n||t[26]!==d||t[27]!==v||t[28]!==g?(C=(0,Q.jsxs)(he,{value:g,onValueChange:d,disabled:n,children:[v,S]}),t[25]=n,t[26]=d,t[27]=v,t[28]=g,t[29]=C):C=t[29];let w;t[30]!==p||t[31]!==n||t[32]!==l||t[33]!==a||t[34]!==i?(w=a?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(ue,{value:l.width,min:240,max:R,disabled:n,format:Nn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`width`,e),children:(0,Q.jsx)(le,{children:(0,Q.jsx)(ce,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(ue,{value:l.height,min:240,max:R,disabled:n,format:Nn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`height`,e),children:(0,Q.jsx)(le,{children:(0,Q.jsx)(ce,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(je,{children:[(0,Q.jsx)(ke,{render:(0,Q.jsx)(b,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${l.height>=l.width?`landscape`:`portrait`}`,onClick:()=>i({browserDefaultViewport:Vn(a)}),children:(0,Q.jsx)(wt,{})})}),(0,Q.jsx)(Ae,{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 Un(e){return(0,Q.jsx)(G,{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 Wn(e){return e.browserDefaultViewport}function Gn(e){let t=(0,Z.c)(20),{disabled:n}=e,r=J(qn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xt(`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)(_t,{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=H.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=Fn(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(me,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(K,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(fe,{align:`end`,alignItemWithTrigger:!1,children:H.map(Kn)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(he,{disabled:n,value:s,onValueChange:c,children:[u,d]}),t[12]=n,t[13]=s,t[14]=c,t[15]=u,t[16]=f):f=t[16];let p;return t[17]!==o||t[18]!==f?(p=(0,Q.jsx)(X,{...a,description:`Page zoom applied to new browser tabs.`,resetAction:o,control:f}),t[17]=o,t[18]=f,t[19]=p):p=t[19],p}function Kn(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:String(e),children:Fn(e)},e)}function qn(e){return e.browserDefaultZoomFactor}function Jn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(Xn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xt(`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)(_t,{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=Pn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(me,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(K,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(fe,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(Pn).map(Yn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(he,{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 Yn(e){let[t,n]=e;return(0,Q.jsx)(G,{hideIndicator:!0,value:t,children:n},t)}function Xn(e){return e.browserDefaultAppearance}function Zn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=J($n),i=J(Qn),a=Y(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=xt(`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)(St,{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=xt(`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)(St,{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 Qn(e){return e.browserRecordingShowMousePresses}function $n(e){return e.browserRecordingShowKeyPresses}function er(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(nr),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xt(`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)(_t,{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=ae.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)(me,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(K,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(fe,{align:`end`,alignItemWithTrigger:!1,children:ae.map(tr)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(he,{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 tr(e){return(0,Q.jsxs)(G,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function nr(e){return e.browserRecordingFrameRate}var rr={system:`Your default browser`,app:`P4 Code`};function ir(e){let t=(0,Z.c)(19),{disabled:n}=e,r=J(or),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xt(`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)(_t,{label:`link target`,onClick:()=>i({browserLinkTarget:P})}):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=rr[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(me,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(K,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(rr),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(fe,{align:`end`,alignItemWithTrigger:!1,children:u.map(ar)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(he,{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 ar(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:rr[e]},e)}function or(e){return e.browserLinkTarget}var sr={duckduckgo:`DuckDuckGo`,google:`Google`,bing:`Bing`,brave:`Brave Search`,kagi:`Kagi`,ecosia:`Ecosia`,custom:`Custom`};function cr(){let e=(0,Z.c)(24),t=J(dr),n=J(ur),r=Y(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=xt(`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)(_t,{label:`search engine`,onClick:()=>r({browserSearchEngine:B,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=U.literals.find(t=>t===e);t!==void 0&&r({browserSearchEngine:t})},e[5]=r,e[6]=o);let s=sr[t],c;e[7]===s?c=e[8]:(c=(0,Q.jsx)(me,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Search engine`,children:(0,Q.jsx)(K,{children:s})}),e[7]=s,e[8]=c);let l;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(fe,{align:`end`,alignItemWithTrigger:!1,children:U.literals.map(lr)}),e[9]=l):l=e[9];let u;e[10]!==t||e[11]!==o||e[12]!==c?(u=(0,Q.jsxs)(he,{value:t,onValueChange:o,children:[c,l]}),e[10]=t,e[11]=o,e[12]=c,e[13]=u):u=e[13];let d;e[14]!==a||e[15]!==u?(d=(0,Q.jsx)(X,{...i,description:`What the address bar searches when you type something that isn't a URL.`,resetAction:a,control:u}),e[14]=a,e[15]=u,e[16]=d):d=e[16];let f;e[17]!==n||e[18]!==t||e[19]!==r?(f=t===`custom`?(0,Q.jsx)(X,{title:`Custom search URL`,description:`Use %s where the search terms go.`,status:et(n)?void 0:`Enter an http or https URL containing %s. Searches use DuckDuckGo until then.`,control:(0,Q.jsx)(Dt,{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:ie,value:n,onCommit:e=>r({browserCustomSearchUrl:e.trim()})})}):null,e[17]=n,e[18]=t,e[19]=r,e[20]=f):f=e[20];let p;return e[21]!==d||e[22]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[d,f]}),e[21]=d,e[22]=f,e[23]=p):p=e[23],p}function lr(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:sr[e]},e)}function ur(e){return e.browserCustomSearchUrl}function dr(e){return e.browserSearchEngine}function fr(){let e=(0,Z.c)(12),t=J(pr),n=Y(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=xt(`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)(_t,{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)(St,{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 pr(e){return e.pullRequestLinksOpenInApp}function mr(){let e=(0,Z.c)(7),{search:t,environment:n}=mt(),r=ft(),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)(vt,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(hr,{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 hr({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=we(e,M),{state:i,loaded:a}=Ve(e),{scope:o,environments:s,connectedEnvironments:c}=mt(),l=pt(),u=o.kind===`project`||o.kind===`checkout`,d=c.some(e=>e.serverConfig?.settings.enableDeviceSupport),f=De(He.configure,{reportFailure:!1}),p=De(He.list,{reportFailure:!1}),[m,h]=(0,$.useState)(null),g=i.hostStatus===`installing`||i.hostStatus===`starting`,_=i.hosts.some(e=>e.kind===`local`&&!e.platforms.some(e=>e.available)),[v,y]=(0,$.useState)(!1);v&&!t&&y(!1),t&&!v&&(i.hostStatus===`ready`||_)&&m!==`hub`&&y(!0);let x=async(t,n)=>{if(e&&Te(e,`settings:write`)){h(t);try{let e=await Promise.allSettled(s.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Te(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return f({environmentId:e.environmentId,input:{...n,...n.enabled?{onboardingCompleted:!0}:{}}})})),t=s.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});t.length>0&&q.add({type:`error`,title:`Device settings not saved on all environments`,description:`Could not update ${t.map(e=>e.label).join(`, `)}.`})}finally{h(null)}}},[S,C]=(0,$.useState)(null),T=i.hosts.find(e=>e.kind===`local`)?.tools,E=e=>{let t=T?.[e];return i.supportsToolUpdate&&t?!t.installedVersions.includes(t.requiredVersion):!1},D=(t,n=!1)=>{e&&(C(null),h(`update-${t}`),p({environmentId:e,input:{updateTool:t}}).then(e=>{if(e._tag===`Failure`){let r=Ee(e.cause);C({tool:t,message:r}),n&&q.add({type:`error`,title:r})}}).finally(()=>h(null)))},O=t=>{e&&(h(t),p({environmentId:e,input:{inspectOnly:!0}}).finally(()=>h(null)))},k=t=>{let n=E(t);if(!n&&!i.supportsToolInspection)return null;let r=m===`update-${t}`||m===`check-${t}`,a=n?`Update to v${T?.[t].requiredVersion}`:`Check ${t===`hub`?`device hub`:`agent device`} version`;return(0,Q.jsxs)(je,{children:[(0,Q.jsx)(ke,{render:(0,Q.jsx)(b,{size:`icon-xs`,variant:`ghost-muted`,disabled:!e||m!==null||g,"aria-label":a,onClick:()=>n?D(t,!0):O(`check-${t}`)}),children:(0,Q.jsxs)(`span`,{className:`grid *:col-start-1 *:row-start-1 *:transition-[opacity,scale] *:duration-150 *:ease-out motion-reduce:*:transition-none`,children:[(0,Q.jsx)(`span`,{className:n&&!r?void 0:`scale-75 opacity-0`,children:(0,Q.jsx)(w,{"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:n&&!r?`scale-75 opacity-0`:void 0,children:(0,Q.jsx)(bt,{refreshing:r})})]})}),(0,Q.jsx)(Ae,{side:`top`,children:a})]})},A=t=>{let n=T?.[t];return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&E(t)?(0,Q.jsx)(b,{size:`sm`,disabled:!e||m!==null||g,onClick:()=>D(t),children:m===`update-${t}`?`Updating…`:`Update to v${n.requiredVersion}`}):null,i.supportsToolInspection?(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:!e||m!==null||g,onClick:()=>O(`check`),children:m===`check`?`Checking…`:`Check versions`}):null]}),S?.tool===t?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:S.message}):null]})};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{...xt(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:qe,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Nt,{action:A(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`hub`),m===`hub`?(0,Q.jsx)(Ke,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Ot,{settingKeys:[`enableDeviceSupport`],checked:t,disabled:!r||u||!a||!e||g||m!==null,"aria-label":`Device hub`,onCheckedChange:e=>void x(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]})}),(0,Q.jsx)(Xe,{children:v?(0,Q.jsx)(X,{...xt(`device-platform-support`),description:c.length>1?`Status for ${c.find(t=>t.environmentId===e)?.label}. Select an environment to inspect its simulator support.`:void 0,status:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,Q.jsx)(We,{compact:!0,platform:`iOS`,status:Ge(i,`ios`)}),(0,Q.jsx)(We,{compact:!0,platform:`Android`,status:Ge(i,`android`)})]}),control:(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:!e||!t||g||m!==null,onClick:()=>{e&&(h(`check`),p({environmentId:e,input:{}}).finally(()=>h(null)))},children:m===`check`?`Checking…`:`Refresh`})}):null}),(0,Q.jsx)(X,{...xt(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:Ue,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Nt,{action:A(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`agent`),m===`agent`?(0,Q.jsx)(Je,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Ot,{settingKeys:[`enableAgentDeviceAccess`],checked:n,disabled:!r||c.length===0||!u&&(!a||!d||g)||m!==null,"aria-label":`Agent device access`,onCheckedChange:e=>u?l({enableAgentDeviceAccess:!!e}):void x(`agent`,{agentAccessEnabled:!!e})})]})}),e?(0,Q.jsx)(Ye,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(Kt,{environmentId:e}),i.supportsEasHosts?(0,Q.jsx)(rn,{environmentId:e}):null]})}function gr(e){let t=(0,Z.c)(14),{disabled:n}=e,r=J(_r),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xt(`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)(_t,{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)(St,{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 _r(e){return e.browserAutoShowFloatingPreview}function vr({disabled:e}){let t=J(e=>e.browserProfiles),n=J(e=>e.browserDefaultProfileId),r=be(),i=Y(),{environments:a,isReady:o}=_e(),c=ye(),[u,d]=(0,$.useState)(null),[h,v]=(0,$.useState)(null),[x,S]=(0,$.useState)(null),[w,O]=(0,$.useState)(null),[k,A]=(0,$.useState)(null),[j,M]=(0,$.useState)(!1),N=se(),P=De($e.clearProfile,{reportFailure:!1}),F={environmentIds:a.map(e=>e.environmentId).filter(e=>N.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await P({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw oe(n)}},I=jn(Tt!==null,o,a.length,F.environmentIds.length),R=(0,$.useRef)(!1),[B,ee]=(0,$.useState)(!1),V=e||!r,H=W(t).filter(e=>e.kind!==`incognito`),te=L(H,n)?.id??`default`,ne=e=>{if(!r||R.current)return;let t=Se().browserProfiles;if(t.length>=24)return;let n=W(t),a=new Set(n.map(e=>e.name)),o=e;for(let t=2;a.has(o);t+=1)o=`${e} ${t}`;let s={id:`profile-${y()}`,name:o,kind:`persistent`};return i({browserProfiles:[...t,s]}),s},ie=(e,t)=>{if(!r||R.current)return;let n=t.trim().slice(0,48);if(n===``)return;let a=Se().browserProfiles;i({browserProfiles:a.map(t=>t.id===e?{...t,name:n}:t)})},U=(e,t)=>{r&&!R.current&&(I?An(Tt,a.map(e=>e.environmentId),e,F).then(()=>{q.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{q.add({type:`error`,title:`Could not clear ${t}'s data`})}):q.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`}))},ae=async e=>{if(!r||R.current)return;if(!I){A(`Connect to an environment before removing this profile.`);return}A(null),M(!0);try{await An(Tt,o?a.map(e=>e.environmentId):[],e,F)}catch{A(`Profile data could not be deleted. Try again.`),M(!1);return}let t=Se();i({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:z}:{}}),M(!1),S(null)},ce=(u??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),le=(0,$.useCallback)(()=>{Tt&&Tt.listBrowserImportSources().then(d).catch(()=>d(e=>e??[]))},[]),ue=async(e,t,n)=>{if(!Tt||!r)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!W(Se().browserProfiles).some(e=>e.id===n.target.profileId)||R.current)return{kind:`blocked`,reason:`readFailed`};R.current=!0,ee(!0);try{let r=await Tt.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!W(Se().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 In;let r=new Set(W(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 An(Tt,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof In?`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:Ln(e)}}finally{R.current=!1,ee(!1)}},G=async e=>{if(Tt)try{let t=await Tt.listBrowserImportSources();return d(t),t.find(t=>t.id===e)}catch{return}},K=t.length>=24;return(0,Q.jsxs)(X,{...xt(`browser-profiles`),description:`Profiles separate cookies and logins. Incognito data is cleared when the app closes.`,control:(0,Q.jsxs)(m,{onOpenChange:e=>e&&le(),children:[(0,Q.jsxs)(_,{render:(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:V||B}),children:[(0,Q.jsx)(f,{}),`Add profile`]}),(0,Q.jsxs)(C,{align:`end`,children:[(0,Q.jsx)(D,{disabled:!r||K,onClick:()=>ne(`New profile`),children:`Blank profile`}),K?(0,Q.jsx)(D,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(T,{}),(0,Q.jsxs)(s,{children:[(0,Q.jsx)(g,{children:`Import from`}),u===null?(0,Q.jsx)(D,{disabled:!0,children:`Looking for browsers…`}):ce.length===0?(0,Q.jsx)(D,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[ce.map(e=>(0,Q.jsx)(D,{disabled:!r||c==null,onClick:()=>{r&&c!=null&&v({source:e,environmentId:c.environmentId,environmentName:yt({isPrimary:!0,environmentId:c.environmentId,runtimeLabel:c.label})})},children:e.name},e.id)),c==null?(0,Q.jsx)(D,{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:H.map((e,t)=>{let n=re(e.id),a=e.id===te;return(0,Q.jsxs)(`div`,{className:E(`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:E(`truncate text-sm text-foreground`,V&&`opacity-64`),children:e.name}):(0,Q.jsx)(Dt,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:V||B,maxLength:48,value:e.name,onCommit:t=>ie(e.id,t)}),a?(0,Q.jsx)(`span`,{className:E(`flex`,V&&`opacity-64`),children:(0,Q.jsx)(p,{children:`Default`})}):null]}),(0,Q.jsxs)(m,{children:[(0,Q.jsx)(_,{render:(0,Q.jsx)(b,{size:`icon-xs`,variant:`ghost-muted`,disabled:V||B,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(l,{})}),(0,Q.jsxs)(C,{align:`end`,children:[(0,Q.jsx)(D,{disabled:!r||a,onClick:()=>{r&&i({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(D,{disabled:!r||!I,onClick:()=>{F.environmentIds.length>0?O(e):U(e.id,e.name)},children:`Clear cookies and cache`}),n?null:(0,Q.jsx)(D,{variant:`destructive`,disabled:!r||!I,onClick:()=>{r&&S(e)},children:`Remove profile and data`}),I?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(T,{}),(0,Q.jsx)(D,{disabled:!0,children:o?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(dt,{open:x!==null,onOpenChange:e=>{!e&&!j&&(S(null),A(null))},children:(0,Q.jsxs)(ct,{children:[(0,Q.jsxs)(at,{children:[(0,Q.jsxs)(ut,{children:[`Remove “`,x?.name,`”?`]}),(0,Q.jsx)(lt,{children:`Its cookies and logins are deleted. Desktop tabs already open in this profile stay open until you close them; server browser tabs close now.`}),k?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:k}):null,I?null:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect to an environment to remove this profile and its data.`})]}),(0,Q.jsxs)(ot,{children:[(0,Q.jsx)(st,{disabled:j,render:(0,Q.jsx)(b,{variant:`outline`,disabled:j}),children:`Cancel`}),(0,Q.jsx)(b,{variant:`destructive`,disabled:j||!r||!I,onClick:()=>{x&&r&&I&&ae(x.id)},children:j?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(dt,{open:w!==null,onOpenChange:e=>{e||O(null)},children:(0,Q.jsxs)(ct,{children:[(0,Q.jsxs)(at,{children:[(0,Q.jsxs)(ut,{children:[`Clear “`,w?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(lt,{children:`You are signed out of its sites. Server browser tabs open in this profile close now.`})]}),(0,Q.jsxs)(ot,{children:[(0,Q.jsx)(st,{render:(0,Q.jsx)(b,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(b,{variant:`destructive`,onClick:()=>{w&&U(w.id,w.name),O(null)},children:`Clear data`})]})]})}),h?(0,Q.jsx)(_n,{source:h.source,destinationEnvironmentName:h.environmentName,targetProfiles:H.map(e=>({id:e.id,name:e.name})),canCreateProfile:r&&!K,onImport:e=>ue(h.source,h.environmentId,e),onRefreshSource:()=>G(h.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await ve()?.shell.openSystemSettings(`full-disk-access`).catch(()=>{q.add({type:`error`,title:`Could not open System Settings`,description:`Open Privacy & Security → Full Disk Access manually.`})})},onClose:()=>v(null)}):null]})}function yr(){let e=(0,Z.c)(3),t=!Oe,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vr,{disabled:t}),(0,Q.jsx)(Hn,{disabled:t}),(0,Q.jsx)(Gn,{disabled:t}),(0,Q.jsx)(Jn,{disabled:t}),(0,Q.jsx)(er,{disabled:t}),(0,Q.jsx)(Zn,{disabled:t}),(0,Q.jsx)(ir,{disabled:t}),(0,Q.jsx)(gr,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Et,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(gt,{children:[i,(0,Q.jsxs)(vt,{id:`browser`,title:`Browser`,children:[t?(0,Q.jsx)(ht,{message:`Only available in the desktop app.`,children:r}):r,(0,Q.jsx)(cr,{}),(0,Q.jsx)(fr,{})]}),(0,Q.jsx)(mr,{})]}),e[2]=a):a=e[2],a}var br=yr;export{br as component};
2
- //# sourceMappingURL=settings.integrations-DRpNV9D5.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{t as i}from"./cloud-BhcSs4Ie.js";import{t as a}from"./plus-B2sOrZDk.js";import{t as o}from"./x-C35beONT.js";import{$n as s,Cd as c,Dd as l,Dl as u,Vu as d,Xd as f,Xn as p,Zn as m,ap as h,er as g,fr as _,hr as v,l as y,mr as b,ol as x,rl as S,rr as C,ru as w,sr as T,t as E,tr as D,wd as O}from"./utils-DkKLB01I.js";import{An as k,Gp as A,Ic as j,Ma as M,Ns as N,On as P,Ps as F,_ as I,_i as L,di as R,hi as z,kn as B,mh as ee,oi as V,pi as H,si as te,v as ne,vi as re,vn as ie,xn as U,yi as W,yn as ae}from"./src-R7EkrVcv.js";import{Dr as oe}from"./runtime-BvdQMwVb.js";import{w as se}from"./entities-DOpLfnwX.js";import{a as ce,r as le,t as ue}from"./number-field-BkDsfSCt.js";import{a as G,c as K,i as de,o as fe,r as pe,s as me,t as he}from"./select-CE2f-g-3.js";import{t as ge}from"./spinner-C-qDE4WQ.js";import{a as q}from"./relay-CTdDIWLg.js";import{D as _e,J as ve,O as ye,c as be,o as xe,r as Se,s as J,x as Y}from"./useSettings-BhGGZc98.js";import{f as Ce}from"./server-DthHkqkT.js";import{i as we,n as Te}from"./session-CxeYe0sJ.js";import{t as Ee}from"./query-CeIgbVxh.js";import{t as De}from"./use-atom-command-Bsfu4mja.js";import{t as Oe}from"./env-BfPir1X4.js";import{a as ke,n as Ae,t as je}from"./tooltip-CCYU8XGM.js";import{t as Me}from"./input-CiPGmOLv.js";import{a as Ne,c as Pe,i as Fe,n as Ie,o as Le,r as Re,s as ze,t as Be}from"./dialog-5OaxRXCC.js";import{i as Ve,t as He}from"./device-Ku4cbgo-.js";import{a as Ue,i as We,l as Ge,n as Ke,o as qe,t as Je,u as Ye}from"./DeviceSetup-Lxy9dmqi.js";import{t as Xe}from"./AnimatedHeight-BoS1RBdk.js";import{i as Ze,n as Qe}from"./Icons-DmQwwfAN.js";import{t as $e}from"./preview-5pSBET3P.js";import{r as et}from"./preview-DnCP9Q0k.js";import{a as tt,i as nt,o as rt,t as it}from"./popover-hyDlWUPU.js";import{a as at,i as ot,n as st,o as ct,r as lt,s as ut,t as dt}from"./alert-dialog-DsMTn0ZK.js";import{F as ft,R as pt,V as mt,a as X,c as ht,i as gt,r as _t,s as vt,w as yt}from"./settingsLayout-YTaL8Lym.js";import{Ho as bt,Lr as xt,Mo as St,Qa as Ct,Za as wt,ao as Tt}from"./main-C04YJQbN.js";import{t as Et}from"./ProjectDefaultsSettings-DN1mhFNf.js";import{t as Dt}from"./draft-input-DM7mC5ty.js";import{t as Ot}from"./ScopedSwitch-Cq7B0T7B.js";import{t as kt}from"./SecretInput-CRgvNUgU.js";import{n as At,r as jt,t as Mt}from"./usePermissionStatus-C5YvHVz-.js";var Z=n(),Q=e(r(),1);function Nt(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(Pt).at(-1)),t[0]=s,t[1]=c);let l=c,u=i===`hub`?`Device hub`:`Agent device`,d=i?`${u}: ${l?`version ${l}`:s?`not installed`:`version unknown`}. Show details`:void 0,f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(v,{tone:`muted`}),t[2]=f):f=t[2];let p=i?l?`v${l}`:s?`Not installed`:`Version unknown`:o?`Versions unavailable`:`Versions`,m;t[3]!==d||t[4]!==p?(m=(0,Q.jsx)(rt,{"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)(tt,{children:h}),t[6]=h,t[7]=g);let _;t[8]!==i||t[9]!==u||t[10]!==n?(_=n?(0,Q.jsx)(`div`,{className:`mt-4 divide-y divide-border/50`,children:[[`Device hub`,n.hub],[`Agent device`,n.agent]].filter(e=>{let[t]=e;return!i||t===u}).map(e=>{let[t,n]=e;return(0,Q.jsxs)(`div`,{className:`space-y-2 py-3 first:pt-0 last:pb-0`,children:[i?null:(0,Q.jsx)(`p`,{className:`text-xs font-medium`,children:t}),(0,Q.jsxs)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs`,children:[(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Running`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.runningVersion??`Not running`}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Required`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono`,children:n.requiredVersion}),(0,Q.jsx)(`dt`,{className:`text-muted-foreground`,children:`Installed`}),(0,Q.jsx)(`dd`,{className:`text-right font-mono break-words`,children:n.installedVersions.join(`, `)||`None`})]})]},t)})}):(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:`Versions have not been checked.`}),t[8]=i,t[9]=u,t[10]=n,t[11]=_):_=t[11];let y=a?`Managed by ${a}. `:``,b;t[12]===y?b=t[13]:(b=(0,Q.jsxs)(`p`,{className:`mt-4 border-t border-border/50 pt-3 text-xs text-muted-foreground`,children:[y,`Tools update automatically on this host when needed.`]}),t[12]=y,t[13]=b);let x;t[14]===o?x=t[15]:(x=o?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-destructive`,children:o}):null,t[14]=o,t[15]=x);let S;t[16]===r?S=t[17]:(S=r?(0,Q.jsx)(`div`,{className:`mt-3`,children:r}):null,t[16]=r,t[17]=S);let C;t[18]!==b||t[19]!==x||t[20]!==S||t[21]!==g||t[22]!==_?(C=(0,Q.jsxs)(nt,{align:`end`,width:`md`,children:[g,_,b,x,S]}),t[18]=b,t[19]=x,t[20]=S,t[21]=g,t[22]=_,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==m?(w=(0,Q.jsxs)(it,{children:[m,C]}),t[24]=C,t[25]=m,t[26]=w):w=t[26],w}function Pt(e,t){return e.localeCompare(t,void 0,{numeric:!0})}var $=e(t(),1);function Ft(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 It(e){let t=(0,Z.c)(4),{platforms:n}=e,r;t[0]===n?r=t[1]:(r=n.map(Lt),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 Lt(e){return(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(ke,{render:(0,Q.jsx)(`span`,{tabIndex:0,className:`inline-flex items-center gap-1`}),children:[e.available?(0,Q.jsx)(u,{className:`size-3`}):(0,Q.jsx)(c,{className:`size-3`}),e.platform===`ios`?`iOS`:`Android`,` `,e.available?`available`:`unavailable`]}),(0,Q.jsx)(Ae,{children:e.reason??(e.platform===`ios`?`iOS available`:`Android available`)})]},e.platform)}var Rt=j(F);function zt(e){let{identityFile:t,...n}=e;return Rt({...n,...t?.trim()?{identityFile:t.trim()}:{}})}function Bt(e){return JSON.stringify([e.target.trim(),e.port,e.identityFile?.trim()||void 0])}async function Vt(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 Ht(e){let t=De(He.testHost,{reportFailure:!1}),[n,r]=(0,$.useState)({}),i=(0,$.useRef)(new Set);return{checks:n,testConnection:async n=>{let a=Bt(n);if(i.current.has(a))return;i.current.add(a),r(e=>({...e,[a]:{}}));let o={};try{return await Vt(e,n,async(e,n)=>{if(!Te(e,`settings:write`))throw Error(`This connection cannot test device hosts.`);let r=await t({environmentId:e,input:n});if(r._tag===`Failure`)throw oe(r);return r.value},(e,t)=>{o[e]=t,r(n=>({...n,[a]:{...n[a],[e]:t}}))}),o}finally{i.current.delete(a)}}}}function Ut(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}=Ht(i),p=d[Bt(c)],m=Object.values(p??{}).some(Gt),g,_;t[0]===c?(g=t[1],_=t[2]):(g=zt({...c,label:c.label.trim()||c.target}),_=ee(g),t[0]=c,t[1]=g,t[2]=_);let v=_,y;t[3]===p?y=t[4]:(y=Object.values(p??{}).filter(Wt),t[3]=p,t[4]=y);let x=y.length,S;t[5]!==a||t[6]!==s?(S=e=>{!e&&!a&&s()},t[5]=a,t[6]=s,t[7]=S):S=t[7];let C=!a,w;t[8]!==a||t[9]!==m||t[10]!==c.label||t[11]!==g||t[12]!==o?(w=(0,Q.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),ee(g)&&c.label.trim()&&!a&&!m&&o(g.value)}}),t[8]=a,t[9]=m,t[10]=c.label,t[11]=g,t[12]=o,t[13]=w):w=t[13];let T=r?`Add device host`:`Edit device host`,E;t[14]===T?E=t[15]:(E=(0,Q.jsx)(Pe,{children:T}),t[14]=T,t[15]=E);let D=i.length===1?`Connect from ${i[0]?.label}.`:`Connect from ${i.length} selected environments.`,k;t[16]===D?k=t[17]:(k=(0,Q.jsxs)(Re,{children:[D,` `,`Hosts on the same machine are skipped.`]}),t[16]=D,t[17]=k);let A;t[18]!==E||t[19]!==k?(A=(0,Q.jsxs)(Ne,{children:[E,k]}),t[18]=E,t[19]=k,t[20]=A):A=t[20];let j;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(`span`,{children:`Name`}),t[21]=j):j=t[21];let M;t[22]===c?M=t[23]:(M=e=>l({...c,label:e.target.value}),t[22]=c,t[23]=M);let N;t[24]!==a||t[25]!==c.label||t[26]!==M?(N=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[j,(0,Q.jsx)(Me,{autoFocus:!0,required:!0,value:c.label,disabled:a,onChange:M,placeholder:`Mac mini`})]}),t[24]=a,t[25]=c.label,t[26]=M,t[27]=N):N=t[27];let P;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(`span`,{children:`SSH target`}),t[28]=P):P=t[28];let F;t[29]===c?F=t[30]:(F=e=>l({...c,target:e.target.value}),t[29]=c,t[30]=F);let I;t[31]!==a||t[32]!==c.target||t[33]!==F?(I=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[P,(0,Q.jsx)(Me,{required:!0,value:c.target,disabled:a,onChange:F,placeholder:`user@host or SSH alias`})]}),t[31]=a,t[32]=c.target,t[33]=F,t[34]=I):I=t[34];let L=n.port!==void 0||n.identityFile!==void 0||void 0,R;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(`summary`,{className:`cursor-pointer text-muted-foreground`,children:`SSH options`}),t[35]=R):R=t[35];let z;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(`span`,{children:`Identity file`}),t[36]=z):z=t[36];let B=c.identityFile??``,V;t[37]===c?V=t[38]:(V=e=>{let{identityFile:t,...n}=c;l(e.target.value?{...n,identityFile:e.target.value}:n)},t[37]=c,t[38]=V);let H;t[39]!==a||t[40]!==B||t[41]!==V?(H=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[z,(0,Q.jsx)(Me,{value:B,disabled:a,onChange:V,placeholder:`SSH config default`})]}),t[39]=a,t[40]=B,t[41]=V,t[42]=H):H=t[42];let te;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(`span`,{children:`Port`}),t[43]=te):te=t[43];let ne=c.port??``,re;t[44]===c?re=t[45]:(re=e=>{let{port:t,...n}=c;l(e.target.value?{...n,port:Number(e.target.value)}:n)},t[44]=c,t[45]=re);let ie;t[46]!==a||t[47]!==ne||t[48]!==re?(ie=(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[te,(0,Q.jsx)(Me,{type:`number`,min:1,max:65535,value:ne,disabled:a,onChange:re,placeholder:`Default`})]}),t[46]=a,t[47]=ne,t[48]=re,t[49]=ie):ie=t[49];let U;t[50]!==H||t[51]!==ie?(U=(0,Q.jsxs)(`div`,{className:`mt-3 grid grid-cols-[minmax(0,1fr)_7rem] gap-3`,children:[H,ie]}),t[50]=H,t[51]=ie,t[52]=U):U=t[52];let W;t[53]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`Optional. Resolved separately on each environment.`}),t[53]=W):W=t[53];let ae;t[54]!==L||t[55]!==U?(ae=(0,Q.jsxs)(`details`,{open:L,className:`text-sm`,children:[R,U,W]}),t[54]=L,t[55]=U,t[56]=ae):ae=t[56];let oe=m?`Checking environments…`:p?x?`${x} of ${i.length} failed`:`Connection checks passed`:`Check access before saving`,se;t[57]===oe?se=t[58]:(se=(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted-foreground`,children:oe}),t[57]=oe,t[58]=se);let ce=a||m||!v,le;t[59]!==g||t[60]!==f?(le=()=>{ee(g)&&f(g.value)},t[59]=g,t[60]=f,t[61]=le):le=t[61];let ue;t[62]===m?ue=t[63]:(ue=m?(0,Q.jsx)(ge,{size:`xs`}):null,t[62]=m,t[63]=ue);let G;t[64]!==ce||t[65]!==le||t[66]!==ue?(G=(0,Q.jsxs)(b,{type:`button`,size:`sm`,variant:`outline`,disabled:ce,onClick:le,children:[ue,` Test connection`]}),t[64]=ce,t[65]=le,t[66]=ue,t[67]=G):G=t[67];let K;t[68]!==se||t[69]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 px-3 py-2.5`,children:[se,G]}),t[68]=se,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)(ge,{size:`xs`}),` Checking…`]}):t.status===`local`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(O,{className:`size-3`}),` Already available locally`]}):t.status===`failed`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(h,{className:`size-3`}),` Failed`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(u,{className:`size-3`}),` Connected`]})})]}),t.status===`connected`?(0,Q.jsx)(`div`,{className:`mt-1.5`,children:(0,Q.jsx)(It,{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]!==N||t[78]!==I||t[79]!==ae||t[80]!==fe?(pe=(0,Q.jsxs)(Le,{children:[N,I,ae,fe]}),t[77]=N,t[78]=I,t[79]=ae,t[80]=fe,t[81]=pe):pe=t[81];let me;t[82]!==a||t[83]!==s?(me=(0,Q.jsx)(b,{type:`button`,variant:`ghost`,disabled:a,onClick:s,children:`Cancel`}),t[82]=a,t[83]=s,t[84]=me):me=t[84];let he;t[85]!==a||t[86]!==m||t[87]!==c.label||t[88]!==v?(he=a||m||!v||!c.label.trim(),t[85]=a,t[86]=m,t[87]=c.label,t[88]=v,t[89]=he):he=t[89];let q;t[90]===a?q=t[91]:(q=a?(0,Q.jsx)(ge,{size:`xs`}):null,t[90]=a,t[91]=q);let _e;t[92]!==he||t[93]!==q?(_e=(0,Q.jsxs)(b,{type:`submit`,disabled:he,children:[q,` Save host`]}),t[92]=he,t[93]=q,t[94]=_e):_e=t[94];let ve;t[95]!==me||t[96]!==_e?(ve=(0,Q.jsxs)(Fe,{children:[me,_e]}),t[95]=me,t[96]=_e,t[97]=ve):ve=t[97];let ye;t[98]!==A||t[99]!==pe||t[100]!==C||t[101]!==ve||t[102]!==w?(ye=(0,Q.jsxs)(ze,{showCloseButton:C,render:w,children:[A,pe,ve]}),t[98]=A,t[99]=pe,t[100]=C,t[101]=ve,t[102]=w,t[103]=ye):ye=t[103];let be;return t[104]!==S||t[105]!==ye?(be=(0,Q.jsx)(Be,{open:!0,onOpenChange:S,children:ye}),t[104]=S,t[105]=ye,t[106]=be):be=t[106],be}function Wt(e){return e.status===`failed`}function Gt(e){return e.status===`pending`}function Kt(e){let{scope:t,environments:n,connectedEnvironments:r}=mt(),i=we(e.environmentId,M),a=t.kind===`project`||t.kind===`checkout`,o=De(Ce.updateSettings,{reportFailure:!1}),[s,c]=(0,$.useState)(null),[l,u]=(0,$.useState)(null),[d,p]=(0,$.useState)(!1),m=n.map(e=>({environmentId:e.environmentId,label:e.label,connected:e.connection.phase===`connected`})),{checks:h,testConnection:g}=Ht(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(!Te(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return o({environmentId:e.environmentId,input:{patch:{deviceHosts:Ft(e.serverConfig.settings.deviceHosts,t,r,i)}}})})),a=n.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});a.length===0?c(null):q.add({type:`error`,title:`Device hosts not saved on all environments`,description:`Could not update ${a.map(e=>e.label).join(`, `)}.`})}finally{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)(b,{size:`sm`,variant:`outline`,disabled:!i||a||d||!e.environmentId||s!==null,onClick:()=>{u(null),c({kind:`ssh`,id:y(),label:``,target:``})},children:[(0,Q.jsx)(f,{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)(qt,{environmentLabel:e.label,environmentId:e.environmentId,hosts:e.serverConfig?.settings.deviceHosts??[],busy:!i||a||d,checks:h,testConnection:async e=>{let t=await g(e);if(!t)return;let n=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=>{u(e),c(e)},onRemove:e=>void _(e,!0)})]},e.environmentId)),s?(0,Q.jsx)(Ut,{host:s,isNew:l===null,targets:m,busy:d,onSave:e=>void _(e,!1,l??e),onClose:()=>c(null)},s.id):null]}):(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect a selected environment to manage device hosts.`})})})}function qt(e){let t=(0,Z.c)(28),{environmentLabel:n,environmentId:r,hosts:i,busy:a,onEdit:o,onRemove:s,checks:c,testConnection:u}=e,{state:d}=Ve(r),f=De(He.list),[p,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 v;if(t[2]!==a||t[3]!==c||t[4]!==r||t[5]!==n||t[6]!==i||t[7]!==o||t[8]!==s||t[9]!==f||t[10]!==p||t[11]!==d||t[12]!==u){let e;t[14]!==a||t[15]!==c||t[16]!==r||t[17]!==n||t[18]!==o||t[19]!==s||t[20]!==f||t[21]!==p||t[22]!==d||t[23]!==u?(e=e=>{let t=d.hostStatuses[e.id],i=c[Bt(e)]?.[r],g=(i?.status===`connected`?i.platforms:void 0)??d.hosts.find(t=>t.id===e.id)?.platforms??[],v=i?.status===`pending`?`Checking connection…`:t?.status===`installing`?`Installing device support…`:t?.status===`starting`?`Connecting…`:null,y=i?.status===`failed`?i.error:i?.status===`local`?void 0:t?.status===`failed`?t.detail:void 0;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 border-t border-border/50 py-2.5`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`truncate text-sm font-medium`,children:e.label}),g.filter(Yt).map(Jt)]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:e.target}),(0,Q.jsx)(Nt,{owner:n,error:d.hosts.find(t=>t.id===e.id)?.toolInspectionError,tools:d.hosts.find(t=>t.id===e.id)?.tools??(i?.status===`connected`?i.tools:void 0)}),i?.status===`local`?(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Already available locally`}):null,y?(0,Q.jsx)(`div`,{className:`mt-1`,role:`status`,children:(0,Q.jsxs)(`details`,{className:`text-xs text-destructive`,children:[(0,Q.jsx)(`summary`,{children:`Connection failed`}),(0,Q.jsx)(`p`,{className:`mt-1 whitespace-pre-wrap break-words`,children:y})]})}):null]}),v?(0,Q.jsxs)(`span`,{role:`status`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,Q.jsx)(ge,{size:`xs`}),v]}):null,(0,Q.jsxs)(m,{children:[(0,Q.jsx)(_,{render:(0,Q.jsx)(b,{size:`icon-sm`,variant:`ghost-muted`,disabled:a,"aria-label":e.label+` options`}),children:(0,Q.jsx)(l,{})}),(0,Q.jsxs)(C,{align:`end`,children:[(0,Q.jsx)(D,{onClick:()=>{o(e)},children:`Edit`}),(0,Q.jsx)(D,{variant:`destructive`,onClick:()=>s(e),children:`Remove`})]})]}),t?.status===`failed`&&d.supportsHostRetry&&d.hostStatus!==`disabled`?(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:a||p!==null,onClick:()=>{h(e.id),f({environmentId:r,input:{retryHostId:e.id}}).finally(()=>h(null))},children:p===e.id?`Retrying…`:`Retry`}):(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:a||v!==null,onClick:()=>void u(e),children:`Test connection`})]},e.id)},t[14]=a,t[15]=c,t[16]=r,t[17]=n,t[18]=o,t[19]=s,t[20]=f,t[21]=p,t[22]=d,t[23]=u,t[24]=e):e=t[24],v=i.map(e),t[2]=a,t[3]=c,t[4]=r,t[5]=n,t[6]=i,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=d,t[12]=u,t[13]=v}else v=t[13];let y;return t[25]!==g||t[26]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[g,v]}),t[25]=g,t[26]=v,t[27]=y):y=t[27],y}function Jt(e){return(0,Q.jsxs)(je,{children:[(0,Q.jsx)(ke,{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)(Ze,{className:`size-3.5 -translate-y-px`}):(0,Q.jsx)(Qe,{className:`size-3.5`})}),(0,Q.jsx)(Ae,{children:e.platform===`ios`?`iOS available`:`Android available`})]},e.platform)}function Yt(e){return e.available}var Xt=j(N),Zt=e=>({kind:`eas`,id:e,label:`EAS Simulator`,accessToken:``,maxSessionMinutes:30,idleMinutes:10,maxConcurrentSessions:2});function Qt(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 $t(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 en=`thread-project`,tn={settings:`the access token saved here`,env:`EXPO_TOKEN on the server`,"eas-login":`the server's eas login`},nn=e=>{let t=A(e);return t instanceof Error?t.message:String(t)};function rn(e){let t=(0,Z.c)(24),{scope:n,connectedEnvironments:r}=mt(),o=we(e.environmentId,M),s=n.kind===`project`||n.kind===`checkout`,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={reportFailure:!1},t[0]=c):c=t[0];let l=De(Ce.updateSettings,c),u;t[1]===e.environmentId?u=t[2]:(u=t=>t.environmentId===e.environmentId,t[1]=e.environmentId,t[2]=u);let d=r.find(u)?.serverConfig?.settings.easDeviceHosts??[],[f,p]=(0,$.useState)(null),[m,h]=(0,$.useState)(!1),g=!o||s||m||!e.environmentId,_=async(t,n)=>{if(!e.environmentId||!Te(e.environmentId,`settings:write`))return;h(!0);let r=await l({environmentId:e.environmentId,input:{patch:{easDeviceHosts:Qt(d,t,n)}}});h(!1),r._tag===`Success`?p(null):q.add({type:`error`,title:n?`EAS host not removed`:`EAS host not saved`,description:nn(r.cause)})},v=X,x;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(x=[`easDeviceHosts`],t[3]=x):x=t[3];let S=g||f!==null,C;t[4]===p?C=t[5]:(C=()=>p({host:Zt(y()),isNew:!0}),t[4]=p,t[5]=C);let w;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,Q.jsx)(a,{className:`size-3.5`}),t[6]=w):w=t[6];let T;t[7]!==S||t[8]!==C?(T=(0,Q.jsxs)(b,{size:`sm`,variant:`outline`,disabled:S,onClick:C,children:[w,` Add EAS host`]}),t[7]=S,t[8]=C,t[9]=T):T=t[9];let E=d.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No EAS hosts.`}):(0,Q.jsx)(`ul`,{className:`divide-y divide-border/40`,children:d.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2.5 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 truncate font-medium`,children:[(0,Q.jsx)(i,{className:`size-3.5 shrink-0`}),` `,e.label]}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,children:$t(e)})]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(b,{size:`sm`,variant:`ghost`,disabled:g,onClick:()=>p({host:e,isNew:!1}),children:`Edit`}),(0,Q.jsx)(b,{size:`sm`,variant:`ghost-destructive`,disabled:g,onClick:()=>void _(e,!0),children:`Remove`})]})]},e.id))}),D;t[10]!==m||t[11]!==f||t[12]!==e.environmentId||t[13]!==_||t[14]!==p?(D=f&&e.environmentId?(0,Q.jsx)(an,{environmentId:e.environmentId,host:f.host,isNew:f.isNew,busy:m,onSave:e=>void _(e,!1),onClose:()=>p(null)},f.host.id):null,t[10]=m,t[11]=f,t[12]=e.environmentId,t[13]=_,t[14]=p,t[15]=D):D=t[15];let O;t[16]!==E||t[17]!==D?(O=(0,Q.jsxs)(`div`,{className:`pt-3 pb-2`,children:[E,D]}),t[16]=E,t[17]=D,t[18]=O):O=t[18];let k;return t[19]!==v||t[20]!==T||t[21]!==O||t[22]!==x?(k=(0,Q.jsx)(v,{id:`eas-device-hosts`,title:`EAS Simulator`,serverScoped:!0,settingKeys:x,description:`Run iOS Simulators and Android emulators in Expo's cloud from this environment. Sessions bill the Expo account until they stop, so each host limits how many run and for how long. Editing or removing a host stops its running sessions.`,control:T,children:O}),t[19]=v,t[20]=T,t[21]=O,t[22]=x,t[23]=k):k=t[23],k}function an(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=De(He.easAccount,n),[i,a]=(0,$.useState)(e.host),s=(0,$.useId)(),c;t[1]===e.host.accessToken?c=t[2]:(c=e.host.accessToken?{kind:`saved`}:{kind:`cleared`},t[1]=e.host.accessToken,t[2]=c);let[l,u]=(0,$.useState)(c),d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d={status:`checking`},t[3]=d):d=t[3];let[f,p]=(0,$.useState)(d),m,h;t[4]!==i||t[5]!==e.host.accessToken||t[6]!==l.kind||t[7]!==l.value?(m={...i,label:i.label.trim(),accessToken:l.kind===`saved`?e.host.accessToken:l.kind===`new`?l.value:``},h=ee(Xt(m)),t[4]=i,t[5]=e.host.accessToken,t[6]=l.kind,t[7]=l.value,t[8]=m,t[9]=h):(m=t[8],h=t[9]);let g=h,_=g?null:i.maxSessionMinutes>0&&i.idleMinutes>=i.maxSessionMinutes?`Idle minutes must be smaller than session minutes.`:`Give the host a label and limits within the ranges shown.`,v;t[10]!==f.account||t[11]!==f.status?(v=f.status===`signed-in`?f.account.apps:[],t[10]=f.account,t[11]=f.status,t[12]=v):v=t[12];let y=v,x=(0,$.useRef)(0),S;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>{x.current+=1,p({status:`idle`})},t[13]=S):S=t[13];let C=S,w;t[14]!==r||t[15]!==e.environmentId||t[16]!==e.host.id||t[17]!==e.isNew||t[18]!==l.kind||t[19]!==l.value?(w=async()=>{let t=x.current+=1,n=await r({environmentId:e.environmentId,input:{...l.kind===`saved`&&!e.isNew?{hostId:e.host.id}:{},...l.kind===`new`?{accessToken:l.value}:l.kind===`cleared`?{accessToken:``}:{}}});t===x.current&&p(n._tag===`Success`?{status:`signed-in`,account:n.value}:{status:`failed`,error:nn(n.cause)})},t[14]=r,t[15]=e.environmentId,t[16]=e.host.id,t[17]=e.isNew,t[18]=l.kind,t[19]=l.value,t[20]=w):w=t[20];let T=w,E;t[21]===T?E=t[22]:(E=()=>{p({status:`checking`}),T()},t[21]=T,t[22]=E);let D=E,O;t[23]===T?O=t[24]:(O=()=>void T(),t[23]=T,t[24]=O);let k=(0,$.useEffectEvent)(O),A;t[25]===k?A=t[26]:(A=()=>{k()},t[25]=k,t[26]=A);let j;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(j=[],t[27]=j):j=t[27],(0,$.useEffect)(A,j);let M;t[28]!==i||t[29]!==e.busy?(M=(t,n,r)=>(0,Q.jsxs)(`label`,{className:`block space-y-1.5`,children:[(0,Q.jsx)(`span`,{children:n}),(0,Q.jsx)(Me,{type:`number`,min:1,max:r,value:i[t],disabled:e.busy,onChange:e=>{let n=Number(e.target.value);a(e=>({...e,[t]:n}))}})]}),t[28]=i,t[29]=e.busy,t[30]=M):M=t[30];let N=M,P;t[31]===e?P=t[32]:(P=t=>{!t&&!e.busy&&e.onClose()},t[31]=e,t[32]=P);let F=!e.busy,I;t[33]!==m||t[34]!==e||t[35]!==g?(I=t=>{t.preventDefault(),g&&!e.busy&&e.onSave(m)},t[33]=m,t[34]=e,t[35]=g,t[36]=I):I=t[36];let L=e.isNew?`Add EAS host`:`Edit EAS host`,R;t[37]===L?R=t[38]:(R=(0,Q.jsx)(Pe,{children:L}),t[37]=L,t[38]=R);let z;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(Re,{children:`The environment's server signs in to Expo and starts the sessions. Without a token here it uses EXPO_TOKEN, then its eas login.`}),t[39]=z):z=t[39];let B;t[40]===R?B=t[41]:(B=(0,Q.jsxs)(Ne,{children:[R,z]}),t[40]=R,t[41]=B);let V;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(`span`,{children:`Name`}),t[42]=V):V=t[42];let H;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(H=e=>{let t=e.target.value;a(e=>({...e,label:t}))},t[43]=H):H=t[43];let te;t[44]!==i.label||t[45]!==e.busy?(te=(0,Q.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[V,(0,Q.jsx)(Me,{autoFocus:!0,required:!0,value:i.label,disabled:e.busy,onChange:H})]}),t[44]=i.label,t[45]=e.busy,t[46]=te):te=t[46];let ne;t[47]===s?ne=t[48]:(ne=(0,Q.jsx)(`label`,{htmlFor:s,className:`block`,children:`Expo access token`}),t[47]=s,t[48]=ne);let re=l.kind===`saved`,ie=l.kind===`new`?l.value:``,U;t[49]===e.host.accessToken?U=t[50]:(U=t=>{let n=t.target.value;u(n?{kind:`new`,value:n}:e.host.accessToken?{kind:`saved`}:{kind:`cleared`}),C()},t[49]=e.host.accessToken,t[50]=U);let W;t[51]!==e.busy||t[52]!==re||t[53]!==ie||t[54]!==U||t[55]!==s?(W=(0,Q.jsx)(kt,{id:s,className:`min-w-0 flex-1`,configured:re,value:ie,disabled:e.busy,placeholder:`Optional`,onChange:U}),t[51]=e.busy,t[52]=re,t[53]=ie,t[54]=U,t[55]=s,t[56]=W):W=t[56];let ae;t[57]===l.kind?ae=t[58]:(ae=l.kind===`cleared`?null:(0,Q.jsx)(b,{type:`button`,size:`icon-sm`,variant:`ghost-destructive`,"aria-label":`Clear access token`,onClick:()=>{u({kind:`cleared`}),C()},children:(0,Q.jsx)(o,{className:`size-3.5`})}),t[57]=l.kind,t[58]=ae);let oe;t[59]!==W||t[60]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[W,ae]}),t[59]=W,t[60]=ae,t[61]=oe):oe=t[61];let se;t[62]!==ne||t[63]!==oe?(se=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ne,oe]}),t[62]=ne,t[63]=oe,t[64]=se):se=t[64];let ce=f.status===`signed-in`?`Signed in as ${f.account.signedInAs} with ${tn[f.account.credentialSource]}.`:f.status===`failed`?f.error:f.status===`checking`?`Checking the Expo account…`:`Check the Expo account before choosing a project.`,le;t[65]===ce?le=t[66]:(le=(0,Q.jsx)(`p`,{role:`status`,className:`min-w-0 text-xs text-muted-foreground`,children:ce}),t[65]=ce,t[66]=le);let ue=e.busy||f.status===`checking`,de;t[67]===D?de=t[68]:(de=()=>void D(),t[67]=D,t[68]=de);let pe;t[69]===f.status?pe=t[70]:(pe=f.status===`checking`?(0,Q.jsx)(ge,{size:`xs`}):null,t[69]=f.status,t[70]=pe);let q;t[71]!==ue||t[72]!==de||t[73]!==pe?(q=(0,Q.jsxs)(b,{type:`button`,size:`sm`,variant:`outline`,disabled:ue,onClick:de,children:[pe,` Check account`]}),t[71]=ue,t[72]=de,t[73]=pe,t[74]=q):q=t[74];let _e;t[75]!==le||t[76]!==q?(_e=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-lg border border-border/60 px-3 py-2.5`,children:[le,q]}),t[75]=le,t[76]=q,t[77]=_e):_e=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??en,be=e.busy,xe;t[79]===Symbol.for(`react.memo_cache_sentinel`)?(xe=e=>{typeof e==`string`&&a(t=>{let{appId:n,...r}=t;return e===en?r:{...r,appId:e}})},t[79]=xe):xe=t[79];let Se;t[80]===y?Se=t[81]:(Se=(0,Q.jsx)(me,{size:`sm`,"aria-label":`EAS project`,children:(0,Q.jsx)(K,{children:e=>e===en?`From the thread's project`:y.find(t=>t.id===e)?.fullName??e})}),t[80]=y,t[81]=Se);let J;t[82]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(G,{value:en,children:`From the thread's project`}),t[82]=J):J=t[82];let Y;t[83]!==y||t[84]!==i.appId?(Y=i.appId&&!y.some(e=>e.id===i.appId)?(0,Q.jsx)(G,{value:i.appId,children:i.appId}):null,t[83]=y,t[84]=i.appId,t[85]=Y):Y=t[85];let Ce;t[86]===y?Ce=t[87]:(Ce=y.map(on),t[86]=y,t[87]=Ce);let we;t[88]!==Y||t[89]!==Ce?(we=(0,Q.jsxs)(fe,{children:[J,Y,Ce]}),t[88]=Y,t[89]=Ce,t[90]=we):we=t[90];let Te;t[91]!==e.busy||t[92]!==ye||t[93]!==Se||t[94]!==we?(Te=(0,Q.jsxs)(he,{value:ye,disabled:be,onValueChange:xe,children:[Se,we]}),t[91]=e.busy,t[92]=ye,t[93]=Se,t[94]=we,t[95]=Te):Te=t[95];let Ee;t[96]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Sessions bill the project's Expo account. "From the thread's project" reads extra.eas.projectId from the project's app config.`}),t[96]=Ee):Ee=t[96];let Oe;t[97]===Te?Oe=t[98]:(Oe=(0,Q.jsxs)(`div`,{className:`space-y-1.5 text-sm`,children:[ve,Te,Ee]}),t[97]=Te,t[98]=Oe);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 Ie;t[103]===_?Ie=t[104]:(Ie=_===null?null:(0,Q.jsx)(`p`,{className:`text-xs text-destructive`,role:`alert`,children:_}),t[103]=_,t[104]=Ie);let Ve;t[105]!==te||t[106]!==se||t[107]!==_e||t[108]!==Oe||t[109]!==ke||t[110]!==je||t[111]!==Ie?(Ve=(0,Q.jsxs)(Le,{children:[te,se,_e,Oe,ke,je,Ie]}),t[105]=te,t[106]=se,t[107]=_e,t[108]=Oe,t[109]=ke,t[110]=je,t[111]=Ie,t[112]=Ve):Ve=t[112];let Ue;t[113]!==e.busy||t[114]!==e.onClose?(Ue=(0,Q.jsx)(b,{type:`button`,variant:`ghost`,disabled:e.busy,onClick:e.onClose,children:`Cancel`}),t[113]=e.busy,t[114]=e.onClose,t[115]=Ue):Ue=t[115];let We=e.busy||!g,Ge;t[116]===e.busy?Ge=t[117]:(Ge=e.busy?(0,Q.jsx)(ge,{size:`xs`}):null,t[116]=e.busy,t[117]=Ge);let Ke;t[118]!==We||t[119]!==Ge?(Ke=(0,Q.jsxs)(b,{type:`submit`,disabled:We,children:[Ge,` Save host`]}),t[118]=We,t[119]=Ge,t[120]=Ke):Ke=t[120];let qe;t[121]!==Ue||t[122]!==Ke?(qe=(0,Q.jsxs)(Fe,{children:[Ue,Ke]}),t[121]=Ue,t[122]=Ke,t[123]=qe):qe=t[123];let Je;t[124]!==I||t[125]!==B||t[126]!==Ve||t[127]!==qe?(Je=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-col`,onSubmit:I,children:[B,Ve,qe]}),t[124]=I,t[125]=B,t[126]=Ve,t[127]=qe,t[128]=Je):Je=t[128];let Ye;t[129]!==F||t[130]!==Je?(Ye=(0,Q.jsx)(ze,{showCloseButton:F,children:Je}),t[129]=F,t[130]=Je,t[131]=Ye):Ye=t[131];let Xe;return t[132]!==P||t[133]!==Ye?(Xe=(0,Q.jsx)(Be,{open:!0,onOpenChange:P,children:Ye}),t[132]=P,t[133]=Ye,t[134]=Xe):Xe=t[134],Xe}function on(e){return(0,Q.jsx)(G,{value:e.id,children:e.fullName},e.id)}function sn(e,t){if(e)return{kind:`new`};let n=t[0];return n?{kind:`existing`,profileId:n.id}:{kind:`new`}}function cn(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 ln(e){return e.step!==`importing`}function un(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 dn(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 fn(e){return e===void 0?{step:`blocked`,reason:`unknownSource`}:un(e)}function pn(e){let t=fn(e);return t.step===`fullDiskAccess`?{...t,checked:!0}:t}function mn(e,t){return t.profiles.some(t=>t.directory===e)?e:t.profiles[0]?.directory??``}function hn(e){switch(e){case`needsKeychainApproval`:case`keychainItemMissing`:case`keychainUnavailable`:case`readFailed`:case`sessionUnavailable`:case`profileNotSaved`:return!0;default:return!1}}function gn(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 _n(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=()=>un(n),t[0]=n,t[1]=p);let[m,h]=(0,$.useState)(p),g;t[2]===n.profiles[0]?.directory?g=t[3]:(g=()=>n.profiles[0]?.directory??``,t[2]=n.profiles[0]?.directory,t[3]=g);let[_,v]=(0,$.useState)(g),b;t[4]!==a||t[5]!==i?(b=()=>sn(a,i),t[4]=a,t[5]=i,t[6]=b):b=t[6];let[x,S]=(0,$.useState)(b),[C,w]=(0,$.useState)(),T;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(T=y(),t[7]=T):T=t[7];let E=(0,$.useRef)(`profile-${T}`),D=(0,$.useRef)(!1),O;t[8]!==o||t[9]!==_||t[10]!==x||t[11]!==i?(O=()=>{if(D.current)return;let e=cn(x,E.current,i);e===void 0?(w(`That profile is no longer available. Choose where to import these cookies.`),h({step:`configure`})):(w(void 0),D.current=!0,h({step:`importing`}),o({sourceProfileDirectory:_,target:e}).then(e=>h(dn(e))).catch(()=>h({step:`blocked`,reason:`readFailed`})).finally(()=>{D.current=!1}))},t[8]=o,t[9]=_,t[10]=x,t[11]=i,t[12]=O):O=t[12];let k=O,A;t[13]===s?A=t[14]:(A=(e,t)=>{h({step:`checking`,check:e}),s().then(e=>{e&&(f(e),v(t=>mn(t,e))),h(t(e))}).catch(()=>h({step:`blocked`,reason:`readFailed`}))},t[13]=s,t[14]=A);let j=A,M;t[15]===j?M=t[16]:(M=()=>j(`browser`,fn),t[15]=j,t[16]=M);let N=M,P;t[17]===j?P=t[18]:(P=()=>j(`fullDiskAccess`,pn),t[17]=j,t[18]=P);let F=P,I;t[19]!==u||t[20]!==m?(I=e=>e||!ln(m)?void 0:u(),t[19]=u,t[20]=m,t[21]=I):I=t[21];let L;t[22]===m?L=t[23]:(L=ln(m),t[22]=m,t[23]=L);let R;t[24]!==a||t[25]!==r||t[26]!==l||t[27]!==u||t[28]!==c||t[29]!==s||t[30]!==N||t[31]!==F||t[32]!==k||t[33]!==d||t[34]!==_||t[35]!==m||t[36]!==x||t[37]!==C||t[38]!==i?(R=m.step===`quit`?(0,Q.jsx)(vn,{source:d,onCancel:u,onRechecked:N}):m.step===`fullDiskAccess`?(0,Q.jsx)(xn,{source:d,onCancel:u,onOpenSettings:c,onCheck:l??(async()=>{let e=await s();return e!==void 0&&e.unavailable===void 0}),onGranted:m.resume===`import`?k:F,stillRequired:m.checked===!0}):m.step===`importing`?(0,Q.jsx)(wn,{}):m.step===`checking`?(0,Q.jsx)(Tn,{sourceName:d.name,check:m.check}):m.step===`done`?(0,Q.jsx)(En,{...m,destinationEnvironmentName:r,onClose:u}):m.step===`blocked`?(0,Q.jsx)(Dn,{source:d,reason:m.reason,onClose:u,onRetry:hn(m.reason)?k:void 0}):(0,Q.jsx)(Sn,{source:d,destinationEnvironmentName:r,targetProfiles:i,canCreateProfile:a,sourceProfileDirectory:_,onSourceProfileChange:v,target:x,onTargetChange:e=>{S(e),w(void 0)},targetError:C,onCancel:u,onImport:k}),t[24]=a,t[25]=r,t[26]=l,t[27]=u,t[28]=c,t[29]=s,t[30]=N,t[31]=F,t[32]=k,t[33]=d,t[34]=_,t[35]=m,t[36]=x,t[37]=C,t[38]=i,t[39]=R):R=t[39];let z;t[40]!==L||t[41]!==R?(z=(0,Q.jsx)(ze,{className:`max-w-lg`,showCloseButton:L,children:R}),t[40]=L,t[41]=R,t[42]=z):z=t[42];let B;return t[43]!==z||t[44]!==I?(B=(0,Q.jsx)(Be,{open:!0,onOpenChange:I,children:z}),t[43]=z,t[44]=I,t[45]=B):B=t[45],B}function vn(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)(Ne,{children:[(0,Q.jsxs)(Pe,{children:[`Quit `,n.name,` to import`]}),(0,Q.jsxs)(Re,{children:[n.name,` is open, so its cookies can’t be read yet. Quit it, then continue.`]})]}),t[0]=n.name,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(b,{variant:`outline`,onClick:r,children:`Cancel`}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(b,{onClick:i,children:`I’ve quit it`}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(Fe,{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 yn(e){if(e!==void 0)return e===0?`no cookies`:`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function bn(e){return`${e.toLocaleString()} ${e===1?`cookie`:`cookies`}`}function xn(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,f]=(0,$.useState)(null),p;t[0]===s?p=t[1]:(p=async()=>({fullDiskAccess:await s()}),t[0]=s,t[1]=p);let m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m={fullDiskAccess:!1},t[2]=m):m=t[2];let h=Mt(p,m),g;t[3]!==i||t[4]!==c?(g=()=>{c||(l(!0),f(null),Promise.resolve().then(i).catch(()=>f(`Could not open System Settings. Try Allow again.`)).finally(()=>l(!1)))},t[3]=i,t[4]=c,t[5]=g):g=t[5];let _=g,v;t[6]===n.name?v=t[7]:(v=(0,Q.jsxs)(Ne,{children:[(0,Q.jsxs)(Pe,{children:[`Let P4 Code read `,n.name,`’s cookies`]}),(0,Q.jsxs)(Re,{children:[`To import cookies from `,n.name,`, P4 Code needs Full Disk Access. Turn it on in System Settings, then come back to finish the import — you can revoke it again once the import is done.`]})]}),t[6]=n.name,t[7]=v);let y;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(d,{className:`size-8 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),t[8]=y):y=t[8];let x=`Read ${n.name}'s cookies for this import.`,S;t[9]===_?S=t[10]:(S=()=>void _(),t[9]=_,t[10]=S);let C;t[11]!==h.status.fullDiskAccess||t[12]!==x||t[13]!==S?(C=[{id:`fullDiskAccess`,icon:y,title:`Full Disk Access`,description:x,granted:h.status.fullDiskAccess,onAllow:S}],t[11]=h.status.fullDiskAccess,t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]!==c||t[16]!==C?(w=(0,Q.jsx)(At,{busy:c,permissions:C}),t[15]=c,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==u||t[19]!==h.error?(T=u||h.error?(0,Q.jsx)(`p`,{role:`status`,className:`mt-3 text-xs text-muted-foreground`,children:u??h.error}):null,t[18]=u,t[19]=h.error,t[20]=T):T=t[20];let E;t[21]!==h||t[22]!==o?(E=h.isReady([`fullDiskAccess`])?null:(0,Q.jsx)(`p`,{className:`mt-3 text-xs text-muted-foreground`,children:o?`Access is still required. Quit and reopen P4 Code if you just allowed it, then retry the import.`:`If access doesn't update after you allow it, quit and reopen P4 Code, then retry the import.`}),t[21]=h,t[22]=o,t[23]=E):E=t[23];let D;t[24]!==T||t[25]!==E||t[26]!==w?(D=(0,Q.jsxs)(Le,{children:[w,T,E]}),t[24]=T,t[25]=E,t[26]=w,t[27]=D):D=t[27];let O;t[28]===r?O=t[29]:(O=(0,Q.jsx)(b,{variant:`outline`,onClick:r,children:`Cancel`}),t[28]=r,t[29]=O);let k;t[30]===h?k=t[31]:(k=h.isReady([`fullDiskAccess`]),t[30]=h,t[31]=k);let A;t[32]!==a||t[33]!==c||t[34]!==k?(A=(0,Q.jsx)(jt,{ready:k,busy:c,onClick:a,children:`Continue`}),t[32]=a,t[33]=c,t[34]=k,t[35]=A):A=t[35];let j;t[36]!==O||t[37]!==A?(j=(0,Q.jsxs)(Fe,{children:[O,A]}),t[36]=O,t[37]=A,t[38]=j):j=t[38];let M;return t[39]!==D||t[40]!==j||t[41]!==v?(M=(0,Q.jsxs)(Q.Fragment,{children:[v,D,j]}),t[39]=D,t[40]=j,t[41]=v,t[42]=M):M=t[42],M}function Sn(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)(Pe,{children:[`Import from `,n.name]}),t[4]=n.name,t[5]=_);let v;t[6]===r?v=t[7]:(v=(0,Q.jsxs)(Re,{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)(Ne,{children:[_,v]}),t[8]=_,t[9]=v,t[10]=y):y=t[10];let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`From`}),t[11]=C):C=t[11];let w;if(t[12]!==s||t[13]!==n.profiles||t[14]!==o){let e;t[16]!==s||t[17]!==o?(e=e=>(0,Q.jsx)(Cn,{selected:o===e.directory,title:e.name,subtitle:yn(e.cookieCount),onSelect:()=>s(e.directory)},e.directory),t[16]=s,t[17]=o,t[18]=e):e=t[18],w=n.profiles.map(e),t[12]=s,t[13]=n.profiles,t[14]=o,t[15]=w}else w=t[15];let T;t[19]===w?T=t[20]:(T=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[C,w]}),t[19]=w,t[20]=T);let E;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center text-muted-foreground`,children:[(0,Q.jsx)(S,{className:`size-4 sm:hidden`}),(0,Q.jsx)(x,{className:`hidden size-4 sm:block`})]}),t[21]=E):E=t[21];let D;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-muted-foreground`,children:`Into`}),t[22]=D):D=t[22];let O;t[23]!==a||t[24]!==u||t[25]!==c.kind?(O=a?(0,Q.jsx)(Cn,{selected:c.kind===`new`,title:`New profile`,subtitle:`Created for these cookies`,onSelect:()=>u({kind:`new`})}):null,t[23]=a,t[24]=u,t[25]=c.kind,t[26]=O):O=t[26];let k;if(t[27]!==u||t[28]!==c.kind||t[29]!==c.profileId||t[30]!==i){let e;t[32]!==u||t[33]!==c.kind||t[34]!==c.profileId?(e=e=>(0,Q.jsx)(Cn,{selected:c.kind===`existing`&&c.profileId===e.id,title:e.name,subtitle:`Existing profile`,onSelect:()=>u({kind:`existing`,profileId:e.id})},e.id),t[32]=u,t[33]=c.kind,t[34]=c.profileId,t[35]=e):e=t[35],k=i.map(e),t[27]=u,t[28]=c.kind,t[29]=c.profileId,t[30]=i,t[31]=k}else k=t[31];let A;t[36]!==O||t[37]!==k?(A=(0,Q.jsxs)(`section`,{className:`flex-1 space-y-2`,children:[D,O,k]}),t[36]=O,t[37]=k,t[38]=A):A=t[38];let j;t[39]!==A||t[40]!==T?(j=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-4`,children:[T,E,A]}),t[39]=A,t[40]=T,t[41]=j):j=t[41];let M;t[42]===g?M=t[43]:(M=g?(0,Q.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-destructive`,children:g}):null,t[42]=g,t[43]=M);let N;t[44]!==j||t[45]!==M?(N=(0,Q.jsxs)(Le,{children:[j,M]}),t[44]=j,t[45]=M,t[46]=N):N=t[46];let P;t[47]===d?P=t[48]:(P=(0,Q.jsx)(b,{variant:`outline`,onClick:d,children:`Cancel`}),t[47]=d,t[48]=P);let F=o===``||m||h,I;t[49]!==f||t[50]!==F?(I=(0,Q.jsx)(b,{disabled:F,onClick:f,children:`Import`}),t[49]=f,t[50]=F,t[51]=I):I=t[51];let L;t[52]!==P||t[53]!==I?(L=(0,Q.jsxs)(Fe,{children:[P,I]}),t[52]=P,t[53]=I,t[54]=L):L=t[54];let R;return t[55]!==N||t[56]!==L||t[57]!==y?(R=(0,Q.jsxs)(Q.Fragment,{children:[y,N,L]}),t[55]=N,t[56]=L,t[57]=y,t[58]=R):R=t[58],R}function Cn(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=E(`flex w-full cursor-pointer items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left outline-none transition-colors focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background`,o),t[0]=o,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,Q.jsx)(`span`,{className:`block truncate text-sm font-medium text-foreground`,children:r}),t[2]=r,t[3]=c);let l;t[4]===i?l=t[5]:(l=i?(0,Q.jsx)(`span`,{className:`block truncate text-xs tabular-nums text-muted-foreground`,children:i}):null,t[4]=i,t[5]=l);let d;t[6]!==c||t[7]!==l?(d=(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=d):d=t[8];let f=n?`border-primary bg-primary text-primary-foreground`:`border-input`,p;t[9]===f?p=t[10]:(p=E(`grid size-4 shrink-0 place-items-center rounded-full border`,f),t[9]=f,t[10]=p);let m;t[11]===n?m=t[12]:(m=n?(0,Q.jsx)(u,{className:`size-2.5`}):null,t[11]=n,t[12]=m);let h;t[13]!==p||t[14]!==m?(h=(0,Q.jsx)(`span`,{className:p,children:m}),t[13]=p,t[14]=m,t[15]=h):h=t[15];let g;return t[16]!==a||t[17]!==n||t[18]!==s||t[19]!==d||t[20]!==h?(g=(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":n,onClick:a,className:s,children:[d,h]}),t[16]=a,t[17]=n,t[18]=s,t[19]=d,t[20]=h,t[21]=g):g=t[21],g}function wn(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(Ne,{children:[(0,Q.jsx)(Pe,{children:`Importing cookies`}),(0,Q.jsx)(Re,{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)(Le,{children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 py-2`,children:[(0,Q.jsx)(ge,{size:`md`,tone:`muted`}),(0,Q.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Importing…`})]})})]}),e[1]=n):n=e[1],n}function Tn(e){let t=(0,Z.c)(13),{sourceName:n,check:r}=e,i;t[0]===n?i=t[1]:(i=(0,Q.jsxs)(Pe,{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)(Re,{children:a}),t[2]=a,t[3]=o);let s;t[4]!==i||t[5]!==o?(s=(0,Q.jsxs)(Ne,{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)(ge,{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)(Le,{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 En(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 ${bn(n)}`:r>0?`Skipped ${bn(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)(Pe,{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?` ${bn(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)(Re,{children:u}),t[10]=u,t[11]=d);let f;t[12]!==l||t[13]!==d?(f=(0,Q.jsxs)(Ne,{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)(Le,{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:gn(i)})]}):null,t[15]=i,t[16]=p);let m;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,Q.jsx)(b,{}),t[17]=m):m=t[17];let h;t[18]===s?h=t[19]:(h=(0,Q.jsx)(Fe,{children:(0,Q.jsx)(Ie,{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 Dn(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)(Pe,{children:[`Couldn’t import from `,n.name]}),t[0]=n.name,t[1]=o);let s=I[r],c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(Re,{children:s}),t[2]=s,t[3]=c);let l;t[4]!==o||t[5]!==c?(l=(0,Q.jsxs)(Ne,{children:[o,c]}),t[4]=o,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,Q.jsx)(b,{variant:`outline`,onClick:i,children:`Close`}),t[7]=i,t[8]=u);let d;t[9]===a?d=t[10]:(d=a?(0,Q.jsx)(b,{onClick:a,children:`Try again`}):null,t[9]=a,t[10]=d);let f;t[11]!==u||t[12]!==d?(f=(0,Q.jsxs)(Fe,{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 On=`fill`,kn=`responsive`;async function An(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 jn(e,t,n,r=0){return(e||r>0)&&t&&n>0}var Mn={width:1280,height:800},Nn={useGrouping:!1},Pn={system:`System`,light:`Light`,dark:`Dark`},Fn=e=>`${Math.round(e*100)}%`,In=class extends Error{constructor(){super(`Browser profile limit reached.`),this.name=`ProfileLimitReachedError`}},Ln=e=>{let t=String(e?.message??``);return ne.literals.find(e=>t.includes(`failed: ${e}.`))??`readFailed`},Rn=e=>e._tag===`fill`?On:e._tag===`preset`&&Ct.some(t=>t.id===e.presetId)?e.presetId:kn,zn=e=>{let t=Rn(e);return t===On?`Fill panel`:t===kn?`Responsive`:Ct.find(e=>e.id===t)?.label??`Responsive`},Bn=e=>Number.isInteger(e)&&e>=240&&e<=3840,Vn=e=>({...e,width:e.height,height:e.width});function Hn(e){let t=(0,Z.c)(42),{disabled:n}=e,r=J(Wn),i=Y(),a=r._tag===`fill`?null:r,o=a?.width??Mn.width,s=a?.height??Mn.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===On){i({browserDefaultViewport:te});return}if(e===kn){i({browserDefaultViewport:{_tag:`freeform`,width:a?.width??Mn.width,height:a?.height??Mn.height}});return}let t=Ct.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||!Bn(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=xt(`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!==k._tag?(0,Q.jsx)(_t,{label:`default browser viewport`,onClick:()=>i({browserDefaultViewport:k})}):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=Rn(r),t[16]=r,t[17]=g);let _;t[18]===r?_=t[19]:(_=zn(r),t[18]=r,t[19]=_);let v;t[20]===_?v=t[21]:(v=(0,Q.jsx)(me,{size:`sm`,className:`w-full min-w-0 sm:w-44`,"aria-label":`Default browser viewport`,children:(0,Q.jsx)(K,{children:_})}),t[20]=_,t[21]=v);let y,x;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(G,{value:On,children:`Fill panel`}),x=(0,Q.jsx)(G,{value:kn,children:`Responsive`}),t[22]=y,t[23]=x):(y=t[22],x=t[23]);let S;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsxs)(fe,{align:`end`,alignItemWithTrigger:!1,children:[y,x,(0,Q.jsxs)(pe,{children:[(0,Q.jsx)(de,{children:`Standard`}),Ct.map(Un)]})]}),t[24]=S):S=t[24];let C;t[25]!==n||t[26]!==d||t[27]!==v||t[28]!==g?(C=(0,Q.jsxs)(he,{value:g,onValueChange:d,disabled:n,children:[v,S]}),t[25]=n,t[26]=d,t[27]=v,t[28]=g,t[29]=C):C=t[29];let w;t[30]!==p||t[31]!==n||t[32]!==l||t[33]!==a||t[34]!==i?(w=a?(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[(0,Q.jsx)(ue,{value:l.width,min:240,max:R,disabled:n,format:Nn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`width`,e),children:(0,Q.jsx)(le,{children:(0,Q.jsx)(ce,{"aria-label":`Default viewport width`})})}),(0,Q.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`×`}),(0,Q.jsx)(ue,{value:l.height,min:240,max:R,disabled:n,format:Nn,size:`sm`,className:`w-20`,onValueCommitted:e=>p(`height`,e),children:(0,Q.jsx)(le,{children:(0,Q.jsx)(ce,{"aria-label":`Default viewport height`})})}),(0,Q.jsxs)(je,{children:[(0,Q.jsx)(ke,{render:(0,Q.jsx)(b,{size:`icon-sm`,variant:`ghost-muted`,disabled:n,"aria-label":`Rotate to ${l.height>=l.width?`landscape`:`portrait`}`,onClick:()=>i({browserDefaultViewport:Vn(a)}),children:(0,Q.jsx)(wt,{})})}),(0,Q.jsx)(Ae,{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 Un(e){return(0,Q.jsx)(G,{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 Wn(e){return e.browserDefaultViewport}function Gn(e){let t=(0,Z.c)(20),{disabled:n}=e,r=J(qn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xt(`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)(_t,{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=H.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=Fn(r),t[7]=r,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Q.jsx)(me,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser zoom`,children:(0,Q.jsx)(K,{children:l})}),t[9]=l,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(fe,{align:`end`,alignItemWithTrigger:!1,children:H.map(Kn)}),t[11]=d):d=t[11];let f;t[12]!==n||t[13]!==s||t[14]!==c||t[15]!==u?(f=(0,Q.jsxs)(he,{disabled:n,value:s,onValueChange:c,children:[u,d]}),t[12]=n,t[13]=s,t[14]=c,t[15]=u,t[16]=f):f=t[16];let p;return t[17]!==o||t[18]!==f?(p=(0,Q.jsx)(X,{...a,description:`Page zoom applied to new browser tabs.`,resetAction:o,control:f}),t[17]=o,t[18]=f,t[19]=p):p=t[19],p}function Kn(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:String(e),children:Fn(e)},e)}function qn(e){return e.browserDefaultZoomFactor}function Jn(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(Xn),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xt(`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)(_t,{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=Pn[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(me,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Default browser appearance`,children:(0,Q.jsx)(K,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(fe,{align:`end`,alignItemWithTrigger:!1,children:Object.entries(Pn).map(Yn)}),t[9]=u):u=t[9];let d;t[10]!==r||t[11]!==n||t[12]!==s||t[13]!==l?(d=(0,Q.jsxs)(he,{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 Yn(e){let[t,n]=e;return(0,Q.jsx)(G,{hideIndicator:!0,value:t,children:n},t)}function Xn(e){return e.browserDefaultAppearance}function Zn(e){let t=(0,Z.c)(17),{disabled:n}=e,r=J($n),i=J(Qn),a=Y(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=xt(`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)(St,{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=xt(`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)(St,{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 Qn(e){return e.browserRecordingShowMousePresses}function $n(e){return e.browserRecordingShowKeyPresses}function er(e){let t=(0,Z.c)(18),{disabled:n}=e,r=J(nr),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xt(`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)(_t,{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=ae.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)(me,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Browser recording frame rate`,children:(0,Q.jsxs)(K,{children:[r,` fps`]})}),t[7]=r,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(fe,{align:`end`,alignItemWithTrigger:!1,children:ae.map(tr)}),t[9]=u):u=t[9];let d;t[10]!==n||t[11]!==s||t[12]!==c||t[13]!==l?(d=(0,Q.jsxs)(he,{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 tr(e){return(0,Q.jsxs)(G,{hideIndicator:!0,value:String(e),children:[e,` fps`]},e)}function nr(e){return e.browserRecordingFrameRate}var rr={system:`Your default browser`,app:`P4 Code`};function ir(e){let t=(0,Z.c)(19),{disabled:n}=e,r=J(or),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xt(`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)(_t,{label:`link target`,onClick:()=>i({browserLinkTarget:P})}):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=rr[r],l;t[7]===c?l=t[8]:(l=(0,Q.jsx)(me,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Open links in`,children:(0,Q.jsx)(K,{children:c})}),t[7]=c,t[8]=l);let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.keys(rr),t[9]=u):u=t[9];let d;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(fe,{align:`end`,alignItemWithTrigger:!1,children:u.map(ar)}),t[10]=d):d=t[10];let f;t[11]!==n||t[12]!==r||t[13]!==s||t[14]!==l?(f=(0,Q.jsxs)(he,{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 ar(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:rr[e]},e)}function or(e){return e.browserLinkTarget}var sr={duckduckgo:`DuckDuckGo`,google:`Google`,bing:`Bing`,brave:`Brave Search`,kagi:`Kagi`,ecosia:`Ecosia`,custom:`Custom`};function cr(){let e=(0,Z.c)(24),t=J(dr),n=J(ur),r=Y(),i;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=xt(`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)(_t,{label:`search engine`,onClick:()=>r({browserSearchEngine:B,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=U.literals.find(t=>t===e);t!==void 0&&r({browserSearchEngine:t})},e[5]=r,e[6]=o);let s=sr[t],c;e[7]===s?c=e[8]:(c=(0,Q.jsx)(me,{size:`sm`,className:`w-full sm:w-40`,"aria-label":`Search engine`,children:(0,Q.jsx)(K,{children:s})}),e[7]=s,e[8]=c);let l;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(fe,{align:`end`,alignItemWithTrigger:!1,children:U.literals.map(lr)}),e[9]=l):l=e[9];let u;e[10]!==t||e[11]!==o||e[12]!==c?(u=(0,Q.jsxs)(he,{value:t,onValueChange:o,children:[c,l]}),e[10]=t,e[11]=o,e[12]=c,e[13]=u):u=e[13];let d;e[14]!==a||e[15]!==u?(d=(0,Q.jsx)(X,{...i,description:`What the address bar searches when you type something that isn't a URL.`,resetAction:a,control:u}),e[14]=a,e[15]=u,e[16]=d):d=e[16];let f;e[17]!==n||e[18]!==t||e[19]!==r?(f=t===`custom`?(0,Q.jsx)(X,{title:`Custom search URL`,description:`Use %s where the search terms go.`,status:et(n)?void 0:`Enter an http or https URL containing %s. Searches use DuckDuckGo until then.`,control:(0,Q.jsx)(Dt,{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:ie,value:n,onCommit:e=>r({browserCustomSearchUrl:e.trim()})})}):null,e[17]=n,e[18]=t,e[19]=r,e[20]=f):f=e[20];let p;return e[21]!==d||e[22]!==f?(p=(0,Q.jsxs)(Q.Fragment,{children:[d,f]}),e[21]=d,e[22]=f,e[23]=p):p=e[23],p}function lr(e){return(0,Q.jsx)(G,{hideIndicator:!0,value:e,children:sr[e]},e)}function ur(e){return e.browserCustomSearchUrl}function dr(e){return e.browserSearchEngine}function fr(){let e=(0,Z.c)(12),t=J(pr),n=Y(),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=xt(`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)(_t,{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)(St,{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 pr(e){return e.pullRequestLinksOpenInApp}function mr(){let e=(0,Z.c)(7),{search:t,environment:n}=mt(),r=ft(),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)(vt,{id:`devices`,title:`Devices`,children:(0,Q.jsx)(hr,{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 hr({environmentId:e,enabled:t,agentAccessEnabled:n}){let r=we(e,M),{state:i,loaded:a}=Ve(e),{scope:o,environments:s,connectedEnvironments:c}=mt(),l=pt(),u=o.kind===`project`||o.kind===`checkout`,d=c.some(e=>e.serverConfig?.settings.enableDeviceSupport),f=De(He.configure,{reportFailure:!1}),p=De(He.list,{reportFailure:!1}),[m,h]=(0,$.useState)(null),g=i.hostStatus===`installing`||i.hostStatus===`starting`,_=i.hosts.some(e=>e.kind===`local`&&!e.platforms.some(e=>e.available)),[v,y]=(0,$.useState)(!1);v&&!t&&y(!1),t&&!v&&(i.hostStatus===`ready`||_)&&m!==`hub`&&y(!0);let x=async(t,n)=>{if(e&&Te(e,`settings:write`)){h(t);try{let e=await Promise.allSettled(s.map(async e=>{if(e.connection.phase!==`connected`||!e.serverConfig)throw Error(`Environment disconnected`);if(!Te(e.environmentId,`settings:write`))throw Error(`This connection cannot change device settings.`);return f({environmentId:e.environmentId,input:{...n,...n.enabled?{onboardingCompleted:!0}:{}}})})),t=s.filter((t,n)=>{let r=e[n];return r?.status!==`fulfilled`||r.value._tag===`Failure`});t.length>0&&q.add({type:`error`,title:`Device settings not saved on all environments`,description:`Could not update ${t.map(e=>e.label).join(`, `)}.`})}finally{h(null)}}},[S,C]=(0,$.useState)(null),T=i.hosts.find(e=>e.kind===`local`)?.tools,E=e=>{let t=T?.[e];return i.supportsToolUpdate&&t?!t.installedVersions.includes(t.requiredVersion):!1},D=(t,n=!1)=>{e&&(C(null),h(`update-${t}`),p({environmentId:e,input:{updateTool:t}}).then(e=>{if(e._tag===`Failure`){let r=Ee(e.cause);C({tool:t,message:r}),n&&q.add({type:`error`,title:r})}}).finally(()=>h(null)))},O=t=>{e&&(h(t),p({environmentId:e,input:{inspectOnly:!0}}).finally(()=>h(null)))},k=t=>{let n=E(t);if(!n&&!i.supportsToolInspection)return null;let r=m===`update-${t}`||m===`check-${t}`,a=n?`Update to v${T?.[t].requiredVersion}`:`Check ${t===`hub`?`device hub`:`agent device`} version`;return(0,Q.jsxs)(je,{children:[(0,Q.jsx)(ke,{render:(0,Q.jsx)(b,{size:`icon-xs`,variant:`ghost-muted`,disabled:!e||m!==null||g,"aria-label":a,onClick:()=>n?D(t,!0):O(`check-${t}`)}),children:(0,Q.jsxs)(`span`,{className:`grid *:col-start-1 *:row-start-1 *:transition-[opacity,scale] *:duration-150 *:ease-out motion-reduce:*:transition-none`,children:[(0,Q.jsx)(`span`,{className:n&&!r?void 0:`scale-75 opacity-0`,children:(0,Q.jsx)(w,{"aria-hidden":!0})}),(0,Q.jsx)(`span`,{className:n&&!r?`scale-75 opacity-0`:void 0,children:(0,Q.jsx)(bt,{refreshing:r})})]})}),(0,Q.jsx)(Ae,{side:`top`,children:a})]})},A=t=>{let n=T?.[t];return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[n&&E(t)?(0,Q.jsx)(b,{size:`sm`,disabled:!e||m!==null||g,onClick:()=>D(t),children:m===`update-${t}`?`Updating…`:`Update to v${n.requiredVersion}`}):null,i.supportsToolInspection?(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:!e||m!==null||g,onClick:()=>O(`check`),children:m===`check`?`Checking…`:`Check versions`}):null]}),S?.tool===t?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,children:S.message}):null]})};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(X,{...xt(`device-hub`),serverScoped:!0,settingKeys:[`enableDeviceSupport`],description:qe,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Nt,{action:A(`hub`),kind:`hub`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`hub`),m===`hub`?(0,Q.jsx)(Ke,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Ot,{settingKeys:[`enableDeviceSupport`],checked:t,disabled:!r||u||!a||!e||g||m!==null,"aria-label":`Device hub`,onCheckedChange:e=>void x(`hub`,{enabled:!!e,...e?{}:{agentAccessEnabled:!1}})})]})}),(0,Q.jsx)(Xe,{children:v?(0,Q.jsx)(X,{...xt(`device-platform-support`),description:c.length>1?`Status for ${c.find(t=>t.environmentId===e)?.label}. Select an environment to inspect its simulator support.`:void 0,status:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-x-5 gap-y-2`,children:[(0,Q.jsx)(We,{compact:!0,platform:`iOS`,status:Ge(i,`ios`)}),(0,Q.jsx)(We,{compact:!0,platform:`Android`,status:Ge(i,`android`)})]}),control:(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:!e||!t||g||m!==null,onClick:()=>{e&&(h(`check`),p({environmentId:e,input:{}}).finally(()=>h(null)))},children:m===`check`?`Checking…`:`Refresh`})}):null}),(0,Q.jsx)(X,{...xt(`agent-device-access`),serverScoped:!0,settingKeys:[`enableAgentDeviceAccess`],description:Ue,control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Nt,{action:A(`agent`),kind:`agent`,tools:i.hosts.find(e=>e.kind===`local`)?.tools}),k(`agent`),m===`agent`?(0,Q.jsx)(Je,{state:i,pending:!0,compact:!0}):null,(0,Q.jsx)(Ot,{settingKeys:[`enableAgentDeviceAccess`],checked:n,disabled:!r||c.length===0||!u&&(!a||!d||g)||m!==null,"aria-label":`Agent device access`,onCheckedChange:e=>u?l({enableAgentDeviceAccess:!!e}):void x(`agent`,{agentAccessEnabled:!!e})})]})}),e?(0,Q.jsx)(Ye,{state:{...i,hosts:i.hosts.filter(e=>e.kind===`local`)},environmentId:e}):null,(0,Q.jsx)(Kt,{environmentId:e}),i.supportsEasHosts?(0,Q.jsx)(rn,{environmentId:e}):null]})}function gr(e){let t=(0,Z.c)(14),{disabled:n}=e,r=J(_r),i=Y(),a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=xt(`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)(_t,{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)(St,{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 _r(e){return e.browserAutoShowFloatingPreview}function vr({disabled:e}){let t=J(e=>e.browserProfiles),n=J(e=>e.browserDefaultProfileId),r=be(),i=Y(),{environments:a,isReady:o}=_e(),c=ye(),[u,d]=(0,$.useState)(null),[h,v]=(0,$.useState)(null),[x,S]=(0,$.useState)(null),[w,O]=(0,$.useState)(null),[k,A]=(0,$.useState)(null),[j,M]=(0,$.useState)(!1),N=se(),P=De($e.clearProfile,{reportFailure:!1}),F={environmentIds:a.map(e=>e.environmentId).filter(e=>N.get(e)?.environment.capabilities.serverBrowser===!0),clear:async(e,t)=>{let n=await P({environmentId:e,input:{profileId:t}});if(n._tag===`Failure`)throw oe(n)}},I=jn(Tt!==null,o,a.length,F.environmentIds.length),R=(0,$.useRef)(!1),[B,ee]=(0,$.useState)(!1),V=e||!r,H=W(t).filter(e=>e.kind!==`incognito`),te=L(H,n)?.id??`default`,ne=e=>{if(!r||R.current)return;let t=Se().browserProfiles;if(t.length>=24)return;let n=W(t),a=new Set(n.map(e=>e.name)),o=e;for(let t=2;a.has(o);t+=1)o=`${e} ${t}`;let s={id:`profile-${y()}`,name:o,kind:`persistent`};return i({browserProfiles:[...t,s]}),s},ie=(e,t)=>{if(!r||R.current)return;let n=t.trim().slice(0,48);if(n===``)return;let a=Se().browserProfiles;i({browserProfiles:a.map(t=>t.id===e?{...t,name:n}:t)})},U=(e,t)=>{r&&!R.current&&(I?An(Tt,a.map(e=>e.environmentId),e,F).then(()=>{q.add({type:`success`,title:`Cleared ${t}'s cookies and cache`})}).catch(()=>{q.add({type:`error`,title:`Could not clear ${t}'s data`})}):q.add({type:`error`,title:`Could not clear ${t}'s data`,description:`You're not connected to a server yet.`}))},ae=async e=>{if(!r||R.current)return;if(!I){A(`Connect to an environment before removing this profile.`);return}A(null),M(!0);try{await An(Tt,o?a.map(e=>e.environmentId):[],e,F)}catch{A(`Profile data could not be deleted. Try again.`),M(!1);return}let t=Se();i({browserProfiles:t.browserProfiles.filter(t=>t.id!==e),...t.browserDefaultProfileId===e?{browserDefaultProfileId:z}:{}}),M(!1),S(null)},ce=(u??[]).filter(e=>e.unavailable!==`notInstalled`&&e.unavailable!==`unsupportedPlatform`),le=(0,$.useCallback)(()=>{Tt&&Tt.listBrowserImportSources().then(d).catch(()=>d(e=>e??[]))},[]),ue=async(e,t,n)=>{if(!Tt||!r)return{kind:`blocked`,reason:`sessionUnavailable`};if(n.target.kind===`existing`&&!W(Se().browserProfiles).some(e=>e.id===n.target.profileId)||R.current)return{kind:`blocked`,reason:`readFailed`};R.current=!0,ee(!0);try{let r=await Tt.importBrowserCookies({environmentId:t,sourceId:e.id,sourceProfileDirectory:n.sourceProfileDirectory,targetProfileId:n.target.profileId});if(n.target.kind===`existing`&&!W(Se().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 In;let r=new Set(W(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 An(Tt,[t],n.target.profileId).catch(()=>void 0);let i=r instanceof In?`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:Ln(e)}}finally{R.current=!1,ee(!1)}},G=async e=>{if(Tt)try{let t=await Tt.listBrowserImportSources();return d(t),t.find(t=>t.id===e)}catch{return}},K=t.length>=24;return(0,Q.jsxs)(X,{...xt(`browser-profiles`),description:`Profiles separate cookies and logins. Incognito data is cleared when the app closes.`,control:(0,Q.jsxs)(m,{onOpenChange:e=>e&&le(),children:[(0,Q.jsxs)(_,{render:(0,Q.jsx)(b,{size:`sm`,variant:`outline`,disabled:V||B}),children:[(0,Q.jsx)(f,{}),`Add profile`]}),(0,Q.jsxs)(C,{align:`end`,children:[(0,Q.jsx)(D,{disabled:!r||K,onClick:()=>ne(`New profile`),children:`Blank profile`}),K?(0,Q.jsx)(D,{disabled:!0,children:`You’ve reached the profile limit`}):null,(0,Q.jsx)(T,{}),(0,Q.jsxs)(s,{children:[(0,Q.jsx)(g,{children:`Import from`}),u===null?(0,Q.jsx)(D,{disabled:!0,children:`Looking for browsers…`}):ce.length===0?(0,Q.jsx)(D,{disabled:!0,children:`No supported browsers found`}):(0,Q.jsxs)(Q.Fragment,{children:[ce.map(e=>(0,Q.jsx)(D,{disabled:!r||c==null,onClick:()=>{r&&c!=null&&v({source:e,environmentId:c.environmentId,environmentName:yt({isPrimary:!0,environmentId:c.environmentId,runtimeLabel:c.label})})},children:e.name},e.id)),c==null?(0,Q.jsx)(D,{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:H.map((e,t)=>{let n=re(e.id),a=e.id===te;return(0,Q.jsxs)(`div`,{className:E(`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:E(`truncate text-sm text-foreground`,V&&`opacity-64`),children:e.name}):(0,Q.jsx)(Dt,{nativeInput:!0,size:`sm`,className:`w-full max-w-56`,"aria-label":`Rename ${e.name}`,disabled:V||B,maxLength:48,value:e.name,onCommit:t=>ie(e.id,t)}),a?(0,Q.jsx)(`span`,{className:E(`flex`,V&&`opacity-64`),children:(0,Q.jsx)(p,{children:`Default`})}):null]}),(0,Q.jsxs)(m,{children:[(0,Q.jsx)(_,{render:(0,Q.jsx)(b,{size:`icon-xs`,variant:`ghost-muted`,disabled:V||B,"aria-label":`${e.name} options`}),children:(0,Q.jsx)(l,{})}),(0,Q.jsxs)(C,{align:`end`,children:[(0,Q.jsx)(D,{disabled:!r||a,onClick:()=>{r&&i({browserDefaultProfileId:e.id})},children:`Set as default`}),(0,Q.jsx)(D,{disabled:!r||!I,onClick:()=>{F.environmentIds.length>0?O(e):U(e.id,e.name)},children:`Clear cookies and cache`}),n?null:(0,Q.jsx)(D,{variant:`destructive`,disabled:!r||!I,onClick:()=>{r&&S(e)},children:`Remove profile and data`}),I?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(T,{}),(0,Q.jsx)(D,{disabled:!0,children:o?`Connect to an environment to clear profile data`:`Checking environments…`})]})]})]})]},e.id)})}),(0,Q.jsx)(dt,{open:x!==null,onOpenChange:e=>{!e&&!j&&(S(null),A(null))},children:(0,Q.jsxs)(ct,{children:[(0,Q.jsxs)(at,{children:[(0,Q.jsxs)(ut,{children:[`Remove “`,x?.name,`”?`]}),(0,Q.jsx)(lt,{children:`Its cookies and logins are deleted. Desktop tabs already open in this profile stay open until you close them; server browser tabs close now.`}),k?(0,Q.jsx)(`p`,{"aria-live":`polite`,className:`text-sm text-destructive`,children:k}):null,I?null:(0,Q.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Connect to an environment to remove this profile and its data.`})]}),(0,Q.jsxs)(ot,{children:[(0,Q.jsx)(st,{disabled:j,render:(0,Q.jsx)(b,{variant:`outline`,disabled:j}),children:`Cancel`}),(0,Q.jsx)(b,{variant:`destructive`,disabled:j||!r||!I,onClick:()=>{x&&r&&I&&ae(x.id)},children:j?`Removing…`:`Remove profile`})]})]})}),(0,Q.jsx)(dt,{open:w!==null,onOpenChange:e=>{e||O(null)},children:(0,Q.jsxs)(ct,{children:[(0,Q.jsxs)(at,{children:[(0,Q.jsxs)(ut,{children:[`Clear “`,w?.name,`”’s cookies and cache?`]}),(0,Q.jsx)(lt,{children:`You are signed out of its sites. Server browser tabs open in this profile close now.`})]}),(0,Q.jsxs)(ot,{children:[(0,Q.jsx)(st,{render:(0,Q.jsx)(b,{variant:`outline`}),children:`Cancel`}),(0,Q.jsx)(b,{variant:`destructive`,onClick:()=>{w&&U(w.id,w.name),O(null)},children:`Clear data`})]})]})}),h?(0,Q.jsx)(_n,{source:h.source,destinationEnvironmentName:h.environmentName,targetProfiles:H.map(e=>({id:e.id,name:e.name})),canCreateProfile:r&&!K,onImport:e=>ue(h.source,h.environmentId,e),onRefreshSource:()=>G(h.source.id),onCheckFullDiskAccess:window.desktopBridge?.checkSystemPermission?()=>window.desktopBridge.checkSystemPermission(`full-disk-access`):void 0,onOpenFullDiskAccessSettings:async()=>{await ve()?.shell.openSystemSettings(`full-disk-access`).catch(()=>{q.add({type:`error`,title:`Could not open System Settings`,description:`Open Privacy & Security → Full Disk Access manually.`})})},onClose:()=>v(null)}):null]})}function yr(){let e=(0,Z.c)(3),t=!Oe,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(vr,{disabled:t}),(0,Q.jsx)(Hn,{disabled:t}),(0,Q.jsx)(Gn,{disabled:t}),(0,Q.jsx)(Jn,{disabled:t}),(0,Q.jsx)(er,{disabled:t}),(0,Q.jsx)(Zn,{disabled:t}),(0,Q.jsx)(ir,{disabled:t}),(0,Q.jsx)(gr,{disabled:t})]}),e[0]=n):n=e[0];let r=n,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(Et,{category:`integrations`}),e[1]=i):i=e[1];let a;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsxs)(gt,{children:[i,(0,Q.jsxs)(vt,{id:`browser`,title:`Browser`,children:[t?(0,Q.jsx)(ht,{message:`Only available in the desktop app.`,children:r}):r,(0,Q.jsx)(cr,{}),(0,Q.jsx)(fr,{})]}),(0,Q.jsx)(mr,{})]}),e[2]=a):a=e[2],a}var br=yr;export{br as component};
2
+ //# sourceMappingURL=settings.integrations-2RsLmeUi.js.map
@@ -1,2 +1,2 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Cd as i,Ea as a,Ic as o,Ol as s,Ul as c,Vf as l,Xd as u,Xn as d,Zn as f,ap as p,du as m,fr as h,iu as g,mr as _,rr as v,t as y,tr as b,uf as x}from"./utils-DkKLB01I.js";import{Ea as S,Ma as C}from"./src-R7EkrVcv.js";import{Dr as w,Sr as T}from"./runtime-D5AfNyNA.js";import{a as E,c as D,o as O,s as k,t as A}from"./select-CE2f-g-3.js";import{t as j}from"./useLocation-KvBZAN7v.js";import{a as M}from"./relay-aZlRxOWS.js";import{f as N}from"./server-B2y_yoz_.js";import{i as P,n as F,o as ee}from"./session-Dt_Dt-Og.js";import{t as I}from"./use-atom-command-QDd_NqJQ.js";import{t as L}from"./env-BfPir1X4.js";import{a as R,n as z,t as B}from"./tooltip-CCYU8XGM.js";import{t as te}from"./toggle-CKr6iZUR.js";import{t as ne}from"./input-CiPGmOLv.js";import{i as re}from"./keybindings-CbaDrm2P.js";import{i as ie,o as V,t as ae}from"./popover-hyDlWUPU.js";import{n as oe,r as se,t as ce}from"./input-group-DOUsG7P-.js";import{n as le,t as ue}from"./kbd-C8opCm5n.js";import{G as de,V as fe,a as pe,i as me,s as he}from"./settingsLayout-Ds1fJJk7.js";import{a as H,c as ge,f as _e,i as ve,l as ye,m as be,n as xe,o as Se,p as U,r as Ce,s as we,t as Te,u as W}from"./KeybindingsSettings.logic-C6XG7NtX.js";import{Ir as Ee,Lr as De,zo as Oe}from"./main-xeaL6Ue7.js";var G=n(),K=e(t(),1),ke=e(a(),1),q=e(r(),1);function Ae(e){let t=(0,G.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(je),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,q.jsx)(r,{children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function je(e){let{part:t,key:n}=e;return(0,q.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 Me(e){let t=(0,G.c)(11),{query:n,onChange:r,inputRef:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(oe,{children:(0,q.jsx)(x,{"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,q.jsxs)(ce,{className:`min-w-0 basis-full **:[input]:h-9 sm:basis-0 sm:flex-1 sm:**:[input]:h-8`,children:[a,(0,q.jsx)(se,{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 Ne(e,t){return e.type===t?[...Ne(e.left,t),...Ne(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 Pe(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 Fe(e,t){let n=Pe(e);if(!n)return e;let r={type:`identifier`,name:t};return n.negated?{type:`not`,node:r}:r}function Ie(e,t){let n=Pe(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:Te}}function Le(e=`and`){return{type:e,left:Y(),right:{type:`not`,node:Y()}}}function X(e){let t=(0,G.c)(14),{label:n,focusable:r,className:i,children:a}=e,o=r===void 0||r?0:void 0,s;t[0]===i?s=t[1]:(s=y(`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]=s);let c;t[2]!==n||t[3]!==o||t[4]!==s?(c=(0,q.jsx)(`span`,{tabIndex:o,"aria-label":n,className:s}),t[2]=n,t[3]=o,t[4]=s,t[5]=c):c=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(l,{className:`size-3.5`}),t[6]=u):u=t[6];let d;t[7]===c?d=t[8]:(d=(0,q.jsx)(R,{render:c,children:u}),t[7]=c,t[8]=d);let f;t[9]===a?f=t[10]:(f=(0,q.jsx)(z,{side:`top`,children:a}),t[9]=a,t[10]=f);let p;return t[11]!==d||t[12]!==f?(p=(0,q.jsxs)(B,{children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function Re(e){let t=(0,G.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,q.jsx)(X,{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 ze(e){let t=(0,G.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,q.jsxs)(X,{label:i,children:[i,` The most recent matching binding wins when both conditions can apply.`]}),t[2]=i,t[3]=a),a}function Be(e){let t=(0,G.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,q.jsx)(D,{placeholder:`Condition`}),t[11]=d):d=t[11];let f;t[12]===i?f=t[13]:(f=i&&i.length>0?(0,q.jsx)(Re,{identifiers:i,focusable:!1}):null,t[12]=i,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,q.jsxs)(k,{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(Ve),t[16]=l,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,q.jsx)(O,{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,q.jsxs)(A,{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 Ve(e){return(0,q.jsx)(E,{value:e,className:`w-full`,children:(0,q.jsx)(`span`,{className:`truncate`,children:e})},e)}function He(e){let t=(0,G.c)(14),{label:n,className:r,onRemove:a}=e,o;t[0]===r?o=t[1]:(o=y(`size-7`,r),t[0]=r,t[1]=o);let s;t[2]!==n||t[3]!==a||t[4]!==o?(s=(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon-sm`,className:o,"aria-label":n,onClick:a}),t[2]=n,t[3]=a,t[4]=o,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,q.jsx)(i,{"aria-hidden":!0,className:`size-3.5`}),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,q.jsx)(R,{delay:200,render:s,children:c}),t[7]=s,t[8]=l);let u;t[9]===n?u=t[10]:(u=(0,q.jsx)(z,{side:`top`,children:n}),t[9]=n,t[10]=u);let d;return t[11]!==l||t[12]!==u?(d=(0,q.jsxs)(B,{children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Ue(e){let t=(0,G.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=Pe(n);if(e){let i=we(e.identifier)?[]:[e.identifier],l;t[6]!==n||t[7]!==a?(l=e=>a(Ie(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,q.jsx)(te,{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(Fe(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,q.jsx)(Be,{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,q.jsx)(He,{label:be(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,q.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=y(`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,q.jsx)(te,{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,q.jsx)(He,{label:be(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,q.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,q.jsx)(`span`,{className:`absolute top-0 bottom-0 left-1.5 w-px bg-border/70`,"aria-hidden":!0}),f=(0,q.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,q.jsxs)(`div`,{className:`relative pl-4`,children:[d,f,(0,q.jsx)(Ue,{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,q.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`,d,f,p,m;if(t[54]!==s||t[55]!==n||t[56]!==a||t[57]!==o||t[58]!==l||t[59]!==r){let e=Ne(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}`}}),h=(t,n)=>{let r=!1,i=J(e.map(e=>!r&&e===t?(r=!0,n):e),l);i&&a(i)},g=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)},b=()=>{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?p=t[65]:(p=y(`space-y-2 rounded-lg border border-border/60 bg-muted/10 p-2`,S),t[64]=S,t[65]=p);let C;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,q.jsx)(k,{size:`compact`,className:`w-24`,children:(0,q.jsx)(D,{})}),t[66]=C):C=t[66];let w;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,q.jsxs)(O,{alignItemWithTrigger:!1,matchTriggerWidth:!1,children:[(0,q.jsx)(E,{value:`and`,children:`and`}),(0,q.jsx)(E,{value:`or`,children:`or`})]}),t[67]=w):w=t[67];let T;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(u,{className:`size-3.5`}),t[68]=T):T=t[68];let j;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,q.jsx)(u,{className:`size-3.5`}),t[69]=j):j=t[69];let M;t[70]!==s||t[71]!==n||t[72]!==o?(M=o?(0,q.jsx)(He,{label:be(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,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsxs)(A,{value:l,onValueChange:e=>v(e),children:[C,w]}),(0,q.jsxs)(_,{type:`button`,variant:`outline`,size:`compact`,onClick:b,children:[T,`Condition`]}),(0,q.jsxs)(_,{type:`button`,variant:`outline`,size:`compact`,onClick:x,children:[j,`Group`]}),M]}),d=`space-y-2`,f=c.map(e=>{let{child:t,key:n}=e;return(0,q.jsxs)(`div`,{className:`relative pl-4`,children:[(0,q.jsx)(`span`,{className:y(`absolute top-0 bottom-0 left-1.5 w-px`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,q.jsx)(`span`,{className:y(`absolute top-4 left-1.5 h-px w-2.5`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,q.jsx)(Ue,{node:t,variables:r,depth:s+1,onChange:e=>h(t,e),onRemove:()=>g(t)})]},n)}),t[54]=s,t[55]=n,t[56]=a,t[57]=o,t[58]=l,t[59]=r,t[60]=d,t[61]=f,t[62]=p,t[63]=m}else d=t[60],f=t[61],p=t[62],m=t[63];let h;t[74]!==d||t[75]!==f?(h=(0,q.jsx)(`div`,{className:d,children:f}),t[74]=d,t[75]=f,t[76]=h):h=t[76];let g;return t[77]!==p||t[78]!==m||t[79]!==h?(g=(0,q.jsxs)(`div`,{className:p,children:[m,h]}),t[77]=p,t[78]=m,t[79]=h,t[80]=g):g=t[80],g}function We(e){let t=(0,G.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,l]=(0,K.useState)(o),d;t[2]===s?d=t[3]:(d=W(s),t[2]=s,t[3]=d);let f=d,p=f.ok?null:f.message,m;t[4]!==f.ok||t[5]!==f.value?(m=f.ok?_e(f.value):[],t[4]=f.ok,t[5]=f.value,t[6]=m):m=t[6];let h=m,g;t[7]!==i||t[8]!==a?(g=e=>{l(e);let t=W(e);a?.(t.ok),t.ok&&i(t.value)},t[7]=i,t[8]=a,t[9]=g):g=t[9];let v=g,y;t[10]!==i||t[11]!==a?(y=e=>{l(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=()=>{b(n?{type:`and`,left:n,right:Y()}: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=Le(`or`);b(n?{type:`and`,left:n,right:e}: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,q.jsx)(`div`,{className:`min-w-0`,children:(0,q.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,q.jsx)(u,{className:`size-3.5`}),t[20]=E):E=t[20];let D;t[21]===S?D=t[22]:(D=(0,q.jsxs)(_,{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,q.jsx)(u,{className:`size-3.5`}),t[23]=O):O=t[23];let k;t[24]===w?k=t[25]:(k=(0,q.jsxs)(_,{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,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,(0,q.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=!!p,N;t[31]!==s||t[32]!==j||t[33]!==M?(N=(0,q.jsx)(se,{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]=N):N=t[34];let P;t[35]===h?P=t[36]:(P=h.length>0?(0,q.jsx)(oe,{align:`inline-end`,children:(0,q.jsx)(Re,{identifiers:h})}):null,t[35]=h,t[36]=P);let F;t[37]!==N||t[38]!==P?(F=(0,q.jsxs)(ce,{children:[N,P]}),t[37]=N,t[38]=P,t[39]=F):F=t[39];let ee;t[40]===p?ee=t[41]:(ee=p?(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-2xs text-destructive`,children:[(0,q.jsx)(c,{className:`size-3.5`}),p]}):null,t[40]=p,t[41]=ee);let I;t[42]!==F||t[43]!==ee?(I=(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[F,ee]}),t[42]=F,t[43]=ee,t[44]=I):I=t[44];let L;t[45]!==S||t[46]!==w||t[47]!==b||t[48]!==n||t[49]!==r?(L=n?(0,q.jsx)(Ue,{node:n,variables:r,onChange:b,onRemove:()=>b(void 0)}):(0,q.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/15 p-3`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsxs)(_,{type:`button`,size:`compact`,onClick:S,children:[(0,q.jsx)(u,{className:`size-3.5`}),`Condition`]}),(0,q.jsxs)(_,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[(0,q.jsx)(u,{className:`size-3.5`}),`Group`]})]})}),t[45]=S,t[46]=w,t[47]=b,t[48]=n,t[49]=r,t[50]=L):L=t[50];let R;t[51]===p?R=t[52]:(R=p?(0,q.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]=p,t[52]=R);let z;t[53]!==L||t[54]!==R?(z=(0,q.jsxs)(`div`,{className:`relative`,children:[L,R]}),t[53]=L,t[54]=R,t[55]=z):z=t[55];let B;return t[56]!==A||t[57]!==I||t[58]!==z?(B=(0,q.jsxs)(`div`,{className:`w-[min(34rem,calc(100vw-2rem))] space-y-3`,children:[A,I,z]}),t[56]=A,t[57]=I,t[58]=z,t[59]=B):B=t[59],B}function Ge(e){return{keyDraft:e.key,whenDraft:e.binding.whenAst,isRecording:!1,isWhenDraftValid:!0}}function Z(e,t){return{...e,...t}}function Ke(e){return{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}}function Q(e){let t=(0,G.c)(27),{row:n,allRows:r,onSave:i}=e,[a,o]=(0,K.useReducer)(Z,n,Ge),s=(0,K.useRef)(null),{keyDraft:c,whenDraft:l,isRecording:u,isWhenDraftValid:d}=a,f,p,m;t[0]!==r||t[1]!==c||t[2]!==n.id||t[3]!==n.key||t[4]!==n.when||t[5]!==l?(m=U(l),f=c!==n.key||m!==n.when,p=ge(r,{rowId:n.id,key:c,when:m}),t[0]=r,t[1]=c,t[2]=n.id,t[3]=n.key,t[4]=n.when,t[5]=l,t[6]=f,t[7]=p,t[8]=m):(f=t[6],p=t[7],m=t[8]);let h=p,g;t[9]!==c||t[10]!==i||t[11]!==n||t[12]!==m?(g=()=>{i({command:n.command,key:c,when:m.trim().length>0?m:void 0,replace:Ke(n)})},t[9]=c,t[10]=i,t[11]=n,t[12]=m,t[13]=g):g=t[13];let _=g,v;t[14]!==u||t[15]!==n.key?(v=e=>{if(e.key===`Tab`&&!u)return;if(e.preventDefault(),e.key===`Escape`){e.stopPropagation();let t=e.currentTarget;(0,ke.flushSync)(()=>o({keyDraft:n.key,isRecording:!1})),s.current?s.current.focus():t.blur();return}let t=ye(e.nativeEvent,navigator.platform);t&&o({keyDraft:t,isRecording:!1})},t[14]=u,t[15]=n.key,t[16]=v):v=t[16];let y=v,b;return t[17]!==y||t[18]!==h||t[19]!==f||t[20]!==u||t[21]!==d||t[22]!==c||t[23]!==_||t[24]!==l||t[25]!==m?(b={keyDraft:c,whenDraft:l,isRecording:u,isWhenDraftValid:d,whenDraftExpression:m,isDirty:f,conflictLabels:h,setDraft:o,save:_,captureKeybinding:y,pillRef:s},t[17]=y,t[18]=h,t[19]=f,t[20]=u,t[21]=d,t[22]=c,t[23]=_,t[24]=l,t[25]=m,t[26]=b):b=t[26],b}function qe(e){let t=(0,G.c)(20),{row:n,editor:r,isSaving:i,pillClassName:a}=e,{keyDraft:o,isRecording:s,isDirty:c,isWhenDraftValid:l,setDraft:u,save:d,captureKeybinding:f,pillRef:p}=r,m=!s&&o===n.key&&n.key.length>0&&!c,h;t[0]!==c||t[1]!==i||t[2]!==l||t[3]!==o||t[4]!==d?(h=c?(0,q.jsx)(_,{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]=h):h=t[5];let g;t[6]!==f||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==p||t[11]!==n.binding||t[12]!==n.command||t[13]!==n.key||t[14]!==u||t[15]!==m?(g=m?(0,q.jsx)(`button`,{ref:p,type:`button`,onClick:()=>u({isRecording:!0}),"aria-label":`Edit shortcut for ${H(n.command)}: ${re(n.binding.shortcut)}`,className:y(`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,q.jsx)(Ae,{value:n.key})}):(0,q.jsx)(ne,{"data-keybinding-capture":``,autoFocus:s,"aria-label":`Keybinding for ${H(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]=p,t[11]=n.binding,t[12]=n.command,t[13]=n.key,t[14]=u,t[15]=m,t[16]=g):g=t[16];let v;return t[17]!==h||t[18]!==g?(v=(0,q.jsxs)(q.Fragment,{children:[h,g]}),t[17]=h,t[18]=g,t[19]=v):v=t[19],v}function Je(e){let t=(0,G.c)(20),{label:n,expression:r,value:i,variables:a,onChange:o,onValidityChange:c}=e,l;t[0]===c?l=t[1]:(l=e=>{e||c(!0)},t[0]=c,t[1]=l);let u=l,d=r?`ghost`:`ghost-muted`,f;t[2]===d?f=t[3]:(f=(0,q.jsx)(_,{variant:d,size:`micro`,className:`min-w-0 shrink`}),t[2]=d,t[3]=f);let p=`Edit when clause for ${n}`,m=r||`Always`,h;t[4]===m?h=t[5]:(h=(0,q.jsx)(`span`,{className:`truncate font-mono`,children:m}),t[4]=m,t[5]=h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,q.jsx)(s,{className:`size-3.5 shrink-0 opacity-60`}),t[6]=g):g=t[6];let v;t[7]!==f||t[8]!==p||t[9]!==h?(v=(0,q.jsxs)(V,{render:f,"aria-label":p,children:[h,g]}),t[7]=f,t[8]=p,t[9]=h,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==c||t[13]!==i||t[14]!==a?(y=(0,q.jsx)(ie,{align:`start`,sideOffset:6,children:(0,q.jsx)(We,{value:i,variables:a,onChange:o,onValidityChange:c})}),t[11]=o,t[12]=c,t[13]=i,t[14]=a,t[15]=y):y=t[15];let b;return t[16]!==u||t[17]!==v||t[18]!==y?(b=(0,q.jsxs)(ae,{onOpenChange:u,children:[v,y]}),t[16]=u,t[17]=v,t[18]=y,t[19]=b):b=t[19],b}function Ye(e){let t=(0,G.c)(24),{row:n,isSaving:r,onReset:i,onRemove:a}=e,o=n.source===`Custom`&&n.defaultKey!==null,s=n.source!==`Default`;if(!o&&!s)return null;let c;t[0]===n.command?c=t[1]:(c=H(n.command),t[0]=n.command,t[1]=c);let l=`Actions for ${c}`,u;t[2]!==r||t[3]!==l?(u=(0,q.jsx)(_,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:r,"aria-label":l}),t[2]=r,t[3]=l,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,q.jsx)(g,{className:`size-3.5`}),t[5]=d):d=t[5];let p;t[6]===u?p=t[7]:(p=(0,q.jsx)(h,{render:u,children:d}),t[6]=u,t[7]=p);let m;t[8]!==o||t[9]!==r||t[10]!==i||t[11]!==n?(m=o?(0,q.jsx)(b,{disabled:r,onClick:()=>i(n),children:`Reset to default`}):null,t[8]=o,t[9]=r,t[10]=i,t[11]=n,t[12]=m):m=t[12];let y;t[13]!==s||t[14]!==r||t[15]!==a||t[16]!==n?(y=s?(0,q.jsx)(b,{variant:`destructive`,disabled:r,onClick:()=>a(n),children:`Remove`}):null,t[13]=s,t[14]=r,t[15]=a,t[16]=n,t[17]=y):y=t[17];let x;t[18]!==m||t[19]!==y?(x=(0,q.jsxs)(v,{align:`end`,children:[m,y]}),t[18]=m,t[19]=y,t[20]=x):x=t[20];let S;return t[21]!==p||t[22]!==x?(S=(0,q.jsxs)(f,{children:[p,x]}),t[21]=p,t[22]=x,t[23]=S):S=t[23],S}function Xe(e){let t=(0,G.c)(2),{source:n}=e;if(n===`Default`)return null;let r;return t[0]===n?r=t[1]:(r=(0,q.jsx)(d,{variant:`outline`,size:`sm`,children:n}),t[0]=n,t[1]=r),r}function $(e){let t=(0,G.c)(13),{row:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsx)(`span`,{className:`flex items-center gap-2`}),t[0]=r):r=t[0];let i;t[1]===n.command?i=t[2]:(i=H(n.command),t[1]=n.command,t[2]=i);let a;t[3]===n.source?a=t[4]:(a=(0,q.jsx)(Xe,{source:n.source}),t[3]=n.source,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,q.jsxs)(R,{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,q.jsx)(z,{side:`top`,children:n.command}),t[8]=n.command,t[9]=s);let c;return t[10]!==o||t[11]!==s?(c=(0,q.jsxs)(B,{children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Ze(e){let t=(0,G.c)(13),{row:n,editor:r,variables:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.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=H(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,q.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[a,(0,q.jsx)(Je,{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 Qe(e){let t=(0,G.c)(2),n;return t[0]===e?n=t[1]:(n=(0,q.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,q.jsx)(Ye,{...e})}),t[0]=e,t[1]=n),n}function $e(e){let t=(0,G.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=Q(u),f;t[4]===n?f=t[5]:(f=(0,q.jsx)($,{row:n}),t[4]=n,t[5]=f);let p;t[6]!==d||t[7]!==n||t[8]!==o?(p=(0,q.jsx)(Ze,{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,q.jsx)(ze,{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,q.jsx)(Qe,{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,q.jsx)(qe,{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,q.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,q.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 et(e){let t=(0,G.c)(30),{allRows:n,onSave:r}=e,[i,a]=(0,K.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,K.useReducer)(Z,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?H(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`){e.stopPropagation(),c({keyDraft:``,isRecording:!1}),e.currentTarget.blur();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 tt(e){let t=(0,G.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,q.jsx)(D,{placeholder:`Command`}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,q.jsx)(k,{size:`sm`,className:i,children:s}),t[3]=i,t[4]=c);let l;t[5]===r?l=t[6]:(l=r.map(nt),t[5]=r,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,q.jsx)(O,{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,q.jsxs)(A,{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 nt(e){return(0,q.jsx)(E,{value:e,className:`w-full`,children:(0,q.jsx)(`span`,{className:`truncate`,children:H(e)})},e)}function rt(e){let t=(0,G.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,q.jsx)(ne,{"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 it(e){let t=(0,G.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,q.jsx)(Je,{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 at(e){let t=(0,G.c)(9),{isSaving:n,onCancel:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,q.jsx)(_,{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,q.jsx)(p,{className:`size-3.5`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,q.jsx)(R,{render:i,children:a}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsx)(z,{side:`top`,children:`Cancel`}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,q.jsxs)(B,{children:[o,s]}),t[7]=o,t[8]=c),c}function ot(e){let t=(0,G.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=et(c),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.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,q.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[u,(0,q.jsx)(it,{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,q.jsx)(tt,{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,q.jsx)(ze,{labels:l.conflictLabels}),t[10]=l.conflictLabels,t[11]=p);let m;t[12]===l?m=t[13]:(m=(0,q.jsx)(rt,{draft:l,className:`w-44`}),t[12]=l,t[13]=m);let h=a||!l.canSave,g=a?`Saving`:`Save`,v;t[14]!==l.save||t[15]!==h||t[16]!==g?(v=(0,q.jsx)(_,{size:`sm`,disabled:h,onClick:l.save,children:g}),t[14]=l.save,t[15]=h,t[16]=g,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==s?(y=(0,q.jsx)(at,{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,q.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,q.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 st(e){let{groups:t,anchorIds:n,savingCommand:r,...i}=e;return t.map(e=>(0,q.jsx)(he,{id:`keybindings-${e.id}`,title:e.title,children:e.rows.map(e=>(0,q.jsx)($e,{row:e,anchorId:n.get(e.id),isSaving:r===e.command,...i},e.id))},e.id))}function ct(){let e=(0,G.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{delay:200,render:(0,q.jsx)(_,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":`The browser may claim some shortcuts first. The desktop app receives them all.`,children:(0,q.jsx)(l,{className:`size-3.5 text-warning`})})}),(0,q.jsx)(z,{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 lt(){let e=(0,G.c)(83),{environment:t,connectedEnvironments:n}=fe(),r=P(t?.environmentId??null,S),i=ee(n,C),a;e[0]!==n||e[1]!==i?(a=n.length>0&&n.every(e=>i.has(e.environmentId)),e[0]=n,e[1]=i,e[2]=a):a=e[2];let s=a,c=t?.serverConfig?.keybindings,l;e[3]===c?l=e[4]:(l=c??[],e[3]=c,e[4]=l);let d;e[5]===l?d=e[6]:(d=o(l),e[5]=l,e[6]=d);let f=d,p=t?.serverConfig?.keybindingsConfigPath??null,h;e[7]===t?.serverConfig?.availableEditors?h=e[8]:(h=t?.serverConfig?.availableEditors??[],e[7]=t?.serverConfig?.availableEditors,e[8]=h);let g=h,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(v={reportFailure:!1},e[9]=v):v=e[9];let y=I(N.upsertKeybinding,v),b;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},e[10]=b):b=e[10];let x=I(N.removeKeybinding,b),E=Oe(t?.environmentId??null,g),[D,O]=(0,K.useState)(``),k=(0,K.useRef)(null),[A,te]=(0,K.useState)(null),[ne,re]=(0,K.useState)(!1),ie;e[11]!==f||e[12]!==D?(ie=Ce(f,D),e[11]=f,e[12]=D,e[13]=ie):ie=e[13];let V=ie,ae;e[14]===V?ae=e[15]:(ae=Se(V),e[14]=V,e[15]=ae);let oe=ae,se;if(e[16]!==V){se=new Map;let t=new Set;for(let e of V)t.has(e.command)||(t.add(e.command),se.set(e.id,Ee(e.command)));e[16]=V,e[17]=se}else se=e[17];let ce=se,le;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(le={select:mt},e[18]=le):le=e[18];let ue=j(le),[pe,H]=(0,K.useState)(ue);ue!==pe&&(H(ue),ue.startsWith(`keybinding-`)&&O(``));let ge;e[19]===f?ge=e[20]:(ge=xe(f),e[19]=f,e[20]=ge);let _e=ge,ye;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(ye=ve(),e[21]=ye):ye=e[21];let be=ye,U;e[22]!==p||e[23]!==E||e[24]!==t?(U=()=>{p&&t&&F(t.environmentId,`orchestration:operate`)&&(async()=>{let e=await E(p);if(e._tag===`Success`||T(e))return;let t=w(e);M.add({title:`Unable to open keybindings file`,description:t instanceof Error?t.message:`The keybindings file was not opened.`,type:`error`})})()},e[22]=p,e[23]=E,e[24]=t,e[25]=U):U=e[25];let we=U,Te;e[26]!==n||e[27]!==t||e[28]!==y?(Te=e=>{if(!t||!n.every(pt))return;te(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=>y({environmentId:e.environmentId,input:r})));te(null);let t=e.find(ft);if(!t)re(!1);else if(!T(t)){let e=w(t);M.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]=y,e[29]=Te):Te=e[29];let W=Te,ke;e[30]!==n||e[31]!==t||e[32]!==x?(ke=e=>{t&&n.every(dt)&&(te(e.command),(async()=>{let t=await Promise.all(n.map(t=>x({environmentId:t.environmentId,input:Ke(e)})));te(null);let r=t.find(ut)??t[0];if(r?._tag===`Failure`&&!T(r)){let e=w(r);M.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]=x,e[33]=ke):ke=e[33];let Ae=ke,je;e[34]===W?je=e[35]:(je=e=>{e.defaultKey&&W({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]=W,e[35]=je);let Ne=je,J;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>re(!1),e[36]=J):J=e[36];let Pe=J,Fe;e[37]!==Ae||e[38]!==Ne||e[39]!==V||e[40]!==W?(Fe={allRows:V,variables:be,onSave:W,onReset:Ne,onRemove:Ae},e[37]=Ae,e[38]=Ne,e[39]=V,e[40]=W,e[41]=Fe):Fe=e[41];let Ie=Fe,Y,Le;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Y=De(`keybindings`),Le=L?null:(0,q.jsx)(ct,{}),e[42]=Y,e[43]=Le):(Y=e[42],Le=e[43]);let X;e[44]===D?X=e[45]:(X=(0,q.jsx)(Me,{query:D,onChange:O,inputRef:k}),e[44]=D,e[45]=X);let Re=ne||!s,ze,Be;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>re(!0),Be=(0,q.jsx)(u,{"aria-hidden":!0,className:`size-4`}),e[46]=ze,e[47]=Be):(ze=e[46],Be=e[47]);let Ve;e[48]===Re?Ve=e[49]:(Ve=(0,q.jsxs)(_,{type:`button`,variant:`outline`,disabled:Re,onClick:ze,children:[Be,`Add keybinding`]}),e[48]=Re,e[49]=Ve);let He=!p||!r,Ue;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,q.jsx)(m,{"aria-hidden":!0,className:`size-4`}),e[50]=Ue):Ue=e[50];let We;e[51]!==we||e[52]!==He?(We=(0,q.jsx)(R,{render:(0,q.jsx)(_,{type:`button`,variant:`outline`,size:`icon`,disabled:He,onClick:we,"aria-label":`Open keybindings.json`,children:Ue})}),e[51]=we,e[52]=He,e[53]=We):We=e[53];let Ge;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,q.jsx)(z,{side:`top`,children:`Open keybindings.json`}),e[54]=Ge):Ge=e[54];let Z;e[55]===We?Z=e[56]:(Z=(0,q.jsxs)(B,{children:[We,Ge]}),e[55]=We,e[56]=Z);let Q;e[57]!==X||e[58]!==Ve||e[59]!==Z?(Q=(0,q.jsx)(he,{...Y,headerAction:Le,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[X,Ve,Z]})}),e[57]=X,e[58]=Ve,e[59]=Z,e[60]=Q):Q=e[60];let qe;e[61]!==s||e[62]!==n?(qe=s?null:(0,q.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]=qe):qe=e[63];let Je=!s,Ye;e[64]!==_e||e[65]!==ne||e[66]!==V||e[67]!==W||e[68]!==A?(Ye=ne?(0,q.jsx)(de,{children:(0,q.jsx)(ot,{commandOptions:_e,allRows:V,variables:be,isSaving:A!==null,onSave:W,onCancel:Pe})}):null,e[64]=_e,e[65]=ne,e[66]=V,e[67]=W,e[68]=A,e[69]=Ye):Ye=e[69];let Xe;e[70]!==ce||e[71]!==oe||e[72]!==Ie||e[73]!==A?(Xe=oe.length>0?(0,q.jsx)(st,{groups:oe,anchorIds:ce,savingCommand:A,...Ie}):(0,q.jsx)(de,{children:(0,q.jsx)(`div`,{className:`px-4 py-12 text-center text-sm text-muted-foreground`,children:`No keybindings match your search.`})}),e[70]=ce,e[71]=oe,e[72]=Ie,e[73]=A,e[74]=Xe):Xe=e[74];let $;e[75]!==Je||e[76]!==Ye||e[77]!==Xe?($=(0,q.jsxs)(`div`,{inert:Je,className:`flex flex-col gap-8`,children:[Ye,Xe]}),e[75]=Je,e[76]=Ye,e[77]=Xe,e[78]=$):$=e[78];let Ze;return e[79]!==Q||e[80]!==qe||e[81]!==$?(Ze=(0,q.jsxs)(me,{children:[Q,qe,$]}),e[79]=Q,e[80]=qe,e[81]=$,e[82]=Ze):Ze=e[82],Ze}function ut(e){return e._tag===`Failure`}function dt(e){return F(e.environmentId,C)}function ft(e){return e._tag===`Failure`}function pt(e){return F(e.environmentId,C)}function mt(e){return e.hash.replace(/^#/,``)}var ht=lt;export{ht as component};
2
- //# sourceMappingURL=settings.keybindings-BPtpYe84.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Cd as i,Ea as a,Ic as o,Ol as s,Ul as c,Vf as l,Xd as u,Xn as d,Zn as f,ap as p,du as m,fr as h,iu as g,mr as _,rr as v,t as y,tr as b,uf as x}from"./utils-DkKLB01I.js";import{Ea as S,Ma as C}from"./src-R7EkrVcv.js";import{Dr as w,Sr as T}from"./runtime-BvdQMwVb.js";import{a as E,c as D,o as O,s as k,t as A}from"./select-CE2f-g-3.js";import{t as j}from"./useLocation-KvBZAN7v.js";import{a as M}from"./relay-CTdDIWLg.js";import{f as N}from"./server-DthHkqkT.js";import{i as P,n as F,o as ee}from"./session-CxeYe0sJ.js";import{t as I}from"./use-atom-command-Bsfu4mja.js";import{t as L}from"./env-BfPir1X4.js";import{a as R,n as z,t as B}from"./tooltip-CCYU8XGM.js";import{t as te}from"./toggle-CKr6iZUR.js";import{t as ne}from"./input-CiPGmOLv.js";import{i as re}from"./keybindings-CbaDrm2P.js";import{i as ie,o as V,t as ae}from"./popover-hyDlWUPU.js";import{n as oe,r as se,t as ce}from"./input-group-DOUsG7P-.js";import{n as le,t as ue}from"./kbd-C8opCm5n.js";import{G as de,V as fe,a as pe,i as me,s as he}from"./settingsLayout-YTaL8Lym.js";import{a as H,c as ge,f as _e,i as ve,l as ye,m as be,n as xe,o as Se,p as U,r as Ce,s as we,t as Te,u as W}from"./KeybindingsSettings.logic-C6XG7NtX.js";import{Ir as Ee,Lr as De,zo as Oe}from"./main-C04YJQbN.js";var G=n(),K=e(t(),1),ke=e(a(),1),q=e(r(),1);function Ae(e){let t=(0,G.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(je),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,q.jsx)(r,{children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function je(e){let{part:t,key:n}=e;return(0,q.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 Me(e){let t=(0,G.c)(11),{query:n,onChange:r,inputRef:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.jsx)(oe,{children:(0,q.jsx)(x,{"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,q.jsxs)(ce,{className:`min-w-0 basis-full **:[input]:h-9 sm:basis-0 sm:flex-1 sm:**:[input]:h-8`,children:[a,(0,q.jsx)(se,{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 Ne(e,t){return e.type===t?[...Ne(e.left,t),...Ne(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 Pe(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 Fe(e,t){let n=Pe(e);if(!n)return e;let r={type:`identifier`,name:t};return n.negated?{type:`not`,node:r}:r}function Ie(e,t){let n=Pe(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:Te}}function Le(e=`and`){return{type:e,left:Y(),right:{type:`not`,node:Y()}}}function X(e){let t=(0,G.c)(14),{label:n,focusable:r,className:i,children:a}=e,o=r===void 0||r?0:void 0,s;t[0]===i?s=t[1]:(s=y(`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]=s);let c;t[2]!==n||t[3]!==o||t[4]!==s?(c=(0,q.jsx)(`span`,{tabIndex:o,"aria-label":n,className:s}),t[2]=n,t[3]=o,t[4]=s,t[5]=c):c=t[5];let u;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.jsx)(l,{className:`size-3.5`}),t[6]=u):u=t[6];let d;t[7]===c?d=t[8]:(d=(0,q.jsx)(R,{render:c,children:u}),t[7]=c,t[8]=d);let f;t[9]===a?f=t[10]:(f=(0,q.jsx)(z,{side:`top`,children:a}),t[9]=a,t[10]=f);let p;return t[11]!==d||t[12]!==f?(p=(0,q.jsxs)(B,{children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function Re(e){let t=(0,G.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,q.jsx)(X,{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 ze(e){let t=(0,G.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,q.jsxs)(X,{label:i,children:[i,` The most recent matching binding wins when both conditions can apply.`]}),t[2]=i,t[3]=a),a}function Be(e){let t=(0,G.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,q.jsx)(D,{placeholder:`Condition`}),t[11]=d):d=t[11];let f;t[12]===i?f=t[13]:(f=i&&i.length>0?(0,q.jsx)(Re,{identifiers:i,focusable:!1}):null,t[12]=i,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,q.jsxs)(k,{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(Ve),t[16]=l,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,q.jsx)(O,{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,q.jsxs)(A,{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 Ve(e){return(0,q.jsx)(E,{value:e,className:`w-full`,children:(0,q.jsx)(`span`,{className:`truncate`,children:e})},e)}function He(e){let t=(0,G.c)(14),{label:n,className:r,onRemove:a}=e,o;t[0]===r?o=t[1]:(o=y(`size-7`,r),t[0]=r,t[1]=o);let s;t[2]!==n||t[3]!==a||t[4]!==o?(s=(0,q.jsx)(_,{type:`button`,variant:`ghost`,size:`icon-sm`,className:o,"aria-label":n,onClick:a}),t[2]=n,t[3]=a,t[4]=o,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,q.jsx)(i,{"aria-hidden":!0,className:`size-3.5`}),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,q.jsx)(R,{delay:200,render:s,children:c}),t[7]=s,t[8]=l);let u;t[9]===n?u=t[10]:(u=(0,q.jsx)(z,{side:`top`,children:n}),t[9]=n,t[10]=u);let d;return t[11]!==l||t[12]!==u?(d=(0,q.jsxs)(B,{children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Ue(e){let t=(0,G.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=Pe(n);if(e){let i=we(e.identifier)?[]:[e.identifier],l;t[6]!==n||t[7]!==a?(l=e=>a(Ie(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,q.jsx)(te,{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(Fe(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,q.jsx)(Be,{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,q.jsx)(He,{label:be(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,q.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=y(`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,q.jsx)(te,{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,q.jsx)(He,{label:be(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,q.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,q.jsx)(`span`,{className:`absolute top-0 bottom-0 left-1.5 w-px bg-border/70`,"aria-hidden":!0}),f=(0,q.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,q.jsxs)(`div`,{className:`relative pl-4`,children:[d,f,(0,q.jsx)(Ue,{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,q.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`,d,f,p,m;if(t[54]!==s||t[55]!==n||t[56]!==a||t[57]!==o||t[58]!==l||t[59]!==r){let e=Ne(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}`}}),h=(t,n)=>{let r=!1,i=J(e.map(e=>!r&&e===t?(r=!0,n):e),l);i&&a(i)},g=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)},b=()=>{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?p=t[65]:(p=y(`space-y-2 rounded-lg border border-border/60 bg-muted/10 p-2`,S),t[64]=S,t[65]=p);let C;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,q.jsx)(k,{size:`compact`,className:`w-24`,children:(0,q.jsx)(D,{})}),t[66]=C):C=t[66];let w;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,q.jsxs)(O,{alignItemWithTrigger:!1,matchTriggerWidth:!1,children:[(0,q.jsx)(E,{value:`and`,children:`and`}),(0,q.jsx)(E,{value:`or`,children:`or`})]}),t[67]=w):w=t[67];let T;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(u,{className:`size-3.5`}),t[68]=T):T=t[68];let j;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,q.jsx)(u,{className:`size-3.5`}),t[69]=j):j=t[69];let M;t[70]!==s||t[71]!==n||t[72]!==o?(M=o?(0,q.jsx)(He,{label:be(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,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsxs)(A,{value:l,onValueChange:e=>v(e),children:[C,w]}),(0,q.jsxs)(_,{type:`button`,variant:`outline`,size:`compact`,onClick:b,children:[T,`Condition`]}),(0,q.jsxs)(_,{type:`button`,variant:`outline`,size:`compact`,onClick:x,children:[j,`Group`]}),M]}),d=`space-y-2`,f=c.map(e=>{let{child:t,key:n}=e;return(0,q.jsxs)(`div`,{className:`relative pl-4`,children:[(0,q.jsx)(`span`,{className:y(`absolute top-0 bottom-0 left-1.5 w-px`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,q.jsx)(`span`,{className:y(`absolute top-4 left-1.5 h-px w-2.5`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,q.jsx)(Ue,{node:t,variables:r,depth:s+1,onChange:e=>h(t,e),onRemove:()=>g(t)})]},n)}),t[54]=s,t[55]=n,t[56]=a,t[57]=o,t[58]=l,t[59]=r,t[60]=d,t[61]=f,t[62]=p,t[63]=m}else d=t[60],f=t[61],p=t[62],m=t[63];let h;t[74]!==d||t[75]!==f?(h=(0,q.jsx)(`div`,{className:d,children:f}),t[74]=d,t[75]=f,t[76]=h):h=t[76];let g;return t[77]!==p||t[78]!==m||t[79]!==h?(g=(0,q.jsxs)(`div`,{className:p,children:[m,h]}),t[77]=p,t[78]=m,t[79]=h,t[80]=g):g=t[80],g}function We(e){let t=(0,G.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,l]=(0,K.useState)(o),d;t[2]===s?d=t[3]:(d=W(s),t[2]=s,t[3]=d);let f=d,p=f.ok?null:f.message,m;t[4]!==f.ok||t[5]!==f.value?(m=f.ok?_e(f.value):[],t[4]=f.ok,t[5]=f.value,t[6]=m):m=t[6];let h=m,g;t[7]!==i||t[8]!==a?(g=e=>{l(e);let t=W(e);a?.(t.ok),t.ok&&i(t.value)},t[7]=i,t[8]=a,t[9]=g):g=t[9];let v=g,y;t[10]!==i||t[11]!==a?(y=e=>{l(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=()=>{b(n?{type:`and`,left:n,right:Y()}: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=Le(`or`);b(n?{type:`and`,left:n,right:e}: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,q.jsx)(`div`,{className:`min-w-0`,children:(0,q.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,q.jsx)(u,{className:`size-3.5`}),t[20]=E):E=t[20];let D;t[21]===S?D=t[22]:(D=(0,q.jsxs)(_,{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,q.jsx)(u,{className:`size-3.5`}),t[23]=O):O=t[23];let k;t[24]===w?k=t[25]:(k=(0,q.jsxs)(_,{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,q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,(0,q.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=!!p,N;t[31]!==s||t[32]!==j||t[33]!==M?(N=(0,q.jsx)(se,{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]=N):N=t[34];let P;t[35]===h?P=t[36]:(P=h.length>0?(0,q.jsx)(oe,{align:`inline-end`,children:(0,q.jsx)(Re,{identifiers:h})}):null,t[35]=h,t[36]=P);let F;t[37]!==N||t[38]!==P?(F=(0,q.jsxs)(ce,{children:[N,P]}),t[37]=N,t[38]=P,t[39]=F):F=t[39];let ee;t[40]===p?ee=t[41]:(ee=p?(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 text-2xs text-destructive`,children:[(0,q.jsx)(c,{className:`size-3.5`}),p]}):null,t[40]=p,t[41]=ee);let I;t[42]!==F||t[43]!==ee?(I=(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[F,ee]}),t[42]=F,t[43]=ee,t[44]=I):I=t[44];let L;t[45]!==S||t[46]!==w||t[47]!==b||t[48]!==n||t[49]!==r?(L=n?(0,q.jsx)(Ue,{node:n,variables:r,onChange:b,onRemove:()=>b(void 0)}):(0,q.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/15 p-3`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsxs)(_,{type:`button`,size:`compact`,onClick:S,children:[(0,q.jsx)(u,{className:`size-3.5`}),`Condition`]}),(0,q.jsxs)(_,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[(0,q.jsx)(u,{className:`size-3.5`}),`Group`]})]})}),t[45]=S,t[46]=w,t[47]=b,t[48]=n,t[49]=r,t[50]=L):L=t[50];let R;t[51]===p?R=t[52]:(R=p?(0,q.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]=p,t[52]=R);let z;t[53]!==L||t[54]!==R?(z=(0,q.jsxs)(`div`,{className:`relative`,children:[L,R]}),t[53]=L,t[54]=R,t[55]=z):z=t[55];let B;return t[56]!==A||t[57]!==I||t[58]!==z?(B=(0,q.jsxs)(`div`,{className:`w-[min(34rem,calc(100vw-2rem))] space-y-3`,children:[A,I,z]}),t[56]=A,t[57]=I,t[58]=z,t[59]=B):B=t[59],B}function Ge(e){return{keyDraft:e.key,whenDraft:e.binding.whenAst,isRecording:!1,isWhenDraftValid:!0}}function Z(e,t){return{...e,...t}}function Ke(e){return{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}}function Q(e){let t=(0,G.c)(27),{row:n,allRows:r,onSave:i}=e,[a,o]=(0,K.useReducer)(Z,n,Ge),s=(0,K.useRef)(null),{keyDraft:c,whenDraft:l,isRecording:u,isWhenDraftValid:d}=a,f,p,m;t[0]!==r||t[1]!==c||t[2]!==n.id||t[3]!==n.key||t[4]!==n.when||t[5]!==l?(m=U(l),f=c!==n.key||m!==n.when,p=ge(r,{rowId:n.id,key:c,when:m}),t[0]=r,t[1]=c,t[2]=n.id,t[3]=n.key,t[4]=n.when,t[5]=l,t[6]=f,t[7]=p,t[8]=m):(f=t[6],p=t[7],m=t[8]);let h=p,g;t[9]!==c||t[10]!==i||t[11]!==n||t[12]!==m?(g=()=>{i({command:n.command,key:c,when:m.trim().length>0?m:void 0,replace:Ke(n)})},t[9]=c,t[10]=i,t[11]=n,t[12]=m,t[13]=g):g=t[13];let _=g,v;t[14]!==u||t[15]!==n.key?(v=e=>{if(e.key===`Tab`&&!u)return;if(e.preventDefault(),e.key===`Escape`){e.stopPropagation();let t=e.currentTarget;(0,ke.flushSync)(()=>o({keyDraft:n.key,isRecording:!1})),s.current?s.current.focus():t.blur();return}let t=ye(e.nativeEvent,navigator.platform);t&&o({keyDraft:t,isRecording:!1})},t[14]=u,t[15]=n.key,t[16]=v):v=t[16];let y=v,b;return t[17]!==y||t[18]!==h||t[19]!==f||t[20]!==u||t[21]!==d||t[22]!==c||t[23]!==_||t[24]!==l||t[25]!==m?(b={keyDraft:c,whenDraft:l,isRecording:u,isWhenDraftValid:d,whenDraftExpression:m,isDirty:f,conflictLabels:h,setDraft:o,save:_,captureKeybinding:y,pillRef:s},t[17]=y,t[18]=h,t[19]=f,t[20]=u,t[21]=d,t[22]=c,t[23]=_,t[24]=l,t[25]=m,t[26]=b):b=t[26],b}function qe(e){let t=(0,G.c)(20),{row:n,editor:r,isSaving:i,pillClassName:a}=e,{keyDraft:o,isRecording:s,isDirty:c,isWhenDraftValid:l,setDraft:u,save:d,captureKeybinding:f,pillRef:p}=r,m=!s&&o===n.key&&n.key.length>0&&!c,h;t[0]!==c||t[1]!==i||t[2]!==l||t[3]!==o||t[4]!==d?(h=c?(0,q.jsx)(_,{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]=h):h=t[5];let g;t[6]!==f||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==p||t[11]!==n.binding||t[12]!==n.command||t[13]!==n.key||t[14]!==u||t[15]!==m?(g=m?(0,q.jsx)(`button`,{ref:p,type:`button`,onClick:()=>u({isRecording:!0}),"aria-label":`Edit shortcut for ${H(n.command)}: ${re(n.binding.shortcut)}`,className:y(`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,q.jsx)(Ae,{value:n.key})}):(0,q.jsx)(ne,{"data-keybinding-capture":``,autoFocus:s,"aria-label":`Keybinding for ${H(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]=p,t[11]=n.binding,t[12]=n.command,t[13]=n.key,t[14]=u,t[15]=m,t[16]=g):g=t[16];let v;return t[17]!==h||t[18]!==g?(v=(0,q.jsxs)(q.Fragment,{children:[h,g]}),t[17]=h,t[18]=g,t[19]=v):v=t[19],v}function Je(e){let t=(0,G.c)(20),{label:n,expression:r,value:i,variables:a,onChange:o,onValidityChange:c}=e,l;t[0]===c?l=t[1]:(l=e=>{e||c(!0)},t[0]=c,t[1]=l);let u=l,d=r?`ghost`:`ghost-muted`,f;t[2]===d?f=t[3]:(f=(0,q.jsx)(_,{variant:d,size:`micro`,className:`min-w-0 shrink`}),t[2]=d,t[3]=f);let p=`Edit when clause for ${n}`,m=r||`Always`,h;t[4]===m?h=t[5]:(h=(0,q.jsx)(`span`,{className:`truncate font-mono`,children:m}),t[4]=m,t[5]=h);let g;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,q.jsx)(s,{className:`size-3.5 shrink-0 opacity-60`}),t[6]=g):g=t[6];let v;t[7]!==f||t[8]!==p||t[9]!==h?(v=(0,q.jsxs)(V,{render:f,"aria-label":p,children:[h,g]}),t[7]=f,t[8]=p,t[9]=h,t[10]=v):v=t[10];let y;t[11]!==o||t[12]!==c||t[13]!==i||t[14]!==a?(y=(0,q.jsx)(ie,{align:`start`,sideOffset:6,children:(0,q.jsx)(We,{value:i,variables:a,onChange:o,onValidityChange:c})}),t[11]=o,t[12]=c,t[13]=i,t[14]=a,t[15]=y):y=t[15];let b;return t[16]!==u||t[17]!==v||t[18]!==y?(b=(0,q.jsxs)(ae,{onOpenChange:u,children:[v,y]}),t[16]=u,t[17]=v,t[18]=y,t[19]=b):b=t[19],b}function Ye(e){let t=(0,G.c)(24),{row:n,isSaving:r,onReset:i,onRemove:a}=e,o=n.source===`Custom`&&n.defaultKey!==null,s=n.source!==`Default`;if(!o&&!s)return null;let c;t[0]===n.command?c=t[1]:(c=H(n.command),t[0]=n.command,t[1]=c);let l=`Actions for ${c}`,u;t[2]!==r||t[3]!==l?(u=(0,q.jsx)(_,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:r,"aria-label":l}),t[2]=r,t[3]=l,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,q.jsx)(g,{className:`size-3.5`}),t[5]=d):d=t[5];let p;t[6]===u?p=t[7]:(p=(0,q.jsx)(h,{render:u,children:d}),t[6]=u,t[7]=p);let m;t[8]!==o||t[9]!==r||t[10]!==i||t[11]!==n?(m=o?(0,q.jsx)(b,{disabled:r,onClick:()=>i(n),children:`Reset to default`}):null,t[8]=o,t[9]=r,t[10]=i,t[11]=n,t[12]=m):m=t[12];let y;t[13]!==s||t[14]!==r||t[15]!==a||t[16]!==n?(y=s?(0,q.jsx)(b,{variant:`destructive`,disabled:r,onClick:()=>a(n),children:`Remove`}):null,t[13]=s,t[14]=r,t[15]=a,t[16]=n,t[17]=y):y=t[17];let x;t[18]!==m||t[19]!==y?(x=(0,q.jsxs)(v,{align:`end`,children:[m,y]}),t[18]=m,t[19]=y,t[20]=x):x=t[20];let S;return t[21]!==p||t[22]!==x?(S=(0,q.jsxs)(f,{children:[p,x]}),t[21]=p,t[22]=x,t[23]=S):S=t[23],S}function Xe(e){let t=(0,G.c)(2),{source:n}=e;if(n===`Default`)return null;let r;return t[0]===n?r=t[1]:(r=(0,q.jsx)(d,{variant:`outline`,size:`sm`,children:n}),t[0]=n,t[1]=r),r}function $(e){let t=(0,G.c)(13),{row:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,q.jsx)(`span`,{className:`flex items-center gap-2`}),t[0]=r):r=t[0];let i;t[1]===n.command?i=t[2]:(i=H(n.command),t[1]=n.command,t[2]=i);let a;t[3]===n.source?a=t[4]:(a=(0,q.jsx)(Xe,{source:n.source}),t[3]=n.source,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,q.jsxs)(R,{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,q.jsx)(z,{side:`top`,children:n.command}),t[8]=n.command,t[9]=s);let c;return t[10]!==o||t[11]!==s?(c=(0,q.jsxs)(B,{children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Ze(e){let t=(0,G.c)(13),{row:n,editor:r,variables:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,q.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=H(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,q.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[a,(0,q.jsx)(Je,{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 Qe(e){let t=(0,G.c)(2),n;return t[0]===e?n=t[1]:(n=(0,q.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,q.jsx)(Ye,{...e})}),t[0]=e,t[1]=n),n}function $e(e){let t=(0,G.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=Q(u),f;t[4]===n?f=t[5]:(f=(0,q.jsx)($,{row:n}),t[4]=n,t[5]=f);let p;t[6]!==d||t[7]!==n||t[8]!==o?(p=(0,q.jsx)(Ze,{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,q.jsx)(ze,{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,q.jsx)(Qe,{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,q.jsx)(qe,{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,q.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,q.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 et(e){let t=(0,G.c)(30),{allRows:n,onSave:r}=e,[i,a]=(0,K.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,K.useReducer)(Z,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?H(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`){e.stopPropagation(),c({keyDraft:``,isRecording:!1}),e.currentTarget.blur();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 tt(e){let t=(0,G.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,q.jsx)(D,{placeholder:`Command`}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,q.jsx)(k,{size:`sm`,className:i,children:s}),t[3]=i,t[4]=c);let l;t[5]===r?l=t[6]:(l=r.map(nt),t[5]=r,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,q.jsx)(O,{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,q.jsxs)(A,{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 nt(e){return(0,q.jsx)(E,{value:e,className:`w-full`,children:(0,q.jsx)(`span`,{className:`truncate`,children:H(e)})},e)}function rt(e){let t=(0,G.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,q.jsx)(ne,{"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 it(e){let t=(0,G.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,q.jsx)(Je,{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 at(e){let t=(0,G.c)(9),{isSaving:n,onCancel:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,q.jsx)(_,{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,q.jsx)(p,{className:`size-3.5`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,q.jsx)(R,{render:i,children:a}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,q.jsx)(z,{side:`top`,children:`Cancel`}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,q.jsxs)(B,{children:[o,s]}),t[7]=o,t[8]=c),c}function ot(e){let t=(0,G.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=et(c),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,q.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,q.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[u,(0,q.jsx)(it,{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,q.jsx)(tt,{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,q.jsx)(ze,{labels:l.conflictLabels}),t[10]=l.conflictLabels,t[11]=p);let m;t[12]===l?m=t[13]:(m=(0,q.jsx)(rt,{draft:l,className:`w-44`}),t[12]=l,t[13]=m);let h=a||!l.canSave,g=a?`Saving`:`Save`,v;t[14]!==l.save||t[15]!==h||t[16]!==g?(v=(0,q.jsx)(_,{size:`sm`,disabled:h,onClick:l.save,children:g}),t[14]=l.save,t[15]=h,t[16]=g,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==s?(y=(0,q.jsx)(at,{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,q.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,q.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 st(e){let{groups:t,anchorIds:n,savingCommand:r,...i}=e;return t.map(e=>(0,q.jsx)(he,{id:`keybindings-${e.id}`,title:e.title,children:e.rows.map(e=>(0,q.jsx)($e,{row:e,anchorId:n.get(e.id),isSaving:r===e.command,...i},e.id))},e.id))}function ct(){let e=(0,G.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,q.jsxs)(B,{children:[(0,q.jsx)(R,{delay:200,render:(0,q.jsx)(_,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":`The browser may claim some shortcuts first. The desktop app receives them all.`,children:(0,q.jsx)(l,{className:`size-3.5 text-warning`})})}),(0,q.jsx)(z,{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 lt(){let e=(0,G.c)(83),{environment:t,connectedEnvironments:n}=fe(),r=P(t?.environmentId??null,S),i=ee(n,C),a;e[0]!==n||e[1]!==i?(a=n.length>0&&n.every(e=>i.has(e.environmentId)),e[0]=n,e[1]=i,e[2]=a):a=e[2];let s=a,c=t?.serverConfig?.keybindings,l;e[3]===c?l=e[4]:(l=c??[],e[3]=c,e[4]=l);let d;e[5]===l?d=e[6]:(d=o(l),e[5]=l,e[6]=d);let f=d,p=t?.serverConfig?.keybindingsConfigPath??null,h;e[7]===t?.serverConfig?.availableEditors?h=e[8]:(h=t?.serverConfig?.availableEditors??[],e[7]=t?.serverConfig?.availableEditors,e[8]=h);let g=h,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(v={reportFailure:!1},e[9]=v):v=e[9];let y=I(N.upsertKeybinding,v),b;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},e[10]=b):b=e[10];let x=I(N.removeKeybinding,b),E=Oe(t?.environmentId??null,g),[D,O]=(0,K.useState)(``),k=(0,K.useRef)(null),[A,te]=(0,K.useState)(null),[ne,re]=(0,K.useState)(!1),ie;e[11]!==f||e[12]!==D?(ie=Ce(f,D),e[11]=f,e[12]=D,e[13]=ie):ie=e[13];let V=ie,ae;e[14]===V?ae=e[15]:(ae=Se(V),e[14]=V,e[15]=ae);let oe=ae,se;if(e[16]!==V){se=new Map;let t=new Set;for(let e of V)t.has(e.command)||(t.add(e.command),se.set(e.id,Ee(e.command)));e[16]=V,e[17]=se}else se=e[17];let ce=se,le;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(le={select:mt},e[18]=le):le=e[18];let ue=j(le),[pe,H]=(0,K.useState)(ue);ue!==pe&&(H(ue),ue.startsWith(`keybinding-`)&&O(``));let ge;e[19]===f?ge=e[20]:(ge=xe(f),e[19]=f,e[20]=ge);let _e=ge,ye;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(ye=ve(),e[21]=ye):ye=e[21];let be=ye,U;e[22]!==p||e[23]!==E||e[24]!==t?(U=()=>{p&&t&&F(t.environmentId,`orchestration:operate`)&&(async()=>{let e=await E(p);if(e._tag===`Success`||T(e))return;let t=w(e);M.add({title:`Unable to open keybindings file`,description:t instanceof Error?t.message:`The keybindings file was not opened.`,type:`error`})})()},e[22]=p,e[23]=E,e[24]=t,e[25]=U):U=e[25];let we=U,Te;e[26]!==n||e[27]!==t||e[28]!==y?(Te=e=>{if(!t||!n.every(pt))return;te(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=>y({environmentId:e.environmentId,input:r})));te(null);let t=e.find(ft);if(!t)re(!1);else if(!T(t)){let e=w(t);M.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]=y,e[29]=Te):Te=e[29];let W=Te,ke;e[30]!==n||e[31]!==t||e[32]!==x?(ke=e=>{t&&n.every(dt)&&(te(e.command),(async()=>{let t=await Promise.all(n.map(t=>x({environmentId:t.environmentId,input:Ke(e)})));te(null);let r=t.find(ut)??t[0];if(r?._tag===`Failure`&&!T(r)){let e=w(r);M.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]=x,e[33]=ke):ke=e[33];let Ae=ke,je;e[34]===W?je=e[35]:(je=e=>{e.defaultKey&&W({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]=W,e[35]=je);let Ne=je,J;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(J=()=>re(!1),e[36]=J):J=e[36];let Pe=J,Fe;e[37]!==Ae||e[38]!==Ne||e[39]!==V||e[40]!==W?(Fe={allRows:V,variables:be,onSave:W,onReset:Ne,onRemove:Ae},e[37]=Ae,e[38]=Ne,e[39]=V,e[40]=W,e[41]=Fe):Fe=e[41];let Ie=Fe,Y,Le;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Y=De(`keybindings`),Le=L?null:(0,q.jsx)(ct,{}),e[42]=Y,e[43]=Le):(Y=e[42],Le=e[43]);let X;e[44]===D?X=e[45]:(X=(0,q.jsx)(Me,{query:D,onChange:O,inputRef:k}),e[44]=D,e[45]=X);let Re=ne||!s,ze,Be;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>re(!0),Be=(0,q.jsx)(u,{"aria-hidden":!0,className:`size-4`}),e[46]=ze,e[47]=Be):(ze=e[46],Be=e[47]);let Ve;e[48]===Re?Ve=e[49]:(Ve=(0,q.jsxs)(_,{type:`button`,variant:`outline`,disabled:Re,onClick:ze,children:[Be,`Add keybinding`]}),e[48]=Re,e[49]=Ve);let He=!p||!r,Ue;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,q.jsx)(m,{"aria-hidden":!0,className:`size-4`}),e[50]=Ue):Ue=e[50];let We;e[51]!==we||e[52]!==He?(We=(0,q.jsx)(R,{render:(0,q.jsx)(_,{type:`button`,variant:`outline`,size:`icon`,disabled:He,onClick:we,"aria-label":`Open keybindings.json`,children:Ue})}),e[51]=we,e[52]=He,e[53]=We):We=e[53];let Ge;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,q.jsx)(z,{side:`top`,children:`Open keybindings.json`}),e[54]=Ge):Ge=e[54];let Z;e[55]===We?Z=e[56]:(Z=(0,q.jsxs)(B,{children:[We,Ge]}),e[55]=We,e[56]=Z);let Q;e[57]!==X||e[58]!==Ve||e[59]!==Z?(Q=(0,q.jsx)(he,{...Y,headerAction:Le,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[X,Ve,Z]})}),e[57]=X,e[58]=Ve,e[59]=Z,e[60]=Q):Q=e[60];let qe;e[61]!==s||e[62]!==n?(qe=s?null:(0,q.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]=qe):qe=e[63];let Je=!s,Ye;e[64]!==_e||e[65]!==ne||e[66]!==V||e[67]!==W||e[68]!==A?(Ye=ne?(0,q.jsx)(de,{children:(0,q.jsx)(ot,{commandOptions:_e,allRows:V,variables:be,isSaving:A!==null,onSave:W,onCancel:Pe})}):null,e[64]=_e,e[65]=ne,e[66]=V,e[67]=W,e[68]=A,e[69]=Ye):Ye=e[69];let Xe;e[70]!==ce||e[71]!==oe||e[72]!==Ie||e[73]!==A?(Xe=oe.length>0?(0,q.jsx)(st,{groups:oe,anchorIds:ce,savingCommand:A,...Ie}):(0,q.jsx)(de,{children:(0,q.jsx)(`div`,{className:`px-4 py-12 text-center text-sm text-muted-foreground`,children:`No keybindings match your search.`})}),e[70]=ce,e[71]=oe,e[72]=Ie,e[73]=A,e[74]=Xe):Xe=e[74];let $;e[75]!==Je||e[76]!==Ye||e[77]!==Xe?($=(0,q.jsxs)(`div`,{inert:Je,className:`flex flex-col gap-8`,children:[Ye,Xe]}),e[75]=Je,e[76]=Ye,e[77]=Xe,e[78]=$):$=e[78];let Ze;return e[79]!==Q||e[80]!==qe||e[81]!==$?(Ze=(0,q.jsxs)(me,{children:[Q,qe,$]}),e[79]=Q,e[80]=qe,e[81]=$,e[82]=Ze):Ze=e[82],Ze}function ut(e){return e._tag===`Failure`}function dt(e){return F(e.environmentId,C)}function ft(e){return e._tag===`Failure`}function pt(e){return F(e.environmentId,C)}function mt(e){return e.hash.replace(/^#/,``)}var ht=lt;export{ht as component};
2
+ //# sourceMappingURL=settings.keybindings-CwvrmKin.js.map