ryco-cli 0.1.29 → 0.1.30

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 (278) hide show
  1. package/README.md +37 -0
  2. package/dist/{AcpAdapter-CG1wRWcf.mjs → AcpAdapter-CKWzfB3Q.mjs} +4 -4
  3. package/dist/{AcpAdapter-8CSe4HK7.cjs → AcpAdapter-DjP0IHpH.cjs} +6 -6
  4. package/dist/{AcpNativeLogging-DbjnRnTf.cjs → AcpNativeLogging-5gTPK9Fq.cjs} +1 -1
  5. package/dist/{AcpNativeLogging-B6TtnnKL.mjs → AcpNativeLogging-Do0LktDb.mjs} +1 -1
  6. package/dist/{AcpRegistryDriver-16ZTxUs3.cjs → AcpRegistryDriver-BblCFfev.cjs} +3 -3
  7. package/dist/{AcpRegistryDriver-DZFasKaz.mjs → AcpRegistryDriver-BzohT-PC.mjs} +3 -3
  8. package/dist/{AzureDevOpsSourceControlProvider-DmJD1-WL.cjs → AzureDevOpsSourceControlProvider-CKSvfuDS.cjs} +1 -1
  9. package/dist/{AzureDevOpsSourceControlProvider-d5Ogsspk.mjs → AzureDevOpsSourceControlProvider-DRWSXTml.mjs} +1 -1
  10. package/dist/{BitbucketSourceControlProvider-B-ZwKj72.cjs → BitbucketSourceControlProvider-Bvl_q1o2.cjs} +1 -1
  11. package/dist/{BitbucketSourceControlProvider-DplKc8Wo.mjs → BitbucketSourceControlProvider-D5UVAc9z.mjs} +1 -1
  12. package/dist/{ClaudeDriver-0gGVop27.mjs → ClaudeDriver-BuQ_azDw.mjs} +7 -7
  13. package/dist/{ClaudeDriver-r0lJ9vmE.cjs → ClaudeDriver-DZkz0QPr.cjs} +8 -8
  14. package/dist/{CodexDriver-bJAbhSwY.cjs → CodexDriver-6Ph2cjAW.cjs} +5 -5
  15. package/dist/{CodexDriver-baT02xVb.mjs → CodexDriver-Bi49RIL4.mjs} +4 -4
  16. package/dist/{CodexTextGeneration-Dwp6X3dq.mjs → CodexTextGeneration-C5TIspJA.mjs} +4 -4
  17. package/dist/{CodexTextGeneration-DFZ5y4gj.cjs → CodexTextGeneration-sXPR9eld.cjs} +4 -4
  18. package/dist/{CopilotDriver-C0OhnSB1.mjs → CopilotDriver-Bcdpz6U_.mjs} +5 -5
  19. package/dist/{CopilotDriver-B_jEqfYQ.cjs → CopilotDriver-D6P0xgRX.cjs} +5 -5
  20. package/dist/{CursorDriver-DinXkGP9.mjs → CursorDriver-CRnDGwEv.mjs} +6 -6
  21. package/dist/{CursorDriver-BBFEW7ZI.cjs → CursorDriver-DMJ7sGSx.cjs} +7 -7
  22. package/dist/{ForgejoSourceControlProvider-iG9o7aZB.cjs → ForgejoSourceControlProvider-D4jGdaJX.cjs} +1 -1
  23. package/dist/{ForgejoSourceControlProvider-Dr0fxfud.mjs → ForgejoSourceControlProvider-Dl_Fk3RY.mjs} +1 -1
  24. package/dist/{GitHubSourceControlProvider-CnIu0n2Y.mjs → GitHubSourceControlProvider-DnwKf0ap.mjs} +1 -1
  25. package/dist/{GitHubSourceControlProvider-L1yFpep4.cjs → GitHubSourceControlProvider-QMe-zymI.cjs} +1 -1
  26. package/dist/{GitLabSourceControlProvider-BZdwXdJl.mjs → GitLabSourceControlProvider-Cj07OTBD.mjs} +1 -1
  27. package/dist/{GitLabSourceControlProvider-CrcBR6KQ.cjs → GitLabSourceControlProvider-CvvN5pHt.cjs} +1 -1
  28. package/dist/{GrokDriver-pX-N6HGS.mjs → GrokDriver-Bvq1jP3S.mjs} +7 -7
  29. package/dist/{GrokDriver-D_Ylzh5z.cjs → GrokDriver-jy8JIvYY.cjs} +10 -10
  30. package/dist/{Metrics-Bf96NJ4j.cjs → Metrics-C0LSU8s7.cjs} +979 -976
  31. package/dist/{Metrics-BjqGlIP4.mjs → Metrics-CnmjpbWk.mjs} +979 -976
  32. package/dist/{NodeSqliteClient-BGg70C7Q.cjs → NodeSqliteClient-D8bzGgPN.cjs} +1 -1
  33. package/dist/{OpenCodeDriver-BFEw5t09.cjs → OpenCodeDriver-Bu5D19tl.cjs} +6 -6
  34. package/dist/{OpenCodeDriver-Byu1pf_i.mjs → OpenCodeDriver-DhyVaBMT.mjs} +5 -5
  35. package/dist/{SideQuestionIsolation-81IoAuoi.mjs → SideQuestionIsolation-B-aE6aBz.mjs} +1 -1
  36. package/dist/{SideQuestionIsolation-CMPkCUP0.cjs → SideQuestionIsolation-CtJ4wX83.cjs} +1 -1
  37. package/dist/bin.cjs +8564 -302
  38. package/dist/bin.mjs +8544 -265
  39. package/dist/client/assets/{AccountSettings-FN7pwqYA.js → AccountSettings-v6-r6gYl.js} +1 -1
  40. package/dist/client/assets/{AiFocusSettings-xcDAMaqH.js → AiFocusSettings-BVdLON0q.js} +1 -1
  41. package/dist/client/assets/{AnimatedHeight-BNg7wnTK.js → AnimatedHeight-UXn4-nUd.js} +1 -1
  42. package/dist/client/assets/{AppearanceSettings-BvsvAOsG.js → AppearanceSettings-DRChsQnN.js} +1 -1
  43. package/dist/client/assets/{BranchToolbar.logic-DFsXV3Qs.js → BranchToolbar.logic-YN3KjVr9.js} +1 -1
  44. package/dist/client/assets/{BrowserPanel-D-g_xDZs.js → BrowserPanel-Dxw3stFP.js} +1 -1
  45. package/dist/client/assets/{ChatRightPanel-Bm906qNi.js → ChatRightPanel-CygpcJiF.js} +5 -5
  46. package/dist/client/assets/{ChatThreadRouteView-CATwakjI.js → ChatThreadRouteView-DYLZFHu0.js} +1 -1
  47. package/dist/client/assets/{CommandPaletteDialog-Obv1bvxj.js → CommandPaletteDialog-BRvBzP1R.js} +1 -1
  48. package/dist/client/assets/{CompositeRoot-CfkIdky8.js → CompositeRoot-BeEGGWwn.js} +1 -1
  49. package/dist/client/assets/{ComputerUseSettings-ljYmTHea.js → ComputerUseSettings-Cq8Pi0ZU.js} +1 -1
  50. package/dist/client/assets/{ConnectionsSettings-CIXs7x_E.js → ConnectionsSettings-RSYtexxd.js} +2 -2
  51. package/dist/client/assets/{ContextHandoffEndpointLabel-BzI4Wi1i.js → ContextHandoffEndpointLabel-CeGDLNA4.js} +1 -1
  52. package/dist/client/assets/{DiagnosticsSettings-DGX_2T2M.js → DiagnosticsSettings-CDa6MVx4.js} +1 -1
  53. package/dist/client/assets/{DialogHandle-CTtSYpsC.js → DialogHandle-BE7egDQQ.js} +1 -1
  54. package/dist/client/assets/{DialogPopup-DdZlhHuQ.js → DialogPopup-NfwDyR5c.js} +1 -1
  55. package/dist/client/assets/DialogRoot-C4mtzigX.js +1 -0
  56. package/dist/client/assets/{DialogTitle-Du7CAbaO.js → DialogTitle-B_Q4DykI.js} +1 -1
  57. package/dist/client/assets/{DialogTrigger-VpFh8Xza.js → DialogTrigger-BSqd4Crj.js} +1 -1
  58. package/dist/client/assets/{DialogViewport-BwuqbGLY.js → DialogViewport-B6w_ROOE.js} +1 -1
  59. package/dist/client/assets/{DraftChatThreadRouteView-Cmc5HpWf.js → DraftChatThreadRouteView-JW_bXVrM.js} +1 -1
  60. package/dist/client/assets/{ExternalIdentityWeb.logic-DsTJQkg-.js → ExternalIdentityWeb.logic-BlKX8J9h.js} +1 -1
  61. package/dist/client/assets/{GlassSurface-BlWIlQ0s.js → GlassSurface-DDG4eTlj.js} +1 -1
  62. package/dist/client/assets/{HostedConnectionControls-ySHqwr4K.js → HostedConnectionControls-CscV6hm1.js} +1 -1
  63. package/dist/client/assets/{HostedHubRoot-Caz8PElK.js → HostedHubRoot-gp7-ClBP.js} +1 -1
  64. package/dist/client/assets/{HostedNativeAuthorizationRoute-BSq_AlY2.js → HostedNativeAuthorizationRoute-j7oSlakZ.js} +1 -1
  65. package/dist/client/assets/{HostedNodeRenameDialog-ChxJdr-Z.js → HostedNodeRenameDialog-D1DSiTpx.js} +1 -1
  66. package/dist/client/assets/{HostedRelayTrustNotice-DPVrIfj_.js → HostedRelayTrustNotice-B9jp4SRh.js} +1 -1
  67. package/dist/client/assets/{IntegrationsSettingsPanel-eAq5h-D5.js → IntegrationsSettingsPanel-DH7SfWtV.js} +1 -1
  68. package/dist/client/assets/{KeybindingsSettings-D1XaEVGH.js → KeybindingsSettings-DkgYYSHS.js} +1 -1
  69. package/dist/client/assets/{LazyBrowserPanel-B6POLJh3.js → LazyBrowserPanel-D4e76vc_.js} +1 -1
  70. package/dist/client/assets/{McpServersSettings-DqLA6n5v.js → McpServersSettings-Dc1kPa-X.js} +1 -1
  71. package/dist/client/assets/{MobileSheet-CtQIYRlY.js → MobileSheet-lT--mLEz.js} +1 -1
  72. package/dist/client/assets/{NodeSecuritySettings-Skm7GQDl.js → NodeSecuritySettings-DcfSx4KT.js} +1 -1
  73. package/dist/client/assets/{NullStore-b8PhjwPZ.js → NullStore-8d2s-Re3.js} +1 -1
  74. package/dist/client/assets/{OnboardingDialog-8-fKvY5H.js → OnboardingDialog-CnLjwM6Z.js} +1 -1
  75. package/dist/client/assets/{OpinionatedPluginsSettings-BIJfJ34L.js → OpinionatedPluginsSettings-BTJyS3rN.js} +1 -1
  76. package/dist/client/assets/{PdfAttachmentPreview-CTo1AyZs.js → PdfAttachmentPreview-C8-hT8KQ.js} +1 -1
  77. package/dist/client/assets/{PhoneGetAppInterstitial-DwopOWnQ.js → PhoneGetAppInterstitial-Zh0zpBgT.js} +1 -1
  78. package/dist/client/assets/{PhoneHome-CUzxhhR4.js → PhoneHome-CIMkuDJF.js} +1 -1
  79. package/dist/client/assets/{PhoneSettingsSurface-BK2RHmYJ.js → PhoneSettingsSurface-CfZQxJNI.js} +1 -1
  80. package/dist/client/assets/{ProvidersSettingsPanel-DPxL7AsR.js → ProvidersSettingsPanel-DAVSiwE1.js} +1 -1
  81. package/dist/client/assets/{QuitShortcutFeedback-eCvP_MNj.js → QuitShortcutFeedback-Qs9XsuZ4.js} +1 -1
  82. package/dist/client/assets/{RedactedSensitiveText-DH4mWpB6.js → RedactedSensitiveText-BHGbQJwB.js} +1 -1
  83. package/dist/client/assets/{RootAppShell-DwiWD4Cy.js → RootAppShell-T056pByH.js} +2 -2
  84. package/dist/client/assets/{Separator-BiINUUQl.js → Separator-B6Esv57Y.js} +1 -1
  85. package/dist/client/assets/{SettingsDialog-CE8qy0qL.js → SettingsDialog-BERU2Qg7.js} +1 -1
  86. package/dist/client/assets/{SettingsPanels-BYknk6GO.js → SettingsPanels-De_XZOQF.js} +1 -1
  87. package/dist/client/assets/{SettingsPanels.editor-64bM0lhg.js → SettingsPanels.editor-Dkva9gX_.js} +1 -1
  88. package/dist/client/assets/{SourceControlSettings-BbveiAj3.js → SourceControlSettings-B4HS17cB.js} +1 -1
  89. package/dist/client/assets/{StatisticsPage-CAO_tCeC.js → StatisticsPage-Bj2ftFdH.js} +1 -1
  90. package/dist/client/assets/{StatisticsPanel-SNlgMv2o.js → StatisticsPanel-Dw7GBBmd.js} +1 -1
  91. package/dist/client/assets/{StatisticsSettingsLink-BpkNubL2.js → StatisticsSettingsLink-_XL3ABoI.js} +1 -1
  92. package/dist/client/assets/{ThreadTerminalDrawer-9x_kqQPy.js → ThreadTerminalDrawer-CPPzQSXN.js} +1 -1
  93. package/dist/client/assets/{ThreadWorkspacePanel-BXE17C4x.js → ThreadWorkspacePanel-DWKU7Omm.js} +1 -1
  94. package/dist/client/assets/{abnfDiagram-N423BO3Z-DAmGykdr.js → abnfDiagram-N423BO3Z-ByEe3mC0.js} +1 -1
  95. package/dist/client/assets/{activity-DRZlu-MC.js → activity-CwTUF6lv.js} +1 -1
  96. package/dist/client/assets/{alert-CwrDisFU.js → alert-DQEkrtUJ.js} +1 -1
  97. package/dist/client/assets/{appChrome-B_VWWDFj.js → appChrome-TkWLAGxk.js} +1 -1
  98. package/dist/client/assets/architecture-7GRP2DOG-HS59zfrk.js +1 -0
  99. package/dist/client/assets/{architectureDiagram-T3A2C74G-DypU2ERW.js → architectureDiagram-T3A2C74G-Bd-yxaTr.js} +1 -1
  100. package/dist/client/assets/{arrow-left-XhcJWpRy.js → arrow-left-DUOpzEbP.js} +1 -1
  101. package/dist/client/assets/{arrow-right-BBs6iTUL.js → arrow-right-HOYJnPKw.js} +1 -1
  102. package/dist/client/assets/{arrow-up-right-CJ9Vq7nK.js → arrow-up-right-DHnMKuVA.js} +1 -1
  103. package/dist/client/assets/{authorization-BugIGt5e.js → authorization-D8dOcEYq.js} +1 -1
  104. package/dist/client/assets/{badge-BswOCwph.js → badge-2AZ3HfVS.js} +1 -1
  105. package/dist/client/assets/{blockDiagram-VBNYF7ZC-B9MhR9hY.js → blockDiagram-VBNYF7ZC-CPDBonMC.js} +1 -1
  106. package/dist/client/assets/{bot-D5wgL7pu.js → bot-DxjPA7Bw.js} +1 -1
  107. package/dist/client/assets/{c4Diagram-5PPSVZJV-C22FWSoE.js → c4Diagram-5PPSVZJV-BM6pAiqT.js} +1 -1
  108. package/dist/client/assets/{capabilities-Bj_X9FZ-.js → capabilities-CsHjxjab.js} +1 -1
  109. package/dist/client/assets/channel-Dn3_cOkm.js +1 -0
  110. package/dist/client/assets/{chart-column-D6Lnkklk.js → chart-column-Cg7d41tb.js} +1 -1
  111. package/dist/client/assets/chevron-right-Dsw16yGn.js +1 -0
  112. package/dist/client/assets/{chunk-2GRJ4B5K-D1tZuCzA.js → chunk-2GRJ4B5K-DVKozJ41.js} +1 -1
  113. package/dist/client/assets/{chunk-4I5QYGJK-Clf86zK0.js → chunk-4I5QYGJK-BRoMwPkW.js} +1 -1
  114. package/dist/client/assets/{chunk-5RXB4S5H-B36N5RYZ.js → chunk-5RXB4S5H-DFMKyoqP.js} +1 -1
  115. package/dist/client/assets/{chunk-6Q2QTUOP-IAxdzsQJ.js → chunk-6Q2QTUOP-Ba6UENe9.js} +1 -1
  116. package/dist/client/assets/{chunk-7Z6QIM7H-Ctqebv_4.js → chunk-7Z6QIM7H-B87gYLWH.js} +1 -1
  117. package/dist/client/assets/{chunk-GF5L2VYU-CAfciJae.js → chunk-GF5L2VYU-DZ840GRQ.js} +1 -1
  118. package/dist/client/assets/{chunk-I66GZJ75-BZ7XtZf4.js → chunk-I66GZJ75-BO6p4Aqg.js} +1 -1
  119. package/dist/client/assets/{chunk-JQJVKLGR-DVuZCWnv.js → chunk-JQJVKLGR-5dTfVinz.js} +1 -1
  120. package/dist/client/assets/{chunk-KBJHAD2P-DtWbzsRm.js → chunk-KBJHAD2P-BeWfBZdP.js} +1 -1
  121. package/dist/client/assets/{chunk-NSK5VX7P-BVMz_Hc4.js → chunk-NSK5VX7P-DuRkdn5k.js} +1 -1
  122. package/dist/client/assets/{chunk-QR6OTTB3-DWitTCy-.js → chunk-QR6OTTB3-Duz4Y_uE.js} +1 -1
  123. package/dist/client/assets/{chunk-UBXNYLIW-BuxXXP2s.js → chunk-UBXNYLIW-D-z8URgN.js} +1 -1
  124. package/dist/client/assets/{chunk-W5SLKNZC-Bnf3sQl4.js → chunk-W5SLKNZC-AGjFjjoJ.js} +1 -1
  125. package/dist/client/assets/{chunk-WRU74C26-xu-KDOon.js → chunk-WRU74C26-BgY3UiXB.js} +1 -1
  126. package/dist/client/assets/classDiagram-JCYQIIEL-ZQvrS8No.js +1 -0
  127. package/dist/client/assets/classDiagram-v2-OCEON4UE-ZQvrS8No.js +1 -0
  128. package/dist/client/assets/{clipboard-copy-oDSkUUg4.js → clipboard-copy-BWf3JuTE.js} +1 -1
  129. package/dist/client/assets/{cynefin-OW5HDTMX-DGNyiNSf.js → cynefin-OW5HDTMX-BuOAGqlK.js} +1 -1
  130. package/dist/client/assets/{cynefinDiagram-MW4NZA55-_ctibv4i.js → cynefinDiagram-MW4NZA55-DqV0Aokp.js} +1 -1
  131. package/dist/client/assets/{dagre-VZM6K2ZE-Bo-bS1Y0.js → dagre-VZM6K2ZE-D_GFquDW.js} +1 -1
  132. package/dist/client/assets/{data-list-DLsM39Hp.js → data-list-BJCq3CVP.js} +1 -1
  133. package/dist/client/assets/{desktopWorkspace-Ocqt625W.js → desktopWorkspace-_iM6B9Kf.js} +1 -1
  134. package/dist/client/assets/{deviceName-z0ZWSq0z.js → deviceName-C2N8ZRX3.js} +1 -1
  135. package/dist/client/assets/{diagram-7IWD3JNH-DSjtw1SY.js → diagram-7IWD3JNH-B1wlsNg2.js} +1 -1
  136. package/dist/client/assets/{diagram-B4RE2ZJO-B7fWEvIa.js → diagram-B4RE2ZJO-D-CYoym7.js} +1 -1
  137. package/dist/client/assets/{diagram-LBJQPF4R-trRYCE5d.js → diagram-LBJQPF4R-DqJ9NCqt.js} +1 -1
  138. package/dist/client/assets/{diagram-Q27KOJAE-_DYcRggk.js → diagram-Q27KOJAE-3yp1D2u4.js} +1 -1
  139. package/dist/client/assets/{diagram-UB23O5K3-BkMzOHX8.js → diagram-UB23O5K3-Byp25nGC.js} +1 -1
  140. package/dist/client/assets/{download-CHdS3R_v.js → download-DsYNYJeu.js} +1 -1
  141. package/dist/client/assets/{ebnfDiagram-BXEA7PRR-DubiOMCG.js → ebnfDiagram-BXEA7PRR-B_IM1l6o.js} +1 -1
  142. package/dist/client/assets/{editorPreferences-DVhg0CXd.js → editorPreferences-D8q1ItMW.js} +1 -1
  143. package/dist/client/assets/{empty-BlBl_Vvw.js → empty-BbJHvskr.js} +1 -1
  144. package/dist/client/assets/{erDiagram-JOGREHBK-CFDiNfSJ.js → erDiagram-JOGREHBK--OtcrCRJ.js} +1 -1
  145. package/dist/client/assets/eventmodeling-NTZA5JFV-Dj71kuPV.js +1 -0
  146. package/dist/client/assets/flowDiagram-UKHOOZJN-BaAiwuvL.js +1 -0
  147. package/dist/client/assets/{ganttDiagram-PKOTCBZU-DT2XhE-m.js → ganttDiagram-PKOTCBZU-w0seBi3Q.js} +1 -1
  148. package/dist/client/assets/{gitGraph-4MIJSDKK-BI5UGiqb.js → gitGraph-4MIJSDKK-BOJ0lcSW.js} +1 -1
  149. package/dist/client/assets/{gitGraphDiagram-DS77QQ5N-CzAB97Rd.js → gitGraphDiagram-DS77QQ5N-BMfOCCYn.js} +1 -1
  150. package/dist/client/assets/{group-DZJuSiJL.js → group-tVMKGp7Q.js} +1 -1
  151. package/dist/client/assets/{hostedConnectionCoordinator-BztHfGNt.js → hostedConnectionCoordinator-BuRWCvUG.js} +1 -1
  152. package/dist/client/assets/hostedPairing-5n5srRC9.js +1 -0
  153. package/dist/client/assets/{hubRoutes-DExWSvVE.js → hubRoutes-jcMPIFy3.js} +1 -1
  154. package/dist/client/assets/{index-BAJdq3TK.js → index-BqZvnGNr.js} +1 -1
  155. package/dist/client/assets/{info-A6RAGUB7-DdGYYgLX.js → info-A6RAGUB7-acjBTQ5o.js} +1 -1
  156. package/dist/client/assets/{infoDiagram-6WML65LV-zhUpER6a.js → infoDiagram-6WML65LV-DB01Nc2m.js} +1 -1
  157. package/dist/client/assets/{input-CzU08wbL.js → input-BDWSVClC.js} +1 -1
  158. package/dist/client/assets/{ishikawaDiagram-WSZJBQD7-BQLkqykE.js → ishikawaDiagram-WSZJBQD7-KhZTvm-J.js} +1 -1
  159. package/dist/client/assets/{journeyDiagram-NVQOT4AX-DBgsbKOF.js → journeyDiagram-NVQOT4AX-C3JCYk-2.js} +1 -1
  160. package/dist/client/assets/{kanban-definition-27J2QSJJ-DF-Rr-xs.js → kanban-definition-27J2QSJJ-Dbo0C1s6.js} +1 -1
  161. package/dist/client/assets/{kbd-DKuvGqFP.js → kbd-Dxm5Elqj.js} +1 -1
  162. package/dist/client/assets/{key-round-CvyrSjb2.js → key-round-CETZqe3h.js} +1 -1
  163. package/dist/client/assets/{layers-CwP65mnC.js → layers-Dqez1Uq8.js} +1 -1
  164. package/dist/client/assets/{log-out-D3rICSt5.js → log-out-D5-aSBAz.js} +1 -1
  165. package/dist/client/assets/{logging-C6tXZlGQ.js → logging-B_qXVrk6.js} +1 -1
  166. package/dist/client/assets/{main-RFllWEko.js → main-DAbEANjY.js} +2 -2
  167. package/dist/client/assets/{mermaid-parser.core-BiGKtilP.js → mermaid-parser.core-B6Q-3x_q.js} +2 -2
  168. package/dist/client/assets/{mermaidEngine-Cjfgf3Bg.js → mermaidEngine-DksLcesB.js} +3 -3
  169. package/dist/client/assets/{mindmap-definition-FAOFIHXS-SiU9JwWJ.js → mindmap-definition-FAOFIHXS-LaMzRxqw.js} +1 -1
  170. package/dist/client/assets/{motion-C9rN_t9p.js → motion-BdscFixQ.js} +1 -1
  171. package/dist/client/assets/{packet-AYTQ26CC-F-HuW5Dr.js → packet-AYTQ26CC-BHhg59Si.js} +1 -1
  172. package/dist/client/assets/{pairingUrl-rQM9kSGT.js → pairingUrl-Dn1e2CVw.js} +1 -1
  173. package/dist/client/assets/{palette-gaqgtube.js → palette-92ylWqeC.js} +1 -1
  174. package/dist/client/assets/{pegDiagram-VL7TDLO6-cC-QUd7I.js → pegDiagram-VL7TDLO6-s7l7UD9d.js} +1 -1
  175. package/dist/client/assets/{pie-WAS4IAKB-BI3XUcLN.js → pie-WAS4IAKB-DygX31Z9.js} +1 -1
  176. package/dist/client/assets/{pieDiagram-7S7Q4E2Y-BP4gJ4ZK.js → pieDiagram-7S7Q4E2Y-bb6I9TtZ.js} +1 -1
  177. package/dist/client/assets/{play-BJZrOx6T.js → play-DUvOxTpL.js} +1 -1
  178. package/dist/client/assets/{primary-CQh_KHGG.js → primary-DZjgHvyf.js} +3 -3
  179. package/dist/client/assets/{providerDriverMeta-LJ2vJxm-.js → providerDriverMeta-T2YbXzuS.js} +1 -1
  180. package/dist/client/assets/{qr-code-Cmfz5JKf.js → qr-code-D4CtBq2F.js} +1 -1
  181. package/dist/client/assets/{qr-code-BFO8lV1M.js → qr-code-dbkTo07n.js} +1 -1
  182. package/dist/client/assets/{quadrantDiagram-CIZ2JOQS-DO-N1m-q.js → quadrantDiagram-CIZ2JOQS-Cj1Y68ZF.js} +1 -1
  183. package/dist/client/assets/{radar-RG4KPBEZ-CfayXQ5F.js → radar-RG4KPBEZ-FHM3ftPp.js} +1 -1
  184. package/dist/client/assets/{radio-group-BueX1AVO.js → radio-group-CRnHYWa8.js} +1 -1
  185. package/dist/client/assets/{railroad-74A4TZTK-CT6f-etT.js → railroad-74A4TZTK-CPMn18Cm.js} +1 -1
  186. package/dist/client/assets/railroad-abnf-HS5TGJTU-DxU7Mt1k.js +1 -0
  187. package/dist/client/assets/railroad-ebnf-LZEXJU2U-BYAPVjRd.js +1 -0
  188. package/dist/client/assets/railroad-peg-WCYAUIDC-BOqgR_X7.js +1 -0
  189. package/dist/client/assets/{railroadDiagram-AXF67PYL-DC8egbob.js → railroadDiagram-AXF67PYL-DyV3SuDj.js} +1 -1
  190. package/dist/client/assets/{refresh-cw-K_hU8_ld.js → refresh-cw-CgDa2Ok_.js} +1 -1
  191. package/dist/client/assets/{requirementDiagram-LRYGKXZP-DJMzcLk_.js → requirementDiagram-LRYGKXZP-_xEAGWaH.js} +1 -1
  192. package/dist/client/assets/runtime-BwHA1GUS.js +18 -0
  193. package/dist/client/assets/{sankeyDiagram-W5VNT64P-YR6aIYLj.js → sankeyDiagram-W5VNT64P-Clf6oTLi.js} +1 -1
  194. package/dist/client/assets/{save-Mh-PA_2P.js → save-C8h0AMdl.js} +1 -1
  195. package/dist/client/assets/{scroll-area-BC-LB_zE.js → scroll-area-7n2X_RLQ.js} +1 -1
  196. package/dist/client/assets/{scrollEdges-Zcpuz3un.js → scrollEdges-BXYnwntN.js} +1 -1
  197. package/dist/client/assets/{separator-yx1r9ZDw.js → separator-CL1qjMqJ.js} +1 -1
  198. package/dist/client/assets/{sequenceDiagram-SI44F4Z6-BVeSqWDA.js → sequenceDiagram-SI44F4Z6-CcYtQLSe.js} +1 -1
  199. package/dist/client/assets/{settingsLayout-BbjDM-p0.js → settingsLayout-DxsFwhF0.js} +1 -1
  200. package/dist/client/assets/{sheet-CpEwjOWn.js → sheet-CGiaw8-i.js} +1 -1
  201. package/dist/client/assets/{shield-i098Bm_B.js → shield-DPC4oHTi.js} +1 -1
  202. package/dist/client/assets/{shield-alert-CXmR7fM9.js → shield-alert-CwH36qZb.js} +1 -1
  203. package/dist/client/assets/{shield-check-CdFhWT_o.js → shield-check-CGD7sEeF.js} +1 -1
  204. package/dist/client/assets/{sidebar-DayQTDZp.js → sidebar-Cc6ANbOP.js} +1 -1
  205. package/dist/client/assets/{sidebarProjectFolders-DXqx3OlZ.js → sidebarProjectFolders-DO2Uv84F.js} +1 -1
  206. package/dist/client/assets/{sidebarStatusText-kdA6QMZS.js → sidebarStatusText-B4AtFXZo.js} +1 -1
  207. package/dist/client/assets/{sidebarUndo-BHFfJj0k.js → sidebarUndo-gdSrfa4O.js} +1 -1
  208. package/dist/client/assets/{skeleton-BwFgUtuE.js → skeleton-rS3IgBob.js} +1 -1
  209. package/dist/client/assets/{smartphone-DGfizz51.js → smartphone-DgVJfbv3.js} +1 -1
  210. package/dist/client/assets/square-Cr9X8U6y.js +1 -0
  211. package/dist/client/assets/{src-DHNjfMxR.js → src-C3Y_imaX.js} +1 -1
  212. package/dist/client/assets/{star-J3x3fktG.js → star-Cqay-Cae.js} +1 -1
  213. package/dist/client/assets/{stateDiagram-OKZ733FA-DoIZN669.js → stateDiagram-OKZ733FA-DEKURpRP.js} +1 -1
  214. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-CWtHILqh.js +1 -0
  215. package/dist/client/assets/storeSelectors-CTDWheMy.js +1 -0
  216. package/dist/client/assets/{swimlanes-SLNWSIFB-BoFLigyK.js → swimlanes-SLNWSIFB-DrR6sbi6.js} +1 -1
  217. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-DuaPce9O.js +8 -0
  218. package/dist/client/assets/{switch-D9inWKdd.js → switch-DnpJB2xv.js} +1 -1
  219. package/dist/client/assets/{timeline-definition-Z64GVDOM-D65EmNWc.js → timeline-definition-Z64GVDOM-bQJvmJx5.js} +1 -1
  220. package/dist/client/assets/{toggle-wMq3LLn1.js → toggle-D10FsFoE.js} +1 -1
  221. package/dist/client/assets/{toggle-group-YNqzWsK0.js → toggle-group-BhzbQPEQ.js} +1 -1
  222. package/dist/client/assets/{tokenModePresentation-C0-NgmX5.js → tokenModePresentation-BkS-mry_.js} +1 -1
  223. package/dist/client/assets/{tooltip-mwOCSCXF.js → tooltip-BlweKBxc.js} +1 -1
  224. package/dist/client/assets/{treeView-Q6P3EWNA-C2S-OPgI.js → treeView-Q6P3EWNA-D4Ex5QTp.js} +1 -1
  225. package/dist/client/assets/{treemap-WGGIJYW6-6Ovsu9iH.js → treemap-WGGIJYW6-C4B6Y6qM.js} +1 -1
  226. package/dist/client/assets/{unplug-BEfcl9Ht.js → unplug-B1dczi-t.js} +1 -1
  227. package/dist/client/assets/{usage-DF8oQrsy.js → usage-BBwaxMif.js} +1 -1
  228. package/dist/client/assets/useAppSidebarCollapsed-CFy476E3.js +1 -0
  229. package/dist/client/assets/useBaseUiId-DKOjzmu3.js +1 -0
  230. package/dist/client/assets/{useLabelableId-C8bc9a0F.js → useLabelableId-DQbY2GG1.js} +1 -1
  231. package/dist/client/assets/{useNavigate-01O5dMQe.js → useNavigate-B8oXtF30.js} +1 -1
  232. package/dist/client/assets/{usePhoneThreadActions-BIdh81kF.js → usePhoneThreadActions-6DCLiyJ5.js} +1 -1
  233. package/dist/client/assets/{usePopupViewport-DYYZwfTW.js → usePopupViewport-CNWcP7Od.js} +1 -1
  234. package/dist/client/assets/{useScrollLock-BO185DkJ.js → useScrollLock-BbKeKZdj.js} +1 -1
  235. package/dist/client/assets/{useStatistics-D55-xLMz.js → useStatistics-B76_r68I.js} +1 -1
  236. package/dist/client/assets/{useTriggerFocusGuards-CMLVr18J.js → useTriggerFocusGuards-BC4Wb3GI.js} +1 -1
  237. package/dist/client/assets/{useValueChanged-DSyRHPje.js → useValueChanged-BkTbyZdO.js} +1 -1
  238. package/dist/client/assets/{user-round-C-U7TZKG.js → user-round-CLy1Qy1Y.js} +1 -1
  239. package/dist/client/assets/{vennDiagram-T6HMQDX7-fZAexcYr.js → vennDiagram-T6HMQDX7-8iiroXim.js} +1 -1
  240. package/dist/client/assets/{vscode-icons-BYX6fBsM.js → vscode-icons-CJBVQtq5.js} +1 -1
  241. package/dist/client/assets/{wardley-WFR3VGLG-gdYWSMxK.js → wardley-WFR3VGLG-DpyNUbTc.js} +1 -1
  242. package/dist/client/assets/{wardleyDiagram-T6FBY63Y-iDJxQb70.js → wardleyDiagram-T6FBY63Y-CI7is3QO.js} +1 -1
  243. package/dist/client/assets/{workspaceMetadataProjection-So9-wSEZ.js → workspaceMetadataProjection-aqZEXDrQ.js} +1 -1
  244. package/dist/client/assets/{wrench-D79uBUSl.js → wrench-7pbbxqrZ.js} +1 -1
  245. package/dist/client/assets/{xychartDiagram-ELKLHX3M-B4cfMwpJ.js → xychartDiagram-ELKLHX3M-BTEX3m2y.js} +1 -1
  246. package/dist/client/index.html +1 -1
  247. package/dist/{deviceHostWorker-CYnrwfrv.cjs → deviceHostWorker-D4HauWIV.cjs} +1 -1
  248. package/dist/{git-BKwGfw8A.mjs → git-9xWsJYIH.mjs} +1 -1
  249. package/dist/{git-Dn5wrgFY.cjs → git-xIkXFy_l.cjs} +2 -2
  250. package/dist/{makeManagedServerProvider-B_lPFNpL.mjs → makeManagedServerProvider-B90UKjnv.mjs} +1 -1
  251. package/dist/{makeManagedServerProvider-CUwxc0Pn.cjs → makeManagedServerProvider-CF776SAO.cjs} +2 -2
  252. package/dist/resource-monitor/ryco-resource-monitor +0 -0
  253. package/dist/resource-monitor/ryco-resource-monitor.exe +0 -0
  254. package/dist/resource-monitor/win32-arm64/ryco-resource-monitor.exe +0 -0
  255. package/dist/resource-monitor/win32-x64/ryco-resource-monitor.exe +0 -0
  256. package/dist/{rolldown-runtime-LGfotAqq.cjs → rolldown-runtime-HbSU0i7K.cjs} +7 -0
  257. package/dist/{src-BzVJd3Me.cjs → src-CARHuYkT.cjs} +1059 -178
  258. package/dist/{src-7E1M4gTQ.mjs → src-CtsgPPhb.mjs} +198 -97
  259. package/package.json +1 -1
  260. package/dist/client/assets/DialogRoot-k2_0SNKA.js +0 -1
  261. package/dist/client/assets/architecture-7GRP2DOG-CQNNG5gU.js +0 -1
  262. package/dist/client/assets/channel-BtX-w3CK.js +0 -1
  263. package/dist/client/assets/chevron-right-Ddq5gL-L.js +0 -1
  264. package/dist/client/assets/classDiagram-JCYQIIEL-BgDa3HFl.js +0 -1
  265. package/dist/client/assets/classDiagram-v2-OCEON4UE-BgDa3HFl.js +0 -1
  266. package/dist/client/assets/eventmodeling-NTZA5JFV-DpzGHjmu.js +0 -1
  267. package/dist/client/assets/flowDiagram-UKHOOZJN-CaDVMm72.js +0 -1
  268. package/dist/client/assets/hostedPairing-CqhLPQqG.js +0 -1
  269. package/dist/client/assets/railroad-abnf-HS5TGJTU-B890iayj.js +0 -1
  270. package/dist/client/assets/railroad-ebnf-LZEXJU2U-C079Tzw6.js +0 -1
  271. package/dist/client/assets/railroad-peg-WCYAUIDC-DxvOX5Rh.js +0 -1
  272. package/dist/client/assets/runtime-OM-uAtaj.js +0 -18
  273. package/dist/client/assets/square-Cd2WS1gv.js +0 -1
  274. package/dist/client/assets/stateDiagram-v2-UEYNNEHI-BnzsGHaN.js +0 -1
  275. package/dist/client/assets/storeSelectors-D60AAN01.js +0 -1
  276. package/dist/client/assets/swimlanesDiagram-ULZ7WXOC-BnA-oDvU.js +0 -8
  277. package/dist/client/assets/useAppSidebarCollapsed-C0jpPtER.js +0 -1
  278. package/dist/client/assets/useBaseUiId-Bz8dcyjd.js +0 -1
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-BqSANuAs.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./index-BAJdq3TK.js";import{K as n,a as r,q as i}from"./primary-CQh_KHGG.js";import{bi as a,t as o,u as s}from"./src-DHNjfMxR.js";import{$l as c,Fa as l,Hr as u,Kr as d,Ql as f,Qr as p,Vr as m,Zl as h,ho as g,mo as _,oo as v,sr as y,uo as b}from"./runtime-OM-uAtaj.js";import{t as x}from"./react-CwJFpaho.js";import{t as S}from"./switch-D9inWKdd.js";import{t as C}from"./compiler-runtime-C4g8XhC5.js";import{t as w}from"./badge-BswOCwph.js";import{t as T}from"./bot-D5wgL7pu.js";import{J as E,Z as D}from"./ContextHandoffEndpointLabel-BzI4Wi1i.js";import{t as O}from"./chevron-right-Ddq5gL-L.js";import{t as k}from"./capabilities-Bj_X9FZ-.js";import"./SettingsPanels.editor-64bM0lhg.js";import{t as A}from"./key-round-CvyrSjb2.js";import{t as j}from"./refresh-cw-K_hU8_ld.js";import{t as M}from"./save-Mh-PA_2P.js";import{t as N}from"./shield-check-CdFhWT_o.js";import{t as P}from"./unplug-BEfcl9Ht.js";import{t as F}from"./wrench-D79uBUSl.js";import{t as I}from"./toastHelpers-CSQRKo4F.js";import{t as L}from"./input-CzU08wbL.js";import{i as R}from"./providerDriverMeta-LJ2vJxm-.js";import{ut as z}from"./main-RFllWEko.js";var B={name:`cable`,size:24,node:[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]};B.node;var V=g(B),H={name:`clipboard`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]};H.node;var U=g(H),ee={name:`link-2-off`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]};ee.node;var te=g(ee),ne=()=>({integrations:[],topology:{available:!1,reason:`Not loaded.`},pairingCodes:{}}),re=(e,t)=>({integrations:t.integrations,topology:t.topology,pairingCodes:{}}),ie=(e,t)=>({...e,integrations:[...e.integrations.filter(e=>e.integration.integrationId!==t.detail.integration.integrationId),t.detail],pairingCodes:{...e.pairingCodes,[t.detail.integration.integrationId]:t.pairingCode}}),ae=(e,t)=>{let n={...e.pairingCodes};return delete n[t],{...e,integrations:e.integrations.filter(e=>e.integration.integrationId!==t),pairingCodes:n}},oe=()=>({installations:[]}),se=e=>[...e].toSorted((e,t)=>e.driver.localeCompare(t.driver)||e.createdAt.localeCompare(t.createdAt)||e.installationId.localeCompare(t.installationId)),ce=(e,t)=>({installations:se(t.installations)}),W=(e,t)=>{let n=e.installations.find(e=>e.installationId===t.installation.installationId);return n&&n.revision>t.installation.revision?e:{installations:se([...e.installations.filter(e=>e.installationId!==t.installation.installationId),t.installation])}},G=e(x(),1),K=C(),le=[50,100,200,400],ue=e=>e instanceof Error&&e.message.trim()===`Agent Control is disabled.`,de=e=>new Promise(t=>window.setTimeout(t,e));async function fe(e,t=de){for(let n of le)try{return await e()}catch(e){if(!ue(e))throw e;await t(n)}return e()}var q=c(),pe={codex:`Codex`,"claude-code":`Claude Code`,"claude-desktop":`Claude Desktop`,"generic-mcp":`Generic MCP`},me=[{capability:s.externalListProjects,label:`List allowed projects`,description:`Discover only projects inside this integration's scope.`},{capability:s.externalCreateTask,label:`Request tasks`,description:`Submit one task to Ryco's normal approval queue.`},{capability:s.externalReadTask,label:`Read own tasks`,description:`Read or wait only for tasks created by this integration.`},{capability:s.externalReadAutomations,label:`Read automations`,description:`Read bounded schedules and run outcomes inside the selected project scope.`},{capability:s.externalManageAutomations,label:`Request automations`,description:`Propose schedule changes; each due run still requires separate approval.`},{capability:s.externalReadActivity,label:`Read activity`,description:`Read bounded payload-free project and provider event summaries.`},{capability:s.externalReadDiagnostics,label:`Read diagnostics`,description:`Read redacted count-only health summaries for allowed projects.`},{capability:s.externalSharedCheckout,label:`Request shared checkout`,description:`May request the local checkout; each request still needs approval.`},{capability:s.externalFullAccess,label:`Request full access`,description:`May request a full-access runtime; each request still needs approval.`}],J=()=>({displayName:``,clientKind:`codex`,scopeKind:`all`,projectIds:``,capabilities:[s.externalListProjects,s.externalCreateTask,s.externalReadTask],expiresAt:``,rateLimitPerMinute:`60`,activeTaskLimit:`1`});function Y(e,t){d.add(I({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function he(e,t){return[e,...t.map(e=>JSON.stringify(e))].join(` `)}function X(e){return e===null?`Never`:new Date(e).toLocaleString()}function ge(e){let t=e.integration;return t.revokedAt===null?t.expiresAt!==null&&Date.parse(t.expiresAt)<=Date.now()?{label:`Expired`,variant:`error`}:t.pairingState===`paired`?{label:`Paired`,variant:`success`}:t.pairingState===`pending`?{label:`Pairing`,variant:`warning`}:{label:`Unpaired`,variant:`outline`}:{label:`Revoked`,variant:`error`}}function _e(e){let t=e.integration;return{displayName:t.displayName,clientKind:t.clientKind,scopeKind:t.projectScope.kind,projectIds:t.projectScope.kind===`selected`?t.projectScope.projectIds.join(`, `):``,capabilities:t.capabilities,expiresAt:t.expiresAt===null?``:new Date(t.expiresAt).toISOString().slice(0,16),rateLimitPerMinute:String(t.rateLimitPerMinute),activeTaskLimit:String(t.activeTaskLimit)}}function Z(e){let t=e.projectIds.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>a.make(e)),n=e.scopeKind===`all`?{kind:`all`}:{kind:`selected`,projectIds:t},r=Number(e.rateLimitPerMinute),i=Number(e.activeTaskLimit);if(!e.displayName.trim())throw Error(`A display name is required.`);if(e.scopeKind===`selected`&&t.length===0)throw Error(`Enter at least one project ID for selected-project scope.`);if(!Number.isInteger(r)||r<1)throw Error(`Rate limit must be a positive whole number.`);if(!Number.isInteger(i)||i<1)throw Error(`Active-task limit must be a positive whole number.`);return{displayName:e.displayName.trim(),clientKind:e.clientKind,projectScope:n,capabilities:e.capabilities,expiresAt:e.expiresAt?new Date(e.expiresAt).toISOString():null,rateLimitPerMinute:r,activeTaskLimit:i}}function ve(e){let t=(0,K.c)(85),{form:n,onChange:r,clientLocked:i}=e,a=i!==void 0&&i,o;t[0]!==n||t[1]!==r?(o=e=>r({...n,displayName:e.target.value}),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n.displayName||t[4]!==o?(s=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Display name`,(0,q.jsx)(L,{value:n.displayName,placeholder:`Local Codex`,onChange:o})]}),t[3]=n.displayName,t[4]=o,t[5]=s):s=t[5];let c=n.clientKind,l;t[6]!==n||t[7]!==r?(l=e=>r({...n,clientKind:e.target.value}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.entries(pe).map(ye),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n.clientKind||t[12]!==l?(d=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Client`,(0,q.jsx)(`select`,{className:`h-9 rounded-lg border border-input bg-background px-3 text-sm`,value:c,disabled:a,onChange:l,children:u})]}),t[10]=a,t[11]=n.clientKind,t[12]=l,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==d?(f=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[s,d]}),t[14]=s,t[15]=d,t[16]=f):f=t[16];let p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Project scope`}),t[17]=p):p=t[17];let m=n.scopeKind===`all`,h;t[18]!==n||t[19]!==r?(h=()=>r({...n,scopeKind:`all`}),t[18]=n,t[19]=r,t[20]=h):h=t[20];let g;t[21]!==m||t[22]!==h?(g=(0,q.jsx)(`input`,{type:`radio`,checked:m,onChange:h}),t[21]=m,t[22]=h,t[23]=g):g=t[23];let _;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsxs)(`span`,{children:[`All current and future projects`,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`The client can discover every project on this local Ryco instance.`})]}),t[24]=_):_=t[24];let v;t[25]===g?v=t[26]:(v=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[g,_]}),t[25]=g,t[26]=v);let y=n.scopeKind===`selected`,b;t[27]!==n||t[28]!==r?(b=()=>r({...n,scopeKind:`selected`}),t[27]=n,t[28]=r,t[29]=b):b=t[29];let x;t[30]!==y||t[31]!==b?(x=(0,q.jsx)(`input`,{type:`radio`,checked:y,onChange:b}),t[30]=y,t[31]=b,t[32]=x):x=t[32];let S=n.scopeKind!==`selected`,C;t[33]!==n||t[34]!==r?(C=e=>r({...n,projectIds:e.target.value}),t[33]=n,t[34]=r,t[35]=C):C=t[35];let w;t[36]!==n.projectIds||t[37]!==S||t[38]!==C?(w=(0,q.jsx)(L,{className:`mt-1.5`,value:n.projectIds,disabled:S,placeholder:`project-id-1, project-id-2`,"aria-label":`Selected project IDs`,onChange:C}),t[36]=n.projectIds,t[37]=S,t[38]=C,t[39]=w):w=t[39];let T;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`Comma-separated stable project IDs. Unknown IDs remain inaccessible.`}),t[40]=T):T=t[40];let E;t[41]===w?E=t[42]:(E=(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Selected projects`,w,T]}),t[41]=w,t[42]=E);let D;t[43]!==x||t[44]!==E?(D=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[x,E]}),t[43]=x,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==v||t[47]!==D?(O=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[p,v,D]}),t[46]=v,t[47]=D,t[48]=O):O=t[48];let k;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Capability grants`}),t[49]=k):k=t[49];let A;t[50]!==n||t[51]!==r?(A=me.map(e=>(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:n.capabilities.includes(e.capability),onChange:t=>r({...n,capabilities:t.target.checked?[...n.capabilities,e.capability]:n.capabilities.filter(t=>t!==e.capability)})}),(0,q.jsxs)(`span`,{children:[e.label,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]})]},e.capability)),t[50]=n,t[51]=r,t[52]=A):A=t[52];let j;t[53]===A?j=t[54]:(j=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[k,A]}),t[53]=A,t[54]=j);let M;t[55]!==n||t[56]!==r?(M=e=>r({...n,expiresAt:e.target.value}),t[55]=n,t[56]=r,t[57]=M):M=t[57];let N;t[58]!==n.expiresAt||t[59]!==M?(N=(0,q.jsx)(L,{type:`datetime-local`,value:n.expiresAt,onChange:M}),t[58]=n.expiresAt,t[59]=M,t[60]=N):N=t[60];let P;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,q.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`Empty means no expiry.`}),t[61]=P):P=t[61];let F;t[62]===N?F=t[63]:(F=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Expires`,N,P]}),t[62]=N,t[63]=F);let I;t[64]!==n||t[65]!==r?(I=e=>r({...n,rateLimitPerMinute:e.target.value}),t[64]=n,t[65]=r,t[66]=I):I=t[66];let R;t[67]!==n.rateLimitPerMinute||t[68]!==I?(R=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Requests per minute`,(0,q.jsx)(L,{type:`number`,min:1,max:600,value:n.rateLimitPerMinute,onChange:I})]}),t[67]=n.rateLimitPerMinute,t[68]=I,t[69]=R):R=t[69];let z;t[70]!==n||t[71]!==r?(z=e=>r({...n,activeTaskLimit:e.target.value}),t[70]=n,t[71]=r,t[72]=z):z=t[72];let B;t[73]!==n.activeTaskLimit||t[74]!==z?(B=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Concurrent active tasks`,(0,q.jsx)(L,{type:`number`,min:1,max:32,value:n.activeTaskLimit,onChange:z})]}),t[73]=n.activeTaskLimit,t[74]=z,t[75]=B):B=t[75];let V;t[76]!==F||t[77]!==R||t[78]!==B?(V=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[F,R,B]}),t[76]=F,t[77]=R,t[78]=B,t[79]=V):V=t[79];let H;return t[80]!==O||t[81]!==j||t[82]!==V||t[83]!==f?(H=(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[f,O,j,V]}),t[80]=O,t[81]=j,t[82]=V,t[83]=f,t[84]=H):H=t[84],H}function ye(e){let[t,n]=e;return(0,q.jsx)(`option`,{value:t,children:n},t)}function be(){let e=f(),t=r(),n=e?.environmentId??t,[i,a]=(0,G.useState)(ne),[o,s]=(0,G.useState)(J),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,v]=(0,G.useState)(null),b=(0,G.useMemo)(()=>n===null?void 0:y(n)?.agentControl,[n]),x=(0,G.useCallback)(async()=>{if(b)try{let e=await fe(()=>b.listIntegrations());a(t=>re(t,e))}catch(e){Y(`Failed to load external integrations`,e)}},[b]);(0,G.useEffect)(()=>{x()},[x]);let S=(0,G.useCallback)(async(e,t)=>{await navigator.clipboard.writeText(t),v(e),window.setTimeout(()=>v(t=>t===e?null:t),1500)},[]),C=async()=>{if(b)try{h(`new`);let e=await b.createIntegration(Z(o));a(t=>ie(t,e)),s(J()),l(!1)}catch(e){Y(`Failed to create integration`,e)}finally{h(null)}},T=async e=>{if(b)try{h(e.integration.integrationId);let t=Z(o);await b.updateIntegration({integrationId:e.integration.integrationId,...t}),d(null),await x()}catch(e){Y(`Failed to update integration`,e)}finally{h(null)}},D=async e=>{if(!b)return;let t=e.integration.integrationId;try{h(t);let e=await b.resumeIntegrationPairing({integrationId:t});a(t=>ie(t,e))}catch(e){Y(`Failed to resume pairing`,e)}finally{h(null)}},O=async e=>{if(!b)return;let t=e.integration.integrationId;try{h(t),await b.revokeIntegration({integrationId:t}),await x()}catch(e){Y(`Failed to revoke integration`,e)}finally{h(null)}},k=async e=>{if(!b)return;let t=e.integration.integrationId;if(window.confirm(`Delete ${e.integration.displayName}? This cannot be undone.`))try{h(t),(await b.deleteIntegration({integrationId:t})).deleted&&a(e=>ae(e,t))}catch(e){Y(`Failed to delete integration`,e)}finally{h(null)}};return(0,q.jsx)(`section`,{"data-testid":`external-integrations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-5`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(N,{className:`size-3.5`}),`Agent Control`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`External integrations`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Pair a local MCP client with a revocable identity. Every task request waits in Ryco for explicit user approval before a thread is created.`})]}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(p,{size:`icon`,variant:`outline`,"aria-label":`Refresh integrations`,onClick:()=>void x(),children:(0,q.jsx)(j,{})}),(0,q.jsxs)(p,{disabled:!b||!i.topology.available,onClick:()=>{d(null),s(J()),l(e=>!e)},children:[(0,q.jsx)(z,{}),`New integration`]})]})]}),i.topology.available?null:(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(te,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local pairing is unavailable`}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[i.topology.reason??`Ryco could not prove a direct loopback-only topology.`,` `,`External setup fails closed while Ryco is remotely exposed or Hub-connected.`]})]})]}),c?(0,q.jsxs)(`div`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsx)(ve,{form:o,onChange:s}),(0,q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,q.jsx)(p,{variant:`ghost`,onClick:()=>l(!1),children:`Cancel`}),(0,q.jsxs)(p,{disabled:m===`new`,onClick:()=>void C(),children:[(0,q.jsx)(A,{}),`Create and pair`]})]})]}):null,i.integrations.length===0&&!c?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-6 text-center text-sm text-muted-foreground`,children:`No external integrations are configured.`}):null,i.integrations.map(e=>{let t=e.integration,n=ge(e),r=i.pairingCodes[t.integrationId],a=he(e.setup.pairCommand.command,e.setup.pairCommand.args),c=u===t.integrationId;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`font-semibold`,children:t.displayName}),(0,q.jsx)(w,{variant:n.variant,children:n.label}),(0,q.jsx)(w,{variant:`outline`,children:pe[t.clientKind]})]}),(0,q.jsx)(`p`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:t.integrationId})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(p,{size:`sm`,variant:`outline`,onClick:()=>{d(c?null:t.integrationId),s(_e(e))},children:c?`Close editor`:`Edit`}),(0,q.jsxs)(p,{size:`sm`,variant:`outline`,disabled:!i.topology.available||m===t.integrationId||t.revokedAt!==null,onClick:()=>void D(e),children:[(0,q.jsx)(A,{}),`Pair again`]}),(0,q.jsx)(p,{size:`sm`,variant:`outline`,disabled:m===t.integrationId||t.revokedAt!==null,onClick:()=>void O(e),children:`Revoke`}),(0,q.jsx)(p,{size:`icon-sm`,variant:`ghost`,"aria-label":`Delete ${t.displayName}`,disabled:m===t.integrationId,onClick:()=>void k(e),children:(0,q.jsx)(E,{})})]})]}),c?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(ve,{form:o,onChange:s}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(p,{disabled:m===t.integrationId,onClick:()=>void T(e),children:[(0,q.jsx)(M,{}),`Save changes`]})})]}):(0,q.jsxs)(`div`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Project scope`}),(0,q.jsx)(`p`,{className:`mt-0.5 break-words font-medium`,children:t.projectScope.kind===`all`?`All current and future projects`:t.projectScope.projectIds.join(`, `)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Limits`}),(0,q.jsxs)(`p`,{className:`mt-0.5 font-medium`,children:[t.rateLimitPerMinute,`/minute · `,t.activeTaskCount,`/`,t.activeTaskLimit,` active`]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Expiry`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.expiresAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Last used`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.lastUsedAt)})]}),(0,q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Capabilities`}),(0,q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:t.capabilities.map(e=>(0,q.jsx)(w,{variant:`outline`,children:e},e))})]})]}),t.pairingState===`pending`?(0,q.jsxs)(`div`,{className:`grid gap-3 rounded-lg border bg-muted/20 p-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:`Finish pairing locally`}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Pairing code expires `,X(t.pairingCodeExpiresAt),`. The code is shown only for this ceremony; the generated MCP configuration never contains it.`]})]}),r?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`code`,{"data-testid":`external-pairing-code`,className:`rounded bg-background px-3 py-2 font-mono text-sm tracking-[0.18em]`,children:r}),(0,q.jsxs)(p,{size:`sm`,variant:`outline`,onClick:()=>void S(`code-${t.integrationId}`,r),children:[g===`code-${t.integrationId}`?(0,q.jsx)(_,{}):(0,q.jsx)(U,{}),`Copy code`]})]}):(0,q.jsx)(`p`,{className:`text-xs text-warning-foreground`,children:`The pairing code is no longer displayed. Choose Pair again to generate a new one.`}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`Run this bridge command, then enter the code`}),(0,q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,q.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded bg-background p-2 text-[11px]`,children:a}),(0,q.jsx)(p,{size:`icon-sm`,variant:`outline`,"aria-label":`Copy pairing command`,onClick:()=>void S(`pair-${t.integrationId}`,a),children:g===`pair-${t.integrationId}`?(0,q.jsx)(_,{}):(0,q.jsx)(U,{})})]})]}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`MCP configuration`}),(0,q.jsx)(`pre`,{"data-testid":`external-mcp-configuration`,className:`max-h-48 overflow-auto rounded bg-background p-3 text-[11px] leading-relaxed`,children:e.setup.configuration}),(0,q.jsxs)(p,{className:`justify-self-start`,size:`sm`,variant:`outline`,onClick:()=>void S(`config-${t.integrationId}`,e.setup.configuration),children:[g===`config-${t.integrationId}`?(0,q.jsx)(_,{}):(0,q.jsx)(U,{}),`Copy configuration`]})]})]}):null]},t.integrationId)})]})})}var xe=[],Se=[];function Ce(e){return e.displayName??R(e.driver)?.label??l(e.driver)}function Q(e){return e.providerDisplayName??R(e.driver)?.label??l(e.driver)}function we(e){return e.driver===`codex`?`codex`:e.driver===`claudeAgent`?`claude-code`:`generic-mcp`}function Te(e){return{...J(),displayName:`${Q(e)} Agent Control`,clientKind:we(e)}}function Ee(e,t){return e.filter(e=>e.workspaceId===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]}function De(e){if(!e)return{label:`Not connected`,variant:`outline`};switch(e.state){case`connected`:return{label:`Connected`,variant:`success`};case`repair-needed`:return{label:`Needs repair`,variant:`error`};case`disconnected`:case`revoked`:return{label:`Disconnected`,variant:`outline`};case`disconnecting`:return{label:`Disconnecting`,variant:`warning`};case`planned`:case`credential-written`:case`provider-written`:case`verifying`:return{label:`Connecting`,variant:`warning`}}}function Oe(e,t){d.add(I({type:`success`,title:e,description:t}))}function $(e,t){d.add(I({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function ke(){let e=f(),t=r(),n=e?.environmentId??t,[i,a]=(0,G.useState)(xe),[o,s]=(0,G.useState)(Se),[c,l]=(0,G.useState)(oe),[u,d]=(0,G.useState)(null),[m,h]=(0,G.useState)(!0),[g,_]=(0,G.useState)(null),[x,S]=(0,G.useState)(null),[C,E]=(0,G.useState)(J),O=(0,G.useMemo)(()=>n===null?void 0:y(n),[n]),k=O?.agentControl,A=O?.mcp,M=(0,G.useCallback)(async()=>{if(!k||!A){h(!1);return}try{let[e,t,n]=await fe(()=>Promise.all([A.listWorkspaces(),k.listMcpInstallations(),k.listIntegrations()]));a(e.providers),s(e.workspaces),l(e=>ce(e,t)),d(n.topology)}catch(e){$(`Failed to load Agent Control providers`,e)}finally{h(!1)}},[k,A]);(0,G.useEffect)(()=>{M()},[M]);let N=async(e,t)=>{if(k)try{_(e.id);let n=t?(()=>{let{clientKind:t,...n}=Z(C);return{workspaceId:e.id,...n}})():{workspaceId:e.id},r=await k.connectMcpInstallation(n);l(e=>W(e,r)),S(null),Oe(`${Q(e)} connected`,`The credential was stored locally and was not shown to the browser.`)}catch(t){$(`Failed to connect ${Q(e)}`,t),await M()}finally{_(null)}},I=async(e,t)=>{if(k)try{_(e.id);let n=await k.repairMcpInstallation({installationId:t.installationId});l(e=>W(e,n)),Oe(`${Q(e)} repaired`)}catch(t){$(`Failed to repair ${Q(e)}`,t),await M()}finally{_(null)}},L=async(e,t)=>{if(k&&window.confirm(`Disconnect Agent Control from ${Q(e)}?`))try{_(e.id);let n=await k.disconnectMcpInstallation({installationId:t.installationId});l(e=>W(e,n)),Oe(`${Q(e)} disconnected`)}catch(t){$(`Failed to disconnect ${Q(e)}`,t),await M()}finally{_(null)}},z=o.filter(e=>e.capabilities.externalAgentControl===`available`);return(0,q.jsx)(`section`,{"data-testid":`agent-control-mcp-installations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-8`,children:[(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(T,{className:`size-3.5`}),`Ryco sessions`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Automatic inside Ryco`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Supported sessions started by Ryco receive Agent Control automatically. There is nothing to install in those provider profiles.`})]}),m?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border p-4 text-sm text-muted-foreground`,children:[(0,q.jsx)(D,{className:`size-4 animate-spin`}),` Loading providers…`]}):i.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No configured provider instances were found.`}):(0,q.jsx)(`div`,{className:`divide-y overflow-hidden rounded-xl border bg-card`,children:i.map(e=>{let t=R(e.driver)?.icon??T,n=e.enabled&&e.capabilities.automaticAgentControl===`available`;return(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-4 py-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(t,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:Ce(e)}),(0,q.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground`,children:e.instanceId}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n?`Available in every new Ryco-managed session.`:e.enabled?`This provider does not expose automatic Agent Control yet.`:`This provider instance is disabled.`})]})]}),(0,q.jsx)(w,{variant:n?`success`:`outline`,children:n?`Automatic`:e.enabled?`Unavailable`:`Disabled`})]},e.instanceId)})})]}),(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(V,{className:`size-3.5`}),`External agents`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Connect an installed provider`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco detects local provider profiles and writes their native MCP configuration. The default grants project listing and task request/read access, limited to 60 requests per minute and one active task. Every task still requires approval.`})]}),(0,q.jsx)(p,{size:`icon`,variant:`outline`,"aria-label":`Refresh Agent Control providers`,disabled:m,onClick:()=>void M(),children:(0,q.jsx)(j,{})})]}),u&&!u.available?(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(v,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local installation is unavailable`}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:u.reason??`Ryco could not prove a direct loopback-only topology.`})]})]}):null,!m&&(!k||!A)?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`This Ryco environment does not expose provider MCP installation yet.`}):!m&&z.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No installable provider profiles were detected. Configure a supported provider instance first, then refresh.`}):(0,q.jsx)(`div`,{className:`grid gap-3`,children:z.map(e=>{let t=Ee(c.installations,e.id),n=De(t),r=t?.state===`connected`,i=t?.state===`repair-needed`,a=g===e.id,o=x===e.id,s=R(e.driver)?.icon??V;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(s,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:Q(e)}),(0,q.jsx)(w,{variant:n.variant,children:n.label})]}),(0,q.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:e.displayPath}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.providerInstances.length,` configured provider`,e.providerInstances.length===1?` instance`:` instances`,t?` · MCP name ${t.serverName}`:``]})]})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2 sm:justify-end`,children:i&&t?(0,q.jsxs)(p,{size:`sm`,disabled:a||u?.available===!1,onClick:()=>void I(e,t),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(F,{}),`Repair`]}):r&&t?(0,q.jsxs)(p,{size:`sm`,variant:`outline`,disabled:a,onClick:()=>void L(e,t),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(P,{}),`Disconnect`]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{size:`sm`,variant:`outline`,disabled:a||u?.available===!1,onClick:()=>{o?S(null):(E(Te(e)),S(e.id))},children:o?`Close`:`Customize`}),(0,q.jsxs)(p,{size:`sm`,disabled:a||u?.available===!1,onClick:()=>void N(e,!1),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(b,{}),`Connect`]})]})})]}),t?.lastError?(0,q.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive`,children:t.lastError}):null,t?.preservedUserChanges?(0,q.jsx)(`div`,{className:`rounded-lg border border-warning/30 bg-warning/8 p-3 text-xs text-warning-foreground`,children:`Ryco left this provider's MCP entry untouched because it had been edited after installation.`}):null,o?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Customize the credential scope and limits before Ryco installs it. The provider profile is fixed to this detected workspace.`}),(0,q.jsx)(ve,{form:C,onChange:E,clientLocked:!0}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(p,{disabled:a||u?.available===!1,onClick:()=>void N(e,!0),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(V,{}),`Connect with these permissions`]})})]}):null]},e.id)})})]})]})})}var Ae=(0,G.lazy)(()=>t(()=>import(`./ComputerUseSettings-ljYmTHea.js`).then(e=>({default:e.ComputerUseSettings})),__vite__mapDeps([0])));function je(){let e=(0,K.c)(15),t=h(),r=f(),a;e[0]===r?.primary?a=e[1]:(a=n&&!i()&&r?.primary===!0,e[0]=r?.primary,e[1]=a);let o=a,s=!!window.desktopBridge?.computerUse&&(t!==`node`||o),c;e[2]===t?c=e[3]:(c=t!==`client`&&(0,q.jsx)(Me,{}),e[2]=t,e[3]=c);let l;e[4]!==o||e[5]!==t||e[6]!==r?(l=t===`node`&&r&&!o&&(0,q.jsxs)(`section`,{className:`border-b p-6 sm:p-8`,"data-settings-section":`Device permissions`,children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Device permissions`}),(0,q.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`To enable screen recording, accessibility, or computer use on `,r.nodeLabel,`, open Ryco on `,r.nodeLabel,` and use Settings → Integrations. Operating system permissions must be approved on that device.`]})]}),e[4]=o,e[5]=t,e[6]=r,e[7]=l):l=e[7];let u;e[8]!==s||e[9]!==t?(u=s&&(0,q.jsx)(`div`,{"data-settings-section":t===`node`?`Device permissions`:void 0,children:(0,q.jsx)(G.Suspense,{fallback:(0,q.jsx)(`p`,{className:`p-6`,children:`Loading device integrations…`}),children:(0,q.jsx)(Ae,{})})}),e[8]=s,e[9]=t,e[10]=u):u=e[10];let d;return e[11]!==c||e[12]!==l||e[13]!==u?(d=(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[c,l,u]}),e[11]=c,e[12]=l,e[13]=u,e[14]=d):d=e[14],d}function Me(){let e=(0,K.c)(25),t=m(Ne),{updateSettings:n}=u(),r=k(o.serverUpdateSettings),i,a,s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Private Agent Control`}),a=(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Private tools for every agent`}),s=(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco sessions receive the tools automatically. Connect supported standalone provider profiles with one click. Routine private-session actions run directly. Destructive and security-sensitive changes require approval.`}),e[0]=i,e[1]=a,e[2]=s):(i=e[0],a=e[1],s=e[2]);let c=t?`Enabled. New Ryco-managed sessions receive Agent Control without changing the provider's global MCP configuration.`:`Disabled. Agent Control is unavailable to Ryco sessions and external clients.`,l;e[3]===c?l=e[4]:(l=(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:c}),e[3]=c,e[4]=l);let d;e[5]!==r.allowed||e[6]!==r.reason?(d=!r.allowed&&r.reason?(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-destructive`,children:r.reason}):null,e[5]=r.allowed,e[6]=r.reason,e[7]=d):d=e[7];let f;e[8]!==l||e[9]!==d?(f=(0,q.jsxs)(`div`,{children:[i,a,s,l,d]}),e[8]=l,e[9]=d,e[10]=f):f=e[10];let p=!r.allowed,h;e[11]===n?h=e[12]:(h=e=>n({agentControl:{enabled:!!e}}),e[11]=n,e[12]=h);let g;e[13]!==t||e[14]!==p||e[15]!==h?(g=(0,q.jsx)(S,{checked:t,disabled:p,onCheckedChange:h,"aria-label":`Enable Agent Control`}),e[13]=t,e[14]=p,e[15]=h,e[16]=g):g=e[16];let _;e[17]!==f||e[18]!==g?(_=(0,q.jsx)(`section`,{"data-settings-section":`Private Agent Control`,className:`scroll-mt-6 border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[f,g]})}),e[17]=f,e[18]=g,e[19]=_):_=e[19];let v;e[20]===t?v=e[21]:(v=t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ke,{}),(0,q.jsxs)(`details`,{className:`group border-b bg-muted/5`,children:[(0,q.jsxs)(`summary`,{className:`mx-auto flex w-full max-w-4xl cursor-pointer list-none items-center gap-3 px-6 py-5 sm:px-8 [&::-webkit-details-marker]:hidden`,children:[(0,q.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(A,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-sm font-semibold`,children:`Advanced manual setup`}),(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Create a revocable pairing for another MCP client or a profile Ryco cannot detect.`})]}),(0,q.jsx)(O,{className:`size-4 text-muted-foreground transition-transform group-open:rotate-90`})]}),(0,q.jsx)(be,{})]})]}):null,e[20]=t,e[21]=v);let y;return e[22]!==_||e[23]!==v?(y=(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[_,v]}),e[22]=_,e[23]=v,e[24]=y):y=e[24],y}function Ne(e){return e.agentControl.enabled}export{je as IntegrationsSettingsPanel};
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./index-BqZvnGNr.js";import{K as n,a as r,q as i}from"./primary-DZjgHvyf.js";import{bi as a,t as o,u as s}from"./src-C3Y_imaX.js";import{$l as c,Fa as l,Hr as u,Kr as d,Ql as f,Qr as p,Vr as m,Zl as h,ho as g,mo as _,oo as v,sr as y,uo as b}from"./runtime-BwHA1GUS.js";import{t as x}from"./react-CwJFpaho.js";import{t as S}from"./switch-DnpJB2xv.js";import{t as C}from"./compiler-runtime-C4g8XhC5.js";import{t as w}from"./badge-2AZ3HfVS.js";import{t as T}from"./bot-DxjPA7Bw.js";import{J as E,Z as D}from"./ContextHandoffEndpointLabel-CeGDLNA4.js";import{t as O}from"./chevron-right-Dsw16yGn.js";import{t as k}from"./capabilities-CsHjxjab.js";import"./SettingsPanels.editor-Dkva9gX_.js";import{t as A}from"./key-round-CETZqe3h.js";import{t as j}from"./refresh-cw-CgDa2Ok_.js";import{t as M}from"./save-C8h0AMdl.js";import{t as N}from"./shield-check-CGD7sEeF.js";import{t as P}from"./unplug-B1dczi-t.js";import{t as F}from"./wrench-7pbbxqrZ.js";import{t as I}from"./toastHelpers-CSQRKo4F.js";import{t as L}from"./input-BDWSVClC.js";import{i as R}from"./providerDriverMeta-T2YbXzuS.js";import{ut as z}from"./main-DAbEANjY.js";var B={name:`cable`,size:24,node:[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]};B.node;var V=g(B),H={name:`clipboard`,size:24,node:[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]};H.node;var U=g(H),ee={name:`link-2-off`,size:24,node:[[`path`,{d:`M9 17H7A5 5 0 0 1 7 7`,key:`10o201`}],[`path`,{d:`M15 7h2a5 5 0 0 1 4 8`,key:`1d3206`}],[`line`,{x1:`8`,x2:`12`,y1:`12`,y2:`12`,key:`rvw6j4`}],[`line`,{x1:`2`,x2:`22`,y1:`2`,y2:`22`,key:`a6p6uj`}]]};ee.node;var te=g(ee),ne=()=>({integrations:[],topology:{available:!1,reason:`Not loaded.`},pairingCodes:{}}),re=(e,t)=>({integrations:t.integrations,topology:t.topology,pairingCodes:{}}),ie=(e,t)=>({...e,integrations:[...e.integrations.filter(e=>e.integration.integrationId!==t.detail.integration.integrationId),t.detail],pairingCodes:{...e.pairingCodes,[t.detail.integration.integrationId]:t.pairingCode}}),ae=(e,t)=>{let n={...e.pairingCodes};return delete n[t],{...e,integrations:e.integrations.filter(e=>e.integration.integrationId!==t),pairingCodes:n}},oe=()=>({installations:[]}),se=e=>[...e].toSorted((e,t)=>e.driver.localeCompare(t.driver)||e.createdAt.localeCompare(t.createdAt)||e.installationId.localeCompare(t.installationId)),ce=(e,t)=>({installations:se(t.installations)}),W=(e,t)=>{let n=e.installations.find(e=>e.installationId===t.installation.installationId);return n&&n.revision>t.installation.revision?e:{installations:se([...e.installations.filter(e=>e.installationId!==t.installation.installationId),t.installation])}},G=e(x(),1),K=C(),le=[50,100,200,400],ue=e=>e instanceof Error&&e.message.trim()===`Agent Control is disabled.`,de=e=>new Promise(t=>window.setTimeout(t,e));async function fe(e,t=de){for(let n of le)try{return await e()}catch(e){if(!ue(e))throw e;await t(n)}return e()}var q=c(),pe={codex:`Codex`,"claude-code":`Claude Code`,"claude-desktop":`Claude Desktop`,"generic-mcp":`Generic MCP`},me=[{capability:s.externalListProjects,label:`List allowed projects`,description:`Discover only projects inside this integration's scope.`},{capability:s.externalCreateTask,label:`Request tasks`,description:`Submit one task to Ryco's normal approval queue.`},{capability:s.externalReadTask,label:`Read own tasks`,description:`Read or wait only for tasks created by this integration.`},{capability:s.externalReadAutomations,label:`Read automations`,description:`Read bounded schedules and run outcomes inside the selected project scope.`},{capability:s.externalManageAutomations,label:`Request automations`,description:`Propose schedule changes; each due run still requires separate approval.`},{capability:s.externalReadActivity,label:`Read activity`,description:`Read bounded payload-free project and provider event summaries.`},{capability:s.externalReadDiagnostics,label:`Read diagnostics`,description:`Read redacted count-only health summaries for allowed projects.`},{capability:s.externalSharedCheckout,label:`Request shared checkout`,description:`May request the local checkout; each request still needs approval.`},{capability:s.externalFullAccess,label:`Request full access`,description:`May request a full-access runtime; each request still needs approval.`}],J=()=>({displayName:``,clientKind:`codex`,scopeKind:`all`,projectIds:``,capabilities:[s.externalListProjects,s.externalCreateTask,s.externalReadTask],expiresAt:``,rateLimitPerMinute:`60`,activeTaskLimit:`1`});function Y(e,t){d.add(I({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function he(e,t){return[e,...t.map(e=>JSON.stringify(e))].join(` `)}function X(e){return e===null?`Never`:new Date(e).toLocaleString()}function ge(e){let t=e.integration;return t.revokedAt===null?t.expiresAt!==null&&Date.parse(t.expiresAt)<=Date.now()?{label:`Expired`,variant:`error`}:t.pairingState===`paired`?{label:`Paired`,variant:`success`}:t.pairingState===`pending`?{label:`Pairing`,variant:`warning`}:{label:`Unpaired`,variant:`outline`}:{label:`Revoked`,variant:`error`}}function _e(e){let t=e.integration;return{displayName:t.displayName,clientKind:t.clientKind,scopeKind:t.projectScope.kind,projectIds:t.projectScope.kind===`selected`?t.projectScope.projectIds.join(`, `):``,capabilities:t.capabilities,expiresAt:t.expiresAt===null?``:new Date(t.expiresAt).toISOString().slice(0,16),rateLimitPerMinute:String(t.rateLimitPerMinute),activeTaskLimit:String(t.activeTaskLimit)}}function Z(e){let t=e.projectIds.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>a.make(e)),n=e.scopeKind===`all`?{kind:`all`}:{kind:`selected`,projectIds:t},r=Number(e.rateLimitPerMinute),i=Number(e.activeTaskLimit);if(!e.displayName.trim())throw Error(`A display name is required.`);if(e.scopeKind===`selected`&&t.length===0)throw Error(`Enter at least one project ID for selected-project scope.`);if(!Number.isInteger(r)||r<1)throw Error(`Rate limit must be a positive whole number.`);if(!Number.isInteger(i)||i<1)throw Error(`Active-task limit must be a positive whole number.`);return{displayName:e.displayName.trim(),clientKind:e.clientKind,projectScope:n,capabilities:e.capabilities,expiresAt:e.expiresAt?new Date(e.expiresAt).toISOString():null,rateLimitPerMinute:r,activeTaskLimit:i}}function ve(e){let t=(0,K.c)(85),{form:n,onChange:r,clientLocked:i}=e,a=i!==void 0&&i,o;t[0]!==n||t[1]!==r?(o=e=>r({...n,displayName:e.target.value}),t[0]=n,t[1]=r,t[2]=o):o=t[2];let s;t[3]!==n.displayName||t[4]!==o?(s=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Display name`,(0,q.jsx)(L,{value:n.displayName,placeholder:`Local Codex`,onChange:o})]}),t[3]=n.displayName,t[4]=o,t[5]=s):s=t[5];let c=n.clientKind,l;t[6]!==n||t[7]!==r?(l=e=>r({...n,clientKind:e.target.value}),t[6]=n,t[7]=r,t[8]=l):l=t[8];let u;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(u=Object.entries(pe).map(ye),t[9]=u):u=t[9];let d;t[10]!==a||t[11]!==n.clientKind||t[12]!==l?(d=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Client`,(0,q.jsx)(`select`,{className:`h-9 rounded-lg border border-input bg-background px-3 text-sm`,value:c,disabled:a,onChange:l,children:u})]}),t[10]=a,t[11]=n.clientKind,t[12]=l,t[13]=d):d=t[13];let f;t[14]!==s||t[15]!==d?(f=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[s,d]}),t[14]=s,t[15]=d,t[16]=f):f=t[16];let p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Project scope`}),t[17]=p):p=t[17];let m=n.scopeKind===`all`,h;t[18]!==n||t[19]!==r?(h=()=>r({...n,scopeKind:`all`}),t[18]=n,t[19]=r,t[20]=h):h=t[20];let g;t[21]!==m||t[22]!==h?(g=(0,q.jsx)(`input`,{type:`radio`,checked:m,onChange:h}),t[21]=m,t[22]=h,t[23]=g):g=t[23];let _;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,q.jsxs)(`span`,{children:[`All current and future projects`,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`The client can discover every project on this local Ryco instance.`})]}),t[24]=_):_=t[24];let v;t[25]===g?v=t[26]:(v=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[g,_]}),t[25]=g,t[26]=v);let y=n.scopeKind===`selected`,b;t[27]!==n||t[28]!==r?(b=()=>r({...n,scopeKind:`selected`}),t[27]=n,t[28]=r,t[29]=b):b=t[29];let x;t[30]!==y||t[31]!==b?(x=(0,q.jsx)(`input`,{type:`radio`,checked:y,onChange:b}),t[30]=y,t[31]=b,t[32]=x):x=t[32];let S=n.scopeKind!==`selected`,C;t[33]!==n||t[34]!==r?(C=e=>r({...n,projectIds:e.target.value}),t[33]=n,t[34]=r,t[35]=C):C=t[35];let w;t[36]!==n.projectIds||t[37]!==S||t[38]!==C?(w=(0,q.jsx)(L,{className:`mt-1.5`,value:n.projectIds,disabled:S,placeholder:`project-id-1, project-id-2`,"aria-label":`Selected project IDs`,onChange:C}),t[36]=n.projectIds,t[37]=S,t[38]=C,t[39]=w):w=t[39];let T;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,q.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:`Comma-separated stable project IDs. Unknown IDs remain inaccessible.`}),t[40]=T):T=t[40];let E;t[41]===w?E=t[42]:(E=(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[`Selected projects`,w,T]}),t[41]=w,t[42]=E);let D;t[43]!==x||t[44]!==E?(D=(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[x,E]}),t[43]=x,t[44]=E,t[45]=D):D=t[45];let O;t[46]!==v||t[47]!==D?(O=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[p,v,D]}),t[46]=v,t[47]=D,t[48]=O):O=t[48];let k;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,q.jsx)(`legend`,{className:`text-xs font-medium`,children:`Capability grants`}),t[49]=k):k=t[49];let A;t[50]!==n||t[51]!==r?(A=me.map(e=>(0,q.jsxs)(`label`,{className:`flex items-start gap-2 text-sm`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:n.capabilities.includes(e.capability),onChange:t=>r({...n,capabilities:t.target.checked?[...n.capabilities,e.capability]:n.capabilities.filter(t=>t!==e.capability)})}),(0,q.jsxs)(`span`,{children:[e.label,(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:e.description})]})]},e.capability)),t[50]=n,t[51]=r,t[52]=A):A=t[52];let j;t[53]===A?j=t[54]:(j=(0,q.jsxs)(`fieldset`,{className:`grid gap-2`,children:[k,A]}),t[53]=A,t[54]=j);let M;t[55]!==n||t[56]!==r?(M=e=>r({...n,expiresAt:e.target.value}),t[55]=n,t[56]=r,t[57]=M):M=t[57];let N;t[58]!==n.expiresAt||t[59]!==M?(N=(0,q.jsx)(L,{type:`datetime-local`,value:n.expiresAt,onChange:M}),t[58]=n.expiresAt,t[59]=M,t[60]=N):N=t[60];let P;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,q.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`Empty means no expiry.`}),t[61]=P):P=t[61];let F;t[62]===N?F=t[63]:(F=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Expires`,N,P]}),t[62]=N,t[63]=F);let I;t[64]!==n||t[65]!==r?(I=e=>r({...n,rateLimitPerMinute:e.target.value}),t[64]=n,t[65]=r,t[66]=I):I=t[66];let R;t[67]!==n.rateLimitPerMinute||t[68]!==I?(R=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Requests per minute`,(0,q.jsx)(L,{type:`number`,min:1,max:600,value:n.rateLimitPerMinute,onChange:I})]}),t[67]=n.rateLimitPerMinute,t[68]=I,t[69]=R):R=t[69];let z;t[70]!==n||t[71]!==r?(z=e=>r({...n,activeTaskLimit:e.target.value}),t[70]=n,t[71]=r,t[72]=z):z=t[72];let B;t[73]!==n.activeTaskLimit||t[74]!==z?(B=(0,q.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium`,children:[`Concurrent active tasks`,(0,q.jsx)(L,{type:`number`,min:1,max:32,value:n.activeTaskLimit,onChange:z})]}),t[73]=n.activeTaskLimit,t[74]=z,t[75]=B):B=t[75];let V;t[76]!==F||t[77]!==R||t[78]!==B?(V=(0,q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[F,R,B]}),t[76]=F,t[77]=R,t[78]=B,t[79]=V):V=t[79];let H;return t[80]!==O||t[81]!==j||t[82]!==V||t[83]!==f?(H=(0,q.jsxs)(`div`,{className:`grid gap-4`,children:[f,O,j,V]}),t[80]=O,t[81]=j,t[82]=V,t[83]=f,t[84]=H):H=t[84],H}function ye(e){let[t,n]=e;return(0,q.jsx)(`option`,{value:t,children:n},t)}function be(){let e=f(),t=r(),n=e?.environmentId??t,[i,a]=(0,G.useState)(ne),[o,s]=(0,G.useState)(J),[c,l]=(0,G.useState)(!1),[u,d]=(0,G.useState)(null),[m,h]=(0,G.useState)(null),[g,v]=(0,G.useState)(null),b=(0,G.useMemo)(()=>n===null?void 0:y(n)?.agentControl,[n]),x=(0,G.useCallback)(async()=>{if(b)try{let e=await fe(()=>b.listIntegrations());a(t=>re(t,e))}catch(e){Y(`Failed to load external integrations`,e)}},[b]);(0,G.useEffect)(()=>{x()},[x]);let S=(0,G.useCallback)(async(e,t)=>{await navigator.clipboard.writeText(t),v(e),window.setTimeout(()=>v(t=>t===e?null:t),1500)},[]),C=async()=>{if(b)try{h(`new`);let e=await b.createIntegration(Z(o));a(t=>ie(t,e)),s(J()),l(!1)}catch(e){Y(`Failed to create integration`,e)}finally{h(null)}},T=async e=>{if(b)try{h(e.integration.integrationId);let t=Z(o);await b.updateIntegration({integrationId:e.integration.integrationId,...t}),d(null),await x()}catch(e){Y(`Failed to update integration`,e)}finally{h(null)}},D=async e=>{if(!b)return;let t=e.integration.integrationId;try{h(t);let e=await b.resumeIntegrationPairing({integrationId:t});a(t=>ie(t,e))}catch(e){Y(`Failed to resume pairing`,e)}finally{h(null)}},O=async e=>{if(!b)return;let t=e.integration.integrationId;try{h(t),await b.revokeIntegration({integrationId:t}),await x()}catch(e){Y(`Failed to revoke integration`,e)}finally{h(null)}},k=async e=>{if(!b)return;let t=e.integration.integrationId;if(window.confirm(`Delete ${e.integration.displayName}? This cannot be undone.`))try{h(t),(await b.deleteIntegration({integrationId:t})).deleted&&a(e=>ae(e,t))}catch(e){Y(`Failed to delete integration`,e)}finally{h(null)}};return(0,q.jsx)(`section`,{"data-testid":`external-integrations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-5`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(N,{className:`size-3.5`}),`Agent Control`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`External integrations`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Pair a local MCP client with a revocable identity. Every task request waits in Ryco for explicit user approval before a thread is created.`})]}),(0,q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,q.jsx)(p,{size:`icon`,variant:`outline`,"aria-label":`Refresh integrations`,onClick:()=>void x(),children:(0,q.jsx)(j,{})}),(0,q.jsxs)(p,{disabled:!b||!i.topology.available,onClick:()=>{d(null),s(J()),l(e=>!e)},children:[(0,q.jsx)(z,{}),`New integration`]})]})]}),i.topology.available?null:(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(te,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local pairing is unavailable`}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[i.topology.reason??`Ryco could not prove a direct loopback-only topology.`,` `,`External setup fails closed while Ryco is remotely exposed or Hub-connected.`]})]})]}),c?(0,q.jsxs)(`div`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsx)(ve,{form:o,onChange:s}),(0,q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,q.jsx)(p,{variant:`ghost`,onClick:()=>l(!1),children:`Cancel`}),(0,q.jsxs)(p,{disabled:m===`new`,onClick:()=>void C(),children:[(0,q.jsx)(A,{}),`Create and pair`]})]})]}):null,i.integrations.length===0&&!c?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-6 text-center text-sm text-muted-foreground`,children:`No external integrations are configured.`}):null,i.integrations.map(e=>{let t=e.integration,n=ge(e),r=i.pairingCodes[t.integrationId],a=he(e.setup.pairCommand.command,e.setup.pairCommand.args),c=u===t.integrationId;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`font-semibold`,children:t.displayName}),(0,q.jsx)(w,{variant:n.variant,children:n.label}),(0,q.jsx)(w,{variant:`outline`,children:pe[t.clientKind]})]}),(0,q.jsx)(`p`,{className:`mt-1 font-mono text-[11px] text-muted-foreground`,children:t.integrationId})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,q.jsx)(p,{size:`sm`,variant:`outline`,onClick:()=>{d(c?null:t.integrationId),s(_e(e))},children:c?`Close editor`:`Edit`}),(0,q.jsxs)(p,{size:`sm`,variant:`outline`,disabled:!i.topology.available||m===t.integrationId||t.revokedAt!==null,onClick:()=>void D(e),children:[(0,q.jsx)(A,{}),`Pair again`]}),(0,q.jsx)(p,{size:`sm`,variant:`outline`,disabled:m===t.integrationId||t.revokedAt!==null,onClick:()=>void O(e),children:`Revoke`}),(0,q.jsx)(p,{size:`icon-sm`,variant:`ghost`,"aria-label":`Delete ${t.displayName}`,disabled:m===t.integrationId,onClick:()=>void k(e),children:(0,q.jsx)(E,{})})]})]}),c?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(ve,{form:o,onChange:s}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(p,{disabled:m===t.integrationId,onClick:()=>void T(e),children:[(0,q.jsx)(M,{}),`Save changes`]})})]}):(0,q.jsxs)(`div`,{className:`grid gap-3 text-xs sm:grid-cols-2`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Project scope`}),(0,q.jsx)(`p`,{className:`mt-0.5 break-words font-medium`,children:t.projectScope.kind===`all`?`All current and future projects`:t.projectScope.projectIds.join(`, `)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Limits`}),(0,q.jsxs)(`p`,{className:`mt-0.5 font-medium`,children:[t.rateLimitPerMinute,`/minute · `,t.activeTaskCount,`/`,t.activeTaskLimit,` active`]})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Expiry`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.expiresAt)})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Last used`}),(0,q.jsx)(`p`,{className:`mt-0.5 font-medium`,children:X(t.lastUsedAt)})]}),(0,q.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,q.jsx)(`span`,{className:`text-muted-foreground`,children:`Capabilities`}),(0,q.jsx)(`div`,{className:`mt-1 flex flex-wrap gap-1`,children:t.capabilities.map(e=>(0,q.jsx)(w,{variant:`outline`,children:e},e))})]})]}),t.pairingState===`pending`?(0,q.jsxs)(`div`,{className:`grid gap-3 rounded-lg border bg-muted/20 p-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:`Finish pairing locally`}),(0,q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Pairing code expires `,X(t.pairingCodeExpiresAt),`. The code is shown only for this ceremony; the generated MCP configuration never contains it.`]})]}),r?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`code`,{"data-testid":`external-pairing-code`,className:`rounded bg-background px-3 py-2 font-mono text-sm tracking-[0.18em]`,children:r}),(0,q.jsxs)(p,{size:`sm`,variant:`outline`,onClick:()=>void S(`code-${t.integrationId}`,r),children:[g===`code-${t.integrationId}`?(0,q.jsx)(_,{}):(0,q.jsx)(U,{}),`Copy code`]})]}):(0,q.jsx)(`p`,{className:`text-xs text-warning-foreground`,children:`The pairing code is no longer displayed. Choose Pair again to generate a new one.`}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`Run this bridge command, then enter the code`}),(0,q.jsxs)(`div`,{className:`flex min-w-0 gap-2`,children:[(0,q.jsx)(`code`,{className:`min-w-0 flex-1 overflow-x-auto rounded bg-background p-2 text-[11px]`,children:a}),(0,q.jsx)(p,{size:`icon-sm`,variant:`outline`,"aria-label":`Copy pairing command`,onClick:()=>void S(`pair-${t.integrationId}`,a),children:g===`pair-${t.integrationId}`?(0,q.jsx)(_,{}):(0,q.jsx)(U,{})})]})]}),(0,q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,q.jsx)(`span`,{className:`text-xs font-medium`,children:`MCP configuration`}),(0,q.jsx)(`pre`,{"data-testid":`external-mcp-configuration`,className:`max-h-48 overflow-auto rounded bg-background p-3 text-[11px] leading-relaxed`,children:e.setup.configuration}),(0,q.jsxs)(p,{className:`justify-self-start`,size:`sm`,variant:`outline`,onClick:()=>void S(`config-${t.integrationId}`,e.setup.configuration),children:[g===`config-${t.integrationId}`?(0,q.jsx)(_,{}):(0,q.jsx)(U,{}),`Copy configuration`]})]})]}):null]},t.integrationId)})]})})}var xe=[],Se=[];function Ce(e){return e.displayName??R(e.driver)?.label??l(e.driver)}function Q(e){return e.providerDisplayName??R(e.driver)?.label??l(e.driver)}function we(e){return e.driver===`codex`?`codex`:e.driver===`claudeAgent`?`claude-code`:`generic-mcp`}function Te(e){return{...J(),displayName:`${Q(e)} Agent Control`,clientKind:we(e)}}function Ee(e,t){return e.filter(e=>e.workspaceId===t).toSorted((e,t)=>t.updatedAt.localeCompare(e.updatedAt))[0]}function De(e){if(!e)return{label:`Not connected`,variant:`outline`};switch(e.state){case`connected`:return{label:`Connected`,variant:`success`};case`repair-needed`:return{label:`Needs repair`,variant:`error`};case`disconnected`:case`revoked`:return{label:`Disconnected`,variant:`outline`};case`disconnecting`:return{label:`Disconnecting`,variant:`warning`};case`planned`:case`credential-written`:case`provider-written`:case`verifying`:return{label:`Connecting`,variant:`warning`}}}function Oe(e,t){d.add(I({type:`success`,title:e,description:t}))}function $(e,t){d.add(I({type:`error`,title:e,description:t instanceof Error?t.message:`The request failed.`}))}function ke(){let e=f(),t=r(),n=e?.environmentId??t,[i,a]=(0,G.useState)(xe),[o,s]=(0,G.useState)(Se),[c,l]=(0,G.useState)(oe),[u,d]=(0,G.useState)(null),[m,h]=(0,G.useState)(!0),[g,_]=(0,G.useState)(null),[x,S]=(0,G.useState)(null),[C,E]=(0,G.useState)(J),O=(0,G.useMemo)(()=>n===null?void 0:y(n),[n]),k=O?.agentControl,A=O?.mcp,M=(0,G.useCallback)(async()=>{if(!k||!A){h(!1);return}try{let[e,t,n]=await fe(()=>Promise.all([A.listWorkspaces(),k.listMcpInstallations(),k.listIntegrations()]));a(e.providers),s(e.workspaces),l(e=>ce(e,t)),d(n.topology)}catch(e){$(`Failed to load Agent Control providers`,e)}finally{h(!1)}},[k,A]);(0,G.useEffect)(()=>{M()},[M]);let N=async(e,t)=>{if(k)try{_(e.id);let n=t?(()=>{let{clientKind:t,...n}=Z(C);return{workspaceId:e.id,...n}})():{workspaceId:e.id},r=await k.connectMcpInstallation(n);l(e=>W(e,r)),S(null),Oe(`${Q(e)} connected`,`The credential was stored locally and was not shown to the browser.`)}catch(t){$(`Failed to connect ${Q(e)}`,t),await M()}finally{_(null)}},I=async(e,t)=>{if(k)try{_(e.id);let n=await k.repairMcpInstallation({installationId:t.installationId});l(e=>W(e,n)),Oe(`${Q(e)} repaired`)}catch(t){$(`Failed to repair ${Q(e)}`,t),await M()}finally{_(null)}},L=async(e,t)=>{if(k&&window.confirm(`Disconnect Agent Control from ${Q(e)}?`))try{_(e.id);let n=await k.disconnectMcpInstallation({installationId:t.installationId});l(e=>W(e,n)),Oe(`${Q(e)} disconnected`)}catch(t){$(`Failed to disconnect ${Q(e)}`,t),await M()}finally{_(null)}},z=o.filter(e=>e.capabilities.externalAgentControl===`available`);return(0,q.jsx)(`section`,{"data-testid":`agent-control-mcp-installations`,className:`border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto grid w-full max-w-4xl gap-8`,children:[(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(T,{className:`size-3.5`}),`Ryco sessions`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Automatic inside Ryco`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Supported sessions started by Ryco receive Agent Control automatically. There is nothing to install in those provider profiles.`})]}),m?(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl border p-4 text-sm text-muted-foreground`,children:[(0,q.jsx)(D,{className:`size-4 animate-spin`}),` Loading providers…`]}):i.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No configured provider instances were found.`}):(0,q.jsx)(`div`,{className:`divide-y overflow-hidden rounded-xl border bg-card`,children:i.map(e=>{let t=R(e.driver)?.icon??T,n=e.enabled&&e.capabilities.automaticAgentControl===`available`;return(0,q.jsxs)(`div`,{className:`flex items-start justify-between gap-4 px-4 py-3`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(t,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-sm font-medium`,children:Ce(e)}),(0,q.jsx)(`p`,{className:`mt-0.5 font-mono text-[11px] text-muted-foreground`,children:e.instanceId}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:n?`Available in every new Ryco-managed session.`:e.enabled?`This provider does not expose automatic Agent Control yet.`:`This provider instance is disabled.`})]})]}),(0,q.jsx)(w,{variant:n?`success`:`outline`,children:n?`Automatic`:e.enabled?`Unavailable`:`Disabled`})]},e.instanceId)})})]}),(0,q.jsxs)(`section`,{className:`grid gap-4`,children:[(0,q.jsxs)(`header`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:[(0,q.jsx)(V,{className:`size-3.5`}),`External agents`]}),(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Connect an installed provider`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco detects local provider profiles and writes their native MCP configuration. The default grants project listing and task request/read access, limited to 60 requests per minute and one active task. Every task still requires approval.`})]}),(0,q.jsx)(p,{size:`icon`,variant:`outline`,"aria-label":`Refresh Agent Control providers`,disabled:m,onClick:()=>void M(),children:(0,q.jsx)(j,{})})]}),u&&!u.available?(0,q.jsxs)(`div`,{className:`flex gap-3 rounded-xl border border-warning/30 bg-warning/8 p-4 text-sm`,children:[(0,q.jsx)(v,{className:`mt-0.5 size-4 shrink-0 text-warning-foreground`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`p`,{className:`font-medium`,children:`Local installation is unavailable`}),(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:u.reason??`Ryco could not prove a direct loopback-only topology.`})]})]}):null,!m&&(!k||!A)?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`This Ryco environment does not expose provider MCP installation yet.`}):!m&&z.length===0?(0,q.jsx)(`div`,{className:`rounded-xl border border-dashed p-4 text-sm text-muted-foreground`,children:`No installable provider profiles were detected. Configure a supported provider instance first, then refresh.`}):(0,q.jsx)(`div`,{className:`grid gap-3`,children:z.map(e=>{let t=Ee(c.installations,e.id),n=De(t),r=t?.state===`connected`,i=t?.state===`repair-needed`,a=g===e.id,o=x===e.id,s=R(e.driver)?.icon??V;return(0,q.jsxs)(`article`,{className:`grid gap-4 rounded-xl border bg-card p-4`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[(0,q.jsx)(`div`,{className:`mt-0.5 flex size-9 shrink-0 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(s,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold`,children:Q(e)}),(0,q.jsx)(w,{variant:n.variant,children:n.label})]}),(0,q.jsx)(`p`,{className:`mt-1 truncate font-mono text-[11px] text-muted-foreground`,children:e.displayPath}),(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:[e.providerInstances.length,` configured provider`,e.providerInstances.length===1?` instance`:` instances`,t?` · MCP name ${t.serverName}`:``]})]})]}),(0,q.jsx)(`div`,{className:`flex shrink-0 flex-wrap gap-2 sm:justify-end`,children:i&&t?(0,q.jsxs)(p,{size:`sm`,disabled:a||u?.available===!1,onClick:()=>void I(e,t),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(F,{}),`Repair`]}):r&&t?(0,q.jsxs)(p,{size:`sm`,variant:`outline`,disabled:a,onClick:()=>void L(e,t),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(P,{}),`Disconnect`]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(p,{size:`sm`,variant:`outline`,disabled:a||u?.available===!1,onClick:()=>{o?S(null):(E(Te(e)),S(e.id))},children:o?`Close`:`Customize`}),(0,q.jsxs)(p,{size:`sm`,disabled:a||u?.available===!1,onClick:()=>void N(e,!1),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(b,{}),`Connect`]})]})})]}),t?.lastError?(0,q.jsx)(`div`,{className:`rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-xs text-destructive`,children:t.lastError}):null,t?.preservedUserChanges?(0,q.jsx)(`div`,{className:`rounded-lg border border-warning/30 bg-warning/8 p-3 text-xs text-warning-foreground`,children:`Ryco left this provider's MCP entry untouched because it had been edited after installation.`}):null,o?(0,q.jsxs)(`div`,{className:`grid gap-4 border-t pt-4`,children:[(0,q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Customize the credential scope and limits before Ryco installs it. The provider profile is fixed to this detected workspace.`}),(0,q.jsx)(ve,{form:C,onChange:E,clientLocked:!0}),(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(p,{disabled:a||u?.available===!1,onClick:()=>void N(e,!0),children:[a?(0,q.jsx)(D,{className:`animate-spin`}):(0,q.jsx)(V,{}),`Connect with these permissions`]})})]}):null]},e.id)})})]})]})})}var Ae=(0,G.lazy)(()=>t(()=>import(`./ComputerUseSettings-Cq8Pi0ZU.js`).then(e=>({default:e.ComputerUseSettings})),__vite__mapDeps([0])));function je(){let e=(0,K.c)(15),t=h(),r=f(),a;e[0]===r?.primary?a=e[1]:(a=n&&!i()&&r?.primary===!0,e[0]=r?.primary,e[1]=a);let o=a,s=!!window.desktopBridge?.computerUse&&(t!==`node`||o),c;e[2]===t?c=e[3]:(c=t!==`client`&&(0,q.jsx)(Me,{}),e[2]=t,e[3]=c);let l;e[4]!==o||e[5]!==t||e[6]!==r?(l=t===`node`&&r&&!o&&(0,q.jsxs)(`section`,{className:`border-b p-6 sm:p-8`,"data-settings-section":`Device permissions`,children:[(0,q.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Device permissions`}),(0,q.jsxs)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:[`To enable screen recording, accessibility, or computer use on `,r.nodeLabel,`, open Ryco on `,r.nodeLabel,` and use Settings → Integrations. Operating system permissions must be approved on that device.`]})]}),e[4]=o,e[5]=t,e[6]=r,e[7]=l):l=e[7];let u;e[8]!==s||e[9]!==t?(u=s&&(0,q.jsx)(`div`,{"data-settings-section":t===`node`?`Device permissions`:void 0,children:(0,q.jsx)(G.Suspense,{fallback:(0,q.jsx)(`p`,{className:`p-6`,children:`Loading device integrations…`}),children:(0,q.jsx)(Ae,{})})}),e[8]=s,e[9]=t,e[10]=u):u=e[10];let d;return e[11]!==c||e[12]!==l||e[13]!==u?(d=(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[c,l,u]}),e[11]=c,e[12]=l,e[13]=u,e[14]=d):d=e[14],d}function Me(){let e=(0,K.c)(25),t=m(Ne),{updateSettings:n}=u(),r=k(o.serverUpdateSettings),i,a,s;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,q.jsx)(`div`,{className:`text-[11px] font-semibold uppercase tracking-[0.08em] text-muted-foreground`,children:`Private Agent Control`}),a=(0,q.jsx)(`h2`,{className:`mt-1 text-lg font-semibold tracking-[-0.01em]`,children:`Private tools for every agent`}),s=(0,q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-muted-foreground/80`,children:`Ryco sessions receive the tools automatically. Connect supported standalone provider profiles with one click. Routine private-session actions run directly. Destructive and security-sensitive changes require approval.`}),e[0]=i,e[1]=a,e[2]=s):(i=e[0],a=e[1],s=e[2]);let c=t?`Enabled. New Ryco-managed sessions receive Agent Control without changing the provider's global MCP configuration.`:`Disabled. Agent Control is unavailable to Ryco sessions and external clients.`,l;e[3]===c?l=e[4]:(l=(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-muted-foreground`,children:c}),e[3]=c,e[4]=l);let d;e[5]!==r.allowed||e[6]!==r.reason?(d=!r.allowed&&r.reason?(0,q.jsx)(`p`,{className:`mt-2 max-w-2xl text-xs leading-relaxed text-destructive`,children:r.reason}):null,e[5]=r.allowed,e[6]=r.reason,e[7]=d):d=e[7];let f;e[8]!==l||e[9]!==d?(f=(0,q.jsxs)(`div`,{children:[i,a,s,l,d]}),e[8]=l,e[9]=d,e[10]=f):f=e[10];let p=!r.allowed,h;e[11]===n?h=e[12]:(h=e=>n({agentControl:{enabled:!!e}}),e[11]=n,e[12]=h);let g;e[13]!==t||e[14]!==p||e[15]!==h?(g=(0,q.jsx)(S,{checked:t,disabled:p,onCheckedChange:h,"aria-label":`Enable Agent Control`}),e[13]=t,e[14]=p,e[15]=h,e[16]=g):g=e[16];let _;e[17]!==f||e[18]!==g?(_=(0,q.jsx)(`section`,{"data-settings-section":`Private Agent Control`,className:`scroll-mt-6 border-b bg-muted/10 p-6 sm:p-8`,children:(0,q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-4xl flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[f,g]})}),e[17]=f,e[18]=g,e[19]=_):_=e[19];let v;e[20]===t?v=e[21]:(v=t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(ke,{}),(0,q.jsxs)(`details`,{className:`group border-b bg-muted/5`,children:[(0,q.jsxs)(`summary`,{className:`mx-auto flex w-full max-w-4xl cursor-pointer list-none items-center gap-3 px-6 py-5 sm:px-8 [&::-webkit-details-marker]:hidden`,children:[(0,q.jsx)(`span`,{className:`flex size-8 items-center justify-center rounded-lg border bg-background`,children:(0,q.jsx)(A,{className:`size-4 text-muted-foreground`})}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-sm font-semibold`,children:`Advanced manual setup`}),(0,q.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:`Create a revocable pairing for another MCP client or a profile Ryco cannot detect.`})]}),(0,q.jsx)(O,{className:`size-4 text-muted-foreground transition-transform group-open:rotate-90`})]}),(0,q.jsx)(be,{})]})]}):null,e[20]=t,e[21]=v);let y;return e[22]!==_||e[23]!==v?(y=(0,q.jsxs)(`div`,{className:`flex-1 overflow-y-auto`,children:[_,v]}),e[22]=_,e[23]=v,e[24]=y):y=e[24],y}function Ne(e){return e.agentControl.enabled}export{je as IntegrationsSettingsPanel};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Tt as t}from"./primary-CQh_KHGG.js";import{$l as n,Bl as r,Bn as i,Dn as a,Kr as o,Ql as s,Qr as c,Vl as l,Wl as u,ao as d,ei as f,hr as p,oo as m,sr as h,ti as g}from"./runtime-OM-uAtaj.js";import{t as _}from"./react-CwJFpaho.js";import{Ft as v,Pt as y,Ut as b,jt as x,mr as S}from"./switch-D9inWKdd.js";import{t as C}from"./compiler-runtime-C4g8XhC5.js";import{i as w,n as T,t as E}from"./tooltip-mwOCSCXF.js";import{d as ee}from"./SettingsPanels-BYknk6GO.js";import{a as D,r as O}from"./editorPreferences-DVhg0CXd.js";import{t as k}from"./toastHelpers-CSQRKo4F.js";import{t as A}from"./shallow-B--PNURq.js";import{t as j}from"./input-CzU08wbL.js";import{i as M,n as N,r as P}from"./settingsLayout-BbjDM-p0.js";import{ut as F}from"./main-RFllWEko.js";var I=e(_(),1),L=C(),R={terminal:{id:`terminal`,label:`Terminal`,sortWeight:10},workspace:{id:`workspace`,label:`Workspace`,sortWeight:20},diff:{id:`diff`,label:`Diff`,sortWeight:30},commandPalette:{id:`commandPalette`,label:`Command palette`,sortWeight:40},sidebar:{id:`sidebar`,label:`Sidebar`,sortWeight:50},chat:{id:`chat`,label:`Chat`,sortWeight:60},composer:{id:`composer`,label:`Composer`,sortWeight:70},editor:{id:`editor`,label:`Editor`,sortWeight:80},modelPicker:{id:`modelPicker`,label:`Model picker`,sortWeight:90},thread:{id:`thread`,label:`Threads`,sortWeight:100},script:{id:`script`,label:`Project scripts`,sortWeight:110}},z={"terminal.toggle":{title:`Toggle terminal drawer`,sortWeight:1},"terminal.split":{title:`Split terminal`,sortWeight:2},"terminal.new":{title:`New terminal`,sortWeight:3},"terminal.close":{title:`Close terminal`,sortWeight:4},"workspace.files":{title:`Open workspace files`,sortWeight:1},"workspace.review":{title:`Open workspace review`,sortWeight:2},"workspace.terminal":{title:`Open workspace terminal`,sortWeight:3},"workspace.simulator":{title:`Open iOS Simulator workspace`,sortWeight:4},"diff.toggle":{title:`Toggle diff view`,sortWeight:1},"commandPalette.toggle":{title:`Open command palette`,sortWeight:1},"sidebar.showInbox":{title:`Show Inbox sidebar`,sortWeight:1},"sidebar.showProjects":{title:`Show Projects sidebar`,sortWeight:2},"chat.new":{title:`New chat`,sortWeight:1},"chat.newLocal":{title:`New chat (local environment)`,sortWeight:2},"composer.stash":{title:`Stash prompt or open stash`,sortWeight:1},"editor.openFavorite":{title:`Open in preferred editor`,sortWeight:1},"modelPicker.toggle":{title:`Toggle model picker`,sortWeight:1},"modelPicker.jump.1":{title:`Pick model 1`,sortWeight:2},"modelPicker.jump.2":{title:`Pick model 2`,sortWeight:3},"modelPicker.jump.3":{title:`Pick model 3`,sortWeight:4},"modelPicker.jump.4":{title:`Pick model 4`,sortWeight:5},"modelPicker.jump.5":{title:`Pick model 5`,sortWeight:6},"modelPicker.jump.6":{title:`Pick model 6`,sortWeight:7},"modelPicker.jump.7":{title:`Pick model 7`,sortWeight:8},"modelPicker.jump.8":{title:`Pick model 8`,sortWeight:9},"modelPicker.jump.9":{title:`Pick model 9`,sortWeight:10},"thread.find":{title:`Find in current thread`,sortWeight:1},"thread.pinToggle":{title:`Pin or unpin current thread`,sortWeight:2},"thread.previous":{title:`Previous thread`,sortWeight:3},"thread.next":{title:`Next thread`,sortWeight:4},"thread.jump.1":{title:`Jump to thread 1`,sortWeight:5},"thread.jump.2":{title:`Jump to thread 2`,sortWeight:6},"thread.jump.3":{title:`Jump to thread 3`,sortWeight:7},"thread.jump.4":{title:`Jump to thread 4`,sortWeight:8},"thread.jump.5":{title:`Jump to thread 5`,sortWeight:9},"thread.jump.6":{title:`Jump to thread 6`,sortWeight:10},"thread.jump.7":{title:`Jump to thread 7`,sortWeight:11},"thread.jump.8":{title:`Jump to thread 8`,sortWeight:12},"thread.jump.9":{title:`Jump to thread 9`,sortWeight:13}};function B(e){let t=e.indexOf(`.`),n=t===-1?e:e.slice(0,t);return n===`script`?R.script:R[n]??R.script}function V(e,t){let n=B(e),r=z[e];if(r)return{category:n,title:r.title,sortWeight:r.sortWeight};let i=e.match(/^script\.([a-z0-9][a-z0-9-]*)\.run$/)?.[1]??e;return{category:n,title:t??`Run: ${i}`,sortWeight:100}}var H=[{id:`always`,label:`Always`,value:void 0},{id:`terminalFocus`,label:`Terminal focused`,value:`terminalFocus`},{id:`notTerminalFocus`,label:`Not in terminal`,value:`!terminalFocus`},{id:`terminalOpen`,label:`Terminal open`,value:`terminalOpen`},{id:`notTerminalOpen`,label:`Terminal not open`,value:`!terminalOpen`},{id:`modelPickerOpen`,label:`Model picker open`,value:`modelPickerOpen`},{id:`commandPaletteOpen`,label:`Command palette open`,value:`commandPaletteOpen`},{id:`composerFocus`,label:`Composer focused`,value:`composerFocus`},{id:`notComposerFocus`,label:`Not in composer`,value:`!composerFocus`}],U=new Map(H.map(e=>[e.value,e])),W=new Map(H.map(e=>[e.value===void 0?void 0:e.value.replace(/\s+/g,``),e]));function G(e){return e===void 0?U.get(void 0):U.get(e)||W.get(e.replace(/\s+/g,``))}function K(e){let t=G(e);return t?t.label:e??`Always`}function q(e){if(e)switch(e.type){case`identifier`:return e.name;case`not`:return`!${q(e.node)}`;case`and`:return`(${q(e.left)} && ${q(e.right)})`;case`or`:return`(${q(e.left)} || ${q(e.right)})`}}function te(e,t){return(e===void 0?``:e.replace(/\s+/g,``))===(t===void 0?``:t.replace(/\s+/g,``))}function ne(e,t){let n=e[t];if(!n)return[];let r=[];return e.forEach((e,i)=>{i!==t&&e.command!==n.command&&e.key===n.key&&te(e.when,n.when)&&r.push({key:n.key,otherCommand:e.command,otherWhen:e.when})}),r}function re(e){let t=new Map;return e.forEach((n,r)=>{let i=ne(e,r);if(i.length===0)return;let a=e[r].command,o=t.get(a)??[];o.push(...i),t.set(a,o)}),t}function J(e){return/mac|iphone|ipad|ipod/i.test(e)}var ie=new Set([`control`,`shift`,`alt`,`altgraph`,`meta`,`os`,`hyper`,`super`,`fn`,`capslock`,`numlock`,`scrolllock`]),ae=new Set([`escape`,`tab`,`enter`]);function oe(e,t){let n=e.toLowerCase();if(n===` `||n===`spacebar`)return`space`;if(n===`esc`)return`escape`;if(n===`arrowup`)return`up`;if(n===`arrowdown`)return`down`;if(n===`arrowleft`)return`left`;if(n===`arrowright`)return`right`;if(t){let e=t.match(/^Digit(\d)$/);if(e)return e[1];if(t===`BracketLeft`)return`[`;if(t===`BracketRight`)return`]`}return n}function se(e,t){let n=e.key.toLowerCase();if(ie.has(n))return null;let r=J(t?.platform??(typeof navigator<`u`?navigator.platform:``)),i=r?e.metaKey:e.ctrlKey;if(!(i||e.shiftKey||e.altKey||(r?e.ctrlKey:e.metaKey))&&ae.has(n))return null;let a=oe(e.key,e.code);return a.length===0?null:{key:a,modKey:i,metaKey:!r&&e.metaKey,ctrlKey:r&&e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey}}var ce={mod:`⌘`,meta:`⌘`,cmd:`⌘`,ctrl:`⌃`,control:`⌃`,shift:`⇧`,alt:`⌥`,option:`⌥`},le={mod:`Ctrl`,meta:`Meta`,cmd:`Meta`,ctrl:`Ctrl`,control:`Ctrl`,shift:`Shift`,alt:`Alt`,option:`Alt`},Y={space:`Space`,enter:`Enter`,escape:`Esc`,up:`↑`,down:`↓`,left:`←`,right:`→`,tab:`Tab`,backspace:`⌫`,delete:`Del`};function X(e,t){let n=J(t?.platform??(typeof navigator<`u`?navigator.platform:``))?ce:le,r=[];e.modKey&&r.push(n.mod),e.metaKey&&r.push(n.meta),e.ctrlKey&&r.push(n.ctrl),e.altKey&&r.push(n.alt),e.shiftKey&&r.push(n.shift);let i=Y[e.key]??(e.key.length===1?e.key.toUpperCase():e.key);return r.push(i),r}function ue(e){let t=[];e.modKey&&t.push(`mod`),e.metaKey&&t.push(`meta`),e.ctrlKey&&t.push(`ctrl`),e.altKey&&t.push(`alt`),e.shiftKey&&t.push(`shift`);let n=e.key===` `?`space`:e.key;return t.push(n),t.join(`+`)}var Z=n(),de=[],fe=(()=>{let e=new Map;for(let n of t){let t=`${n.key}|${n.when??``}`,r=e.get(n.command)??new Set;r.add(t),e.set(n.command,r)}return e})(),Q=new Set(t.map(e=>e.command));function pe(e,t){return`${e.command}|${e.key}|${e.when??``}|${t}`}function me(e){return{key:ue(e.shortcut),command:e.command,when:q(e.whenAst)}}function $(e){return e.map((e,t)=>({...me(e),__id:pe(e,t)}))}function he(e){return e.map(({__id:e,...t})=>t)}function ge(e){return t.filter(t=>t.command===e).map(e=>Object.assign({},e))}function _e(e,t){if(!Q.has(e))return`custom`;let n=fe.get(e);if(!n)return`custom`;if(t.length!==n.size)return`modified`;for(let e of t){let t=`${e.key}|${e.when??``}`;if(!n.has(t))return`modified`}return`default`}function ve(e,t,n){return!n||[t.toLowerCase(),e.command.toLowerCase(),e.key.toLowerCase(),K(e.when).toLowerCase()].some(e=>e.includes(n))}function ye(){return Math.random().toString(36).slice(2)}function be(){let e=s(),t=l(),n=u(),d=r(),f=typeof navigator<`u`?navigator.platform:``,_=g(f),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(null),C=!e||e.primary,w=e?h(e.environmentId)?.keybindings:p().keybindings,T=(0,I.useCallback)(()=>{if(!n)return;if(!C){x(`This file lives on ${e?.nodeLabel??`the selected node`} and cannot be opened in a local editor.`);return}x(null),y(!0);let t=O(d??[]);if(!t){x(`No available editors found.`),y(!1);return}p().shell.openInEditor(n,t).catch(e=>{x(e instanceof Error?e.message:`Unable to open keybindings file.`)}).finally(()=>{y(!1)})},[d,C,n,e?.nodeLabel]),E=i(A(a)),F=(0,I.useMemo)(()=>{let e=new Set,t=new Map;for(let n of E)for(let r of n.scripts){let n=`script.${r.id}.run`;e.add(n),t.has(n)||t.set(n,`Run: ${r.name}`)}return{commandList:Array.from(e),titles:t}},[E]),L=t?.keybindings??de,[z,B]=(0,I.useState)(()=>$(L)),[H,U]=(0,I.useState)(()=>JSON.stringify(he($(L)))),W=(0,I.useRef)(!1);(0,I.useEffect)(()=>{let e=JSON.stringify(he($(L)));e!==H&&(U(e),W.current||B($(L)))},[L,H]);let G=(0,I.useCallback)(async e=>{W.current=!0;try{if(!w)throw Error(`Keybinding settings are unavailable on this node.`);await w.replaceCustom({rules:he(e)})}catch(e){o.add(k({type:`error`,title:`Could not save keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),B($(L))}finally{W.current=!1}},[w,L]),K=(0,I.useCallback)((e,t)=>{B(n=>{let r=n.slice(),i=r[e];if(!i)return n;let a=ue(t);return a===i.key?n:(r[e]={...i,key:a,__id:i.__id},G(r),r)})},[G]),q=(0,I.useCallback)(e=>{B(t=>{let n={command:e,key:``,when:void 0,__id:`placeholder-${ye()}`},r=(()=>{let n=-1;return t.forEach((t,r)=>{t.command===e&&(n=r)}),n})();return r===-1?[...t,n]:[...t.slice(0,r+1),n,...t.slice(r+1)]})},[]),te=(0,I.useCallback)(e=>{B(t=>{let n=t.slice();return n.splice(e,1),G(n),n})},[G]),ne=(0,I.useCallback)((e,t)=>{B(n=>{let r=n.slice(),i=r[e];return!i||(i.when??void 0)===t?n:(r[e]={...i,when:t,__id:i.__id},G(r),r)})},[G]),J=(0,I.useCallback)(e=>{B(t=>{let n=t[e];if(!n)return t;let r=n.command;if(!Q.has(r)){let n=t.slice();return n.splice(e,1),G(n),n}let i=ge(r),a=t.filter(e=>e.command!==r);for(let e of i)a.push({...e,__id:`default-${r}-${ye()}`});return G(a),a})},[G]),ie=(0,I.useCallback)(e=>{B(t=>{let n=t.filter(t=>t.command!==e);if(Q.has(e))for(let t of ge(e))n.push({...t,__id:`default-${e}-${ye()}`});return G(n),n})},[G]),ae=(0,I.useCallback)(async()=>{B([]);try{if(!w)throw Error(`Keybinding settings are unavailable on this node.`);await w.replaceCustom({rules:[]})}catch(e){o.add(k({type:`error`,title:`Could not restore default keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),B($(L))}},[w,L]),oe=(0,I.useRef)(new Map),se=(0,I.useCallback)(e=>{let t=oe.current.get(e);t&&(t.scrollIntoView({behavior:`smooth`,block:`center`}),t.dataset.flash=`true`,window.setTimeout(()=>{delete t.dataset.flash},1100))},[]),[ce,le]=(0,I.useState)(``),Y=(0,I.useDeferredValue)(ce.trim().toLowerCase()),X=(0,I.useMemo)(()=>re(z),[z]),fe=(0,I.useMemo)(()=>{let e=new Map;z.forEach((t,n)=>{let r=e.get(t.command);r?r.push(n):e.set(t.command,[n])});let t=new Set([...e.keys(),...Q,...F.commandList]),n=new Map;for(let r of t){let t=e.get(r)??[],i=t.map(e=>z[e]).filter(Boolean),a=V(r,F.titles.get(r)),o=_e(r,i),s={key:``,command:r,when:void 0};if(!(Y.length===0||ve(s,a.title,Y)||i.some(e=>ve(e,a.title,Y))))continue;let c={command:r,title:a.title,indicesInDraft:t,status:o},l=n.get(a.category.id);l?l.push(c):n.set(a.category.id,[c])}let r=[];for(let e of Object.values(R).toSorted((e,t)=>e.sortWeight-t.sortWeight)){let t=n.get(e.id);t&&t.length!==0&&(t.sort((e,t)=>{let n=V(e.command,F.titles.get(e.command)),r=V(t.command,F.titles.get(t.command));return n.sortWeight-r.sortWeight}),r.push({category:e,rows:t}))}return r},[z,Y,F]),pe=fe.reduce((e,t)=>e+t.rows.length,0),me=(0,I.useMemo)(()=>({platform:f,draft:z,conflictsByCommand:X,onRebind:K,onAddBinding:q,onRemoveBinding:te,onChangeWhen:ne,onResetBinding:J,onResetCommand:ie,scrollToCommand:se,rowRefs:oe}),[f,z,X,K,q,te,ne,J,ie,se]),be=t?.issues.filter(e=>e.kind.startsWith(`keybindings.`))??[],Se=(d??[]).length>0;return(0,Z.jsxs)(N,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg bg-accent text-foreground/70`,children:(0,Z.jsx)(ee,{className:`size-4`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Keybindings`}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Click any shortcut and press a new combination to rebind. Press Esc to cancel, Backspace to clear.`})]})]}),(0,Z.jsxs)(c,{variant:`outline`,size:`xs`,onClick:()=>void ae(),disabled:z.length===0,children:[(0,Z.jsx)(D,{className:`size-3.5`}),`Restore defaults`]})]}),(0,Z.jsx)(M,{title:`Configuration file`,children:(0,Z.jsx)(P,{title:`Keybindings file`,description:"Open the persisted `keybindings.json` file to edit advanced bindings directly.",status:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`block break-all font-mono text-[11px] text-foreground`,children:n??`Resolving keybindings path...`}),b?(0,Z.jsx)(`span`,{className:`mt-1 block text-destructive`,children:b}):(0,Z.jsx)(`span`,{className:`mt-1 block`,children:C?Se?`Opens in your preferred editor.`:`No available editors found.`:`Stored on ${e?.nodeLabel??`the selected node`}; use an editor on that machine.`})]}),control:(0,Z.jsx)(c,{size:`xs`,variant:`outline`,disabled:!C||!n||!Se||v,onClick:T,children:v?`Opening...`:`Open file`})})}),be.length>0?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:[(0,Z.jsx)(m,{className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-0.5`,children:[be.map(e=>(0,Z.jsx)(`p`,{children:e.message},`${e.kind}-${e.message}`)),n?(0,Z.jsxs)(`p`,{className:`opacity-70`,children:[`Edit `,(0,Z.jsx)(`code`,{className:`rounded bg-amber-500/20 px-1`,children:n}),` `,`to resolve.`]}):null]})]}):null,(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(S,{className:`absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground/60`}),(0,Z.jsx)(j,{type:`search`,placeholder:`Search by command, shortcut, or when…`,className:`pl-9`,value:ce,onChange:e=>le(e.target.value)})]}),pe===0?(0,Z.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/60 px-6 py-12 text-center text-sm text-muted-foreground`,children:`No commands match your search.`}):fe.map(e=>(0,Z.jsx)(M,{title:e.category.label,children:e.rows.map(e=>(0,Z.jsx)(xe,{row:e,context:me,isMac:_,scriptTitle:F.titles.get(e.command)},e.command))},e.category.id))]})}var xe=(0,I.memo)(function(e){let t=(0,L.c)(42),{row:n,context:r,isMac:i}=e,a;if(t[0]!==r||t[1]!==i||t[2]!==n.command||t[3]!==n.indicesInDraft||t[4]!==n.status||t[5]!==n.title){let e;t[7]===r.draft?e=t[8]:(e=e=>({index:e,rule:r.draft[e]}),t[7]=r.draft,t[8]=e);let o=n.indicesInDraft.map(e),s=r.conflictsByCommand.get(n.command)??[],c=s.slice(0,3),l=n.command,u;t[9]!==r.rowRefs.current||t[10]!==n.command?(u=e=>{r.rowRefs.current.set(n.command,e)},t[9]=r.rowRefs.current,t[10]=n.command,t[11]=u):u=t[11];let d;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=f(`group flex flex-col gap-2 border-t border-border/60 px-4 py-3 first:border-t-0 transition-colors data-[flash=true]:bg-amber-500/10 sm:px-5`),t[12]=d):d=t[12];let p;t[13]===n.title?p=t[14]:(p=(0,Z.jsx)(`span`,{className:`truncate text-[13px] font-medium tracking-tight text-foreground`,children:n.title}),t[13]=n.title,t[14]=p);let m;t[15]===n.status?m=t[16]:(m=(0,Z.jsx)(Se,{status:n.status}),t[15]=n.status,t[16]=m);let h;t[17]!==p||t[18]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,m]}),t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]===n.command?g=t[21]:(g=(0,Z.jsx)(`code`,{className:`block truncate text-[10px] text-muted-foreground/60`,children:n.command}),t[20]=n.command,t[21]=g);let _;t[22]!==h||t[23]!==g?(_=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[h,g]}),t[22]=h,t[23]=g,t[24]=_):_=t[24];let v=o.length===0?(0,Z.jsx)(we,{draftIndex:-1,rule:{command:n.command,key:``,when:void 0},context:r,isMac:i,isPrimary:!0,isPlaceholder:!0,onAddPlaceholder:()=>r.onAddBinding(n.command)},`placeholder`):o.map((e,t)=>{let{index:n,rule:a}=e;return(0,Z.jsx)(we,{draftIndex:n,rule:a,context:r,isMac:i,isPrimary:t===0,isPlaceholder:a.key.length===0},`${n}-${a.__id}`)}),y;t[25]!==r||t[26]!==n.command||t[27]!==n.title||t[28]!==o?(y=o.length>0?(0,Z.jsxs)(E,{children:[(0,Z.jsx)(w,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onAddBinding(n.command),className:`inline-flex size-6 items-center justify-center rounded-md border border-dashed border-border/60 text-muted-foreground/60 transition-colors hover:border-border hover:text-foreground`,"aria-label":`Add another shortcut for ${n.title}`,children:(0,Z.jsx)(F,{className:`size-3.5`})})}),(0,Z.jsx)(T,{side:`top`,children:`Add another shortcut`})]}):null,t[25]=r,t[26]=n.command,t[27]=n.title,t[28]=o,t[29]=y):y=t[29];let b;t[30]!==r||t[31]!==n.command||t[32]!==n.status||t[33]!==n.title?(b=n.status!=="default"&&Q.has(n.command)?(0,Z.jsxs)(E,{children:[(0,Z.jsx)(w,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onResetCommand(n.command),className:`inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/50 transition-colors hover:text-foreground`,"aria-label":`Reset ${n.title} to default`,children:(0,Z.jsx)(D,{className:`size-3.5`})})}),(0,Z.jsx)(T,{side:`top`,children:`Reset to default`})]}):null,t[30]=r,t[31]=n.command,t[32]=n.status,t[33]=n.title,t[34]=b):b=t[34];let x;t[35]!==v||t[36]!==y||t[37]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[v,y,b]}),t[35]=v,t[36]=y,t[37]=b,t[38]=x):x=t[38];let S;t[39]!==_||t[40]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[_,x]}),t[39]=_,t[40]=x,t[41]=S):S=t[41],a=(0,Z.jsxs)(`div`,{"data-keybinding-command":l,ref:u,className:d,children:[S,c.length>0?(0,Z.jsxs)(`div`,{className:`animate-in fade-in slide-in-from-top-1 flex flex-col gap-1 rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-1.5 text-[11px] text-destructive-foreground/90`,children:[c.map(e=>(0,Z.jsx)(Ce,{conflict:e,isMac:i,platform:r.platform,onSelect:()=>r.scrollToCommand(e.otherCommand)},`${e.key}-${e.otherCommand}`)),s.length>c.length?(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`+ `,s.length-c.length,` more`]}):null]}):null]}),t[0]=r,t[1]=i,t[2]=n.command,t[3]=n.indicesInDraft,t[4]=n.status,t[5]=n.title,t[6]=a}else a=t[6];return a});function Se(e){let t=(0,L.c)(5),{status:n}=e;if(n==="default")return null;let r=n===`modified`?`bg-amber-500/15 text-amber-300`:`bg-indigo-500/15 text-indigo-300`,i;t[0]===r?i=t[1]:(i=f(`rounded px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-[0.06em]`,r),t[0]=r,t[1]=i);let a=n===`modified`?`Modified`:`Custom`,o;return t[2]!==i||t[3]!==a?(o=(0,Z.jsx)(`span`,{className:i,children:a}),t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function Ce(e){let t=(0,L.c)(27),{conflict:n,platform:r,isMac:i,onSelect:a}=e,o;t[0]===n.otherCommand?o=t[1]:(o=V(n.otherCommand),t[0]=n.otherCommand,t[1]=o);let s=o,c,l,u,d;if(t[2]!==n.key||t[3]!==i||t[4]!==r){let e=je(n.key),a=e?X(e,{platform:r}):[n.key];u=`flex flex-wrap items-center gap-1.5`,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(m,{className:`size-3 shrink-0 text-destructive`}),t[9]=d):d=t[9],c=`inline-flex items-center gap-0.5 font-mono`;let o;t[10]===i?o=t[11]:(o=e=>(0,Z.jsx)(De,{token:e,isMac:i},e),t[10]=i,t[11]=o),l=a.map(o),t[2]=n.key,t[3]=i,t[4]=r,t[5]=c,t[6]=l,t[7]=u,t[8]=d}else c=t[5],l=t[6],u=t[7],d=t[8];let f;t[12]!==c||t[13]!==l?(f=(0,Z.jsx)(`span`,{className:c,children:l}),t[12]=c,t[13]=l,t[14]=f):f=t[14];let p;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`span`,{children:`also bound to`}),t[15]=p):p=t[15];let h;t[16]!==s.title||t[17]!==a?(h=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:`rounded bg-destructive/20 px-1.5 py-0.5 font-medium text-destructive-foreground hover:bg-destructive/30`,children:s.title}),t[16]=s.title,t[17]=a,t[18]=h):h=t[18];let g;t[19]===n.otherWhen?g=t[20]:(g=n.otherWhen===void 0?null:(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`when `,(0,Z.jsx)(`code`,{className:`font-mono`,children:K(n.otherWhen)})]}),t[19]=n.otherWhen,t[20]=g);let _;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==h||t[25]!==g?(_=(0,Z.jsxs)(`div`,{className:u,children:[d,f,p,h,g]}),t[21]=u,t[22]=d,t[23]=f,t[24]=h,t[25]=g,t[26]=_):_=t[26],_}function we(e){let t=(0,L.c)(59),{draftIndex:n,rule:r,context:i,isMac:a,isPlaceholder:o,onAddPlaceholder:s}=e,[c,l]=(0,I.useState)(!1),[u,p]=(0,I.useState)(!1),m=(0,I.useRef)(null),h;bb0:{if(r.key.length===0){h=null;break bb0}let e;t[0]===r.key?e=t[1]:(e=je(r.key),t[0]=r.key,t[1]=e),h=e}let g=h,_=g?X(g,{platform:i.platform}):[],v;t[2]!==n||t[3]!==o||t[4]!==s?(v=()=>{if(o&&n===-1&&s){s(),setTimeout(Te,50);return}l(!0)},t[2]=n,t[3]=o,t[4]=s,t[5]=v):v=t[5];let y=v,b,x;t[6]!==i||t[7]!==n||t[8]!==c?(b=()=>{if(!c)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`&&!Ae(e)){l(!1);return}if(e.key===`Tab`&&!Ae(e)){l(!1);return}if(e.key===`Backspace`&&!Ae(e)){n>=0&&i.onRemoveBinding(n),l(!1);return}let t=se(e,{platform:i.platform});t&&(n>=0&&i.onRebind(n,t),p(!0),l(!1),setTimeout(()=>p(!1),220))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},x=[c,n,i],t[6]=i,t[7]=n,t[8]=c,t[9]=b,t[10]=x):(b=t[9],x=t[10]),(0,I.useEffect)(b,x);let S,C;t[11]===c?(S=t[12],C=t[13]):(S=()=>{c&&m.current?.focus()},C=[c],t[11]=c,t[12]=S,t[13]=C),(0,I.useEffect)(S,C);let w;t[14]!==c||t[15]!==y?(w=e=>{c||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),y())},t[14]=c,t[15]=y,t[16]=w):w=t[16];let T=w,E;t[17]!==i||t[18]!==n?(E=()=>{n>=0&&i.onRemoveBinding(n)},t[17]=i,t[18]=n,t[19]=E):E=t[19];let ee=E;if(o&&n===-1&&_.length===0){let e;t[20]===s?e=t[21]:(e=()=>s?.(),t[20]=s,t[21]=e);let n;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(F,{className:`size-3`}),t[22]=n):n=t[22];let r;return t[23]!==T||t[24]!==e?(r=(0,Z.jsxs)(`button`,{ref:m,type:`button`,onClick:e,onKeyDown:T,className:`inline-flex h-6 items-center gap-1 rounded-md border border-dashed border-border/60 bg-transparent px-2 text-[11px] text-muted-foreground/70 transition-colors hover:border-border hover:text-foreground`,children:[n,` No shortcut — click to set`]}),t[23]=T,t[24]=e,t[25]=r):r=t[25],r}let D=`Edit shortcut for ${r.command}`,O=_.length===0&&n>=0?`true`:void 0,k=c?`kb-chip-recording border-indigo-500/60 bg-indigo-500/15 text-indigo-100 shadow-[0_0_0_4px_rgba(99,102,241,0.18)]`:u?`border-emerald-500/50 bg-emerald-500/15 text-emerald-100`:`border-border bg-muted/60 text-foreground hover:bg-muted`,A;t[26]===k?A=t[27]:(A=f(`inline-flex h-6 items-center gap-1 rounded-md border px-2 font-mono text-[11px] transition-all duration-150`,k),t[26]=k,t[27]=A);let j;t[28]===c?j=t[29]:(j=c?{animation:`keybindings-pulse 1.4s ease-in-out infinite`}:{},t[28]=c,t[29]=j);let M=c?(0,Z.jsx)(`span`,{className:`text-[11px] tracking-[0.04em]`,children:`Press shortcut…`}):_.length===0?(0,Z.jsx)(`span`,{className:`text-muted-foreground/60`,children:`Click to set`}):_.map(e=>(0,Z.jsx)(De,{token:e,isMac:a},e)),N;t[30]!==c||t[31]!==r.when?(N=!c&&r.when!==void 0?(0,Z.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:`·`}):null,t[30]=c,t[31]=r.when,t[32]=N):N=t[32];let P;t[33]!==c||t[34]!==T||t[35]!==y||t[36]!==D||t[37]!==O||t[38]!==A||t[39]!==j||t[40]!==M||t[41]!==N?(P=(0,Z.jsxs)(`button`,{ref:m,type:`button`,"aria-pressed":c,"aria-label":D,"data-chip-pending-record":O,onClick:y,onKeyDown:T,className:A,style:j,children:[M,N]}),t[33]=c,t[34]=T,t[35]=y,t[36]=D,t[37]=O,t[38]=A,t[39]=j,t[40]=M,t[41]=N,t[42]=P):P=t[42];let R;t[43]!==i||t[44]!==n?(R=e=>i.onChangeWhen(n,e),t[43]=i,t[44]=n,t[45]=R):R=t[45];let z=n<0||c,B;t[46]!==r.when||t[47]!==R||t[48]!==z?(B=(0,Z.jsx)(Oe,{currentWhen:r.when,onChange:R,disabled:z}),t[46]=r.when,t[47]=R,t[48]=z,t[49]=B):B=t[49];let V;t[50]!==n||t[51]!==ee||t[52]!==c?(V=n>=0&&!c?(0,Z.jsx)(`button`,{type:`button`,onClick:ee,"aria-label":`Remove this shortcut`,className:`opacity-0 transition-opacity group-hover:opacity-100 focus:opacity-100`,children:(0,Z.jsx)(d,{className:`size-3 text-muted-foreground/60 hover:text-destructive`})}):null,t[50]=n,t[51]=ee,t[52]=c,t[53]=V):V=t[53];let H;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(ke,{}),t[54]=H):H=t[54];let U;return t[55]!==P||t[56]!==B||t[57]!==V?(U=(0,Z.jsxs)(`span`,{className:`relative inline-flex items-center gap-1`,children:[P,B,V,H]}),t[55]=P,t[56]=B,t[57]=V,t[58]=U):U=t[58],U}function Te(){document.querySelectorAll(`[data-chip-pending-record="true"]`).forEach(Ee)}function Ee(e){e.click()}function De(e){let t=(0,L.c)(5),{token:n,isMac:r}=e,i=r&&n.length===1&&/[⌀-⏿←-⇿]/.test(n)?`bg-transparent`:`bg-foreground/10`,a;t[0]===i?a=t[1]:(a=f(`rounded px-1 leading-none`,i),t[0]=i,t[1]=a);let o;return t[2]!==a||t[3]!==n?(o=(0,Z.jsx)(`span`,{className:a,children:n}),t[2]=a,t[3]=n,t[4]=o):o=t[4],o}function Oe(e){let t=(0,L.c)(35),{currentWhen:n,onChange:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=G(n),t[0]=n,t[1]=a);let o=a,s,c,l,u,d,p,m;if(t[2]!==n||t[3]!==i){let e=K(n);c=x,s=b,l=`button`,u=i;let r=n===void 0&&`italic opacity-70`;t[11]===r?d=t[12]:(d=f(`inline-flex h-5 items-center gap-1 rounded bg-muted/40 px-1.5 text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,r),t[11]=r,t[12]=d),p=`When: ${e}`,m=n===void 0?`always`:e.toLowerCase(),t[2]=n,t[3]=i,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=p,t[10]=m}else s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],p=t[9],m=t[10];let h;t[13]!==l||t[14]!==u||t[15]!==d||t[16]!==p||t[17]!==m?(h=(0,Z.jsx)(`button`,{type:l,disabled:u,className:d,"aria-label":p,children:m}),t[13]=l,t[14]=u,t[15]=d,t[16]=p,t[17]=m,t[18]=h):h=t[18];let g;t[19]!==s||t[20]!==h?(g=(0,Z.jsx)(s,{render:h}),t[19]=s,t[20]=h,t[21]=g):g=t[21];let _;t[22]!==n||t[23]!==o?(_=!o&&n!==void 0?(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-[10px] text-muted-foreground`,children:[`Current: `,(0,Z.jsx)(`code`,{className:`font-mono`,children:n})]}):null,t[22]=n,t[23]=o,t[24]=_):_=t[24];let S;t[25]!==n||t[26]!==r?(S=H.map(e=>(0,Z.jsxs)(y,{onClick:()=>r(e.value),className:f(`flex items-center justify-between text-[12px]`,e.value===n&&`font-semibold text-foreground`),children:[(0,Z.jsx)(`span`,{children:e.label}),e.value===void 0?(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:`no condition`}):(0,Z.jsx)(`code`,{className:`text-[10px] font-mono text-muted-foreground/60`,children:e.value})]},e.id)),t[25]=n,t[26]=r,t[27]=S):S=t[27];let C;t[28]!==S||t[29]!==_?(C=(0,Z.jsxs)(v,{side:`bottom`,align:`end`,className:`min-w-[220px]`,children:[_,S]}),t[28]=S,t[29]=_,t[30]=C):C=t[30];let w;return t[31]!==c||t[32]!==C||t[33]!==g?(w=(0,Z.jsxs)(c,{children:[g,C]}),t[31]=c,t[32]=C,t[33]=g,t[34]=w):w=t[34],w}function ke(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`style`,{children:`@keyframes keybindings-pulse {
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Tt as t}from"./primary-DZjgHvyf.js";import{$l as n,Bl as r,Bn as i,Dn as a,Kr as o,Ql as s,Qr as c,Vl as l,Wl as u,ao as d,ei as f,hr as p,oo as m,sr as h,ti as g}from"./runtime-BwHA1GUS.js";import{t as _}from"./react-CwJFpaho.js";import{Ft as v,Pt as y,Ut as b,jt as x,mr as S}from"./switch-DnpJB2xv.js";import{t as C}from"./compiler-runtime-C4g8XhC5.js";import{i as w,n as T,t as E}from"./tooltip-BlweKBxc.js";import{d as ee}from"./SettingsPanels-De_XZOQF.js";import{a as D,r as O}from"./editorPreferences-D8q1ItMW.js";import{t as k}from"./toastHelpers-CSQRKo4F.js";import{t as A}from"./shallow-B--PNURq.js";import{t as j}from"./input-BDWSVClC.js";import{i as M,n as N,r as P}from"./settingsLayout-DxsFwhF0.js";import{ut as F}from"./main-DAbEANjY.js";var I=e(_(),1),L=C(),R={terminal:{id:`terminal`,label:`Terminal`,sortWeight:10},workspace:{id:`workspace`,label:`Workspace`,sortWeight:20},diff:{id:`diff`,label:`Diff`,sortWeight:30},commandPalette:{id:`commandPalette`,label:`Command palette`,sortWeight:40},sidebar:{id:`sidebar`,label:`Sidebar`,sortWeight:50},chat:{id:`chat`,label:`Chat`,sortWeight:60},composer:{id:`composer`,label:`Composer`,sortWeight:70},editor:{id:`editor`,label:`Editor`,sortWeight:80},modelPicker:{id:`modelPicker`,label:`Model picker`,sortWeight:90},thread:{id:`thread`,label:`Threads`,sortWeight:100},script:{id:`script`,label:`Project scripts`,sortWeight:110}},z={"terminal.toggle":{title:`Toggle terminal drawer`,sortWeight:1},"terminal.split":{title:`Split terminal`,sortWeight:2},"terminal.new":{title:`New terminal`,sortWeight:3},"terminal.close":{title:`Close terminal`,sortWeight:4},"workspace.files":{title:`Open workspace files`,sortWeight:1},"workspace.review":{title:`Open workspace review`,sortWeight:2},"workspace.terminal":{title:`Open workspace terminal`,sortWeight:3},"workspace.simulator":{title:`Open iOS Simulator workspace`,sortWeight:4},"diff.toggle":{title:`Toggle diff view`,sortWeight:1},"commandPalette.toggle":{title:`Open command palette`,sortWeight:1},"sidebar.showInbox":{title:`Show Inbox sidebar`,sortWeight:1},"sidebar.showProjects":{title:`Show Projects sidebar`,sortWeight:2},"chat.new":{title:`New chat`,sortWeight:1},"chat.newLocal":{title:`New chat (local environment)`,sortWeight:2},"composer.stash":{title:`Stash prompt or open stash`,sortWeight:1},"editor.openFavorite":{title:`Open in preferred editor`,sortWeight:1},"modelPicker.toggle":{title:`Toggle model picker`,sortWeight:1},"modelPicker.jump.1":{title:`Pick model 1`,sortWeight:2},"modelPicker.jump.2":{title:`Pick model 2`,sortWeight:3},"modelPicker.jump.3":{title:`Pick model 3`,sortWeight:4},"modelPicker.jump.4":{title:`Pick model 4`,sortWeight:5},"modelPicker.jump.5":{title:`Pick model 5`,sortWeight:6},"modelPicker.jump.6":{title:`Pick model 6`,sortWeight:7},"modelPicker.jump.7":{title:`Pick model 7`,sortWeight:8},"modelPicker.jump.8":{title:`Pick model 8`,sortWeight:9},"modelPicker.jump.9":{title:`Pick model 9`,sortWeight:10},"thread.find":{title:`Find in current thread`,sortWeight:1},"thread.pinToggle":{title:`Pin or unpin current thread`,sortWeight:2},"thread.previous":{title:`Previous thread`,sortWeight:3},"thread.next":{title:`Next thread`,sortWeight:4},"thread.jump.1":{title:`Jump to thread 1`,sortWeight:5},"thread.jump.2":{title:`Jump to thread 2`,sortWeight:6},"thread.jump.3":{title:`Jump to thread 3`,sortWeight:7},"thread.jump.4":{title:`Jump to thread 4`,sortWeight:8},"thread.jump.5":{title:`Jump to thread 5`,sortWeight:9},"thread.jump.6":{title:`Jump to thread 6`,sortWeight:10},"thread.jump.7":{title:`Jump to thread 7`,sortWeight:11},"thread.jump.8":{title:`Jump to thread 8`,sortWeight:12},"thread.jump.9":{title:`Jump to thread 9`,sortWeight:13}};function B(e){let t=e.indexOf(`.`),n=t===-1?e:e.slice(0,t);return n===`script`?R.script:R[n]??R.script}function V(e,t){let n=B(e),r=z[e];if(r)return{category:n,title:r.title,sortWeight:r.sortWeight};let i=e.match(/^script\.([a-z0-9][a-z0-9-]*)\.run$/)?.[1]??e;return{category:n,title:t??`Run: ${i}`,sortWeight:100}}var H=[{id:`always`,label:`Always`,value:void 0},{id:`terminalFocus`,label:`Terminal focused`,value:`terminalFocus`},{id:`notTerminalFocus`,label:`Not in terminal`,value:`!terminalFocus`},{id:`terminalOpen`,label:`Terminal open`,value:`terminalOpen`},{id:`notTerminalOpen`,label:`Terminal not open`,value:`!terminalOpen`},{id:`modelPickerOpen`,label:`Model picker open`,value:`modelPickerOpen`},{id:`commandPaletteOpen`,label:`Command palette open`,value:`commandPaletteOpen`},{id:`composerFocus`,label:`Composer focused`,value:`composerFocus`},{id:`notComposerFocus`,label:`Not in composer`,value:`!composerFocus`}],U=new Map(H.map(e=>[e.value,e])),W=new Map(H.map(e=>[e.value===void 0?void 0:e.value.replace(/\s+/g,``),e]));function G(e){return e===void 0?U.get(void 0):U.get(e)||W.get(e.replace(/\s+/g,``))}function K(e){let t=G(e);return t?t.label:e??`Always`}function q(e){if(e)switch(e.type){case`identifier`:return e.name;case`not`:return`!${q(e.node)}`;case`and`:return`(${q(e.left)} && ${q(e.right)})`;case`or`:return`(${q(e.left)} || ${q(e.right)})`}}function te(e,t){return(e===void 0?``:e.replace(/\s+/g,``))===(t===void 0?``:t.replace(/\s+/g,``))}function ne(e,t){let n=e[t];if(!n)return[];let r=[];return e.forEach((e,i)=>{i!==t&&e.command!==n.command&&e.key===n.key&&te(e.when,n.when)&&r.push({key:n.key,otherCommand:e.command,otherWhen:e.when})}),r}function re(e){let t=new Map;return e.forEach((n,r)=>{let i=ne(e,r);if(i.length===0)return;let a=e[r].command,o=t.get(a)??[];o.push(...i),t.set(a,o)}),t}function J(e){return/mac|iphone|ipad|ipod/i.test(e)}var ie=new Set([`control`,`shift`,`alt`,`altgraph`,`meta`,`os`,`hyper`,`super`,`fn`,`capslock`,`numlock`,`scrolllock`]),ae=new Set([`escape`,`tab`,`enter`]);function oe(e,t){let n=e.toLowerCase();if(n===` `||n===`spacebar`)return`space`;if(n===`esc`)return`escape`;if(n===`arrowup`)return`up`;if(n===`arrowdown`)return`down`;if(n===`arrowleft`)return`left`;if(n===`arrowright`)return`right`;if(t){let e=t.match(/^Digit(\d)$/);if(e)return e[1];if(t===`BracketLeft`)return`[`;if(t===`BracketRight`)return`]`}return n}function se(e,t){let n=e.key.toLowerCase();if(ie.has(n))return null;let r=J(t?.platform??(typeof navigator<`u`?navigator.platform:``)),i=r?e.metaKey:e.ctrlKey;if(!(i||e.shiftKey||e.altKey||(r?e.ctrlKey:e.metaKey))&&ae.has(n))return null;let a=oe(e.key,e.code);return a.length===0?null:{key:a,modKey:i,metaKey:!r&&e.metaKey,ctrlKey:r&&e.ctrlKey,shiftKey:e.shiftKey,altKey:e.altKey}}var ce={mod:`⌘`,meta:`⌘`,cmd:`⌘`,ctrl:`⌃`,control:`⌃`,shift:`⇧`,alt:`⌥`,option:`⌥`},le={mod:`Ctrl`,meta:`Meta`,cmd:`Meta`,ctrl:`Ctrl`,control:`Ctrl`,shift:`Shift`,alt:`Alt`,option:`Alt`},Y={space:`Space`,enter:`Enter`,escape:`Esc`,up:`↑`,down:`↓`,left:`←`,right:`→`,tab:`Tab`,backspace:`⌫`,delete:`Del`};function X(e,t){let n=J(t?.platform??(typeof navigator<`u`?navigator.platform:``))?ce:le,r=[];e.modKey&&r.push(n.mod),e.metaKey&&r.push(n.meta),e.ctrlKey&&r.push(n.ctrl),e.altKey&&r.push(n.alt),e.shiftKey&&r.push(n.shift);let i=Y[e.key]??(e.key.length===1?e.key.toUpperCase():e.key);return r.push(i),r}function ue(e){let t=[];e.modKey&&t.push(`mod`),e.metaKey&&t.push(`meta`),e.ctrlKey&&t.push(`ctrl`),e.altKey&&t.push(`alt`),e.shiftKey&&t.push(`shift`);let n=e.key===` `?`space`:e.key;return t.push(n),t.join(`+`)}var Z=n(),de=[],fe=(()=>{let e=new Map;for(let n of t){let t=`${n.key}|${n.when??``}`,r=e.get(n.command)??new Set;r.add(t),e.set(n.command,r)}return e})(),Q=new Set(t.map(e=>e.command));function pe(e,t){return`${e.command}|${e.key}|${e.when??``}|${t}`}function me(e){return{key:ue(e.shortcut),command:e.command,when:q(e.whenAst)}}function $(e){return e.map((e,t)=>({...me(e),__id:pe(e,t)}))}function he(e){return e.map(({__id:e,...t})=>t)}function ge(e){return t.filter(t=>t.command===e).map(e=>Object.assign({},e))}function _e(e,t){if(!Q.has(e))return`custom`;let n=fe.get(e);if(!n)return`custom`;if(t.length!==n.size)return`modified`;for(let e of t){let t=`${e.key}|${e.when??``}`;if(!n.has(t))return`modified`}return`default`}function ve(e,t,n){return!n||[t.toLowerCase(),e.command.toLowerCase(),e.key.toLowerCase(),K(e.when).toLowerCase()].some(e=>e.includes(n))}function ye(){return Math.random().toString(36).slice(2)}function be(){let e=s(),t=l(),n=u(),d=r(),f=typeof navigator<`u`?navigator.platform:``,_=g(f),[v,y]=(0,I.useState)(!1),[b,x]=(0,I.useState)(null),C=!e||e.primary,w=e?h(e.environmentId)?.keybindings:p().keybindings,T=(0,I.useCallback)(()=>{if(!n)return;if(!C){x(`This file lives on ${e?.nodeLabel??`the selected node`} and cannot be opened in a local editor.`);return}x(null),y(!0);let t=O(d??[]);if(!t){x(`No available editors found.`),y(!1);return}p().shell.openInEditor(n,t).catch(e=>{x(e instanceof Error?e.message:`Unable to open keybindings file.`)}).finally(()=>{y(!1)})},[d,C,n,e?.nodeLabel]),E=i(A(a)),F=(0,I.useMemo)(()=>{let e=new Set,t=new Map;for(let n of E)for(let r of n.scripts){let n=`script.${r.id}.run`;e.add(n),t.has(n)||t.set(n,`Run: ${r.name}`)}return{commandList:Array.from(e),titles:t}},[E]),L=t?.keybindings??de,[z,B]=(0,I.useState)(()=>$(L)),[H,U]=(0,I.useState)(()=>JSON.stringify(he($(L)))),W=(0,I.useRef)(!1);(0,I.useEffect)(()=>{let e=JSON.stringify(he($(L)));e!==H&&(U(e),W.current||B($(L)))},[L,H]);let G=(0,I.useCallback)(async e=>{W.current=!0;try{if(!w)throw Error(`Keybinding settings are unavailable on this node.`);await w.replaceCustom({rules:he(e)})}catch(e){o.add(k({type:`error`,title:`Could not save keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),B($(L))}finally{W.current=!1}},[w,L]),K=(0,I.useCallback)((e,t)=>{B(n=>{let r=n.slice(),i=r[e];if(!i)return n;let a=ue(t);return a===i.key?n:(r[e]={...i,key:a,__id:i.__id},G(r),r)})},[G]),q=(0,I.useCallback)(e=>{B(t=>{let n={command:e,key:``,when:void 0,__id:`placeholder-${ye()}`},r=(()=>{let n=-1;return t.forEach((t,r)=>{t.command===e&&(n=r)}),n})();return r===-1?[...t,n]:[...t.slice(0,r+1),n,...t.slice(r+1)]})},[]),te=(0,I.useCallback)(e=>{B(t=>{let n=t.slice();return n.splice(e,1),G(n),n})},[G]),ne=(0,I.useCallback)((e,t)=>{B(n=>{let r=n.slice(),i=r[e];return!i||(i.when??void 0)===t?n:(r[e]={...i,when:t,__id:i.__id},G(r),r)})},[G]),J=(0,I.useCallback)(e=>{B(t=>{let n=t[e];if(!n)return t;let r=n.command;if(!Q.has(r)){let n=t.slice();return n.splice(e,1),G(n),n}let i=ge(r),a=t.filter(e=>e.command!==r);for(let e of i)a.push({...e,__id:`default-${r}-${ye()}`});return G(a),a})},[G]),ie=(0,I.useCallback)(e=>{B(t=>{let n=t.filter(t=>t.command!==e);if(Q.has(e))for(let t of ge(e))n.push({...t,__id:`default-${e}-${ye()}`});return G(n),n})},[G]),ae=(0,I.useCallback)(async()=>{B([]);try{if(!w)throw Error(`Keybinding settings are unavailable on this node.`);await w.replaceCustom({rules:[]})}catch(e){o.add(k({type:`error`,title:`Could not restore default keybindings`,description:e instanceof Error?e.message:`An unknown error occurred.`})),B($(L))}},[w,L]),oe=(0,I.useRef)(new Map),se=(0,I.useCallback)(e=>{let t=oe.current.get(e);t&&(t.scrollIntoView({behavior:`smooth`,block:`center`}),t.dataset.flash=`true`,window.setTimeout(()=>{delete t.dataset.flash},1100))},[]),[ce,le]=(0,I.useState)(``),Y=(0,I.useDeferredValue)(ce.trim().toLowerCase()),X=(0,I.useMemo)(()=>re(z),[z]),fe=(0,I.useMemo)(()=>{let e=new Map;z.forEach((t,n)=>{let r=e.get(t.command);r?r.push(n):e.set(t.command,[n])});let t=new Set([...e.keys(),...Q,...F.commandList]),n=new Map;for(let r of t){let t=e.get(r)??[],i=t.map(e=>z[e]).filter(Boolean),a=V(r,F.titles.get(r)),o=_e(r,i),s={key:``,command:r,when:void 0};if(!(Y.length===0||ve(s,a.title,Y)||i.some(e=>ve(e,a.title,Y))))continue;let c={command:r,title:a.title,indicesInDraft:t,status:o},l=n.get(a.category.id);l?l.push(c):n.set(a.category.id,[c])}let r=[];for(let e of Object.values(R).toSorted((e,t)=>e.sortWeight-t.sortWeight)){let t=n.get(e.id);t&&t.length!==0&&(t.sort((e,t)=>{let n=V(e.command,F.titles.get(e.command)),r=V(t.command,F.titles.get(t.command));return n.sortWeight-r.sortWeight}),r.push({category:e,rows:t}))}return r},[z,Y,F]),pe=fe.reduce((e,t)=>e+t.rows.length,0),me=(0,I.useMemo)(()=>({platform:f,draft:z,conflictsByCommand:X,onRebind:K,onAddBinding:q,onRemoveBinding:te,onChangeWhen:ne,onResetBinding:J,onResetCommand:ie,scrollToCommand:se,rowRefs:oe}),[f,z,X,K,q,te,ne,J,ie,se]),be=t?.issues.filter(e=>e.kind.startsWith(`keybindings.`))??[],Se=(d??[]).length>0;return(0,Z.jsxs)(N,{children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`grid size-9 place-items-center rounded-lg bg-accent text-foreground/70`,children:(0,Z.jsx)(ee,{className:`size-4`})}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`h1`,{className:`text-lg font-semibold tracking-tight`,children:`Keybindings`}),(0,Z.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Click any shortcut and press a new combination to rebind. Press Esc to cancel, Backspace to clear.`})]})]}),(0,Z.jsxs)(c,{variant:`outline`,size:`xs`,onClick:()=>void ae(),disabled:z.length===0,children:[(0,Z.jsx)(D,{className:`size-3.5`}),`Restore defaults`]})]}),(0,Z.jsx)(M,{title:`Configuration file`,children:(0,Z.jsx)(P,{title:`Keybindings file`,description:"Open the persisted `keybindings.json` file to edit advanced bindings directly.",status:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`block break-all font-mono text-[11px] text-foreground`,children:n??`Resolving keybindings path...`}),b?(0,Z.jsx)(`span`,{className:`mt-1 block text-destructive`,children:b}):(0,Z.jsx)(`span`,{className:`mt-1 block`,children:C?Se?`Opens in your preferred editor.`:`No available editors found.`:`Stored on ${e?.nodeLabel??`the selected node`}; use an editor on that machine.`})]}),control:(0,Z.jsx)(c,{size:`xs`,variant:`outline`,disabled:!C||!n||!Se||v,onClick:T,children:v?`Opening...`:`Open file`})})}),be.length>0?(0,Z.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-200`,children:[(0,Z.jsx)(m,{className:`mt-0.5 size-4 shrink-0`}),(0,Z.jsxs)(`div`,{className:`flex-1 space-y-0.5`,children:[be.map(e=>(0,Z.jsx)(`p`,{children:e.message},`${e.kind}-${e.message}`)),n?(0,Z.jsxs)(`p`,{className:`opacity-70`,children:[`Edit `,(0,Z.jsx)(`code`,{className:`rounded bg-amber-500/20 px-1`,children:n}),` `,`to resolve.`]}):null]})]}):null,(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(S,{className:`absolute left-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground/60`}),(0,Z.jsx)(j,{type:`search`,placeholder:`Search by command, shortcut, or when…`,className:`pl-9`,value:ce,onChange:e=>le(e.target.value)})]}),pe===0?(0,Z.jsx)(`div`,{className:`rounded-lg border border-dashed border-border/60 px-6 py-12 text-center text-sm text-muted-foreground`,children:`No commands match your search.`}):fe.map(e=>(0,Z.jsx)(M,{title:e.category.label,children:e.rows.map(e=>(0,Z.jsx)(xe,{row:e,context:me,isMac:_,scriptTitle:F.titles.get(e.command)},e.command))},e.category.id))]})}var xe=(0,I.memo)(function(e){let t=(0,L.c)(42),{row:n,context:r,isMac:i}=e,a;if(t[0]!==r||t[1]!==i||t[2]!==n.command||t[3]!==n.indicesInDraft||t[4]!==n.status||t[5]!==n.title){let e;t[7]===r.draft?e=t[8]:(e=e=>({index:e,rule:r.draft[e]}),t[7]=r.draft,t[8]=e);let o=n.indicesInDraft.map(e),s=r.conflictsByCommand.get(n.command)??[],c=s.slice(0,3),l=n.command,u;t[9]!==r.rowRefs.current||t[10]!==n.command?(u=e=>{r.rowRefs.current.set(n.command,e)},t[9]=r.rowRefs.current,t[10]=n.command,t[11]=u):u=t[11];let d;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(d=f(`group flex flex-col gap-2 border-t border-border/60 px-4 py-3 first:border-t-0 transition-colors data-[flash=true]:bg-amber-500/10 sm:px-5`),t[12]=d):d=t[12];let p;t[13]===n.title?p=t[14]:(p=(0,Z.jsx)(`span`,{className:`truncate text-[13px] font-medium tracking-tight text-foreground`,children:n.title}),t[13]=n.title,t[14]=p);let m;t[15]===n.status?m=t[16]:(m=(0,Z.jsx)(Se,{status:n.status}),t[15]=n.status,t[16]=m);let h;t[17]!==p||t[18]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p,m]}),t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;t[20]===n.command?g=t[21]:(g=(0,Z.jsx)(`code`,{className:`block truncate text-[10px] text-muted-foreground/60`,children:n.command}),t[20]=n.command,t[21]=g);let _;t[22]!==h||t[23]!==g?(_=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[h,g]}),t[22]=h,t[23]=g,t[24]=_):_=t[24];let v=o.length===0?(0,Z.jsx)(we,{draftIndex:-1,rule:{command:n.command,key:``,when:void 0},context:r,isMac:i,isPrimary:!0,isPlaceholder:!0,onAddPlaceholder:()=>r.onAddBinding(n.command)},`placeholder`):o.map((e,t)=>{let{index:n,rule:a}=e;return(0,Z.jsx)(we,{draftIndex:n,rule:a,context:r,isMac:i,isPrimary:t===0,isPlaceholder:a.key.length===0},`${n}-${a.__id}`)}),y;t[25]!==r||t[26]!==n.command||t[27]!==n.title||t[28]!==o?(y=o.length>0?(0,Z.jsxs)(E,{children:[(0,Z.jsx)(w,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onAddBinding(n.command),className:`inline-flex size-6 items-center justify-center rounded-md border border-dashed border-border/60 text-muted-foreground/60 transition-colors hover:border-border hover:text-foreground`,"aria-label":`Add another shortcut for ${n.title}`,children:(0,Z.jsx)(F,{className:`size-3.5`})})}),(0,Z.jsx)(T,{side:`top`,children:`Add another shortcut`})]}):null,t[25]=r,t[26]=n.command,t[27]=n.title,t[28]=o,t[29]=y):y=t[29];let b;t[30]!==r||t[31]!==n.command||t[32]!==n.status||t[33]!==n.title?(b=n.status!=="default"&&Q.has(n.command)?(0,Z.jsxs)(E,{children:[(0,Z.jsx)(w,{render:(0,Z.jsx)(`button`,{type:`button`,onClick:()=>r.onResetCommand(n.command),className:`inline-flex size-6 items-center justify-center rounded-md text-muted-foreground/50 transition-colors hover:text-foreground`,"aria-label":`Reset ${n.title} to default`,children:(0,Z.jsx)(D,{className:`size-3.5`})})}),(0,Z.jsx)(T,{side:`top`,children:`Reset to default`})]}):null,t[30]=r,t[31]=n.command,t[32]=n.status,t[33]=n.title,t[34]=b):b=t[34];let x;t[35]!==v||t[36]!==y||t[37]!==b?(x=(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-1.5`,children:[v,y,b]}),t[35]=v,t[36]=y,t[37]=b,t[38]=x):x=t[38];let S;t[39]!==_||t[40]!==x?(S=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[_,x]}),t[39]=_,t[40]=x,t[41]=S):S=t[41],a=(0,Z.jsxs)(`div`,{"data-keybinding-command":l,ref:u,className:d,children:[S,c.length>0?(0,Z.jsxs)(`div`,{className:`animate-in fade-in slide-in-from-top-1 flex flex-col gap-1 rounded-md border border-destructive/30 bg-destructive/10 px-2.5 py-1.5 text-[11px] text-destructive-foreground/90`,children:[c.map(e=>(0,Z.jsx)(Ce,{conflict:e,isMac:i,platform:r.platform,onSelect:()=>r.scrollToCommand(e.otherCommand)},`${e.key}-${e.otherCommand}`)),s.length>c.length?(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`+ `,s.length-c.length,` more`]}):null]}):null]}),t[0]=r,t[1]=i,t[2]=n.command,t[3]=n.indicesInDraft,t[4]=n.status,t[5]=n.title,t[6]=a}else a=t[6];return a});function Se(e){let t=(0,L.c)(5),{status:n}=e;if(n==="default")return null;let r=n===`modified`?`bg-amber-500/15 text-amber-300`:`bg-indigo-500/15 text-indigo-300`,i;t[0]===r?i=t[1]:(i=f(`rounded px-1.5 py-0.5 text-[9px] font-medium uppercase tracking-[0.06em]`,r),t[0]=r,t[1]=i);let a=n===`modified`?`Modified`:`Custom`,o;return t[2]!==i||t[3]!==a?(o=(0,Z.jsx)(`span`,{className:i,children:a}),t[2]=i,t[3]=a,t[4]=o):o=t[4],o}function Ce(e){let t=(0,L.c)(27),{conflict:n,platform:r,isMac:i,onSelect:a}=e,o;t[0]===n.otherCommand?o=t[1]:(o=V(n.otherCommand),t[0]=n.otherCommand,t[1]=o);let s=o,c,l,u,d;if(t[2]!==n.key||t[3]!==i||t[4]!==r){let e=je(n.key),a=e?X(e,{platform:r}):[n.key];u=`flex flex-wrap items-center gap-1.5`,t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Z.jsx)(m,{className:`size-3 shrink-0 text-destructive`}),t[9]=d):d=t[9],c=`inline-flex items-center gap-0.5 font-mono`;let o;t[10]===i?o=t[11]:(o=e=>(0,Z.jsx)(De,{token:e,isMac:i},e),t[10]=i,t[11]=o),l=a.map(o),t[2]=n.key,t[3]=i,t[4]=r,t[5]=c,t[6]=l,t[7]=u,t[8]=d}else c=t[5],l=t[6],u=t[7],d=t[8];let f;t[12]!==c||t[13]!==l?(f=(0,Z.jsx)(`span`,{className:c,children:l}),t[12]=c,t[13]=l,t[14]=f):f=t[14];let p;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Z.jsx)(`span`,{children:`also bound to`}),t[15]=p):p=t[15];let h;t[16]!==s.title||t[17]!==a?(h=(0,Z.jsx)(`button`,{type:`button`,onClick:a,className:`rounded bg-destructive/20 px-1.5 py-0.5 font-medium text-destructive-foreground hover:bg-destructive/30`,children:s.title}),t[16]=s.title,t[17]=a,t[18]=h):h=t[18];let g;t[19]===n.otherWhen?g=t[20]:(g=n.otherWhen===void 0?null:(0,Z.jsxs)(`span`,{className:`opacity-70`,children:[`when `,(0,Z.jsx)(`code`,{className:`font-mono`,children:K(n.otherWhen)})]}),t[19]=n.otherWhen,t[20]=g);let _;return t[21]!==u||t[22]!==d||t[23]!==f||t[24]!==h||t[25]!==g?(_=(0,Z.jsxs)(`div`,{className:u,children:[d,f,p,h,g]}),t[21]=u,t[22]=d,t[23]=f,t[24]=h,t[25]=g,t[26]=_):_=t[26],_}function we(e){let t=(0,L.c)(59),{draftIndex:n,rule:r,context:i,isMac:a,isPlaceholder:o,onAddPlaceholder:s}=e,[c,l]=(0,I.useState)(!1),[u,p]=(0,I.useState)(!1),m=(0,I.useRef)(null),h;bb0:{if(r.key.length===0){h=null;break bb0}let e;t[0]===r.key?e=t[1]:(e=je(r.key),t[0]=r.key,t[1]=e),h=e}let g=h,_=g?X(g,{platform:i.platform}):[],v;t[2]!==n||t[3]!==o||t[4]!==s?(v=()=>{if(o&&n===-1&&s){s(),setTimeout(Te,50);return}l(!0)},t[2]=n,t[3]=o,t[4]=s,t[5]=v):v=t[5];let y=v,b,x;t[6]!==i||t[7]!==n||t[8]!==c?(b=()=>{if(!c)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`&&!Ae(e)){l(!1);return}if(e.key===`Tab`&&!Ae(e)){l(!1);return}if(e.key===`Backspace`&&!Ae(e)){n>=0&&i.onRemoveBinding(n),l(!1);return}let t=se(e,{platform:i.platform});t&&(n>=0&&i.onRebind(n,t),p(!0),l(!1),setTimeout(()=>p(!1),220))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},x=[c,n,i],t[6]=i,t[7]=n,t[8]=c,t[9]=b,t[10]=x):(b=t[9],x=t[10]),(0,I.useEffect)(b,x);let S,C;t[11]===c?(S=t[12],C=t[13]):(S=()=>{c&&m.current?.focus()},C=[c],t[11]=c,t[12]=S,t[13]=C),(0,I.useEffect)(S,C);let w;t[14]!==c||t[15]!==y?(w=e=>{c||(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),y())},t[14]=c,t[15]=y,t[16]=w):w=t[16];let T=w,E;t[17]!==i||t[18]!==n?(E=()=>{n>=0&&i.onRemoveBinding(n)},t[17]=i,t[18]=n,t[19]=E):E=t[19];let ee=E;if(o&&n===-1&&_.length===0){let e;t[20]===s?e=t[21]:(e=()=>s?.(),t[20]=s,t[21]=e);let n;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(F,{className:`size-3`}),t[22]=n):n=t[22];let r;return t[23]!==T||t[24]!==e?(r=(0,Z.jsxs)(`button`,{ref:m,type:`button`,onClick:e,onKeyDown:T,className:`inline-flex h-6 items-center gap-1 rounded-md border border-dashed border-border/60 bg-transparent px-2 text-[11px] text-muted-foreground/70 transition-colors hover:border-border hover:text-foreground`,children:[n,` No shortcut — click to set`]}),t[23]=T,t[24]=e,t[25]=r):r=t[25],r}let D=`Edit shortcut for ${r.command}`,O=_.length===0&&n>=0?`true`:void 0,k=c?`kb-chip-recording border-indigo-500/60 bg-indigo-500/15 text-indigo-100 shadow-[0_0_0_4px_rgba(99,102,241,0.18)]`:u?`border-emerald-500/50 bg-emerald-500/15 text-emerald-100`:`border-border bg-muted/60 text-foreground hover:bg-muted`,A;t[26]===k?A=t[27]:(A=f(`inline-flex h-6 items-center gap-1 rounded-md border px-2 font-mono text-[11px] transition-all duration-150`,k),t[26]=k,t[27]=A);let j;t[28]===c?j=t[29]:(j=c?{animation:`keybindings-pulse 1.4s ease-in-out infinite`}:{},t[28]=c,t[29]=j);let M=c?(0,Z.jsx)(`span`,{className:`text-[11px] tracking-[0.04em]`,children:`Press shortcut…`}):_.length===0?(0,Z.jsx)(`span`,{className:`text-muted-foreground/60`,children:`Click to set`}):_.map(e=>(0,Z.jsx)(De,{token:e,isMac:a},e)),N;t[30]!==c||t[31]!==r.when?(N=!c&&r.when!==void 0?(0,Z.jsx)(`span`,{className:`ml-1 hidden sm:inline`,children:`·`}):null,t[30]=c,t[31]=r.when,t[32]=N):N=t[32];let P;t[33]!==c||t[34]!==T||t[35]!==y||t[36]!==D||t[37]!==O||t[38]!==A||t[39]!==j||t[40]!==M||t[41]!==N?(P=(0,Z.jsxs)(`button`,{ref:m,type:`button`,"aria-pressed":c,"aria-label":D,"data-chip-pending-record":O,onClick:y,onKeyDown:T,className:A,style:j,children:[M,N]}),t[33]=c,t[34]=T,t[35]=y,t[36]=D,t[37]=O,t[38]=A,t[39]=j,t[40]=M,t[41]=N,t[42]=P):P=t[42];let R;t[43]!==i||t[44]!==n?(R=e=>i.onChangeWhen(n,e),t[43]=i,t[44]=n,t[45]=R):R=t[45];let z=n<0||c,B;t[46]!==r.when||t[47]!==R||t[48]!==z?(B=(0,Z.jsx)(Oe,{currentWhen:r.when,onChange:R,disabled:z}),t[46]=r.when,t[47]=R,t[48]=z,t[49]=B):B=t[49];let V;t[50]!==n||t[51]!==ee||t[52]!==c?(V=n>=0&&!c?(0,Z.jsx)(`button`,{type:`button`,onClick:ee,"aria-label":`Remove this shortcut`,className:`opacity-0 transition-opacity group-hover:opacity-100 focus:opacity-100`,children:(0,Z.jsx)(d,{className:`size-3 text-muted-foreground/60 hover:text-destructive`})}):null,t[50]=n,t[51]=ee,t[52]=c,t[53]=V):V=t[53];let H;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,Z.jsx)(ke,{}),t[54]=H):H=t[54];let U;return t[55]!==P||t[56]!==B||t[57]!==V?(U=(0,Z.jsxs)(`span`,{className:`relative inline-flex items-center gap-1`,children:[P,B,V,H]}),t[55]=P,t[56]=B,t[57]=V,t[58]=U):U=t[58],U}function Te(){document.querySelectorAll(`[data-chip-pending-record="true"]`).forEach(Ee)}function Ee(e){e.click()}function De(e){let t=(0,L.c)(5),{token:n,isMac:r}=e,i=r&&n.length===1&&/[⌀-⏿←-⇿]/.test(n)?`bg-transparent`:`bg-foreground/10`,a;t[0]===i?a=t[1]:(a=f(`rounded px-1 leading-none`,i),t[0]=i,t[1]=a);let o;return t[2]!==a||t[3]!==n?(o=(0,Z.jsx)(`span`,{className:a,children:n}),t[2]=a,t[3]=n,t[4]=o):o=t[4],o}function Oe(e){let t=(0,L.c)(35),{currentWhen:n,onChange:r,disabled:i}=e,a;t[0]===n?a=t[1]:(a=G(n),t[0]=n,t[1]=a);let o=a,s,c,l,u,d,p,m;if(t[2]!==n||t[3]!==i){let e=K(n);c=x,s=b,l=`button`,u=i;let r=n===void 0&&`italic opacity-70`;t[11]===r?d=t[12]:(d=f(`inline-flex h-5 items-center gap-1 rounded bg-muted/40 px-1.5 text-[10px] text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50`,r),t[11]=r,t[12]=d),p=`When: ${e}`,m=n===void 0?`always`:e.toLowerCase(),t[2]=n,t[3]=i,t[4]=s,t[5]=c,t[6]=l,t[7]=u,t[8]=d,t[9]=p,t[10]=m}else s=t[4],c=t[5],l=t[6],u=t[7],d=t[8],p=t[9],m=t[10];let h;t[13]!==l||t[14]!==u||t[15]!==d||t[16]!==p||t[17]!==m?(h=(0,Z.jsx)(`button`,{type:l,disabled:u,className:d,"aria-label":p,children:m}),t[13]=l,t[14]=u,t[15]=d,t[16]=p,t[17]=m,t[18]=h):h=t[18];let g;t[19]!==s||t[20]!==h?(g=(0,Z.jsx)(s,{render:h}),t[19]=s,t[20]=h,t[21]=g):g=t[21];let _;t[22]!==n||t[23]!==o?(_=!o&&n!==void 0?(0,Z.jsxs)(`div`,{className:`px-2 py-1.5 text-[10px] text-muted-foreground`,children:[`Current: `,(0,Z.jsx)(`code`,{className:`font-mono`,children:n})]}):null,t[22]=n,t[23]=o,t[24]=_):_=t[24];let S;t[25]!==n||t[26]!==r?(S=H.map(e=>(0,Z.jsxs)(y,{onClick:()=>r(e.value),className:f(`flex items-center justify-between text-[12px]`,e.value===n&&`font-semibold text-foreground`),children:[(0,Z.jsx)(`span`,{children:e.label}),e.value===void 0?(0,Z.jsx)(`span`,{className:`text-[10px] text-muted-foreground/60`,children:`no condition`}):(0,Z.jsx)(`code`,{className:`text-[10px] font-mono text-muted-foreground/60`,children:e.value})]},e.id)),t[25]=n,t[26]=r,t[27]=S):S=t[27];let C;t[28]!==S||t[29]!==_?(C=(0,Z.jsxs)(v,{side:`bottom`,align:`end`,className:`min-w-[220px]`,children:[_,S]}),t[28]=S,t[29]=_,t[30]=C):C=t[30];let w;return t[31]!==c||t[32]!==C||t[33]!==g?(w=(0,Z.jsxs)(c,{children:[g,C]}),t[31]=c,t[32]=C,t[33]=g,t[34]=w):w=t[34],w}function ke(){let e=(0,L.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsx)(`style`,{children:`@keyframes keybindings-pulse {
2
2
  0%, 100% { box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15); }
3
3
  50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0.30); }
4
4
  }
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/main-BqSANuAs.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./index-BAJdq3TK.js";import{$l as n,ho as r}from"./runtime-OM-uAtaj.js";import{t as i}from"./react-CwJFpaho.js";import{t as a}from"./compiler-runtime-C4g8XhC5.js";var o={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};o.node;var s=r(o),c=a(),l=e(i(),1),u=n(),d=(0,l.lazy)(()=>t(()=>import(`./BrowserPanel-D-g_xDZs.js`).then(e=>({default:e.BrowserPanel})),__vite__mapDeps([0])));function f(e){let t=(0,c.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading browser…`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,u.jsx)(l.Suspense,{fallback:n,children:(0,u.jsx)(d,{...e})}),t[1]=e,t[2]=r),r}export{s as n,f as t};
2
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{t}from"./index-BqZvnGNr.js";import{$l as n,ho as r}from"./runtime-BwHA1GUS.js";import{t as i}from"./react-CwJFpaho.js";import{t as a}from"./compiler-runtime-C4g8XhC5.js";var o={name:`folder-open`,size:24,node:[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]};o.node;var s=r(o),c=a(),l=e(i(),1),u=n(),d=(0,l.lazy)(()=>t(()=>import(`./BrowserPanel-Dxw3stFP.js`).then(e=>({default:e.BrowserPanel})),__vite__mapDeps([0])));function f(e){let t=(0,c.c)(3),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`p`,{role:`status`,className:`p-4 text-sm text-muted-foreground`,children:`Loading browser…`}),t[0]=n):n=t[0];let r;return t[1]===e?r=t[2]:(r=(0,u.jsx)(l.Suspense,{fallback:n,children:(0,u.jsx)(d,{...e})}),t[1]=e,t[2]=r),r}export{s as n,f as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{S as t,x as n}from"./src-DHNjfMxR.js";import{$l as r,Fa as i,Kr as a,Ql as o,Qr as s,ei as c,ho as l,hr as u,oo as d,po as f,sr as p,uo as m}from"./runtime-OM-uAtaj.js";import{t as h}from"./react-CwJFpaho.js";import{Ct as g,Gt as _,Jt as v,Qt as y,Xt as b,Yt as x,Zt as S,dr as C,pr as w,qt as T,t as E}from"./switch-D9inWKdd.js";import{t as D}from"./compiler-runtime-C4g8XhC5.js";import{i as ee,n as te,t as ne}from"./tooltip-mwOCSCXF.js";import{a as O,c as k,n as A,o as j,s as M,t as N}from"./badge-BswOCwph.js";import{J as re,Z as P}from"./ContextHandoffEndpointLabel-BzI4Wi1i.js";import"./SettingsPanels.editor-64bM0lhg.js";import{t as F}from"./refresh-cw-K_hU8_ld.js";import{t as I}from"./save-Mh-PA_2P.js";import{t as L}from"./wrench-D79uBUSl.js";import{t as R}from"./toastHelpers-CSQRKo4F.js";import{t as z}from"./input-CzU08wbL.js";import{i as B}from"./providerDriverMeta-LJ2vJxm-.js";import{ut as V}from"./main-RFllWEko.js";var H={name:`earth`,size:24,node:[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]],aliases:[`globe-2`]};H.node;var ie=l(H),U={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]};U.node;var ae=l(U),W=e(h(),1),G=D(),K=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function q(){return{name:``,transport:`stdio`,command:``,argsText:``,cwd:``,url:``,bearerTokenEnvVar:``,envText:``,envVarsText:``,httpHeadersText:``,envHttpHeadersText:``,enabled:!0,required:!1,startupTimeoutSec:``,toolTimeoutSec:``,enabledToolsText:``,disabledToolsText:``,oauthScopesText:``,secretFields:[],clearedSecretFields:[]}}function J(e){return e.join(`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{S as t,x as n}from"./src-C3Y_imaX.js";import{$l as r,Fa as i,Kr as a,Ql as o,Qr as s,ei as c,ho as l,hr as u,oo as d,po as f,sr as p,uo as m}from"./runtime-BwHA1GUS.js";import{t as h}from"./react-CwJFpaho.js";import{Ct as g,Gt as _,Jt as v,Qt as y,Xt as b,Yt as x,Zt as S,dr as C,pr as w,qt as T,t as E}from"./switch-DnpJB2xv.js";import{t as D}from"./compiler-runtime-C4g8XhC5.js";import{i as ee,n as te,t as ne}from"./tooltip-BlweKBxc.js";import{a as O,c as k,n as A,o as j,s as M,t as N}from"./badge-2AZ3HfVS.js";import{J as re,Z as P}from"./ContextHandoffEndpointLabel-CeGDLNA4.js";import"./SettingsPanels.editor-Dkva9gX_.js";import{t as F}from"./refresh-cw-CgDa2Ok_.js";import{t as I}from"./save-C8h0AMdl.js";import{t as L}from"./wrench-7pbbxqrZ.js";import{t as R}from"./toastHelpers-CSQRKo4F.js";import{t as z}from"./input-BDWSVClC.js";import{i as B}from"./providerDriverMeta-T2YbXzuS.js";import{ut as V}from"./main-DAbEANjY.js";var H={name:`earth`,size:24,node:[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]],aliases:[`globe-2`]};H.node;var ie=l(H),U={name:`log-in`,size:24,node:[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]};U.node;var ae=l(U),W=e(h(),1),G=D(),K=/^[a-zA-Z][a-zA-Z0-9_-]*$/;function q(){return{name:``,transport:`stdio`,command:``,argsText:``,cwd:``,url:``,bearerTokenEnvVar:``,envText:``,envVarsText:``,httpHeadersText:``,envHttpHeadersText:``,enabled:!0,required:!1,startupTimeoutSec:``,toolTimeoutSec:``,enabledToolsText:``,disabledToolsText:``,oauthScopesText:``,secretFields:[],clearedSecretFields:[]}}function J(e){return e.join(`
2
2
  `)}function Y(e){return Object.entries(e).map(([e,t])=>`${e}=${t}`).join(`
3
3
  `)}function oe(e){let t=e.config;return{name:e.name,transport:t.transport===`http`?`http`:`stdio`,command:t.command??``,argsText:J(t.args),cwd:t.cwd??``,url:t.url??``,bearerTokenEnvVar:t.bearerTokenEnvVar??``,envText:Y(t.env),envVarsText:J(t.envVars),httpHeadersText:Y(t.httpHeaders),envHttpHeadersText:Y(t.envHttpHeaders),enabled:t.enabled,required:t.required??!1,startupTimeoutSec:t.startupTimeoutSec?.toString()??``,toolTimeoutSec:t.toolTimeoutSec?.toString()??``,enabledToolsText:J(t.enabledTools),disabledToolsText:J(t.disabledTools),oauthScopesText:J(t.oauthScopes),secretFields:Object.entries(t.secretFields??{}).filter(([,e])=>e===`present`).map(([e])=>e).toSorted(),clearedSecretFields:[]}}function se(e){return e.split(/\r?\n/).map(e=>e.trim()).filter(e=>e.length>0)}function ce(e){let t={};for(let n of se(e)){let e=n.indexOf(`=`);if(e<=0)continue;let r=n.slice(0,e).trim(),i=n.slice(e+1).trim();r.length>0&&(t[r]=i)}return t}function le(e){let t=e.trim();if(!t)return;let n=Number(t);return Number.isFinite(n)&&n>0?n:NaN}function ue(e){let t=e.name.trim();if(!K.test(t))return`Server name must start with a letter and use only letters, numbers, dashes, and underscores.`;if(e.transport===`stdio`&&e.command.trim().length===0)return`Stdio servers need a command.`;if(e.transport===`http`&&e.url.trim().length===0)return`HTTP servers need a URL.`;for(let[t,n]of[[`Startup timeout`,e.startupTimeoutSec],[`Tool timeout`,e.toolTimeoutSec]]){let e=le(n);if(Number.isNaN(e))return`${t} must be a positive number.`}return null}function de(e){let t=le(e.startupTimeoutSec),n=le(e.toolTimeoutSec);return{transport:e.transport,command:e.command.trim(),args:se(e.argsText),cwd:e.cwd.trim()||null,url:e.url.trim(),bearerTokenEnvVar:e.bearerTokenEnvVar.trim()||null,env:ce(e.envText),envVars:se(e.envVarsText),httpHeaders:ce(e.httpHeadersText),envHttpHeaders:ce(e.envHttpHeadersText),enabled:e.enabled,required:e.required,...t===void 0||Number.isNaN(t)?{}:{startupTimeoutSec:t},...n===void 0||Number.isNaN(n)?{}:{toolTimeoutSec:n},enabledTools:se(e.enabledToolsText),disabledTools:se(e.disabledToolsText),oauthScopes:se(e.oauthScopesText)}}function fe(e){return Object.fromEntries(e.secretFields.map(t=>[t,e.clearedSecretFields.includes(t)?{action:`clear`}:{action:`retain`}]))}function pe(e){let t=e.config;return t.transport===`http`?t.url||`HTTP`:t.transport===`stdio`?[t.command,...t.args].filter(Boolean).join(` `)||`stdio`:`Configured outside the known MCP schema`}var X=r(),me=[],he=[];function Z(e){if(!e)throw Error(`MCP settings are unavailable before a backend is paired.`);return e}function Q(e,t){a.add(R({type:`error`,title:e,description:t instanceof Error?t.message:`An error occurred.`}))}function ge(e){switch(e){case`user`:return`User config`;case`project`:return`Project`;case`system`:return`System`;case`managed`:return`Managed`;case`mixed`:return`Mixed`;case`unknown`:return`Unknown`}}function _e(e){return e.startupStatus===`failed`?`error`:e.startupStatus===`disabled`?`outline`:e.authStatus===`notLoggedIn`?`warning`:e.startupStatus===`ready`?`success`:`outline`}function ve(e){return e.startupStatus===`disabled`?`Disabled`:e.startupStatus===`failed`?`Failed`:e.authStatus===`notLoggedIn`?`Login needed`:e.startupStatus===`ready`?`Ready`:`Unknown`}function ye(e){return e.enabled?e.status===`managed`?`success`:e.status===`external`?`warning`:`outline`:`outline`}function be(e){if(!e.enabled)return`Disabled`;switch(e.status){case`managed`:return`Managed`;case`external`:return`External config`;case`unsupported`:return`Not wired`}}function xe(e){return e.displayName??B(e.driver)?.label??i(e.driver)}function Se(e){return e?e.providerDisplayName??B(e.driver)?.label??i(e.driver):`the provider`}function $(e){let t=(0,G.c)(5),n;t[0]===e.label?n=t[1]:(n=(0,X.jsx)(`span`,{children:e.label}),t[0]=e.label,t[1]=n);let r;return t[2]!==e.children||t[3]!==n?(r=(0,X.jsxs)(`label`,{className:`grid gap-1.5 text-xs font-medium text-foreground/80`,children:[n,e.children]}),t[2]=e.children,t[3]=n,t[4]=r):r=t[4],r}function Ce(e){let t=(0,G.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,X.jsx)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground/70`,children:n}),t[0]=n,t[1]=r),r}function we(e){let t=(0,G.c)(5),{value:n,onChange:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={value:`stdio`,label:`Stdio`,icon:C},t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=[i,{value:`http`,label:`HTTP`,icon:ie}],t[1]=a):a=t[1];let o;return t[2]!==r||t[3]!==n?(o=(0,X.jsx)(`div`,{className:`grid grid-cols-2 rounded-lg border bg-muted/30 p-1`,children:a.map(e=>{let t=e.icon,i=n===e.value;return(0,X.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),className:c(`flex h-8 items-center justify-center gap-2 rounded-md text-xs font-medium transition-colors`,i?`bg-background text-foreground shadow-xs`:`text-muted-foreground`),children:[(0,X.jsx)(t,{className:`size-3.5`}),e.label]},e.value)})}),t[2]=r,t[3]=n,t[4]=o):o=t[4],o}function Te({open:e,server:t,providerName:n,onOpenChange:r,onSubmit:i}){let[a,o]=(0,W.useState)(()=>q()),[c,l]=(0,W.useState)(null),[u,f]=(0,W.useState)(!1),p=t!==null;(0,W.useEffect)(()=>{e&&(o(t?oe(t):q()),l(null))},[e,t]);let m=(e,t)=>{o(n=>({...n,[e]:t}))},h=async()=>{let e=ue(a);if(e){l(e);return}f(!0);try{await i(a),r(!1)}catch(e){Q(`Failed to save MCP server`,e)}finally{f(!1)}};return(0,X.jsx)(_,{open:e,onOpenChange:r,children:(0,X.jsxs)(S,{className:`max-w-2xl`,bottomStickOnMobile:!1,children:[(0,X.jsxs)(x,{children:[(0,X.jsx)(y,{children:p?`Edit MCP server`:`Add MCP server`}),(0,X.jsxs)(T,{children:[`Configuration is written through `,n,`'s native MCP management surface. Existing secret values are never loaded into this form and are retained unless you enter replacements with the same keys.`]})]}),(0,X.jsxs)(b,{className:`space-y-5`,children:[(0,X.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-[1fr_12rem]`,children:[(0,X.jsx)($,{label:`Server name`,children:(0,X.jsx)(z,{value:a.name,disabled:p,onChange:e=>m(`name`,e.target.value),placeholder:`github`,spellCheck:!1})}),(0,X.jsx)($,{label:`Transport`,children:(0,X.jsx)(we,{value:a.transport,onChange:e=>m(`transport`,e)})})]}),a.transport===`stdio`?(0,X.jsxs)(`div`,{className:`grid gap-4`,children:[(0,X.jsx)($,{label:`Command`,children:(0,X.jsx)(z,{value:a.command,onChange:e=>m(`command`,e.target.value),placeholder:`npx`,spellCheck:!1})}),(0,X.jsxs)($,{label:`Arguments`,children:[(0,X.jsx)(g,{value:a.argsText,onChange:e=>m(`argsText`,e.target.value),placeholder:`-y
4
4
  @modelcontextprotocol/server-filesystem
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$c as t,$l as n,El as r,Es as i,Hs as a,Ic as o,Is as s,Kc as c,Ks as l,Ls as u,Nl as d,Ol as f,Pl as p,Qr as m,Rl as h,Rs as g,Vs as _,Xs as v,Zs as y,ao as b,bl as x,ds as S,ei as C,el as w,fl as ee,ml as T,ol as E,os as D,pl as O,tl as k,xl as A,zs as j}from"./runtime-OM-uAtaj.js";import{t as M}from"./react-CwJFpaho.js";import{t as N}from"./compiler-runtime-C4g8XhC5.js";import{a as P}from"./NullStore-b8PhjwPZ.js";import{p as F,s as I}from"./useScrollLock-BO185DkJ.js";import{i as L,n as R,o as z,s as B,t as te}from"./DialogViewport-BwuqbGLY.js";import{n as V,r as H,t as ne}from"./DialogTitle-Du7CAbaO.js";import{t as re}from"./useControlled-CgAAWIy9.js";import{t as ie}from"./GlassSurface-BlWIlQ0s.js";var U=e(M(),1),W=N(),G=120;function K(e){let t=e.replace(/\s+/gu,` `).trim();return t.length<=G?t:`${t.slice(0,119)}…`}var q=n();function J(e){let t=(0,W.c)(37),{label:n,icon:r,secondaryText:i,trailing:a,disabled:o,disabledReason:s,destructive:c,selected:l,onClick:u,className:d}=e,f=o!==void 0&&o,p=c!==void 0&&c,m=(0,U.useId)(),h;t[0]!==f||t[1]!==s?(h=f&&s?K(s):null,t[0]=f,t[1]=s,t[2]=h):h=t[2];let g=h,_=`${m}-label`,v=`${m}-secondary`,y=`${m}-trailing`,b=`${m}-reason`,x=i?v:null,S=a?y:null,w;t[3]!==_||t[4]!==x||t[5]!==S?(w=[_,x,S].filter(Y),t[3]=_,t[4]=x,t[5]=S,t[6]=w):w=t[6];let ee=w.join(` `),T=g?ee:void 0,E=g?b:void 0,D=p&&!f&&`text-destructive`,O=l&&`bg-accent/60 font-medium`,k;t[7]!==d||t[8]!==O||t[9]!==D?(k=C(`flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:text-muted-foreground/60`,D,O,d),t[7]=d,t[8]=O,t[9]=D,t[10]=k):k=t[10];let A;t[11]!==n||t[12]!==_?(A=(0,q.jsx)(`span`,{id:_,className:`truncate`,children:n}),t[11]=n,t[12]=_,t[13]=A):A=t[13];let j;t[14]!==v||t[15]!==i?(j=i?(0,q.jsx)(`span`,{id:v,className:`truncate text-xs text-muted-foreground`,children:i}):null,t[14]=v,t[15]=i,t[16]=j):j=t[16];let M;t[17]!==g||t[18]!==b?(M=g?(0,q.jsx)(`span`,{id:b,className:`truncate text-xs text-muted-foreground/80`,children:g}):null,t[17]=g,t[18]=b,t[19]=M):M=t[19];let N;t[20]!==A||t[21]!==j||t[22]!==M?(N=(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[A,j,M]}),t[20]=A,t[21]=j,t[22]=M,t[23]=N):N=t[23];let P;t[24]!==a||t[25]!==y?(P=a?(0,q.jsx)(`span`,{id:y,className:`flex shrink-0 items-center gap-2`,children:a}):null,t[24]=a,t[25]=y,t[26]=P):P=t[26];let F;return t[27]!==f||t[28]!==r||t[29]!==u||t[30]!==l||t[31]!==k||t[32]!==N||t[33]!==P||t[34]!==T||t[35]!==E?(F=(0,q.jsxs)(`button`,{type:`button`,disabled:f,"aria-labelledby":T,"aria-describedby":E,"aria-pressed":l,className:k,"data-slot":`mobile-list-row`,onClick:u,children:[r,N,P]}),t[27]=f,t[28]=r,t[29]=u,t[30]=l,t[31]=k,t[32]=N,t[33]=P,t[34]=T,t[35]=E,t[36]=F):F=t[36],F}function Y(e){return e!==null}var ae=`--nested-drawers`,oe=`--drawer-height`,se=`--drawer-frontmost-height`,ce=`--drawer-swipe-movement-x`,le=`--drawer-swipe-movement-y`,X=`--drawer-snap-point-offset`,ue=`--drawer-swipe-strength`,de=`--drawer-swipe-progress`,fe=U.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...s}=e,c=B(),l=c.useState(`open`),u=c.useState(`nested`),d=c.useState(`mounted`),f={open:l,transitionStatus:c.useState(`transitionStatus`)};return v(`div`,e,{state:f,ref:[c.context.backdropRef,t],stateAttributesMapping:o,props:[{role:`presentation`,hidden:!d,style:{pointerEvents:l?void 0:`none`,userSelect:`none`,WebkitUserSelect:`none`,[de]:`0`,[ue]:`1`}},s],enabled:a||!u})}),pe=H,me=`data-drawer-content`,he=U.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return B(),v(`div`,e,{ref:t,props:[{[me]:``},a]})}),ge=V,_e=U.createContext(void 0);function ve(){return U.useContext(_e)}var ye=`data-expanded`,be=`data-nested-drawer-open`,Z=`data-nested-drawer-swiping`,xe=`data-swipe-dismiss`,Se=`data-swipe-direction`,Ce=`data-swiping`,we=U.createContext(void 0);function Te(e){let t=U.useContext(we);if(e!==!0&&t===void 0)throw Error(d(90));return t}function Ee(e,t){let n=e+t;return n>=0?t:-Math.sqrt(-n)-e}function Q(e,t,n){if(!Number.isFinite(t)||t<=0)return null;if(typeof e==`number`)return Number.isFinite(e)?e<=1?_(e,0,1)*t:e:null;let r=e.trim();if(r.endsWith(`px`)){let e=Number.parseFloat(r);return Number.isFinite(e)?e:null}if(r.endsWith(`rem`)){let e=Number.parseFloat(r);return Number.isFinite(e)?e*n:null}return null}function De(e,t){let n=-1,r=1/0;for(let i=0;i<e.length;i+=1){let a=Math.abs(e[i]-t);a<r&&(r=a,n=i)}return n}function Oe(){let e=B(),{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:i}=Te(),a=e.useState(`viewportElement`),[o,s]=U.useState(0),[c,l]=U.useState(16),u=f(()=>{let e=T(a).documentElement;s(a?a.offsetHeight:e.clientHeight);let t=parseFloat(getComputedStyle(e).fontSize);Number.isFinite(t)&&l(t)});p(()=>{if(u(),!a||typeof ResizeObserver!=`function`)return;let e=new ResizeObserver(u);return e.observe(a),()=>{e.disconnect()}},[u,a]);let d=U.useMemo(()=>{if(!t||t.length===0||o<=0||i<=0)return[];let e=Math.min(i,o),n=t.map(t=>{let n=Q(t,o,c);if(n===null)return null;let r=_(n,0,e);return{value:t,height:r,offset:Math.max(0,i-r)}}).filter(e=>!!e);if(n.length<=1)return n;let r=[],a=[];for(let e=n.length-1;e>=0;--e){let t=n[e];a.some(e=>Math.abs(e-t.height)<=1)||(a.push(t.height),r.push(t))}return r.reverse(),r},[i,c,t,o]);return{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:i,viewportHeight:o,resolvedSnapPoints:d,activeSnapPointOffset:U.useMemo(()=>{if(n===null)return;let e=d.find(e=>Object.is(e.value,n));if(e)return e;let t=Math.min(i,o),r=Q(n,o,c);if(r===null)return;let a=_(r,0,t);return d[De(d.map(e=>e.height),a)]},[n,i,d,c,o])?.offset??null}}var ke=U.createContext(null);function Ae(){return U.useContext(ke)}var je=!1;function Me(){je||=(typeof CSS<`u`&&`registerProperty`in CSS&&([ce,le,X].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),[{name:de,initialValue:`0`},{name:ue,initialValue:`1`}].forEach(({name:e,initialValue:t})=>{try{CSS.registerProperty({name:e,syntax:`<number>`,inherits:!1,initialValue:t})}catch{}})),!0)}var Ne={...o,expanded(e){return e?{[ye]:``}:null},nestedDrawerOpen(e){return e?{[be]:``}:null},nestedDrawerSwiping(e){return e?{[Z]:``}:null},swipeDirection(e){return{[Se]:e}},swiping(e){return e?{[Ce]:``}:null}},$=U.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=B(),u=c.context.popupRef,{swipeDirection:d,frontmostHeight:m,hasNestedDrawer:g,nestedSwiping:_,nestedSwipeProgressStore:y,onPopupHeightChange:b,notifyParentFrontmostHeight:x,notifyParentHasNestedDrawer:S}=Te(),C=c.useState(`descriptionElementId`),w=c.useState(`disablePointerDismissal`),ee=c.useState(`floatingRootContext`),T=c.useState(`popupProps`),E=c.useState(`modal`),D=c.useState(`mounted`),O=c.useState(`nested`),k=c.useState(`nestedOpenDrawerCount`),A=c.useState(`transitionStatus`),j=c.useState(`open`),M=c.useState(`openMethod`),N=c.useState(`titleElementId`),L=c.useState(`role`),R=ee.useState(`floatingId`),te=s.id??R,V=Ae();z();let{snapPoints:H,activeSnapPoint:ne,activeSnapPointOffset:re}=Oe(),ie=k>0,W=V?.swiping??!1,G=V?.swipeStrength??null,[K,J]=U.useState(0),Y=U.useRef(0),ce=f(()=>{let e=u.current;if(!e)return;let t=e.offsetHeight;if(Y.current>0&&m>Y.current&&t>Y.current)return;if(Y.current>0&&g){let e=Y.current;J(e),b(e);return}let n=t;n!==Y.current&&(Y.current=n,J(n),b(n))});p(()=>{if(!D){Y.current=0,J(0),b(0);return}let e=u.current;if(!e||(Me(),ce(),typeof ResizeObserver!=`function`))return;let t=new ResizeObserver(ce);return t.observe(e),()=>{t.disconnect()}},[ce,D,ie,b,u]),p(()=>{let e=()=>{let e=u.current;if(!e)return;let t=y.getSnapshot();t>0?e.style.setProperty(de,`${t}`):e.style.setProperty(de,`0`)};e();let t=y.subscribe(e),n=u.current;return()=>{t(),n&&n.style.setProperty(de,`0`)}},[y,u]),p(()=>{if(j)return x?.(m),()=>{x?.(0)}},[m,j,x]),p(()=>{if(S)return S(j||A===`ending`),()=>{S(!1)}},[S,j,A]),l({open:j,ref:u,onComplete(){j&&c.context.onOpenChangeComplete?.(!0)}});let fe=o===void 0?u:o,pe=c.useStateSetter(`popupElement`),me={open:j,nested:O,transitionStatus:A,expanded:ne===1,nestedDrawerOpen:ie,nestedDrawerSwiping:_,swipeDirection:d,swiping:W},he;K&&(g||A===`ending`)&&(he=`${K}px`);let ge=H&&H.length>0&&(d===`down`||d===`up`),_e=null;ge&&re!==null&&(_e=d===`up`?-re:re);let ve=V?V.getDragStyles():h;if(ge&&d===`down`){let e=re??0,t=Number.parseFloat(String(ve[le]));ve=W&&Number.isFinite(t)?{...ve,transform:void 0,[le]:`${Ee(e,t)}px`}:{...ve,transform:void 0}}let ye=v(`div`,e,{state:me,props:[T,{id:te,"aria-labelledby":N,"aria-describedby":C,role:L,...P,hidden:!D,onKeyDown(e){I.has(e.key)&&e.stopPropagation()},style:{...ve,[de]:`0`,[ae]:k,[oe]:he,[X]:typeof _e==`number`?`${_e}px`:`0px`,[se]:m?`${m}px`:void 0,[ue]:typeof G==`number`&&Number.isFinite(G)&&G>0?`${G}`:`1`}},s],ref:[t,u,pe],stateAttributesMapping:Ne});return(0,q.jsx)(F,{context:ee,openInteractionType:M,disabled:!D,closeOnFocusOut:!w,initialFocus:fe,returnFocus:a,modal:E!==!1,restoreFocus:`popup`,children:ye})}),Pe=L,Fe,Ie;function Le(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null,swipeDirection:p=`down`,snapToSequentialPoints:m=!1,snapPoints:h,snapPoint:g,defaultSnapPoint:_,onSnapPointChange:v}=e,y=Te(!0),b=y?.onNestedSwipeProgressChange,x=y?.onNestedFrontmostHeightChange,S=y?.onNestedSwipingChange,C=y?.onNestedDrawerPresenceChange,[w,ee]=U.useState(0),[T,E]=U.useState(0),[O,k]=U.useState(!1),[A,j]=U.useState(!1),[M]=U.useState(Re),N=_===void 0?h?.[0]??null:_,P=g!==void 0,[F,I]=re({controlled:g,default:N,name:`Drawer`,state:`snapPoint`}),L=U.useRef(!1),z=U.useRef(!1),B=f((e,t)=>{let n=t??D(`none`);v?.(e,n),!n.isCanceled&&I(e)}),te=U.useMemo(()=>P||!h||h.length===0?F:F===null||!h.some(e=>Object.is(e,F))?N:F,[F,P,N,h]),V=f(e=>{ee(e),!L.current&&e>0&&E(e)}),H=f(e=>{if(e>0){L.current=!0,E(e);return}L.current=!1,w>0&&E(w)}),ne=f(e=>{k(e)}),ie=f(e=>{M.set(e),b?.(e)}),W=f(e=>{j(e),S?.(e)}),G=f((e,t)=>{i?.(e,t),!t.isCanceled&&!e&&h&&h.length>0&&B(N,D(t.reason,t.event,t.trigger))}),K=U.useMemo(()=>({swipeDirection:p,swipeAreaActiveRef:z,snapToSequentialPoints:m,snapPoints:h,activeSnapPoint:te,setActiveSnapPoint:B,frontmostHeight:T,popupHeight:w,hasNestedDrawer:O,nestedSwiping:A,nestedSwipeProgressStore:M,onNestedDrawerPresenceChange:ne,onPopupHeightChange:V,onNestedFrontmostHeightChange:H,onNestedSwipingChange:W,onNestedSwipeProgressChange:ie,notifyParentFrontmostHeight:x,notifyParentSwipingChange:S,notifyParentSwipeProgressChange:b,notifyParentHasNestedDrawer:C}),[te,T,O,A,M,C,b,S,x,ne,H,ie,W,V,w,B,h,m,z,p]),J=typeof t==`function`?e=>(0,q.jsxs)(U.Fragment,{children:[Fe||=(0,q.jsx)(ze,{}),t(e)]}):(0,q.jsxs)(U.Fragment,{children:[Ie||=(0,q.jsx)(ze,{}),t]}),Y=R(`drawer`,{open:n,defaultOpen:r,onOpenChange:G,onOpenChangeComplete:a,disablePointerDismissal:o,modal:s,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d,children:J});return(0,q.jsx)(we.Provider,{value:K,children:Y})}function Re(){let e=0,t=new Set;return{getSnapshot:()=>e,set(n){let r=Number.isFinite(n)?n:0;r!==e&&(e=r,t.forEach(e=>{e()}))},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function ze(){let e=ve(),t=B(!1),n=e?.setDrawerOpen,r=e?.removeDrawer,i=t.useState(`open`),a=t.useState(`nestedOpenDialogCount`),o=t.useState(`popupElement`),s=a===0;return p(()=>{if(r)return()=>{r(t)}},[r,t]),p(()=>{n?.(t,i)},[i,n,t]),U.useEffect(()=>{if(!i||!s||!E)return;let e=x(o).CloseWatcher;if(!e)return;function n(e){t.select(`open`)&&t.setOpen(!1,D(S,e))}let r=new e,a=O(r,`close`,n);return()=>{a(),r.destroy()}},[t,s,i,o]),null}var Be=ne,Ve=e(r(),1),He=`data-nested-dialog-open`,Ue=U.createContext(void 0);function We(){return U.useContext(Ue)}var Ge=10,Ke=.5,qe=.5,Je=300,Ye=4,Xe=.2,Ze=4,Qe=80,$e=360,et=.1,tt=6,nt=2,rt=`[${me}]`,it=U.forwardRef(function(e,t){let{render:n,className:r,style:a,children:o,...l}=e,d=B(),m=d.context.popupRef,h=d.context.backdropRef,{swipeDirection:v,notifyParentSwipingChange:b,notifyParentSwipeProgressChange:x,frontmostHeight:S,snapToSequentialPoints:C,swipeAreaActiveRef:E}=Te(),M=ve(),{snapPoints:N,resolvedSnapPoints:P,activeSnapPoint:F,activeSnapPointOffset:I,setActiveSnapPoint:L,popupHeight:R}=Oe(),z=d.useState(`open`),V=d.useState(`mounted`),H=d.useState(`nested`),ne=d.useState(`nestedOpenDrawerCount`),re=d.useState(`viewportElement`),ie=d.useState(`popupElement`),W=M?.visualStateStore,G=ne>0,K=v===`left`||v===`right`?`horizontal`:`vertical`,J=K===`vertical`,Y=J?`horizontal`:`vertical`,[ae,se]=U.useState(null),X=U.useRef(void 0),ue=U.useRef(null),fe=ee(),pe=U.useRef(!1),me=U.useRef(!1),he=U.useRef(``),ge=U.useRef(!1),_e=U.useRef(!1),ye=U.useRef(null),be=We(),Z=U.useMemo(()=>{if(!N||N.length<2||P.length<2||v!==`down`&&v!==`up`)return null;let e=P.map(e=>e.offset).sort((e,t)=>e-t),t=e[0];return{minOffset:t,range:e[1]-t}},[P,N,v]),Se=U.useMemo(()=>!Z||I===null?null:_((I-Z.minOffset)/Z.range,0,1),[I,Z]),Ce=U.useMemo(()=>N&&N.length>0&&(v===`down`||v===`up`)?v===`down`?[`down`,`up`]:[`up`,`down`]:[v],[N,v]),we=f(e=>{m.current?.toggleAttribute(xe,e),h.current?.toggleAttribute(xe,e)}),Q=f(()=>{we(!1),m.current?.removeAttribute(c),se(null)}),Ae=f(()=>{me.current&&(me.current=!1,b?.(!1))}),je=f((e,t,n)=>{let r=z&&!H&&t,i=r?e:0,a=z&&t?e:0;n&&x&&(x(a),a<=0&&Ae()),W?.set({swipeProgress:i,frontmostHeight:i>0?S:0});let o=h.current;if(!o)return;let s=r&&i>0;o.style.setProperty(de,s?`${i}`:`0`),s&&S>0?o.style.setProperty(oe,`${S}px`):o.style.removeProperty(oe)});function Me(e,t,n,r,i,a,o,c){let l=ct(e,t);if(l<=0)return null;let u=((t===`down`||t===`up`)&&N&&N.length>0?I??0:0)+s(t,n,r),d=Math.max(0,l-u);if(d<=0)return null;let f=s(t,o,c),p=Math.abs(f)>0?f:s(t,i,a);if(p<=Xe)return null;let m=_(p,Xe,Ze);return et+(_(d/m,Qe,$e)-Qe)/280*.9}function Ne(e){if(me.current||!e)return;let t=e.direction??v,n=s(t,e.deltaX,e.deltaY);Math.abs(n)<Ge||(me.current=!0,b?.(!0))}let $=u({enabled:V&&!G,directions:Ce,elementRef:d.context.popupRef,ignoreSelectorWhenTouch:!1,ignoreScrollableAncestors:!0,movementCssVars:{x:ce,y:le},onSwipeStart(e){if(`touches`in e||e.pointerType===`touch`)return;let t=m.current,n=T(t).getSelection?.();if(!n||n.isCollapsed)return;let r=A(n.anchorNode)?n.anchorNode:n.anchorNode?.parentElement,i=A(n.focusNode)?n.focusNode:n.focusNode?.parentElement;(w(t,r)||w(t,i))&&n.removeAllRanges()},onSwipingChange(e){pe.current=e,at(d.context.backdropRef.current,e),!e&&!x&&Ae()},swipeThreshold({element:e,direction:t}){return lt(e,t)},canStart(e,t){let n=d.context.popupRef.current;if(!n)return!1;let r=n.ownerDocument,i=g(n.getRootNode(),e.x,e.y);if(!i||!w(n,i))return!1;let a=t.nativeEvent;return!((`touches`in a||a.pointerType===`touch`)&&pt(r,n))},onProgress(e,t){let n=pe.current;n&&Ne(t);let r=!!(N&&N.length>0);if(n&&v===`down`&&r&&t){let e=d.context.popupRef.current;e&&(e.style.removeProperty(`transform`),e.style.setProperty(le,`${Ee(I??0,t.deltaY)}px`))}let i=e;if(Z&&R>0){let e=I??Z.minOffset;n&&t&&Number.isFinite(t.deltaY)?i=(e=>_((e-Z.minOffset)/Z.range,0,1))(_(e+t.deltaY,0,R)):Se!==null&&(i=Se)}n||(x?.(0),Ae()),je(i,!0,n)},onRelease({event:e,deltaX:t,deltaY:n,direction:r,velocityX:a,velocityY:o,releaseVelocityX:l,releaseVelocityY:u}){let f=d.context.popupRef.current;if(!f){Q();return}let p=f;function m(e){Ae(),we(!0),p.style.removeProperty(`transition`),p.setAttribute(c,``),Ve.flushSync(()=>{se(Me(p,e,t,n,a,o,l,u))})}if(!N||N.length===0){if(!r){Q();return}let e=s(r,t,n);if(e<=0)return Q(),!1;if(s(r,a,o)>=Ke)return m(r),!0;let i=e>lt(p,r);return i?m(r):Q(),i}if(v!==`down`&&v!==`up`){Q();return}if(!R)return Q(),!1;if(P.length===0){Q();return}let h=v===`down`?n:-n,g=Math.sign(h),y=v===`down`?u:-u,b=v===`down`?o:-o,x=y;if(g!==0&&Math.abs(h)>=Ge){let e=Math.sign(x);e!==0&&e!==g&&(x=b)}let S=I??0,w=_(S+h,0,R),ee=Math.abs(x)>=qe?_(x,-4,Ye)*Je:0,T=C?w:_(w+ee,0,R),E=D(i,e),O=()=>(je(0,!0,!0),Q(),!1),k=e=>(L(e.value,E),O()),A=e=>r?(L(null,E),E.isCanceled?O():(X.current=F,m(v),!0)):k(e);if(C){let e=[...P].sort((e,t)=>e.offset-t.offset),t=e.map(e=>e.offset),n=De(t,S),r=e[De(t,T)],i=Math.sign(x),a=g!==0&&i!==0&&i===g&&Math.abs(x)>=qe,o=T;if(a){let t=_(n+g,0,e.length-1);if(t!==n){let n=e[t];(g>0?T<n.offset:T>n.offset)&&(r=n,o=n.offset)}else if(g>0)return A(r)}return Math.abs(o-R)<Math.abs(o-r.offset)?A(r):k(r)}let j=P[De(P.map(e=>e.offset),T)];return x>=Ke&&h>0||Math.abs(T-R)<Math.abs(T-j.offset)?A(j):k(j)},onDismiss(e){W?.set({swipeProgress:0,frontmostHeight:0});let t=d.context.backdropRef.current;t&&(t.style.setProperty(de,`0`),t.style.removeProperty(oe));let n=D(i,e);if(d.setOpen(!1,n),n.isCanceled){let t=X.current;t!==void 0&&L(t,D(i,e)),X.current=void 0,ue.current?.(),Q();return}if(d.select(`open`)){let t=e;fe.request(()=>{if(d.select(`open`)){let e=X.current;e!==void 0&&L(e,D(i,t)),X.current=void 0,Q(),ue.current?.()}else X.current=void 0});return}X.current=void 0,we(!0)}}),Pe=$.getPointerProps(),Fe=$.getTouchProps(),{moveNative:Ie,reset:Le}=$;ue.current=Le,U.useEffect(()=>{let e=re??ie;if(!e)return;let t=e,n=T(t);function r(e,r,i){let a=J?i.clientY-r.lastY:i.clientX-r.lastX;if(e.touches.length===2||pt(n,t)||!z||!V||G||_t(r,e,i,J))return;let o=r.scrollTarget;if(!o||o===n.documentElement||o===n.body){e.cancelable&&e.preventDefault(),e.stopPropagation(),Ie(e,t);return}if(!vt(o,K)){e.cancelable&&e.preventDefault(),e.stopPropagation();return}if(a!==0){let t=xt(o,K,v,a);r.allowSwipe?e.cancelable&&e.preventDefault():e.cancelable&&t?(r.allowSwipe=!0,e.preventDefault()):r.allowSwipe=!1}r.allowSwipe===!0&&(e.stopPropagation(),Ie(e,t))}function i(e){if(be?.onTouchMove(e),_e.current)return;let t=ye.current,n=e.touches[0];n&&t&&(r(e,t,n),gt(t,n))}return O(n,`touchmove`,i,{passive:!1,capture:!0})},[V,G,z,ie,J,K,v,Ie,re,be]),p(()=>{Z&&!$.swiping&&je(!z||H?0:Se??0,!0,!1)},[je,S,H,x,z,Se,Z,$.swiping,d,W]),p(()=>{if(x)return z||x(0),()=>{x(0)}},[x,z]),p(()=>{z&&(E.current||Le(),Q())},[Q,z,Le,E]),p(()=>{let e=h.current;return()=>{W?.set({swipeProgress:0,frontmostHeight:0}),at(e,!1);let t=h.current;t!==e&&at(t,!1),Ae()}},[h,Ae,W]);let Re=U.useMemo(()=>({swiping:$.swiping,getDragStyles:$.getDragStyles,swipeStrength:ae??null,setSwipeDismissed:we}),[we,$.getDragStyles,$.swiping,ae]);function ze(e){_e.current=e,ye.current=null}function Be(){ze(!1),he.current=``,ge.current=!1}function Ue(e){return he.current=``,e.pointerType!==`touch`}return(0,q.jsx)(te,{ref:t,className:r,style:a,render:n,...y(l,{onPointerDown(e){if(he.current=e.pointerType,ge.current=e.pointerType===`pen`,!z||!V||G)return;let t=g(e.currentTarget.getRootNode(),e.clientX,e.clientY);ot(t)||st(t)||e.pointerType!==`touch`&&Pe.onPointerDown?.(e)},onPointerMove(e){e.pointerType!==`touch`&&Pe.onPointerMove?.(e)},onPointerUp(e){Ue(e)&&Pe.onPointerUp?.(e)},onPointerCancel(e){Ue(e)&&Pe.onPointerCancel?.(e)},onTouchStart(e){if(he.current===`pen`&&ge.current){ge.current=!1,ze(!1);return}if(!z||!V||G){ze(!1);return}let t=e.touches[0];if(!t)return;if(ht(e)){ze(!1);return}let n=e.currentTarget,r=g(n.getRootNode(),t.clientX,t.clientY),i=k(e.nativeEvent),a=A(i)?i:n;if(!w(n,a)){ze(!0);return}if(be?.onTouchStart(e),ot(r)){ze(!0);return}_e.current=!1;let o=j(a,n,K),s=j(a,n,Y)!=null,c=null;o&&(c=bt(o,K,v)?null:!1),ye.current={startX:t.clientX,startY:t.clientY,lastX:t.clientX,lastY:t.clientY,scrollTarget:o,hasCrossAxisScrollableContent:s,allowSwipe:c,preserveNativeCrossAxisScroll:!1,drawerAxisAttributed:!1},Fe.onTouchStart?.(e)},onTouchEnd(e){be?.onTouchEnd(e),Be(),Fe.onTouchEnd?.(e)},onTouchCancel(e){be?.onTouchCancel(),Be(),Fe.onTouchCancel?.(e)},[He]:void 0}),children:(0,q.jsx)(ke.Provider,{value:Re,children:o})})});function at(e,t){e?.toggleAttribute(Ce,t)}function ot(e){return!!e?.closest(a)}function st(e){return!!e?.closest(rt)}function ct(e,t){return t===`left`||t===`right`?e.offsetWidth:e.offsetHeight}function lt(e,t){return Math.max(ct(e,t)*.5,Ge)}function ut(e,t){return e instanceof t.HTMLInputElement&&e.type===`range`}function dt(e){return e.tagName===`INPUT`||e.tagName===`TEXTAREA`}function ft(e,t){let n=A(e.anchorNode)?e.anchorNode:e.anchorNode?.parentElement,r=A(e.focusNode)?e.focusNode:e.focusNode?.parentElement;return e.containsNode(t,!0)||w(t,n)||w(t,r)}function pt(e,n){let r=t(e);if(r&&w(n,r)&&dt(r)){let{selectionStart:e,selectionEnd:t}=r;if(e!=null&&t!=null&&e<t)return!0}let i=e.getSelection?.();return!i||i.isCollapsed?!1:ft(i,n)}function mt(e,t){return e.composedPath().some(e=>ut(e,t))}function ht(e){return mt(e.nativeEvent,x(e.currentTarget))}function gt(e,t){e.lastX=t.clientX,e.lastY=t.clientY}function _t(e,t,n,r){if(e.preserveNativeCrossAxisScroll)return!0;if(e.drawerAxisAttributed||e.allowSwipe===!0||!e.hasCrossAxisScrollableContent)return!1;if(!t.cancelable)return e.preserveNativeCrossAxisScroll=!0,!0;let i=r?n.clientY-e.startY:n.clientX-e.startX,a=r?n.clientX-e.startX:n.clientY-e.startY,o=Math.abs(i),s=Math.abs(a);return s>=tt&&s>o+nt?(e.preserveNativeCrossAxisScroll=!0,!0):o>=tt?(e.drawerAxisAttributed=!0,!1):!0}function vt(e,t){return yt(e,t).max>0}function yt(e,t){if(t===`vertical`){let t=Math.max(0,e.scrollHeight-e.clientHeight);return{offset:e.scrollTop,max:t}}let n=Math.max(0,e.scrollWidth-e.clientWidth);return{offset:e.scrollLeft,max:n}}function bt(e,t,n){let r=St(n,t),{offset:i,max:a}=yt(e,t);return r?i<=0:i>=a}function xt(e,t,n,r){return(St(n,t)?r>0:r<0)&&bt(e,t,n)}function St(e,t){return t===`vertical`?e===`down`:e===`right`}var Ct=.5,wt=1,Tt=[Ct,wt];function Et(e){return e===`medium`?Ct:wt}function Dt(e){return e==null?null:e===Ct?`medium`:`large`}function Ot(e){let t=(0,W.c)(23),{open:n,onOpenChange:r,label:i,detent:a,onDetentChange:o,activeDetent:s,className:c,children:l}=e,u=a===void 0?`large`:a,d;t[0]===u?d=t[1]:(d=Et(u),t[0]=u,t[1]=d);let f;t[2]===s?f=t[3]:(f=s===void 0?{}:{snapPoint:s===null?null:Et(s)},t[2]=s,t[3]=f);let p;t[4]===o?p=t[5]:(p=e=>o?.(Dt(e)),t[4]=o,t[5]=p);let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,q.jsx)(fe,{className:C(`app-sheet-backdrop fixed inset-0 z-50 backdrop-blur-sm`,`transition-opacity duration-[var(--app-motion-duration-sheet)] ease-[var(--app-motion-ease)] data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none`),"data-slot":`mobile-sheet-backdrop`}),t[6]=h):h=t[6];let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=C(`pointer-events-auto fixed inset-0 z-50 flex flex-col justify-end pt-12`,`pb-[var(--app-keyboard-inset,0px)]`),t[7]=g):g=t[7];let _;t[8]===c?_=t[9]:(_=C(ie(`sheet`),`pointer-events-auto flex max-h-full min-h-0 w-full min-w-0 flex-col rounded-t-2xl border-t not-dark:bg-clip-padding text-popover-foreground shadow-lg/5`,`pb-safe pl-safe pr-safe`,`translate-y-[calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px))] data-ending-style:translate-y-full data-starting-style:translate-y-full`,`transition-[translate,scale] duration-[var(--app-motion-duration-sheet)] ease-[var(--app-motion-ease)] will-change-transform motion-reduce:transition-none`,`data-nested-drawer-open:scale-96`,c),t[8]=c,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,q.jsx)(`span`,{"aria-hidden":!0,className:`mx-auto mt-2 mb-1 h-1 w-9 shrink-0 rounded-full bg-muted-foreground/32`,"data-slot":`mobile-sheet-grabber`}),t[10]=v):v=t[10];let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,q.jsx)(pe,{"aria-label":`Close`,className:`absolute end-2 top-2 z-20`,"data-slot":`mobile-sheet-close`,render:(0,q.jsx)(m,{size:`icon`,variant:`ghost`}),children:(0,q.jsx)(b,{})}),t[11]=y):y=t[11];let x;t[12]!==l||t[13]!==i||t[14]!==_?(x=(0,q.jsxs)(Pe,{children:[h,(0,q.jsx)(it,{className:g,"data-slot":`mobile-sheet-viewport`,children:(0,q.jsxs)($,{"aria-label":i,className:_,"data-slot":`sheet-popup`,"data-mobile-sheet":``,onKeyDown:kt,children:[v,l,y]})})]}),t[12]=l,t[13]=i,t[14]=_,t[15]=x):x=t[15];let S;return t[16]!==r||t[17]!==n||t[18]!==x||t[19]!==d||t[20]!==f||t[21]!==p?(S=(0,q.jsx)(Le,{open:n,onOpenChange:r,swipeDirection:`down`,snapPoints:Tt,defaultSnapPoint:d,...f,onSnapPointChange:p,children:x}),t[16]=r,t[17]=n,t[18]=x,t[19]=d,t[20]=f,t[21]=p,t[22]=S):S=t[22],S}function kt(e){e.stopPropagation()}function At(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=C(`flex shrink-0 flex-col gap-1 px-4 pt-2 pe-11 pb-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(`div`,{className:i,"data-slot":`mobile-sheet-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=C(`truncate font-heading font-semibold text-base leading-tight`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(Be,{className:i,"data-slot":`mobile-sheet-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=C(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(ge,{className:i,"data-slot":`mobile-sheet-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=C(`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pb-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(he,{className:i,"data-slot":`mobile-sheet-panel`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=C(`flex shrink-0 flex-col-reverse gap-2 px-4 pt-3 pb-2 sm:flex-row`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(`div`,{className:i,"data-slot":`mobile-sheet-footer`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}export{Nt as a,K as c,At as i,Mt as n,jt as o,Pt as r,J as s,Ot as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{$c as t,$l as n,El as r,Es as i,Hs as a,Ic as o,Is as s,Kc as c,Ks as l,Ls as u,Nl as d,Ol as f,Pl as p,Qr as m,Rl as h,Rs as g,Vs as _,Xs as v,Zs as y,ao as b,bl as x,ds as S,ei as C,el as w,fl as ee,ml as T,ol as E,os as D,pl as O,tl as k,xl as A,zs as j}from"./runtime-BwHA1GUS.js";import{t as M}from"./react-CwJFpaho.js";import{t as N}from"./compiler-runtime-C4g8XhC5.js";import{a as P}from"./NullStore-8d2s-Re3.js";import{p as F,s as I}from"./useScrollLock-BbKeKZdj.js";import{i as L,n as R,o as z,s as B,t as te}from"./DialogViewport-B6w_ROOE.js";import{n as V,r as H,t as ne}from"./DialogTitle-B_Q4DykI.js";import{t as re}from"./useControlled-CgAAWIy9.js";import{t as ie}from"./GlassSurface-DDG4eTlj.js";var U=e(M(),1),W=N(),G=120;function K(e){let t=e.replace(/\s+/gu,` `).trim();return t.length<=G?t:`${t.slice(0,119)}…`}var q=n();function J(e){let t=(0,W.c)(37),{label:n,icon:r,secondaryText:i,trailing:a,disabled:o,disabledReason:s,destructive:c,selected:l,onClick:u,className:d}=e,f=o!==void 0&&o,p=c!==void 0&&c,m=(0,U.useId)(),h;t[0]!==f||t[1]!==s?(h=f&&s?K(s):null,t[0]=f,t[1]=s,t[2]=h):h=t[2];let g=h,_=`${m}-label`,v=`${m}-secondary`,y=`${m}-trailing`,b=`${m}-reason`,x=i?v:null,S=a?y:null,w;t[3]!==_||t[4]!==x||t[5]!==S?(w=[_,x,S].filter(Y),t[3]=_,t[4]=x,t[5]=S,t[6]=w):w=t[6];let ee=w.join(` `),T=g?ee:void 0,E=g?b:void 0,D=p&&!f&&`text-destructive`,O=l&&`bg-accent/60 font-medium`,k;t[7]!==d||t[8]!==O||t[9]!==D?(k=C(`flex min-h-11 w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:text-muted-foreground/60`,D,O,d),t[7]=d,t[8]=O,t[9]=D,t[10]=k):k=t[10];let A;t[11]!==n||t[12]!==_?(A=(0,q.jsx)(`span`,{id:_,className:`truncate`,children:n}),t[11]=n,t[12]=_,t[13]=A):A=t[13];let j;t[14]!==v||t[15]!==i?(j=i?(0,q.jsx)(`span`,{id:v,className:`truncate text-xs text-muted-foreground`,children:i}):null,t[14]=v,t[15]=i,t[16]=j):j=t[16];let M;t[17]!==g||t[18]!==b?(M=g?(0,q.jsx)(`span`,{id:b,className:`truncate text-xs text-muted-foreground/80`,children:g}):null,t[17]=g,t[18]=b,t[19]=M):M=t[19];let N;t[20]!==A||t[21]!==j||t[22]!==M?(N=(0,q.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[A,j,M]}),t[20]=A,t[21]=j,t[22]=M,t[23]=N):N=t[23];let P;t[24]!==a||t[25]!==y?(P=a?(0,q.jsx)(`span`,{id:y,className:`flex shrink-0 items-center gap-2`,children:a}):null,t[24]=a,t[25]=y,t[26]=P):P=t[26];let F;return t[27]!==f||t[28]!==r||t[29]!==u||t[30]!==l||t[31]!==k||t[32]!==N||t[33]!==P||t[34]!==T||t[35]!==E?(F=(0,q.jsxs)(`button`,{type:`button`,disabled:f,"aria-labelledby":T,"aria-describedby":E,"aria-pressed":l,className:k,"data-slot":`mobile-list-row`,onClick:u,children:[r,N,P]}),t[27]=f,t[28]=r,t[29]=u,t[30]=l,t[31]=k,t[32]=N,t[33]=P,t[34]=T,t[35]=E,t[36]=F):F=t[36],F}function Y(e){return e!==null}var ae=`--nested-drawers`,oe=`--drawer-height`,se=`--drawer-frontmost-height`,ce=`--drawer-swipe-movement-x`,le=`--drawer-swipe-movement-y`,X=`--drawer-snap-point-offset`,ue=`--drawer-swipe-strength`,de=`--drawer-swipe-progress`,fe=U.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...s}=e,c=B(),l=c.useState(`open`),u=c.useState(`nested`),d=c.useState(`mounted`),f={open:l,transitionStatus:c.useState(`transitionStatus`)};return v(`div`,e,{state:f,ref:[c.context.backdropRef,t],stateAttributesMapping:o,props:[{role:`presentation`,hidden:!d,style:{pointerEvents:l?void 0:`none`,userSelect:`none`,WebkitUserSelect:`none`,[de]:`0`,[ue]:`1`}},s],enabled:a||!u})}),pe=H,me=`data-drawer-content`,he=U.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return B(),v(`div`,e,{ref:t,props:[{[me]:``},a]})}),ge=V,_e=U.createContext(void 0);function ve(){return U.useContext(_e)}var ye=`data-expanded`,be=`data-nested-drawer-open`,Z=`data-nested-drawer-swiping`,xe=`data-swipe-dismiss`,Se=`data-swipe-direction`,Ce=`data-swiping`,we=U.createContext(void 0);function Te(e){let t=U.useContext(we);if(e!==!0&&t===void 0)throw Error(d(90));return t}function Ee(e,t){let n=e+t;return n>=0?t:-Math.sqrt(-n)-e}function Q(e,t,n){if(!Number.isFinite(t)||t<=0)return null;if(typeof e==`number`)return Number.isFinite(e)?e<=1?_(e,0,1)*t:e:null;let r=e.trim();if(r.endsWith(`px`)){let e=Number.parseFloat(r);return Number.isFinite(e)?e:null}if(r.endsWith(`rem`)){let e=Number.parseFloat(r);return Number.isFinite(e)?e*n:null}return null}function De(e,t){let n=-1,r=1/0;for(let i=0;i<e.length;i+=1){let a=Math.abs(e[i]-t);a<r&&(r=a,n=i)}return n}function Oe(){let e=B(),{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:i}=Te(),a=e.useState(`viewportElement`),[o,s]=U.useState(0),[c,l]=U.useState(16),u=f(()=>{let e=T(a).documentElement;s(a?a.offsetHeight:e.clientHeight);let t=parseFloat(getComputedStyle(e).fontSize);Number.isFinite(t)&&l(t)});p(()=>{if(u(),!a||typeof ResizeObserver!=`function`)return;let e=new ResizeObserver(u);return e.observe(a),()=>{e.disconnect()}},[u,a]);let d=U.useMemo(()=>{if(!t||t.length===0||o<=0||i<=0)return[];let e=Math.min(i,o),n=t.map(t=>{let n=Q(t,o,c);if(n===null)return null;let r=_(n,0,e);return{value:t,height:r,offset:Math.max(0,i-r)}}).filter(e=>!!e);if(n.length<=1)return n;let r=[],a=[];for(let e=n.length-1;e>=0;--e){let t=n[e];a.some(e=>Math.abs(e-t.height)<=1)||(a.push(t.height),r.push(t))}return r.reverse(),r},[i,c,t,o]);return{snapPoints:t,activeSnapPoint:n,setActiveSnapPoint:r,popupHeight:i,viewportHeight:o,resolvedSnapPoints:d,activeSnapPointOffset:U.useMemo(()=>{if(n===null)return;let e=d.find(e=>Object.is(e.value,n));if(e)return e;let t=Math.min(i,o),r=Q(n,o,c);if(r===null)return;let a=_(r,0,t);return d[De(d.map(e=>e.height),a)]},[n,i,d,c,o])?.offset??null}}var ke=U.createContext(null);function Ae(){return U.useContext(ke)}var je=!1;function Me(){je||=(typeof CSS<`u`&&`registerProperty`in CSS&&([ce,le,X].forEach(e=>{try{CSS.registerProperty({name:e,syntax:`<length>`,inherits:!1,initialValue:`0px`})}catch{}}),[{name:de,initialValue:`0`},{name:ue,initialValue:`1`}].forEach(({name:e,initialValue:t})=>{try{CSS.registerProperty({name:e,syntax:`<number>`,inherits:!1,initialValue:t})}catch{}})),!0)}var Ne={...o,expanded(e){return e?{[ye]:``}:null},nestedDrawerOpen(e){return e?{[be]:``}:null},nestedDrawerSwiping(e){return e?{[Z]:``}:null},swipeDirection(e){return{[Se]:e}},swiping(e){return e?{[Ce]:``}:null}},$=U.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,initialFocus:o,...s}=e,c=B(),u=c.context.popupRef,{swipeDirection:d,frontmostHeight:m,hasNestedDrawer:g,nestedSwiping:_,nestedSwipeProgressStore:y,onPopupHeightChange:b,notifyParentFrontmostHeight:x,notifyParentHasNestedDrawer:S}=Te(),C=c.useState(`descriptionElementId`),w=c.useState(`disablePointerDismissal`),ee=c.useState(`floatingRootContext`),T=c.useState(`popupProps`),E=c.useState(`modal`),D=c.useState(`mounted`),O=c.useState(`nested`),k=c.useState(`nestedOpenDrawerCount`),A=c.useState(`transitionStatus`),j=c.useState(`open`),M=c.useState(`openMethod`),N=c.useState(`titleElementId`),L=c.useState(`role`),R=ee.useState(`floatingId`),te=s.id??R,V=Ae();z();let{snapPoints:H,activeSnapPoint:ne,activeSnapPointOffset:re}=Oe(),ie=k>0,W=V?.swiping??!1,G=V?.swipeStrength??null,[K,J]=U.useState(0),Y=U.useRef(0),ce=f(()=>{let e=u.current;if(!e)return;let t=e.offsetHeight;if(Y.current>0&&m>Y.current&&t>Y.current)return;if(Y.current>0&&g){let e=Y.current;J(e),b(e);return}let n=t;n!==Y.current&&(Y.current=n,J(n),b(n))});p(()=>{if(!D){Y.current=0,J(0),b(0);return}let e=u.current;if(!e||(Me(),ce(),typeof ResizeObserver!=`function`))return;let t=new ResizeObserver(ce);return t.observe(e),()=>{t.disconnect()}},[ce,D,ie,b,u]),p(()=>{let e=()=>{let e=u.current;if(!e)return;let t=y.getSnapshot();t>0?e.style.setProperty(de,`${t}`):e.style.setProperty(de,`0`)};e();let t=y.subscribe(e),n=u.current;return()=>{t(),n&&n.style.setProperty(de,`0`)}},[y,u]),p(()=>{if(j)return x?.(m),()=>{x?.(0)}},[m,j,x]),p(()=>{if(S)return S(j||A===`ending`),()=>{S(!1)}},[S,j,A]),l({open:j,ref:u,onComplete(){j&&c.context.onOpenChangeComplete?.(!0)}});let fe=o===void 0?u:o,pe=c.useStateSetter(`popupElement`),me={open:j,nested:O,transitionStatus:A,expanded:ne===1,nestedDrawerOpen:ie,nestedDrawerSwiping:_,swipeDirection:d,swiping:W},he;K&&(g||A===`ending`)&&(he=`${K}px`);let ge=H&&H.length>0&&(d===`down`||d===`up`),_e=null;ge&&re!==null&&(_e=d===`up`?-re:re);let ve=V?V.getDragStyles():h;if(ge&&d===`down`){let e=re??0,t=Number.parseFloat(String(ve[le]));ve=W&&Number.isFinite(t)?{...ve,transform:void 0,[le]:`${Ee(e,t)}px`}:{...ve,transform:void 0}}let ye=v(`div`,e,{state:me,props:[T,{id:te,"aria-labelledby":N,"aria-describedby":C,role:L,...P,hidden:!D,onKeyDown(e){I.has(e.key)&&e.stopPropagation()},style:{...ve,[de]:`0`,[ae]:k,[oe]:he,[X]:typeof _e==`number`?`${_e}px`:`0px`,[se]:m?`${m}px`:void 0,[ue]:typeof G==`number`&&Number.isFinite(G)&&G>0?`${G}`:`1`}},s],ref:[t,u,pe],stateAttributesMapping:Ne});return(0,q.jsx)(F,{context:ee,openInteractionType:M,disabled:!D,closeOnFocusOut:!w,initialFocus:fe,returnFocus:a,modal:E!==!1,restoreFocus:`popup`,children:ye})}),Pe=L,Fe,Ie;function Le(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null,swipeDirection:p=`down`,snapToSequentialPoints:m=!1,snapPoints:h,snapPoint:g,defaultSnapPoint:_,onSnapPointChange:v}=e,y=Te(!0),b=y?.onNestedSwipeProgressChange,x=y?.onNestedFrontmostHeightChange,S=y?.onNestedSwipingChange,C=y?.onNestedDrawerPresenceChange,[w,ee]=U.useState(0),[T,E]=U.useState(0),[O,k]=U.useState(!1),[A,j]=U.useState(!1),[M]=U.useState(Re),N=_===void 0?h?.[0]??null:_,P=g!==void 0,[F,I]=re({controlled:g,default:N,name:`Drawer`,state:`snapPoint`}),L=U.useRef(!1),z=U.useRef(!1),B=f((e,t)=>{let n=t??D(`none`);v?.(e,n),!n.isCanceled&&I(e)}),te=U.useMemo(()=>P||!h||h.length===0?F:F===null||!h.some(e=>Object.is(e,F))?N:F,[F,P,N,h]),V=f(e=>{ee(e),!L.current&&e>0&&E(e)}),H=f(e=>{if(e>0){L.current=!0,E(e);return}L.current=!1,w>0&&E(w)}),ne=f(e=>{k(e)}),ie=f(e=>{M.set(e),b?.(e)}),W=f(e=>{j(e),S?.(e)}),G=f((e,t)=>{i?.(e,t),!t.isCanceled&&!e&&h&&h.length>0&&B(N,D(t.reason,t.event,t.trigger))}),K=U.useMemo(()=>({swipeDirection:p,swipeAreaActiveRef:z,snapToSequentialPoints:m,snapPoints:h,activeSnapPoint:te,setActiveSnapPoint:B,frontmostHeight:T,popupHeight:w,hasNestedDrawer:O,nestedSwiping:A,nestedSwipeProgressStore:M,onNestedDrawerPresenceChange:ne,onPopupHeightChange:V,onNestedFrontmostHeightChange:H,onNestedSwipingChange:W,onNestedSwipeProgressChange:ie,notifyParentFrontmostHeight:x,notifyParentSwipingChange:S,notifyParentSwipeProgressChange:b,notifyParentHasNestedDrawer:C}),[te,T,O,A,M,C,b,S,x,ne,H,ie,W,V,w,B,h,m,z,p]),J=typeof t==`function`?e=>(0,q.jsxs)(U.Fragment,{children:[Fe||=(0,q.jsx)(ze,{}),t(e)]}):(0,q.jsxs)(U.Fragment,{children:[Ie||=(0,q.jsx)(ze,{}),t]}),Y=R(`drawer`,{open:n,defaultOpen:r,onOpenChange:G,onOpenChangeComplete:a,disablePointerDismissal:o,modal:s,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d,children:J});return(0,q.jsx)(we.Provider,{value:K,children:Y})}function Re(){let e=0,t=new Set;return{getSnapshot:()=>e,set(n){let r=Number.isFinite(n)?n:0;r!==e&&(e=r,t.forEach(e=>{e()}))},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function ze(){let e=ve(),t=B(!1),n=e?.setDrawerOpen,r=e?.removeDrawer,i=t.useState(`open`),a=t.useState(`nestedOpenDialogCount`),o=t.useState(`popupElement`),s=a===0;return p(()=>{if(r)return()=>{r(t)}},[r,t]),p(()=>{n?.(t,i)},[i,n,t]),U.useEffect(()=>{if(!i||!s||!E)return;let e=x(o).CloseWatcher;if(!e)return;function n(e){t.select(`open`)&&t.setOpen(!1,D(S,e))}let r=new e,a=O(r,`close`,n);return()=>{a(),r.destroy()}},[t,s,i,o]),null}var Be=ne,Ve=e(r(),1),He=`data-nested-dialog-open`,Ue=U.createContext(void 0);function We(){return U.useContext(Ue)}var Ge=10,Ke=.5,qe=.5,Je=300,Ye=4,Xe=.2,Ze=4,Qe=80,$e=360,et=.1,tt=6,nt=2,rt=`[${me}]`,it=U.forwardRef(function(e,t){let{render:n,className:r,style:a,children:o,...l}=e,d=B(),m=d.context.popupRef,h=d.context.backdropRef,{swipeDirection:v,notifyParentSwipingChange:b,notifyParentSwipeProgressChange:x,frontmostHeight:S,snapToSequentialPoints:C,swipeAreaActiveRef:E}=Te(),M=ve(),{snapPoints:N,resolvedSnapPoints:P,activeSnapPoint:F,activeSnapPointOffset:I,setActiveSnapPoint:L,popupHeight:R}=Oe(),z=d.useState(`open`),V=d.useState(`mounted`),H=d.useState(`nested`),ne=d.useState(`nestedOpenDrawerCount`),re=d.useState(`viewportElement`),ie=d.useState(`popupElement`),W=M?.visualStateStore,G=ne>0,K=v===`left`||v===`right`?`horizontal`:`vertical`,J=K===`vertical`,Y=J?`horizontal`:`vertical`,[ae,se]=U.useState(null),X=U.useRef(void 0),ue=U.useRef(null),fe=ee(),pe=U.useRef(!1),me=U.useRef(!1),he=U.useRef(``),ge=U.useRef(!1),_e=U.useRef(!1),ye=U.useRef(null),be=We(),Z=U.useMemo(()=>{if(!N||N.length<2||P.length<2||v!==`down`&&v!==`up`)return null;let e=P.map(e=>e.offset).sort((e,t)=>e-t),t=e[0];return{minOffset:t,range:e[1]-t}},[P,N,v]),Se=U.useMemo(()=>!Z||I===null?null:_((I-Z.minOffset)/Z.range,0,1),[I,Z]),Ce=U.useMemo(()=>N&&N.length>0&&(v===`down`||v===`up`)?v===`down`?[`down`,`up`]:[`up`,`down`]:[v],[N,v]),we=f(e=>{m.current?.toggleAttribute(xe,e),h.current?.toggleAttribute(xe,e)}),Q=f(()=>{we(!1),m.current?.removeAttribute(c),se(null)}),Ae=f(()=>{me.current&&(me.current=!1,b?.(!1))}),je=f((e,t,n)=>{let r=z&&!H&&t,i=r?e:0,a=z&&t?e:0;n&&x&&(x(a),a<=0&&Ae()),W?.set({swipeProgress:i,frontmostHeight:i>0?S:0});let o=h.current;if(!o)return;let s=r&&i>0;o.style.setProperty(de,s?`${i}`:`0`),s&&S>0?o.style.setProperty(oe,`${S}px`):o.style.removeProperty(oe)});function Me(e,t,n,r,i,a,o,c){let l=ct(e,t);if(l<=0)return null;let u=((t===`down`||t===`up`)&&N&&N.length>0?I??0:0)+s(t,n,r),d=Math.max(0,l-u);if(d<=0)return null;let f=s(t,o,c),p=Math.abs(f)>0?f:s(t,i,a);if(p<=Xe)return null;let m=_(p,Xe,Ze);return et+(_(d/m,Qe,$e)-Qe)/280*.9}function Ne(e){if(me.current||!e)return;let t=e.direction??v,n=s(t,e.deltaX,e.deltaY);Math.abs(n)<Ge||(me.current=!0,b?.(!0))}let $=u({enabled:V&&!G,directions:Ce,elementRef:d.context.popupRef,ignoreSelectorWhenTouch:!1,ignoreScrollableAncestors:!0,movementCssVars:{x:ce,y:le},onSwipeStart(e){if(`touches`in e||e.pointerType===`touch`)return;let t=m.current,n=T(t).getSelection?.();if(!n||n.isCollapsed)return;let r=A(n.anchorNode)?n.anchorNode:n.anchorNode?.parentElement,i=A(n.focusNode)?n.focusNode:n.focusNode?.parentElement;(w(t,r)||w(t,i))&&n.removeAllRanges()},onSwipingChange(e){pe.current=e,at(d.context.backdropRef.current,e),!e&&!x&&Ae()},swipeThreshold({element:e,direction:t}){return lt(e,t)},canStart(e,t){let n=d.context.popupRef.current;if(!n)return!1;let r=n.ownerDocument,i=g(n.getRootNode(),e.x,e.y);if(!i||!w(n,i))return!1;let a=t.nativeEvent;return!((`touches`in a||a.pointerType===`touch`)&&pt(r,n))},onProgress(e,t){let n=pe.current;n&&Ne(t);let r=!!(N&&N.length>0);if(n&&v===`down`&&r&&t){let e=d.context.popupRef.current;e&&(e.style.removeProperty(`transform`),e.style.setProperty(le,`${Ee(I??0,t.deltaY)}px`))}let i=e;if(Z&&R>0){let e=I??Z.minOffset;n&&t&&Number.isFinite(t.deltaY)?i=(e=>_((e-Z.minOffset)/Z.range,0,1))(_(e+t.deltaY,0,R)):Se!==null&&(i=Se)}n||(x?.(0),Ae()),je(i,!0,n)},onRelease({event:e,deltaX:t,deltaY:n,direction:r,velocityX:a,velocityY:o,releaseVelocityX:l,releaseVelocityY:u}){let f=d.context.popupRef.current;if(!f){Q();return}let p=f;function m(e){Ae(),we(!0),p.style.removeProperty(`transition`),p.setAttribute(c,``),Ve.flushSync(()=>{se(Me(p,e,t,n,a,o,l,u))})}if(!N||N.length===0){if(!r){Q();return}let e=s(r,t,n);if(e<=0)return Q(),!1;if(s(r,a,o)>=Ke)return m(r),!0;let i=e>lt(p,r);return i?m(r):Q(),i}if(v!==`down`&&v!==`up`){Q();return}if(!R)return Q(),!1;if(P.length===0){Q();return}let h=v===`down`?n:-n,g=Math.sign(h),y=v===`down`?u:-u,b=v===`down`?o:-o,x=y;if(g!==0&&Math.abs(h)>=Ge){let e=Math.sign(x);e!==0&&e!==g&&(x=b)}let S=I??0,w=_(S+h,0,R),ee=Math.abs(x)>=qe?_(x,-4,Ye)*Je:0,T=C?w:_(w+ee,0,R),E=D(i,e),O=()=>(je(0,!0,!0),Q(),!1),k=e=>(L(e.value,E),O()),A=e=>r?(L(null,E),E.isCanceled?O():(X.current=F,m(v),!0)):k(e);if(C){let e=[...P].sort((e,t)=>e.offset-t.offset),t=e.map(e=>e.offset),n=De(t,S),r=e[De(t,T)],i=Math.sign(x),a=g!==0&&i!==0&&i===g&&Math.abs(x)>=qe,o=T;if(a){let t=_(n+g,0,e.length-1);if(t!==n){let n=e[t];(g>0?T<n.offset:T>n.offset)&&(r=n,o=n.offset)}else if(g>0)return A(r)}return Math.abs(o-R)<Math.abs(o-r.offset)?A(r):k(r)}let j=P[De(P.map(e=>e.offset),T)];return x>=Ke&&h>0||Math.abs(T-R)<Math.abs(T-j.offset)?A(j):k(j)},onDismiss(e){W?.set({swipeProgress:0,frontmostHeight:0});let t=d.context.backdropRef.current;t&&(t.style.setProperty(de,`0`),t.style.removeProperty(oe));let n=D(i,e);if(d.setOpen(!1,n),n.isCanceled){let t=X.current;t!==void 0&&L(t,D(i,e)),X.current=void 0,ue.current?.(),Q();return}if(d.select(`open`)){let t=e;fe.request(()=>{if(d.select(`open`)){let e=X.current;e!==void 0&&L(e,D(i,t)),X.current=void 0,Q(),ue.current?.()}else X.current=void 0});return}X.current=void 0,we(!0)}}),Pe=$.getPointerProps(),Fe=$.getTouchProps(),{moveNative:Ie,reset:Le}=$;ue.current=Le,U.useEffect(()=>{let e=re??ie;if(!e)return;let t=e,n=T(t);function r(e,r,i){let a=J?i.clientY-r.lastY:i.clientX-r.lastX;if(e.touches.length===2||pt(n,t)||!z||!V||G||_t(r,e,i,J))return;let o=r.scrollTarget;if(!o||o===n.documentElement||o===n.body){e.cancelable&&e.preventDefault(),e.stopPropagation(),Ie(e,t);return}if(!vt(o,K)){e.cancelable&&e.preventDefault(),e.stopPropagation();return}if(a!==0){let t=xt(o,K,v,a);r.allowSwipe?e.cancelable&&e.preventDefault():e.cancelable&&t?(r.allowSwipe=!0,e.preventDefault()):r.allowSwipe=!1}r.allowSwipe===!0&&(e.stopPropagation(),Ie(e,t))}function i(e){if(be?.onTouchMove(e),_e.current)return;let t=ye.current,n=e.touches[0];n&&t&&(r(e,t,n),gt(t,n))}return O(n,`touchmove`,i,{passive:!1,capture:!0})},[V,G,z,ie,J,K,v,Ie,re,be]),p(()=>{Z&&!$.swiping&&je(!z||H?0:Se??0,!0,!1)},[je,S,H,x,z,Se,Z,$.swiping,d,W]),p(()=>{if(x)return z||x(0),()=>{x(0)}},[x,z]),p(()=>{z&&(E.current||Le(),Q())},[Q,z,Le,E]),p(()=>{let e=h.current;return()=>{W?.set({swipeProgress:0,frontmostHeight:0}),at(e,!1);let t=h.current;t!==e&&at(t,!1),Ae()}},[h,Ae,W]);let Re=U.useMemo(()=>({swiping:$.swiping,getDragStyles:$.getDragStyles,swipeStrength:ae??null,setSwipeDismissed:we}),[we,$.getDragStyles,$.swiping,ae]);function ze(e){_e.current=e,ye.current=null}function Be(){ze(!1),he.current=``,ge.current=!1}function Ue(e){return he.current=``,e.pointerType!==`touch`}return(0,q.jsx)(te,{ref:t,className:r,style:a,render:n,...y(l,{onPointerDown(e){if(he.current=e.pointerType,ge.current=e.pointerType===`pen`,!z||!V||G)return;let t=g(e.currentTarget.getRootNode(),e.clientX,e.clientY);ot(t)||st(t)||e.pointerType!==`touch`&&Pe.onPointerDown?.(e)},onPointerMove(e){e.pointerType!==`touch`&&Pe.onPointerMove?.(e)},onPointerUp(e){Ue(e)&&Pe.onPointerUp?.(e)},onPointerCancel(e){Ue(e)&&Pe.onPointerCancel?.(e)},onTouchStart(e){if(he.current===`pen`&&ge.current){ge.current=!1,ze(!1);return}if(!z||!V||G){ze(!1);return}let t=e.touches[0];if(!t)return;if(ht(e)){ze(!1);return}let n=e.currentTarget,r=g(n.getRootNode(),t.clientX,t.clientY),i=k(e.nativeEvent),a=A(i)?i:n;if(!w(n,a)){ze(!0);return}if(be?.onTouchStart(e),ot(r)){ze(!0);return}_e.current=!1;let o=j(a,n,K),s=j(a,n,Y)!=null,c=null;o&&(c=bt(o,K,v)?null:!1),ye.current={startX:t.clientX,startY:t.clientY,lastX:t.clientX,lastY:t.clientY,scrollTarget:o,hasCrossAxisScrollableContent:s,allowSwipe:c,preserveNativeCrossAxisScroll:!1,drawerAxisAttributed:!1},Fe.onTouchStart?.(e)},onTouchEnd(e){be?.onTouchEnd(e),Be(),Fe.onTouchEnd?.(e)},onTouchCancel(e){be?.onTouchCancel(),Be(),Fe.onTouchCancel?.(e)},[He]:void 0}),children:(0,q.jsx)(ke.Provider,{value:Re,children:o})})});function at(e,t){e?.toggleAttribute(Ce,t)}function ot(e){return!!e?.closest(a)}function st(e){return!!e?.closest(rt)}function ct(e,t){return t===`left`||t===`right`?e.offsetWidth:e.offsetHeight}function lt(e,t){return Math.max(ct(e,t)*.5,Ge)}function ut(e,t){return e instanceof t.HTMLInputElement&&e.type===`range`}function dt(e){return e.tagName===`INPUT`||e.tagName===`TEXTAREA`}function ft(e,t){let n=A(e.anchorNode)?e.anchorNode:e.anchorNode?.parentElement,r=A(e.focusNode)?e.focusNode:e.focusNode?.parentElement;return e.containsNode(t,!0)||w(t,n)||w(t,r)}function pt(e,n){let r=t(e);if(r&&w(n,r)&&dt(r)){let{selectionStart:e,selectionEnd:t}=r;if(e!=null&&t!=null&&e<t)return!0}let i=e.getSelection?.();return!i||i.isCollapsed?!1:ft(i,n)}function mt(e,t){return e.composedPath().some(e=>ut(e,t))}function ht(e){return mt(e.nativeEvent,x(e.currentTarget))}function gt(e,t){e.lastX=t.clientX,e.lastY=t.clientY}function _t(e,t,n,r){if(e.preserveNativeCrossAxisScroll)return!0;if(e.drawerAxisAttributed||e.allowSwipe===!0||!e.hasCrossAxisScrollableContent)return!1;if(!t.cancelable)return e.preserveNativeCrossAxisScroll=!0,!0;let i=r?n.clientY-e.startY:n.clientX-e.startX,a=r?n.clientX-e.startX:n.clientY-e.startY,o=Math.abs(i),s=Math.abs(a);return s>=tt&&s>o+nt?(e.preserveNativeCrossAxisScroll=!0,!0):o>=tt?(e.drawerAxisAttributed=!0,!1):!0}function vt(e,t){return yt(e,t).max>0}function yt(e,t){if(t===`vertical`){let t=Math.max(0,e.scrollHeight-e.clientHeight);return{offset:e.scrollTop,max:t}}let n=Math.max(0,e.scrollWidth-e.clientWidth);return{offset:e.scrollLeft,max:n}}function bt(e,t,n){let r=St(n,t),{offset:i,max:a}=yt(e,t);return r?i<=0:i>=a}function xt(e,t,n,r){return(St(n,t)?r>0:r<0)&&bt(e,t,n)}function St(e,t){return t===`vertical`?e===`down`:e===`right`}var Ct=.5,wt=1,Tt=[Ct,wt];function Et(e){return e===`medium`?Ct:wt}function Dt(e){return e==null?null:e===Ct?`medium`:`large`}function Ot(e){let t=(0,W.c)(23),{open:n,onOpenChange:r,label:i,detent:a,onDetentChange:o,activeDetent:s,className:c,children:l}=e,u=a===void 0?`large`:a,d;t[0]===u?d=t[1]:(d=Et(u),t[0]=u,t[1]=d);let f;t[2]===s?f=t[3]:(f=s===void 0?{}:{snapPoint:s===null?null:Et(s)},t[2]=s,t[3]=f);let p;t[4]===o?p=t[5]:(p=e=>o?.(Dt(e)),t[4]=o,t[5]=p);let h;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,q.jsx)(fe,{className:C(`app-sheet-backdrop fixed inset-0 z-50 backdrop-blur-sm`,`transition-opacity duration-[var(--app-motion-duration-sheet)] ease-[var(--app-motion-ease)] data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none`),"data-slot":`mobile-sheet-backdrop`}),t[6]=h):h=t[6];let g;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(g=C(`pointer-events-auto fixed inset-0 z-50 flex flex-col justify-end pt-12`,`pb-[var(--app-keyboard-inset,0px)]`),t[7]=g):g=t[7];let _;t[8]===c?_=t[9]:(_=C(ie(`sheet`),`pointer-events-auto flex max-h-full min-h-0 w-full min-w-0 flex-col rounded-t-2xl border-t not-dark:bg-clip-padding text-popover-foreground shadow-lg/5`,`pb-safe pl-safe pr-safe`,`translate-y-[calc(var(--drawer-snap-point-offset,0px)+var(--drawer-swipe-movement-y,0px))] data-ending-style:translate-y-full data-starting-style:translate-y-full`,`transition-[translate,scale] duration-[var(--app-motion-duration-sheet)] ease-[var(--app-motion-ease)] will-change-transform motion-reduce:transition-none`,`data-nested-drawer-open:scale-96`,c),t[8]=c,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,q.jsx)(`span`,{"aria-hidden":!0,className:`mx-auto mt-2 mb-1 h-1 w-9 shrink-0 rounded-full bg-muted-foreground/32`,"data-slot":`mobile-sheet-grabber`}),t[10]=v):v=t[10];let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,q.jsx)(pe,{"aria-label":`Close`,className:`absolute end-2 top-2 z-20`,"data-slot":`mobile-sheet-close`,render:(0,q.jsx)(m,{size:`icon`,variant:`ghost`}),children:(0,q.jsx)(b,{})}),t[11]=y):y=t[11];let x;t[12]!==l||t[13]!==i||t[14]!==_?(x=(0,q.jsxs)(Pe,{children:[h,(0,q.jsx)(it,{className:g,"data-slot":`mobile-sheet-viewport`,children:(0,q.jsxs)($,{"aria-label":i,className:_,"data-slot":`sheet-popup`,"data-mobile-sheet":``,onKeyDown:kt,children:[v,l,y]})})]}),t[12]=l,t[13]=i,t[14]=_,t[15]=x):x=t[15];let S;return t[16]!==r||t[17]!==n||t[18]!==x||t[19]!==d||t[20]!==f||t[21]!==p?(S=(0,q.jsx)(Le,{open:n,onOpenChange:r,swipeDirection:`down`,snapPoints:Tt,defaultSnapPoint:d,...f,onSnapPointChange:p,children:x}),t[16]=r,t[17]=n,t[18]=x,t[19]=d,t[20]=f,t[21]=p,t[22]=S):S=t[22],S}function kt(e){e.stopPropagation()}function At(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=C(`flex shrink-0 flex-col gap-1 px-4 pt-2 pe-11 pb-3`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(`div`,{className:i,"data-slot":`mobile-sheet-header`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function jt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=C(`truncate font-heading font-semibold text-base leading-tight`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(Be,{className:i,"data-slot":`mobile-sheet-title`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Mt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=C(`text-muted-foreground text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(ge,{className:i,"data-slot":`mobile-sheet-description`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Nt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=C(`min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 pb-2`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(he,{className:i,"data-slot":`mobile-sheet-panel`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Pt(e){let t=(0,W.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=C(`flex shrink-0 flex-col-reverse gap-2 px-4 pt-3 pb-2 sm:flex-row`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,q.jsx)(`div`,{className:i,"data-slot":`mobile-sheet-footer`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}export{Nt as a,K as c,At as i,Mt as n,jt as o,Pt as r,J as s,Ot as t};