@p4code/cli 0.9.10 → 0.9.13

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 (342) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-CYcCQdSE.mjs → binCli-D22yxtxv.mjs} +10250 -6033
  3. package/dist/client/.vite/manifest.json +2084 -2031
  4. package/dist/client/assets/{2NI2N5EU-CTGx9SqE.js → 2NI2N5EU-DBKJSvEQ.js} +2 -2
  5. package/dist/client/assets/{4UO7MD6I-BjVL6foo.js → 4UO7MD6I-1JuY3zN7.js} +2 -2
  6. package/dist/client/assets/{5B3SVYGG-Cs9CtCwM.js → 5B3SVYGG-CwgmePuE.js} +2 -2
  7. package/dist/client/assets/{5GK6JWQ2-uCqJ5b6P.js → 5GK6JWQ2-D9VJsozU.js} +2 -2
  8. package/dist/client/assets/{5N7A7DKN-D8xYxzg8.js → 5N7A7DKN-CFgZoUw5.js} +2 -2
  9. package/dist/client/assets/{5OC2THR4-B4_z8HL_.js → 5OC2THR4-Cx6keXWX.js} +2 -2
  10. package/dist/client/assets/{5S6HY5KT-BQM1ruT_.js → 5S6HY5KT-Ce1reKKv.js} +2 -2
  11. package/dist/client/assets/{6IMQ5BUJ-CkYA1m9F.js → 6IMQ5BUJ-D7X0q9kf.js} +2 -2
  12. package/dist/client/assets/{6OLKWJ4F-B7EL2QRF.js → 6OLKWJ4F-YLfMA9aH.js} +2 -2
  13. package/dist/client/assets/{74OO7NKP-3i4AYzMo.js → 74OO7NKP-Wm5pZPTC.js} +2 -2
  14. package/dist/client/assets/{75O6YZUN-CFk80U2S.js → 75O6YZUN-D2He6_fp.js} +2 -2
  15. package/dist/client/assets/{77XECAW3-DUjtpBc8.js → 77XECAW3-CV_JLSeU.js} +2 -2
  16. package/dist/client/assets/{ABYRPUBD-BobiH6Ib.js → ABYRPUBD-D0xOVN1A.js} +2 -2
  17. package/dist/client/assets/AlertDialogRoot-DaczVYX9.js +2 -0
  18. package/dist/client/assets/{AnimatedHeight-Baj5Pa60.js → AnimatedHeight-yuTG4G03.js} +2 -2
  19. package/dist/client/assets/{AuthSurfaceShell-PCmsqp7T.js → AuthSurfaceShell-CCBOJP5G.js} +2 -2
  20. package/dist/client/assets/{BB2UYUI2-DnxMKjgT.js → BB2UYUI2-BdXGRPif.js} +2 -2
  21. package/dist/client/assets/{BUM34MOA-DNTynUxx.js → BUM34MOA-isqGnSvm.js} +2 -2
  22. package/dist/client/assets/{CEQABKGZ-veHxvA1u.js → CEQABKGZ-DE0PWXRq.js} +2 -2
  23. package/dist/client/assets/{CXAC5362-BynYY6uD.js → CXAC5362-0Zr5tv4C.js} +2 -2
  24. package/dist/client/assets/{ChatGptUsageButton-D-N8-zk6.js → ChatGptUsageButton-w6RkBCUH.js} +2 -2
  25. package/dist/client/assets/{ChatMarkdown-fdsQ0rQe.js → ChatMarkdown-CFUfXlYp.js} +31 -31
  26. package/dist/client/assets/CheckboxIndicator-lkbFKbE7.js +2 -0
  27. package/dist/client/assets/{ClippedText-Bz4usJaN.js → ClippedText-Bf8FSQkX.js} +2 -2
  28. package/dist/client/assets/CodexSetupSection.logic-SHExnMKR.js +2 -0
  29. package/dist/client/assets/ComboboxClear-B0HJXjbz.js +2 -0
  30. package/dist/client/assets/{ComboboxGroupLabel-B9uepPCe.js → ComboboxGroupLabel-CMc5xUrd.js} +2 -2
  31. package/dist/client/assets/{CommandBlock-BFdf6yDf.js → CommandBlock-CluJmhVo.js} +2 -2
  32. package/dist/client/assets/{ComposerPromptEditor--x6yGPiW.js → ComposerPromptEditor-DR1WsmjD.js} +60 -60
  33. package/dist/client/assets/CompositeRoot-BMHKb-nN.js +2 -0
  34. package/dist/client/assets/{connect-agent-BJCTM1nf.js → ConnectAgentSurface-CNWdh9ck.js} +2 -2
  35. package/dist/client/assets/{ConnectionStatusDot-CpPwqzkK.js → ConnectionStatusDot-CpmZ8NE5.js} +2 -2
  36. package/dist/client/assets/{DRLTVNUE-BOhroau_.js → DRLTVNUE-Dttc5MrD.js} +2 -2
  37. package/dist/client/assets/{DYY6UVD2-Bpmvecid.js → DYY6UVD2-DTrZAR1D.js} +2 -2
  38. package/dist/client/assets/DevicePanel-CRFuAv_j.js +2 -0
  39. package/dist/client/assets/{DeviceSetup-CJ3rjcDw.js → DeviceSetup-DRzepax4.js} +2 -2
  40. package/dist/client/assets/DialogTitle-pLX9Mw1n.js +2 -0
  41. package/dist/client/assets/{DiffCommentAnnotation-BkAROMry.js → DiffCommentAnnotation-6V9nI3Cm.js} +3 -3
  42. package/dist/client/assets/{DiffFileTree-ERgpSLaE.js → DiffFileTree-CBEjDul5.js} +2 -2
  43. package/dist/client/assets/DiffPanel-CM5Rvb_z.js +2 -0
  44. package/dist/client/assets/{DiffWorkerPoolProvider-BrhQktrm.js → DiffWorkerPoolProvider-f4-YQsHo.js} +2 -2
  45. package/dist/client/assets/{EmbeddedDesign-DpSkJYii.js → EmbeddedDesign-DSEjf0KK.js} +5 -5
  46. package/dist/client/assets/{EnvironmentMachineIcon-BrGxJPP_.js → EnvironmentMachineIcon-B6wAZat7.js} +2 -2
  47. package/dist/client/assets/{ExpandableText-auxbX5_6.js → ExpandableText-Cjat32hh.js} +2 -2
  48. package/dist/client/assets/{FNOVOB4O-Mdzaj7g-.js → FNOVOB4O-LisHSqAM.js} +2 -2
  49. package/dist/client/assets/FieldControl-DwBVFJAI.js +2 -0
  50. package/dist/client/assets/{FileDiff-sbzjIw4Y.js → FileDiff-Bj9kBLN2.js} +2 -2
  51. package/dist/client/assets/FilePreviewPanel-z6NirC2y.js +34 -0
  52. package/dist/client/assets/{FoldedSettingsSection-DN1s3P5h.js → FoldedSettingsSection-DIlgxayr.js} +2 -2
  53. package/dist/client/assets/FormContext-DcnLkh-4.js +2 -0
  54. package/dist/client/assets/{HDGCDEEZ-Ylftf3gZ.js → HDGCDEEZ-Bn1jLSys.js} +2 -2
  55. package/dist/client/assets/{HSJLKHB7-BQqIHFzA.js → HSJLKHB7-CHpiqxlA.js} +2 -2
  56. package/dist/client/assets/{Icons-BP6jlahF.js → Icons-Be1TL1sN.js} +2 -2
  57. package/dist/client/assets/Input-BZ1XdBC0.js +2 -0
  58. package/dist/client/assets/JZOYTAAL-BZEjBuKj.js +1 -0
  59. package/dist/client/assets/{K3MD6TGW-C-WMFQa2.js → K3MD6TGW-D5oCFPkP.js} +2 -2
  60. package/dist/client/assets/{K7RP3OMA-Bv01V4PC.js → K7RP3OMA-ZIPW--CU.js} +2 -2
  61. package/dist/client/assets/{KeybindingsSettings.logic-CkmobJKX.js → KeybindingsSettings.logic-Ctmq4InP.js} +2 -2
  62. package/dist/client/assets/{LHDIQX7Q-NSQFT8t0.js → LHDIQX7Q-BkDTNH4X.js} +2 -2
  63. package/dist/client/assets/{LUXOKEGN-URYU7c_t.js → LUXOKEGN-BMFFLlMk.js} +2 -2
  64. package/dist/client/assets/LinkMachineSelect-DGm4EDKi.js +2 -0
  65. package/dist/client/assets/{MathTypeset-vloBebae.js → MathTypeset-DpXMOBGY.js} +2 -2
  66. package/dist/client/assets/{N3JZAHOW-B9_qgeJe.js → N3JZAHOW-CV9TIlCo.js} +2 -2
  67. package/dist/client/assets/{NUIALGQ3-CgK-ZGa2.js → NUIALGQ3-WBqakHka.js} +2 -2
  68. package/dist/client/assets/{NoProjectsHero-Bkfsk4qc.js → NoProjectsHero-BfU7AxbB.js} +2 -2
  69. package/dist/client/assets/{O65XPQGZ-DcczmOOs.js → O65XPQGZ-CYhr2tYZ.js} +2 -2
  70. package/dist/client/assets/{O7XIQ6OM-DBN8Ta1r.js → O7XIQ6OM-D2JMbFqc.js} +2 -2
  71. package/dist/client/assets/{OFQON5FD-BAqD2M9W.js → OFQON5FD-B1aTfx9o.js} +2 -2
  72. package/dist/client/assets/{P4ConnectAccountPages-kTztZndM.js → P4ConnectAccountPages-J205rNHS.js} +2 -2
  73. package/dist/client/assets/P4ConnectSidebarSignIn-Bc4xlsJh.js +2 -0
  74. package/dist/client/assets/{PJQHF43J-D1TwOPBO.js → PJQHF43J-Dm3RMjWi.js} +2 -2
  75. package/dist/client/assets/PanelLayoutControls-BQZYES2T.js +216 -0
  76. package/dist/client/assets/{PierreEntryIcon-CcaKUQ_5.js → PierreEntryIcon-CHy821MU.js} +2 -2
  77. package/dist/client/assets/PopoverHandle-BkzqaTB6.js +2 -0
  78. package/dist/client/assets/PreviewPanel-D8V2zDl4.js +2 -0
  79. package/dist/client/assets/ProjectDefaultsSettings-6UkudkKP.js +2 -0
  80. package/dist/client/assets/ProjectFavicon-LcyFYpHB.js +3 -0
  81. package/dist/client/assets/{ProjectIconPickerDialog-DrNrdWag.js → ProjectIconPickerDialog-D03-Jrsi.js} +2 -2
  82. package/dist/client/assets/{ProjectMonogram-BJooqIM-.js → ProjectMonogram-C8FlNLaU.js} +2 -2
  83. package/dist/client/assets/{ProviderAuthTerminal-BdestvKT.js → ProviderAuthTerminal-DMTbKboR.js} +2 -2
  84. package/dist/client/assets/ProviderModelPicker-CpWE-Lfx.js +2 -0
  85. package/dist/client/assets/{ProviderSettingsForm-B1ZiIcrJ.js → ProviderSettingsForm-DrCFln8c.js} +2 -2
  86. package/dist/client/assets/PullRequestCodeTab-CjBrGNWY.js +6 -0
  87. package/dist/client/assets/{RHNBAITX-AZ9q_QDP.js → RHNBAITX-C7mnxleL.js} +2 -2
  88. package/dist/client/assets/{ReadOnlySourcePreview-CSK6ee05.js → ReadOnlySourcePreview-BasbTHVd.js} +2 -2
  89. package/dist/client/assets/RedactedSensitiveText-DACYfm7e.js +2 -0
  90. package/dist/client/assets/{RenderErrorBoundary-ImTUJEbS.js → RenderErrorBoundary-CIVNp8r9.js} +4 -4
  91. package/dist/client/assets/{SLD4V6NK-uXoZZAB2.js → SLD4V6NK-BkeVs7gb.js} +2 -2
  92. package/dist/client/assets/ScheduledTasksSettings-DpYigye5.js +4 -0
  93. package/dist/client/assets/{ScopedSwitch-IyBzdLBa.js → ScopedSwitch-D1uscoF8.js} +2 -2
  94. package/dist/client/assets/{ScrollAreaCorner-Bstf_gNQ.js → ScrollAreaCorner-DBtks1xb.js} +2 -2
  95. package/dist/client/assets/{SecretInput-BTBcl8SC.js → SecretInput-ZW3hnCoN.js} +2 -2
  96. package/dist/client/assets/SelectScrollUpArrow-Bq-GYRhT.js +2 -0
  97. package/dist/client/assets/SelfImproveSettingsSection-CDIhJO4P.js +2 -0
  98. package/dist/client/assets/SettingsPanels-Co5mks6X.js +46 -0
  99. package/dist/client/assets/SettingsPanels.logic-H5v8FTnu.js +2 -0
  100. package/dist/client/assets/{SettingsScopeNotice-BSIkX2D-.js → SettingsScopeNotice-gFtgpybO.js} +2 -2
  101. package/dist/client/assets/{SidebarStageBackdrop-D7me9VdP.js → SidebarStageBackdrop-DSuAw8Ob.js} +2 -2
  102. package/dist/client/assets/{T3PCR2KE-B4buGw24.js → T3PCR2KE-D6MHoseG.js} +2 -2
  103. package/dist/client/assets/{TKWO2OVW-B2GIBRnj.js → TKWO2OVW-gZK7dLQZ.js} +2 -2
  104. package/dist/client/assets/{TSHNXIZL-CwVvoBmu.js → TSHNXIZL-BKUmF3Cu.js} +2 -2
  105. package/dist/client/assets/{ThemeEditorPanel-Z1t7Xzva.js → ThemeEditorPanel-lI_9CbBH.js} +3 -3
  106. package/dist/client/assets/ThreadTerminalDrawer-CD3plt2C.js +5 -0
  107. package/dist/client/assets/TooltipViewport-Be_gbUW1.js +2 -0
  108. package/dist/client/assets/{UQJE5E4I-Bzqu0vVG.js → UQJE5E4I-D6av033t.js} +2 -2
  109. package/dist/client/assets/{USNYFO5S-C4Z9b1ks.js → USNYFO5S-Cy6sDMEU.js} +2 -2
  110. package/dist/client/assets/{Virtualizer-saguDIDi.js → Virtualizer-B_IsUzcr.js} +2 -2
  111. package/dist/client/assets/{WEVWDWVA-C5c2236d.js → WEVWDWVA-Cq1fZcng.js} +2 -2
  112. package/dist/client/assets/{WorkspaceBreadcrumb-CQH9TmFi.js → WorkspaceBreadcrumb-DbQW7iNE.js} +2 -2
  113. package/dist/client/assets/{WorkspacePageContainer-E5ZuTsSl.js → WorkspacePageContainer-BxI-x0oV.js} +2 -2
  114. package/dist/client/assets/{WorkspacePageHeader-DGopnQZ2.js → WorkspacePageHeader-Bc_F6Uog.js} +2 -2
  115. package/dist/client/assets/{X5RFHQXM-NygNPjev.js → X5RFHQXM-DdtKPA-W.js} +2 -2
  116. package/dist/client/assets/{X62E3GBT-qvvfx8FL.js → X62E3GBT-C7OjB5pB.js} +2 -2
  117. package/dist/client/assets/{XBNEOJTC-DAgGRRGR.js → XBNEOJTC-_Tbl2Kwh.js} +2 -2
  118. package/dist/client/assets/{YHV2MVVZ-PIsz4H0c.js → YHV2MVVZ-CA4YS5f4.js} +2 -2
  119. package/dist/client/assets/{YURCZMG2-CAQz8Kb8.js → YURCZMG2-DSnhUUsH.js} +2 -2
  120. package/dist/client/assets/{YVG2LODB-Crh6Gk8v.js → YVG2LODB-D-qFsH5t.js} +2 -2
  121. package/dist/client/assets/_chat-Cnc6rxt6.js +47 -0
  122. package/dist/client/assets/_chat.design-SX7SShjI.js +2 -0
  123. package/dist/client/assets/{_chat.index-ij31rX59.js → _chat.index-Bz1lJLpv.js} +2 -2
  124. package/dist/client/assets/_chat.new-BEqc5oJc.js +4 -0
  125. package/dist/client/assets/_chat.pull-requests-A3IwVYWs.js +2 -0
  126. package/dist/client/assets/{alert-CqueYfb9.js → alert-BOVMKHDy.js} +2 -2
  127. package/dist/client/assets/alert-dialog-Du3fYY3I.js +2 -0
  128. package/dist/client/assets/{assetUrls-5u2VAW_2.js → assetUrls-CYjvy6P4.js} +2 -2
  129. package/dist/client/assets/assets-JgE2I_Ix.js +2 -0
  130. package/dist/client/assets/browserHistoryStore-CdncPjG8.js +2 -0
  131. package/dist/client/assets/{browserLinkTarget-CUvZuS7D.js → browserLinkTarget-Bf9H9UVe.js} +2 -2
  132. package/dist/client/assets/{checkbox-BPr09F_k.js → checkbox-d50pgAVe.js} +2 -2
  133. package/dist/client/assets/circle-stop-0Wd2uKSK.js +2 -0
  134. package/dist/client/assets/{color-picker-roKqOkuS.js → color-picker-zcQshxaE.js} +2 -2
  135. package/dist/client/assets/{combobox-CEzOq8mg.js → combobox-BrCd1kH5.js} +2 -2
  136. package/dist/client/assets/{command-i_eKJj3B.js → command-DFkhX6wm.js} +2 -2
  137. package/dist/client/assets/{connect-wndN2LD9.js → connect-DkH09d_M.js} +2 -2
  138. package/dist/client/assets/connect-agent-DJHm1Ubj.js +2 -0
  139. package/dist/client/assets/{design-Cve-RO6N.js → design-DrpehYJf.js} +2 -2
  140. package/dist/client/assets/device-Nh7DArH7.js +2 -0
  141. package/dist/client/assets/{dialog-CKG1aUT3.js → dialog-BpR3dRVS.js} +2 -2
  142. package/dist/client/assets/{diffRendering-Dyda4rX5.js → diffRendering-BuOJdnZ8.js} +2 -2
  143. package/dist/client/assets/{dist-DP18jjts.js → dist-CMJL98Oz.js} +3 -3
  144. package/dist/client/assets/{draft-input-DvNQZghL.js → draft-input-CzfhM72Z.js} +2 -2
  145. package/dist/client/assets/{duoViewer-BnfAzuzK.js → duoViewer-ChrCWcjO.js} +2 -2
  146. package/dist/client/assets/dynamic-CVt07u2H.js +3 -0
  147. package/dist/client/assets/{embeddedScripts-BMILAsdP.js → embeddedScripts-BWqMWwOU.js} +2 -2
  148. package/dist/client/assets/{empty-D6SdnsPw.js → empty-Cy-8us9l.js} +2 -2
  149. package/dist/client/assets/entities-aKdRyfsJ.js +2 -0
  150. package/dist/client/assets/{fileLinks-BlBUc4i_.js → fileLinks-BgHa8yE4.js} +2 -2
  151. package/dist/client/assets/{fileTreeExpansion-B8yevc-B.js → fileTreeExpansion-CBn1SzSX.js} +2 -2
  152. package/dist/client/assets/{getDiffFileInput-dJd1H35Q.js → getDiffFileInput-IQ1TDM4E.js} +2 -2
  153. package/dist/client/assets/{guideRunStore-DksWd_Oc.js → guideRunStore-DfNfJUIu.js} +2 -2
  154. package/dist/client/assets/{htmlRender-hlYiIm7u.js → htmlRender-lwQ3HyqS.js} +2 -2
  155. package/dist/client/assets/index-BXvrSYK3.js +3 -0
  156. package/dist/client/assets/{input-yNgBXsRj.js → input-FUjAUGXY.js} +2 -2
  157. package/dist/client/assets/{input-group-APyqVexM.js → input-group-BdZ_CKvG.js} +2 -2
  158. package/dist/client/assets/{kbd-Cr4XEhSh.js → kbd-CGgmav-Q.js} +2 -2
  159. package/dist/client/assets/{keybindings-hzk4_Sgu.js → keybindings-DuCyi9aT.js} +2 -2
  160. package/dist/client/assets/{lazy-DILJj7Gd.js → lazy-Bs2SFpYS.js} +4 -4
  161. package/dist/client/assets/{lazyRouteComponent-tnhWsSYX.js → lazyRouteComponent-CYNRqeNP.js} +2 -2
  162. package/dist/client/assets/{link-CmpZDWcG.js → link-DW1IQk5s.js} +2 -2
  163. package/dist/client/assets/{linkedPrompt-CE3amDef.js → linkedPrompt-yo2xi4Z8.js} +2 -2
  164. package/dist/client/assets/main-BD4pReCY.css +2 -0
  165. package/dist/client/assets/main-C0z861OK.js +37 -0
  166. package/dist/client/assets/mediaReference-BQ9J-tjl.js +2 -0
  167. package/dist/client/assets/mediaSource-BLpxwEw3.js +2 -0
  168. package/dist/client/assets/number-field-Pve745k3.js +2 -0
  169. package/dist/client/assets/{observeResize-DjqKtKLK.js → observeResize-CZuDzlcZ.js} +2 -2
  170. package/dist/client/assets/{onboarding-pqbI8W1U.js → onboarding-CE8pzS12.js} +2 -2
  171. package/dist/client/assets/openFileInPreview-Dns9tPaB.js +2 -0
  172. package/dist/client/assets/{p4ProjectFile-xLwkLebE.js → p4ProjectFile-jwYvYDE-.js} +2 -2
  173. package/dist/client/assets/{pair-C4lVdDUz.js → pair-OPslYcM9.js} +2 -2
  174. package/dist/client/assets/{pendingSendStore-BoFRcmy5.js → pendingSendStore-CLwMM17y.js} +2 -2
  175. package/dist/client/assets/{phoneViewer-Cotavx5y.js → phoneViewer-CkTxyA9N.js} +2 -2
  176. package/dist/client/assets/{pierre-icons-CBskVugi.js → pierre-icons-DY8ZeGCr.js} +2 -2
  177. package/dist/client/assets/{popover-DVeZET9D.js → popover-hYAmvSJj.js} +2 -2
  178. package/dist/client/assets/{preview-Bw-Ffmn4.js → preview-CI9HEdfV.js} +2 -2
  179. package/dist/client/assets/{preview-oweHYD4S.js → preview-YhZE3kRt.js} +2 -2
  180. package/dist/client/assets/{previewMiniPlayerStore-DrP4x3Ce.js → previewMiniPlayerStore-DUPe1gGI.js} +2 -2
  181. package/dist/client/assets/primary-BlS2rEKe.js +2 -0
  182. package/dist/client/assets/primaryCloudLinkState-CyPf4N0F.js +2 -0
  183. package/dist/client/assets/projectFilesQueryState-BdWJ4WwI.js +2 -0
  184. package/dist/client/assets/projectScriptEditor-C0FBhCbn.js +2 -0
  185. package/dist/client/assets/{providerSkills-DTVLY34_.js → providerSkills-Ca_7EbAx.js} +2 -2
  186. package/dist/client/assets/{pullRequestDetail.logic-BLe7zsLi.js → pullRequestDetail.logic-DYx7bEwE.js} +4 -4
  187. package/dist/client/assets/{pullRequestIcons-DyEIFm1n.js → pullRequestIcons-csprKuju.js} +2 -2
  188. package/dist/client/assets/{pullRequestReviewStore-B55CEHY9.js → pullRequestReviewStore-_uEYgfaW.js} +2 -2
  189. package/dist/client/assets/pullRequests-B85p5Xnw.js +2 -0
  190. package/dist/client/assets/queries-B0FvRKmk.js +2 -0
  191. package/dist/client/assets/query-B2_Td0ad.js +2 -0
  192. package/dist/client/assets/radio-group-IyWHDcIP.js +2 -0
  193. package/dist/client/assets/{renderScheduler-CNepEPa2.js → renderScheduler-DR2WAtIH.js} +2 -2
  194. package/dist/client/assets/{rightPanelStore-CRQRe1Cp.js → rightPanelStore-rZSIb-5z.js} +2 -2
  195. package/dist/client/assets/runtime-BK2Lh1vB.js +3 -0
  196. package/dist/client/assets/runtime-BVmDVuJ-.js +6 -0
  197. package/dist/client/assets/{runtimeModeConfig-BAFMgMrE.js → runtimeModeConfig-DFxXOIlV.js} +2 -2
  198. package/dist/client/assets/{scheduledTasksSettings.logic-CTJ1Zr8Z.js → scheduledTasksSettings.logic-W9AQpJk4.js} +3 -3
  199. package/dist/client/assets/{scroll-area-DTOm0CbX.js → scroll-area-Cf7uLi_s.js} +2 -2
  200. package/dist/client/assets/{select-CML8G0wN.js → select-vBkqTMKL.js} +2 -2
  201. package/dist/client/assets/selfImproveFindings-4GGN9cRm.js +2 -0
  202. package/dist/client/assets/server-DwkxciXh.js +2 -0
  203. package/dist/client/assets/session-BIwsf8Q4.js +2 -0
  204. package/dist/client/assets/session-logic-D8FbVFDm.js +26 -0
  205. package/dist/client/assets/{settings-CTpjG14a.js → settings-C58Y7hMl.js} +2 -2
  206. package/dist/client/assets/{settings.appearance-Cq56uRT4.js → settings.appearance-C9ZmuG-n.js} +2 -2
  207. package/dist/client/assets/settings.archived-BxqS4kuW.js +2 -0
  208. package/dist/client/assets/{settings.computer-use-J2r1Wt55.js → settings.computer-use-CeIs-8zf.js} +2 -2
  209. package/dist/client/assets/settings.connections-CEr4PdrJ.js +2 -0
  210. package/dist/client/assets/{settings.data-controls-Kotba8vC.js → settings.data-controls-BbzJxjBi.js} +2 -2
  211. package/dist/client/assets/{settings.decisions-DghPRQ02.js → settings.decisions-DagsCV4K.js} +2 -2
  212. package/dist/client/assets/{settings.designs-D-0dwYo4.js → settings.designs-DEThhuEj.js} +2 -2
  213. package/dist/client/assets/settings.diagnostics-DdsecwWn.js +2 -0
  214. package/dist/client/assets/{settings.general-c-32Nudd.js → settings.general-RgU1jNmB.js} +2 -2
  215. package/dist/client/assets/settings.integrations-CO-aLXSC.js +2 -0
  216. package/dist/client/assets/{settings.keybindings-BIfUzprR.js → settings.keybindings-CU8fBQaI.js} +2 -2
  217. package/dist/client/assets/{settings.open-source-licenses-wmlqchzJ.js → settings.open-source-licenses-rG8Neftl.js} +2 -2
  218. package/dist/client/assets/{settings.plugins-C1PnlzX1.js → settings.plugins-Dr0VpcPy.js} +4 -4
  219. package/dist/client/assets/settings.projects-hxwk8_7r.js +4 -0
  220. package/dist/client/assets/settings.providers-D5-Kj1jY.js +3 -0
  221. package/dist/client/assets/{settings.scheduled-tasks-BGGcs-KK.js → settings.scheduled-tasks-DwUd14Xj.js} +2 -2
  222. package/dist/client/assets/settings.snap-shot-CTMJRtJe.js +2 -0
  223. package/dist/client/assets/settings.source-control-BHD5KE8W.js +2 -0
  224. package/dist/client/assets/{settings.storage-CxA7PNjV.js → settings.storage-Bhd9ragP.js} +2 -2
  225. package/dist/client/assets/settingsLayout-WhjsCfB6.js +3 -0
  226. package/dist/client/assets/{sidebar-DMJE0zUg.js → sidebar-O52WtiJv.js} +2 -2
  227. package/dist/client/assets/{sidebarProjectGrouping-CPb438r8.js → sidebarProjectGrouping-BYVdJp_w.js} +2 -2
  228. package/dist/client/assets/{skeleton-eiJFH0l9.js → skeleton-PlPtYr_f.js} +2 -2
  229. package/dist/client/assets/{sourceControl-DzD_N8hv.js → sourceControl-BkJeQRrv.js} +2 -2
  230. package/dist/client/assets/{sourceControlClients-BG_kFh61.js → sourceControlClients-CtMx7u86.js} +2 -2
  231. package/dist/client/assets/{spinner-H4tz4lLc.js → spinner-BZ5ohCyO.js} +2 -2
  232. package/dist/client/assets/{terminal-links-D7Hzce_h.js → terminal-links-UI2UJn0y.js} +2 -2
  233. package/dist/client/assets/terminalSessions-C1xOLG3i.js +2 -0
  234. package/dist/client/assets/{textarea-CkmpNgx5.js → textarea-DIg__-Gi.js} +2 -2
  235. package/dist/client/assets/{themePalette-pZ7Ys_kT.js → themePalette-BMlBfFUx.js} +3 -3
  236. package/dist/client/assets/toast-BZ96uuab.js +2 -0
  237. package/dist/client/assets/{toggle-BDixfqRe.js → toggle-DJ8KOwn5.js} +2 -2
  238. package/dist/client/assets/{toggle-group-DV__8G6T.js → toggle-group-2e3XGJdx.js} +2 -2
  239. package/dist/client/assets/{tooltip-DsRaXpYk.js → tooltip-BPiLl1TV.js} +2 -2
  240. package/dist/client/assets/{uiStateStore-DKTSAGd0.js → uiStateStore-4i21PZUL.js} +2 -2
  241. package/dist/client/assets/usage-uuNPbJve.js +2 -0
  242. package/dist/client/assets/{usageAccess-BXUmTDe1.js → usageAccess-CsMv6eC9.js} +2 -2
  243. package/dist/client/assets/{usageFormat-xrTYBhxI.js → usageFormat-DhefL58S.js} +2 -2
  244. package/dist/client/assets/{usageShortcuts-CQcKqXkw.js → usageShortcuts-CREc0FBr.js} +2 -2
  245. package/dist/client/assets/{use-atom-command-BETKz9Hv.js → use-atom-command-CdV5BZYB.js} +2 -2
  246. package/dist/client/assets/{useAriaLabelledBy-DVTboZ71.js → useAriaLabelledBy-CYRfRdAq.js} +2 -2
  247. package/dist/client/assets/useHandleNewThread-BsnMrEPr.js +2 -0
  248. package/dist/client/assets/{useLocation--dLSTvwv.js → useLocation-DHd-KBb-.js} +2 -2
  249. package/dist/client/assets/{useNavigate-DAhzXpNZ.js → useNavigate-AZUCIeU4.js} +2 -2
  250. package/dist/client/assets/{useNavigateBack-ClmMPFha.js → useNavigateBack-C7DkQuEE.js} +2 -2
  251. package/dist/client/assets/{useP4ConnectAuthPrompt-BXoWBt0U.js → useP4ConnectAuthPrompt-u1GHgwlc.js} +2 -2
  252. package/dist/client/assets/{useParams-D_0yPfYl.js → useParams-rbhXoEw9.js} +2 -2
  253. package/dist/client/assets/{usePermissionStatus-BGxDZxHH.js → usePermissionStatus-DHzE_VGG.js} +2 -2
  254. package/dist/client/assets/{usePullRequestActions-D0-24Gox.js → usePullRequestActions-Cv12eqOn.js} +3 -3
  255. package/dist/client/assets/{useRegisterFieldControl-DnspXZl4.js → useRegisterFieldControl-D4FG4i3_.js} +2 -2
  256. package/dist/client/assets/{useScopedModelAvailability-C44gQf2k.js → useScopedModelAvailability-D6cbxQLl.js} +2 -2
  257. package/dist/client/assets/useSettings-B09a3zie.js +3 -0
  258. package/dist/client/assets/utils-C5GGWTfe.js +37 -0
  259. package/dist/client/assets/vcsRefInvalidation-B66hRx4g.js +2 -0
  260. package/dist/client/assets/welcome-D2-tjFV3.js +2 -0
  261. package/dist/client/index.html +1 -1
  262. package/dist/client/third-party-licenses.json +1 -1
  263. package/dist/{renderer-DNRW9Bfa.mjs → renderer-CuqsXHrO.mjs} +2 -2
  264. package/dist/{runtime-KPwu-Er9.mjs → runtime-CWPUW_8Y.mjs} +547 -60
  265. package/package.json +4 -3
  266. package/dist/client/assets/AlertDialogRoot-BDlDnUeW.js +0 -2
  267. package/dist/client/assets/CheckboxIndicator-CvUY7aCo.js +0 -2
  268. package/dist/client/assets/CodexSetupSection.logic-lS_hYW7M.js +0 -2
  269. package/dist/client/assets/ComboboxClear-BWxvz8Y9.js +0 -2
  270. package/dist/client/assets/CompositeRoot-XnJ7Nzli.js +0 -2
  271. package/dist/client/assets/ConnectionDiagnosisDetails-BiLziJiH.js +0 -2
  272. package/dist/client/assets/DevicePanel-BgToYlYg.js +0 -2
  273. package/dist/client/assets/DialogTitle-DdTujj5B.js +0 -2
  274. package/dist/client/assets/DiffPanel-DwPk2swZ.js +0 -2
  275. package/dist/client/assets/FieldControl-DfaF5AW8.js +0 -2
  276. package/dist/client/assets/FilePreviewPanel-BOnzRmKq.js +0 -34
  277. package/dist/client/assets/FormContext-B_ZMFN7l.js +0 -2
  278. package/dist/client/assets/Input-B9nob0l2.js +0 -2
  279. package/dist/client/assets/JZOYTAAL-5fSSCfug.js +0 -1
  280. package/dist/client/assets/P4ConnectSidebarSignIn-BLFNWeXr.js +0 -2
  281. package/dist/client/assets/PanelLayoutControls-BL3qZRW6.js +0 -216
  282. package/dist/client/assets/PopoverHandle-Bf0PlJ6j.js +0 -2
  283. package/dist/client/assets/PreviewPanel-CF9KdCOZ.js +0 -2
  284. package/dist/client/assets/ProjectDefaultsSettings-DC9sqe1A.js +0 -2
  285. package/dist/client/assets/ProjectFavicon-6uv-3a7b.js +0 -3
  286. package/dist/client/assets/ProviderModelPicker-Dx26TqdI.js +0 -2
  287. package/dist/client/assets/PullRequestCodeTab-5JEE8HsL.js +0 -6
  288. package/dist/client/assets/ScheduledTasksSettings-BDkh7pCI.js +0 -4
  289. package/dist/client/assets/SelectScrollUpArrow-BAwxXUi-.js +0 -2
  290. package/dist/client/assets/SelfImproveSettingsSection-DGcoA36F.js +0 -2
  291. package/dist/client/assets/SettingsPanels-BfzvtrNj.js +0 -46
  292. package/dist/client/assets/SettingsPanels.logic-xcOt84aX.js +0 -2
  293. package/dist/client/assets/ThreadTerminalDrawer-CnO3UVOq.js +0 -5
  294. package/dist/client/assets/TooltipViewport-CEOeTVyb.js +0 -2
  295. package/dist/client/assets/_chat-BO5aRu-j.js +0 -45
  296. package/dist/client/assets/_chat.design-1RXhKj_3.js +0 -2
  297. package/dist/client/assets/_chat.new-QYOVVQAv.js +0 -4
  298. package/dist/client/assets/_chat.pull-requests-B8-W4w8K.js +0 -2
  299. package/dist/client/assets/assets-dVntMNKj.js +0 -2
  300. package/dist/client/assets/browserHistoryStore-AwPHr-9a.js +0 -2
  301. package/dist/client/assets/circle-stop-F6BJYb9Y.js +0 -2
  302. package/dist/client/assets/device-ZhgWJyBN.js +0 -2
  303. package/dist/client/assets/dynamic-DXn8DtfU.js +0 -3
  304. package/dist/client/assets/entities-DCgQUDZp.js +0 -2
  305. package/dist/client/assets/index-Bxk_RxGw.js +0 -3
  306. package/dist/client/assets/main-B-tAk2zT.css +0 -2
  307. package/dist/client/assets/main-CVSzIqPv.js +0 -37
  308. package/dist/client/assets/mediaReference-DMJ5Zay3.js +0 -2
  309. package/dist/client/assets/mediaSource-UIArIbzY.js +0 -2
  310. package/dist/client/assets/number-field-DcRWl9B0.js +0 -2
  311. package/dist/client/assets/openFileInPreview-x34grdQ6.js +0 -2
  312. package/dist/client/assets/primary-CIcP7bEP.js +0 -2
  313. package/dist/client/assets/primaryCloudLinkState-Dwi-D0I7.js +0 -2
  314. package/dist/client/assets/projectFilesQueryState-02nlfyzQ.js +0 -2
  315. package/dist/client/assets/projectScriptEditor-CIDcf-KL.js +0 -2
  316. package/dist/client/assets/pullRequests-mcrrz3SF.js +0 -2
  317. package/dist/client/assets/queries-ByCVdESa.js +0 -2
  318. package/dist/client/assets/query-D-IVadFI.js +0 -2
  319. package/dist/client/assets/radio-group-DIOJb--u.js +0 -2
  320. package/dist/client/assets/runtime-CZnPVuwS.js +0 -3
  321. package/dist/client/assets/runtime-DEFP_0P0.js +0 -6
  322. package/dist/client/assets/selfImproveFindings-DuRaHmql.js +0 -2
  323. package/dist/client/assets/server-BuS35bSu.js +0 -2
  324. package/dist/client/assets/session-DIw-RcNy.js +0 -2
  325. package/dist/client/assets/session-logic-B5D2SdWr.js +0 -26
  326. package/dist/client/assets/settings.archived-D2NDpNIY.js +0 -2
  327. package/dist/client/assets/settings.connections-DDjl99g3.js +0 -2
  328. package/dist/client/assets/settings.diagnostics-C1H_Oj2r.js +0 -2
  329. package/dist/client/assets/settings.integrations-BBvK_SX4.js +0 -2
  330. package/dist/client/assets/settings.projects-BmJITbPY.js +0 -4
  331. package/dist/client/assets/settings.providers-ELxTJwWk.js +0 -3
  332. package/dist/client/assets/settings.snap-shot-CvbNcoJx.js +0 -2
  333. package/dist/client/assets/settings.source-control-k2lVK3Ho.js +0 -2
  334. package/dist/client/assets/settingsLayout-BWJVQUbK.js +0 -3
  335. package/dist/client/assets/terminalSessions-BxTpBnAL.js +0 -2
  336. package/dist/client/assets/toast-rcFdQept.js +0 -2
  337. package/dist/client/assets/usage-C-EgFB5m.js +0 -2
  338. package/dist/client/assets/useHandleNewThread-BoN4NqHy.js +0 -2
  339. package/dist/client/assets/useSettings-4JwtKUFC.js +0 -3
  340. package/dist/client/assets/utils-D19Exirm.js +0 -37
  341. package/dist/client/assets/vcsRefInvalidation-aUafFWy3.js +0 -2
  342. package/dist/client/assets/welcome-DORffgtg.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{$n as i,Cp as a,Gd as o,Jn as s,Lc as c,Vm as l,Xp as u,Yn as d,Z_ as f,dr as p,ih as m,jd as h,of as g,pf as _,rv as v,t as y,tr as b,um as x,ur as S}from"./utils-D19Exirm.js";import{R as C,W as w}from"./runtime-DEFP_0P0.js";import{a as T,c as E,o as D,s as O,t as k}from"./select-CML8G0wN.js";import{t as A}from"./useLocation--dLSTvwv.js";import{i as j}from"./toast-rcFdQept.js";import{f as M}from"./server-BuS35bSu.js";import{i as ee,n as N,o as te}from"./session-DIw-RcNy.js";import{t as P}from"./use-atom-command-BETKz9Hv.js";import{t as ne}from"./env-wK1YYxA8.js";import{a as F,n as I,t as L}from"./tooltip-DsRaXpYk.js";import{t as R}from"./toggle-BDixfqRe.js";import{t as re}from"./input-yNgBXsRj.js";import{i as ie}from"./keybindings-hzk4_Sgu.js";import{i as ae,o as oe,t as z}from"./popover-DVeZET9D.js";import{n as se,r as ce,t as B}from"./input-group-APyqVexM.js";import{n as le,t as ue}from"./kbd-Cr4XEhSh.js";import{G as de,V as fe,a as pe,i as me,s as he}from"./settingsLayout-BWJVQUbK.js";import{a as V,c as ge,f as _e,i as ve,l as ye,m as H,n as be,o as xe,p as U,r as Se,s as Ce,t as we,u as Te}from"./KeybindingsSettings.logic-CkmobJKX.js";import{_o as Ee,_r as De,vr as Oe}from"./main-CVSzIqPv.js";var W=n(),G=e(t(),1),K=e(r(),1);function q(e){let t=(0,W.c)(6),{value:n}=e,r,i;if(t[0]!==n){let e=new Map,a=n.split(`+`).map(t=>{let n=e.get(t)??0;return e.set(t,n+1),{part:t,key:n===0?t:`${t}-${n}`}});r=le,i=a.map(ke),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a;return t[3]!==r||t[4]!==i?(a=(0,K.jsx)(r,{children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function ke(e){let{part:t,key:n}=e;return(0,K.jsx)(ue,{children:t===`mod`?navigator.platform.toLowerCase().includes(`mac`)?`⌘`:`Ctrl`:t===`shift`?`⇧`:t===`alt`?navigator.platform.toLowerCase().includes(`mac`)?`⌥`:`Alt`:t===`ctrl`?`⌃`:t.length===1?t.toUpperCase():t},n)}function Ae(e){let t=(0,W.c)(11),{query:n,onChange:r,inputRef:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(se,{children:(0,K.jsx)(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,K.jsxs)(B,{className:`min-w-0 basis-full **:[input]:h-9 sm:basis-0 sm:flex-1 sm:**:[input]:h-8`,children:[a,(0,K.jsx)(ce,{ref:i,type:`search`,value:n,onChange:o,onKeyDown:s,placeholder:`Search keybindings`,"aria-label":`Search keybindings`,size:`sm`})]}),t[6]=i,t[7]=n,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function je(e,t){return e.type===t?[...je(e.left,t),...je(e.right,t)]:[e]}function J(e,t){let n=e[0];if(n)return e.slice(1).reduce((e,n)=>({type:t,left:e,right:n}),n)}function Me(e){return e.type===`identifier`?{identifier:e.name,negated:!1}:e.type===`not`&&e.node.type===`identifier`?{identifier:e.node.name,negated:!0}:null}function Ne(e,t){let n=Me(e);if(!n)return e;let r={type:`identifier`,name:t};return n.negated?{type:`not`,node:r}:r}function Pe(e,t){let n=Me(e);if(!n)return t?{type:`not`,node:e}:e;let r={type:`identifier`,name:n.identifier};return t?{type:`not`,node:r}:r}function Y(){return{type:`identifier`,name:we}}function Fe(e=`and`){return{type:e,left:Y(),right:{type:`not`,node:Y()}}}function Ie(e){let t=(0,W.c)(14),{label:n,focusable:r,className:i,children:a}=e,o=r===void 0||r?0:void 0,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,K.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,K.jsx)(l,{className:`size-3.5`}),t[6]=u):u=t[6];let d;t[7]===c?d=t[8]:(d=(0,K.jsx)(F,{render:c,children:u}),t[7]=c,t[8]=d);let f;t[9]===a?f=t[10]:(f=(0,K.jsx)(I,{side:`top`,children:a}),t[9]=a,t[10]=f);let p;return t[11]!==d||t[12]!==f?(p=(0,K.jsxs)(L,{children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13],p}function Le(e){let t=(0,W.c)(5),{identifiers:n,focusable:r}=e,i=r===void 0||r;if(n.length===0)return null;let a;t[0]===n?a=t[1]:(a=n.length===1?`Unknown condition: ${n[0]}`:`Unknown conditions: ${n.join(`, `)}`,t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==o?(s=(0,K.jsx)(Ie,{label:o,focusable:i,className:`size-4.5`,children:`P4 Code does not recognize this condition yet. It can still be saved, but it may not match unless the runtime provides it.`}),t[2]=i,t[3]=o,t[4]=s):s=t[4],s}function X(e){let t=(0,W.c)(4),{labels:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.length===1?`Conflicts with ${n[0]}.`:`Conflicts with ${n.slice(0,3).join(`, `)}${n.length>3?`, and more`:``}.`,t[0]=n,t[1]=r);let i=r,a;return t[2]===i?a=t[3]:(a=(0,K.jsxs)(Ie,{label:i,children:[i,` The most recent matching binding wins when both conditions can apply.`]}),t[2]=i,t[3]=a),a}function Re(e){let t=(0,W.c)(25),{value:n,variables:r,unknownIdentifiers:i,onChange:a}=e,o;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>e===n,t[3]=n,t[4]=e),o=r.find(e),t[0]=n,t[1]=r,t[2]=o}else o=t[2];let s=o,c;t[5]!==s||t[6]!==n||t[7]!==r?(c=s||r.some(e=>e===n)?r:[n,...r],t[5]=s,t[6]=n,t[7]=r,t[8]=c):c=t[8];let l=c,u;t[9]===a?u=t[10]:(u=e=>e&&a(e),t[9]=a,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(E,{placeholder:`Condition`}),t[11]=d):d=t[11];let f;t[12]===i?f=t[13]:(f=i&&i.length>0?(0,K.jsx)(Le,{identifiers:i,focusable:!1}):null,t[12]=i,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,K.jsxs)(O,{size:`compact`,className:`min-w-0 flex-1`,children:[d,f]}),t[14]=f,t[15]=p);let m;t[16]===l?m=t[17]:(m=l.map(ze),t[16]=l,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,K.jsx)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:m}),t[18]=m,t[19]=h);let g;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==n?(g=(0,K.jsxs)(k,{value:n,onValueChange:u,children:[p,h]}),t[20]=u,t[21]=p,t[22]=h,t[23]=n,t[24]=g):g=t[24],g}function ze(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:e})},e)}function Be(e){let t=(0,W.c)(14),{label:n,className:r,onRemove:i}=e,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]!==i||t[4]!==o?(s=(0,K.jsx)(p,{type:`button`,variant:`ghost`,size:`icon-sm`,className:o,"aria-label":n,onClick:i}),t[2]=n,t[3]=i,t[4]=o,t[5]=s):s=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,K.jsx)(a,{"aria-hidden":!0,className:`size-3.5`}),t[6]=c):c=t[6];let l;t[7]===s?l=t[8]:(l=(0,K.jsx)(F,{delay:200,render:s,children:c}),t[7]=s,t[8]=l);let u;t[9]===n?u=t[10]:(u=(0,K.jsx)(I,{side:`top`,children:n}),t[9]=n,t[10]=u);let d;return t[11]!==l||t[12]!==u?(d=(0,K.jsxs)(L,{children:[l,u]}),t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function Z(e){let t=(0,W.c)(81),{node:n,variables:r,depth:i,onChange:a,onRemove:o}=e,s=i===void 0?0:i,c;if(t[0]!==s||t[1]!==n||t[2]!==a||t[3]!==o||t[4]!==r){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Me(n);if(e){let i=Ce(e.identifier)?[]:[e.identifier],l;t[6]!==n||t[7]!==a?(l=e=>a(Pe(n,e)),t[6]=n,t[7]=a,t[8]=l):l=t[8];let u=`Negate ${e.identifier}`,d;t[9]!==e||t[10]!==l||t[11]!==u?(d=(0,K.jsx)(R,{pressed:e.negated,onPressedChange:l,"aria-label":u,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[9]=e,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==n||t[14]!==a?(f=e=>a(Ne(n,e)),t[13]=n,t[14]=a,t[15]=f):f=t[15];let p;t[16]!==e||t[17]!==f||t[18]!==i||t[19]!==r?(p=(0,K.jsx)(Re,{value:e.identifier,variables:r,unknownIdentifiers:i,onChange:f}),t[16]=e,t[17]=f,t[18]=i,t[19]=r,t[20]=p):p=t[20];let m;t[21]!==s||t[22]!==n||t[23]!==o?(m=o?(0,K.jsx)(Be,{label:H(n,s),onRemove:o}):null,t[21]=s,t[22]=n,t[23]=o,t[24]=m):m=t[24];let h;t[25]!==d||t[26]!==p||t[27]!==m?(h=(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border/70 bg-background/60 px-2 py-2`,children:[d,p,m]}),t[25]=d,t[26]=p,t[27]=m,t[28]=h):h=t[28],c=h;break bb0}}t[0]=s,t[1]=n,t[2]=a,t[3]=o,t[4]=r,t[5]=c}else c=t[5];if(c!==Symbol.for(`react.early_return_sentinel`))return c;if(n.type===`not`){let e=s>0&&`border-border/50 bg-background/50`,i;t[29]===e?i=t[30]:(i=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,K.jsx)(R,{pressed:!0,onPressedChange:e=>a(e?n:n.node),"aria-label":`Negate group`,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[31]=n,t[32]=a,t[33]=c):c=t[33];let l;t[34]!==s||t[35]!==n||t[36]!==o?(l=o?(0,K.jsx)(Be,{label:H(n,s),className:`ml-auto`,onRemove:o}):null,t[34]=s,t[35]=n,t[36]=o,t[37]=l):l=t[37];let u;t[38]!==c||t[39]!==l?(u=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c,l]}),t[38]=c,t[39]=l,t[40]=u):u=t[40];let d,f;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(`span`,{className:`absolute top-0 bottom-0 left-1.5 w-px bg-border/70`,"aria-hidden":!0}),f=(0,K.jsx)(`span`,{className:`absolute top-4 left-1.5 h-px w-2.5 bg-border/70`,"aria-hidden":!0}),t[41]=d,t[42]=f):(d=t[41],f=t[42]);let p=s+1,m;t[43]===a?m=t[44]:(m=e=>a({type:`not`,node:e}),t[43]=a,t[44]=m);let h;t[45]!==n.node||t[46]!==p||t[47]!==m||t[48]!==r?(h=(0,K.jsxs)(`div`,{className:`relative pl-4`,children:[d,f,(0,K.jsx)(Z,{node:n.node,variables:r,depth:p,onChange:m})]}),t[45]=n.node,t[46]=p,t[47]=m,t[48]=r,t[49]=h):h=t[49];let g;return t[50]!==h||t[51]!==i||t[52]!==u?(g=(0,K.jsxs)(`div`,{className:i,children:[u,h]}),t[50]=h,t[51]=i,t[52]=u,t[53]=g):g=t[53],g}let l=n.type===`or`?`or`:`and`,d,f,m,h;if(t[54]!==s||t[55]!==n||t[56]!==a||t[57]!==o||t[58]!==l||t[59]!==r){let e=je(n,l),i=new Map,c=e.map(e=>{let t=`${e.type}-${U(e)}`,n=i.get(t)??0;return i.set(t,n+1),{child:e,key:n===0?t:`${t}-${n}`}}),g=(t,n)=>{let r=!1,i=J(e.map(e=>!r&&e===t?(r=!0,n):e),l);i&&a(i)},_=t=>{let n=!1,r=J(e.filter(e=>!n&&e===t?(n=!0,!1):!0),l);a(r||Y())},v=t=>{if(t===l)return;let n=J(e,t);n&&a(n)},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?m=t[65]:(m=y(`space-y-2 rounded-lg border border-border/60 bg-muted/10 p-2`,S),t[64]=S,t[65]=m);let C;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,K.jsx)(O,{size:`compact`,className:`w-24`,children:(0,K.jsx)(E,{})}),t[66]=C):C=t[66];let w;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsxs)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,children:[(0,K.jsx)(T,{value:`and`,children:`and`}),(0,K.jsx)(T,{value:`or`,children:`or`})]}),t[67]=w):w=t[67];let A;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,K.jsx)(u,{className:`size-3.5`}),t[68]=A):A=t[68];let j;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,K.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,K.jsx)(Be,{label:H(n,s),className:`ml-auto`,onRemove:o}):null,t[70]=s,t[71]=n,t[72]=o,t[73]=M):M=t[73],h=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(k,{value:l,onValueChange:e=>v(e),children:[C,w]}),(0,K.jsxs)(p,{type:`button`,variant:`outline`,size:`compact`,onClick:b,children:[A,`Condition`]}),(0,K.jsxs)(p,{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,K.jsxs)(`div`,{className:`relative pl-4`,children:[(0,K.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,K.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,K.jsx)(Z,{node:t,variables:r,depth:s+1,onChange:e=>g(t,e),onRemove:()=>_(t)})]},n)}),t[54]=s,t[55]=n,t[56]=a,t[57]=o,t[58]=l,t[59]=r,t[60]=d,t[61]=f,t[62]=m,t[63]=h}else d=t[60],f=t[61],m=t[62],h=t[63];let g;t[74]!==d||t[75]!==f?(g=(0,K.jsx)(`div`,{className:d,children:f}),t[74]=d,t[75]=f,t[76]=g):g=t[76];let _;return t[77]!==m||t[78]!==h||t[79]!==g?(_=(0,K.jsxs)(`div`,{className:m,children:[h,g]}),t[77]=m,t[78]=h,t[79]=g,t[80]=_):_=t[80],_}function Ve(e){let t=(0,W.c)(60),{value:n,variables:r,onChange:i,onValidityChange:a}=e,s;t[0]===n?s=t[1]:(s=U(n),t[0]=n,t[1]=s);let[c,l]=(0,G.useState)(s),d;t[2]===c?d=t[3]:(d=Te(c),t[2]=c,t[3]=d);let f=d,m=f.ok?null:f.message,h;t[4]!==f.ok||t[5]!==f.value?(h=f.ok?_e(f.value):[],t[4]=f.ok,t[5]=f.value,t[6]=h):h=t[6];let g=h,_;t[7]!==i||t[8]!==a?(_=e=>{l(e);let t=Te(e);a?.(t.ok),t.ok&&i(t.value)},t[7]=i,t[8]=a,t[9]=_):_=t[9];let v=_,y;t[10]!==i||t[11]!==a?(y=e=>{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=Fe(`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,K.jsx)(`div`,{className:`min-w-0`,children:(0,K.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`When`})}),t[19]=T):T=t[19];let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,K.jsx)(u,{className:`size-3.5`}),t[20]=E):E=t[20];let D;t[21]===S?D=t[22]:(D=(0,K.jsxs)(p,{type:`button`,variant:`outline`,size:`compact`,onClick:S,children:[E,`Condition`]}),t[21]=S,t[22]=D);let O;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,K.jsx)(u,{className:`size-3.5`}),t[23]=O):O=t[23];let k;t[24]===w?k=t[25]:(k=(0,K.jsxs)(p,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[O,`Group`]}),t[24]=w,t[25]=k);let A;t[26]!==D||t[27]!==k?(A=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[D,k]})]}),t[26]=D,t[27]=k,t[28]=A):A=t[28];let j;t[29]===v?j=t[30]:(j=e=>v(e.currentTarget.value),t[29]=v,t[30]=j);let M=!!m,ee;t[31]!==c||t[32]!==j||t[33]!==M?(ee=(0,K.jsx)(ce,{value:c,onChange:j,placeholder:`Always`,"aria-invalid":M,"aria-label":`When expression`,size:`compact`,font:`mono`}),t[31]=c,t[32]=j,t[33]=M,t[34]=ee):ee=t[34];let N;t[35]===g?N=t[36]:(N=g.length>0?(0,K.jsx)(se,{align:`inline-end`,children:(0,K.jsx)(Le,{identifiers:g})}):null,t[35]=g,t[36]=N);let te;t[37]!==ee||t[38]!==N?(te=(0,K.jsxs)(B,{children:[ee,N]}),t[37]=ee,t[38]=N,t[39]=te):te=t[39];let P;t[40]===m?P=t[41]:(P=m?(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-2xs text-destructive`,children:[(0,K.jsx)(o,{className:`size-3.5`}),m]}):null,t[40]=m,t[41]=P);let ne;t[42]!==te||t[43]!==P?(ne=(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[te,P]}),t[42]=te,t[43]=P,t[44]=ne):ne=t[44];let F;t[45]!==S||t[46]!==w||t[47]!==b||t[48]!==n||t[49]!==r?(F=n?(0,K.jsx)(Z,{node:n,variables:r,onChange:b,onRemove:()=>b(void 0)}):(0,K.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/15 p-3`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(p,{type:`button`,size:`compact`,onClick:S,children:[(0,K.jsx)(u,{className:`size-3.5`}),`Condition`]}),(0,K.jsxs)(p,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[(0,K.jsx)(u,{className:`size-3.5`}),`Group`]})]})}),t[45]=S,t[46]=w,t[47]=b,t[48]=n,t[49]=r,t[50]=F):F=t[50];let I;t[51]===m?I=t[52]:(I=m?(0,K.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center rounded-lg border border-destructive/30 bg-background/75 p-4 text-center text-xs text-destructive backdrop-blur-xs`,children:`Fix the expression above to continue editing visually.`}):null,t[51]=m,t[52]=I);let L;t[53]!==F||t[54]!==I?(L=(0,K.jsxs)(`div`,{className:`relative`,children:[F,I]}),t[53]=F,t[54]=I,t[55]=L):L=t[55];let R;return t[56]!==A||t[57]!==ne||t[58]!==L?(R=(0,K.jsxs)(`div`,{className:`w-[min(34rem,calc(100vw-2rem))] space-y-3`,children:[A,ne,L]}),t[56]=A,t[57]=ne,t[58]=L,t[59]=R):R=t[59],R}function He(e){return{keyDraft:e.key,whenDraft:e.binding.whenAst,isRecording:!1,isWhenDraftValid:!0}}function Q(e,t){return{...e,...t}}function Ue(e){return{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}}function We(e){let t=(0,W.c)(27),{row:n,allRows:r,onSave:i}=e,[a,o]=(0,G.useReducer)(Q,n,He),{keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u}=a,d,f,p;t[0]!==r||t[1]!==s||t[2]!==n.id||t[3]!==n.key||t[4]!==n.when||t[5]!==c?(p=U(c),d=s!==n.key||p!==n.when,f=ge(r,{rowId:n.id,key:s,when:p}),t[0]=r,t[1]=s,t[2]=n.id,t[3]=n.key,t[4]=n.when,t[5]=c,t[6]=d,t[7]=f,t[8]=p):(d=t[6],f=t[7],p=t[8]);let m=f,h;t[9]!==s||t[10]!==i||t[11]!==n||t[12]!==p?(h=()=>{i({command:n.command,key:s,when:p.trim().length>0?p:void 0,replace:Ue(n)})},t[9]=s,t[10]=i,t[11]=n,t[12]=p,t[13]=h):h=t[13];let g=h,_;t[14]!==l||t[15]!==n.key?(_=e=>{if(e.key===`Tab`&&!l)return;if(e.preventDefault(),e.key===`Escape`){o({keyDraft:n.key,isRecording:!1});return}let t=ye(e.nativeEvent,navigator.platform);t&&o({keyDraft:t,isRecording:!1})},t[14]=l,t[15]=n.key,t[16]=_):_=t[16];let v=_,y;return t[17]!==v||t[18]!==m||t[19]!==d||t[20]!==l||t[21]!==u||t[22]!==s||t[23]!==g||t[24]!==c||t[25]!==p?(y={keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u,whenDraftExpression:p,isDirty:d,conflictLabels:m,setDraft:o,save:g,captureKeybinding:v},t[17]=v,t[18]=m,t[19]=d,t[20]=l,t[21]=u,t[22]=s,t[23]=g,t[24]=c,t[25]=p,t[26]=y):y=t[26],y}function Ge(e){let t=(0,W.c)(19),{row:n,editor:r,isSaving:i,pillClassName:a}=e,{keyDraft:o,isRecording:s,isDirty:c,isWhenDraftValid:l,setDraft:u,save:d,captureKeybinding:f}=r,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,K.jsx)(p,{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]!==n.binding||t[11]!==n.command||t[12]!==n.key||t[13]!==u||t[14]!==m?(g=m?(0,K.jsx)(`button`,{type:`button`,onClick:()=>u({isRecording:!0}),"aria-label":`Edit shortcut for ${V(n.command)}: ${ie(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,K.jsx)(q,{value:n.key})}):(0,K.jsx)(re,{"data-keybinding-capture":``,autoFocus:s,"aria-label":`Keybinding for ${V(n.command)}`,value:s?``:o,placeholder:s?`Press shortcut`:`Unassigned`,size:`sm`,font:`mono`,className:`w-44`,onFocus:()=>u({isRecording:!0}),onBlur:()=>u({isRecording:!1}),onChange:e=>u({keyDraft:e.currentTarget.value}),onKeyDown:f}),t[6]=f,t[7]=s,t[8]=o,t[9]=a,t[10]=n.binding,t[11]=n.command,t[12]=n.key,t[13]=u,t[14]=m,t[15]=g):g=t[15];let _;return t[16]!==h||t[17]!==g?(_=(0,K.jsxs)(K.Fragment,{children:[h,g]}),t[16]=h,t[17]=g,t[18]=_):_=t[18],_}function $(e){let t=(0,W.c)(17),{label:n,expression:r,value:i,variables:a,onChange:o,onValidityChange:s}=e,c=r?`ghost`:`ghost-muted`,l;t[0]===c?l=t[1]:(l=(0,K.jsx)(p,{variant:c,size:`micro`,className:`min-w-0 shrink`}),t[0]=c,t[1]=l);let u=`Edit when clause for ${n}`,d=r||`Always`,f;t[2]===d?f=t[3]:(f=(0,K.jsx)(`span`,{className:`truncate font-mono`,children:d}),t[2]=d,t[3]=f);let m;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,K.jsx)(h,{className:`size-3.5 shrink-0 opacity-60`}),t[4]=m):m=t[4];let g;t[5]!==l||t[6]!==u||t[7]!==f?(g=(0,K.jsxs)(oe,{render:l,"aria-label":u,children:[f,m]}),t[5]=l,t[6]=u,t[7]=f,t[8]=g):g=t[8];let _;t[9]!==o||t[10]!==s||t[11]!==i||t[12]!==a?(_=(0,K.jsx)(ae,{align:`start`,sideOffset:6,children:(0,K.jsx)(Ve,{value:i,variables:a,onChange:o,onValidityChange:s})}),t[9]=o,t[10]=s,t[11]=i,t[12]=a,t[13]=_):_=t[13];let v;return t[14]!==g||t[15]!==_?(v=(0,K.jsxs)(z,{children:[g,_]}),t[14]=g,t[15]=_,t[16]=v):v=t[16],v}function Ke(e){let t=(0,W.c)(24),{row:n,isSaving:r,onReset:a,onRemove:o}=e,s=n.source===`Custom`&&n.defaultKey!==null,c=n.source!==`Default`;if(!s&&!c)return null;let l;t[0]===n.command?l=t[1]:(l=V(n.command),t[0]=n.command,t[1]=l);let u=`Actions for ${l}`,f;t[2]!==r||t[3]!==u?(f=(0,K.jsx)(p,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:r,"aria-label":u}),t[2]=r,t[3]=u,t[4]=f):f=t[4];let m;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,K.jsx)(g,{className:`size-3.5`}),t[5]=m):m=t[5];let h;t[6]===f?h=t[7]:(h=(0,K.jsx)(S,{render:f,children:m}),t[6]=f,t[7]=h);let _;t[8]!==s||t[9]!==r||t[10]!==a||t[11]!==n?(_=s?(0,K.jsx)(i,{disabled:r,onClick:()=>a(n),children:`Reset to default`}):null,t[8]=s,t[9]=r,t[10]=a,t[11]=n,t[12]=_):_=t[12];let v;t[13]!==c||t[14]!==r||t[15]!==o||t[16]!==n?(v=c?(0,K.jsx)(i,{variant:`destructive`,disabled:r,onClick:()=>o(n),children:`Remove`}):null,t[13]=c,t[14]=r,t[15]=o,t[16]=n,t[17]=v):v=t[17];let y;t[18]!==_||t[19]!==v?(y=(0,K.jsxs)(b,{align:`end`,children:[_,v]}),t[18]=_,t[19]=v,t[20]=y):y=t[20];let x;return t[21]!==h||t[22]!==y?(x=(0,K.jsxs)(d,{children:[h,y]}),t[21]=h,t[22]=y,t[23]=x):x=t[23],x}function qe(e){let t=(0,W.c)(2),{source:n}=e;if(n===`Default`)return null;let r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(s,{variant:`outline`,size:`sm`,children:n}),t[0]=n,t[1]=r),r}function Je(e){let t=(0,W.c)(13),{row:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsx)(`span`,{className:`flex items-center gap-2`}),t[0]=r):r=t[0];let i;t[1]===n.command?i=t[2]:(i=V(n.command),t[1]=n.command,t[2]=i);let a;t[3]===n.source?a=t[4]:(a=(0,K.jsx)(qe,{source:n.source}),t[3]=n.source,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,K.jsxs)(F,{render:r,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7];let s;t[8]===n.command?s=t[9]:(s=(0,K.jsx)(I,{side:`top`,children:n.command}),t[8]=n.command,t[9]=s);let c;return t[10]!==o||t[11]!==s?(c=(0,K.jsxs)(L,{children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Ye(e){let t=(0,W.c)(13),{row:n,editor:r,variables:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[0]=a):a=t[0];let o;t[1]===n.command?o=t[2]:(o=V(n.command),t[1]=n.command,t[2]=o);let s,c;t[3]===r?(s=t[4],c=t[5]):(s=e=>r.setDraft({whenDraft:e}),c=e=>r.setDraft({isWhenDraftValid:e}),t[3]=r,t[4]=s,t[5]=c);let l;return t[6]!==r.whenDraft||t[7]!==r.whenDraftExpression||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==i?(l=(0,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[a,(0,K.jsx)($,{label:o,expression:r.whenDraftExpression,value:r.whenDraft,variables:i,onChange:s,onValidityChange:c})]}),t[6]=r.whenDraft,t[7]=r.whenDraftExpression,t[8]=o,t[9]=s,t[10]=c,t[11]=i,t[12]=l):l=t[12],l}function Xe(e){let t=(0,W.c)(2),n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(`span`,{className:`flex items-center opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100 has-data-popup-open:opacity-100 pointer-coarse:opacity-100`,children:(0,K.jsx)(Ke,{...e})}),t[0]=e,t[1]=n),n}function Ze(e){let t=(0,W.c)(30),{row:n,isSaving:r,anchorId:i,allRows:a,variables:o,onSave:s,onReset:c,onRemove:l}=e,u;t[0]!==a||t[1]!==s||t[2]!==n?(u={row:n,allRows:a,onSave:s},t[0]=a,t[1]=s,t[2]=n,t[3]=u):u=t[3];let d=We(u),f;t[4]===n?f=t[5]:(f=(0,K.jsx)(Je,{row:n}),t[4]=n,t[5]=f);let p;t[6]!==d||t[7]!==n||t[8]!==o?(p=(0,K.jsx)(Ye,{row:n,editor:d,variables:o}),t[6]=d,t[7]=n,t[8]=o,t[9]=p):p=t[9];let m;t[10]===d.conflictLabels?m=t[11]:(m=(0,K.jsx)(X,{labels:d.conflictLabels}),t[10]=d.conflictLabels,t[11]=m);let h;t[12]!==r||t[13]!==l||t[14]!==c||t[15]!==n?(h=(0,K.jsx)(Xe,{row:n,isSaving:r,onReset:c,onRemove:l}),t[12]=r,t[13]=l,t[14]=c,t[15]=n,t[16]=h):h=t[16];let g;t[17]!==d||t[18]!==r||t[19]!==n?(g=(0,K.jsx)(Ge,{row:n,editor:d,isSaving:r,pillClassName:`-mr-1.5`}),t[17]=d,t[18]=r,t[19]=n,t[20]=g):g=t[20];let _;t[21]!==m||t[22]!==h||t[23]!==g?(_=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[m,h,g]}),t[21]=m,t[22]=h,t[23]=g,t[24]=_):_=t[24];let v;return t[25]!==i||t[26]!==f||t[27]!==p||t[28]!==_?(v=(0,K.jsx)(pe,{id:i,className:`group/row rounded-none`,title:f,description:p,control:_}),t[25]=i,t[26]=f,t[27]=p,t[28]=_,t[29]=v):v=t[29],v}function Qe(e){let t=(0,W.c)(30),{allRows:n,onSave:r}=e,[i,a]=(0,G.useState)(``),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={keyDraft:``,whenDraft:void 0,isRecording:!1,isWhenDraftValid:!0},t[0]=o):o=t[0];let[s,c]=(0,G.useReducer)(Q,o),{keyDraft:l,whenDraft:u,isRecording:d,isWhenDraftValid:f}=s,p,m;t[1]!==n||t[2]!==l||t[3]!==u?(m=U(u),p=ge(n,{rowId:`new`,key:l,when:m}),t[1]=n,t[2]=l,t[3]=u,t[4]=p,t[5]=m):(p=t[4],m=t[5]);let h=p,g;t[6]===i?g=t[7]:(g=i?V(i):`new keybinding`,t[6]=i,t[7]=g);let _=g,v;t[8]!==i||t[9]!==f||t[10]!==l?(v=!!i&&l.trim().length>0&&f,t[8]=i,t[9]=f,t[10]=l,t[11]=v):v=t[11];let y=v,b;t[12]!==i||t[13]!==l||t[14]!==r||t[15]!==m?(b=()=>{i&&r({command:i,key:l,...m.trim().length>0?{when:m}:{}})},t[12]=i,t[13]=l,t[14]=r,t[15]=m,t[16]=b):b=t[16];let x=b,S;t[17]===d?S=t[18]:(S=e=>{if(e.key===`Tab`&&!d)return;if(e.preventDefault(),e.key===`Escape`){c({keyDraft:``,isRecording:!1});return}let t=ye(e.nativeEvent,navigator.platform);t&&c({keyDraft:t,isRecording:!1})},t[17]=d,t[18]=S);let C=S,w;return t[19]!==y||t[20]!==C||t[21]!==i||t[22]!==_||t[23]!==h||t[24]!==d||t[25]!==l||t[26]!==x||t[27]!==u||t[28]!==m?(w={commandDraft:i,setCommandDraft:a,keyDraft:l,whenDraft:u,whenDraftExpression:m,isRecording:d,conflictLabels:h,commandLabelText:_,canSave:y,setDraft:c,save:x,captureKeybinding:C},t[19]=y,t[20]=C,t[21]=i,t[22]=_,t[23]=h,t[24]=d,t[25]=l,t[26]=x,t[27]=u,t[28]=m,t[29]=w):w=t[29],w}function $e(e){let t=(0,W.c)(14),{draft:n,commandOptions:r,className:i}=e,a=n.commandDraft,o;t[0]===n?o=t[1]:(o=e=>n.setCommandDraft(e),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(E,{placeholder:`Command`}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,K.jsx)(O,{size:`sm`,className:i,children:s}),t[3]=i,t[4]=c);let l;t[5]===r?l=t[6]:(l=r.map(et),t[5]=r,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,K.jsx)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n.commandDraft||t[10]!==o||t[11]!==c||t[12]!==u?(d=(0,K.jsxs)(k,{value:a,onValueChange:o,children:[c,u]}),t[9]=n.commandDraft,t[10]=o,t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function et(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:V(e)})},e)}function tt(e){let t=(0,W.c)(14),{draft:n,autoFocus:r,className:i}=e,a=r!==void 0&&r,o=`Keybinding for ${n.commandLabelText}`,s=n.isRecording?``:n.keyDraft,c=n.isRecording?`Press shortcut`:`Unassigned`,l,u,d;t[0]===n?(l=t[1],u=t[2],d=t[3]):(l=()=>n.setDraft({isRecording:!0}),u=()=>n.setDraft({isRecording:!1}),d=e=>n.setDraft({keyDraft:e.currentTarget.value}),t[0]=n,t[1]=l,t[2]=u,t[3]=d);let f;return t[4]!==a||t[5]!==i||t[6]!==n.captureKeybinding||t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,K.jsx)(re,{"data-keybinding-capture":``,autoFocus:a,"aria-label":o,value:s,placeholder:c,size:`sm`,font:`mono`,className:i,onFocus:l,onBlur:u,onChange:d,onKeyDown:n.captureKeybinding}),t[4]=a,t[5]=i,t[6]=n.captureKeybinding,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function nt(e){let t=(0,W.c)(10),{draft:n,variables:r}=e,i,a;t[0]===n?(i=t[1],a=t[2]):(i=e=>n.setDraft({whenDraft:e}),a=e=>n.setDraft({isWhenDraftValid:e}),t[0]=n,t[1]=i,t[2]=a);let o;return t[3]!==n.commandLabelText||t[4]!==n.whenDraft||t[5]!==n.whenDraftExpression||t[6]!==i||t[7]!==a||t[8]!==r?(o=(0,K.jsx)($,{label:n.commandLabelText,expression:n.whenDraftExpression,value:n.whenDraft,variables:r,onChange:i,onValidityChange:a}),t[3]=n.commandLabelText,t[4]=n.whenDraft,t[5]=n.whenDraftExpression,t[6]=i,t[7]=a,t[8]=r,t[9]=o):o=t[9],o}function rt(e){let t=(0,W.c)(9),{isSaving:n,onCancel:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,K.jsx)(p,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:n,"aria-label":`Cancel new keybinding`,onClick:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(m,{className:`size-3.5`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,K.jsx)(F,{render:i,children:a}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(I,{side:`top`,children:`Cancel`}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,K.jsxs)(L,{children:[o,s]}),t[7]=o,t[8]=c),c}function it(e){let t=(0,W.c)(30),{commandOptions:n,allRows:r,variables:i,isSaving:a,onSave:o,onCancel:s}=e,c;t[0]!==r||t[1]!==o?(c={allRows:r,onSave:o},t[0]=r,t[1]=o,t[2]=c):c=t[2];let l=Qe(c),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[3]=u):u=t[3];let d;t[4]!==l||t[5]!==i?(d=(0,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[u,(0,K.jsx)(nt,{draft:l,variables:i})]}),t[4]=l,t[5]=i,t[6]=d):d=t[6];let f;t[7]!==n||t[8]!==l?(f=(0,K.jsx)($e,{draft:l,commandOptions:n,className:`w-56`}),t[7]=n,t[8]=l,t[9]=f):f=t[9];let m;t[10]===l.conflictLabels?m=t[11]:(m=(0,K.jsx)(X,{labels:l.conflictLabels}),t[10]=l.conflictLabels,t[11]=m);let h;t[12]===l?h=t[13]:(h=(0,K.jsx)(tt,{draft:l,className:`w-44`}),t[12]=l,t[13]=h);let g=a||!l.canSave,_=a?`Saving`:`Save`,v;t[14]!==l.save||t[15]!==g||t[16]!==_?(v=(0,K.jsx)(p,{size:`sm`,disabled:g,onClick:l.save,children:_}),t[14]=l.save,t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==s?(y=(0,K.jsx)(rt,{isSaving:a,onCancel:s}),t[18]=a,t[19]=s,t[20]=y):y=t[20];let b;t[21]!==f||t[22]!==m||t[23]!==h||t[24]!==v||t[25]!==y?(b=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[f,m,h,v,y]}),t[21]=f,t[22]=m,t[23]=h,t[24]=v,t[25]=y,t[26]=b):b=t[26];let x;return t[27]!==b||t[28]!==d?(x=(0,K.jsx)(pe,{className:`bg-muted/15`,title:`New keybinding`,description:d,control:b}),t[27]=b,t[28]=d,t[29]=x):x=t[29],x}function at(e){let{groups:t,anchorIds:n,savingCommand:r,...i}=e;return t.map(e=>(0,K.jsx)(he,{id:`keybindings-${e.id}`,title:e.title,children:e.rows.map(e=>(0,K.jsx)(Ze,{row:e,anchorId:n.get(e.id),isSaving:r===e.command,...i},e.id))},e.id))}function ot(){let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{delay:200,render:(0,K.jsx)(p,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":`The browser may claim some shortcuts first. The desktop app receives them all.`,children:(0,K.jsx)(l,{className:`size-3.5 text-warning`})})}),(0,K.jsx)(I,{side:`top`,className:`max-w-72`,children:`The browser may claim some shortcuts first. The desktop app receives them all.`})]}),e[0]=t):t=e[0],t}function st(){let e=(0,W.c)(83),{environment:t,connectedEnvironments:n}=fe(),r=ee(t?.environmentId??null,f),i=te(n,v),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 o=a,s=t?.serverConfig?.keybindings,l;e[3]===s?l=e[4]:(l=s??[],e[3]=s,e[4]=l);let d;e[5]===l?d=e[6]:(d=c(l),e[5]=l,e[6]=d);let m=d,h=t?.serverConfig?.keybindingsConfigPath??null,g;e[7]===t?.serverConfig?.availableEditors?g=e[8]:(g=t?.serverConfig?.availableEditors??[],e[7]=t?.serverConfig?.availableEditors,e[8]=g);let y=g,b;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(b={reportFailure:!1},e[9]=b):b=e[9];let x=P(M.upsertKeybinding,b),S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S={reportFailure:!1},e[10]=S):S=e[10];let T=P(M.removeKeybinding,S),E=Ee(t?.environmentId??null,y),[D,O]=(0,G.useState)(``),k=(0,G.useRef)(null),[R,re]=(0,G.useState)(null),[ie,ae]=(0,G.useState)(!1),oe;e[11]!==m||e[12]!==D?(oe=Se(m,D),e[11]=m,e[12]=D,e[13]=oe):oe=e[13];let z=oe,se;e[14]===z?se=e[15]:(se=xe(z),e[14]=z,e[15]=se);let ce=se,B;if(e[16]!==z){B=new Map;let t=new Set;for(let e of z)t.has(e.command)||(t.add(e.command),B.set(e.id,De(e.command)));e[16]=z,e[17]=B}else B=e[17];let le=B,ue;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(ue={select:ft},e[18]=ue):ue=e[18];let pe=A(ue),[V,ge]=(0,G.useState)(pe);pe!==V&&(ge(pe),pe.startsWith(`keybinding-`)&&O(``));let _e;e[19]===m?_e=e[20]:(_e=be(m),e[19]=m,e[20]=_e);let ye=_e,H;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(H=ve(),e[21]=H):H=e[21];let U=H,Ce;e[22]!==h||e[23]!==E||e[24]!==t?(Ce=()=>{h&&t&&N(t.environmentId,`orchestration:operate`)&&(async()=>{let e=await E(h);if(e._tag===`Success`||C(e))return;let t=w(e);j.add({title:`Unable to open keybindings file`,description:t instanceof Error?t.message:`The keybindings file was not opened.`,type:`error`})})()},e[22]=h,e[23]=E,e[24]=t,e[25]=Ce):Ce=e[25];let we=Ce,Te;e[26]!==n||e[27]!==t||e[28]!==x?(Te=e=>{if(!t||!n.every(dt))return;re(e.command);let r={command:e.command,key:e.key.trim(),...e.when?.trim()?{when:e.when.trim()}:{},...e.replace?{replace:e.replace}:{}};(async()=>{let e=await Promise.all(n.map(e=>x({environmentId:e.environmentId,input:r})));re(null);let t=e.find(ut);if(!t)ae(!1);else if(!C(t)){let e=w(t);j.add({title:`Unable to save keybinding`,description:e instanceof Error?e.message:`The keybinding was not saved.`,type:`error`})}})()},e[26]=n,e[27]=t,e[28]=x,e[29]=Te):Te=e[29];let q=Te,ke;e[30]!==n||e[31]!==t||e[32]!==T?(ke=e=>{t&&n.every(lt)&&(re(e.command),(async()=>{let t=await Promise.all(n.map(t=>T({environmentId:t.environmentId,input:Ue(e)})));re(null);let r=t.find(ct)??t[0];if(r?._tag===`Failure`&&!C(r)){let e=w(r);j.add({title:`Unable to remove keybinding`,description:e instanceof Error?e.message:`The keybinding was not removed.`,type:`error`})}})())},e[30]=n,e[31]=t,e[32]=T,e[33]=ke):ke=e[33];let je=ke,J;e[34]===q?J=e[35]:(J=e=>{e.defaultKey&&q({command:e.command,key:e.defaultKey,when:e.defaultWhen.trim().length>0?e.defaultWhen:void 0,replace:{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}})},e[34]=q,e[35]=J);let Me=J,Ne;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>ae(!1),e[36]=Ne):Ne=e[36];let Pe=Ne,Y;e[37]!==je||e[38]!==Me||e[39]!==z||e[40]!==q?(Y={allRows:z,variables:U,onSave:q,onReset:Me,onRemove:je},e[37]=je,e[38]=Me,e[39]=z,e[40]=q,e[41]=Y):Y=e[41];let Fe=Y,Ie,Le;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=Oe(`keybindings`),Le=ne?null:(0,K.jsx)(ot,{}),e[42]=Ie,e[43]=Le):(Ie=e[42],Le=e[43]);let X;e[44]===D?X=e[45]:(X=(0,K.jsx)(Ae,{query:D,onChange:O,inputRef:k}),e[44]=D,e[45]=X);let Re=ie||!o,ze,Be;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>ae(!0),Be=(0,K.jsx)(u,{"aria-hidden":!0,className:`size-4`}),e[46]=ze,e[47]=Be):(ze=e[46],Be=e[47]);let Z;e[48]===Re?Z=e[49]:(Z=(0,K.jsxs)(p,{type:`button`,variant:`outline`,disabled:Re,onClick:ze,children:[Be,`Add keybinding`]}),e[48]=Re,e[49]=Z);let Ve=!h||!r,He;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,K.jsx)(_,{"aria-hidden":!0,className:`size-4`}),e[50]=He):He=e[50];let Q;e[51]!==we||e[52]!==Ve?(Q=(0,K.jsx)(F,{render:(0,K.jsx)(p,{type:`button`,variant:`outline`,size:`icon`,disabled:Ve,onClick:we,"aria-label":`Open keybindings.json`,children:He})}),e[51]=we,e[52]=Ve,e[53]=Q):Q=e[53];let We;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,K.jsx)(I,{side:`top`,children:`Open keybindings.json`}),e[54]=We):We=e[54];let Ge;e[55]===Q?Ge=e[56]:(Ge=(0,K.jsxs)(L,{children:[Q,We]}),e[55]=Q,e[56]=Ge);let $;e[57]!==X||e[58]!==Z||e[59]!==Ge?($=(0,K.jsx)(he,{...Ie,headerAction:Le,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[X,Z,Ge]})}),e[57]=X,e[58]=Z,e[59]=Ge,e[60]=$):$=e[60];let Ke;e[61]!==o||e[62]!==n?(Ke=o?null:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.length===0?`Connect an environment to change keybindings.`:`This connection can view keybindings but cannot change them.`}),e[61]=o,e[62]=n,e[63]=Ke):Ke=e[63];let qe=!o,Je;e[64]!==ye||e[65]!==ie||e[66]!==z||e[67]!==q||e[68]!==R?(Je=ie?(0,K.jsx)(de,{children:(0,K.jsx)(it,{commandOptions:ye,allRows:z,variables:U,isSaving:R!==null,onSave:q,onCancel:Pe})}):null,e[64]=ye,e[65]=ie,e[66]=z,e[67]=q,e[68]=R,e[69]=Je):Je=e[69];let Ye;e[70]!==le||e[71]!==ce||e[72]!==Fe||e[73]!==R?(Ye=ce.length>0?(0,K.jsx)(at,{groups:ce,anchorIds:le,savingCommand:R,...Fe}):(0,K.jsx)(de,{children:(0,K.jsx)(`div`,{className:`px-4 py-12 text-center text-sm text-muted-foreground`,children:`No keybindings match your search.`})}),e[70]=le,e[71]=ce,e[72]=Fe,e[73]=R,e[74]=Ye):Ye=e[74];let Xe;e[75]!==qe||e[76]!==Je||e[77]!==Ye?(Xe=(0,K.jsxs)(`div`,{inert:qe,className:`flex flex-col gap-8`,children:[Je,Ye]}),e[75]=qe,e[76]=Je,e[77]=Ye,e[78]=Xe):Xe=e[78];let Ze;return e[79]!==$||e[80]!==Ke||e[81]!==Xe?(Ze=(0,K.jsxs)(me,{children:[$,Ke,Xe]}),e[79]=$,e[80]=Ke,e[81]=Xe,e[82]=Ze):Ze=e[82],Ze}function ct(e){return e._tag===`Failure`}function lt(e){return N(e.environmentId,v)}function ut(e){return e._tag===`Failure`}function dt(e){return N(e.environmentId,v)}function ft(e){return e.hash.replace(/^#/,``)}var pt=st;export{pt as component};
2
- //# sourceMappingURL=settings.keybindings-BIfUzprR.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Hc as i,Id as a,Xn as o,Yn as s,Zd as c,dr as l,er as u,ff as d,fr as f,gm as p,kp as m,lv as h,nm as g,nr as _,qm as v,rv as y,t as b,uh as x,yf as S}from"./utils-C5GGWTfe.js";import{R as C,W as w}from"./runtime-BVmDVuJ-.js";import{a as T,c as E,o as D,s as O,t as k}from"./select-vBkqTMKL.js";import{t as A}from"./useLocation-DHd-KBb-.js";import{i as j}from"./toast-BZ96uuab.js";import{f as M}from"./server-DwkxciXh.js";import{i as ee,n as N,o as te}from"./session-BIwsf8Q4.js";import{t as P}from"./use-atom-command-CdV5BZYB.js";import{t as ne}from"./env-wK1YYxA8.js";import{a as F,n as I,t as L}from"./tooltip-BPiLl1TV.js";import{t as R}from"./toggle-DJ8KOwn5.js";import{t as re}from"./input-FUjAUGXY.js";import{i as ie}from"./keybindings-DuCyi9aT.js";import{i as ae,o as oe,t as z}from"./popover-hYAmvSJj.js";import{n as se,r as ce,t as B}from"./input-group-BdZ_CKvG.js";import{n as le,t as ue}from"./kbd-CGgmav-Q.js";import{G as de,V as fe,a as pe,i as me,s as he}from"./settingsLayout-WhjsCfB6.js";import{a as V,c as ge,f as _e,i as ve,l as ye,m as H,n as be,o as xe,p as U,r as Se,s as Ce,t as we,u as Te}from"./KeybindingsSettings.logic-Ctmq4InP.js";import{Ar as Ee,Co as De,kr as Oe}from"./main-C0z861OK.js";var W=n(),G=e(t(),1),K=e(r(),1);function q(e){let t=(0,W.c)(6),{value:n}=e,r,i;if(t[0]!==n){let e=new Map,a=n.split(`+`).map(t=>{let n=e.get(t)??0;return e.set(t,n+1),{part:t,key:n===0?t:`${t}-${n}`}});r=le,i=a.map(ke),t[0]=n,t[1]=r,t[2]=i}else r=t[1],i=t[2];let a;return t[3]!==r||t[4]!==i?(a=(0,K.jsx)(r,{children:i}),t[3]=r,t[4]=i,t[5]=a):a=t[5],a}function ke(e){let{part:t,key:n}=e;return(0,K.jsx)(ue,{children:t===`mod`?navigator.platform.toLowerCase().includes(`mac`)?`⌘`:`Ctrl`:t===`shift`?`⇧`:t===`alt`?navigator.platform.toLowerCase().includes(`mac`)?`⌥`:`Alt`:t===`ctrl`?`⌃`:t.length===1?t.toUpperCase():t},n)}function Ae(e){let t=(0,W.c)(11),{query:n,onChange:r,inputRef:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(se,{children:(0,K.jsx)(p,{"aria-hidden":!0,className:`size-3.5`})}),t[0]=a):a=t[0];let o;t[1]===r?o=t[2]:(o=e=>r(e.currentTarget.value),t[1]=r,t[2]=o);let s;t[3]!==r||t[4]!==n?(s=e=>{e.key===`Escape`&&(e.preventDefault(),n.length>0?r(``):e.currentTarget.blur())},t[3]=r,t[4]=n,t[5]=s):s=t[5];let c;return t[6]!==i||t[7]!==n||t[8]!==o||t[9]!==s?(c=(0,K.jsxs)(B,{className:`min-w-0 basis-full **:[input]:h-9 sm:basis-0 sm:flex-1 sm:**:[input]:h-8`,children:[a,(0,K.jsx)(ce,{ref:i,type:`search`,value:n,onChange:o,onKeyDown:s,placeholder:`Search keybindings`,"aria-label":`Search keybindings`,size:`sm`})]}),t[6]=i,t[7]=n,t[8]=o,t[9]=s,t[10]=c):c=t[10],c}function je(e,t){return e.type===t?[...je(e.left,t),...je(e.right,t)]:[e]}function J(e,t){let n=e[0];if(n)return e.slice(1).reduce((e,n)=>({type:t,left:e,right:n}),n)}function Me(e){return e.type===`identifier`?{identifier:e.name,negated:!1}:e.type===`not`&&e.node.type===`identifier`?{identifier:e.node.name,negated:!0}:null}function Ne(e,t){let n=Me(e);if(!n)return e;let r={type:`identifier`,name:t};return n.negated?{type:`not`,node:r}:r}function Pe(e,t){let n=Me(e);if(!n)return t?{type:`not`,node:e}:e;let r={type:`identifier`,name:n.identifier};return t?{type:`not`,node:r}:r}function Y(){return{type:`identifier`,name:we}}function Fe(e=`and`){return{type:e,left:Y(),right:{type:`not`,node:Y()}}}function Ie(e){let t=(0,W.c)(14),{label:n,focusable:r,className:i,children:a}=e,o=r===void 0||r?0:void 0,s;t[0]===i?s=t[1]:(s=b(`inline-flex size-5 shrink-0 items-center justify-center rounded-sm text-warning outline-none transition-colors hover:bg-warning/10 focus-visible:ring-3 focus-visible:ring-inset focus-visible:ring-warning/25`,i),t[0]=i,t[1]=s);let c;t[2]!==n||t[3]!==o||t[4]!==s?(c=(0,K.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 l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,K.jsx)(v,{className:`size-3.5`}),t[6]=l):l=t[6];let u;t[7]===c?u=t[8]:(u=(0,K.jsx)(F,{render:c,children:l}),t[7]=c,t[8]=u);let d;t[9]===a?d=t[10]:(d=(0,K.jsx)(I,{side:`top`,children:a}),t[9]=a,t[10]=d);let f;return t[11]!==u||t[12]!==d?(f=(0,K.jsxs)(L,{children:[u,d]}),t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function Le(e){let t=(0,W.c)(5),{identifiers:n,focusable:r}=e,i=r===void 0||r;if(n.length===0)return null;let a;t[0]===n?a=t[1]:(a=n.length===1?`Unknown condition: ${n[0]}`:`Unknown conditions: ${n.join(`, `)}`,t[0]=n,t[1]=a);let o=a,s;return t[2]!==i||t[3]!==o?(s=(0,K.jsx)(Ie,{label:o,focusable:i,className:`size-4.5`,children:`P4 Code does not recognize this condition yet. It can still be saved, but it may not match unless the runtime provides it.`}),t[2]=i,t[3]=o,t[4]=s):s=t[4],s}function X(e){let t=(0,W.c)(4),{labels:n}=e;if(n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.length===1?`Conflicts with ${n[0]}.`:`Conflicts with ${n.slice(0,3).join(`, `)}${n.length>3?`, and more`:``}.`,t[0]=n,t[1]=r);let i=r,a;return t[2]===i?a=t[3]:(a=(0,K.jsxs)(Ie,{label:i,children:[i,` The most recent matching binding wins when both conditions can apply.`]}),t[2]=i,t[3]=a),a}function Re(e){let t=(0,W.c)(25),{value:n,variables:r,unknownIdentifiers:i,onChange:a}=e,o;if(t[0]!==n||t[1]!==r){let e;t[3]===n?e=t[4]:(e=e=>e===n,t[3]=n,t[4]=e),o=r.find(e),t[0]=n,t[1]=r,t[2]=o}else o=t[2];let s=o,c;t[5]!==s||t[6]!==n||t[7]!==r?(c=s||r.some(e=>e===n)?r:[n,...r],t[5]=s,t[6]=n,t[7]=r,t[8]=c):c=t[8];let l=c,u;t[9]===a?u=t[10]:(u=e=>e&&a(e),t[9]=a,t[10]=u);let d;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(E,{placeholder:`Condition`}),t[11]=d):d=t[11];let f;t[12]===i?f=t[13]:(f=i&&i.length>0?(0,K.jsx)(Le,{identifiers:i,focusable:!1}):null,t[12]=i,t[13]=f);let p;t[14]===f?p=t[15]:(p=(0,K.jsxs)(O,{size:`compact`,className:`min-w-0 flex-1`,children:[d,f]}),t[14]=f,t[15]=p);let m;t[16]===l?m=t[17]:(m=l.map(ze),t[16]=l,t[17]=m);let h;t[18]===m?h=t[19]:(h=(0,K.jsx)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:m}),t[18]=m,t[19]=h);let g;return t[20]!==u||t[21]!==p||t[22]!==h||t[23]!==n?(g=(0,K.jsxs)(k,{value:n,onValueChange:u,children:[p,h]}),t[20]=u,t[21]=p,t[22]=h,t[23]=n,t[24]=g):g=t[24],g}function ze(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:e})},e)}function Be(e){let t=(0,W.c)(14),{label:n,className:r,onRemove:i}=e,a;t[0]===r?a=t[1]:(a=b(`size-7`,r),t[0]=r,t[1]=a);let o;t[2]!==n||t[3]!==i||t[4]!==a?(o=(0,K.jsx)(f,{type:`button`,variant:`ghost`,size:`icon-sm`,className:a,"aria-label":n,onClick:i}),t[2]=n,t[3]=i,t[4]=a,t[5]=o):o=t[5];let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(m,{"aria-hidden":!0,className:`size-3.5`}),t[6]=s):s=t[6];let c;t[7]===o?c=t[8]:(c=(0,K.jsx)(F,{delay:200,render:o,children:s}),t[7]=o,t[8]=c);let l;t[9]===n?l=t[10]:(l=(0,K.jsx)(I,{side:`top`,children:n}),t[9]=n,t[10]=l);let u;return t[11]!==c||t[12]!==l?(u=(0,K.jsxs)(L,{children:[c,l]}),t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function Z(e){let t=(0,W.c)(81),{node:n,variables:r,depth:i,onChange:a,onRemove:o}=e,s=i===void 0?0:i,c;if(t[0]!==s||t[1]!==n||t[2]!==a||t[3]!==o||t[4]!==r){c=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Me(n);if(e){let i=Ce(e.identifier)?[]:[e.identifier],l;t[6]!==n||t[7]!==a?(l=e=>a(Pe(n,e)),t[6]=n,t[7]=a,t[8]=l):l=t[8];let u=`Negate ${e.identifier}`,d;t[9]!==e||t[10]!==l||t[11]!==u?(d=(0,K.jsx)(R,{pressed:e.negated,onPressedChange:l,"aria-label":u,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[9]=e,t[10]=l,t[11]=u,t[12]=d):d=t[12];let f;t[13]!==n||t[14]!==a?(f=e=>a(Ne(n,e)),t[13]=n,t[14]=a,t[15]=f):f=t[15];let p;t[16]!==e||t[17]!==f||t[18]!==i||t[19]!==r?(p=(0,K.jsx)(Re,{value:e.identifier,variables:r,unknownIdentifiers:i,onChange:f}),t[16]=e,t[17]=f,t[18]=i,t[19]=r,t[20]=p):p=t[20];let m;t[21]!==s||t[22]!==n||t[23]!==o?(m=o?(0,K.jsx)(Be,{label:H(n,s),onRemove:o}):null,t[21]=s,t[22]=n,t[23]=o,t[24]=m):m=t[24];let h;t[25]!==d||t[26]!==p||t[27]!==m?(h=(0,K.jsxs)(`div`,{className:`flex items-center gap-2 rounded-md border border-border/70 bg-background/60 px-2 py-2`,children:[d,p,m]}),t[25]=d,t[26]=p,t[27]=m,t[28]=h):h=t[28],c=h;break bb0}}t[0]=s,t[1]=n,t[2]=a,t[3]=o,t[4]=r,t[5]=c}else c=t[5];if(c!==Symbol.for(`react.early_return_sentinel`))return c;if(n.type===`not`){let e=s>0&&`border-border/50 bg-background/50`,i;t[29]===e?i=t[30]:(i=b(`space-y-2 rounded-lg border border-border/70 bg-muted/20 p-2`,e),t[29]=e,t[30]=i);let c;t[31]!==n||t[32]!==a?(c=(0,K.jsx)(R,{pressed:!0,onPressedChange:e=>a(e?n:n.node),"aria-label":`Negate group`,variant:`outline`,size:`compact`,className:`min-w-10`,children:`Not`}),t[31]=n,t[32]=a,t[33]=c):c=t[33];let l;t[34]!==s||t[35]!==n||t[36]!==o?(l=o?(0,K.jsx)(Be,{label:H(n,s),className:`ml-auto`,onRemove:o}):null,t[34]=s,t[35]=n,t[36]=o,t[37]=l):l=t[37];let u;t[38]!==c||t[39]!==l?(u=(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[c,l]}),t[38]=c,t[39]=l,t[40]=u):u=t[40];let d,f;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,K.jsx)(`span`,{className:`absolute top-0 bottom-0 left-1.5 w-px bg-border/70`,"aria-hidden":!0}),f=(0,K.jsx)(`span`,{className:`absolute top-4 left-1.5 h-px w-2.5 bg-border/70`,"aria-hidden":!0}),t[41]=d,t[42]=f):(d=t[41],f=t[42]);let p=s+1,m;t[43]===a?m=t[44]:(m=e=>a({type:`not`,node:e}),t[43]=a,t[44]=m);let h;t[45]!==n.node||t[46]!==p||t[47]!==m||t[48]!==r?(h=(0,K.jsxs)(`div`,{className:`relative pl-4`,children:[d,f,(0,K.jsx)(Z,{node:n.node,variables:r,depth:p,onChange:m})]}),t[45]=n.node,t[46]=p,t[47]=m,t[48]=r,t[49]=h):h=t[49];let g;return t[50]!==h||t[51]!==i||t[52]!==u?(g=(0,K.jsxs)(`div`,{className:i,children:[u,h]}),t[50]=h,t[51]=i,t[52]=u,t[53]=g):g=t[53],g}let l=n.type===`or`?`or`:`and`,u,d,p,m;if(t[54]!==s||t[55]!==n||t[56]!==a||t[57]!==o||t[58]!==l||t[59]!==r){let e=je(n,l),i=new Map,c=e.map(e=>{let t=`${e.type}-${U(e)}`,n=i.get(t)??0;return i.set(t,n+1),{child:e,key:n===0?t:`${t}-${n}`}}),h=(t,n)=>{let r=!1,i=J(e.map(e=>!r&&e===t?(r=!0,n):e),l);i&&a(i)},_=t=>{let n=!1,r=J(e.filter(e=>!n&&e===t?(n=!0,!1):!0),l);a(r||Y())},v=t=>{if(t===l)return;let n=J(e,t);n&&a(n)},y=()=>{let t=J([...e,Y()],l);t&&a(t)},x=()=>{let t={type:l===`and`?`or`:`and`,left:Y(),right:{type:`not`,node:Y()}},n=J([...e,t],l);n&&a(n)},S=s>0&&`border-border/70 bg-background/55`;t[64]===S?p=t[65]:(p=b(`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,K.jsx)(O,{size:`compact`,className:`w-24`,children:(0,K.jsx)(E,{})}),t[66]=C):C=t[66];let w;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,K.jsxs)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,children:[(0,K.jsx)(T,{value:`and`,children:`and`}),(0,K.jsx)(T,{value:`or`,children:`or`})]}),t[67]=w):w=t[67];let A;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,K.jsx)(g,{className:`size-3.5`}),t[68]=A):A=t[68];let j;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,K.jsx)(g,{className:`size-3.5`}),t[69]=j):j=t[69];let M;t[70]!==s||t[71]!==n||t[72]!==o?(M=o?(0,K.jsx)(Be,{label:H(n,s),className:`ml-auto`,onRemove:o}):null,t[70]=s,t[71]=n,t[72]=o,t[73]=M):M=t[73],m=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsxs)(k,{value:l,onValueChange:e=>v(e),children:[C,w]}),(0,K.jsxs)(f,{type:`button`,variant:`outline`,size:`compact`,onClick:y,children:[A,`Condition`]}),(0,K.jsxs)(f,{type:`button`,variant:`outline`,size:`compact`,onClick:x,children:[j,`Group`]}),M]}),u=`space-y-2`,d=c.map(e=>{let{child:t,key:n}=e;return(0,K.jsxs)(`div`,{className:`relative pl-4`,children:[(0,K.jsx)(`span`,{className:b(`absolute top-0 bottom-0 left-1.5 w-px`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,K.jsx)(`span`,{className:b(`absolute top-4 left-1.5 h-px w-2.5`,s===0?`bg-border`:`bg-border/70`),"aria-hidden":!0}),(0,K.jsx)(Z,{node:t,variables:r,depth:s+1,onChange:e=>h(t,e),onRemove:()=>_(t)})]},n)}),t[54]=s,t[55]=n,t[56]=a,t[57]=o,t[58]=l,t[59]=r,t[60]=u,t[61]=d,t[62]=p,t[63]=m}else u=t[60],d=t[61],p=t[62],m=t[63];let h;t[74]!==u||t[75]!==d?(h=(0,K.jsx)(`div`,{className:u,children:d}),t[74]=u,t[75]=d,t[76]=h):h=t[76];let _;return t[77]!==p||t[78]!==m||t[79]!==h?(_=(0,K.jsxs)(`div`,{className:p,children:[m,h]}),t[77]=p,t[78]=m,t[79]=h,t[80]=_):_=t[80],_}function Ve(e){let t=(0,W.c)(60),{value:n,variables:r,onChange:i,onValidityChange:a}=e,o;t[0]===n?o=t[1]:(o=U(n),t[0]=n,t[1]=o);let[s,l]=(0,G.useState)(o),u;t[2]===s?u=t[3]:(u=Te(s),t[2]=s,t[3]=u);let d=u,p=d.ok?null:d.message,m;t[4]!==d.ok||t[5]!==d.value?(m=d.ok?_e(d.value):[],t[4]=d.ok,t[5]=d.value,t[6]=m):m=t[6];let h=m,_;t[7]!==i||t[8]!==a?(_=e=>{l(e);let t=Te(e);a?.(t.ok),t.ok&&i(t.value)},t[7]=i,t[8]=a,t[9]=_):_=t[9];let v=_,y;t[10]!==i||t[11]!==a?(y=e=>{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=Fe(`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,K.jsx)(`div`,{className:`min-w-0`,children:(0,K.jsx)(`div`,{className:`text-sm font-medium text-foreground`,children:`When`})}),t[19]=T):T=t[19];let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,K.jsx)(g,{className:`size-3.5`}),t[20]=E):E=t[20];let D;t[21]===S?D=t[22]:(D=(0,K.jsxs)(f,{type:`button`,variant:`outline`,size:`compact`,onClick:S,children:[E,`Condition`]}),t[21]=S,t[22]=D);let O;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,K.jsx)(g,{className:`size-3.5`}),t[23]=O):O=t[23];let k;t[24]===w?k=t[25]:(k=(0,K.jsxs)(f,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[O,`Group`]}),t[24]=w,t[25]=k);let A;t[26]!==D||t[27]!==k?(A=(0,K.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[D,k]})]}),t[26]=D,t[27]=k,t[28]=A):A=t[28];let j;t[29]===v?j=t[30]:(j=e=>v(e.currentTarget.value),t[29]=v,t[30]=j);let M=!!p,ee;t[31]!==s||t[32]!==j||t[33]!==M?(ee=(0,K.jsx)(ce,{value:s,onChange:j,placeholder:`Always`,"aria-invalid":M,"aria-label":`When expression`,size:`compact`,font:`mono`}),t[31]=s,t[32]=j,t[33]=M,t[34]=ee):ee=t[34];let N;t[35]===h?N=t[36]:(N=h.length>0?(0,K.jsx)(se,{align:`inline-end`,children:(0,K.jsx)(Le,{identifiers:h})}):null,t[35]=h,t[36]=N);let te;t[37]!==ee||t[38]!==N?(te=(0,K.jsxs)(B,{children:[ee,N]}),t[37]=ee,t[38]=N,t[39]=te):te=t[39];let P;t[40]===p?P=t[41]:(P=p?(0,K.jsxs)(`div`,{className:`flex items-center gap-1.5 text-2xs text-destructive`,children:[(0,K.jsx)(c,{className:`size-3.5`}),p]}):null,t[40]=p,t[41]=P);let ne;t[42]!==te||t[43]!==P?(ne=(0,K.jsxs)(`div`,{className:`space-y-1.5`,children:[te,P]}),t[42]=te,t[43]=P,t[44]=ne):ne=t[44];let F;t[45]!==S||t[46]!==w||t[47]!==b||t[48]!==n||t[49]!==r?(F=n?(0,K.jsx)(Z,{node:n,variables:r,onChange:b,onRemove:()=>b(void 0)}):(0,K.jsx)(`div`,{className:`rounded-md border border-dashed border-border/80 bg-muted/15 p-3`,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,K.jsxs)(f,{type:`button`,size:`compact`,onClick:S,children:[(0,K.jsx)(g,{className:`size-3.5`}),`Condition`]}),(0,K.jsxs)(f,{type:`button`,variant:`outline`,size:`compact`,onClick:w,children:[(0,K.jsx)(g,{className:`size-3.5`}),`Group`]})]})}),t[45]=S,t[46]=w,t[47]=b,t[48]=n,t[49]=r,t[50]=F):F=t[50];let I;t[51]===p?I=t[52]:(I=p?(0,K.jsx)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center rounded-lg border border-destructive/30 bg-background/75 p-4 text-center text-xs text-destructive backdrop-blur-xs`,children:`Fix the expression above to continue editing visually.`}):null,t[51]=p,t[52]=I);let L;t[53]!==F||t[54]!==I?(L=(0,K.jsxs)(`div`,{className:`relative`,children:[F,I]}),t[53]=F,t[54]=I,t[55]=L):L=t[55];let R;return t[56]!==A||t[57]!==ne||t[58]!==L?(R=(0,K.jsxs)(`div`,{className:`w-[min(34rem,calc(100vw-2rem))] space-y-3`,children:[A,ne,L]}),t[56]=A,t[57]=ne,t[58]=L,t[59]=R):R=t[59],R}function He(e){return{keyDraft:e.key,whenDraft:e.binding.whenAst,isRecording:!1,isWhenDraftValid:!0}}function Q(e,t){return{...e,...t}}function Ue(e){return{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}}function We(e){let t=(0,W.c)(27),{row:n,allRows:r,onSave:i}=e,[a,o]=(0,G.useReducer)(Q,n,He),{keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u}=a,d,f,p;t[0]!==r||t[1]!==s||t[2]!==n.id||t[3]!==n.key||t[4]!==n.when||t[5]!==c?(p=U(c),d=s!==n.key||p!==n.when,f=ge(r,{rowId:n.id,key:s,when:p}),t[0]=r,t[1]=s,t[2]=n.id,t[3]=n.key,t[4]=n.when,t[5]=c,t[6]=d,t[7]=f,t[8]=p):(d=t[6],f=t[7],p=t[8]);let m=f,h;t[9]!==s||t[10]!==i||t[11]!==n||t[12]!==p?(h=()=>{i({command:n.command,key:s,when:p.trim().length>0?p:void 0,replace:Ue(n)})},t[9]=s,t[10]=i,t[11]=n,t[12]=p,t[13]=h):h=t[13];let g=h,_;t[14]!==l||t[15]!==n.key?(_=e=>{if(e.key===`Tab`&&!l)return;if(e.preventDefault(),e.key===`Escape`){o({keyDraft:n.key,isRecording:!1});return}let t=ye(e.nativeEvent,navigator.platform);t&&o({keyDraft:t,isRecording:!1})},t[14]=l,t[15]=n.key,t[16]=_):_=t[16];let v=_,y;return t[17]!==v||t[18]!==m||t[19]!==d||t[20]!==l||t[21]!==u||t[22]!==s||t[23]!==g||t[24]!==c||t[25]!==p?(y={keyDraft:s,whenDraft:c,isRecording:l,isWhenDraftValid:u,whenDraftExpression:p,isDirty:d,conflictLabels:m,setDraft:o,save:g,captureKeybinding:v},t[17]=v,t[18]=m,t[19]=d,t[20]=l,t[21]=u,t[22]=s,t[23]=g,t[24]=c,t[25]=p,t[26]=y):y=t[26],y}function Ge(e){let t=(0,W.c)(19),{row:n,editor:r,isSaving:i,pillClassName:a}=e,{keyDraft:o,isRecording:s,isDirty:c,isWhenDraftValid:l,setDraft:u,save:d,captureKeybinding: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,K.jsx)(f,{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]!==p||t[7]!==s||t[8]!==o||t[9]!==a||t[10]!==n.binding||t[11]!==n.command||t[12]!==n.key||t[13]!==u||t[14]!==m?(g=m?(0,K.jsx)(`button`,{type:`button`,onClick:()=>u({isRecording:!0}),"aria-label":`Edit shortcut for ${V(n.command)}: ${ie(n.binding.shortcut)}`,className:b(`inline-flex h-8 cursor-pointer items-center rounded-md border border-transparent px-1.5 sm:h-7 outline-none transition-colors hover:border-border/70 hover:bg-accent focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-inset focus-visible:ring-ring/24`,a),children:(0,K.jsx)(q,{value:n.key})}):(0,K.jsx)(re,{"data-keybinding-capture":``,autoFocus:s,"aria-label":`Keybinding for ${V(n.command)}`,value:s?``:o,placeholder:s?`Press shortcut`:`Unassigned`,size:`sm`,font:`mono`,className:`w-44`,onFocus:()=>u({isRecording:!0}),onBlur:()=>u({isRecording:!1}),onChange:e=>u({keyDraft:e.currentTarget.value}),onKeyDown:p}),t[6]=p,t[7]=s,t[8]=o,t[9]=a,t[10]=n.binding,t[11]=n.command,t[12]=n.key,t[13]=u,t[14]=m,t[15]=g):g=t[15];let _;return t[16]!==h||t[17]!==g?(_=(0,K.jsxs)(K.Fragment,{children:[h,g]}),t[16]=h,t[17]=g,t[18]=_):_=t[18],_}function $(e){let t=(0,W.c)(17),{label:n,expression:r,value:i,variables:o,onChange:s,onValidityChange:c}=e,l=r?`ghost`:`ghost-muted`,u;t[0]===l?u=t[1]:(u=(0,K.jsx)(f,{variant:l,size:`micro`,className:`min-w-0 shrink`}),t[0]=l,t[1]=u);let d=`Edit when clause for ${n}`,p=r||`Always`,m;t[2]===p?m=t[3]:(m=(0,K.jsx)(`span`,{className:`truncate font-mono`,children:p}),t[2]=p,t[3]=m);let h;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,K.jsx)(a,{className:`size-3.5 shrink-0 opacity-60`}),t[4]=h):h=t[4];let g;t[5]!==u||t[6]!==d||t[7]!==m?(g=(0,K.jsxs)(oe,{render:u,"aria-label":d,children:[m,h]}),t[5]=u,t[6]=d,t[7]=m,t[8]=g):g=t[8];let _;t[9]!==s||t[10]!==c||t[11]!==i||t[12]!==o?(_=(0,K.jsx)(ae,{align:`start`,sideOffset:6,children:(0,K.jsx)(Ve,{value:i,variables:o,onChange:s,onValidityChange:c})}),t[9]=s,t[10]=c,t[11]=i,t[12]=o,t[13]=_):_=t[13];let v;return t[14]!==g||t[15]!==_?(v=(0,K.jsxs)(z,{children:[g,_]}),t[14]=g,t[15]=_,t[16]=v):v=t[16],v}function Ke(e){let t=(0,W.c)(24),{row:n,isSaving:r,onReset:i,onRemove:a}=e,s=n.source===`Custom`&&n.defaultKey!==null,c=n.source!==`Default`;if(!s&&!c)return null;let p;t[0]===n.command?p=t[1]:(p=V(n.command),t[0]=n.command,t[1]=p);let m=`Actions for ${p}`,h;t[2]!==r||t[3]!==m?(h=(0,K.jsx)(f,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:r,"aria-label":m}),t[2]=r,t[3]=m,t[4]=h):h=t[4];let g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,K.jsx)(d,{className:`size-3.5`}),t[5]=g):g=t[5];let v;t[6]===h?v=t[7]:(v=(0,K.jsx)(l,{render:h,children:g}),t[6]=h,t[7]=v);let y;t[8]!==s||t[9]!==r||t[10]!==i||t[11]!==n?(y=s?(0,K.jsx)(u,{disabled:r,onClick:()=>i(n),children:`Reset to default`}):null,t[8]=s,t[9]=r,t[10]=i,t[11]=n,t[12]=y):y=t[12];let b;t[13]!==c||t[14]!==r||t[15]!==a||t[16]!==n?(b=c?(0,K.jsx)(u,{variant:`destructive`,disabled:r,onClick:()=>a(n),children:`Remove`}):null,t[13]=c,t[14]=r,t[15]=a,t[16]=n,t[17]=b):b=t[17];let x;t[18]!==y||t[19]!==b?(x=(0,K.jsxs)(_,{align:`end`,children:[y,b]}),t[18]=y,t[19]=b,t[20]=x):x=t[20];let S;return t[21]!==v||t[22]!==x?(S=(0,K.jsxs)(o,{children:[v,x]}),t[21]=v,t[22]=x,t[23]=S):S=t[23],S}function qe(e){let t=(0,W.c)(2),{source:n}=e;if(n===`Default`)return null;let r;return t[0]===n?r=t[1]:(r=(0,K.jsx)(s,{variant:`outline`,size:`sm`,children:n}),t[0]=n,t[1]=r),r}function Je(e){let t=(0,W.c)(13),{row:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,K.jsx)(`span`,{className:`flex items-center gap-2`}),t[0]=r):r=t[0];let i;t[1]===n.command?i=t[2]:(i=V(n.command),t[1]=n.command,t[2]=i);let a;t[3]===n.source?a=t[4]:(a=(0,K.jsx)(qe,{source:n.source}),t[3]=n.source,t[4]=a);let o;t[5]!==i||t[6]!==a?(o=(0,K.jsxs)(F,{render:r,children:[i,a]}),t[5]=i,t[6]=a,t[7]=o):o=t[7];let s;t[8]===n.command?s=t[9]:(s=(0,K.jsx)(I,{side:`top`,children:n.command}),t[8]=n.command,t[9]=s);let c;return t[10]!==o||t[11]!==s?(c=(0,K.jsxs)(L,{children:[o,s]}),t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function Ye(e){let t=(0,W.c)(13),{row:n,editor:r,variables:i}=e,a;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[0]=a):a=t[0];let o;t[1]===n.command?o=t[2]:(o=V(n.command),t[1]=n.command,t[2]=o);let s,c;t[3]===r?(s=t[4],c=t[5]):(s=e=>r.setDraft({whenDraft:e}),c=e=>r.setDraft({isWhenDraftValid:e}),t[3]=r,t[4]=s,t[5]=c);let l;return t[6]!==r.whenDraft||t[7]!==r.whenDraftExpression||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==i?(l=(0,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[a,(0,K.jsx)($,{label:o,expression:r.whenDraftExpression,value:r.whenDraft,variables:i,onChange:s,onValidityChange:c})]}),t[6]=r.whenDraft,t[7]=r.whenDraftExpression,t[8]=o,t[9]=s,t[10]=c,t[11]=i,t[12]=l):l=t[12],l}function Xe(e){let t=(0,W.c)(2),n;return t[0]===e?n=t[1]:(n=(0,K.jsx)(`span`,{className:`flex items-center opacity-0 transition-opacity group-focus-within/row:opacity-100 group-hover/row:opacity-100 has-data-popup-open:opacity-100 pointer-coarse:opacity-100`,children:(0,K.jsx)(Ke,{...e})}),t[0]=e,t[1]=n),n}function Ze(e){let t=(0,W.c)(30),{row:n,isSaving:r,anchorId:i,allRows:a,variables:o,onSave:s,onReset:c,onRemove:l}=e,u;t[0]!==a||t[1]!==s||t[2]!==n?(u={row:n,allRows:a,onSave:s},t[0]=a,t[1]=s,t[2]=n,t[3]=u):u=t[3];let d=We(u),f;t[4]===n?f=t[5]:(f=(0,K.jsx)(Je,{row:n}),t[4]=n,t[5]=f);let p;t[6]!==d||t[7]!==n||t[8]!==o?(p=(0,K.jsx)(Ye,{row:n,editor:d,variables:o}),t[6]=d,t[7]=n,t[8]=o,t[9]=p):p=t[9];let m;t[10]===d.conflictLabels?m=t[11]:(m=(0,K.jsx)(X,{labels:d.conflictLabels}),t[10]=d.conflictLabels,t[11]=m);let h;t[12]!==r||t[13]!==l||t[14]!==c||t[15]!==n?(h=(0,K.jsx)(Xe,{row:n,isSaving:r,onReset:c,onRemove:l}),t[12]=r,t[13]=l,t[14]=c,t[15]=n,t[16]=h):h=t[16];let g;t[17]!==d||t[18]!==r||t[19]!==n?(g=(0,K.jsx)(Ge,{row:n,editor:d,isSaving:r,pillClassName:`-mr-1.5`}),t[17]=d,t[18]=r,t[19]=n,t[20]=g):g=t[20];let _;t[21]!==m||t[22]!==h||t[23]!==g?(_=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[m,h,g]}),t[21]=m,t[22]=h,t[23]=g,t[24]=_):_=t[24];let v;return t[25]!==i||t[26]!==f||t[27]!==p||t[28]!==_?(v=(0,K.jsx)(pe,{id:i,className:`group/row rounded-none`,title:f,description:p,control:_}),t[25]=i,t[26]=f,t[27]=p,t[28]=_,t[29]=v):v=t[29],v}function Qe(e){let t=(0,W.c)(30),{allRows:n,onSave:r}=e,[i,a]=(0,G.useState)(``),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o={keyDraft:``,whenDraft:void 0,isRecording:!1,isWhenDraftValid:!0},t[0]=o):o=t[0];let[s,c]=(0,G.useReducer)(Q,o),{keyDraft:l,whenDraft:u,isRecording:d,isWhenDraftValid:f}=s,p,m;t[1]!==n||t[2]!==l||t[3]!==u?(m=U(u),p=ge(n,{rowId:`new`,key:l,when:m}),t[1]=n,t[2]=l,t[3]=u,t[4]=p,t[5]=m):(p=t[4],m=t[5]);let h=p,g;t[6]===i?g=t[7]:(g=i?V(i):`new keybinding`,t[6]=i,t[7]=g);let _=g,v;t[8]!==i||t[9]!==f||t[10]!==l?(v=!!i&&l.trim().length>0&&f,t[8]=i,t[9]=f,t[10]=l,t[11]=v):v=t[11];let y=v,b;t[12]!==i||t[13]!==l||t[14]!==r||t[15]!==m?(b=()=>{i&&r({command:i,key:l,...m.trim().length>0?{when:m}:{}})},t[12]=i,t[13]=l,t[14]=r,t[15]=m,t[16]=b):b=t[16];let x=b,S;t[17]===d?S=t[18]:(S=e=>{if(e.key===`Tab`&&!d)return;if(e.preventDefault(),e.key===`Escape`){c({keyDraft:``,isRecording:!1});return}let t=ye(e.nativeEvent,navigator.platform);t&&c({keyDraft:t,isRecording:!1})},t[17]=d,t[18]=S);let C=S,w;return t[19]!==y||t[20]!==C||t[21]!==i||t[22]!==_||t[23]!==h||t[24]!==d||t[25]!==l||t[26]!==x||t[27]!==u||t[28]!==m?(w={commandDraft:i,setCommandDraft:a,keyDraft:l,whenDraft:u,whenDraftExpression:m,isRecording:d,conflictLabels:h,commandLabelText:_,canSave:y,setDraft:c,save:x,captureKeybinding:C},t[19]=y,t[20]=C,t[21]=i,t[22]=_,t[23]=h,t[24]=d,t[25]=l,t[26]=x,t[27]=u,t[28]=m,t[29]=w):w=t[29],w}function $e(e){let t=(0,W.c)(14),{draft:n,commandOptions:r,className:i}=e,a=n.commandDraft,o;t[0]===n?o=t[1]:(o=e=>n.setCommandDraft(e),t[0]=n,t[1]=o);let s;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(E,{placeholder:`Command`}),t[2]=s):s=t[2];let c;t[3]===i?c=t[4]:(c=(0,K.jsx)(O,{size:`sm`,className:i,children:s}),t[3]=i,t[4]=c);let l;t[5]===r?l=t[6]:(l=r.map(et),t[5]=r,t[6]=l);let u;t[7]===l?u=t[8]:(u=(0,K.jsx)(D,{alignItemWithTrigger:!1,matchTriggerWidth:!1,className:`max-h-72`,children:l}),t[7]=l,t[8]=u);let d;return t[9]!==n.commandDraft||t[10]!==o||t[11]!==c||t[12]!==u?(d=(0,K.jsxs)(k,{value:a,onValueChange:o,children:[c,u]}),t[9]=n.commandDraft,t[10]=o,t[11]=c,t[12]=u,t[13]=d):d=t[13],d}function et(e){return(0,K.jsx)(T,{value:e,className:`w-full`,children:(0,K.jsx)(`span`,{className:`truncate`,children:V(e)})},e)}function tt(e){let t=(0,W.c)(14),{draft:n,autoFocus:r,className:i}=e,a=r!==void 0&&r,o=`Keybinding for ${n.commandLabelText}`,s=n.isRecording?``:n.keyDraft,c=n.isRecording?`Press shortcut`:`Unassigned`,l,u,d;t[0]===n?(l=t[1],u=t[2],d=t[3]):(l=()=>n.setDraft({isRecording:!0}),u=()=>n.setDraft({isRecording:!1}),d=e=>n.setDraft({keyDraft:e.currentTarget.value}),t[0]=n,t[1]=l,t[2]=u,t[3]=d);let f;return t[4]!==a||t[5]!==i||t[6]!==n.captureKeybinding||t[7]!==o||t[8]!==s||t[9]!==c||t[10]!==l||t[11]!==u||t[12]!==d?(f=(0,K.jsx)(re,{"data-keybinding-capture":``,autoFocus:a,"aria-label":o,value:s,placeholder:c,size:`sm`,font:`mono`,className:i,onFocus:l,onBlur:u,onChange:d,onKeyDown:n.captureKeybinding}),t[4]=a,t[5]=i,t[6]=n.captureKeybinding,t[7]=o,t[8]=s,t[9]=c,t[10]=l,t[11]=u,t[12]=d,t[13]=f):f=t[13],f}function nt(e){let t=(0,W.c)(10),{draft:n,variables:r}=e,i,a;t[0]===n?(i=t[1],a=t[2]):(i=e=>n.setDraft({whenDraft:e}),a=e=>n.setDraft({isWhenDraftValid:e}),t[0]=n,t[1]=i,t[2]=a);let o;return t[3]!==n.commandLabelText||t[4]!==n.whenDraft||t[5]!==n.whenDraftExpression||t[6]!==i||t[7]!==a||t[8]!==r?(o=(0,K.jsx)($,{label:n.commandLabelText,expression:n.whenDraftExpression,value:n.whenDraft,variables:r,onChange:i,onValidityChange:a}),t[3]=n.commandLabelText,t[4]=n.whenDraft,t[5]=n.whenDraftExpression,t[6]=i,t[7]=a,t[8]=r,t[9]=o):o=t[9],o}function rt(e){let t=(0,W.c)(9),{isSaving:n,onCancel:r}=e,i;t[0]!==n||t[1]!==r?(i=(0,K.jsx)(f,{type:`button`,variant:`ghost-muted`,size:`icon-sm`,disabled:n,"aria-label":`Cancel new keybinding`,onClick:r}),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,K.jsx)(x,{className:`size-3.5`}),t[3]=a):a=t[3];let o;t[4]===i?o=t[5]:(o=(0,K.jsx)(F,{render:i,children:a}),t[4]=i,t[5]=o);let s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,K.jsx)(I,{side:`top`,children:`Cancel`}),t[6]=s):s=t[6];let c;return t[7]===o?c=t[8]:(c=(0,K.jsxs)(L,{children:[o,s]}),t[7]=o,t[8]=c),c}function it(e){let t=(0,W.c)(30),{commandOptions:n,allRows:r,variables:i,isSaving:a,onSave:o,onCancel:s}=e,c;t[0]!==r||t[1]!==o?(c={allRows:r,onSave:o},t[0]=r,t[1]=o,t[2]=c):c=t[2];let l=Qe(c),u;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,K.jsx)(`span`,{className:`text-xs leading-none text-muted-foreground/70`,children:`When`}),t[3]=u):u=t[3];let d;t[4]!==l||t[5]!==i?(d=(0,K.jsxs)(`span`,{className:`flex h-6 items-center gap-1.5`,children:[u,(0,K.jsx)(nt,{draft:l,variables:i})]}),t[4]=l,t[5]=i,t[6]=d):d=t[6];let p;t[7]!==n||t[8]!==l?(p=(0,K.jsx)($e,{draft:l,commandOptions:n,className:`w-56`}),t[7]=n,t[8]=l,t[9]=p):p=t[9];let m;t[10]===l.conflictLabels?m=t[11]:(m=(0,K.jsx)(X,{labels:l.conflictLabels}),t[10]=l.conflictLabels,t[11]=m);let h;t[12]===l?h=t[13]:(h=(0,K.jsx)(tt,{draft:l,className:`w-44`}),t[12]=l,t[13]=h);let g=a||!l.canSave,_=a?`Saving`:`Save`,v;t[14]!==l.save||t[15]!==g||t[16]!==_?(v=(0,K.jsx)(f,{size:`sm`,disabled:g,onClick:l.save,children:_}),t[14]=l.save,t[15]=g,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==a||t[19]!==s?(y=(0,K.jsx)(rt,{isSaving:a,onCancel:s}),t[18]=a,t[19]=s,t[20]=y):y=t[20];let b;t[21]!==p||t[22]!==m||t[23]!==h||t[24]!==v||t[25]!==y?(b=(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[p,m,h,v,y]}),t[21]=p,t[22]=m,t[23]=h,t[24]=v,t[25]=y,t[26]=b):b=t[26];let x;return t[27]!==b||t[28]!==d?(x=(0,K.jsx)(pe,{className:`bg-muted/15`,title:`New keybinding`,description:d,control:b}),t[27]=b,t[28]=d,t[29]=x):x=t[29],x}function at(e){let{groups:t,anchorIds:n,savingCommand:r,...i}=e;return t.map(e=>(0,K.jsx)(he,{id:`keybindings-${e.id}`,title:e.title,children:e.rows.map(e=>(0,K.jsx)(Ze,{row:e,anchorId:n.get(e.id),isSaving:r===e.command,...i},e.id))},e.id))}function ot(){let e=(0,W.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,K.jsxs)(L,{children:[(0,K.jsx)(F,{delay:200,render:(0,K.jsx)(f,{size:`icon-micro`,variant:`ghost-muted`,"aria-label":`The browser may claim some shortcuts first. The desktop app receives them all.`,children:(0,K.jsx)(v,{className:`size-3.5 text-warning`})})}),(0,K.jsx)(I,{side:`top`,className:`max-w-72`,children:`The browser may claim some shortcuts first. The desktop app receives them all.`})]}),e[0]=t):t=e[0],t}function st(){let e=(0,W.c)(83),{environment:t,connectedEnvironments:n}=fe(),r=ee(t?.environmentId??null,y),a=te(n,h),o;e[0]!==n||e[1]!==a?(o=n.length>0&&n.every(e=>a.has(e.environmentId)),e[0]=n,e[1]=a,e[2]=o):o=e[2];let s=o,c=t?.serverConfig?.keybindings,l;e[3]===c?l=e[4]:(l=c??[],e[3]=c,e[4]=l);let u;e[5]===l?u=e[6]:(u=i(l),e[5]=l,e[6]=u);let d=u,p=t?.serverConfig?.keybindingsConfigPath??null,m;e[7]===t?.serverConfig?.availableEditors?m=e[8]:(m=t?.serverConfig?.availableEditors??[],e[7]=t?.serverConfig?.availableEditors,e[8]=m);let _=m,v;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(v={reportFailure:!1},e[9]=v):v=e[9];let b=P(M.upsertKeybinding,v),x;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(x={reportFailure:!1},e[10]=x):x=e[10];let T=P(M.removeKeybinding,x),E=De(t?.environmentId??null,_),[D,O]=(0,G.useState)(``),k=(0,G.useRef)(null),[R,re]=(0,G.useState)(null),[ie,ae]=(0,G.useState)(!1),oe;e[11]!==d||e[12]!==D?(oe=Se(d,D),e[11]=d,e[12]=D,e[13]=oe):oe=e[13];let z=oe,se;e[14]===z?se=e[15]:(se=xe(z),e[14]=z,e[15]=se);let ce=se,B;if(e[16]!==z){B=new Map;let t=new Set;for(let e of z)t.has(e.command)||(t.add(e.command),B.set(e.id,Oe(e.command)));e[16]=z,e[17]=B}else B=e[17];let le=B,ue;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(ue={select:ft},e[18]=ue):ue=e[18];let pe=A(ue),[V,ge]=(0,G.useState)(pe);pe!==V&&(ge(pe),pe.startsWith(`keybinding-`)&&O(``));let _e;e[19]===d?_e=e[20]:(_e=be(d),e[19]=d,e[20]=_e);let ye=_e,H;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(H=ve(),e[21]=H):H=e[21];let U=H,Ce;e[22]!==p||e[23]!==E||e[24]!==t?(Ce=()=>{p&&t&&N(t.environmentId,`orchestration:operate`)&&(async()=>{let e=await E(p);if(e._tag===`Success`||C(e))return;let t=w(e);j.add({title:`Unable to open keybindings file`,description:t instanceof Error?t.message:`The keybindings file was not opened.`,type:`error`})})()},e[22]=p,e[23]=E,e[24]=t,e[25]=Ce):Ce=e[25];let we=Ce,Te;e[26]!==n||e[27]!==t||e[28]!==b?(Te=e=>{if(!t||!n.every(dt))return;re(e.command);let r={command:e.command,key:e.key.trim(),...e.when?.trim()?{when:e.when.trim()}:{},...e.replace?{replace:e.replace}:{}};(async()=>{let e=await Promise.all(n.map(e=>b({environmentId:e.environmentId,input:r})));re(null);let t=e.find(ut);if(!t)ae(!1);else if(!C(t)){let e=w(t);j.add({title:`Unable to save keybinding`,description:e instanceof Error?e.message:`The keybinding was not saved.`,type:`error`})}})()},e[26]=n,e[27]=t,e[28]=b,e[29]=Te):Te=e[29];let q=Te,ke;e[30]!==n||e[31]!==t||e[32]!==T?(ke=e=>{t&&n.every(lt)&&(re(e.command),(async()=>{let t=await Promise.all(n.map(t=>T({environmentId:t.environmentId,input:Ue(e)})));re(null);let r=t.find(ct)??t[0];if(r?._tag===`Failure`&&!C(r)){let e=w(r);j.add({title:`Unable to remove keybinding`,description:e instanceof Error?e.message:`The keybinding was not removed.`,type:`error`})}})())},e[30]=n,e[31]=t,e[32]=T,e[33]=ke):ke=e[33];let je=ke,J;e[34]===q?J=e[35]:(J=e=>{e.defaultKey&&q({command:e.command,key:e.defaultKey,when:e.defaultWhen.trim().length>0?e.defaultWhen:void 0,replace:{command:e.command,key:e.key,...e.when.trim().length>0?{when:e.when}:{}}})},e[34]=q,e[35]=J);let Me=J,Ne;e[36]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=()=>ae(!1),e[36]=Ne):Ne=e[36];let Pe=Ne,Y;e[37]!==je||e[38]!==Me||e[39]!==z||e[40]!==q?(Y={allRows:z,variables:U,onSave:q,onReset:Me,onRemove:je},e[37]=je,e[38]=Me,e[39]=z,e[40]=q,e[41]=Y):Y=e[41];let Fe=Y,Ie,Le;e[42]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=Ee(`keybindings`),Le=ne?null:(0,K.jsx)(ot,{}),e[42]=Ie,e[43]=Le):(Ie=e[42],Le=e[43]);let X;e[44]===D?X=e[45]:(X=(0,K.jsx)(Ae,{query:D,onChange:O,inputRef:k}),e[44]=D,e[45]=X);let Re=ie||!s,ze,Be;e[46]===Symbol.for(`react.memo_cache_sentinel`)?(ze=()=>ae(!0),Be=(0,K.jsx)(g,{"aria-hidden":!0,className:`size-4`}),e[46]=ze,e[47]=Be):(ze=e[46],Be=e[47]);let Z;e[48]===Re?Z=e[49]:(Z=(0,K.jsxs)(f,{type:`button`,variant:`outline`,disabled:Re,onClick:ze,children:[Be,`Add keybinding`]}),e[48]=Re,e[49]=Z);let Ve=!p||!r,He;e[50]===Symbol.for(`react.memo_cache_sentinel`)?(He=(0,K.jsx)(S,{"aria-hidden":!0,className:`size-4`}),e[50]=He):He=e[50];let Q;e[51]!==we||e[52]!==Ve?(Q=(0,K.jsx)(F,{render:(0,K.jsx)(f,{type:`button`,variant:`outline`,size:`icon`,disabled:Ve,onClick:we,"aria-label":`Open keybindings.json`,children:He})}),e[51]=we,e[52]=Ve,e[53]=Q):Q=e[53];let We;e[54]===Symbol.for(`react.memo_cache_sentinel`)?(We=(0,K.jsx)(I,{side:`top`,children:`Open keybindings.json`}),e[54]=We):We=e[54];let Ge;e[55]===Q?Ge=e[56]:(Ge=(0,K.jsxs)(L,{children:[Q,We]}),e[55]=Q,e[56]=Ge);let $;e[57]!==X||e[58]!==Z||e[59]!==Ge?($=(0,K.jsx)(he,{...Ie,headerAction:Le,children:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-3 py-3 sm:px-4`,children:[X,Z,Ge]})}),e[57]=X,e[58]=Z,e[59]=Ge,e[60]=$):$=e[60];let Ke;e[61]!==s||e[62]!==n?(Ke=s?null:(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.length===0?`Connect an environment to change keybindings.`:`This connection can view keybindings but cannot change them.`}),e[61]=s,e[62]=n,e[63]=Ke):Ke=e[63];let qe=!s,Je;e[64]!==ye||e[65]!==ie||e[66]!==z||e[67]!==q||e[68]!==R?(Je=ie?(0,K.jsx)(de,{children:(0,K.jsx)(it,{commandOptions:ye,allRows:z,variables:U,isSaving:R!==null,onSave:q,onCancel:Pe})}):null,e[64]=ye,e[65]=ie,e[66]=z,e[67]=q,e[68]=R,e[69]=Je):Je=e[69];let Ye;e[70]!==le||e[71]!==ce||e[72]!==Fe||e[73]!==R?(Ye=ce.length>0?(0,K.jsx)(at,{groups:ce,anchorIds:le,savingCommand:R,...Fe}):(0,K.jsx)(de,{children:(0,K.jsx)(`div`,{className:`px-4 py-12 text-center text-sm text-muted-foreground`,children:`No keybindings match your search.`})}),e[70]=le,e[71]=ce,e[72]=Fe,e[73]=R,e[74]=Ye):Ye=e[74];let Xe;e[75]!==qe||e[76]!==Je||e[77]!==Ye?(Xe=(0,K.jsxs)(`div`,{inert:qe,className:`flex flex-col gap-8`,children:[Je,Ye]}),e[75]=qe,e[76]=Je,e[77]=Ye,e[78]=Xe):Xe=e[78];let Ze;return e[79]!==$||e[80]!==Ke||e[81]!==Xe?(Ze=(0,K.jsxs)(me,{children:[$,Ke,Xe]}),e[79]=$,e[80]=Ke,e[81]=Xe,e[82]=Ze):Ze=e[82],Ze}function ct(e){return e._tag===`Failure`}function lt(e){return N(e.environmentId,h)}function ut(e){return e._tag===`Failure`}function dt(e){return N(e.environmentId,h)}function ft(e){return e.hash.replace(/^#/,``)}var pt=st;export{pt as component};
2
+ //# sourceMappingURL=settings.keybindings-CU8fBQaI.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{Nd as i,dr as a,sf as o,um as s}from"./utils-D19Exirm.js";import{a as c,n as l,t as u}from"./tooltip-DsRaXpYk.js";import{n as d,r as f,t as p}from"./input-group-APyqVexM.js";import{i as m,s as h}from"./settingsLayout-BWJVQUbK.js";import{co as g,lo as _,so as v}from"./main-CVSzIqPv.js";var y=e(t(),1),b=n();function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function C(e){if(typeof e!=`string`)return!1;try{let t=new URL(e).protocol;return t===`http:`||t===`https:`}catch{return!1}}function w(e,t){if(!x(e))throw Error(`License entry ${String(t+1)} is not an object.`);if(!S(e.bundles)||e.bundles.length===0||e.kind!==`custom`&&e.kind!==`package`||typeof e.license!=`string`||typeof e.name!=`string`||typeof e.noticeText!=`string`||e.sourceUrl!==null&&!C(e.sourceUrl)||e.version!==null&&typeof e.version!=`string`)throw Error(`License entry ${String(t+1)} has an invalid shape.`);return{bundles:e.bundles,kind:e.kind,license:e.license,name:e.name,noticeText:e.noticeText,sourceUrl:e.sourceUrl,version:e.version}}function T(e){if(!x(e)||e.schemaVersion!==1||!Array.isArray(e.entries))throw Error(`The open-source license manifest has an unsupported format.`);let t=e.entries.map(w),n=new Set;for(let e of t){let t=k(e);if(n.has(t))throw Error(`The open-source license manifest contains a duplicate entry: ${t}`);n.add(t)}return{schemaVersion:1,entries:t}}function E(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(e=>e.length>0);return n.length===0?e:e.filter(e=>{let t=[e.name,e.version,e.license,...e.bundles].filter(e=>e!==null).join(` `).toLowerCase();return n.every(e=>t.includes(e))})}var D={android:`Android`,assets:`Assets`,desktop:`Desktop`,"device-tools":`Device tools`,ios:`iOS`,mobile:`Mobile`,server:`Server`,web:`Web`};function O(e){return e.map(e=>Object.prototype.hasOwnProperty.call(D,e)?D[e]:e).join(`, `)}function k(e){return encodeURIComponent(JSON.stringify([e.kind,e.name,e.version]))}var A=e(r(),1),j;async function M(){let e=AbortSignal.timeout(3e4);try{let t=await fetch(`${`/`.replace(/\/$/,``)}/third-party-licenses.json`,{signal:e});if(!t.ok)throw Error(`The license manifest request failed with status ${String(t.status)}.`);return T(await t.json())}catch(t){throw e.aborted?Error(`The license manifest took too long to load.`,{cause:t}):t}}function N(){return j??=M().catch(e=>{throw j=void 0,e}),j}function P(e){let t=(0,b.c)(34),{entry:n,open:r,onOpenChange:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,A.jsx)(i,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-200 group-data-panel-open:rotate-90`}),t[0]=c):c=t[0];let l;t[1]===n.name?l=t[2]:(l=(0,A.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:n.name}),t[1]=n.name,t[2]=l);let u;t[3]===n.version?u=t[4]:(u=n.version?(0,A.jsx)(`code`,{className:`shrink-0 text-xs text-muted-foreground`,children:n.version}):null,t[3]=n.version,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,A.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[l,u]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f=n.license,p;t[8]===n.bundles?p=t[9]:(p=O(n.bundles),t[8]=n.bundles,t[9]=p);let m;t[10]!==n.license||t[11]!==p?(m=(0,A.jsxs)(`span`,{className:`max-w-[42%] shrink-0 truncate text-xs text-muted-foreground`,children:[f,` · `,p]}),t[10]=n.license,t[11]=p,t[12]=m):m=t[12];let h;t[13]!==d||t[14]!==m?(h=(0,A.jsxs)(_,{className:`group flex min-h-10 min-w-0 flex-1 items-center gap-2.5 px-3 text-left sm:min-h-9 sm:px-4`,children:[c,d,m]}),t[13]=d,t[14]=m,t[15]=h):h=t[15];let y;t[16]!==n.name||t[17]!==n.sourceUrl?(y=n.sourceUrl?(0,A.jsx)(a,{"aria-label":`View project source for ${n.name}`,className:`me-3 shrink-0 sm:me-4`,render:(0,A.jsx)(`a`,{href:n.sourceUrl,rel:`noreferrer noopener`,target:`_blank`}),size:`icon-micro`,title:`Project source`,variant:`ghost-muted`,children:(0,A.jsx)(o,{"aria-hidden":!0,className:`size-3`})}):null,t[16]=n.name,t[17]=n.sourceUrl,t[18]=y):y=t[18];let x;t[19]!==h||t[20]!==y?(x=(0,A.jsxs)(`div`,{className:`flex min-h-10 items-center hover:bg-muted/35 sm:min-h-9`,children:[h,y]}),t[19]=h,t[20]=y,t[21]=x):x=t[21];let S;t[22]!==n.noticeText||t[23]!==r?(S=r?(0,A.jsx)(`div`,{className:`px-9 pt-1 pb-4 sm:px-10`,children:(0,A.jsx)(`pre`,{className:`max-w-[76ch] whitespace-pre-wrap break-words font-mono text-xs/5 text-foreground/80`,children:n.noticeText})}):null,t[22]=n.noticeText,t[23]=r,t[24]=S):S=t[24];let C;t[25]===S?C=t[26]:(C=(0,A.jsx)(g,{children:S}),t[25]=S,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,A.jsxs)(`article`,{children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==s||t[31]!==r||t[32]!==w?(T=(0,A.jsx)(v,{open:r,onOpenChange:s,children:w}),t[30]=s,t[31]=r,t[32]=w,t[33]=T):T=t[33],T}function F(e){let t=(0,b.c)(2),{filteredCount:n,totalCount:r}=e,i=n===r?`${String(r)} notices`:`${String(n)} of ${String(r)}`,a;return t[0]===i?a=t[1]:(a=(0,A.jsx)(`p`,{className:`whitespace-nowrap text-xs font-normal text-muted-foreground tabular-nums`,children:i}),t[0]=i,t[1]=a),a}function I(e){let t=(0,b.c)(34),{query:n,onQueryChange:r,searchOpen:i,onSearchOpenChange:o,filteredCount:m,totalCount:h}=e;if(!i){let e;t[0]!==m||t[1]!==h?(e=(0,A.jsx)(F,{filteredCount:m,totalCount:h}),t[0]=m,t[1]=h,t[2]=e):e=t[2];let n;t[3]===o?n=t[4]:(n=()=>o(!0),t[3]=o,t[4]=n);let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,A.jsx)(s,{className:`size-3`}),t[5]=r):r=t[5];let i;t[6]===n?i=t[7]:(i=(0,A.jsx)(c,{render:(0,A.jsx)(a,{"aria-label":`Search open-source licenses`,onClick:n,size:`icon-micro`,type:`button`,variant:`ghost-muted`,children:r})}),t[6]=n,t[7]=i);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,A.jsx)(l,{side:`top`,children:`Search licenses`}),t[8]=d):d=t[8];let f;t[9]===i?f=t[10]:(f=(0,A.jsxs)(u,{children:[i,d]}),t[9]=i,t[10]=f);let p;return t[11]!==e||t[12]!==f?(p=(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e,f]}),t[11]=e,t[12]=f,t[13]=p):p=t[13],p}let g;t[14]!==m||t[15]!==h?(g=(0,A.jsx)(`div`,{className:`hidden sm:block`,children:(0,A.jsx)(F,{filteredCount:m,totalCount:h})}),t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,A.jsx)(d,{children:(0,A.jsx)(s,{"aria-hidden":!0,className:`size-3`})}),t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==n.length?(v=()=>{n.length===0&&o(!1)},t[18]=o,t[19]=n.length,t[20]=v):v=t[20];let y;t[21]===r?y=t[22]:(y=e=>r(e.currentTarget.value),t[21]=r,t[22]=y);let x;t[23]!==r||t[24]!==o?(x=e=>{e.key===`Escape`&&(e.preventDefault(),r(``),o(!1))},t[23]=r,t[24]=o,t[25]=x):x=t[25];let S;t[26]!==n||t[27]!==v||t[28]!==y||t[29]!==x?(S=(0,A.jsxs)(p,{className:`w-36 sm:w-44`,children:[_,(0,A.jsx)(f,{"aria-label":`Search open-source licenses`,autoFocus:!0,onBlur:v,onChange:y,onKeyDown:x,placeholder:`Search licenses`,size:`sm`,type:`search`,value:n})]}),t[26]=n,t[27]=v,t[28]=y,t[29]=x,t[30]=S):S=t[30];let C;return t[31]!==g||t[32]!==S?(C=(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[g,S]}),t[31]=g,t[32]=S,t[33]=C):C=t[33],C}function L(e){let t=(0,b.c)(8),{message:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,A.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:`Open-source notices are unavailable`}),t[0]=i):i=t[0];let o;t[1]===n?o=t[2]:(o=(0,A.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[i,(0,A.jsx)(`p`,{className:`max-w-[70ch] text-pretty text-xs leading-normal text-muted-foreground/80`,children:n})]}),t[1]=n,t[2]=o);let s;t[3]===r?s=t[4]:(s=(0,A.jsx)(a,{type:`button`,size:`xs`,variant:`outline`,onClick:r,children:`Try again`}),t[3]=r,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,A.jsxs)(`div`,{className:`flex flex-col items-start gap-3 px-3 py-5 sm:px-4`,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function R(){let e=(0,b.c)(25),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`loading`},e[0]=t):t=e[0];let[n,r]=(0,y.useState)(t),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(0),f;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=!1;return r({status:`loading`}),N().then(t=>{e||r({status:`ready`,manifest:t})},t=>{e||r({status:`error`,message:t instanceof Error?t.message:`The license manifest could not load.`})}),()=>{e=!0}},e[1]=f):f=e[1];let p;e[2]===u?p=e[3]:(p=[u],e[2]=u,e[3]=p),(0,y.useEffect)(f,p);let g;e[4]!==n.manifest||e[5]!==n.status?(g=n.status===`ready`?n.manifest.entries:[],e[4]=n.manifest,e[5]=n.status,e[6]=g):g=e[6];let _=g,v;e[7]!==_||e[8]!==i?(v=E(_,i),e[7]=_,e[8]=i,e[9]=v):v=e[9];let x=v,S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>d(z),e[10]=S):S=e[10];let C=S,w;e[11]!==_||e[12]!==x||e[13]!==i||e[14]!==o||e[15]!==n.status?(w=n.status===`ready`?(0,A.jsx)(I,{query:i,onQueryChange:a,searchOpen:o,onSearchOpenChange:s,filteredCount:x.length,totalCount:_.length}):null,e[11]=_,e[12]=x,e[13]=i,e[14]=o,e[15]=n.status,e[16]=w):w=e[16];let T;e[17]!==x||e[18]!==c||e[19]!==n.message||e[20]!==n.status?(T=n.status===`ready`?(0,A.jsx)(`div`,{className:`text-base sm:text-sm`,children:x.length>0?x.map(e=>{let t=k(e);return(0,A.jsx)(P,{entry:e,open:c===t,onOpenChange:e=>l(e?t:null)},t)}):(0,A.jsx)(`p`,{className:`px-3 py-8 text-center text-sm/6 text-muted-foreground sm:px-4`,children:`No licenses match that search.`})}):n.status===`error`?(0,A.jsx)(L,{message:n.message,onRetry:C}):(0,A.jsx)(`p`,{className:`px-3 py-5 text-sm/6 text-muted-foreground sm:px-4`,children:`Loading open-source notices…`}),e[17]=x,e[18]=c,e[19]=n.message,e[20]=n.status,e[21]=T):T=e[21];let D;return e[22]!==w||e[23]!==T?(D=(0,A.jsx)(m,{children:(0,A.jsx)(h,{title:`Third-party notices`,headerAction:w,children:T})}),e[22]=w,e[23]=T,e[24]=D):D=e[24],D}function z(e){return e+1}var B=R;export{B as component};
2
- //# sourceMappingURL=settings.open-source-licenses-wmlqchzJ.js.map
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{Rd as i,fr as a,gm as o,pf as s}from"./utils-C5GGWTfe.js";import{a as c,n as l,t as u}from"./tooltip-BPiLl1TV.js";import{n as d,r as f,t as p}from"./input-group-BdZ_CKvG.js";import{i as m,s as h}from"./settingsLayout-WhjsCfB6.js";import{ho as g,mo as _,po as v}from"./main-C0z861OK.js";var y=e(t(),1),b=n();function x(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function S(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function C(e){if(typeof e!=`string`)return!1;try{let t=new URL(e).protocol;return t===`http:`||t===`https:`}catch{return!1}}function w(e,t){if(!x(e))throw Error(`License entry ${String(t+1)} is not an object.`);if(!S(e.bundles)||e.bundles.length===0||e.kind!==`custom`&&e.kind!==`package`||typeof e.license!=`string`||typeof e.name!=`string`||typeof e.noticeText!=`string`||e.sourceUrl!==null&&!C(e.sourceUrl)||e.version!==null&&typeof e.version!=`string`)throw Error(`License entry ${String(t+1)} has an invalid shape.`);return{bundles:e.bundles,kind:e.kind,license:e.license,name:e.name,noticeText:e.noticeText,sourceUrl:e.sourceUrl,version:e.version}}function T(e){if(!x(e)||e.schemaVersion!==1||!Array.isArray(e.entries))throw Error(`The open-source license manifest has an unsupported format.`);let t=e.entries.map(w),n=new Set;for(let e of t){let t=k(e);if(n.has(t))throw Error(`The open-source license manifest contains a duplicate entry: ${t}`);n.add(t)}return{schemaVersion:1,entries:t}}function E(e,t){let n=t.trim().toLowerCase().split(/\s+/).filter(e=>e.length>0);return n.length===0?e:e.filter(e=>{let t=[e.name,e.version,e.license,...e.bundles].filter(e=>e!==null).join(` `).toLowerCase();return n.every(e=>t.includes(e))})}var D={android:`Android`,assets:`Assets`,desktop:`Desktop`,"device-tools":`Device tools`,ios:`iOS`,mobile:`Mobile`,server:`Server`,web:`Web`};function O(e){return e.map(e=>Object.prototype.hasOwnProperty.call(D,e)?D[e]:e).join(`, `)}function k(e){return encodeURIComponent(JSON.stringify([e.kind,e.name,e.version]))}var A=e(r(),1),j;async function M(){let e=AbortSignal.timeout(3e4);try{let t=await fetch(`${`/`.replace(/\/$/,``)}/third-party-licenses.json`,{signal:e});if(!t.ok)throw Error(`The license manifest request failed with status ${String(t.status)}.`);return T(await t.json())}catch(t){throw e.aborted?Error(`The license manifest took too long to load.`,{cause:t}):t}}function N(){return j??=M().catch(e=>{throw j=void 0,e}),j}function P(e){let t=(0,b.c)(34),{entry:n,open:r,onOpenChange:o}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,A.jsx)(i,{"aria-hidden":!0,className:`size-3.5 shrink-0 text-muted-foreground transition-transform duration-200 group-data-panel-open:rotate-90`}),t[0]=c):c=t[0];let l;t[1]===n.name?l=t[2]:(l=(0,A.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:n.name}),t[1]=n.name,t[2]=l);let u;t[3]===n.version?u=t[4]:(u=n.version?(0,A.jsx)(`code`,{className:`shrink-0 text-xs text-muted-foreground`,children:n.version}):null,t[3]=n.version,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,A.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-baseline gap-2`,children:[l,u]}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f=n.license,p;t[8]===n.bundles?p=t[9]:(p=O(n.bundles),t[8]=n.bundles,t[9]=p);let m;t[10]!==n.license||t[11]!==p?(m=(0,A.jsxs)(`span`,{className:`max-w-[42%] shrink-0 truncate text-xs text-muted-foreground`,children:[f,` · `,p]}),t[10]=n.license,t[11]=p,t[12]=m):m=t[12];let h;t[13]!==d||t[14]!==m?(h=(0,A.jsxs)(g,{className:`group flex min-h-10 min-w-0 flex-1 items-center gap-2.5 px-3 text-left sm:min-h-9 sm:px-4`,children:[c,d,m]}),t[13]=d,t[14]=m,t[15]=h):h=t[15];let y;t[16]!==n.name||t[17]!==n.sourceUrl?(y=n.sourceUrl?(0,A.jsx)(a,{"aria-label":`View project source for ${n.name}`,className:`me-3 shrink-0 sm:me-4`,render:(0,A.jsx)(`a`,{href:n.sourceUrl,rel:`noreferrer noopener`,target:`_blank`}),size:`icon-micro`,title:`Project source`,variant:`ghost-muted`,children:(0,A.jsx)(s,{"aria-hidden":!0,className:`size-3`})}):null,t[16]=n.name,t[17]=n.sourceUrl,t[18]=y):y=t[18];let x;t[19]!==h||t[20]!==y?(x=(0,A.jsxs)(`div`,{className:`flex min-h-10 items-center hover:bg-muted/35 sm:min-h-9`,children:[h,y]}),t[19]=h,t[20]=y,t[21]=x):x=t[21];let S;t[22]!==n.noticeText||t[23]!==r?(S=r?(0,A.jsx)(`div`,{className:`px-9 pt-1 pb-4 sm:px-10`,children:(0,A.jsx)(`pre`,{className:`max-w-[76ch] whitespace-pre-wrap break-words font-mono text-xs/5 text-foreground/80`,children:n.noticeText})}):null,t[22]=n.noticeText,t[23]=r,t[24]=S):S=t[24];let C;t[25]===S?C=t[26]:(C=(0,A.jsx)(_,{children:S}),t[25]=S,t[26]=C);let w;t[27]!==x||t[28]!==C?(w=(0,A.jsxs)(`article`,{children:[x,C]}),t[27]=x,t[28]=C,t[29]=w):w=t[29];let T;return t[30]!==o||t[31]!==r||t[32]!==w?(T=(0,A.jsx)(v,{open:r,onOpenChange:o,children:w}),t[30]=o,t[31]=r,t[32]=w,t[33]=T):T=t[33],T}function F(e){let t=(0,b.c)(2),{filteredCount:n,totalCount:r}=e,i=n===r?`${String(r)} notices`:`${String(n)} of ${String(r)}`,a;return t[0]===i?a=t[1]:(a=(0,A.jsx)(`p`,{className:`whitespace-nowrap text-xs font-normal text-muted-foreground tabular-nums`,children:i}),t[0]=i,t[1]=a),a}function I(e){let t=(0,b.c)(34),{query:n,onQueryChange:r,searchOpen:i,onSearchOpenChange:s,filteredCount:m,totalCount:h}=e;if(!i){let e;t[0]!==m||t[1]!==h?(e=(0,A.jsx)(F,{filteredCount:m,totalCount:h}),t[0]=m,t[1]=h,t[2]=e):e=t[2];let n;t[3]===s?n=t[4]:(n=()=>s(!0),t[3]=s,t[4]=n);let r;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,A.jsx)(o,{className:`size-3`}),t[5]=r):r=t[5];let i;t[6]===n?i=t[7]:(i=(0,A.jsx)(c,{render:(0,A.jsx)(a,{"aria-label":`Search open-source licenses`,onClick:n,size:`icon-micro`,type:`button`,variant:`ghost-muted`,children:r})}),t[6]=n,t[7]=i);let d;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,A.jsx)(l,{side:`top`,children:`Search licenses`}),t[8]=d):d=t[8];let f;t[9]===i?f=t[10]:(f=(0,A.jsxs)(u,{children:[i,d]}),t[9]=i,t[10]=f);let p;return t[11]!==e||t[12]!==f?(p=(0,A.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[e,f]}),t[11]=e,t[12]=f,t[13]=p):p=t[13],p}let g;t[14]!==m||t[15]!==h?(g=(0,A.jsx)(`div`,{className:`hidden sm:block`,children:(0,A.jsx)(F,{filteredCount:m,totalCount:h})}),t[14]=m,t[15]=h,t[16]=g):g=t[16];let _;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,A.jsx)(d,{children:(0,A.jsx)(o,{"aria-hidden":!0,className:`size-3`})}),t[17]=_):_=t[17];let v;t[18]!==s||t[19]!==n.length?(v=()=>{n.length===0&&s(!1)},t[18]=s,t[19]=n.length,t[20]=v):v=t[20];let y;t[21]===r?y=t[22]:(y=e=>r(e.currentTarget.value),t[21]=r,t[22]=y);let x;t[23]!==r||t[24]!==s?(x=e=>{e.key===`Escape`&&(e.preventDefault(),r(``),s(!1))},t[23]=r,t[24]=s,t[25]=x):x=t[25];let S;t[26]!==n||t[27]!==v||t[28]!==y||t[29]!==x?(S=(0,A.jsxs)(p,{className:`w-36 sm:w-44`,children:[_,(0,A.jsx)(f,{"aria-label":`Search open-source licenses`,autoFocus:!0,onBlur:v,onChange:y,onKeyDown:x,placeholder:`Search licenses`,size:`sm`,type:`search`,value:n})]}),t[26]=n,t[27]=v,t[28]=y,t[29]=x,t[30]=S):S=t[30];let C;return t[31]!==g||t[32]!==S?(C=(0,A.jsxs)(`div`,{className:`flex items-center gap-2`,children:[g,S]}),t[31]=g,t[32]=S,t[33]=C):C=t[33],C}function L(e){let t=(0,b.c)(8),{message:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,A.jsx)(`h3`,{className:`text-sm font-medium text-foreground`,children:`Open-source notices are unavailable`}),t[0]=i):i=t[0];let o;t[1]===n?o=t[2]:(o=(0,A.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[i,(0,A.jsx)(`p`,{className:`max-w-[70ch] text-pretty text-xs leading-normal text-muted-foreground/80`,children:n})]}),t[1]=n,t[2]=o);let s;t[3]===r?s=t[4]:(s=(0,A.jsx)(a,{type:`button`,size:`xs`,variant:`outline`,onClick:r,children:`Try again`}),t[3]=r,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,A.jsxs)(`div`,{className:`flex flex-col items-start gap-3 px-3 py-5 sm:px-4`,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function R(){let e=(0,b.c)(25),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`loading`},e[0]=t):t=e[0];let[n,r]=(0,y.useState)(t),[i,a]=(0,y.useState)(``),[o,s]=(0,y.useState)(!1),[c,l]=(0,y.useState)(null),[u,d]=(0,y.useState)(0),f;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=!1;return r({status:`loading`}),N().then(t=>{e||r({status:`ready`,manifest:t})},t=>{e||r({status:`error`,message:t instanceof Error?t.message:`The license manifest could not load.`})}),()=>{e=!0}},e[1]=f):f=e[1];let p;e[2]===u?p=e[3]:(p=[u],e[2]=u,e[3]=p),(0,y.useEffect)(f,p);let g;e[4]!==n.manifest||e[5]!==n.status?(g=n.status===`ready`?n.manifest.entries:[],e[4]=n.manifest,e[5]=n.status,e[6]=g):g=e[6];let _=g,v;e[7]!==_||e[8]!==i?(v=E(_,i),e[7]=_,e[8]=i,e[9]=v):v=e[9];let x=v,S;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>d(z),e[10]=S):S=e[10];let C=S,w;e[11]!==_||e[12]!==x||e[13]!==i||e[14]!==o||e[15]!==n.status?(w=n.status===`ready`?(0,A.jsx)(I,{query:i,onQueryChange:a,searchOpen:o,onSearchOpenChange:s,filteredCount:x.length,totalCount:_.length}):null,e[11]=_,e[12]=x,e[13]=i,e[14]=o,e[15]=n.status,e[16]=w):w=e[16];let T;e[17]!==x||e[18]!==c||e[19]!==n.message||e[20]!==n.status?(T=n.status===`ready`?(0,A.jsx)(`div`,{className:`text-base sm:text-sm`,children:x.length>0?x.map(e=>{let t=k(e);return(0,A.jsx)(P,{entry:e,open:c===t,onOpenChange:e=>l(e?t:null)},t)}):(0,A.jsx)(`p`,{className:`px-3 py-8 text-center text-sm/6 text-muted-foreground sm:px-4`,children:`No licenses match that search.`})}):n.status===`error`?(0,A.jsx)(L,{message:n.message,onRetry:C}):(0,A.jsx)(`p`,{className:`px-3 py-5 text-sm/6 text-muted-foreground sm:px-4`,children:`Loading open-source notices…`}),e[17]=x,e[18]=c,e[19]=n.message,e[20]=n.status,e[21]=T):T=e[21];let D;return e[22]!==w||e[23]!==T?(D=(0,A.jsx)(m,{children:(0,A.jsx)(h,{title:`Third-party notices`,headerAction:w,children:T})}),e[22]=w,e[23]=T,e[24]=D):D=e[24],D}function z(e){return e+1}var B=R;export{B as component};
2
+ //# sourceMappingURL=settings.open-source-licenses-rG8Neftl.js.map
@@ -1,5 +1,5 @@
1
- import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{$n as i,$p as a,A_ as o,Ab as s,Ep as c,F_ as l,I_ as u,Jn as d,M_ as f,N_ as p,Os as m,P_ as h,Rm as g,Sd as _,Xp as v,Yn as y,Yp as b,aE as x,cd as S,dr as C,fl as w,im as T,j_ as E,jd as D,k_ as O,l as k,mm as A,nT as j,t as M,tr as N,ts as P,um as F,ur as I}from"./utils-D19Exirm.js";import{n as L}from"./ChatMarkdown-fdsQ0rQe.js";import{a as R,c as z,o as B,s as V,t as H}from"./select-CML8G0wN.js";import{t as U}from"./spinner-H4tz4lLc.js";import{t as W}from"./useLocation--dLSTvwv.js";import{p as G}from"./toast-rcFdQept.js";import{S as K}from"./useSettings-4JwtKUFC.js";import{f as q}from"./server-BuS35bSu.js";import{n as ee}from"./query-D-IVadFI.js";import{t as J}from"./use-atom-command-BETKz9Hv.js";import{s as te,u as ne}from"./providerSkills-DTVLY34_.js";import{i as Y}from"./usageFormat-xrTYBhxI.js";import{a as re,n as ie,t as ae}from"./tooltip-DsRaXpYk.js";import{t as oe}from"./skeleton-eiJFH0l9.js";import{t as se}from"./textarea-CkmpNgx5.js";import{n as ce,t as le}from"./toggle-group-DV__8G6T.js";import{t as ue}from"./input-yNgBXsRj.js";import{c as de,r as fe,s as pe,t as me}from"./dialog-CKG1aUT3.js";import{i as he,o as ge,r as _e,t as ve}from"./empty-D6SdnsPw.js";import{n as ye,r as be,t as xe}from"./input-group-APyqVexM.js";import{a as Se}from"./projectFilesQueryState-02nlfyzQ.js";import{F as Ce,G as we,V as Te,a as Ee,i as De,s as Oe}from"./settingsLayout-BWJVQUbK.js";import{Gr as ke,Jr as Ae,Kr as je,Wr as Me,Xr as Ne,Yr as Pe,oa as X,qr as Fe,uo as Ie,vr as Le}from"./main-CVSzIqPv.js";import{i as Re}from"./selfImproveFindings-DuRaHmql.js";import{r as ze,t as Be}from"./SelfImproveSettingsSection-DGcoA36F.js";import{t as Ve}from"./SecretInput-BTBcl8SC.js";var Z=n(),He={spawn:`Failed to start`,timeout:`Timed out`,protocol:`Not an MCP server`,http:`Can't connect`,auth:`Credentials rejected`};function Ue(e,t,n){if(!e.enabled)return{tone:`muted`,label:`Off`,needsSignIn:!1};if(n)return{tone:`muted`,label:`Checking…`,needsSignIn:!1};if(e.transport.type===`http`&&e.transport.auth===`oauth`&&t?.auth===`signed-out`)return{tone:`warning`,label:`Needs sign-in`,needsSignIn:!0};let r=t?.health;switch(r?.status){case`connected`:return{tone:`success`,label:`Connected · ${r.toolCount} ${r.toolCount===1?`tool`:`tools`}`,needsSignIn:!1};case`needs-auth`:return{tone:`warning`,label:`Needs sign-in`,needsSignIn:!0};case`error`:return{tone:`error`,label:He[r.category],detail:r.message,needsSignIn:!1};default:return t?.auth===`signed-in`?{tone:`success`,label:`Signed in`,needsSignIn:!1}:{tone:`muted`,label:`Not checked`,needsSignIn:!1}}}function We(e){let t=e.transport;if(t.type===`http`)try{let e=new URL(t.url);return`Remote · ${e.host}${e.pathname===`/`?``:e.pathname}`}catch{return`Remote`}return[t.command,...t.args].join(` `)}var Q=e(t(),1),Ge=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ke=e=>typeof e==`string`&&e.trim()?e:void 0,qe=e=>{if(e!==null)try{let t=JSON.parse(e);return Ge(t)?t:void 0}catch{return}},Je=e=>{let t=Ke(e)?.replace(/^\.\//,``);if(t!==void 0&&t.toLowerCase().endsWith(`.svg`)&&!(t.startsWith(`/`)||t.split(/[\\/]/).includes(`..`)))return t};function Ye(e,t){let n=qe(e),r=qe(t),i=Ge(r?.interface)?r.interface:void 0,a=n?.author??r?.author,o={displayName:Ke(n?.displayName)??Ke(i?.displayName),description:Ke(n?.description)??Ke(r?.description),publisher:Ke(a)??(Ge(a)?Ke(a.name):void 0),iconPath:Je(n?.icon)??Je(i?.logo)??Je(i?.composerIcon)};return Object.fromEntries(Object.entries(o).filter(([,e])=>e!==void 0))}function Xe(e){let t=qe(e)?.userConfig;return Ge(t)?Object.entries(t).map(([e,t])=>{let n=Ge(t)?t:{},r=Ke(n.description);return{key:e,title:Ke(n.title)??e,...r===void 0?{}:{description:r},required:n.required===!0}}):[]}var $=e(r(),1),Ze=e=>{let t=x(m(e));return t&&!t.truncated?t.contents:null};function Qe(e){let t=(0,Z.c)(48),{environmentId:n,plugin:r,enabled:o,disabled:s,onDetails:l,onToggle:u}=e,d;t[0]!==n||t[1]!==r.path?(d=Se(n,r.path,`.claude-plugin/plugin.json`),t[0]=n,t[1]=r.path,t[2]=d):d=t[2];let f=P(d),p;t[3]!==n||t[4]!==r.path?(p=Se(n,r.path,`.codex-plugin/plugin.json`),t[3]=n,t[4]=r.path,t[5]=p):p=t[5];let m=P(p),{displayName:h,description:g,publisher:_,iconPath:v}=Ye(Ze(f),Ze(m)),b=Ze(P(Se(n,r.path,v??null))),x=v&&b?.trimStart().startsWith(`<`)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(b)}`:null,S=ne(n),w;t[6]===x?w=t[7]:(w=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`flex size-10 shrink-0 items-center justify-center rounded-xl border border-border/60 bg-muted`,children:x?(0,$.jsx)(`img`,{src:x,alt:``,className:`size-6 object-contain`}):(0,$.jsx)(a,{className:`size-5 text-muted-foreground`})}),t[6]=x,t[7]=w);let T=h??r.name,E;t[8]===T?E=t[9]:(E=(0,$.jsx)(`span`,{className:`break-words text-sm font-medium`,children:T}),t[8]=T,t[9]=E);let D;t[10]===_?D=t[11]:(D=_?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:_}):null,t[10]=_,t[11]=D);let O;t[12]!==E||t[13]!==D?(O=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[E,D]}),t[12]=E,t[13]=D,t[14]=O):O=t[14];let k=g??`Local plugin`,A;t[15]===k?A=t[16]:(A=(0,$.jsx)(`p`,{className:`break-words text-xs text-muted-foreground`,children:k}),t[15]=k,t[16]=A);let j;t[17]!==O||t[18]!==A?(j=(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-1`,children:[O,A]}),t[17]=O,t[18]=A,t[19]=j):j=t[19];let M=`More for ${r.name}`,F;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,$.jsx)(c,{"aria-hidden":!0}),t[20]=F):F=t[20];let L;t[21]===M?L=t[22]:(L=(0,$.jsx)(re,{render:(0,$.jsx)(I,{render:(0,$.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":M,children:F})})}),t[21]=M,t[22]=L);let R;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(ie,{children:`Plugin actions`}),t[23]=R):R=t[23];let z;t[24]===L?z=t[25]:(z=(0,$.jsxs)(ae,{children:[L,R]}),t[24]=L,t[25]=z);let B;t[26]!==n||t[27]!==S||t[28]!==r.path?(B=S.capabilities.canOpenDefault?(0,$.jsx)(i,{onClick:()=>void S.activate(`open`,{environmentId:n,filePath:r.path,workspaceRoot:void 0}),children:`Open`}):null,t[26]=n,t[27]=S,t[28]=r.path,t[29]=B):B=t[29];let V;t[30]===l?V=t[31]:(V=(0,$.jsx)(i,{onClick:l,children:`Details`}),t[30]=l,t[31]=V);let H;t[32]!==B||t[33]!==V?(H=(0,$.jsxs)(N,{align:`end`,children:[B,V]}),t[32]=B,t[33]=V,t[34]=H):H=t[34];let U;t[35]!==z||t[36]!==H?(U=(0,$.jsxs)(y,{children:[z,H]}),t[35]=z,t[36]=H,t[37]=U):U=t[37];let W=`Load ${r.name}`,G;t[38]!==s||t[39]!==o||t[40]!==u||t[41]!==W?(G=(0,$.jsx)(Ie,{"aria-label":W,checked:o,disabled:s,onCheckedChange:u}),t[38]=s,t[39]=o,t[40]=u,t[41]=W,t[42]=G):G=t[42];let K;return t[43]!==j||t[44]!==U||t[45]!==G||t[46]!==w?(K=(0,$.jsxs)(`li`,{className:`flex items-center gap-4 py-4`,children:[w,j,U,G]}),t[43]=j,t[44]=U,t[45]=G,t[46]=w,t[47]=K):K=t[47],K}var $e=[`Personal`,`Built-in`,`Project`,`Plugins`,`Other`];function et(e){switch(te(e)){case`personal`:return`Personal`;case`system`:return`Built-in`;case`repo`:case`project`:return`Project`;case`app`:return`Plugins`;default:return`Other`}}var tt=[[`codex`,`Codex`],[`claudeAgent`,`Claude`],[`cursor`,`Cursor`],[`grok`,`Grok`],[`antigravity`,`Antigravity`],[`opencode`,`OpenCode`],[`muse`,`Muse`],[`pi`,`Pi`]],nt={remote:`Remote servers aren't supported by this provider`,"working-directory":`Servers with a working directory aren't supported here`,provider:`Not supported by this provider yet`};function rt(e){return tt.find(([t])=>t===e)?.[1]??e}function it(e){switch(e){case`signed-in`:return`Signed in`;case`signed-out`:return`Not signed in`;case`unavailable`:return`Add this server to the provider's own MCP config to sign in.`;case`unknown`:return`Sign-in status unknown`}}function at(e,t){if(!h(e))return`unavailable`;let n=t.filter(t=>t.driver===e);if(n.some(e=>e.status===`signed-in`))return`signed-in`;if(n.some(e=>e.status===`signed-out`))return`needs-sign-in`}function ot(e){return tt.map(([t,n])=>{let r=f(t,e.transport),i=u.make(t);return{driver:i,label:n,enabled:r.supported&&!e.disabledProviders.includes(i),...r.supported?{}:{unsupported:nt[r.reason]}}})}var st={name:``,type:`stdio`,command:``,args:``,cwd:``,url:``,auth:`none`,values:[]};function ct(e){let t=e.transport;return t.type===`stdio`?{...st,name:e.name,type:`stdio`,command:t.command,args:t.args.join(`
1
+ import{a as e,t}from"./react-BUfh6y28.js";import{n,t as r}from"./jsx-runtime-DJeoFXNw.js";import{B_ as i,Dd as a,F_ as o,H_ as s,I_ as c,Id as l,L_ as u,Lb as d,Mp as f,Ms as p,R_ as m,V_ as h,Wm as g,Xn as _,Yn as v,_l as y,am as b,bm as x,dT as S,dr as C,er as w,fr as T,gm as E,hE as D,l as O,nm as k,nr as A,ns as j,pd as M,t as N,tm as P,um as F,z_ as I}from"./utils-C5GGWTfe.js";import{n as L}from"./ChatMarkdown-CFUfXlYp.js";import{a as R,c as z,o as B,s as V,t as H}from"./select-vBkqTMKL.js";import{t as U}from"./spinner-BZ5ohCyO.js";import{t as W}from"./useLocation-DHd-KBb-.js";import{p as G}from"./toast-BZ96uuab.js";import{S as K}from"./useSettings-B09a3zie.js";import{f as q}from"./server-DwkxciXh.js";import{n as ee}from"./query-B2_Td0ad.js";import{t as J}from"./use-atom-command-CdV5BZYB.js";import{s as te,u as ne}from"./providerSkills-Ca_7EbAx.js";import{i as Y}from"./usageFormat-DhefL58S.js";import{a as re,n as ie,t as ae}from"./tooltip-BPiLl1TV.js";import{t as oe}from"./skeleton-PlPtYr_f.js";import{t as se}from"./textarea-DIg__-Gi.js";import{n as ce,t as le}from"./toggle-group-2e3XGJdx.js";import{t as ue}from"./input-FUjAUGXY.js";import{c as de,r as fe,s as pe,t as me}from"./dialog-BpR3dRVS.js";import{i as he,o as ge,r as _e,t as ve}from"./empty-Cy-8us9l.js";import{n as ye,r as be,t as xe}from"./input-group-BdZ_CKvG.js";import{a as Se}from"./projectFilesQueryState-BdWJ4WwI.js";import{a as Ce,i as we,n as Te,o as Ee,r as De,s as Oe,t as ke}from"./alert-dialog-Du3fYY3I.js";import{F as Ae,G as je,V as Me,a as Ne,i as Pe,s as Fe}from"./settingsLayout-WhjsCfB6.js";import{Ar as Ie,da as X,go as Le}from"./main-C0z861OK.js";import{i as Re}from"./selfImproveFindings-4GGN9cRm.js";import{r as ze,t as Be}from"./SelfImproveSettingsSection-CDIhJO4P.js";import{t as Ve}from"./SecretInput-ZW3hnCoN.js";var Z=n(),He={spawn:`Failed to start`,timeout:`Timed out`,protocol:`Not an MCP server`,http:`Can't connect`,auth:`Credentials rejected`};function Ue(e,t,n){if(!e.enabled)return{tone:`muted`,label:`Off`,needsSignIn:!1};if(n)return{tone:`muted`,label:`Checking…`,needsSignIn:!1};if(e.transport.type===`http`&&e.transport.auth===`oauth`&&t?.auth===`signed-out`)return{tone:`warning`,label:`Needs sign-in`,needsSignIn:!0};let r=t?.health;switch(r?.status){case`connected`:return{tone:`success`,label:`Connected · ${r.toolCount} ${r.toolCount===1?`tool`:`tools`}`,needsSignIn:!1};case`needs-auth`:return{tone:`warning`,label:`Needs sign-in`,needsSignIn:!0};case`error`:return{tone:`error`,label:He[r.category],detail:r.message,needsSignIn:!1};default:return t?.auth===`signed-in`?{tone:`success`,label:`Signed in`,needsSignIn:!1}:{tone:`muted`,label:`Not checked`,needsSignIn:!1}}}function We(e){let t=e.transport;if(t.type===`http`)try{let e=new URL(t.url);return`Remote · ${e.host}${e.pathname===`/`?``:e.pathname}`}catch{return`Remote`}return[t.command,...t.args].join(` `)}var Q=e(t(),1),Ge=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ke=e=>typeof e==`string`&&e.trim()?e:void 0,qe=e=>{if(e!==null)try{let t=JSON.parse(e);return Ge(t)?t:void 0}catch{return}},Je=e=>{let t=Ke(e)?.replace(/^\.\//,``);if(t!==void 0&&t.toLowerCase().endsWith(`.svg`)&&!(t.startsWith(`/`)||t.split(/[\\/]/).includes(`..`)))return t};function Ye(e,t){let n=qe(e),r=qe(t),i=Ge(r?.interface)?r.interface:void 0,a=n?.author??r?.author,o={displayName:Ke(n?.displayName)??Ke(i?.displayName),description:Ke(n?.description)??Ke(r?.description),publisher:Ke(a)??(Ge(a)?Ke(a.name):void 0),iconPath:Je(n?.icon)??Je(i?.logo)??Je(i?.composerIcon)};return Object.fromEntries(Object.entries(o).filter(([,e])=>e!==void 0))}function Xe(e){let t=qe(e)?.userConfig;return Ge(t)?Object.entries(t).map(([e,t])=>{let n=Ge(t)?t:{},r=Ke(n.description);return{key:e,title:Ke(n.title)??e,...r===void 0?{}:{description:r},required:n.required===!0}}):[]}var $=e(r(),1),Ze=e=>{let t=D(p(e));return t&&!t.truncated?t.contents:null};function Qe(e){let t=(0,Z.c)(48),{environmentId:n,plugin:r,enabled:i,disabled:a,onDetails:o,onToggle:s}=e,c;t[0]!==n||t[1]!==r.path?(c=Se(n,r.path,`.claude-plugin/plugin.json`),t[0]=n,t[1]=r.path,t[2]=c):c=t[2];let l=j(c),u;t[3]!==n||t[4]!==r.path?(u=Se(n,r.path,`.codex-plugin/plugin.json`),t[3]=n,t[4]=r.path,t[5]=u):u=t[5];let d=j(u),{displayName:p,description:m,publisher:h,iconPath:g}=Ye(Ze(l),Ze(d)),v=Ze(j(Se(n,r.path,g??null))),y=g&&v?.trimStart().startsWith(`<`)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(v)}`:null,x=ne(n),S;t[6]===y?S=t[7]:(S=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`flex size-10 shrink-0 items-center justify-center rounded-xl border border-border/60 bg-muted`,children:y?(0,$.jsx)(`img`,{src:y,alt:``,className:`size-6 object-contain`}):(0,$.jsx)(b,{className:`size-5 text-muted-foreground`})}),t[6]=y,t[7]=S);let E=p??r.name,D;t[8]===E?D=t[9]:(D=(0,$.jsx)(`span`,{className:`break-words text-sm font-medium`,children:E}),t[8]=E,t[9]=D);let O;t[10]===h?O=t[11]:(O=h?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:h}):null,t[10]=h,t[11]=O);let k;t[12]!==D||t[13]!==O?(k=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-baseline gap-x-2`,children:[D,O]}),t[12]=D,t[13]=O,t[14]=k):k=t[14];let M=m??`Local plugin`,N;t[15]===M?N=t[16]:(N=(0,$.jsx)(`p`,{className:`break-words text-xs text-muted-foreground`,children:M}),t[15]=M,t[16]=N);let P;t[17]!==k||t[18]!==N?(P=(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-1`,children:[k,N]}),t[17]=k,t[18]=N,t[19]=P):P=t[19];let F=`More for ${r.name}`,I;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,$.jsx)(f,{"aria-hidden":!0}),t[20]=I):I=t[20];let L;t[21]===F?L=t[22]:(L=(0,$.jsx)(re,{render:(0,$.jsx)(C,{render:(0,$.jsx)(T,{variant:`ghost`,size:`icon-sm`,"aria-label":F,children:I})})}),t[21]=F,t[22]=L);let R;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,$.jsx)(ie,{children:`Plugin actions`}),t[23]=R):R=t[23];let z;t[24]===L?z=t[25]:(z=(0,$.jsxs)(ae,{children:[L,R]}),t[24]=L,t[25]=z);let B;t[26]!==n||t[27]!==x||t[28]!==r.path?(B=x.capabilities.canOpenDefault?(0,$.jsx)(w,{onClick:()=>void x.activate(`open`,{environmentId:n,filePath:r.path,workspaceRoot:void 0}),children:`Open`}):null,t[26]=n,t[27]=x,t[28]=r.path,t[29]=B):B=t[29];let V;t[30]===o?V=t[31]:(V=(0,$.jsx)(w,{onClick:o,children:`Details`}),t[30]=o,t[31]=V);let H;t[32]!==B||t[33]!==V?(H=(0,$.jsxs)(A,{align:`end`,children:[B,V]}),t[32]=B,t[33]=V,t[34]=H):H=t[34];let U;t[35]!==z||t[36]!==H?(U=(0,$.jsxs)(_,{children:[z,H]}),t[35]=z,t[36]=H,t[37]=U):U=t[37];let W=`Load ${r.name}`,G;t[38]!==a||t[39]!==i||t[40]!==s||t[41]!==W?(G=(0,$.jsx)(Le,{"aria-label":W,checked:i,disabled:a,onCheckedChange:s}),t[38]=a,t[39]=i,t[40]=s,t[41]=W,t[42]=G):G=t[42];let K;return t[43]!==P||t[44]!==U||t[45]!==G||t[46]!==S?(K=(0,$.jsxs)(`li`,{className:`flex items-center gap-4 py-4`,children:[S,P,U,G]}),t[43]=P,t[44]=U,t[45]=G,t[46]=S,t[47]=K):K=t[47],K}var $e=[`Personal`,`Built-in`,`Project`,`Plugins`,`Other`];function et(e){switch(te(e)){case`personal`:return`Personal`;case`system`:return`Built-in`;case`repo`:case`project`:return`Project`;case`app`:return`Plugins`;default:return`Other`}}var tt=[[`codex`,`Codex`],[`claudeAgent`,`Claude`],[`cursor`,`Cursor`],[`grok`,`Grok`],[`antigravity`,`Antigravity`],[`opencode`,`OpenCode`],[`muse`,`Muse`],[`pi`,`Pi`]],nt={remote:`Remote servers aren't supported by this provider`,"working-directory":`Servers with a working directory aren't supported here`,provider:`Not supported by this provider yet`};function rt(e){return tt.find(([t])=>t===e)?.[1]??e}function it(e){switch(e){case`signed-in`:return`Signed in`;case`signed-out`:return`Not signed in`;case`unavailable`:return`Add this server to the provider's own MCP config to sign in.`;case`unknown`:return`Sign-in status unknown`}}function at(e,t){if(!i(e))return`unavailable`;let n=t.filter(t=>t.driver===e);if(n.some(e=>e.status===`signed-in`))return`signed-in`;if(n.some(e=>e.status===`signed-out`))return`needs-sign-in`}function ot(e){return tt.map(([t,n])=>{let r=m(t,e.transport),i=s.make(t);return{driver:i,label:n,enabled:r.supported&&!e.disabledProviders.includes(i),...r.supported?{}:{unsupported:nt[r.reason]}}})}var st={name:``,type:`stdio`,command:``,args:``,cwd:``,url:``,auth:`none`,values:[]};function ct(e){let t=e.transport;return t.type===`stdio`?{...st,name:e.name,type:`stdio`,command:t.command,args:t.args.join(`
2
2
  `),cwd:t.cwd??``,values:Object.entries(t.env).map(([e,t])=>({key:e,value:t}))}:{...st,name:e.name,type:`http`,url:t.url,auth:t.auth,values:Object.entries(t.headers).map(([e,t])=>({key:e,value:t}))}}var lt=/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/;function ut(e,t){let n=e.name.trim();if(!n)return`Enter a name.`;if(!lt.test(n)||n.length>64)return`Use letters, numbers, dashes, and underscores.`;if(n===`p4-code`)return`That name belongs to P4 Code's own server.`;if(t.has(n))return`Another server already uses that name.`;if(e.type===`stdio`&&!e.command.trim())return`Enter the command that starts it.`;if(e.type===`http`&&!/^https?:\/\/\S+$/i.test(e.url.trim()))return`Enter an http or https URL.`}function dt(e,t){let n=Object.fromEntries(e.values.map(e=>[e.key.trim(),e.value]).filter(([e])=>e.length>0)),r=e.type===`stdio`?{type:`stdio`,command:e.command.trim(),args:e.args.split(`
3
- `).map(e=>e.trim()).filter(e=>e.length>0),env:n,...e.cwd.trim()?{cwd:e.cwd.trim()}:{}}:{type:`http`,url:e.url.trim(),headers:n,auth:e.auth};return{name:e.name.trim(),enabled:t?.enabled??!0,transport:r,disabledProviders:t?.disabledProviders??[],...t?.source===void 0?{}:{source:t.source}}}function ft(e){let t=new Map;for(let n of e){let e=n.displayName??n.driver;for(let r of n.skills){let n=`${r.scope??``}\u0000${r.name}`,i=t.get(n);i===void 0?t.set(n,{skill:r,providers:[e]}):i.providers.includes(e)||i.providers.push(e)}}return[...t.values()].toSorted((e,t)=>pt(e.skill).localeCompare(pt(t.skill)))}var pt=e=>e.displayName??e.name.split(/[-_\s]+/).filter(e=>e.length>0).map(e=>e[0].toUpperCase()+e.slice(1)).join(` `);function mt(e){switch(e){case void 0:return;case`user`:return`Personal`;case`project`:case`repo`:return`Project`;case`system`:return`Built-in`;default:return e[0].toUpperCase()+e.slice(1)}}function ht(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/.exec(e);return(t===null?e:e.slice(t[0].length)).trimStart()}function gt(e){let t=(0,Z.c)(14),{title:n,onBack:r,onUninstall:i,children:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(S,{"aria-hidden":!0}),t[0]=o):o=t[0];let s;t[1]===r?s=t[2]:(s=(0,$.jsxs)(C,{size:`xs`,variant:`ghost`,className:`w-fit`,onClick:r,children:[o,`Back`]}),t[1]=r,t[2]=s);let c;t[3]===n?c=t[4]:(c=(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-xl font-semibold text-foreground`,children:n}),t[3]=n,t[4]=c);let l;t[5]===i?l=t[6]:(l=i?(0,$.jsxs)(C,{size:`sm`,variant:`destructive-outline`,onClick:i,children:[(0,$.jsx)(g,{"aria-hidden":!0}),`Uninstall`]}):null,t[5]=i,t[6]=l);let u;t[7]!==c||t[8]!==l?(u=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[c,l]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==s||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`grid gap-6`,children:[s,u,a]}),t[10]=a,t[11]=s,t[12]=u,t[13]=d):d=t[13],d}function _t(e){let t=(0,Z.c)(6),{label:n,htmlFor:r,children:i}=e,a;t[0]!==r||t[1]!==n?(a=(0,$.jsx)(X,{htmlFor:r,children:n}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,$.jsxs)(`div`,{className:`grid gap-2 px-4 py-4`,children:[a,i]}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function vt(e){let t=(0,Z.c)(69),{server:n,takenNames:r,onSave:i}=e,a;t[0]===n?a=t[1]:(a=n===void 0?st:ct(n),t[0]=n,t[1]=a);let o=a,[s,c]=(0,Q.useState)(o),l;t[2]===o?l=t[3]:(l=JSON.stringify(o),t[2]=o,t[3]=l);let u=l,[d,f]=(0,Q.useState)(u);u!==d&&(f(u),c(o));let p;t[4]!==s||t[5]!==r?(p=ut(s,r),t[4]=s,t[5]=r,t[6]=p):p=t[6];let m=p,h;t[7]===s?h=t[8]:(h=JSON.stringify(s),t[7]=s,t[8]=h);let _=h!==u,y;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>c(t=>({...t,...e})),t[9]=y):y=t[9];let b=y,x=s.type===`stdio`?`Environment variables`:`Headers`,S;t[10]===s.values?S=t[11]:(S=(e,t)=>b({values:s.values.map((n,r)=>r===e?{...n,...t}:n)}),t[10]=s.values,t[11]=S);let w=S,T;t[12]!==_||t[13]!==s||t[14]!==i||t[15]!==m||t[16]!==n?(T=e=>{e.preventDefault(),_&&m===void 0&&i(dt(s,n))},t[12]=_,t[13]=s,t[14]=i,t[15]=m,t[16]=n,t[17]=T):T=t[17];let E;t[18]===n?E=t[19]:(E=n===void 0?null:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`To switch between a command and a URL, uninstall the server and add it again.`}),t[18]=n,t[19]=E);let D;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(D=e=>b({name:e.target.value}),t[20]=D):D=t[20];let O;t[21]===s.name?O=t[22]:(O=(0,$.jsx)(_t,{label:`Name`,htmlFor:`mcp-server-name`,children:(0,$.jsx)(ue,{id:`mcp-server-name`,placeholder:`github`,value:s.name,onChange:D})}),t[21]=s.name,t[22]=O);let k;t[23]!==s.type||t[24]!==n?(k=n===void 0?(0,$.jsx)(_t,{label:`Type`,children:(0,$.jsxs)(ce,{"aria-label":`How P4 Code reaches the server`,value:[s.type],onValueChange:e=>{let t=e[0];(t===`stdio`||t===`http`)&&b({type:t,values:[]})},children:[(0,$.jsx)(le,{value:`stdio`,children:`Command`}),(0,$.jsx)(le,{value:`http`,children:`URL`})]})}):null,t[23]=s.type,t[24]=n,t[25]=k):k=t[25];let A;t[26]!==s.args||t[27]!==s.auth||t[28]!==s.command||t[29]!==s.cwd||t[30]!==s.type||t[31]!==s.url?(A=s.type===`stdio`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_t,{label:`Command`,htmlFor:`mcp-server-command`,children:(0,$.jsx)(ue,{id:`mcp-server-command`,placeholder:`npx`,value:s.command,onChange:e=>b({command:e.target.value})})}),(0,$.jsx)(_t,{label:`Arguments, one per line`,htmlFor:`mcp-server-args`,children:(0,$.jsx)(se,{id:`mcp-server-args`,placeholder:`-y
4
- @modelcontextprotocol/server-postgres`,value:s.args,onChange:e=>b({args:e.target.value})})}),(0,$.jsx)(_t,{label:`Working directory (optional)`,htmlFor:`mcp-server-cwd`,children:(0,$.jsx)(ue,{id:`mcp-server-cwd`,placeholder:`The session's project folder`,value:s.cwd,onChange:e=>b({cwd:e.target.value})})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_t,{label:`URL`,htmlFor:`mcp-server-url`,children:(0,$.jsx)(ue,{id:`mcp-server-url`,placeholder:`https://mcp.example.com/mcp`,value:s.url,onChange:e=>b({url:e.target.value})})}),(0,$.jsx)(_t,{label:`Authentication`,children:(0,$.jsxs)(H,{value:s.auth,onValueChange:e=>{(e===`none`||e===`oauth`)&&b({auth:e})},children:[(0,$.jsx)(V,{"aria-label":`Authentication`,children:(0,$.jsx)(z,{children:yt})}),(0,$.jsxs)(B,{alignItemWithTrigger:!1,children:[(0,$.jsx)(R,{value:`none`,children:`None or headers`}),(0,$.jsx)(R,{value:`oauth`,children:`OAuth (sign in after saving)`})]})]})})]}),t[26]=s.args,t[27]=s.auth,t[28]=s.command,t[29]=s.cwd,t[30]=s.type,t[31]=s.url,t[32]=A):A=t[32];let j;t[33]!==s.type||t[34]!==s.values||t[35]!==w||t[36]!==x?(j=s.values.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(ue,{"aria-label":`${x} name`,placeholder:s.type===`stdio`?`API_TOKEN`:`Authorization`,value:e.key,onChange:e=>w(t,{key:e.target.value})}),(0,$.jsx)(Ve,{"aria-label":`${x} value`,placeholder:`Value`,value:e.value,onChange:e=>w(t,{value:e.target.value})}),(0,$.jsx)(C,{size:`icon-sm`,variant:`ghost`,"aria-label":`Remove ${e.key||`row`}`,onClick:()=>b({values:s.values.filter((e,n)=>n!==t)}),children:(0,$.jsx)(g,{"aria-hidden":!0})})]},t)),t[33]=s.type,t[34]=s.values,t[35]=w,t[36]=x,t[37]=j):j=t[37];let M;t[38]===s.values?M=t[39]:(M=()=>b({values:[...s.values,{key:``,value:``}]}),t[38]=s.values,t[39]=M);let N;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(v,{"aria-hidden":!0}),t[40]=N):N=t[40];let P=s.type===`stdio`?`variable`:`header`,F;t[41]!==M||t[42]!==P?(F=(0,$.jsxs)(C,{variant:`soft`,onClick:M,children:[N,`Add `,P]}),t[41]=M,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==j||t[45]!==F?(I=(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[j,F]}),t[44]=j,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==I||t[48]!==x?(L=(0,$.jsx)(_t,{label:x,children:I}),t[47]=I,t[48]=x,t[49]=L):L=t[49];let U;t[50]!==O||t[51]!==k||t[52]!==A||t[53]!==L?(U=(0,$.jsxs)(we,{children:[O,k,A,L]}),t[50]=O,t[51]=k,t[52]=A,t[53]=L,t[54]=U):U=t[54];let W;t[55]!==_||t[56]!==m?(W=_&&m!==void 0?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-foreground`,children:m}):null,t[55]=_,t[56]=m,t[57]=W):W=t[57];let G=!_||m!==void 0,K=n===void 0?`Add server`:`Save`,q;t[58]!==G||t[59]!==K?(q=(0,$.jsx)(C,{type:`submit`,disabled:G,children:K}),t[58]=G,t[59]=K,t[60]=q):q=t[60];let ee;t[61]!==W||t[62]!==q?(ee=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[W,q]}),t[61]=W,t[62]=q,t[63]=ee):ee=t[63];let J;return t[64]!==U||t[65]!==ee||t[66]!==T||t[67]!==E?(J=(0,$.jsxs)(`form`,{className:`grid gap-3`,onSubmit:T,children:[E,U,ee]}),t[64]=U,t[65]=ee,t[66]=T,t[67]=E,t[68]=J):J=t[68],J}function yt(e){return e===`oauth`?`OAuth (sign in after saving)`:`None or headers`}function bt(e){let t=(0,Z.c)(55),{environmentId:n,plugin:r,environmentLabel:i,onSave:a}=e,o=r?.path??``,s=r===void 0?null:`.claude-plugin/plugin.json`,c;t[0]!==n||t[1]!==o||t[2]!==s?(c=Se(n,o,s),t[0]=n,t[1]=o,t[2]=s,t[3]=c):c=t[3];let l=x(m(P(c))),u=Xe(r!==void 0&&l!==null&&!l.truncated?l.contents:null),d;t[4]===r?.options?d=t[5]:(d=r?.options??{},t[4]=r?.options,t[5]=d);let f=d,p=[...u,...Object.keys(f).filter(e=>!u.some(t=>t.key===e)).map(St)],[h,g]=(0,Q.useState)(r?.name??``),[_,v]=(0,Q.useState)(r?.path??``),[y,b]=(0,Q.useState)(f),S;t[6]!==r?.name||t[7]!==r?.path||t[8]!==f?(S=JSON.stringify([r?.name??``,r?.path??``,f]),t[6]=r?.name,t[7]=r?.path,t[8]=f,t[9]=S):S=t[9];let w=S,[T,E]=(0,Q.useState)(w);w!==T&&(E(w),g(r?.name??``),v(r?.path??``),b(f));let D,O;t[10]!==h||t[11]!==y||t[12]!==_||t[13]!==r?.name||t[14]!==r?.path||t[15]!==f?(D=Object.fromEntries(Object.entries(y).filter(xt)),O=h!==(r?.name??``)||_!==(r?.path??``)||JSON.stringify(D)!==JSON.stringify(f),t[10]=h,t[11]=y,t[12]=_,t[13]=r?.name,t[14]=r?.path,t[15]=f,t[16]=D,t[17]=O):(D=t[16],O=t[17]);let k=O,A;t[18]!==h||t[19]!==_?(A=h.trim().length>0&&_.trim().startsWith(`/`),t[18]=h,t[19]=_,t[20]=A):A=t[20];let j=A,M;t[21]!==k||t[22]!==h||t[23]!==D||t[24]!==a||t[25]!==_||t[26]!==r?.enabled||t[27]!==j?(M=e=>{e.preventDefault(),k&&j&&a({name:h.trim(),path:_.trim(),enabled:r?.enabled??!0,options:D})},t[21]=k,t[22]=h,t[23]=D,t[24]=a,t[25]=_,t[26]=r?.enabled,t[27]=j,t[28]=M):M=t[28];let N;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(N=e=>g(e.target.value),t[29]=N):N=t[29];let F;t[30]===h?F=t[31]:(F=(0,$.jsx)(_t,{label:`Name`,htmlFor:`plugin-name`,children:(0,$.jsx)(ue,{id:`plugin-name`,value:h,onChange:N})}),t[30]=h,t[31]=F);let I=`Folder on ${i}`,L;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>v(e.target.value),t[32]=L):L=t[32];let R;t[33]===_?R=t[34]:(R=(0,$.jsx)(ue,{id:`plugin-path`,placeholder:`/Users/me/plugins/my-plugin`,value:_,onChange:L}),t[33]=_,t[34]=R);let z;t[35]!==I||t[36]!==R?(z=(0,$.jsx)(_t,{label:I,htmlFor:`plugin-path`,children:R}),t[35]=I,t[36]=R,t[37]=z):z=t[37];let B=p.map(e=>(0,$.jsx)(_t,{label:e.required?e.title:`${e.title} (optional)`,htmlFor:`plugin-option-${e.key}`,children:(0,$.jsx)(Ve,{id:`plugin-option-${e.key}`,placeholder:`description`in e?e.description:void 0,value:y[e.key]??``,onChange:t=>b(n=>({...n,[e.key]:t.target.value}))})},e.key)),V;t[38]!==F||t[39]!==z||t[40]!==B?(V=(0,$.jsxs)(we,{children:[F,z,B]}),t[38]=F,t[39]=z,t[40]=B,t[41]=V):V=t[41];let H;t[42]!==k||t[43]!==j?(H=k&&!j?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-foreground`,children:`Enter a name and the plugin folder's full path.`}):null,t[42]=k,t[43]=j,t[44]=H):H=t[44];let U=!k||!j,W=r===void 0?`Add plugin`:`Save`,G;t[45]!==U||t[46]!==W?(G=(0,$.jsx)(C,{type:`submit`,disabled:U,children:W}),t[45]=U,t[46]=W,t[47]=G):G=t[47];let K;t[48]!==H||t[49]!==G?(K=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[H,G]}),t[48]=H,t[49]=G,t[50]=K):K=t[50];let q;return t[51]!==V||t[52]!==K||t[53]!==M?(q=(0,$.jsxs)(`form`,{className:`grid gap-3`,onSubmit:M,children:[V,K]}),t[51]=V,t[52]=K,t[53]=M,t[54]=q):q=t[54],q}function xt(e){let[,t]=e;return t}function St(e){return{key:e,title:e,required:!1}}var Ct=e=>e.replace(/[\\/][^\\/]*$/,``)||`/`;function wt(e){let t=(0,Z.c)(69),{entry:n,environmentId:r,onClose:a}=e,{skill:o,providers:s}=n,l,u,d;t[0]!==r||t[1]!==o.path?(l=Ct(o.path),u=P,d=Se(r,l,o.path),t[0]=r,t[1]=o.path,t[2]=l,t[3]=u,t[4]=d):(l=t[2],u=t[3],d=t[4]);let f=u(d),p;t[5]===f?p=t[6]:(p=x(m(f)),t[5]=f,t[6]=p);let h=p,g=ne(r),{copyToClipboard:v}=G(),b;t[7]!==r||t[8]!==o.path?(b={environmentId:r,filePath:o.path,workspaceRoot:void 0},t[7]=r,t[8]=o.path,t[9]=b):b=t[9];let S=b,w=o.shortDescription??o.description,T;t[10]===o.scope?T=t[11]:(T=mt(o.scope),t[10]=o.scope,t[11]=T);let E=T,D;t[12]===a?D=t[13]:(D=e=>!e&&a(),t[12]=a,t[13]=D);let O;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`flex size-12 shrink-0 items-center justify-center rounded-full border border-border/60 text-muted-foreground`,children:(0,$.jsx)(_,{className:`size-5`})}),t[14]=O):O=t[14];let k;t[15]===o?k=t[16]:(k=pt(o),t[15]=o,t[16]=k);let A=`More for ${k}`,j;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(c,{"aria-hidden":!0}),t[17]=j):j=t[17];let M;t[18]===A?M=t[19]:(M=(0,$.jsx)(I,{render:(0,$.jsx)(C,{size:`icon-sm`,variant:`ghost`,"aria-label":A,children:j})}),t[18]=A,t[19]=M);let F;t[20]!==g||t[21]!==S?(F=g.capabilities.canOpenDefault?(0,$.jsx)(i,{onClick:()=>void g.activate(`open`,S),children:`Open`}):null,t[20]=g,t[21]=S,t[22]=F):F=t[22];let R;t[23]!==g||t[24]!==S?(R=g.capabilities.revealLabel?(0,$.jsx)(i,{onClick:()=>void g.activate(`reveal-in-folder`,S),children:g.capabilities.revealLabel}):null,t[23]=g,t[24]=S,t[25]=R):R=t[25];let z=h===null,B;t[26]!==v||t[27]!==h?(B=()=>h&&v(h.contents,void 0),t[26]=v,t[27]=h,t[28]=B):B=t[28];let V;t[29]!==z||t[30]!==B?(V=(0,$.jsx)(i,{disabled:z,onClick:B,children:`Copy Markdown`}),t[29]=z,t[30]=B,t[31]=V):V=t[31];let H;t[32]!==F||t[33]!==R||t[34]!==V?(H=(0,$.jsxs)(N,{align:`end`,children:[F,R,V]}),t[32]=F,t[33]=R,t[34]=V,t[35]=H):H=t[35];let U;t[36]!==M||t[37]!==H?(U=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 pe-8`,children:[O,(0,$.jsxs)(y,{children:[M,H]})]}),t[36]=M,t[37]=H,t[38]=U):U=t[38];let W;t[39]===o?W=t[40]:(W=pt(o),t[39]=o,t[40]=W);let K;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`Skill`}),t[41]=K):K=t[41];let q;t[42]===W?q=t[43]:(q=(0,$.jsxs)(de,{children:[W,` `,K]}),t[42]=W,t[43]=q);let ee;t[44]===w?ee=t[45]:(ee=w?(0,$.jsx)(fe,{children:w}):null,t[44]=w,t[45]=ee);let J;t[46]!==q||t[47]!==ee?(J=(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[q,ee]}),t[46]=q,t[47]=ee,t[48]=J):J=t[48];let te;t[49]!==l||t[50]!==r||t[51]!==h||t[52]!==f?(te=(0,$.jsx)(`div`,{className:`max-h-[50vh] min-h-24 overflow-y-auto rounded-xl border border-border/60 bg-card/40 px-5 py-4`,children:h===null?f._tag===`Failure`?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This skill's file could not be read. It may have moved since the provider last scanned it.`}):(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(oe,{className:`h-4 w-3/4`}),(0,$.jsx)(oe,{className:`h-4 w-full`}),(0,$.jsx)(oe,{className:`h-4 w-2/3`})]}):(0,$.jsx)(L,{text:ht(h.contents),cwd:l,environmentId:r})}),t[49]=l,t[50]=r,t[51]=h,t[52]=f,t[53]=te):te=t[53];let Y;t[54]===s?Y=t[55]:(Y=s.join(`, `),t[54]=s,t[55]=Y);let re=`Loaded by ${Y}`,ie;t[56]!==E||t[57]!==re?(ie=[E,re].filter(Boolean),t[56]=E,t[57]=re,t[58]=ie):ie=t[58];let ae=ie.join(` · `),se;t[59]===ae?se=t[60]:(se=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:ae}),t[59]=ae,t[60]=se);let ce;t[61]!==U||t[62]!==J||t[63]!==te||t[64]!==se?(ce=(0,$.jsx)(pe,{className:`max-w-2xl`,children:(0,$.jsxs)(`div`,{className:`grid min-h-0 gap-4 p-6`,children:[U,J,te,se]})}),t[61]=U,t[62]=J,t[63]=te,t[64]=se,t[65]=ce):ce=t[65];let le;return t[66]!==ce||t[67]!==D?(le=(0,$.jsx)(me,{open:!0,onOpenChange:D,children:ce}),t[66]=ce,t[67]=D,t[68]=le):le=t[68],le}var Tt={"edited-both-sides":`Changed here and on another machine since the last sync.`,"unmanaged-local-collision":`This machine has its own copy with the same name.`,"deleted-remotely-edited-locally":`Deleted on another machine, changed here.`,"mass-removal-held":`Most synced items vanished from the hub at once, so nothing was removed here.`,"hub-behind-manifest":`The hub has an older copy than this machine last synced.`,"not-writable-here":`This machine cannot hold this item.`,"write-failed":`Could not be written here. The next sync tries again.`};function Et(e){return Tt[e]??e}var Dt={skill:`Skill`,agent:`Subagent`,memory:`Memory`,mcp:`MCP server`,settings:`Settings`};function Ot(e){return`${Dt[e.kind]} ${e.name}`}function kt(e){if(e.running)return`Syncing…`;let t=e.lastRun;if(t===null)return`Not synced since the server started.`;let n=Y(t.finishedAt);if(t.outcome===`unavailable`)return`Couldn't reach the hub at ${n}.`;let r=[t.received>0?`${t.received} received`:null,t.published>0?`${t.published} shared`:null,t.removed>0?`${t.removed} removed`:null].filter(e=>e!==null);return`Synced ${n}${r.length>0?` · ${r.join(` · `)}`:` · no changes`}.`}function At(){let e=(0,Z.c)(4),{scope:t,environment:n}=Te(),r=t.environmentIds.length===1?n?.environmentId??null:null,i=n?.connection.phase===`connected`&&n.serverConfig!==null,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Le(`hub-sync`),e[0]=a):a=e[0];let o;return e[1]!==i||e[2]!==r?(o=(0,$.jsx)(Oe,{...a,children:r&&i?(0,$.jsx)(Mt,{environmentId:r}):(0,$.jsx)(Ee,{title:`Hub`,description:`Pick a single connected environment to sync its skills, subagents and memory.`})}),e[1]=i,e[2]=r,e[3]=o):o=e[3],o}function jt(e,t){let n=Re(e,t);return n.ok?null:n.message}function Mt(e){let t=(0,Z.c)(95),{environmentId:n}=e,r;t[0]===n?r=t[1]:(r=q.hubSyncLive({environmentId:n,input:void 0}),t[0]=n,t[1]=r);let i=ee(r),a;t[2]===n?a=t[3]:(a=q.connectHubSync.permissionAtom(n),t[2]=n,t[3]=a);let o=P(a),s;t[4]===n?s=t[5]:(s=q.runHubSyncNow.permissionAtom(n),t[4]=n,t[5]=s);let c=P(s),l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[6]=l):l=t[6];let u=l,d=J(q.disconnectHubSync,u),f=J(q.setHubSyncMode,u),p=J(q.runHubSyncNow,u),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),v=i.data;if(!v){let e=i.error?`Couldn't load hub sync.`:`Loading…`,n;return t[7]===e?n=t[8]:(n=(0,$.jsx)(Ee,{title:`Hub`,status:e}),t[7]=e,t[8]=n),n}let y=v.source!==`none`,b=v.source===`environment`,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=async e=>{h(!0),_(await e()),h(!1)},t[9]=x):x=t[9];let S=x,w,T,E,D,O,k,A,j,M,N;if(t[10]!==o||t[11]!==c||t[12]!==d||t[13]!==n||t[14]!==g||t[15]!==b||t[16]!==y||t[17]!==m||t[18]!==p||t[19]!==f||t[20]!==v){let e=v.lastRun?.conflicts??[],r=v.lastRun?.refused??[],i=!y,a=!o||y,s;t[31]!==n||t[32]!==a?(s=(0,$.jsx)(Pt,{environmentId:n,disabled:a}),t[31]=n,t[32]=a,t[33]=s):s=t[33],t[34]!==i||t[35]!==s?(O=(0,$.jsx)(Be,{open:i,children:s}),t[34]=i,t[35]=s,t[36]=O):O=t[36],T=Be,M=y;let l=b?` · set by P4CODE_HUB_URL on the server`:null,u;t[37]===g?u=t[38]:(u=(0,$.jsx)(ze,{text:g}),t[37]=g,t[38]=u);let h;t[39]!==v.baseUrl||t[40]!==l||t[41]!==u?(h=(0,$.jsxs)($.Fragment,{children:[v.baseUrl,l,u]}),t[39]=v.baseUrl,t[40]=l,t[41]=u,t[42]=h):h=t[42];let _;t[43]!==o||t[44]!==d||t[45]!==n||t[46]!==b||t[47]!==y||t[48]!==m?(_=b?null:(0,$.jsx)(C,{size:`sm`,variant:`outline`,disabled:!o||m||!y,onClick:()=>void S(async()=>jt(await d({environmentId:n,input:void 0}),`Couldn't disconnect.`)),children:`Disconnect`}),t[43]=o,t[44]=d,t[45]=n,t[46]=b,t[47]=y,t[48]=m,t[49]=_):_=t[49],t[50]!==h||t[51]!==_?(N=(0,$.jsx)(Ee,{title:`Hub`,status:h,control:_}),t[50]=h,t[51]=_,t[52]=N):N=t[52];let x=`When the server starts and every ${v.intervalMinutes} minutes.`,P=v.syncMode===`auto`,F=!o||m||!y,I;t[53]!==n||t[54]!==f?(I=e=>void S(async()=>jt(await f({environmentId:n,input:{syncMode:e?`auto`:`paused`}}),`Couldn't change automatic sync.`)),t[53]=n,t[54]=f,t[55]=I):I=t[55];let L;t[56]!==P||t[57]!==F||t[58]!==I?(L=(0,$.jsx)(Ie,{"aria-label":`Sync automatically`,checked:P,disabled:F,onCheckedChange:I}),t[56]=P,t[57]=F,t[58]=I,t[59]=L):L=t[59],t[60]!==x||t[61]!==L?(E=(0,$.jsx)(Ee,{title:`Sync automatically`,description:x,control:L}),t[60]=x,t[61]=L,t[62]=E):E=t[62];let R;t[63]===v?R=t[64]:(R=kt(v),t[63]=v,t[64]=R);let z;t[65]===R?z=t[66]:(z=(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,children:R}),t[65]=R,t[66]=z);let B=!c||m||v.running||!y,V;t[67]!==n||t[68]!==p?(V=()=>void S(async()=>jt(await p({environmentId:n,input:void 0}),`Couldn't start a sync.`)),t[67]=n,t[68]=p,t[69]=V):V=t[69];let H;t[70]===v.running?H=t[71]:(H=v.running?(0,$.jsx)(U,{size:`xs`}):null,t[70]=v.running,t[71]=H);let W;t[72]!==B||t[73]!==V||t[74]!==H?(W=(0,$.jsxs)(C,{size:`sm`,variant:`outline`,disabled:B,onClick:V,children:[H,`Sync now`]}),t[72]=B,t[73]=V,t[74]=H,t[75]=W):W=t[75],t[76]!==z||t[77]!==W?(D=(0,$.jsx)(Ee,{title:`Last sync`,status:z,control:W}),t[76]=z,t[77]=W,t[78]=D):D=t[78],w=Ft,k=n,A=[...e,...r],j=new Set(e.map(Nt)),t[10]=o,t[11]=c,t[12]=d,t[13]=n,t[14]=g,t[15]=b,t[16]=y,t[17]=m,t[18]=p,t[19]=f,t[20]=v,t[21]=w,t[22]=T,t[23]=E,t[24]=D,t[25]=O,t[26]=k,t[27]=A,t[28]=j,t[29]=M,t[30]=N}else w=t[21],T=t[22],E=t[23],D=t[24],O=t[25],k=t[26],A=t[27],j=t[28],M=t[29],N=t[30];let F=!c||v.running||!y,I;t[79]!==w||t[80]!==F||t[81]!==k||t[82]!==A||t[83]!==j?(I=(0,$.jsx)(w,{environmentId:k,issues:A,resolvable:j,disabled:F}),t[79]=w,t[80]=F,t[81]=k,t[82]=A,t[83]=j,t[84]=I):I=t[84];let L;t[85]!==T||t[86]!==E||t[87]!==D||t[88]!==I||t[89]!==M||t[90]!==N?(L=(0,$.jsxs)(T,{open:M,children:[N,E,D,I]}),t[85]=T,t[86]=E,t[87]=D,t[88]=I,t[89]=M,t[90]=N,t[91]=L):L=t[91];let R;return t[92]!==O||t[93]!==L?(R=(0,$.jsxs)($.Fragment,{children:[O,L]}),t[92]=O,t[93]=L,t[94]=R):R=t[94],R}var Nt=e=>`${e.kind}/${e.name}`;function Pt(e){let t=(0,Z.c)(34),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={reportFailure:!1},t[0]=u):u=t[0];let d=J(q.connectHubSync,u),f=e.disabled||o,p;t[1]!==n||t[2]!==i?(p=n.trim()!==``&&i.trim()!==``,t[1]=n,t[2]=i,t[3]=p):p=t[3];let m=p,h;t[4]===c?h=t[5]:(h=(0,$.jsx)(ze,{text:c}),t[4]=c,t[5]=h);let g;t[6]!==n||t[7]!==d||t[8]!==f||t[9]!==e.environmentId||t[10]!==m||t[11]!==i?(g=t=>{t.preventDefault(),m&&!f&&(s(!0),d({environmentId:e.environmentId,input:{baseUrl:n.trim(),token:i.trim()}}).then(e=>{let t=jt(e,`Couldn't link the hub.`);l(t),t===null&&a(``),s(!1)}))},t[6]=n,t[7]=d,t[8]=f,t[9]=e.environmentId,t[10]=m,t[11]=i,t[12]=g):g=t[12];let _;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>r(e.target.value),t[13]=_):_=t[13];let v;t[14]!==n||t[15]!==f?(v=(0,$.jsx)(`div`,{className:`min-w-48 flex-1`,children:(0,$.jsx)(ue,{"aria-label":`Hub URL`,autoComplete:`off`,value:n,disabled:f,placeholder:`https://hub.example.ts.net`,onChange:_})}),t[14]=n,t[15]=f,t[16]=v):v=t[16];let y;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>a(e.target.value),t[17]=y):y=t[17];let b;t[18]!==f||t[19]!==i?(b=(0,$.jsx)(`div`,{className:`min-w-40 flex-1`,children:(0,$.jsx)(ue,{"aria-label":`Hub token`,type:`password`,autoComplete:`off`,value:i,disabled:f,placeholder:`Token`,onChange:y})}),t[18]=f,t[19]=i,t[20]=b):b=t[20];let x=f||!m,S;t[21]===o?S=t[22]:(S=o?(0,$.jsx)(U,{size:`xs`}):null,t[21]=o,t[22]=S);let w;t[23]!==x||t[24]!==S?(w=(0,$.jsxs)(C,{type:`submit`,size:`sm`,disabled:x,children:[S,`Connect`]}),t[23]=x,t[24]=S,t[25]=w):w=t[25];let T;t[26]!==w||t[27]!==g||t[28]!==v||t[29]!==b?(T=(0,$.jsxs)(`form`,{className:`flex max-w-xl flex-wrap items-center gap-2 pb-2`,onSubmit:g,children:[v,b,w]}),t[26]=w,t[27]=g,t[28]=v,t[29]=b,t[30]=T):T=t[30];let E;return t[31]!==T||t[32]!==h?(E=(0,$.jsx)(Ee,{title:`Hub`,description:`Keep skills, subagents and memory the same on every machine linked to one hub. Mint a token on the hub host with p4c hub token add.`,status:h,children:T}),t[31]=T,t[32]=h,t[33]=E):E=t[33],E}function Ft(e){let t=(0,Z.c)(13),n;t[0]===e.issues?n=t[1]:(n=new Map(e.issues.map(It)),t[0]=e.issues,t[1]=n);let r=n,[i,a]=(0,Q.useState)(e.issues),o;if(t[2]!==e.issues||t[3]!==i){let n;t[5]===i?n=t[6]:(n=e=>!i.some(t=>Nt(t)===Nt(e)),t[5]=i,t[6]=n),o=[...i,...e.issues.filter(n)],t[2]=e.issues,t[3]=i,t[4]=o}else o=t[4];let s=o;s.length!==i.length&&a(s);let c;return t[7]!==r||t[8]!==s||t[9]!==e.disabled||t[10]!==e.environmentId||t[11]!==e.resolvable?(c=(0,$.jsx)($.Fragment,{children:s.map(t=>{let n=Nt(t),i=r.get(n);return(0,$.jsx)(`div`,{onTransitionEnd:e=>{e.target!==e.currentTarget.firstChild||i||a(e=>e.filter(e=>Nt(e)!==n))},children:(0,$.jsx)(Be,{open:i!==void 0,children:(0,$.jsx)(Lt,{environmentId:e.environmentId,issue:i??t,resolutions:e.resolvable.has(n)?w(t.reason):[],disabled:e.disabled||i===void 0})})},n)})}),t[7]=r,t[8]=s,t[9]=e.disabled,t[10]=e.environmentId,t[11]=e.resolvable,t[12]=c):c=t[12],c}function It(e){return[Nt(e),e]}function Lt(e){let t=(0,Z.c)(24),{issue:n}=e,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[0]=l):l=t[0];let u=J(q.resolveHubSyncConflict,l),d;t[1]===n?d=t[2]:(d=Ot(n),t[1]=n,t[2]=d);let f=d,p;t[3]!==n.kind||t[4]!==n.name||t[5]!==e.environmentId||t[6]!==u?(p=async t=>{i(!0),o(jt(await u({environmentId:e.environmentId,input:{kind:n.kind,name:n.name,resolution:t}}),`Couldn't apply that choice.`)),i(!1),c(!1)},t[3]=n.kind,t[4]=n.name,t[5]=e.environmentId,t[6]=u,t[7]=p):p=t[7];let m=p,h=e.disabled||r,g;t[8]===n.reason?g=t[9]:(g=Et(n.reason),t[8]=n.reason,t[9]=g);let _;t[10]===a?_=t[11]:(_=(0,$.jsx)(ze,{text:a}),t[10]=a,t[11]=_);let v;t[12]!==s||t[13]!==h||t[14]!==r||t[15]!==e.resolutions||t[16]!==m||t[17]!==f?(v=e.resolutions.length===0?null:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[e.resolutions.includes(`keep-local`)?(0,$.jsx)(C,{size:`sm`,variant:`outline`,disabled:h,onClick:()=>void m(`keep-local`),children:`Keep this machine's`}):null,e.resolutions.includes(`use-hub`)?(0,$.jsxs)(Me,{open:s,onOpenChange:e=>{r||c(e)},children:[(0,$.jsx)(C,{size:`sm`,variant:`outline`,disabled:h,onClick:()=>c(!0),children:`Use hub's`}),(0,$.jsxs)(Pe,{children:[(0,$.jsxs)(Ae,{children:[(0,$.jsxs)(Ne,{children:[`Replace this machine's `,f,`?`]}),(0,$.jsx)(je,{children:`The hub's copy overwrites the one here. Changes made only on this machine are lost.`})]}),(0,$.jsxs)(Fe,{children:[(0,$.jsx)(ke,{disabled:r,render:(0,$.jsx)(C,{variant:`outline`,disabled:r}),children:`Cancel`}),(0,$.jsxs)(C,{variant:`destructive`,disabled:r,onClick:()=>void m(`use-hub`),children:[r?(0,$.jsx)(U,{size:`sm`}):null,`Replace`]})]})]})]}):null]}),t[12]=s,t[13]=h,t[14]=r,t[15]=e.resolutions,t[16]=m,t[17]=f,t[18]=v):v=t[18];let y;return t[19]!==g||t[20]!==_||t[21]!==v||t[22]!==f?(y=(0,$.jsx)(Ee,{title:f,description:g,status:_,control:v}),t[19]=g,t[20]=_,t[21]=v,t[22]=f,t[23]=y):y=t[23],y}var Rt={claude:`Claude`,codex:`Codex`,cursor:`Cursor`},zt={success:`bg-success`,warning:`bg-warning`,error:`bg-destructive`,muted:`bg-muted-foreground/40`},Bt={success:`text-success-foreground`,warning:`text-warning-foreground`,error:`text-destructive-foreground`,muted:`text-muted-foreground`},Vt=s(O);function Ht(e){let t=j(e);return Vt(t)&&t.reason===`rejected`?`This server only lets apps it has approved sign in, and it refused P4 Code. Sign in with a provider below instead.`:`Sign-in could not start. Check the server URL, then try again.`}function Ut(e,t,n){return e.transport.type===`http`&&(e.transport.auth===`oauth`||n?.auth===`signed-in`||t.needsSignIn)}function Wt(e){let t=(0,Z.c)(13),{status:n,className:r}=e,i=Bt[n.tone],a;t[0]!==r||t[1]!==i?(a=M(`flex min-w-0 items-center gap-1.5 text-xs`,i,r),t[0]=r,t[1]=i,t[2]=a):a=t[2];let o=zt[n.tone],s;t[3]===o?s=t[4]:(s=M(`size-1.5 shrink-0 rounded-full`,o),t[3]=o,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{"aria-hidden":!0,className:s}),t[5]=s,t[6]=c);let l;t[7]===n.label?l=t[8]:(l=(0,$.jsx)(`span`,{className:`truncate`,children:n.label}),t[7]=n.label,t[8]=l);let u;return t[9]!==a||t[10]!==c||t[11]!==l?(u=(0,$.jsxs)(`span`,{className:a,children:[c,l]}),t[9]=a,t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function Gt(){let e=(0,Z.c)(11),{environment:t,scope:n}=Te(),r=t?.connection.phase===`connected`&&t.serverConfig!==null,i=r?t.environmentId:null,a=r&&t.serverConfig?.environment.capabilities.mcpRegistry===!0,o;e[0]!==r||e[1]!==t||e[2]!==i||e[3]!==n||e[4]!==a?(o=t===null||!r?(0,$.jsx)(ve,{children:(0,$.jsxs)(he,{children:[(0,$.jsx)(ge,{children:`Connect to manage plugins and MCP servers`}),(0,$.jsx)(_e,{children:`They live on each environment. Choose a connected one above.`})]})}):!a||i===null?(0,$.jsx)(ve,{children:(0,$.jsxs)(he,{children:[(0,$.jsxs)(ge,{children:[`Update `,t.label,` to manage plugins and MCP servers`]}),(0,$.jsx)(_e,{children:`This environment runs a version without them.`})]})}):(0,$.jsx)(Yt,{environmentId:i,environmentLabel:t.label,projectId:n.kind===`checkout`?n.checkout.id:n.kind===`project`?n.members.find(e=>e.environmentId===i)?.id:void 0,projectLabel:n.kind===`project`||n.kind===`checkout`?n.label:void 0},i),e[0]=r,e[1]=t,e[2]=i,e[3]=n,e[4]=a,e[5]=o):o=e[5];let s;e[6]===r?s=e[7]:(s=r?(0,$.jsx)(At,{}):null,e[6]=r,e[7]=s);let c;return e[8]!==o||e[9]!==s?(c=(0,$.jsxs)(De,{width:`wide`,children:[o,s]}),e[8]=o,e[9]=s,e[10]=c):c=e[10],c}var Kt={plugins:`Search plugins`,mcps:`Search MCP servers`,skills:`Search skills`},qt=(e,...t)=>e===``||t.some(t=>t.toLowerCase().includes(e));function Jt(e){let t=(0,Z.c)(9),{text:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(!1),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{let t=r.current;a(e&&t!==null&&t.scrollWidth>t.clientWidth)},t[0]=o):o=t[0];let s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`span`,{ref:r,tabIndex:0,className:`block truncate text-xs text-muted-foreground`}),t[1]=s):s=t[1];let c,l;t[2]===n?(c=t[3],l=t[4]):(c=(0,$.jsx)(re,{render:s,children:n}),l=(0,$.jsx)(ie,{children:n}),t[2]=n,t[3]=c,t[4]=l);let u;return t[5]!==i||t[6]!==c||t[7]!==l?(u=(0,$.jsxs)(ae,{open:i,onOpenChange:o,children:[c,l]}),t[5]=i,t[6]=c,t[7]=l,t[8]=u):u=t[8],u}function Yt({environmentId:e,environmentLabel:t,projectId:n,projectLabel:r}){let s=W({select:e=>e.hash}),[u,d]=(0,Q.useState)(()=>s.replace(/^#/,``)===`mcp-servers`?`mcps`:s.replace(/^#/,``)===`skills`?`skills`:`plugins`),[f,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(`All categories`),v=P(q.configValueAtom(e))?.providers,x=(0,Q.useMemo)(()=>ft(v??[]),[v]),[S,w]=(0,Q.useState)(null),O=Ce(e=>e.mcpServers),j=Ce(e=>e.plugins),M=Ce(e=>e.projectSettingsOverrides),L=Ce(e=>e.skillOverrides),U=ne(e),G=P(q.updateSettings.permissionAtom(e)),[ee,te]=(0,Q.useState)(null),Y=P(q.mcpRegistryTest.permissionAtom(e)),oe=K(e),se=J(q.updateSettings,{label:`update MCP registry`,reportFailure:!0}),ue=J(q.mcpRegistryState,{reportFailure:!1}),de=J(q.mcpRegistryTest,{label:`check MCP server`,reportFailure:!0}),fe=J(q.mcpRegistryOAuthStart,{label:`start MCP sign-in`,reportFailure:!0}),pe=J(q.mcpRegistryOAuthSignOut,{label:`sign out of MCP server`,reportFailure:!0}),me=J(q.mcpRegistryDiscover,{reportFailure:!1}),he=J(q.mcpRegistryImport,{label:`import MCP servers`,reportFailure:!0}),[ge,_e]=(0,Q.useState)({}),[ve,Se]=(0,Q.useState)(new Set),[we,Te]=(0,Q.useState)([]),[Ee,De]=(0,Q.useState)({kind:`list`}),X=Ee.kind!==`list`&&Ee.id!==null&&(Ee.kind===`server`?O[Ee.id]===void 0:j[Ee.id]===void 0)?{kind:`list`}:Ee,[Re,ze]=(0,Q.useState)(s);if(s!==Re){ze(s);let e=s.replace(/^#/,``);(e===`mcp-servers`||e===`plugins`||e===`skills`)&&(d(e===`mcp-servers`?`mcps`:e),De({kind:`list`}))}let[Be,Ve]=(0,Q.useState)(null),Z=(0,Q.useRef)(new Map),[He,Ge]=(0,Q.useState)(null),[Ke,qe]=(0,Q.useState)({}),Je=(0,Q.useMemo)(()=>Object.entries(O).map(([e,t])=>[o.make(e),t]).toSorted(([,e],[,t])=>e.name.localeCompare(t.name)),[O]),Ye=(0,Q.useMemo)(()=>Object.entries(j).map(([e,t])=>[E.make(e),t]),[j]),Xe=(0,Q.useCallback)(async()=>{let t=await ue({environmentId:e,input:{}});t._tag===`Success`&&_e(t.value.servers)},[e,ue]),Ze=(0,Q.useCallback)(async()=>{if(!Y)return;let t=await me({environmentId:e,input:n===void 0?{}:{projectId:n}});t._tag===`Success`&&Te(t.value.servers)},[Y,me,e,n]);(0,Q.useEffect)(()=>{Xe(),Ze()},[Xe,Ze]);let tt=e=>{d(`mcps`),De({kind:`server`,id:e})},nt=e=>{d(`plugins`),De({kind:`plugin`,id:e})},rt=t=>se({environmentId:e,input:{patch:t}}),it=async t=>{Se(e=>new Set(e).add(t));let n=await de({environmentId:e,input:{serverId:t}});if(Se(e=>{let n=new Set(e);return n.delete(t),n}),n._tag===`Success`)return _e(e=>({...e,[t]:n.value})),n.value},at=(0,Q.useEffectEvent)(async e=>{(await it(e))?.health.status===`connected`&&Ge(null)});(0,Q.useEffect)(()=>{if(He===null)return;let e=()=>void at(He);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[He]);let ot=async(e,t,n)=>{(await rt({mcpServers:{[e]:t}}))._tag===`Success`&&(n&&De({kind:`list`}),Ze(),t.enabled&&await it(e))},st=async(t,n=!1)=>{let r=Z.current.get(t);if(!n&&He===t&&r){window.open(r,`_blank`,`noopener,noreferrer`);return}let i=oe??window.location.origin;qe(e=>{let n={...e};return delete n[t],n});let a=await fe({environmentId:e,input:{serverId:t,origin:new URL(i,window.location.href).origin,...n?{reauthenticate:n}:{}}});a._tag===`Success`?a.value.authorizationUrl===null?await it(t):(Z.current.set(t,a.value.authorizationUrl),Ge(t),window.open(a.value.authorizationUrl,`_blank`,`noopener,noreferrer`)):a._tag===`Failure`&&qe(e=>({...e,[t]:Ht(a.cause)}))},ct=async t=>{let n=await pe({environmentId:e,input:{serverId:t}});n._tag===`Success`&&_e(e=>({...e,[t]:n.value}))},lt=(e,t,r)=>{if(n===void 0)return;let i=M[n]??{},a={...i[e]};r===void 0?delete a[t]:a[t]={enabled:r},rt({projectSettingsOverrides:{[n]:{...i,[e]:a}}})},ut=async()=>{let t=Be;if(Ve(null),t!==null){if(t.kind===`server`){let n=O[t.id];n?.transport.type===`http`&&n.transport.auth===`oauth`&&await pe({environmentId:e,input:{serverId:t.id}}),await rt({mcpServers:{[t.id]:null}})}else await rt({plugins:{[t.id]:null}});De({kind:`list`})}},dt=we.filter(e=>!e.alreadyAdded),mt=new Set(Je.filter(([e])=>X.kind!==`server`||e!==X.id).map(([,e])=>e.name)),ht=f.trim().toLowerCase(),_t=Je.filter(([,e])=>qt(ht,e.name,We(e))),yt=Ye.filter(([,e])=>qt(ht,e.name,e.path)),xt=dt.filter(e=>qt(ht,e.name,e.summary)),St=(e,t)=>p({mcpServers:O,plugins:j,projectSettingsOverrides:M},e,n??null,t),Ct=(e,t,r)=>{n===void 0?rt(e===`mcpServers`?{mcpServers:{[t]:{...O[t],enabled:r}}}:{plugins:{[t]:{...j[t],enabled:r}}}):lt(e,t,r)},Tt=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-1`,children:[(0,$.jsx)(`h1`,{className:`text-2xl font-semibold text-foreground`,children:`Plugins`}),(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Manage plugins, skills, and MCP servers given to agents on `,t,`.`]})]}),Y?(0,$.jsxs)(y,{children:[(0,$.jsx)(I,{render:(0,$.jsxs)(C,{children:[`Add`,(0,$.jsx)(D,{"aria-hidden":!0})]})}),(0,$.jsxs)(N,{align:`end`,children:[(0,$.jsxs)(i,{onClick:()=>tt(null),children:[(0,$.jsx)(b,{"aria-hidden":!0}),`Add MCP server`]}),(0,$.jsxs)(i,{onClick:()=>nt(null),children:[(0,$.jsx)(a,{"aria-hidden":!0}),`Add plugin`]})]})]}):null]}),Et=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(ce,{"aria-label":`Show`,variant:`default`,value:[u],onValueChange:e=>{let t=e[0];(t===`plugins`||t===`mcps`||t===`skills`)&&(d(t),De({kind:`list`}))},children:[(0,$.jsxs)(le,{value:`plugins`,...Le(`plugins`),children:[`Plugins `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:Ye.length})]}),(0,$.jsxs)(le,{value:`mcps`,...Le(`mcp-servers`),children:[`MCPs `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:Je.length})]}),(0,$.jsxs)(le,{value:`skills`,...Le(`skills`),children:[`Skills `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:x.length})]})]}),(0,$.jsxs)(`div`,{className:`flex w-full gap-2 sm:w-auto`,children:[u===`skills`?(0,$.jsx)(`div`,{className:`w-fit shrink-0`,children:(0,$.jsxs)(H,{value:h,onValueChange:e=>e&&g(e),children:[(0,$.jsx)(V,{"aria-label":`Skill category`,children:(0,$.jsx)(z,{})}),(0,$.jsxs)(B,{children:[(0,$.jsx)(R,{value:`All categories`,children:`All categories`}),$e.filter(e=>e===`Personal`||e===`Built-in`||x.some(({skill:t})=>et(t)===e)).map(e=>(0,$.jsx)(R,{value:e,children:e},e))]})]})}):null,(0,$.jsxs)(xe,{className:`min-w-0 flex-1 sm:w-56`,children:[(0,$.jsx)(ye,{children:(0,$.jsx)(F,{"aria-hidden":!0})}),(0,$.jsx)(be,{"aria-label":Kt[u],placeholder:Kt[u],value:f,onChange:e=>m(e.currentTarget.value)})]})]})]}),Dt=(e,t)=>(0,$.jsxs)(ae,{children:[(0,$.jsx)(re,{render:(0,$.jsx)(C,{size:`icon-sm`,variant:`ghost`,"aria-label":e,onClick:t,children:(0,$.jsx)(A,{"aria-hidden":!0})})}),(0,$.jsx)(ie,{children:e})]}),Ot=yt.length===0?(0,$.jsx)(`p`,{className:`py-6 text-sm text-muted-foreground`,children:Ye.length===0?`No plugins yet. Add a Claude Code or Codex plugin folder to give its tools to your agents.`:`No plugins match your search.`}):(0,$.jsx)(`ul`,{className:`grid gap-1`,children:yt.map(([t,n])=>(0,$.jsx)(Qe,{environmentId:e,plugin:n,enabled:St(`plugins`,t),disabled:!G,onDetails:()=>nt(t),onToggle:e=>Ct(`plugins`,t,e)},t))}),kt=x.filter(({skill:e})=>(h===`All categories`||et(e)===h)&&qt(ht,pt(e),e.name,e.shortDescription??``,e.description??``)),At=kt.length===0?(0,$.jsx)(`p`,{className:`py-6 text-sm text-muted-foreground`,children:x.length===0?`No skills found. Providers report the skills they load when they start.`:`No skills match these filters.`}):(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Switches apply to new Claude and OpenCode sessions.`}),(0,$.jsx)(`ul`,{className:`grid gap-1`,children:kt.map(t=>{let r=et(t.skill),a=(v??[]).filter(e=>l(e.driver)&&e.skills.some(e=>e.name===t.skill.name)),o=a.length?a.map(e=>e.displayName??e.driver).join(`, `):`Native settings`;return(0,$.jsxs)(`li`,{className:`flex items-center gap-3 py-3`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`flex size-10 shrink-0 items-center justify-center rounded-full border border-border/60 text-muted-foreground`,children:(0,$.jsx)(_,{className:`size-4`})}),(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>w(t),className:`w-fit break-words text-left text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:pt(t.skill)}),(0,$.jsx)(Jt,{text:t.skill.shortDescription??t.skill.description??t.skill.path}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:[r,o].filter(Boolean).join(` · `)})]}),(0,$.jsxs)(y,{children:[(0,$.jsxs)(ae,{children:[(0,$.jsx)(re,{render:(0,$.jsx)(I,{render:(0,$.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":`More for ${pt(t.skill)}`,children:(0,$.jsx)(c,{"aria-hidden":!0})})})}),(0,$.jsx)(ie,{children:`Skill actions`})]}),(0,$.jsxs)(N,{align:`end`,children:[U.capabilities.canOpenDefault?(0,$.jsx)(i,{onClick:()=>void U.activate(`open`,{environmentId:e,filePath:t.skill.path,workspaceRoot:void 0}),children:`Open`}):null,(0,$.jsx)(i,{onClick:()=>w(t),children:`Details`}),n!==void 0&&M[n]?.skillOverrides?.[t.skill.name]!==void 0?(0,$.jsx)(i,{onClick:()=>{let e=M[n]??{},r={...e.skillOverrides};delete r[t.skill.name],rt({projectSettingsOverrides:{[n]:{...e,skillOverrides:r}}})},children:`Use environment setting`}):null]})]}),(0,$.jsx)(Ie,{"aria-label":`Enable ${pt(t.skill)} for ${o}`,checked:(n===void 0?void 0:M[n]?.skillOverrides?.[t.skill.name])??L[t.skill.name]??t.skill.enabled,disabled:!G||ee!==null||a.length===0,onCheckedChange:e=>{te(t.skill.name),rt(n===void 0?{skillOverrides:{[t.skill.name]:e}}:{projectSettingsOverrides:{[n]:{...M[n],skillOverrides:{...M[n]?.skillOverrides,[t.skill.name]:e}}}}).finally(()=>te(null))}})]},t.skill.path)})})]}),jt=(0,$.jsxs)(`div`,{className:`grid gap-6`,children:[Je.length>0?(0,$.jsx)(Oe,{title:`Servers`,children:_t.length===0?(0,$.jsx)(`p`,{className:`px-3 text-sm text-muted-foreground sm:px-4`,children:`No MCP servers match your search.`}):(0,$.jsx)($.Fragment,{children:_t.map(([e,t])=>{let n=St(`mcpServers`,e),r=Ue({...t,enabled:n},ge[e],ve.has(e)),a=Ke[e],o=Ut(t,r,ge[e]);return(0,$.jsxs)(`div`,{className:`flex min-h-14 items-center gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,$.jsx)(`span`,{className:`break-words text-sm font-medium text-foreground`,children:t.name}),r.tone===`error`||o?(0,$.jsx)(Wt,{status:r}):null,a?(0,$.jsx)(`span`,{className:`text-xs text-destructive-foreground`,children:a}):null]}),r.needsSignIn&&Y?(0,$.jsx)(C,{size:`xs`,variant:`outline`,onClick:()=>void st(e),children:`Authenticate`}):null,o&&!r.needsSignIn&&Y?(0,$.jsxs)(y,{children:[(0,$.jsxs)(ae,{children:[(0,$.jsx)(re,{render:(0,$.jsx)(I,{render:(0,$.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":`More for ${t.name}`,children:(0,$.jsx)(c,{"aria-hidden":!0})})})}),(0,$.jsx)(ie,{children:`Sign-in actions`})]}),(0,$.jsxs)(N,{align:`end`,children:[(0,$.jsx)(i,{onClick:()=>void st(e,!0),children:`Re-authenticate`}),ge[e]?.auth===`signed-in`?(0,$.jsx)(i,{onClick:()=>void ct(e),children:`Sign out`}):null]})]}):null,Dt(`Settings for ${t.name}`,()=>tt(e)),(0,$.jsx)(Ie,{"aria-label":`Give ${t.name} to agents`,checked:n,disabled:!Y,onCheckedChange:t=>Ct(`mcpServers`,e,t)})]},e)})})}):null,Y&&xt.length>0?(0,$.jsx)(Oe,{title:`Found in provider configs`,headerAction:(0,$.jsx)(C,{size:`icon-xs`,variant:`ghost`,"aria-label":`Look again`,onClick:()=>void Ze(),children:(0,$.jsx)(T,{"aria-hidden":!0})}),children:(0,$.jsx)($.Fragment,{children:xt.map(t=>(0,$.jsxs)(`div`,{className:`flex min-h-14 items-center gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,$.jsx)(`span`,{className:`break-words text-sm font-medium text-foreground`,children:t.name}),xt.filter(e=>e.name===t.name).length>1?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(t.providers??[t.provider]).map(e=>Rt[e]).join(`, `)}):null]}),(0,$.jsx)(C,{size:`xs`,variant:`outline`,onClick:async()=>{(await he({environmentId:e,input:{...n===void 0?{}:{projectId:n},servers:[{provider:t.provider,path:t.path,name:t.name}]}}))._tag===`Success`&&(Ze(),Xe())},children:`Import`})]},`${t.provider}:${t.path}:${t.name}`))})}):null]}),Mt=X.kind===`server`?(0,$.jsxs)(gt,{title:X.id===null?`Add MCP server`:`Update ${O[X.id]?.name??`server`} MCP`,onBack:()=>De({kind:`list`}),onUninstall:X.id!==null&&Y?()=>Ve({kind:`server`,id:X.id}):void 0,children:[(0,$.jsx)(vt,{server:X.id===null?void 0:O[X.id],takenNames:mt,onSave:e=>void ot(X.id??o.make(k()),e,X.id===null)},X.id??`new`),X.id!==null&&O[X.id]!==void 0?(0,$.jsx)(Zt,{environmentId:e,id:X.id,server:O[X.id],runtime:ge[X.id],checking:ve.has(X.id),canManage:Y,projectLabel:r,projectOverride:n===void 0?void 0:M[n]?.mcpServers?.[X.id],awaitingSignIn:He===X.id,onProviderToggle:(e,t)=>{let n=O[X.id],r=t?n.disabledProviders.filter(t=>t!==e):[...n.disabledProviders,e];rt({mcpServers:{[X.id]:{...n,disabledProviders:r}}})},onProjectOverride:n===void 0?void 0:e=>lt(`mcpServers`,X.id,e),signInError:Ke[X.id],onTest:()=>void it(X.id),onSignIn:()=>void st(X.id),onReauthenticate:()=>void st(X.id,!0),onSignOut:()=>void ct(X.id)},`${e}:${X.id}`):null]}):null,Nt=X.kind===`plugin`?(0,$.jsxs)(gt,{title:X.id===null?`Add plugin`:`Update ${j[X.id]?.name??`plugin`}`,onBack:()=>De({kind:`list`}),onUninstall:X.id!==null&&Y?()=>Ve({kind:`plugin`,id:X.id}):void 0,children:[(0,$.jsx)(bt,{environmentId:e,plugin:X.id===null?void 0:j[X.id],environmentLabel:t,onSave:async e=>{let t=X.id??E.make(k());(await rt({plugins:{[t]:e}}))._tag===`Success`&&X.id===null&&De({kind:`list`})}},X.id??`new`),X.id!==null&&j[X.id]!==void 0?(0,$.jsx)(on,{plugin:j[X.id],projectLabel:r,projectOverride:n===void 0?void 0:M[n]?.plugins?.[X.id],onProjectOverride:n===void 0?void 0:e=>lt(`plugins`,X.id,e)}):null]}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`grid gap-6`,children:[Tt,Et,Mt??Nt??(u===`plugins`?Ot:u===`mcps`?jt:At)]}),S===null?null:(0,$.jsx)(wt,{entry:S,environmentId:e,onClose:()=>w(null)}),(0,$.jsx)(Me,{open:Be!==null,onOpenChange:e=>!e&&Ve(null),children:(0,$.jsxs)(Pe,{children:[(0,$.jsxs)(Ae,{children:[(0,$.jsxs)(Ne,{children:[`Remove`,` `,Be?.kind===`server`?O[Be.id]?.name??`server`:Be?.kind===`plugin`?j[Be.id]?.name??`plugin`:``,`?`]}),(0,$.jsxs)(je,{children:[`New sessions on `,t,` stop getting it. Its stored values and sign-in are deleted. Provider config files are not changed.`]})]}),(0,$.jsxs)(Fe,{children:[(0,$.jsx)(ke,{render:(0,$.jsx)(C,{variant:`outline`,children:`Cancel`})}),(0,$.jsx)(C,{variant:`destructive`,onClick:()=>void ut(),children:`Remove`})]})]})})]})}function Xt(e){let t=(0,Z.c)(16),{projectLabel:n,override:r,inherited:i,onChange:a}=e,o=r?.enabled!==void 0,s=`In ${n}`,c=o?`Set for this project.`:`Follows the environment (${i?`on`:`off`}).`,l;t[0]!==a||t[1]!==o?(l=o?(0,$.jsx)(C,{size:`xs`,variant:`ghost`,onClick:()=>a(void 0),children:`Reset`}):null,t[0]=a,t[1]=o,t[2]=l):l=t[2];let u=`Use in ${n}`,d=r?.enabled??i,f;t[3]===a?f=t[4]:(f=e=>a(e),t[3]=a,t[4]=f);let p;t[5]!==u||t[6]!==d||t[7]!==f?(p=(0,$.jsx)(Ie,{"aria-label":u,checked:d,onCheckedChange:f}),t[5]=u,t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==l||t[10]!==p?(m=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,p]}),t[9]=l,t[10]=p,t[11]=m):m=t[11];let h;return t[12]!==s||t[13]!==c||t[14]!==m?(h=(0,$.jsx)(Ee,{title:s,description:c,control:m}),t[12]=s,t[13]=c,t[14]=m,t[15]=h):h=t[15],h}function Zt(e){let t=(0,Z.c)(108),{environmentId:n,id:r,server:i,runtime:a,checking:o,canManage:s,projectLabel:c,projectOverride:l,awaitingSignIn:u,signInError:f,onProviderToggle:p,onProjectOverride:m,onTest:h,onSignIn:g,onReauthenticate:_,onSignOut:v}=e,y=s&&i.transport.type===`http`&&i.transport.auth===`oauth`&&a?.auth===`signed-out`,b=tn(n,r,y),x=b.entries,S;t[0]!==o||t[1]!==a||t[2]!==i?(S=Ue(i,a,o),t[0]=o,t[1]=a,t[2]=i,t[3]=S):S=t[3];let w=S,T;t[4]===x?T=t[5]:(T=x?.filter($t).length??0,t[4]=x,t[5]=T);let E=T,D;t[6]!==w||t[7]!==E||t[8]!==x||t[9]!==y?(D=y?{...w,tone:`muted`,label:x===null?`Checking providers…`:E>0?`Available to ${E} ${E===1?`provider`:`providers`}`:`No providers connected`}:w,t[6]=w,t[7]=E,t[8]=x,t[9]=y,t[10]=D):D=t[10];let O=D,k,A,j,M,N,P,F;if(t[11]!==u||t[12]!==s||t[13]!==o||t[14]!==x||t[15]!==r||t[16]!==p||t[17]!==_||t[18]!==g||t[19]!==v||t[20]!==h||t[21]!==a?.auth||t[22]!==i||t[23]!==f||t[24]!==b||t[25]!==O||t[26]!==y){let e;t[34]===x?e=t[35]:(e=e=>({...e,badge:x===null||e.unsupported!==void 0?void 0:at(e.driver,x)}),t[34]=x,t[35]=e);let n=ot(i).map(e),c=i.transport.type===`http`&&a?.auth===`signed-in`,l=f??O.detail;N=`grid gap-6`,P=r;let m;t[36]===O?m=t[37]:(m=(0,$.jsx)(Wt,{status:O,className:`flex-1 text-sm`}),t[36]=O,t[37]=m);let S;t[38]!==u||t[39]!==s||t[40]!==g||t[41]!==O.needsSignIn||t[42]!==y?(S=O.needsSignIn&&s&&!y?(0,$.jsx)(C,{size:`xs`,onClick:g,children:u?`Open sign-in again`:`Authenticate`}):null,t[38]=u,t[39]=s,t[40]=g,t[41]=O.needsSignIn,t[42]=y,t[43]=S):S=t[43];let w;t[44]!==s||t[45]!==_||t[46]!==c||t[47]!==O.needsSignIn?(w=c&&!O.needsSignIn&&s?(0,$.jsx)(C,{size:`xs`,variant:`outline`,onClick:_,children:`Re-authenticate`}):null,t[44]=s,t[45]=_,t[46]=c,t[47]=O.needsSignIn,t[48]=w):w=t[48];let T;t[49]!==s||t[50]!==v||t[51]!==c?(T=c&&s?(0,$.jsx)(C,{size:`xs`,variant:`ghost`,onClick:v,children:`Sign out`}):null,t[49]=s,t[50]=v,t[51]=c,t[52]=T):T=t[52];let E;t[53]!==s||t[54]!==o||t[55]!==h||t[56]!==i.enabled?(E=s&&i.enabled?(0,$.jsx)(C,{size:`xs`,variant:`outline`,disabled:o,onClick:h,children:`Test connection`}):null,t[53]=s,t[54]=o,t[55]=h,t[56]=i.enabled,t[57]=E):E=t[57];let D;t[58]!==m||t[59]!==S||t[60]!==w||t[61]!==T||t[62]!==E?(D=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[m,S,w,T,E]}),t[58]=m,t[59]=S,t[60]=w,t[61]=T,t[62]=E,t[63]=D):D=t[63];let I;t[64]!==u||t[65]!==O.needsSignIn||t[66]!==y?(I=O.needsSignIn&&!y?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u?`Finish signing in in your browser, then come back here.`:y?`Sign in here to give it to every provider.`:`Agents can't reach this server until you sign in.`}):null,t[64]=u,t[65]=O.needsSignIn,t[66]=y,t[67]=I):I=t[67];let L;t[68]!==l||t[69]!==y?(L=l&&!y?(0,$.jsx)(`p`,{className:`rounded-md bg-destructive/8 px-2.5 py-1.5 text-xs text-destructive-foreground`,children:l}):null,t[68]=l,t[69]=y,t[70]=L):L=t[70];let R;t[71]!==u||t[72]!==l||t[73]!==g||t[74]!==y?(R=y?(0,$.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:l?`Shared sign-in unavailable`:`Shared sign-in`}),(0,$.jsxs)(`div`,{className:`grid gap-2 pt-2`,children:[(0,$.jsx)(`p`,{children:l??`Sign in through P4 Code to share access with every enabled provider.`}),(0,$.jsx)(`div`,{children:(0,$.jsx)(C,{size:`xs`,variant:`outline`,onClick:g,children:u?`Open browser`:l?`Retry shared sign-in`:`Sign in through P4 Code`})})]})]}):null,t[71]=u,t[72]=l,t[73]=g,t[74]=y,t[75]=R):R=t[75];let z;t[76]===i.source?z=t[77]:(z=i.source?(0,$.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:`Import source`}),(0,$.jsx)(`p`,{className:`break-all pt-2`,children:i.source.path})]}):null,t[76]=i.source,t[77]=z);let B=y?(0,$.jsx)(rn,{serverName:i.name,signIns:b,blocked:n.filter(Qt).length}):null;t[78]!==D||t[79]!==I||t[80]!==L||t[81]!==R||t[82]!==z||t[83]!==B?(F=(0,$.jsx)(Oe,{title:`Status`,children:(0,$.jsx)(we,{children:(0,$.jsxs)(`div`,{className:`grid gap-2 px-4 py-3`,children:[D,I,L,R,z,B]})})}),t[78]=D,t[79]=I,t[80]=L,t[81]=R,t[82]=z,t[83]=B,t[84]=F):F=t[84],A=Oe,M=`Providers`,k=we;let V;t[85]!==s||t[86]!==p||t[87]!==i.name?(V=e=>(0,$.jsx)(Ee,{title:e.label,...e.unsupported===void 0?{}:{description:e.unsupported},control:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.badge===void 0?null:(0,$.jsx)(d,{variant:an[e.badge].variant,children:an[e.badge].label}),(0,$.jsx)(Ie,{"aria-label":`Give ${i.name} to ${e.label}`,checked:e.enabled&&e.badge!==`unavailable`,disabled:!s||e.unsupported!==void 0||e.badge===`unavailable`,onCheckedChange:t=>p(e.driver,t)})]})},e.driver),t[85]=s,t[86]=p,t[87]=i.name,t[88]=V):V=t[88],j=n.map(V),t[11]=u,t[12]=s,t[13]=o,t[14]=x,t[15]=r,t[16]=p,t[17]=_,t[18]=g,t[19]=v,t[20]=h,t[21]=a?.auth,t[22]=i,t[23]=f,t[24]=b,t[25]=O,t[26]=y,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N,t[32]=P,t[33]=F}else k=t[27],A=t[28],j=t[29],M=t[30],N=t[31],P=t[32],F=t[33];let I;t[89]!==k||t[90]!==j?(I=(0,$.jsx)(k,{children:j}),t[89]=k,t[90]=j,t[91]=I):I=t[91];let L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(`p`,{className:`px-3 text-xs text-muted-foreground sm:px-4`,children:`A change reaches a thread when its provider session next starts.`}),t[92]=L):L=t[92];let R;t[93]!==A||t[94]!==M||t[95]!==I?(R=(0,$.jsxs)(A,{title:M,children:[I,L]}),t[93]=A,t[94]=M,t[95]=I,t[96]=R):R=t[96];let z;t[97]!==m||t[98]!==c||t[99]!==l||t[100]!==i.enabled?(z=c!==void 0&&m!==void 0?(0,$.jsx)(Oe,{title:`Project`,children:(0,$.jsx)(we,{children:(0,$.jsx)(Xt,{projectLabel:c,override:l,inherited:i.enabled,onChange:m})})}):null,t[97]=m,t[98]=c,t[99]=l,t[100]=i.enabled,t[101]=z):z=t[101];let B;return t[102]!==R||t[103]!==z||t[104]!==N||t[105]!==P||t[106]!==F?(B=(0,$.jsxs)(`div`,{className:N,"data-server-id":P,children:[F,R,z]}),t[102]=R,t[103]=z,t[104]=N,t[105]=P,t[106]=F,t[107]=B):B=t[107],B}function Qt(e){return e.enabled&&e.badge===`unavailable`}function $t(e){return e.status===`signed-in`}function en(e){let t=j(e);return Vt(t)&&t.detail!==void 0?t.detail:`Sign-in could not start. Try again.`}function tn(e,t,n){let r=J(q.mcpRegistryProviderSignInState,{reportFailure:!1}),i=J(q.mcpRegistryProviderSignInStart,{reportFailure:!1}),a=J(q.mcpRegistryProviderSignInWait,{reportFailure:!1}),o=J(q.mcpRegistryProviderSignInComplete,{reportFailure:!1}),s=J(q.mcpRegistryProviderSignInCancel,{reportFailure:!1}),c=J(q.mcpRegistryProviderSignOut,{reportFailure:!1}),l=P(q.mcpRegistryProviderSignInComplete.permissionAtom(e)),u=P(q.mcpRegistryProviderSignInCancel.permissionAtom(e)),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)({}),[h,g]=(0,Q.useState)(new Set),_=(0,Q.useRef)(new Set),v=e=>f(t=>t?.map(t=>t.instanceId===e.instanceId?e:t)??null),y=(e,t)=>m(n=>{let r={...n};return t===void 0?delete r[e]:r[e]=t,r});return(0,Q.useEffect)(()=>{if(!n)return;let i=!1;return r({environmentId:e,input:{serverId:t}}).then(e=>{i||f(e._tag===`Success`?e.value.providers:[])}),()=>{i=!0}},[n,e,r,t]),(0,Q.useEffect)(()=>{if(!n)return;let r=!1;for(let n of d??[]){let i=n.pending;i&&a({environmentId:e,input:{serverId:t,instanceId:n.instanceId,flowId:i.flowId}}).then(e=>{r||(f(t=>t?.map(t=>{if(t.instanceId!==n.instanceId||t.pending?.flowId!==i.flowId)return t;if(e._tag===`Success`)return e.value;let{pending:r,...a}=t;return a})??null),e._tag===`Failure`?y(n.instanceId,en(e.cause)):e._tag===`Success`&&e.value.status!==`signed-in`&&!_.current.has(n.instanceId)&&y(n.instanceId,`Sign-in ended without connecting. Try again.`))})}return()=>{r=!0}},[n,d,e,t,a]),{entries:n?d:null,errors:p,busy:h,run:async(n,r,a)=>{if(!_.current.has(n.instanceId)){_.current.add(n.instanceId),g(new Set(_.current)),y(n.instanceId,void 0);try{let l={serverId:t,instanceId:n.instanceId};if(r===`start`){let t=await i({environmentId:e,input:l});t._tag===`Success`?(v({...n,pending:t.value}),window.open(t.value.authorizationUrl,`_blank`,`noopener,noreferrer`)):t._tag===`Failure`&&y(n.instanceId,en(t.cause));return}let u={...l,flowId:n.pending?.flowId??``},d=r===`complete`?await o({environmentId:e,input:{...u,callbackUrl:a.trim()}}):r===`cancel`?await s({environmentId:e,input:u}):await c({environmentId:e,input:l});d._tag===`Success`?v(d.value):d._tag===`Failure`&&y(n.instanceId,en(d.cause))}finally{_.current.delete(n.instanceId),g(new Set(_.current))}}},canComplete:l,canCancel:u}}function nn(e){let t=(0,Z.c)(39),{entry:n,signIns:r}=e,i;t[0]!==n.displayName||t[1]!==n.driver?(i=n.displayName??rt(n.driver),t[0]=n.displayName,t[1]=n.driver,t[2]=i):i=t[2];let a=i,[o,s]=(0,Q.useState)(``),c=n.pending,l;t[3]!==n.instanceId||t[4]!==r.busy?(l=r.busy.has(n.instanceId),t[3]=n.instanceId,t[4]=r.busy,t[5]=l):l=t[5];let u=l,d=r.errors[n.instanceId],f=`mcp-callback-${n.instanceId}`,p;t[6]===a?p=t[7]:(p=(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:a}),t[6]=a,t[7]=p);let m=c?`text-warning-foreground`:n.status===`signed-in`?`text-success-foreground`:`text-muted-foreground`,h;t[8]===m?h=t[9]:(h=M(`text-xs`,m),t[8]=m,t[9]=h);let g;t[10]!==n.status||t[11]!==c?(g=c?`Waiting for sign-in`:it(n.status),t[10]=n.status,t[11]=c,t[12]=g):g=t[12];let _;t[13]!==h||t[14]!==g?(_=(0,$.jsx)(`p`,{className:h,role:`status`,children:g}),t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==p||t[17]!==_?(v=(0,$.jsxs)(`div`,{className:`grid gap-1`,children:[p,_]}),t[16]=p,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==u||t[20]!==n||t[21]!==d||t[22]!==c||t[23]!==r?(y=!c&&n.status!==`unavailable`?(0,$.jsx)(C,{size:`xs`,variant:n.status===`signed-in`?`outline`:`default`,disabled:u,onClick:()=>void r.run(n,n.status===`signed-in`?`signOut`:`start`),children:u?`Please wait…`:n.status===`signed-in`?`Sign out`:d?`Start over`:`Sign in`}):null,t[19]=u,t[20]=n,t[21]=d,t[22]=c,t[23]=r,t[24]=y):y=t[24];let b;t[25]!==v||t[26]!==y?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[v,y]}),t[25]=v,t[26]=y,t[27]=b):b=t[27];let x;t[28]!==u||t[29]!==o||t[30]!==n||t[31]!==d||t[32]!==f||t[33]!==c||t[34]!==r?(x=c?(0,$.jsxs)(`form`,{className:`grid gap-2`,onSubmit:e=>{e.preventDefault(),o.trim()&&!u&&r.canComplete&&r.run(n,`complete`,o)},children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Approve in your browser. If it ends on a callback URL, paste that URL here.`}),(0,$.jsx)(`label`,{htmlFor:f,className:`text-xs font-medium`,children:`Callback URL`}),(0,$.jsx)(ue,{id:f,value:o,onChange:e=>s(e.target.value),placeholder:`http://localhost:…/callback?code=…&state=…`,autoComplete:`off`,spellCheck:!1,disabled:u||!r.canComplete,"aria-invalid":!!d,"aria-describedby":d?`${f}-error`:void 0}),d?(0,$.jsx)(`p`,{id:`${f}-error`,role:`alert`,className:`text-xs text-destructive-foreground`,children:d}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(C,{type:`submit`,size:`xs`,disabled:u||!o.trim()||!r.canComplete,children:u?`Please wait…`:`Finish sign-in`}),(0,$.jsx)(C,{type:`button`,size:`xs`,variant:`outline`,disabled:u,onClick:()=>window.open(c.authorizationUrl,`_blank`,`noopener,noreferrer`),children:`Open browser`}),(0,$.jsx)(C,{type:`button`,size:`xs`,variant:`ghost`,disabled:u||!r.canCancel,onClick:()=>void r.run(n,`cancel`),children:`Cancel`})]})]}):d?(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive-foreground`,children:d}):null,t[28]=u,t[29]=o,t[30]=n,t[31]=d,t[32]=f,t[33]=c,t[34]=r,t[35]=x):x=t[35];let S;return t[36]!==b||t[37]!==x?(S=(0,$.jsxs)(`div`,{className:`grid gap-2 border-t border-border pt-3`,children:[b,x]}),t[36]=b,t[37]=x,t[38]=S):S=t[38],S}function rn(e){let t=(0,Z.c)(8),{serverName:n,signIns:r,blocked:i}=e,a;t[0]===r?a=t[1]:(a=r.entries===null?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Checking providers…`}):r.entries.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No enabled provider here can sign in to MCP servers itself.`}):r.entries.map(e=>(0,$.jsx)(nn,{entry:e,signIns:r},`${e.instanceId}:${e.pending?.flowId??`idle`}`)),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n?(o=i>0?(0,$.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer`,children:[i,` other `,i===1?`provider`:`providers`,` unavailable`]}),(0,$.jsxs)(`p`,{className:`pt-2`,children:[`These providers need shared sign-in to use `,n,`.`]})]}):null,t[2]=i,t[3]=n,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}var an={"signed-in":{variant:`success`,label:`Signed in`},"needs-sign-in":{variant:`warning`,label:`Sign in needed`},unavailable:{variant:`secondary`,label:`Unavailable`}};function on(e){let t=(0,Z.c)(7),{plugin:n,projectLabel:r,projectOverride:i,onProjectOverride:a}=e,o;t[0]!==a||t[1]!==n||t[2]!==r||t[3]!==i?(o=r!==void 0&&a!==void 0?(0,$.jsx)(Oe,{title:`Project`,children:(0,$.jsx)(we,{children:(0,$.jsx)(Xt,{projectLabel:r,override:i,inherited:n.enabled,onChange:a})})}):null,t[0]=a,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;return t[5]===o?s=t[6]:(s=(0,$.jsx)(`div`,{className:`grid gap-6`,children:o}),t[5]=o,t[6]=s),s}var sn=Gt;export{sn as component};
5
- //# sourceMappingURL=settings.plugins-C1PnlzX1.js.map
3
+ `).map(e=>e.trim()).filter(e=>e.length>0),env:n,...e.cwd.trim()?{cwd:e.cwd.trim()}:{}}:{type:`http`,url:e.url.trim(),headers:n,auth:e.auth};return{name:e.name.trim(),enabled:t?.enabled??!0,transport:r,disabledProviders:t?.disabledProviders??[],...t?.source===void 0?{}:{source:t.source}}}function ft(e){let t=new Map;for(let n of e){let e=n.displayName??n.driver;for(let r of n.skills){let n=`${r.scope??``}\u0000${r.name}`,i=t.get(n);i===void 0?t.set(n,{skill:r,providers:[e]}):i.providers.includes(e)||i.providers.push(e)}}return[...t.values()].toSorted((e,t)=>pt(e.skill).localeCompare(pt(t.skill)))}var pt=e=>e.displayName??e.name.split(/[-_\s]+/).filter(e=>e.length>0).map(e=>e[0].toUpperCase()+e.slice(1)).join(` `);function mt(e){switch(e){case void 0:return;case`user`:return`Personal`;case`project`:case`repo`:return`Project`;case`system`:return`Built-in`;default:return e[0].toUpperCase()+e.slice(1)}}function ht(e){let t=/^---\r?\n[\s\S]*?\r?\n---\r?\n?/.exec(e);return(t===null?e:e.slice(t[0].length)).trimStart()}function gt(e){let t=(0,Z.c)(14),{title:n,onBack:r,onUninstall:i,children:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(M,{"aria-hidden":!0}),t[0]=o):o=t[0];let s;t[1]===r?s=t[2]:(s=(0,$.jsxs)(T,{size:`xs`,variant:`ghost`,className:`w-fit`,onClick:r,children:[o,`Back`]}),t[1]=r,t[2]=s);let c;t[3]===n?c=t[4]:(c=(0,$.jsx)(`h2`,{className:`min-w-0 truncate text-xl font-semibold text-foreground`,children:n}),t[3]=n,t[4]=c);let l;t[5]===i?l=t[6]:(l=i?(0,$.jsxs)(T,{size:`sm`,variant:`destructive-outline`,onClick:i,children:[(0,$.jsx)(g,{"aria-hidden":!0}),`Uninstall`]}):null,t[5]=i,t[6]=l);let u;t[7]!==c||t[8]!==l?(u=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[c,l]}),t[7]=c,t[8]=l,t[9]=u):u=t[9];let d;return t[10]!==a||t[11]!==s||t[12]!==u?(d=(0,$.jsxs)(`div`,{className:`grid gap-6`,children:[s,u,a]}),t[10]=a,t[11]=s,t[12]=u,t[13]=d):d=t[13],d}function _t(e){let t=(0,Z.c)(6),{label:n,htmlFor:r,children:i}=e,a;t[0]!==r||t[1]!==n?(a=(0,$.jsx)(X,{htmlFor:r,children:n}),t[0]=r,t[1]=n,t[2]=a):a=t[2];let o;return t[3]!==i||t[4]!==a?(o=(0,$.jsxs)(`div`,{className:`grid gap-2 px-4 py-4`,children:[a,i]}),t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function vt(e){let t=(0,Z.c)(69),{server:n,takenNames:r,onSave:i}=e,a;t[0]===n?a=t[1]:(a=n===void 0?st:ct(n),t[0]=n,t[1]=a);let o=a,[s,c]=(0,Q.useState)(o),l;t[2]===o?l=t[3]:(l=JSON.stringify(o),t[2]=o,t[3]=l);let u=l,[d,f]=(0,Q.useState)(u);u!==d&&(f(u),c(o));let p;t[4]!==s||t[5]!==r?(p=ut(s,r),t[4]=s,t[5]=r,t[6]=p):p=t[6];let m=p,h;t[7]===s?h=t[8]:(h=JSON.stringify(s),t[7]=s,t[8]=h);let _=h!==u,v;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>c(t=>({...t,...e})),t[9]=v):v=t[9];let y=v,b=s.type===`stdio`?`Environment variables`:`Headers`,x;t[10]===s.values?x=t[11]:(x=(e,t)=>y({values:s.values.map((n,r)=>r===e?{...n,...t}:n)}),t[10]=s.values,t[11]=x);let S=x,C;t[12]!==_||t[13]!==s||t[14]!==i||t[15]!==m||t[16]!==n?(C=e=>{e.preventDefault(),_&&m===void 0&&i(dt(s,n))},t[12]=_,t[13]=s,t[14]=i,t[15]=m,t[16]=n,t[17]=C):C=t[17];let w;t[18]===n?w=t[19]:(w=n===void 0?null:(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`To switch between a command and a URL, uninstall the server and add it again.`}),t[18]=n,t[19]=w);let E;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>y({name:e.target.value}),t[20]=E):E=t[20];let D;t[21]===s.name?D=t[22]:(D=(0,$.jsx)(_t,{label:`Name`,htmlFor:`mcp-server-name`,children:(0,$.jsx)(ue,{id:`mcp-server-name`,placeholder:`github`,value:s.name,onChange:E})}),t[21]=s.name,t[22]=D);let O;t[23]!==s.type||t[24]!==n?(O=n===void 0?(0,$.jsx)(_t,{label:`Type`,children:(0,$.jsxs)(ce,{"aria-label":`How P4 Code reaches the server`,value:[s.type],onValueChange:e=>{let t=e[0];(t===`stdio`||t===`http`)&&y({type:t,values:[]})},children:[(0,$.jsx)(le,{value:`stdio`,children:`Command`}),(0,$.jsx)(le,{value:`http`,children:`URL`})]})}):null,t[23]=s.type,t[24]=n,t[25]=O):O=t[25];let A;t[26]!==s.args||t[27]!==s.auth||t[28]!==s.command||t[29]!==s.cwd||t[30]!==s.type||t[31]!==s.url?(A=s.type===`stdio`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_t,{label:`Command`,htmlFor:`mcp-server-command`,children:(0,$.jsx)(ue,{id:`mcp-server-command`,placeholder:`npx`,value:s.command,onChange:e=>y({command:e.target.value})})}),(0,$.jsx)(_t,{label:`Arguments, one per line`,htmlFor:`mcp-server-args`,children:(0,$.jsx)(se,{id:`mcp-server-args`,placeholder:`-y
4
+ @modelcontextprotocol/server-postgres`,value:s.args,onChange:e=>y({args:e.target.value})})}),(0,$.jsx)(_t,{label:`Working directory (optional)`,htmlFor:`mcp-server-cwd`,children:(0,$.jsx)(ue,{id:`mcp-server-cwd`,placeholder:`The session's project folder`,value:s.cwd,onChange:e=>y({cwd:e.target.value})})})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(_t,{label:`URL`,htmlFor:`mcp-server-url`,children:(0,$.jsx)(ue,{id:`mcp-server-url`,placeholder:`https://mcp.example.com/mcp`,value:s.url,onChange:e=>y({url:e.target.value})})}),(0,$.jsx)(_t,{label:`Authentication`,children:(0,$.jsxs)(H,{value:s.auth,onValueChange:e=>{(e===`none`||e===`oauth`)&&y({auth:e})},children:[(0,$.jsx)(V,{"aria-label":`Authentication`,children:(0,$.jsx)(z,{children:yt})}),(0,$.jsxs)(B,{alignItemWithTrigger:!1,children:[(0,$.jsx)(R,{value:`none`,children:`None or headers`}),(0,$.jsx)(R,{value:`oauth`,children:`OAuth (sign in after saving)`})]})]})})]}),t[26]=s.args,t[27]=s.auth,t[28]=s.command,t[29]=s.cwd,t[30]=s.type,t[31]=s.url,t[32]=A):A=t[32];let j;t[33]!==s.type||t[34]!==s.values||t[35]!==S||t[36]!==b?(j=s.values.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(ue,{"aria-label":`${b} name`,placeholder:s.type===`stdio`?`API_TOKEN`:`Authorization`,value:e.key,onChange:e=>S(t,{key:e.target.value})}),(0,$.jsx)(Ve,{"aria-label":`${b} value`,placeholder:`Value`,value:e.value,onChange:e=>S(t,{value:e.target.value})}),(0,$.jsx)(T,{size:`icon-sm`,variant:`ghost`,"aria-label":`Remove ${e.key||`row`}`,onClick:()=>y({values:s.values.filter((e,n)=>n!==t)}),children:(0,$.jsx)(g,{"aria-hidden":!0})})]},t)),t[33]=s.type,t[34]=s.values,t[35]=S,t[36]=b,t[37]=j):j=t[37];let M;t[38]===s.values?M=t[39]:(M=()=>y({values:[...s.values,{key:``,value:``}]}),t[38]=s.values,t[39]=M);let N;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,$.jsx)(k,{"aria-hidden":!0}),t[40]=N):N=t[40];let P=s.type===`stdio`?`variable`:`header`,F;t[41]!==M||t[42]!==P?(F=(0,$.jsxs)(T,{variant:`soft`,onClick:M,children:[N,`Add `,P]}),t[41]=M,t[42]=P,t[43]=F):F=t[43];let I;t[44]!==j||t[45]!==F?(I=(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[j,F]}),t[44]=j,t[45]=F,t[46]=I):I=t[46];let L;t[47]!==I||t[48]!==b?(L=(0,$.jsx)(_t,{label:b,children:I}),t[47]=I,t[48]=b,t[49]=L):L=t[49];let U;t[50]!==D||t[51]!==O||t[52]!==A||t[53]!==L?(U=(0,$.jsxs)(je,{children:[D,O,A,L]}),t[50]=D,t[51]=O,t[52]=A,t[53]=L,t[54]=U):U=t[54];let W;t[55]!==_||t[56]!==m?(W=_&&m!==void 0?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-foreground`,children:m}):null,t[55]=_,t[56]=m,t[57]=W):W=t[57];let G=!_||m!==void 0,K=n===void 0?`Add server`:`Save`,q;t[58]!==G||t[59]!==K?(q=(0,$.jsx)(T,{type:`submit`,disabled:G,children:K}),t[58]=G,t[59]=K,t[60]=q):q=t[60];let ee;t[61]!==W||t[62]!==q?(ee=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[W,q]}),t[61]=W,t[62]=q,t[63]=ee):ee=t[63];let J;return t[64]!==U||t[65]!==ee||t[66]!==C||t[67]!==w?(J=(0,$.jsxs)(`form`,{className:`grid gap-3`,onSubmit:C,children:[w,U,ee]}),t[64]=U,t[65]=ee,t[66]=C,t[67]=w,t[68]=J):J=t[68],J}function yt(e){return e===`oauth`?`OAuth (sign in after saving)`:`None or headers`}function bt(e){let t=(0,Z.c)(55),{environmentId:n,plugin:r,environmentLabel:i,onSave:a}=e,o=r?.path??``,s=r===void 0?null:`.claude-plugin/plugin.json`,c;t[0]!==n||t[1]!==o||t[2]!==s?(c=Se(n,o,s),t[0]=n,t[1]=o,t[2]=s,t[3]=c):c=t[3];let l=D(p(j(c))),u=Xe(r!==void 0&&l!==null&&!l.truncated?l.contents:null),d;t[4]===r?.options?d=t[5]:(d=r?.options??{},t[4]=r?.options,t[5]=d);let f=d,m=[...u,...Object.keys(f).filter(e=>!u.some(t=>t.key===e)).map(St)],[h,g]=(0,Q.useState)(r?.name??``),[_,v]=(0,Q.useState)(r?.path??``),[y,b]=(0,Q.useState)(f),x;t[6]!==r?.name||t[7]!==r?.path||t[8]!==f?(x=JSON.stringify([r?.name??``,r?.path??``,f]),t[6]=r?.name,t[7]=r?.path,t[8]=f,t[9]=x):x=t[9];let S=x,[C,w]=(0,Q.useState)(S);S!==C&&(w(S),g(r?.name??``),v(r?.path??``),b(f));let E,O;t[10]!==h||t[11]!==y||t[12]!==_||t[13]!==r?.name||t[14]!==r?.path||t[15]!==f?(E=Object.fromEntries(Object.entries(y).filter(xt)),O=h!==(r?.name??``)||_!==(r?.path??``)||JSON.stringify(E)!==JSON.stringify(f),t[10]=h,t[11]=y,t[12]=_,t[13]=r?.name,t[14]=r?.path,t[15]=f,t[16]=E,t[17]=O):(E=t[16],O=t[17]);let k=O,A;t[18]!==h||t[19]!==_?(A=h.trim().length>0&&_.trim().startsWith(`/`),t[18]=h,t[19]=_,t[20]=A):A=t[20];let M=A,N;t[21]!==k||t[22]!==h||t[23]!==E||t[24]!==a||t[25]!==_||t[26]!==r?.enabled||t[27]!==M?(N=e=>{e.preventDefault(),k&&M&&a({name:h.trim(),path:_.trim(),enabled:r?.enabled??!0,options:E})},t[21]=k,t[22]=h,t[23]=E,t[24]=a,t[25]=_,t[26]=r?.enabled,t[27]=M,t[28]=N):N=t[28];let P;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>g(e.target.value),t[29]=P):P=t[29];let F;t[30]===h?F=t[31]:(F=(0,$.jsx)(_t,{label:`Name`,htmlFor:`plugin-name`,children:(0,$.jsx)(ue,{id:`plugin-name`,value:h,onChange:P})}),t[30]=h,t[31]=F);let I=`Folder on ${i}`,L;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>v(e.target.value),t[32]=L):L=t[32];let R;t[33]===_?R=t[34]:(R=(0,$.jsx)(ue,{id:`plugin-path`,placeholder:`/Users/me/plugins/my-plugin`,value:_,onChange:L}),t[33]=_,t[34]=R);let z;t[35]!==I||t[36]!==R?(z=(0,$.jsx)(_t,{label:I,htmlFor:`plugin-path`,children:R}),t[35]=I,t[36]=R,t[37]=z):z=t[37];let B=m.map(e=>(0,$.jsx)(_t,{label:e.required?e.title:`${e.title} (optional)`,htmlFor:`plugin-option-${e.key}`,children:(0,$.jsx)(Ve,{id:`plugin-option-${e.key}`,placeholder:`description`in e?e.description:void 0,value:y[e.key]??``,onChange:t=>b(n=>({...n,[e.key]:t.target.value}))})},e.key)),V;t[38]!==F||t[39]!==z||t[40]!==B?(V=(0,$.jsxs)(je,{children:[F,z,B]}),t[38]=F,t[39]=z,t[40]=B,t[41]=V):V=t[41];let H;t[42]!==k||t[43]!==M?(H=k&&!M?(0,$.jsx)(`p`,{role:`alert`,className:`text-sm text-destructive-foreground`,children:`Enter a name and the plugin folder's full path.`}):null,t[42]=k,t[43]=M,t[44]=H):H=t[44];let U=!k||!M,W=r===void 0?`Add plugin`:`Save`,G;t[45]!==U||t[46]!==W?(G=(0,$.jsx)(T,{type:`submit`,disabled:U,children:W}),t[45]=U,t[46]=W,t[47]=G):G=t[47];let K;t[48]!==H||t[49]!==G?(K=(0,$.jsxs)(`div`,{className:`flex items-center justify-end gap-3`,children:[H,G]}),t[48]=H,t[49]=G,t[50]=K):K=t[50];let q;return t[51]!==V||t[52]!==K||t[53]!==N?(q=(0,$.jsxs)(`form`,{className:`grid gap-3`,onSubmit:N,children:[V,K]}),t[51]=V,t[52]=K,t[53]=N,t[54]=q):q=t[54],q}function xt(e){let[,t]=e;return t}function St(e){return{key:e,title:e,required:!1}}var Ct=e=>e.replace(/[\\/][^\\/]*$/,``)||`/`;function wt(e){let t=(0,Z.c)(69),{entry:n,environmentId:r,onClose:i}=e,{skill:o,providers:s}=n,c,l,u;t[0]!==r||t[1]!==o.path?(c=Ct(o.path),l=j,u=Se(r,c,o.path),t[0]=r,t[1]=o.path,t[2]=c,t[3]=l,t[4]=u):(c=t[2],l=t[3],u=t[4]);let d=l(u),m;t[5]===d?m=t[6]:(m=D(p(d)),t[5]=d,t[6]=m);let h=m,g=ne(r),{copyToClipboard:v}=G(),y;t[7]!==r||t[8]!==o.path?(y={environmentId:r,filePath:o.path,workspaceRoot:void 0},t[7]=r,t[8]=o.path,t[9]=y):y=t[9];let b=y,x=o.shortDescription??o.description,S;t[10]===o.scope?S=t[11]:(S=mt(o.scope),t[10]=o.scope,t[11]=S);let E=S,O;t[12]===i?O=t[13]:(O=e=>!e&&i(),t[12]=i,t[13]=O);let k;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(`span`,{"aria-hidden":!0,className:`flex size-12 shrink-0 items-center justify-center rounded-full border border-border/60 text-muted-foreground`,children:(0,$.jsx)(a,{className:`size-5`})}),t[14]=k):k=t[14];let M;t[15]===o?M=t[16]:(M=pt(o),t[15]=o,t[16]=M);let N=`More for ${M}`,P;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,$.jsx)(f,{"aria-hidden":!0}),t[17]=P):P=t[17];let F;t[18]===N?F=t[19]:(F=(0,$.jsx)(C,{render:(0,$.jsx)(T,{size:`icon-sm`,variant:`ghost`,"aria-label":N,children:P})}),t[18]=N,t[19]=F);let I;t[20]!==g||t[21]!==b?(I=g.capabilities.canOpenDefault?(0,$.jsx)(w,{onClick:()=>void g.activate(`open`,b),children:`Open`}):null,t[20]=g,t[21]=b,t[22]=I):I=t[22];let R;t[23]!==g||t[24]!==b?(R=g.capabilities.revealLabel?(0,$.jsx)(w,{onClick:()=>void g.activate(`reveal-in-folder`,b),children:g.capabilities.revealLabel}):null,t[23]=g,t[24]=b,t[25]=R):R=t[25];let z=h===null,B;t[26]!==v||t[27]!==h?(B=()=>h&&v(h.contents,void 0),t[26]=v,t[27]=h,t[28]=B):B=t[28];let V;t[29]!==z||t[30]!==B?(V=(0,$.jsx)(w,{disabled:z,onClick:B,children:`Copy Markdown`}),t[29]=z,t[30]=B,t[31]=V):V=t[31];let H;t[32]!==I||t[33]!==R||t[34]!==V?(H=(0,$.jsxs)(A,{align:`end`,children:[I,R,V]}),t[32]=I,t[33]=R,t[34]=V,t[35]=H):H=t[35];let U;t[36]!==F||t[37]!==H?(U=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 pe-8`,children:[k,(0,$.jsxs)(_,{children:[F,H]})]}),t[36]=F,t[37]=H,t[38]=U):U=t[38];let W;t[39]===o?W=t[40]:(W=pt(o),t[39]=o,t[40]=W);let K;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`Skill`}),t[41]=K):K=t[41];let q;t[42]===W?q=t[43]:(q=(0,$.jsxs)(de,{children:[W,` `,K]}),t[42]=W,t[43]=q);let ee;t[44]===x?ee=t[45]:(ee=x?(0,$.jsx)(fe,{children:x}):null,t[44]=x,t[45]=ee);let J;t[46]!==q||t[47]!==ee?(J=(0,$.jsxs)(`div`,{className:`grid gap-1.5`,children:[q,ee]}),t[46]=q,t[47]=ee,t[48]=J):J=t[48];let te;t[49]!==c||t[50]!==r||t[51]!==h||t[52]!==d?(te=(0,$.jsx)(`div`,{className:`max-h-[50vh] min-h-24 overflow-y-auto rounded-xl border border-border/60 bg-card/40 px-5 py-4`,children:h===null?d._tag===`Failure`?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`This skill's file could not be read. It may have moved since the provider last scanned it.`}):(0,$.jsxs)(`div`,{className:`grid gap-2`,children:[(0,$.jsx)(oe,{className:`h-4 w-3/4`}),(0,$.jsx)(oe,{className:`h-4 w-full`}),(0,$.jsx)(oe,{className:`h-4 w-2/3`})]}):(0,$.jsx)(L,{text:ht(h.contents),cwd:c,environmentId:r})}),t[49]=c,t[50]=r,t[51]=h,t[52]=d,t[53]=te):te=t[53];let Y;t[54]===s?Y=t[55]:(Y=s.join(`, `),t[54]=s,t[55]=Y);let re=`Loaded by ${Y}`,ie;t[56]!==E||t[57]!==re?(ie=[E,re].filter(Boolean),t[56]=E,t[57]=re,t[58]=ie):ie=t[58];let ae=ie.join(` · `),se;t[59]===ae?se=t[60]:(se=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:ae}),t[59]=ae,t[60]=se);let ce;t[61]!==U||t[62]!==J||t[63]!==te||t[64]!==se?(ce=(0,$.jsx)(pe,{className:`max-w-2xl`,children:(0,$.jsxs)(`div`,{className:`grid min-h-0 gap-4 p-6`,children:[U,J,te,se]})}),t[61]=U,t[62]=J,t[63]=te,t[64]=se,t[65]=ce):ce=t[65];let le;return t[66]!==ce||t[67]!==O?(le=(0,$.jsx)(me,{open:!0,onOpenChange:O,children:ce}),t[66]=ce,t[67]=O,t[68]=le):le=t[68],le}var Tt={"edited-both-sides":`Changed here and on another machine since the last sync.`,"unmanaged-local-collision":`This machine has its own copy with the same name.`,"deleted-remotely-edited-locally":`Deleted on another machine, changed here.`,"mass-removal-held":`Most synced items vanished from the hub at once, so nothing was removed here.`,"hub-behind-manifest":`The hub has an older copy than this machine last synced.`,"not-writable-here":`This machine cannot hold this item.`,"write-failed":`Could not be written here. The next sync tries again.`};function Et(e){return Tt[e]??e}var Dt={skill:`Skill`,agent:`Subagent`,memory:`Memory`,mcp:`MCP server`,settings:`Settings`};function Ot(e){return`${Dt[e.kind]} ${e.name}`}function kt(e){if(e.running)return`Syncing…`;let t=e.lastRun;if(t===null)return`Not synced since the server started.`;let n=Y(t.finishedAt);if(t.outcome===`unavailable`)return`Couldn't reach the hub at ${n}.`;let r=[t.received>0?`${t.received} received`:null,t.published>0?`${t.published} shared`:null,t.removed>0?`${t.removed} removed`:null].filter(e=>e!==null);return`Synced ${n}${r.length>0?` · ${r.join(` · `)}`:` · no changes`}.`}function At(){let e=(0,Z.c)(4),{scope:t,environment:n}=Me(),r=t.environmentIds.length===1?n?.environmentId??null:null,i=n?.connection.phase===`connected`&&n.serverConfig!==null,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=Ie(`hub-sync`),e[0]=a):a=e[0];let o;return e[1]!==i||e[2]!==r?(o=(0,$.jsx)(Fe,{...a,children:r&&i?(0,$.jsx)(Mt,{environmentId:r}):(0,$.jsx)(Ne,{title:`Hub`,description:`Pick a single connected environment to sync its skills, subagents and memory.`})}),e[1]=i,e[2]=r,e[3]=o):o=e[3],o}function jt(e,t){let n=Re(e,t);return n.ok?null:n.message}function Mt(e){let t=(0,Z.c)(95),{environmentId:n}=e,r;t[0]===n?r=t[1]:(r=q.hubSyncLive({environmentId:n,input:void 0}),t[0]=n,t[1]=r);let i=ee(r),a;t[2]===n?a=t[3]:(a=q.connectHubSync.permissionAtom(n),t[2]=n,t[3]=a);let o=j(a),s;t[4]===n?s=t[5]:(s=q.runHubSyncNow.permissionAtom(n),t[4]=n,t[5]=s);let c=j(s),l;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[6]=l):l=t[6];let u=l,d=J(q.disconnectHubSync,u),f=J(q.setHubSyncMode,u),p=J(q.runHubSyncNow,u),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),v=i.data;if(!v){let e=i.error?`Couldn't load hub sync.`:`Loading…`,n;return t[7]===e?n=t[8]:(n=(0,$.jsx)(Ne,{title:`Hub`,status:e}),t[7]=e,t[8]=n),n}let y=v.source!==`none`,b=v.source===`environment`,x;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(x=async e=>{h(!0),_(await e()),h(!1)},t[9]=x):x=t[9];let S=x,C,w,E,D,O,k,A,M,N,P;if(t[10]!==o||t[11]!==c||t[12]!==d||t[13]!==n||t[14]!==g||t[15]!==b||t[16]!==y||t[17]!==m||t[18]!==p||t[19]!==f||t[20]!==v){let e=v.lastRun?.conflicts??[],r=v.lastRun?.refused??[],i=!y,a=!o||y,s;t[31]!==n||t[32]!==a?(s=(0,$.jsx)(Pt,{environmentId:n,disabled:a}),t[31]=n,t[32]=a,t[33]=s):s=t[33],t[34]!==i||t[35]!==s?(O=(0,$.jsx)(Be,{open:i,children:s}),t[34]=i,t[35]=s,t[36]=O):O=t[36],w=Be,N=y;let l=b?` · set by P4CODE_HUB_URL on the server`:null,u;t[37]===g?u=t[38]:(u=(0,$.jsx)(ze,{text:g}),t[37]=g,t[38]=u);let h;t[39]!==v.baseUrl||t[40]!==l||t[41]!==u?(h=(0,$.jsxs)($.Fragment,{children:[v.baseUrl,l,u]}),t[39]=v.baseUrl,t[40]=l,t[41]=u,t[42]=h):h=t[42];let _;t[43]!==o||t[44]!==d||t[45]!==n||t[46]!==b||t[47]!==y||t[48]!==m?(_=b?null:(0,$.jsx)(T,{size:`sm`,variant:`outline`,disabled:!o||m||!y,onClick:()=>void S(async()=>jt(await d({environmentId:n,input:void 0}),`Couldn't disconnect.`)),children:`Disconnect`}),t[43]=o,t[44]=d,t[45]=n,t[46]=b,t[47]=y,t[48]=m,t[49]=_):_=t[49],t[50]!==h||t[51]!==_?(P=(0,$.jsx)(Ne,{title:`Hub`,status:h,control:_}),t[50]=h,t[51]=_,t[52]=P):P=t[52];let x=`When the server starts and every ${v.intervalMinutes} minutes.`,j=v.syncMode===`auto`,F=!o||m||!y,I;t[53]!==n||t[54]!==f?(I=e=>void S(async()=>jt(await f({environmentId:n,input:{syncMode:e?`auto`:`paused`}}),`Couldn't change automatic sync.`)),t[53]=n,t[54]=f,t[55]=I):I=t[55];let L;t[56]!==j||t[57]!==F||t[58]!==I?(L=(0,$.jsx)(Le,{"aria-label":`Sync automatically`,checked:j,disabled:F,onCheckedChange:I}),t[56]=j,t[57]=F,t[58]=I,t[59]=L):L=t[59],t[60]!==x||t[61]!==L?(E=(0,$.jsx)(Ne,{title:`Sync automatically`,description:x,control:L}),t[60]=x,t[61]=L,t[62]=E):E=t[62];let R;t[63]===v?R=t[64]:(R=kt(v),t[63]=v,t[64]=R);let z;t[65]===R?z=t[66]:(z=(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,children:R}),t[65]=R,t[66]=z);let B=!c||m||v.running||!y,V;t[67]!==n||t[68]!==p?(V=()=>void S(async()=>jt(await p({environmentId:n,input:void 0}),`Couldn't start a sync.`)),t[67]=n,t[68]=p,t[69]=V):V=t[69];let H;t[70]===v.running?H=t[71]:(H=v.running?(0,$.jsx)(U,{size:`xs`}):null,t[70]=v.running,t[71]=H);let W;t[72]!==B||t[73]!==V||t[74]!==H?(W=(0,$.jsxs)(T,{size:`sm`,variant:`outline`,disabled:B,onClick:V,children:[H,`Sync now`]}),t[72]=B,t[73]=V,t[74]=H,t[75]=W):W=t[75],t[76]!==z||t[77]!==W?(D=(0,$.jsx)(Ne,{title:`Last sync`,status:z,control:W}),t[76]=z,t[77]=W,t[78]=D):D=t[78],C=Ft,k=n,A=[...e,...r],M=new Set(e.map(Nt)),t[10]=o,t[11]=c,t[12]=d,t[13]=n,t[14]=g,t[15]=b,t[16]=y,t[17]=m,t[18]=p,t[19]=f,t[20]=v,t[21]=C,t[22]=w,t[23]=E,t[24]=D,t[25]=O,t[26]=k,t[27]=A,t[28]=M,t[29]=N,t[30]=P}else C=t[21],w=t[22],E=t[23],D=t[24],O=t[25],k=t[26],A=t[27],M=t[28],N=t[29],P=t[30];let F=!c||v.running||!y,I;t[79]!==C||t[80]!==F||t[81]!==k||t[82]!==A||t[83]!==M?(I=(0,$.jsx)(C,{environmentId:k,issues:A,resolvable:M,disabled:F}),t[79]=C,t[80]=F,t[81]=k,t[82]=A,t[83]=M,t[84]=I):I=t[84];let L;t[85]!==w||t[86]!==E||t[87]!==D||t[88]!==I||t[89]!==N||t[90]!==P?(L=(0,$.jsxs)(w,{open:N,children:[P,E,D,I]}),t[85]=w,t[86]=E,t[87]=D,t[88]=I,t[89]=N,t[90]=P,t[91]=L):L=t[91];let R;return t[92]!==O||t[93]!==L?(R=(0,$.jsxs)($.Fragment,{children:[O,L]}),t[92]=O,t[93]=L,t[94]=R):R=t[94],R}var Nt=e=>`${e.kind}/${e.name}`;function Pt(e){let t=(0,Z.c)(34),[n,r]=(0,Q.useState)(``),[i,a]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u={reportFailure:!1},t[0]=u):u=t[0];let d=J(q.connectHubSync,u),f=e.disabled||o,p;t[1]!==n||t[2]!==i?(p=n.trim()!==``&&i.trim()!==``,t[1]=n,t[2]=i,t[3]=p):p=t[3];let m=p,h;t[4]===c?h=t[5]:(h=(0,$.jsx)(ze,{text:c}),t[4]=c,t[5]=h);let g;t[6]!==n||t[7]!==d||t[8]!==f||t[9]!==e.environmentId||t[10]!==m||t[11]!==i?(g=t=>{t.preventDefault(),m&&!f&&(s(!0),d({environmentId:e.environmentId,input:{baseUrl:n.trim(),token:i.trim()}}).then(e=>{let t=jt(e,`Couldn't link the hub.`);l(t),t===null&&a(``),s(!1)}))},t[6]=n,t[7]=d,t[8]=f,t[9]=e.environmentId,t[10]=m,t[11]=i,t[12]=g):g=t[12];let _;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>r(e.target.value),t[13]=_):_=t[13];let v;t[14]!==n||t[15]!==f?(v=(0,$.jsx)(`div`,{className:`min-w-48 flex-1`,children:(0,$.jsx)(ue,{"aria-label":`Hub URL`,autoComplete:`off`,value:n,disabled:f,placeholder:`https://hub.example.ts.net`,onChange:_})}),t[14]=n,t[15]=f,t[16]=v):v=t[16];let y;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(y=e=>a(e.target.value),t[17]=y):y=t[17];let b;t[18]!==f||t[19]!==i?(b=(0,$.jsx)(`div`,{className:`min-w-40 flex-1`,children:(0,$.jsx)(ue,{"aria-label":`Hub token`,type:`password`,autoComplete:`off`,value:i,disabled:f,placeholder:`Token`,onChange:y})}),t[18]=f,t[19]=i,t[20]=b):b=t[20];let x=f||!m,S;t[21]===o?S=t[22]:(S=o?(0,$.jsx)(U,{size:`xs`}):null,t[21]=o,t[22]=S);let C;t[23]!==x||t[24]!==S?(C=(0,$.jsxs)(T,{type:`submit`,size:`sm`,disabled:x,children:[S,`Connect`]}),t[23]=x,t[24]=S,t[25]=C):C=t[25];let w;t[26]!==C||t[27]!==g||t[28]!==v||t[29]!==b?(w=(0,$.jsxs)(`form`,{className:`flex max-w-xl flex-wrap items-center gap-2 pb-2`,onSubmit:g,children:[v,b,C]}),t[26]=C,t[27]=g,t[28]=v,t[29]=b,t[30]=w):w=t[30];let E;return t[31]!==w||t[32]!==h?(E=(0,$.jsx)(Ne,{title:`Hub`,description:`Keep skills, subagents and memory the same on every machine linked to one hub. Mint a token on the hub host with p4c hub token add.`,status:h,children:w}),t[31]=w,t[32]=h,t[33]=E):E=t[33],E}function Ft(e){let t=(0,Z.c)(13),n;t[0]===e.issues?n=t[1]:(n=new Map(e.issues.map(It)),t[0]=e.issues,t[1]=n);let r=n,[i,a]=(0,Q.useState)(e.issues),o;if(t[2]!==e.issues||t[3]!==i){let n;t[5]===i?n=t[6]:(n=e=>!i.some(t=>Nt(t)===Nt(e)),t[5]=i,t[6]=n),o=[...i,...e.issues.filter(n)],t[2]=e.issues,t[3]=i,t[4]=o}else o=t[4];let s=o;s.length!==i.length&&a(s);let c;return t[7]!==r||t[8]!==s||t[9]!==e.disabled||t[10]!==e.environmentId||t[11]!==e.resolvable?(c=(0,$.jsx)($.Fragment,{children:s.map(t=>{let n=Nt(t),i=r.get(n);return(0,$.jsx)(`div`,{onTransitionEnd:e=>{e.target!==e.currentTarget.firstChild||i||a(e=>e.filter(e=>Nt(e)!==n))},children:(0,$.jsx)(Be,{open:i!==void 0,children:(0,$.jsx)(Lt,{environmentId:e.environmentId,issue:i??t,resolutions:e.resolvable.has(n)?y(t.reason):[],disabled:e.disabled||i===void 0})})},n)})}),t[7]=r,t[8]=s,t[9]=e.disabled,t[10]=e.environmentId,t[11]=e.resolvable,t[12]=c):c=t[12],c}function It(e){return[Nt(e),e]}function Lt(e){let t=(0,Z.c)(24),{issue:n}=e,[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),l;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l={reportFailure:!1},t[0]=l):l=t[0];let u=J(q.resolveHubSyncConflict,l),d;t[1]===n?d=t[2]:(d=Ot(n),t[1]=n,t[2]=d);let f=d,p;t[3]!==n.kind||t[4]!==n.name||t[5]!==e.environmentId||t[6]!==u?(p=async t=>{i(!0),o(jt(await u({environmentId:e.environmentId,input:{kind:n.kind,name:n.name,resolution:t}}),`Couldn't apply that choice.`)),i(!1),c(!1)},t[3]=n.kind,t[4]=n.name,t[5]=e.environmentId,t[6]=u,t[7]=p):p=t[7];let m=p,h=e.disabled||r,g;t[8]===n.reason?g=t[9]:(g=Et(n.reason),t[8]=n.reason,t[9]=g);let _;t[10]===a?_=t[11]:(_=(0,$.jsx)(ze,{text:a}),t[10]=a,t[11]=_);let v;t[12]!==s||t[13]!==h||t[14]!==r||t[15]!==e.resolutions||t[16]!==m||t[17]!==f?(v=e.resolutions.length===0?null:(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[e.resolutions.includes(`keep-local`)?(0,$.jsx)(T,{size:`sm`,variant:`outline`,disabled:h,onClick:()=>void m(`keep-local`),children:`Keep this machine's`}):null,e.resolutions.includes(`use-hub`)?(0,$.jsxs)(ke,{open:s,onOpenChange:e=>{r||c(e)},children:[(0,$.jsx)(T,{size:`sm`,variant:`outline`,disabled:h,onClick:()=>c(!0),children:`Use hub's`}),(0,$.jsxs)(Ee,{children:[(0,$.jsxs)(Ce,{children:[(0,$.jsxs)(Oe,{children:[`Replace this machine's `,f,`?`]}),(0,$.jsx)(De,{children:`The hub's copy overwrites the one here. Changes made only on this machine are lost.`})]}),(0,$.jsxs)(we,{children:[(0,$.jsx)(Te,{disabled:r,render:(0,$.jsx)(T,{variant:`outline`,disabled:r}),children:`Cancel`}),(0,$.jsxs)(T,{variant:`destructive`,disabled:r,onClick:()=>void m(`use-hub`),children:[r?(0,$.jsx)(U,{size:`sm`}):null,`Replace`]})]})]})]}):null]}),t[12]=s,t[13]=h,t[14]=r,t[15]=e.resolutions,t[16]=m,t[17]=f,t[18]=v):v=t[18];let y;return t[19]!==g||t[20]!==_||t[21]!==v||t[22]!==f?(y=(0,$.jsx)(Ne,{title:f,description:g,status:_,control:v}),t[19]=g,t[20]=_,t[21]=v,t[22]=f,t[23]=y):y=t[23],y}var Rt={claude:`Claude`,codex:`Codex`,cursor:`Cursor`},zt={success:`bg-success`,warning:`bg-warning`,error:`bg-destructive`,muted:`bg-muted-foreground/40`},Bt={success:`text-success-foreground`,warning:`text-warning-foreground`,error:`text-destructive-foreground`,muted:`text-muted-foreground`},Vt=d(o);function Ht(e){let t=S(e);return Vt(t)&&t.reason===`rejected`?`This server only lets apps it has approved sign in, and it refused P4 Code. Sign in with a provider below instead.`:`Sign-in could not start. Check the server URL, then try again.`}function Ut(e,t,n){return e.transport.type===`http`&&(e.transport.auth===`oauth`||n?.auth===`signed-in`||t.needsSignIn)}function Wt(e){let t=(0,Z.c)(13),{status:n,className:r}=e,i=Bt[n.tone],a;t[0]!==r||t[1]!==i?(a=N(`flex min-w-0 items-center gap-1.5 text-xs`,i,r),t[0]=r,t[1]=i,t[2]=a):a=t[2];let o=zt[n.tone],s;t[3]===o?s=t[4]:(s=N(`size-1.5 shrink-0 rounded-full`,o),t[3]=o,t[4]=s);let c;t[5]===s?c=t[6]:(c=(0,$.jsx)(`span`,{"aria-hidden":!0,className:s}),t[5]=s,t[6]=c);let l;t[7]===n.label?l=t[8]:(l=(0,$.jsx)(`span`,{className:`truncate`,children:n.label}),t[7]=n.label,t[8]=l);let u;return t[9]!==a||t[10]!==c||t[11]!==l?(u=(0,$.jsxs)(`span`,{className:a,children:[c,l]}),t[9]=a,t[10]=c,t[11]=l,t[12]=u):u=t[12],u}function Gt(){let e=(0,Z.c)(11),{environment:t,scope:n}=Me(),r=t?.connection.phase===`connected`&&t.serverConfig!==null,i=r?t.environmentId:null,a=r&&t.serverConfig?.environment.capabilities.mcpRegistry===!0,o;e[0]!==r||e[1]!==t||e[2]!==i||e[3]!==n||e[4]!==a?(o=t===null||!r?(0,$.jsx)(ve,{children:(0,$.jsxs)(he,{children:[(0,$.jsx)(ge,{children:`Connect to manage plugins and MCP servers`}),(0,$.jsx)(_e,{children:`They live on each environment. Choose a connected one above.`})]})}):!a||i===null?(0,$.jsx)(ve,{children:(0,$.jsxs)(he,{children:[(0,$.jsxs)(ge,{children:[`Update `,t.label,` to manage plugins and MCP servers`]}),(0,$.jsx)(_e,{children:`This environment runs a version without them.`})]})}):(0,$.jsx)(Yt,{environmentId:i,environmentLabel:t.label,projectId:n.kind===`checkout`?n.checkout.id:n.kind===`project`?n.members.find(e=>e.environmentId===i)?.id:void 0,projectLabel:n.kind===`project`||n.kind===`checkout`?n.label:void 0},i),e[0]=r,e[1]=t,e[2]=i,e[3]=n,e[4]=a,e[5]=o):o=e[5];let s;e[6]===r?s=e[7]:(s=r?(0,$.jsx)(At,{}):null,e[6]=r,e[7]=s);let c;return e[8]!==o||e[9]!==s?(c=(0,$.jsxs)(Pe,{width:`wide`,children:[o,s]}),e[8]=o,e[9]=s,e[10]=c):c=e[10],c}var Kt={plugins:`Search plugins`,mcps:`Search MCP servers`,skills:`Search skills`},qt=(e,...t)=>e===``||t.some(t=>t.toLowerCase().includes(e));function Jt(e){let t=(0,Z.c)(9),{text:n}=e,r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(!1),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=e=>{let t=r.current;a(e&&t!==null&&t.scrollWidth>t.clientWidth)},t[0]=o):o=t[0];let s;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,$.jsx)(`span`,{ref:r,tabIndex:0,className:`block truncate text-xs text-muted-foreground`}),t[1]=s):s=t[1];let c,l;t[2]===n?(c=t[3],l=t[4]):(c=(0,$.jsx)(re,{render:s,children:n}),l=(0,$.jsx)(ie,{children:n}),t[2]=n,t[3]=c,t[4]=l);let u;return t[5]!==i||t[6]!==c||t[7]!==l?(u=(0,$.jsxs)(ae,{open:i,onOpenChange:o,children:[c,l]}),t[5]=i,t[6]=c,t[7]=l,t[8]=u):u=t[8],u}function Yt({environmentId:e,environmentLabel:t,projectId:n,projectLabel:r}){let i=W({select:e=>e.hash}),[o,s]=(0,Q.useState)(()=>i.replace(/^#/,``)===`mcp-servers`?`mcps`:i.replace(/^#/,``)===`skills`?`skills`:`plugins`),[d,p]=(0,Q.useState)(``),[m,g]=(0,Q.useState)(`All categories`),v=j(q.configValueAtom(e))?.providers,y=(0,Q.useMemo)(()=>ft(v??[]),[v]),[S,D]=(0,Q.useState)(null),k=Ae(e=>e.mcpServers),M=Ae(e=>e.plugins),N=Ae(e=>e.projectSettingsOverrides),L=Ae(e=>e.skillOverrides),U=ne(e),G=j(q.updateSettings.permissionAtom(e)),[ee,te]=(0,Q.useState)(null),Y=j(q.mcpRegistryTest.permissionAtom(e)),oe=K(e),se=J(q.updateSettings,{label:`update MCP registry`,reportFailure:!0}),ue=J(q.mcpRegistryState,{reportFailure:!1}),de=J(q.mcpRegistryTest,{label:`check MCP server`,reportFailure:!0}),fe=J(q.mcpRegistryOAuthStart,{label:`start MCP sign-in`,reportFailure:!0}),pe=J(q.mcpRegistryOAuthSignOut,{label:`sign out of MCP server`,reportFailure:!0}),me=J(q.mcpRegistryDiscover,{reportFailure:!1}),he=J(q.mcpRegistryImport,{label:`import MCP servers`,reportFailure:!0}),[ge,_e]=(0,Q.useState)({}),[ve,Se]=(0,Q.useState)(new Set),[je,Me]=(0,Q.useState)([]),[Ne,Pe]=(0,Q.useState)({kind:`list`}),X=Ne.kind!==`list`&&Ne.id!==null&&(Ne.kind===`server`?k[Ne.id]===void 0:M[Ne.id]===void 0)?{kind:`list`}:Ne,[Re,ze]=(0,Q.useState)(i);if(i!==Re){ze(i);let e=i.replace(/^#/,``);(e===`mcp-servers`||e===`plugins`||e===`skills`)&&(s(e===`mcp-servers`?`mcps`:e),Pe({kind:`list`}))}let[Be,Ve]=(0,Q.useState)(null),Z=(0,Q.useRef)(new Map),[He,Ge]=(0,Q.useState)(null),[Ke,qe]=(0,Q.useState)({}),Je=(0,Q.useMemo)(()=>Object.entries(k).map(([e,t])=>[c.make(e),t]).toSorted(([,e],[,t])=>e.name.localeCompare(t.name)),[k]),Ye=(0,Q.useMemo)(()=>Object.entries(M).map(([e,t])=>[u.make(e),t]),[M]),Xe=(0,Q.useCallback)(async()=>{let t=await ue({environmentId:e,input:{}});t._tag===`Success`&&_e(t.value.servers)},[e,ue]),Ze=(0,Q.useCallback)(async()=>{if(!Y)return;let t=await me({environmentId:e,input:n===void 0?{}:{projectId:n}});t._tag===`Success`&&Me(t.value.servers)},[Y,me,e,n]);(0,Q.useEffect)(()=>{Xe(),Ze()},[Xe,Ze]);let tt=e=>{s(`mcps`),Pe({kind:`server`,id:e})},nt=e=>{s(`plugins`),Pe({kind:`plugin`,id:e})},rt=t=>se({environmentId:e,input:{patch:t}}),it=async t=>{Se(e=>new Set(e).add(t));let n=await de({environmentId:e,input:{serverId:t}});if(Se(e=>{let n=new Set(e);return n.delete(t),n}),n._tag===`Success`)return _e(e=>({...e,[t]:n.value})),n.value},at=(0,Q.useEffectEvent)(async e=>{(await it(e))?.health.status===`connected`&&Ge(null)});(0,Q.useEffect)(()=>{if(He===null)return;let e=()=>void at(He);return window.addEventListener(`focus`,e),()=>window.removeEventListener(`focus`,e)},[He]);let ot=async(e,t,n)=>{(await rt({mcpServers:{[e]:t}}))._tag===`Success`&&(n&&Pe({kind:`list`}),Ze(),t.enabled&&await it(e))},st=async(t,n=!1)=>{let r=Z.current.get(t);if(!n&&He===t&&r){window.open(r,`_blank`,`noopener,noreferrer`);return}let i=oe??window.location.origin;qe(e=>{let n={...e};return delete n[t],n});let a=await fe({environmentId:e,input:{serverId:t,origin:new URL(i,window.location.href).origin,...n?{reauthenticate:n}:{}}});a._tag===`Success`?a.value.authorizationUrl===null?await it(t):(Z.current.set(t,a.value.authorizationUrl),Ge(t),window.open(a.value.authorizationUrl,`_blank`,`noopener,noreferrer`)):a._tag===`Failure`&&qe(e=>({...e,[t]:Ht(a.cause)}))},ct=async t=>{let n=await pe({environmentId:e,input:{serverId:t}});n._tag===`Success`&&_e(e=>({...e,[t]:n.value}))},lt=(e,t,r)=>{if(n===void 0)return;let i=N[n]??{},a={...i[e]};r===void 0?delete a[t]:a[t]={enabled:r},rt({projectSettingsOverrides:{[n]:{...i,[e]:a}}})},ut=async()=>{let t=Be;if(Ve(null),t!==null){if(t.kind===`server`){let n=k[t.id];n?.transport.type===`http`&&n.transport.auth===`oauth`&&await pe({environmentId:e,input:{serverId:t.id}}),await rt({mcpServers:{[t.id]:null}})}else await rt({plugins:{[t.id]:null}});Pe({kind:`list`})}},dt=je.filter(e=>!e.alreadyAdded),mt=new Set(Je.filter(([e])=>X.kind!==`server`||e!==X.id).map(([,e])=>e.name)),ht=d.trim().toLowerCase(),_t=Je.filter(([,e])=>qt(ht,e.name,We(e))),yt=Ye.filter(([,e])=>qt(ht,e.name,e.path)),xt=dt.filter(e=>qt(ht,e.name,e.summary)),St=(e,t)=>I({mcpServers:k,plugins:M,projectSettingsOverrides:N},e,n??null,t),Ct=(e,t,r)=>{n===void 0?rt(e===`mcpServers`?{mcpServers:{[t]:{...k[t],enabled:r}}}:{plugins:{[t]:{...M[t],enabled:r}}}):lt(e,t,r)},Tt=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`grid gap-1`,children:[(0,$.jsx)(`h1`,{className:`text-2xl font-semibold text-foreground`,children:`Plugins`}),(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`Manage plugins, skills, and MCP servers given to agents on `,t,`.`]})]}),Y?(0,$.jsxs)(_,{children:[(0,$.jsx)(C,{render:(0,$.jsxs)(T,{children:[`Add`,(0,$.jsx)(l,{"aria-hidden":!0})]})}),(0,$.jsxs)(A,{align:`end`,children:[(0,$.jsxs)(w,{onClick:()=>tt(null),children:[(0,$.jsx)(P,{"aria-hidden":!0}),`Add MCP server`]}),(0,$.jsxs)(w,{onClick:()=>nt(null),children:[(0,$.jsx)(b,{"aria-hidden":!0}),`Add plugin`]})]})]}):null]}),Et=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,$.jsxs)(ce,{"aria-label":`Show`,variant:`default`,value:[o],onValueChange:e=>{let t=e[0];(t===`plugins`||t===`mcps`||t===`skills`)&&(s(t),Pe({kind:`list`}))},children:[(0,$.jsxs)(le,{value:`plugins`,...Ie(`plugins`),children:[`Plugins `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:Ye.length})]}),(0,$.jsxs)(le,{value:`mcps`,...Ie(`mcp-servers`),children:[`MCPs `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:Je.length})]}),(0,$.jsxs)(le,{value:`skills`,...Ie(`skills`),children:[`Skills `,(0,$.jsx)(`span`,{className:`text-muted-foreground`,children:y.length})]})]}),(0,$.jsxs)(`div`,{className:`flex w-full gap-2 sm:w-auto`,children:[o===`skills`?(0,$.jsx)(`div`,{className:`w-fit shrink-0`,children:(0,$.jsxs)(H,{value:m,onValueChange:e=>e&&g(e),children:[(0,$.jsx)(V,{"aria-label":`Skill category`,children:(0,$.jsx)(z,{})}),(0,$.jsxs)(B,{children:[(0,$.jsx)(R,{value:`All categories`,children:`All categories`}),$e.filter(e=>e===`Personal`||e===`Built-in`||y.some(({skill:t})=>et(t)===e)).map(e=>(0,$.jsx)(R,{value:e,children:e},e))]})]})}):null,(0,$.jsxs)(xe,{className:`min-w-0 flex-1 sm:w-56`,children:[(0,$.jsx)(ye,{children:(0,$.jsx)(E,{"aria-hidden":!0})}),(0,$.jsx)(be,{"aria-label":Kt[o],placeholder:Kt[o],value:d,onChange:e=>p(e.currentTarget.value)})]})]})]}),Dt=(e,t)=>(0,$.jsxs)(ae,{children:[(0,$.jsx)(re,{render:(0,$.jsx)(T,{size:`icon-sm`,variant:`ghost`,"aria-label":e,onClick:t,children:(0,$.jsx)(x,{"aria-hidden":!0})})}),(0,$.jsx)(ie,{children:e})]}),Ot=yt.length===0?(0,$.jsx)(`p`,{className:`py-6 text-sm text-muted-foreground`,children:Ye.length===0?`No plugins yet. Add a Claude Code or Codex plugin folder to give its tools to your agents.`:`No plugins match your search.`}):(0,$.jsx)(`ul`,{className:`grid gap-1`,children:yt.map(([t,n])=>(0,$.jsx)(Qe,{environmentId:e,plugin:n,enabled:St(`plugins`,t),disabled:!G,onDetails:()=>nt(t),onToggle:e=>Ct(`plugins`,t,e)},t))}),kt=y.filter(({skill:e})=>(m===`All categories`||et(e)===m)&&qt(ht,pt(e),e.name,e.shortDescription??``,e.description??``)),At=kt.length===0?(0,$.jsx)(`p`,{className:`py-6 text-sm text-muted-foreground`,children:y.length===0?`No skills found. Providers report the skills they load when they start.`:`No skills match these filters.`}):(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Switches apply to new Claude and OpenCode sessions.`}),(0,$.jsx)(`ul`,{className:`grid gap-1`,children:kt.map(t=>{let r=et(t.skill),i=(v??[]).filter(e=>h(e.driver)&&e.skills.some(e=>e.name===t.skill.name)),o=i.length?i.map(e=>e.displayName??e.driver).join(`, `):`Native settings`;return(0,$.jsxs)(`li`,{className:`flex items-center gap-3 py-3`,children:[(0,$.jsx)(`span`,{"aria-hidden":!0,className:`flex size-10 shrink-0 items-center justify-center rounded-full border border-border/60 text-muted-foreground`,children:(0,$.jsx)(a,{className:`size-4`})}),(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-1`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>D(t),className:`w-fit break-words text-left text-sm font-medium outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,children:pt(t.skill)}),(0,$.jsx)(Jt,{text:t.skill.shortDescription??t.skill.description??t.skill.path}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:[r,o].filter(Boolean).join(` · `)})]}),(0,$.jsxs)(_,{children:[(0,$.jsxs)(ae,{children:[(0,$.jsx)(re,{render:(0,$.jsx)(C,{render:(0,$.jsx)(T,{variant:`ghost`,size:`icon-sm`,"aria-label":`More for ${pt(t.skill)}`,children:(0,$.jsx)(f,{"aria-hidden":!0})})})}),(0,$.jsx)(ie,{children:`Skill actions`})]}),(0,$.jsxs)(A,{align:`end`,children:[U.capabilities.canOpenDefault?(0,$.jsx)(w,{onClick:()=>void U.activate(`open`,{environmentId:e,filePath:t.skill.path,workspaceRoot:void 0}),children:`Open`}):null,(0,$.jsx)(w,{onClick:()=>D(t),children:`Details`}),n!==void 0&&N[n]?.skillOverrides?.[t.skill.name]!==void 0?(0,$.jsx)(w,{onClick:()=>{let e=N[n]??{},r={...e.skillOverrides};delete r[t.skill.name],rt({projectSettingsOverrides:{[n]:{...e,skillOverrides:r}}})},children:`Use environment setting`}):null]})]}),(0,$.jsx)(Le,{"aria-label":`Enable ${pt(t.skill)} for ${o}`,checked:(n===void 0?void 0:N[n]?.skillOverrides?.[t.skill.name])??L[t.skill.name]??t.skill.enabled,disabled:!G||ee!==null||i.length===0,onCheckedChange:e=>{te(t.skill.name),rt(n===void 0?{skillOverrides:{[t.skill.name]:e}}:{projectSettingsOverrides:{[n]:{...N[n],skillOverrides:{...N[n]?.skillOverrides,[t.skill.name]:e}}}}).finally(()=>te(null))}})]},t.skill.path)})})]}),jt=(0,$.jsxs)(`div`,{className:`grid gap-6`,children:[Je.length>0?(0,$.jsx)(Fe,{title:`Servers`,children:_t.length===0?(0,$.jsx)(`p`,{className:`px-3 text-sm text-muted-foreground sm:px-4`,children:`No MCP servers match your search.`}):(0,$.jsx)($.Fragment,{children:_t.map(([e,t])=>{let n=St(`mcpServers`,e),r=Ue({...t,enabled:n},ge[e],ve.has(e)),i=Ke[e],a=Ut(t,r,ge[e]);return(0,$.jsxs)(`div`,{className:`flex min-h-14 items-center gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,$.jsx)(`span`,{className:`break-words text-sm font-medium text-foreground`,children:t.name}),r.tone===`error`||a?(0,$.jsx)(Wt,{status:r}):null,i?(0,$.jsx)(`span`,{className:`text-xs text-destructive-foreground`,children:i}):null]}),r.needsSignIn&&Y?(0,$.jsx)(T,{size:`xs`,variant:`outline`,onClick:()=>void st(e),children:`Authenticate`}):null,a&&!r.needsSignIn&&Y?(0,$.jsxs)(_,{children:[(0,$.jsxs)(ae,{children:[(0,$.jsx)(re,{render:(0,$.jsx)(C,{render:(0,$.jsx)(T,{variant:`ghost`,size:`icon-sm`,"aria-label":`More for ${t.name}`,children:(0,$.jsx)(f,{"aria-hidden":!0})})})}),(0,$.jsx)(ie,{children:`Sign-in actions`})]}),(0,$.jsxs)(A,{align:`end`,children:[(0,$.jsx)(w,{onClick:()=>void st(e,!0),children:`Re-authenticate`}),ge[e]?.auth===`signed-in`?(0,$.jsx)(w,{onClick:()=>void ct(e),children:`Sign out`}):null]})]}):null,Dt(`Settings for ${t.name}`,()=>tt(e)),(0,$.jsx)(Le,{"aria-label":`Give ${t.name} to agents`,checked:n,disabled:!Y,onCheckedChange:t=>Ct(`mcpServers`,e,t)})]},e)})})}):null,Y&&xt.length>0?(0,$.jsx)(Fe,{title:`Found in provider configs`,headerAction:(0,$.jsx)(T,{size:`icon-xs`,variant:`ghost`,"aria-label":`Look again`,onClick:()=>void Ze(),children:(0,$.jsx)(F,{"aria-hidden":!0})}),children:(0,$.jsx)($.Fragment,{children:xt.map(t=>(0,$.jsxs)(`div`,{className:`flex min-h-14 items-center gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`grid min-w-0 flex-1 gap-0.5`,children:[(0,$.jsx)(`span`,{className:`break-words text-sm font-medium text-foreground`,children:t.name}),xt.filter(e=>e.name===t.name).length>1?(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:(t.providers??[t.provider]).map(e=>Rt[e]).join(`, `)}):null]}),(0,$.jsx)(T,{size:`xs`,variant:`outline`,onClick:async()=>{(await he({environmentId:e,input:{...n===void 0?{}:{projectId:n},servers:[{provider:t.provider,path:t.path,name:t.name}]}}))._tag===`Success`&&(Ze(),Xe())},children:`Import`})]},`${t.provider}:${t.path}:${t.name}`))})}):null]}),Mt=X.kind===`server`?(0,$.jsxs)(gt,{title:X.id===null?`Add MCP server`:`Update ${k[X.id]?.name??`server`} MCP`,onBack:()=>Pe({kind:`list`}),onUninstall:X.id!==null&&Y?()=>Ve({kind:`server`,id:X.id}):void 0,children:[(0,$.jsx)(vt,{server:X.id===null?void 0:k[X.id],takenNames:mt,onSave:e=>void ot(X.id??c.make(O()),e,X.id===null)},X.id??`new`),X.id!==null&&k[X.id]!==void 0?(0,$.jsx)(Zt,{environmentId:e,id:X.id,server:k[X.id],runtime:ge[X.id],checking:ve.has(X.id),canManage:Y,projectLabel:r,projectOverride:n===void 0?void 0:N[n]?.mcpServers?.[X.id],awaitingSignIn:He===X.id,onProviderToggle:(e,t)=>{let n=k[X.id],r=t?n.disabledProviders.filter(t=>t!==e):[...n.disabledProviders,e];rt({mcpServers:{[X.id]:{...n,disabledProviders:r}}})},onProjectOverride:n===void 0?void 0:e=>lt(`mcpServers`,X.id,e),signInError:Ke[X.id],onTest:()=>void it(X.id),onSignIn:()=>void st(X.id),onReauthenticate:()=>void st(X.id,!0),onSignOut:()=>void ct(X.id)},`${e}:${X.id}`):null]}):null,Nt=X.kind===`plugin`?(0,$.jsxs)(gt,{title:X.id===null?`Add plugin`:`Update ${M[X.id]?.name??`plugin`}`,onBack:()=>Pe({kind:`list`}),onUninstall:X.id!==null&&Y?()=>Ve({kind:`plugin`,id:X.id}):void 0,children:[(0,$.jsx)(bt,{environmentId:e,plugin:X.id===null?void 0:M[X.id],environmentLabel:t,onSave:async e=>{let t=X.id??u.make(O());(await rt({plugins:{[t]:e}}))._tag===`Success`&&X.id===null&&Pe({kind:`list`})}},X.id??`new`),X.id!==null&&M[X.id]!==void 0?(0,$.jsx)(on,{plugin:M[X.id],projectLabel:r,projectOverride:n===void 0?void 0:N[n]?.plugins?.[X.id],onProjectOverride:n===void 0?void 0:e=>lt(`plugins`,X.id,e)}):null]}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`grid gap-6`,children:[Tt,Et,Mt??Nt??(o===`plugins`?Ot:o===`mcps`?jt:At)]}),S===null?null:(0,$.jsx)(wt,{entry:S,environmentId:e,onClose:()=>D(null)}),(0,$.jsx)(ke,{open:Be!==null,onOpenChange:e=>!e&&Ve(null),children:(0,$.jsxs)(Ee,{children:[(0,$.jsxs)(Ce,{children:[(0,$.jsxs)(Oe,{children:[`Remove`,` `,Be?.kind===`server`?k[Be.id]?.name??`server`:Be?.kind===`plugin`?M[Be.id]?.name??`plugin`:``,`?`]}),(0,$.jsxs)(De,{children:[`New sessions on `,t,` stop getting it. Its stored values and sign-in are deleted. Provider config files are not changed.`]})]}),(0,$.jsxs)(we,{children:[(0,$.jsx)(Te,{render:(0,$.jsx)(T,{variant:`outline`,children:`Cancel`})}),(0,$.jsx)(T,{variant:`destructive`,onClick:()=>void ut(),children:`Remove`})]})]})})]})}function Xt(e){let t=(0,Z.c)(16),{projectLabel:n,override:r,inherited:i,onChange:a}=e,o=r?.enabled!==void 0,s=`In ${n}`,c=o?`Set for this project.`:`Follows the environment (${i?`on`:`off`}).`,l;t[0]!==a||t[1]!==o?(l=o?(0,$.jsx)(T,{size:`xs`,variant:`ghost`,onClick:()=>a(void 0),children:`Reset`}):null,t[0]=a,t[1]=o,t[2]=l):l=t[2];let u=`Use in ${n}`,d=r?.enabled??i,f;t[3]===a?f=t[4]:(f=e=>a(e),t[3]=a,t[4]=f);let p;t[5]!==u||t[6]!==d||t[7]!==f?(p=(0,$.jsx)(Le,{"aria-label":u,checked:d,onCheckedChange:f}),t[5]=u,t[6]=d,t[7]=f,t[8]=p):p=t[8];let m;t[9]!==l||t[10]!==p?(m=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,p]}),t[9]=l,t[10]=p,t[11]=m):m=t[11];let h;return t[12]!==s||t[13]!==c||t[14]!==m?(h=(0,$.jsx)(Ne,{title:s,description:c,control:m}),t[12]=s,t[13]=c,t[14]=m,t[15]=h):h=t[15],h}function Zt(e){let t=(0,Z.c)(108),{environmentId:n,id:r,server:i,runtime:a,checking:o,canManage:s,projectLabel:c,projectOverride:l,awaitingSignIn:u,signInError:d,onProviderToggle:f,onProjectOverride:p,onTest:m,onSignIn:h,onReauthenticate:g,onSignOut:_}=e,y=s&&i.transport.type===`http`&&i.transport.auth===`oauth`&&a?.auth===`signed-out`,b=tn(n,r,y),x=b.entries,S;t[0]!==o||t[1]!==a||t[2]!==i?(S=Ue(i,a,o),t[0]=o,t[1]=a,t[2]=i,t[3]=S):S=t[3];let C=S,w;t[4]===x?w=t[5]:(w=x?.filter($t).length??0,t[4]=x,t[5]=w);let E=w,D;t[6]!==C||t[7]!==E||t[8]!==x||t[9]!==y?(D=y?{...C,tone:`muted`,label:x===null?`Checking providers…`:E>0?`Available to ${E} ${E===1?`provider`:`providers`}`:`No providers connected`}:C,t[6]=C,t[7]=E,t[8]=x,t[9]=y,t[10]=D):D=t[10];let O=D,k,A,j,M,N,P,F;if(t[11]!==u||t[12]!==s||t[13]!==o||t[14]!==x||t[15]!==r||t[16]!==f||t[17]!==g||t[18]!==h||t[19]!==_||t[20]!==m||t[21]!==a?.auth||t[22]!==i||t[23]!==d||t[24]!==b||t[25]!==O||t[26]!==y){let e;t[34]===x?e=t[35]:(e=e=>({...e,badge:x===null||e.unsupported!==void 0?void 0:at(e.driver,x)}),t[34]=x,t[35]=e);let n=ot(i).map(e),c=i.transport.type===`http`&&a?.auth===`signed-in`,l=d??O.detail;N=`grid gap-6`,P=r;let p;t[36]===O?p=t[37]:(p=(0,$.jsx)(Wt,{status:O,className:`flex-1 text-sm`}),t[36]=O,t[37]=p);let S;t[38]!==u||t[39]!==s||t[40]!==h||t[41]!==O.needsSignIn||t[42]!==y?(S=O.needsSignIn&&s&&!y?(0,$.jsx)(T,{size:`xs`,onClick:h,children:u?`Open sign-in again`:`Authenticate`}):null,t[38]=u,t[39]=s,t[40]=h,t[41]=O.needsSignIn,t[42]=y,t[43]=S):S=t[43];let C;t[44]!==s||t[45]!==g||t[46]!==c||t[47]!==O.needsSignIn?(C=c&&!O.needsSignIn&&s?(0,$.jsx)(T,{size:`xs`,variant:`outline`,onClick:g,children:`Re-authenticate`}):null,t[44]=s,t[45]=g,t[46]=c,t[47]=O.needsSignIn,t[48]=C):C=t[48];let w;t[49]!==s||t[50]!==_||t[51]!==c?(w=c&&s?(0,$.jsx)(T,{size:`xs`,variant:`ghost`,onClick:_,children:`Sign out`}):null,t[49]=s,t[50]=_,t[51]=c,t[52]=w):w=t[52];let E;t[53]!==s||t[54]!==o||t[55]!==m||t[56]!==i.enabled?(E=s&&i.enabled?(0,$.jsx)(T,{size:`xs`,variant:`outline`,disabled:o,onClick:m,children:`Test connection`}):null,t[53]=s,t[54]=o,t[55]=m,t[56]=i.enabled,t[57]=E):E=t[57];let D;t[58]!==p||t[59]!==S||t[60]!==C||t[61]!==w||t[62]!==E?(D=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[p,S,C,w,E]}),t[58]=p,t[59]=S,t[60]=C,t[61]=w,t[62]=E,t[63]=D):D=t[63];let I;t[64]!==u||t[65]!==O.needsSignIn||t[66]!==y?(I=O.needsSignIn&&!y?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:u?`Finish signing in in your browser, then come back here.`:y?`Sign in here to give it to every provider.`:`Agents can't reach this server until you sign in.`}):null,t[64]=u,t[65]=O.needsSignIn,t[66]=y,t[67]=I):I=t[67];let L;t[68]!==l||t[69]!==y?(L=l&&!y?(0,$.jsx)(`p`,{className:`rounded-md bg-destructive/8 px-2.5 py-1.5 text-xs text-destructive-foreground`,children:l}):null,t[68]=l,t[69]=y,t[70]=L):L=t[70];let R;t[71]!==u||t[72]!==l||t[73]!==h||t[74]!==y?(R=y?(0,$.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:l?`Shared sign-in unavailable`:`Shared sign-in`}),(0,$.jsxs)(`div`,{className:`grid gap-2 pt-2`,children:[(0,$.jsx)(`p`,{children:l??`Sign in through P4 Code to share access with every enabled provider.`}),(0,$.jsx)(`div`,{children:(0,$.jsx)(T,{size:`xs`,variant:`outline`,onClick:h,children:u?`Open browser`:l?`Retry shared sign-in`:`Sign in through P4 Code`})})]})]}):null,t[71]=u,t[72]=l,t[73]=h,t[74]=y,t[75]=R):R=t[75];let z;t[76]===i.source?z=t[77]:(z=i.source?(0,$.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer`,children:`Import source`}),(0,$.jsx)(`p`,{className:`break-all pt-2`,children:i.source.path})]}):null,t[76]=i.source,t[77]=z);let B=y?(0,$.jsx)(rn,{serverName:i.name,signIns:b,blocked:n.filter(Qt).length}):null;t[78]!==D||t[79]!==I||t[80]!==L||t[81]!==R||t[82]!==z||t[83]!==B?(F=(0,$.jsx)(Fe,{title:`Status`,children:(0,$.jsx)(je,{children:(0,$.jsxs)(`div`,{className:`grid gap-2 px-4 py-3`,children:[D,I,L,R,z,B]})})}),t[78]=D,t[79]=I,t[80]=L,t[81]=R,t[82]=z,t[83]=B,t[84]=F):F=t[84],A=Fe,M=`Providers`,k=je;let V;t[85]!==s||t[86]!==f||t[87]!==i.name?(V=e=>(0,$.jsx)(Ne,{title:e.label,...e.unsupported===void 0?{}:{description:e.unsupported},control:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[e.badge===void 0?null:(0,$.jsx)(v,{variant:an[e.badge].variant,children:an[e.badge].label}),(0,$.jsx)(Le,{"aria-label":`Give ${i.name} to ${e.label}`,checked:e.enabled&&e.badge!==`unavailable`,disabled:!s||e.unsupported!==void 0||e.badge===`unavailable`,onCheckedChange:t=>f(e.driver,t)})]})},e.driver),t[85]=s,t[86]=f,t[87]=i.name,t[88]=V):V=t[88],j=n.map(V),t[11]=u,t[12]=s,t[13]=o,t[14]=x,t[15]=r,t[16]=f,t[17]=g,t[18]=h,t[19]=_,t[20]=m,t[21]=a?.auth,t[22]=i,t[23]=d,t[24]=b,t[25]=O,t[26]=y,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N,t[32]=P,t[33]=F}else k=t[27],A=t[28],j=t[29],M=t[30],N=t[31],P=t[32],F=t[33];let I;t[89]!==k||t[90]!==j?(I=(0,$.jsx)(k,{children:j}),t[89]=k,t[90]=j,t[91]=I):I=t[91];let L;t[92]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,$.jsx)(`p`,{className:`px-3 text-xs text-muted-foreground sm:px-4`,children:`A change reaches a thread when its provider session next starts.`}),t[92]=L):L=t[92];let R;t[93]!==A||t[94]!==M||t[95]!==I?(R=(0,$.jsxs)(A,{title:M,children:[I,L]}),t[93]=A,t[94]=M,t[95]=I,t[96]=R):R=t[96];let z;t[97]!==p||t[98]!==c||t[99]!==l||t[100]!==i.enabled?(z=c!==void 0&&p!==void 0?(0,$.jsx)(Fe,{title:`Project`,children:(0,$.jsx)(je,{children:(0,$.jsx)(Xt,{projectLabel:c,override:l,inherited:i.enabled,onChange:p})})}):null,t[97]=p,t[98]=c,t[99]=l,t[100]=i.enabled,t[101]=z):z=t[101];let B;return t[102]!==R||t[103]!==z||t[104]!==N||t[105]!==P||t[106]!==F?(B=(0,$.jsxs)(`div`,{className:N,"data-server-id":P,children:[F,R,z]}),t[102]=R,t[103]=z,t[104]=N,t[105]=P,t[106]=F,t[107]=B):B=t[107],B}function Qt(e){return e.enabled&&e.badge===`unavailable`}function $t(e){return e.status===`signed-in`}function en(e){let t=S(e);return Vt(t)&&t.detail!==void 0?t.detail:`Sign-in could not start. Try again.`}function tn(e,t,n){let r=J(q.mcpRegistryProviderSignInState,{reportFailure:!1}),i=J(q.mcpRegistryProviderSignInStart,{reportFailure:!1}),a=J(q.mcpRegistryProviderSignInWait,{reportFailure:!1}),o=J(q.mcpRegistryProviderSignInComplete,{reportFailure:!1}),s=J(q.mcpRegistryProviderSignInCancel,{reportFailure:!1}),c=J(q.mcpRegistryProviderSignOut,{reportFailure:!1}),l=j(q.mcpRegistryProviderSignInComplete.permissionAtom(e)),u=j(q.mcpRegistryProviderSignInCancel.permissionAtom(e)),[d,f]=(0,Q.useState)(null),[p,m]=(0,Q.useState)({}),[h,g]=(0,Q.useState)(new Set),_=(0,Q.useRef)(new Set),v=e=>f(t=>t?.map(t=>t.instanceId===e.instanceId?e:t)??null),y=(e,t)=>m(n=>{let r={...n};return t===void 0?delete r[e]:r[e]=t,r});return(0,Q.useEffect)(()=>{if(!n)return;let i=!1;return r({environmentId:e,input:{serverId:t}}).then(e=>{i||f(e._tag===`Success`?e.value.providers:[])}),()=>{i=!0}},[n,e,r,t]),(0,Q.useEffect)(()=>{if(!n)return;let r=!1;for(let n of d??[]){let i=n.pending;i&&a({environmentId:e,input:{serverId:t,instanceId:n.instanceId,flowId:i.flowId}}).then(e=>{r||(f(t=>t?.map(t=>{if(t.instanceId!==n.instanceId||t.pending?.flowId!==i.flowId)return t;if(e._tag===`Success`)return e.value;let{pending:r,...a}=t;return a})??null),e._tag===`Failure`?y(n.instanceId,en(e.cause)):e._tag===`Success`&&e.value.status!==`signed-in`&&!_.current.has(n.instanceId)&&y(n.instanceId,`Sign-in ended without connecting. Try again.`))})}return()=>{r=!0}},[n,d,e,t,a]),{entries:n?d:null,errors:p,busy:h,run:async(n,r,a)=>{if(!_.current.has(n.instanceId)){_.current.add(n.instanceId),g(new Set(_.current)),y(n.instanceId,void 0);try{let l={serverId:t,instanceId:n.instanceId};if(r===`start`){let t=await i({environmentId:e,input:l});t._tag===`Success`?(v({...n,pending:t.value}),window.open(t.value.authorizationUrl,`_blank`,`noopener,noreferrer`)):t._tag===`Failure`&&y(n.instanceId,en(t.cause));return}let u={...l,flowId:n.pending?.flowId??``},d=r===`complete`?await o({environmentId:e,input:{...u,callbackUrl:a.trim()}}):r===`cancel`?await s({environmentId:e,input:u}):await c({environmentId:e,input:l});d._tag===`Success`?v(d.value):d._tag===`Failure`&&y(n.instanceId,en(d.cause))}finally{_.current.delete(n.instanceId),g(new Set(_.current))}}},canComplete:l,canCancel:u}}function nn(e){let t=(0,Z.c)(39),{entry:n,signIns:r}=e,i;t[0]!==n.displayName||t[1]!==n.driver?(i=n.displayName??rt(n.driver),t[0]=n.displayName,t[1]=n.driver,t[2]=i):i=t[2];let a=i,[o,s]=(0,Q.useState)(``),c=n.pending,l;t[3]!==n.instanceId||t[4]!==r.busy?(l=r.busy.has(n.instanceId),t[3]=n.instanceId,t[4]=r.busy,t[5]=l):l=t[5];let u=l,d=r.errors[n.instanceId],f=`mcp-callback-${n.instanceId}`,p;t[6]===a?p=t[7]:(p=(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:a}),t[6]=a,t[7]=p);let m=c?`text-warning-foreground`:n.status===`signed-in`?`text-success-foreground`:`text-muted-foreground`,h;t[8]===m?h=t[9]:(h=N(`text-xs`,m),t[8]=m,t[9]=h);let g;t[10]!==n.status||t[11]!==c?(g=c?`Waiting for sign-in`:it(n.status),t[10]=n.status,t[11]=c,t[12]=g):g=t[12];let _;t[13]!==h||t[14]!==g?(_=(0,$.jsx)(`p`,{className:h,role:`status`,children:g}),t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==p||t[17]!==_?(v=(0,$.jsxs)(`div`,{className:`grid gap-1`,children:[p,_]}),t[16]=p,t[17]=_,t[18]=v):v=t[18];let y;t[19]!==u||t[20]!==n||t[21]!==d||t[22]!==c||t[23]!==r?(y=!c&&n.status!==`unavailable`?(0,$.jsx)(T,{size:`xs`,variant:n.status===`signed-in`?`outline`:`default`,disabled:u,onClick:()=>void r.run(n,n.status===`signed-in`?`signOut`:`start`),children:u?`Please wait…`:n.status===`signed-in`?`Sign out`:d?`Start over`:`Sign in`}):null,t[19]=u,t[20]=n,t[21]=d,t[22]=c,t[23]=r,t[24]=y):y=t[24];let b;t[25]!==v||t[26]!==y?(b=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[v,y]}),t[25]=v,t[26]=y,t[27]=b):b=t[27];let x;t[28]!==u||t[29]!==o||t[30]!==n||t[31]!==d||t[32]!==f||t[33]!==c||t[34]!==r?(x=c?(0,$.jsxs)(`form`,{className:`grid gap-2`,onSubmit:e=>{e.preventDefault(),o.trim()&&!u&&r.canComplete&&r.run(n,`complete`,o)},children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Approve in your browser. If it ends on a callback URL, paste that URL here.`}),(0,$.jsx)(`label`,{htmlFor:f,className:`text-xs font-medium`,children:`Callback URL`}),(0,$.jsx)(ue,{id:f,value:o,onChange:e=>s(e.target.value),placeholder:`http://localhost:…/callback?code=…&state=…`,autoComplete:`off`,spellCheck:!1,disabled:u||!r.canComplete,"aria-invalid":!!d,"aria-describedby":d?`${f}-error`:void 0}),d?(0,$.jsx)(`p`,{id:`${f}-error`,role:`alert`,className:`text-xs text-destructive-foreground`,children:d}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,$.jsx)(T,{type:`submit`,size:`xs`,disabled:u||!o.trim()||!r.canComplete,children:u?`Please wait…`:`Finish sign-in`}),(0,$.jsx)(T,{type:`button`,size:`xs`,variant:`outline`,disabled:u,onClick:()=>window.open(c.authorizationUrl,`_blank`,`noopener,noreferrer`),children:`Open browser`}),(0,$.jsx)(T,{type:`button`,size:`xs`,variant:`ghost`,disabled:u||!r.canCancel,onClick:()=>void r.run(n,`cancel`),children:`Cancel`})]})]}):d?(0,$.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive-foreground`,children:d}):null,t[28]=u,t[29]=o,t[30]=n,t[31]=d,t[32]=f,t[33]=c,t[34]=r,t[35]=x):x=t[35];let S;return t[36]!==b||t[37]!==x?(S=(0,$.jsxs)(`div`,{className:`grid gap-2 border-t border-border pt-3`,children:[b,x]}),t[36]=b,t[37]=x,t[38]=S):S=t[38],S}function rn(e){let t=(0,Z.c)(8),{serverName:n,signIns:r,blocked:i}=e,a;t[0]===r?a=t[1]:(a=r.entries===null?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Checking providers…`}):r.entries.length===0?(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No enabled provider here can sign in to MCP servers itself.`}):r.entries.map(e=>(0,$.jsx)(nn,{entry:e,signIns:r},`${e.instanceId}:${e.pending?.flowId??`idle`}`)),t[0]=r,t[1]=a);let o;t[2]!==i||t[3]!==n?(o=i>0?(0,$.jsxs)(`details`,{className:`text-xs text-muted-foreground`,children:[(0,$.jsxs)(`summary`,{className:`cursor-pointer`,children:[i,` other `,i===1?`provider`:`providers`,` unavailable`]}),(0,$.jsxs)(`p`,{className:`pt-2`,children:[`These providers need shared sign-in to use `,n,`.`]})]}):null,t[2]=i,t[3]=n,t[4]=o):o=t[4];let s;return t[5]!==a||t[6]!==o?(s=(0,$.jsxs)(`div`,{className:`grid gap-3`,children:[a,o]}),t[5]=a,t[6]=o,t[7]=s):s=t[7],s}var an={"signed-in":{variant:`success`,label:`Signed in`},"needs-sign-in":{variant:`warning`,label:`Sign in needed`},unavailable:{variant:`secondary`,label:`Unavailable`}};function on(e){let t=(0,Z.c)(7),{plugin:n,projectLabel:r,projectOverride:i,onProjectOverride:a}=e,o;t[0]!==a||t[1]!==n||t[2]!==r||t[3]!==i?(o=r!==void 0&&a!==void 0?(0,$.jsx)(Fe,{title:`Project`,children:(0,$.jsx)(je,{children:(0,$.jsx)(Xt,{projectLabel:r,override:i,inherited:n.enabled,onChange:a})})}):null,t[0]=a,t[1]=n,t[2]=r,t[3]=i,t[4]=o):o=t[4];let s;return t[5]===o?s=t[6]:(s=(0,$.jsx)(`div`,{className:`grid gap-6`,children:o}),t[5]=o,t[6]=s),s}var sn=Gt;export{sn as component};
5
+ //# sourceMappingURL=settings.plugins-Dr0VpcPy.js.map