@readmagic/workmate 0.0.6 → 0.0.7

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 (409) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-ClHi-Dr6.js → AddWorkspaceDirectory-CFrrXnt9.js} +1 -1
  2. package/dist/chunks/{App-BP06lHmf.js → App-Buad9Llp.js} +1 -1
  3. package/dist/chunks/{ApproveApiKey-Bsy8kr2a.js → ApproveApiKey-B2HJUD7h.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-BQbHdvc3.js +1 -0
  5. package/dist/chunks/{AssistantSessionChooser-CcocKoTJ.js → AssistantSessionChooser-4lm4eXQ8.js} +1 -1
  6. package/dist/chunks/BackgroundTasksDialog-D4qA0M5O.js +2 -0
  7. package/dist/chunks/{BypassPermissionsModeDialog-BKj_3Idm.js → BypassPermissionsModeDialog-DllL8dxU.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog--ywODh81.js +1 -0
  9. package/dist/chunks/{ClaudeMdExternalIncludesDialog-BD-7yAZh.js → ClaudeMdExternalIncludesDialog-BZSyRqeq.js} +1 -1
  10. package/dist/chunks/ConsoleOAuthFlow-Wkfw7Ts-.js +1 -0
  11. package/dist/chunks/{DesktopHandoff-BmPmCfT3.js → DesktopHandoff-DaP4Riar.js} +1 -1
  12. package/dist/chunks/{DiffDialog-C4XSSjvV.js → DiffDialog-B7hx8i_Y.js} +2 -2
  13. package/dist/chunks/Doctor-89OgoAUA.js +1 -0
  14. package/dist/chunks/Doctor-CuKJ-nGt.js +3 -0
  15. package/dist/chunks/ExitFlow-DnPydE17.js +2 -0
  16. package/dist/chunks/{Feedback-BaYA8-SU.js → Feedback-SmGiR3mf.js} +2 -2
  17. package/dist/chunks/{Grove-BJziCbZH.js → Grove-CjN9DO47.js} +1 -1
  18. package/dist/chunks/Grove-Cq88VBmM.js +1 -0
  19. package/dist/chunks/{HybridTransport-B8V6O6rM.js → HybridTransport-rK83Qijz.js} +1 -1
  20. package/dist/chunks/{InvalidConfigDialog-CHzBSJDf.js → InvalidConfigDialog-DdO0AxyF.js} +1 -1
  21. package/dist/chunks/{InvalidSettingsDialog-BKenH3bD.js → InvalidSettingsDialog-s1G0DwXF.js} +1 -1
  22. package/dist/chunks/MCPConnectionManager-NRfIjdlj.js +1 -0
  23. package/dist/chunks/{McpParsingWarnings-Bj2-YL8o.js → McpParsingWarnings-Du5IxZos.js} +1 -1
  24. package/dist/chunks/MessageSelector-iIroHvXo.js +3 -0
  25. package/dist/chunks/Messages-D4Hm4gaY.js +11 -0
  26. package/dist/chunks/{Onboarding-BrAJp0aL.js → Onboarding-BiZByBK-.js} +1 -1
  27. package/dist/chunks/{OverageCreditUpsell-Ds1cB7RC.js → OverageCreditUpsell-BM7szLgm.js} +1 -1
  28. package/dist/chunks/PluginSettings-uY5KTCtK.js +17 -0
  29. package/dist/chunks/{PromptInputFooterSuggestions-egs9VvUs.js → PromptInputFooterSuggestions-BmsFdOu9.js} +1 -1
  30. package/dist/chunks/{PromptInputHelpMenu-SieM5NoY.js → PromptInputHelpMenu-DX-0wEDo.js} +1 -1
  31. package/dist/chunks/QueryEngine-CGYaShXD.js +1 -0
  32. package/dist/chunks/REPL-CRJB2t2z.js +142 -0
  33. package/dist/chunks/REPL-u4Yq29Du.js +1 -0
  34. package/dist/chunks/{RemoteCallout-Cs-ro8_i.js → RemoteCallout-B-tyvQOe.js} +1 -1
  35. package/dist/chunks/{RemoteSessionManager-B740Dp6m.js → RemoteSessionManager-DCd0O5_l.js} +2 -2
  36. package/dist/chunks/ResumeConversation-DAAXlOCd.js +1 -0
  37. package/dist/chunks/{SSETransport-DtpMDekF.js → SSETransport-5VK5okFv.js} +1 -1
  38. package/dist/chunks/SearchExtraToolsTool-B-7Bworf.js +1 -0
  39. package/dist/chunks/Settings-CUjWlncb.js +2 -0
  40. package/dist/chunks/{TeleportProgress-rYaHIEfe.js → TeleportProgress-DxN0bQL2.js} +1 -1
  41. package/dist/chunks/{TeleportRepoMismatchDialog-DY97YZMB.js → TeleportRepoMismatchDialog-A5Ss0kuk.js} +1 -1
  42. package/dist/chunks/{TeleportResumeWrapper-jaQzyTCh.js → TeleportResumeWrapper-Bz14mUqR.js} +1 -1
  43. package/dist/chunks/{ThemePicker-BViWzLp3.js → ThemePicker-CVSRqTzW.js} +1 -1
  44. package/dist/chunks/TrustDialog-CY8an_Tg.js +1 -0
  45. package/dist/chunks/{ValidationErrorsList-B8pRiGuy.js → ValidationErrorsList-BYsDtAvX.js} +1 -1
  46. package/dist/chunks/{WelcomeV2-DqnbSdIu.js → WelcomeV2-C1BfrqC5.js} +1 -1
  47. package/dist/chunks/{add-dir-C2Hu3oE4.js → add-dir-DfLYgwox.js} +1 -1
  48. package/dist/chunks/{agentDisplay-XoDJhr03.js → agentDisplay-CMmHIl86.js} +1 -1
  49. package/dist/chunks/{agents-C4QXeHIJ.js → agents-DE_4mAHG.js} +1 -1
  50. package/dist/chunks/agents-DJtPfvnL.js +103 -0
  51. package/dist/chunks/allErrors-CQE2k0zO.js +1 -0
  52. package/dist/chunks/{ant-B6k6cBts.js → ant-ClQkuQjZ.js} +1 -1
  53. package/dist/chunks/{api-gqTA-D7n.js → api-2cdIPaeq.js} +1 -1
  54. package/dist/chunks/api-CG-lhKe-.js +1 -0
  55. package/dist/chunks/{assistant-DJ9hd4uC.js → assistant-Bje16tQx.js} +1 -1
  56. package/dist/chunks/auth-DMfEiQrC.js +1 -0
  57. package/dist/chunks/auth-D_cGl8WD.js +1 -0
  58. package/dist/chunks/{auth-BnSrKyJe.js → auth-DqcKPbw8.js} +1 -1
  59. package/dist/chunks/{autoMode-BNukrVAB.js → autoMode-ZW70mpr0.js} +5 -5
  60. package/dist/chunks/{autonomy-BEmI7WVW.js → autonomy-CwbWsCnv.js} +1 -1
  61. package/dist/chunks/autonomy-Oui8yK8G.js +15 -0
  62. package/dist/chunks/{autonomyPanel-fhge09AG.js → autonomyPanel-Mq50H7iM.js} +1 -1
  63. package/dist/chunks/backgroundHousekeeping-BpLtI45r.js +1 -0
  64. package/dist/chunks/backgroundHousekeeping-DtJNx4Ja.js +17 -0
  65. package/dist/chunks/{branch-Bpe-gocq.js → branch-DU5O9KZ0.js} +1 -1
  66. package/dist/chunks/{bridge-D12Shbkj.js → bridge-DNNxtPlz.js} +2 -2
  67. package/dist/chunks/{bridgeConfig-BhxRF2vm.js → bridgeConfig-CE6dMsiJ.js} +1 -1
  68. package/dist/chunks/bridgeConfig-DP9dD1Cv.js +1 -0
  69. package/dist/chunks/{bridgeEnabled-SbB-6zdY.js → bridgeEnabled-Cc0mGlTb.js} +1 -1
  70. package/dist/chunks/bridgeEnabled-D8wP3DWQ.js +1 -0
  71. package/dist/chunks/bridgeMain-CwxMa_pd.js +1 -0
  72. package/dist/chunks/bridgeMain-D11t1BYQ.js +68 -0
  73. package/dist/chunks/{bridgeMessaging-DHc5dOhB.js → bridgeMessaging-DdvApEqW.js} +1 -1
  74. package/dist/chunks/{bridgePointer-MqLe5Asm.js → bridgePointer-DqHMHa2B.js} +1 -1
  75. package/dist/chunks/{btw-D9hMM5d2.js → btw-CejSEdNl.js} +1 -1
  76. package/dist/chunks/{caches-UeVVM3T0.js → caches-5HVQSevy.js} +2 -2
  77. package/dist/chunks/caches-B-nJoHLM.js +1 -0
  78. package/dist/chunks/{ccrClient-Iza0L8Zw.js → ccrClient-BFyfO67b.js} +1 -1
  79. package/dist/chunks/{claudeDesktop-Cx31Ugjp.js → claudeDesktop-Fe-QL-sN.js} +1 -1
  80. package/dist/chunks/{clear-B4d38ssF.js → clear-D8m2utXW.js} +1 -1
  81. package/dist/chunks/client-C6MbjvOB.js +17 -0
  82. package/dist/chunks/client-DKXCfdde.js +1 -0
  83. package/dist/chunks/client-xxikkAoZ.js +1 -0
  84. package/dist/chunks/{color-D8VOyoYl.js → color-DWhgZH7A.js} +1 -1
  85. package/dist/chunks/commands-CxJpmEKF.js +1 -0
  86. package/dist/chunks/commitAttribution-DM6SBMwl.js +1 -0
  87. package/dist/chunks/{commitAttribution-ChAgixdj.js → commitAttribution-DPnHHKSA.js} +1 -1
  88. package/dist/chunks/compact-CblM7306.js +2 -0
  89. package/dist/chunks/config-BLVBFi5v.js +1 -0
  90. package/dist/chunks/config-CMnqm6Se.js +1 -0
  91. package/dist/chunks/{config-DmomySWC.js → config-DRDuVyzE.js} +2 -2
  92. package/dist/chunks/{context-Cl6BJ2vm.js → context-CdSMMM-0.js} +1 -1
  93. package/dist/chunks/context-noninteractive-CPkf2vB9.js +1 -0
  94. package/dist/chunks/{context-noninteractive-9hELVC29.js → context-noninteractive-DNury4JI.js} +5 -5
  95. package/dist/chunks/conversation-DCMw_rsE.js +1 -0
  96. package/dist/chunks/conversation-pUtvc-cE.js +1 -0
  97. package/dist/chunks/{createSSHSession-BM-5pbv6.js → createSSHSession-BOdTAX3N.js} +1 -1
  98. package/dist/chunks/{createSession-Cvl1Q50F.js → createSession-8Ei-Lj7V.js} +1 -1
  99. package/dist/chunks/createSession-CjqxVh_Q.js +1 -0
  100. package/dist/chunks/crossProjectResume-Bj_Pe8oe.js +40 -0
  101. package/dist/chunks/{datadog-CpqEQbHa.js → datadog-DqHxqiwY.js} +1 -1
  102. package/dist/chunks/{desktop-B_L6T6jI.js → desktop-Z5FAfunZ.js} +1 -1
  103. package/dist/chunks/{diff-CVzOodeg.js → diff-CJEKvOA5.js} +1 -1
  104. package/dist/chunks/doctor-BA2ZLDTl.js +1 -0
  105. package/dist/chunks/{entry-DHVYCR26.js → entry-DE0uMIf0.js} +4 -4
  106. package/dist/chunks/envLessBridgeConfig-B-LKYNvv.js +1 -0
  107. package/dist/chunks/envLessBridgeConfig-DyD9XCda.js +1 -0
  108. package/dist/chunks/{esm-D5q6s4l8.js → esm-5w3xFBnt.js} +1 -1
  109. package/dist/chunks/exit-Dt9kHtJO.js +1 -0
  110. package/dist/chunks/{extra-usage-zDHVtWKZ.js → extra-usage-C7E2Z1p1.js} +1 -1
  111. package/dist/chunks/extra-usage-D0Kkjp-2.js +1 -0
  112. package/dist/chunks/{extra-usage-core-BFOolqoi.js → extra-usage-core-DjdaD1qO.js} +1 -1
  113. package/dist/chunks/{extra-usage-noninteractive-cUGZy0en.js → extra-usage-noninteractive-BnD1RhKK.js} +1 -1
  114. package/dist/chunks/{extraUsage-Dq66zzqR.js → extraUsage-CpgRTcMk.js} +1 -1
  115. package/dist/chunks/extractMemories-DhUprYa7.js +1 -0
  116. package/dist/chunks/{fast-MS7WZpD8.js → fast-C4ZevUNL.js} +1 -1
  117. package/dist/chunks/fast-CChxlAAF.js +1 -0
  118. package/dist/chunks/{feedback-Fw4m28ZC.js → feedback-BIhBhV6n.js} +1 -1
  119. package/dist/chunks/{firstPartyEventLogger-CoSUd0a1.js → firstPartyEventLogger-BXY1IJ2D.js} +2 -2
  120. package/dist/chunks/firstPartyEventLogger-CnkGSojw.js +1 -0
  121. package/dist/chunks/{flushGate-De-yppeo.js → flushGate-CgHq81Gw.js} +1 -1
  122. package/dist/chunks/{gemini-BPziscyN.js → gemini-C1J-x1g7.js} +1 -1
  123. package/dist/chunks/generateRecap-C0jjCg0Z.js +1 -0
  124. package/dist/chunks/generateSessionName-w0BMtwS7.js +1 -0
  125. package/dist/chunks/{githubRepoPathMapping-qAoiyj6P.js → githubRepoPathMapping-8D0kpsif.js} +1 -1
  126. package/dist/chunks/{goal-CFx4eRkf.js → goal-B4GsR54_.js} +3 -3
  127. package/dist/chunks/grok-ffNyU3Lt.js +1 -0
  128. package/dist/chunks/{grove-CpqjcGCb.js → grove-BQisE2JM.js} +1 -1
  129. package/dist/chunks/{heapdump-C4kPlqGt.js → heapdump-DiCjAPR3.js} +1 -1
  130. package/dist/chunks/{help-B1h-faJ3.js → help-2hn8VK2-.js} +1 -1
  131. package/dist/chunks/hooks-CBmrBO-J.js +1 -0
  132. package/dist/chunks/{hooks-X6J03MnA.js → hooks-CkA9bhHl.js} +2 -2
  133. package/dist/chunks/inboundAttachments-C5K3XPTC.js +1 -0
  134. package/dist/chunks/{inboundAttachments-CUJE3KaU.js → inboundAttachments-IH-g95jo.js} +1 -1
  135. package/dist/chunks/initReplBridge-C-P4dgAG.js +1 -0
  136. package/dist/chunks/{install-D5YORIJL.js → install-Dzlm4u58.js} +1 -1
  137. package/dist/chunks/{instrumentation-Bw3CxPQf.js → instrumentation-Yt31gxWN.js} +3 -3
  138. package/dist/chunks/{job-DOWtcltx.js → job-BXujwZNa.js} +1 -1
  139. package/dist/chunks/{keybindings-BLw5J-Zj.js → keybindings-D8FXoO89.js} +2 -2
  140. package/dist/chunks/language-Baosud0X.js +1 -0
  141. package/dist/chunks/{language-C6Fq-XOZ.js → language-Ca4B018X.js} +1 -1
  142. package/dist/chunks/{launchAgentsPlatform-jWWf-Lk9.js → launchAgentsPlatform-D6DmNuDt.js} +1 -1
  143. package/dist/chunks/{launchLocalMemory-kHeD0I0y.js → launchLocalMemory-C0FzUq7x.js} +2 -2
  144. package/dist/chunks/{launchLocalVault-DLqkOjmb.js → launchLocalVault-DkYAre4O.js} +3 -3
  145. package/dist/chunks/{launchMemoryStores-Ct7AVXrO.js → launchMemoryStores-D2rKWAPs.js} +1 -1
  146. package/dist/chunks/{launchOnboarding-Cc6WwPX9.js → launchOnboarding-gOVAFEFp.js} +1 -1
  147. package/dist/chunks/{launchSchedule-ZyvuvjgU.js → launchSchedule-IZdFstT_.js} +1 -1
  148. package/dist/chunks/{launchSkillStore-BejQnLog.js → launchSkillStore-B7LamM1d.js} +1 -1
  149. package/dist/chunks/{launchTeleport-8CuYUfIR.js → launchTeleport-C2BQMfYP.js} +3 -3
  150. package/dist/chunks/{launchVault-DIvIOuPh.js → launchVault-C60WUcCI.js} +1 -1
  151. package/dist/chunks/{lazySchema-DcIJE_0i.js → lazySchema-DULtBUCI.js} +1 -1
  152. package/dist/chunks/loadAgentsDir-B9c3Emvg.js +1 -0
  153. package/dist/chunks/{loadAgentsDir-D206qwP3.js → loadAgentsDir-x3rlgED4.js} +690 -692
  154. package/dist/chunks/loadPluginHooks-BhNdAjeY.js +1 -0
  155. package/dist/chunks/localSearch-BLCGsdyM.js +1 -0
  156. package/dist/chunks/{localSearch-CzrbOklu.js → localSearch-DtplGF-l.js} +1 -1
  157. package/dist/chunks/{logoV2Utils-8M56V7oN.js → logoV2Utils-gGK9gErT.js} +1 -1
  158. package/dist/chunks/{magicDocs-DWjL2k7P.js → magicDocs-qdDB_mKb.js} +2 -2
  159. package/dist/chunks/{main-BohPzJFF.js → main-OWFSddRx.js} +82 -82
  160. package/dist/chunks/managedEnv-Aq5BXfY7.js +1 -0
  161. package/dist/chunks/managedEnv-BHoeDjpS.js +1 -0
  162. package/dist/chunks/managedEnvConstants-BPwL2aWI.js +1 -0
  163. package/dist/chunks/{mappers-BDMZFgKx.js → mappers-04gNXJ3w.js} +1 -1
  164. package/dist/chunks/mcp-BSNdwbxR.js +1 -0
  165. package/dist/chunks/mcp-CMnDNI-4.js +6 -0
  166. package/dist/chunks/mcp-D1yA9E56.js +2 -0
  167. package/dist/chunks/memory-D1zbyjxN.js +1 -0
  168. package/dist/chunks/{mode-CUkHFkju.js → mode-DY087x_x.js} +2 -2
  169. package/dist/chunks/{model-CKkOnnnx.js → model-CZViyZnE.js} +1 -1
  170. package/dist/chunks/{model-BY3auM2c.js → model-D0EfJBuw.js} +1 -1
  171. package/dist/chunks/model-DLLkVV6S.js +1 -0
  172. package/dist/chunks/{nativeInstaller-CA5d6_G7.js → nativeInstaller-yj81F75v.js} +1 -1
  173. package/dist/chunks/onChangeAppState-DhGKPG9g.js +1 -0
  174. package/dist/chunks/{openai-Cbomn0Ws.js → openai-EYRnUsco.js} +3 -3
  175. package/dist/chunks/{overageCreditGrant-DsUrmeBh.js → overageCreditGrant-Du3dOYVu.js} +1 -1
  176. package/dist/chunks/{panelCall-BsVoL1uF.js → panelCall-dMvRPAGE.js} +1 -1
  177. package/dist/chunks/{partition-BAakXjvj.js → partition-C4FWzYVm.js} +1 -1
  178. package/dist/chunks/{passes-CLRt7Cvm.js → passes-Daz-ARWD.js} +1 -1
  179. package/dist/chunks/permissions-DF8tAmDF.js +3 -0
  180. package/dist/chunks/{pidLock-D5rUnDB-.js → pidLock-CbC_il6r.js} +2 -2
  181. package/dist/chunks/{plan-SYZ4DXR8.js → plan-rsb_83Fo.js} +1 -1
  182. package/dist/chunks/{plugin-Bfjzhmrk.js → plugin-Cm31-nej.js} +1 -1
  183. package/dist/chunks/pluginAutoupdate-0k03PVff.js +1 -0
  184. package/dist/chunks/pluginBlocklist-wPFCUPdm.js +1 -0
  185. package/dist/chunks/pluginCliCommands-DhL9LbH0.js +1 -0
  186. package/dist/chunks/{pluginFlagging-D9HKAGBC.js → pluginFlagging-CAdaFV_D.js} +1 -1
  187. package/dist/chunks/pluginOperations-Cs_Z4C6O.js +2 -0
  188. package/dist/chunks/pluginStartupCheck-BRXGKGjG.js +1 -0
  189. package/dist/chunks/pluginStartupCheck-KeU0efTj.js +1 -0
  190. package/dist/chunks/{plugins-Dn6ceWrT.js → plugins-CQNKZmjP.js} +4 -4
  191. package/dist/chunks/policyLimits-D2s8M8P2.js +1 -0
  192. package/dist/chunks/{pollConfig-DH2oCtFS.js → pollConfig-2nFzv6Hy.js} +1 -1
  193. package/dist/chunks/{poor-j-y-bv8o.js → poor-DXumVTR4.js} +1 -1
  194. package/dist/chunks/{poorMode-DhzFKpPl.js → poorMode-CBOtooa0.js} +1 -1
  195. package/dist/chunks/poorMode-yNZL5uYf.js +1 -0
  196. package/dist/chunks/print-uxCF5ka5.js +23 -0
  197. package/dist/chunks/{privacy-settings-DHMJREbb.js → privacy-settings-BncbJCV0.js} +1 -1
  198. package/dist/chunks/processBashCommand-CGdwvPmD.js +1 -0
  199. package/dist/chunks/processSlashCommand-DQarepEb.js +5 -0
  200. package/dist/chunks/prompt-BgOdcHkd.js +1 -0
  201. package/dist/chunks/{prompt-BNHtszmZ.js → prompt-CE3sFmZV.js} +5 -5
  202. package/dist/chunks/prompt-CLJKFebn.js +1 -0
  203. package/dist/chunks/{promptEditor-DeMrXUir.js → promptEditor-CyTzyjwG.js} +2 -2
  204. package/dist/chunks/{protocolHandler-BHxBy84Z.js → protocolHandler-JR8pASdH.js} +1 -1
  205. package/dist/chunks/rate-limit-options-C-EqWjeI.js +1 -0
  206. package/dist/chunks/{rcDebugLog-CUy1_F23.js → rcDebugLog-DBB9r8aw.js} +1 -1
  207. package/dist/chunks/reconciler-CYD_XpG4.js +4 -0
  208. package/dist/chunks/{referral-CUaIo_vT.js → referral-CKmHHxj_.js} +1 -1
  209. package/dist/chunks/refresh-ZqZdmLK5.js +1 -0
  210. package/dist/chunks/{registerProtocol-B7Fzdofu.js → registerProtocol-wZv2uiW_.js} +1 -1
  211. package/dist/chunks/{release-notes-fbfv2DC0.js → release-notes-B5K7wVqZ.js} +1 -1
  212. package/dist/chunks/{releaseNotes-CxAHFLPl.js → releaseNotes-B8gbyFFJ.js} +2 -2
  213. package/dist/chunks/{reload-plugins-B9IT9CFA.js → reload-plugins-B9ApSp2m.js} +1 -1
  214. package/dist/chunks/{remote-env-BOklGlll.js → remote-env-CAt1dHIS.js} +1 -1
  215. package/dist/chunks/{remoteBridgeCore-j0bG1zjv.js → remoteBridgeCore-Bk3UdSLJ.js} +1 -1
  216. package/dist/chunks/remoteManagedSettings-bswzAB6W.js +1 -0
  217. package/dist/chunks/rename-CE_U6KE6.js +1 -0
  218. package/dist/chunks/{resume-y7MCTZHJ.js → resume-BicEjsPd.js} +2 -2
  219. package/dist/chunks/{runtimeObserver-CyzLASla.js → runtimeObserver-BrGF5QWX.js} +4 -4
  220. package/dist/chunks/{runtimeObserver-BZcJ1FbH.js → runtimeObserver-CiwnPFjK.js} +1 -1
  221. package/dist/chunks/sandbox-adapter-BtMiHImm.js +1 -0
  222. package/dist/chunks/{sandbox-toggle-CWpBO228.js → sandbox-toggle-D8eebdyI.js} +1 -1
  223. package/dist/chunks/searchExtraTools-hLLPuh7c.js +1 -0
  224. package/dist/chunks/{session-DL4cA_8l.js → session-BZIlR9Gc.js} +2 -2
  225. package/dist/chunks/{sessionDiscovery-DAfNKqp1.js → sessionDiscovery-DfDqTrF1.js} +1 -1
  226. package/dist/chunks/sessionFileAccessHooks-Bm8wiqwe.js +1 -0
  227. package/dist/chunks/sessionMemory-D37S0-jX.js +1 -0
  228. package/dist/chunks/sessionMemory-DmlAG3jq.js +1 -0
  229. package/dist/chunks/sessionMemoryUtils-6EWDHSGU.js +1 -0
  230. package/dist/chunks/sessionObserver-BUw2rzKl.js +1 -0
  231. package/dist/chunks/{sessionObserver-ShbCwJ8x.js → sessionObserver-KgquhGWw.js} +1 -1
  232. package/dist/chunks/sessionStorage-CucBSK5Q.js +1 -0
  233. package/dist/chunks/{sessionTitle-coed9IuJ.js → sessionTitle-DAnM73S0.js} +2 -2
  234. package/dist/chunks/{sessionTracing-D9rUyiq0.js → sessionTracing-_Hh5VXxt.js} +1 -1
  235. package/dist/chunks/settings-BeLFUeie.js +19 -0
  236. package/dist/chunks/settings-Cl16Haug.js +1 -0
  237. package/dist/chunks/settingsSync-BNvFYH3c.js +1 -0
  238. package/dist/chunks/setup-D8kXv3ts.js +3 -0
  239. package/dist/chunks/{shadowedRuleDetection-D1wsAdpp.js → shadowedRuleDetection-C6R5zOUe.js} +1 -1
  240. package/dist/chunks/{sideQuestion-wSi38p81.js → sideQuestion-hUhxls9r.js} +3 -3
  241. package/dist/chunks/{sinks-C_Dl1p4K.js → sinks-BuE17DeZ.js} +2 -2
  242. package/dist/chunks/sinks-FevoYQqP.js +1 -0
  243. package/dist/chunks/{skill-learning-B5tmc7EX.js → skill-learning-CMdxGtxr.js} +1 -1
  244. package/dist/chunks/skillChangeDetector-C65ZLSYV.js +1 -0
  245. package/dist/chunks/{skillGapStore-Df5BWAk5.js → skillGapStore-D18LRJAM.js} +2 -2
  246. package/dist/chunks/{skillGapStore-D-kQKVDZ.js → skillGapStore-Ep62R-2_.js} +1 -1
  247. package/dist/chunks/{skillGenerator-DbcdpAkw.js → skillGenerator-Bc7WwNT8.js} +2 -2
  248. package/dist/chunks/{skillLearning-ClRiDcJH.js → skillLearning-Cs9fJgkV.js} +1 -1
  249. package/dist/chunks/skillLearning-duPZl69A.js +1 -0
  250. package/dist/chunks/{skillPanel-LBd4E-MM.js → skillPanel-Cyzby746.js} +3 -3
  251. package/dist/chunks/{skillSearchPanel-CErRnUwo.js → skillSearchPanel-Cll9ccA5.js} +4 -4
  252. package/dist/chunks/{skills-CBKhfg_a.js → skills-BPPeYBy7.js} +1 -1
  253. package/dist/chunks/{stats-BY4dskVg.js → stats-CqfF4Axp.js} +1 -1
  254. package/dist/chunks/{status-DU-B4SMW.js → status-CC9Q-2Yn.js} +1 -1
  255. package/dist/chunks/{status-BnJIXtKl.js → status-D4IQpsNK.js} +2 -2
  256. package/dist/chunks/statusNoticeHelpers-CEGvdm5d.js +1 -0
  257. package/dist/chunks/syncCache-CANQZ9mQ.js +1 -0
  258. package/dist/chunks/{tag-B-wVW9Aj.js → tag-DDbNqBMu.js} +2 -2
  259. package/dist/chunks/{tasks-CBVL005y.js → tasks-CZvWJYGr.js} +1 -1
  260. package/dist/chunks/teleport-Dk5j03Ix.js +1 -0
  261. package/dist/chunks/{templateJobs-D6998LcG.js → templateJobs-D1BdhZsv.js} +1 -1
  262. package/dist/chunks/{terminalSetup-CuV-qU6v.js → terminalSetup-3JNy6i_J.js} +5 -5
  263. package/dist/chunks/{terminalSetup-0SBdyKF5.js → terminalSetup-Cn6jeYw1.js} +1 -1
  264. package/dist/chunks/{theme-p0AooruD.js → theme-Cg4GNOoQ.js} +1 -1
  265. package/dist/chunks/thinkback-p-vKIRW_.js +1 -0
  266. package/dist/chunks/thinkback-play-DnPTDE8B.js +1 -0
  267. package/dist/chunks/{thinkback-DI2NpvG-.js → thinkback-rFA1do6F.js} +1 -1
  268. package/dist/chunks/{toolEventObserver-DlH73w-S.js → toolEventObserver-CzsCuUMc.js} +1 -1
  269. package/dist/chunks/{toolEventObserver-DTccwC3c.js → toolEventObserver-SFwURL5F.js} +1 -1
  270. package/dist/chunks/toolPool-BR27AMJO.js +1 -0
  271. package/dist/chunks/trustedDevice-BYt39fui.js +1 -0
  272. package/dist/chunks/{trustedDevice-BTYoQCkC.js → trustedDevice-CKedohmT.js} +1 -1
  273. package/dist/chunks/{types-C-MRCL8J.js → types-Dut4311z.js} +2 -2
  274. package/dist/chunks/{ultrareviewCommand-BDFUS3hf.js → ultrareviewCommand-C_4OSBTW.js} +2 -2
  275. package/dist/chunks/{undercover-vuTpCnQJ.js → undercover-D30rKimg.js} +1 -1
  276. package/dist/chunks/undercover-DRSwLozU.js +1 -0
  277. package/dist/chunks/{updateCCB-DFL5Wt_I.js → updateCCB-C2G-U-qA.js} +1 -1
  278. package/dist/chunks/upgrade-Bi-bIz7R.js +1 -0
  279. package/dist/chunks/{upgrade-D5qwcaWQ.js → upgrade-Chs-OQFd.js} +1 -1
  280. package/dist/chunks/{upload-B_yADHX9.js → upload-D8FWMSQx.js} +1 -1
  281. package/dist/chunks/{usage-C0SnnC-i.js → usage-BxVeUt60.js} +1 -1
  282. package/dist/chunks/usage-DUO7Yy1f.js +1 -0
  283. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-DKIqRraH.js → useExitOnCtrlCDWithKeybindings-BwsZ5f0s.js} +1 -1
  284. package/dist/chunks/useMainLoopModel-Gy1Vv4Qr.js +1 -0
  285. package/dist/chunks/useManagePlugins-B11_87VN.js +1 -0
  286. package/dist/chunks/useMergedTools-CR56my9t.js +1 -0
  287. package/dist/chunks/{useSearchInput-D1Vr2Js1.js → useSearchInput-C5OzQnX6.js} +1 -1
  288. package/dist/chunks/{useSettingsErrors-B7BXHchG.js → useSettingsErrors-B9vOZL41.js} +1 -1
  289. package/dist/chunks/{util-BaDs-wL5.js → util-8EHwfg4A.js} +1 -1
  290. package/dist/chunks/validatePlugin-6q1qmnAC.js +1 -0
  291. package/dist/chunks/{vim-C-icQDz1.js → vim-CNDzwoTd.js} +1 -1
  292. package/dist/chunks/{workerRegistry-ChqPPIaO.js → workerRegistry-CvyHvwx-.js} +1 -1
  293. package/dist/chunks/worktree-ogmNCIpz.js +1 -0
  294. package/dist/cli.js +1 -1
  295. package/package.json +1 -1
  296. package/dist/chunks/ApproveApiKey-a2ZonQ3n.js +0 -1
  297. package/dist/chunks/BackgroundTasksDialog-DNeBhGCf.js +0 -2
  298. package/dist/chunks/ClaudeMdExternalIncludesDialog-DFivNFuo.js +0 -1
  299. package/dist/chunks/ConsoleOAuthFlow-CS3zjEPF.js +0 -1
  300. package/dist/chunks/Doctor-BhD-ZzZm.js +0 -1
  301. package/dist/chunks/Doctor-DEQe2q16.js +0 -3
  302. package/dist/chunks/ExitFlow-BttnAv-O.js +0 -2
  303. package/dist/chunks/Grove-sWm-oLBf.js +0 -1
  304. package/dist/chunks/MCPConnectionManager-CNh9dNlk.js +0 -1
  305. package/dist/chunks/MessageSelector-DdR6wJhh.js +0 -3
  306. package/dist/chunks/Messages-Ch6cboMV.js +0 -11
  307. package/dist/chunks/PluginSettings-CGqEzejq.js +0 -17
  308. package/dist/chunks/QueryEngine-CZZMl3PB.js +0 -1
  309. package/dist/chunks/REPL-CG2N7E4Q.js +0 -142
  310. package/dist/chunks/REPL-DvA910N_.js +0 -1
  311. package/dist/chunks/ResumeConversation-DzV2zmuX.js +0 -1
  312. package/dist/chunks/SearchExtraToolsTool-C4uO-Zx3.js +0 -1
  313. package/dist/chunks/Settings-XKw6FI_m.js +0 -2
  314. package/dist/chunks/TrustDialog-DGJ_BisZ.js +0 -1
  315. package/dist/chunks/agents-BIHTGDYh.js +0 -103
  316. package/dist/chunks/allErrors-1896uQA1.js +0 -1
  317. package/dist/chunks/api-BsFW57_Q.js +0 -1
  318. package/dist/chunks/auth-8Vd3_U8t.js +0 -1
  319. package/dist/chunks/auth-DRTjfnGy.js +0 -1
  320. package/dist/chunks/autonomy-DGcy5Rml.js +0 -15
  321. package/dist/chunks/backgroundHousekeeping-3i_d_WW5.js +0 -1
  322. package/dist/chunks/backgroundHousekeeping-BVMf_Tjn.js +0 -17
  323. package/dist/chunks/bridgeConfig-CqIQ_rvD.js +0 -1
  324. package/dist/chunks/bridgeEnabled-D0XC5kNh.js +0 -1
  325. package/dist/chunks/bridgeMain-DHUpZFgL.js +0 -68
  326. package/dist/chunks/bridgeMain-DUbQjgCp.js +0 -1
  327. package/dist/chunks/caches-CWzT7e6Y.js +0 -1
  328. package/dist/chunks/client-BzKQTXzF.js +0 -1
  329. package/dist/chunks/commands-DDamMmo4.js +0 -1
  330. package/dist/chunks/commitAttribution-CgohL8vD.js +0 -1
  331. package/dist/chunks/compact-IFHwxjZ9.js +0 -2
  332. package/dist/chunks/config-DY5-_kk_.js +0 -1
  333. package/dist/chunks/config-WxgxrQoP.js +0 -1
  334. package/dist/chunks/context-noninteractive-Beij5MfU.js +0 -1
  335. package/dist/chunks/conversation-BBB91hEw.js +0 -1
  336. package/dist/chunks/conversation-BWVTM40Y.js +0 -1
  337. package/dist/chunks/createSession-CoQtL5Rj.js +0 -1
  338. package/dist/chunks/crossProjectResume-BasMLl2n.js +0 -40
  339. package/dist/chunks/doctor-1L0TFuGw.js +0 -1
  340. package/dist/chunks/envLessBridgeConfig-CN0_44-p.js +0 -1
  341. package/dist/chunks/envLessBridgeConfig-Ck2-KMq0.js +0 -1
  342. package/dist/chunks/exit-Bm1S_f3i.js +0 -1
  343. package/dist/chunks/extra-usage-UHAWtypK.js +0 -1
  344. package/dist/chunks/extractMemories-BcaklA33.js +0 -1
  345. package/dist/chunks/fast-DALAHO3d.js +0 -1
  346. package/dist/chunks/firstPartyEventLogger-CS9jVz6D.js +0 -1
  347. package/dist/chunks/generateRecap-jGDLI_wU.js +0 -1
  348. package/dist/chunks/generateSessionName-hDJ6HBJ1.js +0 -1
  349. package/dist/chunks/grok-Byblph7F.js +0 -1
  350. package/dist/chunks/hooks-DPLIIpAD.js +0 -1
  351. package/dist/chunks/inboundAttachments-BekVc0W-.js +0 -1
  352. package/dist/chunks/initReplBridge-JQ-afRx9.js +0 -1
  353. package/dist/chunks/language-Cqw5gYJR.js +0 -1
  354. package/dist/chunks/loadAgentsDir-TZjwTqdr.js +0 -1
  355. package/dist/chunks/loadPluginHooks-Ddhsyn0_.js +0 -1
  356. package/dist/chunks/localSearch-DrOAL6f4.js +0 -1
  357. package/dist/chunks/mcp-Bt1ITh-Z.js +0 -1
  358. package/dist/chunks/mcp-CwJ-AIpt.js +0 -6
  359. package/dist/chunks/mcp-W0LFoyFR.js +0 -2
  360. package/dist/chunks/memory-3wV7m7UU.js +0 -1
  361. package/dist/chunks/model-DRXcJyU9.js +0 -1
  362. package/dist/chunks/onChangeAppState-DBmy2Ow_.js +0 -1
  363. package/dist/chunks/permissions-BVSFuwNP.js +0 -3
  364. package/dist/chunks/pluginAutoupdate-reO2PgtQ.js +0 -1
  365. package/dist/chunks/pluginBlocklist-C3H2afWG.js +0 -1
  366. package/dist/chunks/pluginCliCommands-lqdxdkQp.js +0 -1
  367. package/dist/chunks/pluginOperations-EN3EKLux.js +0 -2
  368. package/dist/chunks/pluginStartupCheck-BY73BMT2.js +0 -1
  369. package/dist/chunks/pluginStartupCheck-CwWOlveD.js +0 -1
  370. package/dist/chunks/policyLimits-CkTI5KEt.js +0 -1
  371. package/dist/chunks/poorMode-V11s-3cf.js +0 -1
  372. package/dist/chunks/print-Db_VXmfO.js +0 -23
  373. package/dist/chunks/processBashCommand-BcM_fhV9.js +0 -1
  374. package/dist/chunks/processSlashCommand-DEVo3GPX.js +0 -5
  375. package/dist/chunks/prompt-CrX31AGm.js +0 -1
  376. package/dist/chunks/prompt-IAvMxKDl.js +0 -1
  377. package/dist/chunks/rate-limit-options-DIudL9fb.js +0 -1
  378. package/dist/chunks/reconciler-BXpPyfSY.js +0 -4
  379. package/dist/chunks/refresh-CuaVBIQ0.js +0 -1
  380. package/dist/chunks/remoteManagedSettings-Cq994lyc.js +0 -1
  381. package/dist/chunks/rename-Iev7wQsI.js +0 -1
  382. package/dist/chunks/sandbox-adapter-Cu1FYrkh.js +0 -1
  383. package/dist/chunks/searchExtraTools-BUOUds7p.js +0 -1
  384. package/dist/chunks/sessionFileAccessHooks-2cgIIxPk.js +0 -1
  385. package/dist/chunks/sessionMemory-BS8_TbKj.js +0 -1
  386. package/dist/chunks/sessionMemory-D5fSHXvZ.js +0 -1
  387. package/dist/chunks/sessionMemoryUtils-BWUztNh6.js +0 -1
  388. package/dist/chunks/sessionObserver-ChfQtK2m.js +0 -1
  389. package/dist/chunks/sessionStorage-Cf5wmnyB.js +0 -1
  390. package/dist/chunks/settings-BovzmwMP.js +0 -19
  391. package/dist/chunks/settingsSync-PqU9XGJq.js +0 -1
  392. package/dist/chunks/setup-B_FOvNpp.js +0 -3
  393. package/dist/chunks/sinks-BpcRrN_T.js +0 -1
  394. package/dist/chunks/skillChangeDetector-DNqohXxz.js +0 -1
  395. package/dist/chunks/skillLearning-C5cXZE6_.js +0 -1
  396. package/dist/chunks/statusNoticeHelpers-CzTuGNuC.js +0 -1
  397. package/dist/chunks/teleport-dtqQXM4x.js +0 -1
  398. package/dist/chunks/thinkback-Catprqs_.js +0 -1
  399. package/dist/chunks/thinkback-play-CqrIRx2o.js +0 -1
  400. package/dist/chunks/toolPool-B64V-jmK.js +0 -1
  401. package/dist/chunks/trustedDevice-CiwjT_Y6.js +0 -1
  402. package/dist/chunks/undercover-XYapZ_SS.js +0 -1
  403. package/dist/chunks/upgrade-DIg3j929.js +0 -1
  404. package/dist/chunks/usage-CYJKE8N6.js +0 -1
  405. package/dist/chunks/useMainLoopModel-XetDUXd-.js +0 -1
  406. package/dist/chunks/useManagePlugins-B2KhKiu5.js +0 -1
  407. package/dist/chunks/useMergedTools-CKvwz_Zt.js +0 -1
  408. package/dist/chunks/validatePlugin-DtiYlXby.js +0 -1
  409. package/dist/chunks/worktree-DAn8ooa1.js +0 -1
@@ -0,0 +1,11 @@
1
+ import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{l as r,o as i}from"./envUtils-DSxRz_kt.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{C as s,Gr as c,I as l,N as u,P as d,Pn as f,Rn as p,di as m,fi as h,j as g,mt as _,ot as v,t as y,ui as b,xt as x}from"./src-CDCSSo0U2.js";import{t as S}from"./jsx-runtime-Bb4Xn-E0.js";import{B as C,en as w}from"./state-ix0xIunV.js";import{AE as T,Am as E,Au as D,Bo as O,Cm as k,Co as ee,Do as te,EE as A,Em as j,Eo as M,FS as N,Fb as P,Fo as ne,Fy as F,Iy as re,Ja as ie,Jm as ae,Ka as oe,Ko as se,ME as ce,Mo as I,Mu as le,Nb as ue,Nu as L,Nx as de,Ou as fe,PS as pe,Pb as me,Px as he,Rw as ge,Sm as _e,Tm as ve,To as ye,Uo as be,Wo as xe,XS as Se,Ym as Ce,_o as we,av as Te,cv as Ee,dv as R,eo as De,fh as Oe,go as ke,hx as Ae,jo as je,ju as Me,kE as Ne,ku as Pe,lv as Fe,mx as Ie,nh as Le,oo as Re,pD as ze,ph as Be,qa as Ve,sv as He,th as Ue,to as We,uD as Ge,uv as Ke,wm as qe,wo as Je,yu as Ye,zw as Xe}from"./loadAgentsDir-x3rlgED4.js";import{n as Ze,t as Qe}from"./cwd-CYmmnQVS.js";import{a as $e,l as et,o as tt,r as nt,s as rt}from"./debug-BrXObCdR.js";import{Gt as it,J as at,Jt as ot,g as st,n as ct,q as lt}from"./settings-BeLFUeie.js";import{b as ut,c as z,g as dt}from"./config-DRDuVyzE.js";import{B as ft,L as pt,R as mt,Y as ht}from"./log-BMCygSzM.js";import{f as gt,l as _t}from"./file-DcZWPH2V.js";import{n as vt,r as yt}from"./analytics-BotDBGh0.js";import{S as bt,b as xt,h as St,n as Ct,p as wt,r as Tt,t as Et}from"./startupProfiler-xa3NmN7Z.js";import{l as Dt,o as Ot}from"./stringUtils-DGLPkqJ4.js";import{Bt as kt,Dt as At,E as jt,Gt as Mt,St as Nt,Tt as Pt,_ as Ft,_n as It,b as Lt,vn as Rt}from"./model-CZViyZnE.js";import{Cn as zt,Tn as Bt}from"./prompt-CE3sFmZV.js";import{C as Vt,y as Ht}from"./rcDebugLog-DBB9r8aw.js";import{a as Ut,o as Wt,r as Gt,s as Kt,t as qt}from"./referral-CKmHHxj_.js";import{d as Jt,f as Yt,h as Xt,p as Zt}from"./terminalSetup-3JNy6i_J.js";import{n as Qt,r as $t,t as en}from"./browser-BmZuQom6.js";import{c as tn,r as nn}from"./releaseNotes-B8gbyFFJ.js";import{a as rn,c as an,d as on,i as sn,l as cn,n as ln,o as un,r as dn,t as fn,u as pn}from"./logoV2Utils-gGK9gErT.js";import{n as mn,t as hn}from"./systemTheme-Ceakddth.js";import{n as gn,r as _n}from"./PromptInputFooterSuggestions-BmsFdOu9.js";import{n as vn,t as yn}from"./useMainLoopModel-Gy1Vv4Qr.js";import{n as bn,t as xn}from"./modalContext-DFjKLCB6.js";import{i as Sn,n as Cn,r as wn,s as Tn,t as En}from"./OverageCreditUpsell-BM7szLgm.js";import{n as Dn,r as On,t as kn}from"./statusNoticeHelpers-CEGvdm5d.js";import{homedir as An}from"os";import{relative as jn}from"path";import{fileURLToPath as Mn}from"url";function Nn(e){return Array.isArray?Array.isArray(e):Vn(e)===`[object Array]`}function Pn(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function Fn(e){return e==null?``:Pn(e)}function B(e){return typeof e==`string`}function In(e){return typeof e==`number`}function Ln(e){return e===!0||e===!1||zn(e)&&Vn(e)==`[object Boolean]`}function Rn(e){return typeof e==`object`}function zn(e){return Rn(e)&&e!==null}function V(e){return e!=null}function Bn(e){return!e.trim().length}function Vn(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}function Hn(e){let t=null,n=null,r=null,i=1,a=null;if(B(e)||Nn(e))r=e,t=Un(e),n=Wn(e);else{if(!Er.call(e,`name`))throw Error(Cr(`name`));let o=e.name;if(r=o,Er.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(wr(Wn(o)));t=Un(o),n=Wn(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function Un(e){return Nn(e)?e:e.split(`.`)}function Wn(e){return Nn(e)?e.join(`.`):e}function Gn(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(V(e))if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!V(s))return;if(a===t.length-1&&(B(s)||In(s)||Ln(s)||typeof s==`bigint`))n.push(o===void 0?Fn(s):{v:Fn(s),i:o});else if(Nn(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}};return i(e,B(t)?t.split(`.`):t,0),r?n:n[0]}function Kn(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=1,a=!1;for(let e=0;e<t.length;e++)t.charCodeAt(e)===32?a||(i++,a=!0):a=!1;if(n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}function qn(e,t,{getFn:n=H.getFn,fieldNormWeight:r=H.fieldNormWeight}={}){let i=new Mr({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(Hn)),i.setSources(t),i.create(),i}function Jn(e,{getFn:t=H.getFn,fieldNormWeight:n=H.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new Mr({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function Yn(e=[],t=H.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}function Xn(e,t,n,{location:r=H.location,distance:i=H.distance,threshold:a=H.threshold,findAllMatches:o=H.findAllMatches,minMatchCharLength:s=H.minMatchCharLength,includeMatches:c=H.includeMatches,ignoreLocation:l=H.ignoreLocation}={}){if(t.length>32)throw Error(Sr(32));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=Yn(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function Zn(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function Qn(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}function $n(e){return e.startsWith(`inverse`)}function er(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function tr(e,t){let n=e.match(t);return n?n[1]:null}function nr(e,t={}){return e.replace(/\\\|/g,Br).split(Vr).map(e=>{let n=er(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<zr;){let e=Rr[o],n=tr(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<zr;){let e=Rr[o],n=tr(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}function rr(...e){Ur.push(...e)}function ir(e,t){for(let n=0,r=Ur.length;n<r;n+=1){let r=Ur[n];if(r.condition(e,t))return new r(e,t)}return new Ir(e,t)}function ar(e,t,{auto:n=!0}={}){let r=e=>{if(B(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=ir(e,t)),r}let i=Object.keys(e),a=qr(e);if(!a&&i.length>1&&!Kr(e))return r(Yr(e));if(Jr(e)){let r=a?e[Gr.PATH]:i[0],o=a?e[Gr.PATTERN]:e[r];if(!B(o))throw Error(xr(r));let s={keyId:Wn(r),pattern:o};return n&&(s.searcher=ir(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];Nn(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return Kr(e)||(e=Yr(e)),r(e)}function or(e,{ignoreFieldNorm:t=H.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function sr(e,{ignoreFieldNorm:t=H.ignoreFieldNorm}){e.forEach(e=>{e.score=or(e.matches,{ignoreFieldNorm:t})})}function cr(e){let t=[];return e.matches.forEach(e=>{if(!V(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function lr(e,t,{includeMatches:n=H.includeMatches,includeScore:r=H.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=cr(e)),r&&(a.score=e.score),a})}function ur(e){Qr.has(e)||(Qr.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function dr(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||ur(e),t=>t.match(e)||[]):e=>e.match(Zr)||[]}function fr({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=dr(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=Fr(n)),r(n)}}}function pr(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function mr(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0){pr(e,a,i,r);return}if(o)for(let t=0;t<n;t++){let n=o[t];if(n)if(Array.isArray(n))for(let t of n)pr(e,t.v,i,r);else pr(e,n.v,i,r)}}function hr(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)mr(r,i,t,n);return r}function gr(e,t,n,r){mr(e,t,n,r)}function _r(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function vr(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)_r(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var yr,br,xr,Sr,Cr,wr,Tr,Er,Dr,Or,kr,Ar,jr,H,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r,ei,ti,ni=t((()=>{yr=`Incorrect 'index' type`,br=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,xr=e=>`Invalid value for key ${e}`,Sr=e=>`Pattern length exceeds max of ${e}.`,Cr=e=>`Missing ${e} property in key`,wr=e=>`Property 'weight' in key '${e}' must be a positive integer`,Tr=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,Er=Object.prototype.hasOwnProperty,Dr=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=Hn(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}},Or={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},kr={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},Ar={location:0,threshold:.6,distance:100},jr={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:Gn,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},H=Object.freeze({...kr,...Or,...Ar,...jr}),Mr=class{constructor({getFn:e=H.getFn,fieldNormWeight:t=H.fieldNormWeight}={}){this.norm=Kn(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(B(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(br);if(B(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(br);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!V(e)||Bn(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(V(i)){if(Nn(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(V(n)){if(B(n)){if(!Bn(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(V(n.v)){let t=B(n.v)?n.v:Fn(n.v);if(!Bn(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(B(i)&&!Bn(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}},Nr={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},Pr=RegExp(`[`+Object.keys(Nr).join(``)+`]`,`g`),Fr=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(Pr,e=>Nr[e]):e=>e,Ir=class{constructor(e,{location:t=H.location,threshold:n=H.threshold,distance:r=H.distance,includeMatches:i=H.includeMatches,findAllMatches:a=H.findAllMatches,minMatchCharLength:o=H.minMatchCharLength,isCaseSensitive:s=H.isCaseSensitive,ignoreDiacritics:c=H.ignoreDiacritics,ignoreLocation:l=H.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?Fr(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:Zn(e),startIndex:t})},d=this.pattern.length;if(d>32){let e=0,t=d%32,n=d-t;for(;e<n;)u(this.pattern.substr(e,32),e),e+=32;if(t){let e=d-32;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?Fr(e):e,this.pattern===e){let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=Xn(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=Qn(u)),p}},Lr=new Set([`fuzzy`,`include`]),Rr=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new Ir(e,{location:t.location??H.location,threshold:t.threshold??H.threshold,distance:t.distance??H.distance,includeMatches:t.includeMatches??H.includeMatches,findAllMatches:t.findAllMatches??H.findAllMatches,minMatchCharLength:t.minMatchCharLength??H.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??H.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??H.ignoreDiacritics,ignoreLocation:t.ignoreLocation??H.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],zr=Rr.length,Br=`\0`,Vr=`|`,Hr=class{constructor(e,{isCaseSensitive:t=H.isCaseSensitive,ignoreDiacritics:n=H.ignoreDiacritics,includeMatches:r=H.includeMatches,minMatchCharLength:i=H.minMatchCharLength,ignoreLocation:a=H.ignoreLocation,findAllMatches:o=H.findAllMatches,location:s=H.location,threshold:c=H.threshold,distance:l=H.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?Fr(e):e,this.pattern=e,this.query=nr(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?Fr(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,$n(r.type)&&(c=!0),n&&(Lr.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=Qn(o)),e}}return{isMatch:!1,score:1}}},Ur=[],Wr={AND:`$and`,OR:`$or`},Gr={PATH:`$path`,PATTERN:`$val`},Kr=e=>!!(e[Wr.AND]||e[Wr.OR]),qr=e=>!!e[Gr.PATH],Jr=e=>!Nn(e)&&Rn(e)&&!Kr(e),Yr=e=>({[Wr.AND]:Object.keys(e).map(t=>({[t]:e[t]}))}),Xr=class{constructor(e){this.limit=e,this.heap=[]}get size(){return this.heap.length}shouldInsert(e){return this.size<this.limit||e<this.heap[0].score}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):e.score<this.heap[0].score&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(e){return this.heap.sort(e)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(t[e].score<=t[n].score)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&t[i].score>t[r].score&&(r=i),a<n&&t[a].score>t[r].score&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}},Zr=/[\p{L}\p{M}\p{N}_]+/gu,Qr=new WeakSet,$r=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=fr({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new Ir(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=31}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=Qn(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}},ei=class{constructor(e,t,n){this.options={...H,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new Dr(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=ir(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Mr))throw Error(yr);if(this._myIndex=t||qn(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=fr({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=hr(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!V(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=fr({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});gr(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&vr(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(br);this._invertedIndex&&vr(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(B(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return In(n)&&n>-1&&(e=e.slice(0,n)),e}let c=In(n)&&n>0&&B(e),l;if(c){let t=new Xr(n);B(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),l=t.extractSorted(o)}else l=B(e)?B(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),sr(l,{ignoreFieldNorm:s}),a&&l.sort(o),In(n)&&n>-1&&(l=l.slice(0,n));return lr(l,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!V(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=or(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=ar(e,this.options),n=(e,t,r)=>{if(!(`children`in e)){let{keyId:n,searcher:i}=e,a;return n===null?(a=[],this._myIndex.keys.forEach((e,n)=>{a.push(...this._findMatches({key:e,value:t[n],searcher:i}))})):a=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:i}),a&&a.length?[{idx:r,item:t,matches:a}]:[]}let{children:i,operator:a}=e,o=[];for(let e=0,s=i.length;e<s;e+=1){let s=i[e],c=n(s,t,r);if(c.length)o.push(...c);else if(a===Wr.AND)return[]}return o},r=this._myIndex.records,i=new Map,a=[];return r.forEach(({$:e,i:r})=>{if(V(e)){let o=n(t,e,r);o.length&&(i.has(r)||(i.set(r,{idx:r,item:e,matches:[]}),a.push(i.get(r))),o.forEach(({matches:e})=>{i.get(r).matches.push(...e)}))}}),a}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{keys:a,records:o}=this._myIndex,s=t?null:[];return o.forEach(({$:e,i:o})=>{if(!V(e))return;let c=[],l=!1,u=!1;if(a.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:o,item:e,matches:c};t?(r.score=or(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!V(t))return[];let r=[];if(Nn(t))t.forEach(({v:t,i,n:a})=>{if(!V(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=31){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}},ei.version=`7.4.2`,ei.createIndex=qn,ei.parseIndex=Jn,ei.config=H,ei.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(Tr);return ir(e,{...H,...n}).searchIn(t)},ei.parseQuery=ar,rr(Hr),rr($r),ei.use=function(...e){e.forEach(e=>rr(e))},ti=ei}));function ri(e,t){for(let n of e)if(!t.has(n))return!1;return!0}var ii=t((()=>{}));function ai(e){if(e.type!==`user`)return!1;let t=Array.isArray(e.message.content)?e.message.content[0]:void 0;return!t||typeof t==`string`||t?.type!==`text`||!t.text.includes(`<task-notification`)||we(t.text,`status`)!==`completed`?!1:we(t.text,`summary`)?.startsWith(`Background command `)??!1}function oi(e,t){if(!he()||t)return e;let n=[],r=0;for(;r<e.length;){let t=e[r];if(ai(t)){let i=0;for(;r<e.length&&ai(e[r]);)i++,r++;i===1?n.push(t):n.push({...t,message:{role:`user`,content:[{type:`text`,text:`<${ft}><${pt}>completed</${pt}><${mt}>${i} background commands completed</${mt}></${ft}>`}]}})}else n.push(t),r++}return n}var si=t((()=>{ht(),Ye(),de(),I()}));function ci(e){return e.type===`system`&&e.subtype===`stop_hook_summary`&&e.hookLabel!==void 0}function li(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(ci(r)){let i=r.hookLabel,a=[];for(;n<e.length;){let t=e[n];if(!ci(t)||t.hookLabel!==i)break;a.push(t),n++}a.length===1?t.push(r):t.push({...r,hookCount:a.reduce((e,t)=>e+t.hookCount,0),hookInfos:a.flatMap(e=>e.hookInfos),hookErrors:a.flatMap(e=>e.hookErrors),preventedContinuation:a.some(e=>e.preventedContinuation),hasOutput:a.some(e=>e.hasOutput),totalDurationMs:Math.max(...a.map(e=>e.totalDurationMs??0))})}else t.push(r),n++}return t}var ui=t((()=>{}));function di(e){let t=mi.get(e);return t||(t=new Set(e.filter(e=>e.renderGroupedToolUse).map(e=>e.name)),mi.set(e,t)),t}function fi(e){if(e.type===`assistant`&&e.message?.content&&Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_use`){let t=e.message.content[0];return{messageId:e.message.id,toolUseId:t.id,toolName:t.name}}return null}function pi(e,t,n=!1){if(n)return{messages:e};let r=di(t),i=new Map;for(let t of e){let e=fi(t);if(e&&r.has(e.toolName)){let n=`${e.messageId}:${e.toolName}`,r=i.get(n)??[];r.push(t),i.set(n,r)}}let a=new Map,o=new Set;for(let[e,t]of i)if(t.length>=2){a.set(e,t);for(let e of t){let t=fi(e);t&&o.add(t.toolUseId)}}let s=new Map;for(let t of e)if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content))for(let e of t.message.content)e.type===`tool_result`&&o.has(e.tool_use_id)&&s.set(e.tool_use_id,t);let c=[],l=new Set;for(let t of e){let e=fi(t);if(e){let t=`${e.messageId}:${e.toolName}`,n=a.get(t);if(n){if(!l.has(t)){l.add(t);let r=n[0],i=[];for(let e of n){let t=e.message.content[0].id,n=s.get(t);n&&i.push(n)}let a={type:`grouped_tool_use`,toolName:e.toolName,messages:n,results:i,displayMessage:r,uuid:`grouped-${r.uuid}`,timestamp:r.timestamp,messageId:e.messageId};c.push(a)}continue}}if(t.type===`user`&&t.message?.content&&Array.isArray(t.message.content)){let e=t.message.content.filter(e=>e.type===`tool_result`);if(e.length>0&&e.every(e=>o.has(e.tool_use_id)))continue}c.push(t)}return{messages:c}}var mi,hi=t((()=>{mi=new WeakMap}));function gi(e){let t=Si.get(e);if(t!==void 0)return t;let n=_i(e).toLowerCase();return Si.set(e,n),n}function _i(e){let t=``;switch(e.type){case`user`:{let n=e.message.content;if(typeof n==`string`)t=xi.has(n)?``:n;else{let r=[];for(let t of n??[])t.type===`text`?xi.has(t.text)||r.push(t.text):t.type===`tool_result`&&r.push(yi(e.toolUseResult));t=r.join(`
2
+ `)}break}case`assistant`:{let n=e.message.content;Array.isArray(n)&&(t=n.flatMap(e=>e.type===`text`?[e.text]:e.type===`tool_use`?[vi(e.input)]:[]).join(`
3
+ `));break}case`attachment`:if(e.attachment.type===`relevant_memories`)t=(e.attachment.memories??[]).map(e=>e.content).join(`
4
+ `);else if(e.attachment.type===`queued_command`&&e.attachment.commandMode!==`task-notification`&&!e.attachment.isMeta){let n=e.attachment.prompt;t=typeof n==`string`?n:n.flatMap(e=>e.type===`text`?[e.text]:[]).join(`
5
+ `)}break;case`collapsed_read_search`:e.relevantMemories&&(t=e.relevantMemories.map(e=>e.content).join(`
6
+ `));break;default:break}let n=t,r=n.indexOf(`<system-reminder>`);for(;r>=0;){let e=n.indexOf(bi,r);if(e<0)break;n=n.slice(0,r)+n.slice(e+18),r=n.indexOf(`<system-reminder>`)}return n}function vi(e){if(!e||typeof e!=`object`)return``;let t=e,n=[];for(let e of[`command`,`pattern`,`file_path`,`path`,`prompt`,`description`,`query`,`url`,`skill`]){let r=t[e];typeof r==`string`&&n.push(r)}for(let e of[`args`,`files`]){let r=t[e];Array.isArray(r)&&r.every(e=>typeof e==`string`)&&n.push(r.join(` `))}return n.join(`
7
+ `)}function yi(e){if(!e||typeof e!=`object`)return typeof e==`string`?e:``;let t=e;if(typeof t.stdout==`string`){let e=typeof t.stderr==`string`?t.stderr:``;return t.stdout+(e?`
8
+ `+e:``)}if(t.file&&typeof t.file==`object`&&typeof t.file.content==`string`)return t.file.content;let n=[];for(let e of[`content`,`output`,`result`,`text`,`message`]){let r=t[e];typeof r==`string`&&n.push(r)}for(let e of[`filenames`,`lines`,`results`]){let r=t[e];Array.isArray(r)&&r.every(e=>typeof e==`string`)&&n.push(r.join(`
9
+ `))}return n.join(`
10
+ `)}var bi,xi,Si,Ci=t((()=>{I(),bi=`</system-reminder>`,xi=new Set([Ve,ie]),Si=new WeakMap}));function wi({pose:e=`default`}={}){return(0,Ti.jsxs)(l,{flexDirection:`column`,alignItems:`center`,children:[(0,Ti.jsx)(d,{color:`clawd_body`,children:` █████ `}),(0,Ti.jsx)(d,{color:`clawd_body`,children:`██ ● ● ██`}),(0,Ti.jsx)(d,{color:`clawd_body`,children:`██ ▄▄▄ ██`}),(0,Ti.jsx)(d,{color:`clawd_body`,children:` █ █ █ █ `})]})}var Ti,Ei=t((()=>{h(),y(),Ti=S()}));function Di(e){let{title:t,lines:n,footer:r,emptyMessage:i,customContent:a}=e,o=c(t);if(a!==void 0)o=Math.max(o,a.width);else if(n.length===0&&i)o=Math.max(o,c(i));else{let e=Math.max(0,...n.map(e=>e.timestamp?c(e.timestamp):0));for(let t of n){let n=e>0?e:0,r=c(t.text)+(n>0?n+2:0);o=Math.max(o,r)}}return r&&(o=Math.max(o,c(r))),o}function Oi({config:e,actualWidth:t}){let{title:n,lines:r,footer:i,emptyMessage:a,customContent:o}=e,s=Math.max(0,...r.map(e=>e.timestamp?c(e.timestamp):0));return(0,U.jsxs)(l,{flexDirection:`column`,width:t,children:[(0,U.jsx)(d,{bold:!0,color:`claude`,children:n}),o?(0,U.jsxs)(U.Fragment,{children:[o.content,i&&(0,U.jsx)(d,{dimColor:!0,italic:!0,children:bt(i,t)})]}):r.length===0&&a?(0,U.jsx)(d,{dimColor:!0,children:bt(a,t)}):(0,U.jsxs)(U.Fragment,{children:[r.map((e,n)=>{let r=Math.max(10,t-(s>0?s+2:0));return(0,U.jsxs)(d,{children:[s>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(d,{dimColor:!0,children:(e.timestamp||``).padEnd(s)}),` `]}),(0,U.jsx)(d,{children:bt(e.text,r)})]},n)}),i&&(0,U.jsx)(d,{dimColor:!0,italic:!0,children:bt(i,t)})]})]})}var U,ki=t((()=>{h(),y(),xt(),U=S()}));function Ai({feeds:e,maxWidth:t}){let n=e.map(e=>Di(e)),r=Math.max(...n),i=Math.min(r,t);return(0,Mi.jsx)(l,{flexDirection:`column`,children:e.map((t,n)=>(0,Mi.jsxs)(ji.Fragment,{children:[(0,Mi.jsx)(Oi,{config:t,actualWidth:i}),n<e.length-1&&(0,Mi.jsx)(s,{color:`claude`,width:i})]},n))})}var ji,Mi,Ni=t((()=>{ji=n(h(),1),y(),ki(),Mi=S()}));function Pi(e){let t=e.map(e=>{let t=St(e.modified);return{text:(e.summary&&e.summary!==`No prompt`?e.summary:e.firstPrompt)||``,timestamp:t}});return{title:`Recent activity`,lines:t,footer:t.length>0?`/resume for more`:void 0,emptyMessage:`No recent activity`}}function Fi(e){let t=e.map(e=>{if(process.env.USER_TYPE===`ant`){let t=e.match(/^(\d+\s+\w+\s+ago)\s+(.+)$/);if(t)return{timestamp:t[1],text:t[2]||``}}return{text:e}}),n=process.env.USER_TYPE===`ant`?`Unable to fetch latest claude-cli-internal commits`:`Check the Claude Code changelog for updates`;return{title:process.env.USER_TYPE===`ant`?`What's new [ANT-ONLY: Latest CC commits]`:`What's new`,lines:t,footer:t.length>0?`/release-notes for more`:void 0,emptyMessage:n}}function Ii(e){let t=e.filter(({isEnabled:e})=>e).sort((e,t)=>Number(e.isComplete)-Number(t.isComplete)).map(({text:e,isComplete:t})=>({text:`${t?`${o.tick} `:``}${e}`})),n=Qe()===An()?`Note: You have launched claude in your home directory. For the best experience, launch it in a project directory instead.`:void 0;return n&&t.push({text:n}),{title:`Tips for getting started`,lines:t}}function Li(){let e=Ut(),t=e?`Share Claude Code and earn ${Gt(e)} of extra usage`:`Share Claude Code with friends`;return{title:`3 guest passes`,lines:[],customContent:{content:(0,Ri.jsxs)(Ri.Fragment,{children:[(0,Ri.jsx)(l,{marginY:1,children:(0,Ri.jsx)(d,{color:`claude`,children:`[✻] [✻] [✻]`})}),(0,Ri.jsx)(d,{dimColor:!0,children:t})]}),width:48},footer:`/passes`}}var Ri,zi=t((()=>{a(),y(),Kt(),Ze(),xt(),Ri=S()}));function Bi(e,t,n){return Array.from({length:n},()=>({pose:e,offset:t}))}function Vi(){let{pose:e,bounceOffset:t,onClick:n}=Hi();return(0,Wi.jsx)(l,{height:Xi,flexDirection:`column`,onClick:n,children:(0,Wi.jsx)(l,{marginTop:t,flexShrink:0,children:(0,Wi.jsx)(wi,{pose:e})})})}function Hi(){let[e]=(0,Ui.useState)(()=>ct().prefersReducedMotion??!1),[t,n]=(0,Ui.useState)(-1),r=(0,Ui.useRef)(Gi),i=()=>{e||t!==-1||(r.current=Ki[Math.floor(Math.random()*Ki.length)],n(0))};(0,Ui.useEffect)(()=>{if(t===-1)return;if(t>=r.current.length){n(-1);return}let e=setTimeout(n,Ji,Yi);return()=>clearTimeout(e)},[t]);let a=r.current,o=t>=0&&t<a.length?a[t]:qi;return{pose:o.pose,bounceOffset:o.offset,onClick:i}}var Ui,Wi,Gi,Ki,qi,Ji,Yi,Xi,Zi=t((()=>{h(),Ui=n(h(),1),y(),st(),Ei(),Wi=S(),Gi=[...Bi(`default`,1,2),...Bi(`arms-up`,0,3),...Bi(`default`,0,1),...Bi(`default`,1,2),...Bi(`arms-up`,0,3),...Bi(`default`,0,1)],Ki=[Gi,[...Bi(`look-right`,0,5),...Bi(`look-left`,0,5),...Bi(`default`,0,1)]],qi={pose:`default`,offset:0},Ji=60,Yi=e=>e+1,Xi=3}));function Qi(){let e=Wt();e==null||e<=0||e>(z().passesLastSeenRemaining??0)&&ut(t=>({...t,passesUpsellSeenCount:0,hasVisitedPasses:!1,passesLastSeenRemaining:e}))}function $i(){let{eligible:e,hasCache:t}=qt();if(!e||!t)return!1;Qi();let n=z();return!((n.passesUpsellSeenCount??0)>=3||n.hasVisitedPasses)}function ea(){let[e]=(0,ra.useState)(()=>$i());return e}function ta(){let e=0;ut(t=>(e=(t.passesUpsellSeenCount??0)+1,{...t,passesUpsellSeenCount:e})),yt(`tengu_guest_passes_upsell_shown`,{seen_count:e})}function na(){let e=Ut();return(0,ia.jsxs)(d,{dimColor:!0,children:[(0,ia.jsx)(d,{color:`claude`,children:`[✻]`}),` `,(0,ia.jsx)(d,{color:`claude`,children:`[✻]`}),` `,(0,ia.jsx)(d,{color:`claude`,children:`[✻]`}),` ·`,` `,e?`Share Claude Code and earn ${Gt(e)} of extra usage · /passes`:`3 guest passes at /passes`]})}var ra,ia,aa=t((()=>{h(),ra=n(h(),1),y(),vt(),Kt(),dt(),ia=S()}));function oa(){let{columns:e}=v(),t=N(e=>e.agent),n=jt(vn()),{version:r,cwd:i,billingType:a,agentName:o}=un(),s=t??o,u=ea(),f=Tn();(0,sa.useEffect)(()=>{u&&ta()},[u]),(0,sa.useEffect)(()=>{f&&!u&&wn()},[f,u]);let p=Math.max(e-15,20),m=bt(r,Math.max(p-11,6)),{shouldSplit:h,truncatedModel:g,truncatedBilling:_}=dn(n,a,p),y=s?p-1-c(s)-3:p,b=on(i,Math.max(y,10));return(0,W.jsx)(ve,{children:(0,W.jsxs)(l,{flexDirection:`row`,gap:2,alignItems:`center`,children:[he()?(0,W.jsx)(Vi,{}):(0,W.jsx)(wi,{}),(0,W.jsxs)(l,{flexDirection:`column`,children:[(0,W.jsxs)(d,{children:[(0,W.jsx)(d,{bold:!0,children:`Work Mate`}),` `,(0,W.jsxs)(d,{dimColor:!0,children:[`v`,m]})]}),h?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(d,{dimColor:!0,children:g}),(0,W.jsx)(d,{dimColor:!0,children:_})]}):(0,W.jsxs)(d,{dimColor:!0,children:[g,` · `,_]}),(0,W.jsx)(d,{dimColor:!0,children:s?`@${s} · ${b}`:b}),u&&(0,W.jsx)(na,{}),!u&&f&&(0,W.jsx)(En,{maxWidth:p,twoLine:!0})]})]})})}var sa,W,ca=t((()=>{sa=n(h(),1),yn(),Se(),y(),pe(),xt(),de(),pn(),Ft(),j(),Zi(),Ei(),aa(),Sn(),W=S()}));function la(){let e=(0,da.useMemo)(ua,[]),t=(0,da.useMemo)(()=>z().lastShownEmergencyTip,[]),n=e.tip&&e.tip!==t;return(0,da.useEffect)(()=>{n&&ut(t=>t.lastShownEmergencyTip===e.tip?t:{...t,lastShownEmergencyTip:e.tip})},[n,e.tip]),n?(0,fa.jsx)(l,{paddingLeft:2,flexDirection:`column`,children:(0,fa.jsx)(d,{...e.color===`warning`?{color:`warning`}:e.color===`error`?{color:`error`}:{dimColor:!0},children:e.tip})}):null}function ua(){return pa}var da,fa,pa,ma=t((()=>{h(),da=n(h(),1),y(),dt(),fa=S(),pa={tip:``,color:`dim`}}));function ha({char:e=`✻`}){let[t]=(0,ga.useState)(()=>ct().prefersReducedMotion??!1),[n,r]=(0,ga.useState)(t),i=(0,ga.useRef)(null),[a,o]=_(n?null:50);return(0,ga.useEffect)(()=>{if(n)return;let e=setTimeout(r,ya,!0);return()=>clearTimeout(e)},[n]),n?(0,_a.jsx)(l,{ref:a,children:(0,_a.jsx)(d,{color:ba,children:e})}):(i.current===null&&(i.current=o),(0,_a.jsx)(l,{ref:a,children:(0,_a.jsx)(d,{color:P(ue((o-i.current)/va*360%360)),children:e})}))}var ga,_a,va,ya,ba,xa=t((()=>{h(),ga=n(h(),1),ot(),y(),st(),me(),_a=S(),va=1500,ya=va*2,ba=P({r:153,g:153,b:153})}));function Sa(){return Lt()&&(z().opus1mMergeNoticeSeenCount??0)<Ea}function Ca(){let[e]=(0,wa.useState)(Sa);return(0,wa.useEffect)(()=>{if(!e)return;let t=(z().opus1mMergeNoticeSeenCount??0)+1;ut(e=>(e.opus1mMergeNoticeSeenCount??0)>=t?e:{...e,opus1mMergeNoticeSeenCount:t})},[e]),e?(0,Ta.jsxs)(l,{paddingLeft:2,children:[(0,Ta.jsx)(ha,{char:`↑`}),(0,Ta.jsx)(d,{dimColor:!0,children:` Opus now defaults to 1M context · 5x more room, same pricing`})]}):null}var wa,Ta,Ea,Da=t((()=>{h(),wa=n(h(),1),ot(),y(),dt(),Ft(),xa(),Ta=S(),Ea=6}));function Oa(){return null}var ka=t((()=>{}));function Aa(){return null}var ja=t((()=>{}));function Ma(){let e=an(),t=z().oauthAccount?.displayName??``,{columns:n}=v(),i=Xt(),a=Ge.isSandboxingEnabled(),o=ea(),s=Tn(),u=N(e=>e.agent),f=z(),p;try{p=cn(3)}catch{p=[]}let[m]=(0,Na.useState)(()=>{let e=ct().companyAnnouncements;if(!(!e||e.length===0))return f.numStartups===1?e[0]:e[Math.floor(Math.random()*e.length)]}),{hasReleaseNotes:h}=nn(f.lastReleaseNotesSeen);(0,Na.useEffect)(()=>{z().lastReleaseNotesSeen!==`0.0.7`&&(ut(e=>e.lastReleaseNotesSeen===`0.0.7`?e:{...e,lastReleaseNotesSeen:`0.0.7`}),i&&Yt())},[f,i]);let _=!h&&!i&&!r(process.env.CLAUDE_CODE_FORCE_FULL_LOGO);(0,Na.useEffect)(()=>{o&&!i&&!_&&ta()},[o,i,_]),(0,Na.useEffect)(()=>{s&&!i&&!o&&!_&&wn()},[s,i,o,_]);let y=jt(vn()),{version:b,cwd:x,billingType:S,agentName:C}=un(),w=u??C,T=bt(y,Pa-20);if(!h&&!i&&!r(process.env.CLAUDE_CODE_FORCE_FULL_LOGO))return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(oa,{}),(0,G.jsx)(Ca,{}),tt()&&(0,G.jsxs)(l,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(d,{color:`warning`,children:`Debug mode enabled`}),(0,G.jsxs)(d,{dimColor:!0,children:[`Logging to: `,rt()?`stderr`:nt()]})]}),(0,G.jsx)(la,{}),process.env.CLAUDE_CODE_TMUX_SESSION&&(0,G.jsxs)(l,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsxs)(d,{dimColor:!0,children:[`tmux session: `,process.env.CLAUDE_CODE_TMUX_SESSION]}),(0,G.jsx)(d,{dimColor:!0,children:process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Claude uses ${process.env.CLAUDE_CODE_TMUX_PREFIX})`:`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} d`})]}),m&&(0,G.jsxs)(l,{paddingLeft:2,flexDirection:`column`,children:[!process.env.IS_DEMO&&f.oauthAccount?.organizationName&&(0,G.jsxs)(d,{dimColor:!0,children:[`Message from `,f.oauthAccount.organizationName,`:`]}),(0,G.jsx)(d,{children:m})]}),process.env.USER_TYPE===`ant`&&!process.env.DEMO_VERSION&&(0,G.jsx)(l,{paddingLeft:2,flexDirection:`column`,children:(0,G.jsx)(d,{dimColor:!0,children:`Use /issue to report model behavior issues`})}),process.env.USER_TYPE===`ant`&&!process.env.DEMO_VERSION&&(0,G.jsxs)(l,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(d,{color:`warning`,children:`[ANT-ONLY] Logs:`}),(0,G.jsxs)(d,{dimColor:!0,children:[`API calls: `,_t(ge())]}),(0,G.jsxs)(d,{dimColor:!0,children:[`Debug logs: `,_t(nt())]}),Tt()&&(0,G.jsxs)(d,{dimColor:!0,children:[`Startup Perf: `,_t(Et())]})]}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(Oa,{}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(Aa,{})]});let E=rn(n),D=mn(z().theme),O=` ${g(`claude`,D)(`Work Mate`)} ${g(`inactive`,D)(`v${b}`)} `,k=g(`claude`,D)(` Work Mate `);if(E===`compact`){let e=sn(t);c(e)>n-4&&(e=sn(null));let r=w?n-4-1-c(w)-3:n-4,i=on(x,Math.max(r,10));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ve,{children:(0,G.jsxs)(l,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:k,position:`top`,align:`start`,offset:1},paddingX:1,paddingY:1,alignItems:`center`,width:n,children:[(0,G.jsx)(d,{bold:!0,children:e}),(0,G.jsx)(l,{marginY:1,children:(0,G.jsx)(wi,{})}),(0,G.jsx)(d,{dimColor:!0,children:T}),(0,G.jsx)(d,{dimColor:!0,children:S}),(0,G.jsx)(d,{dimColor:!0,children:w?`@${w} · ${i}`:i})]})}),(0,G.jsx)(Ca,{}),a&&(0,G.jsx)(l,{marginTop:1,flexDirection:`column`,children:(0,G.jsx)(d,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(Oa,{}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(Aa,{})]})}let ee=sn(t),te=!process.env.IS_DEMO&&f.oauthAccount?.organizationName?`${T} · ${S} · ${f.oauthAccount.organizationName}`:`${T} · ${S}`,A=w?Pa-1-c(w)-3:Pa,j=on(x,Math.max(A,10)),M=w?`@${w} · ${j}`:j,{leftWidth:P,rightWidth:ne}=fn(n,E,ln(ee,M,te));return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(ve,{children:(0,G.jsx)(l,{flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,borderText:{content:O,position:`top`,align:`start`,offset:3},children:(0,G.jsxs)(l,{flexDirection:E===`horizontal`?`row`:`column`,paddingX:1,gap:1,children:[(0,G.jsxs)(l,{flexDirection:`column`,width:P,justifyContent:`space-between`,alignItems:`center`,minHeight:9,children:[(0,G.jsx)(l,{marginTop:1,children:(0,G.jsx)(d,{bold:!0,children:ee})}),(0,G.jsx)(wi,{}),(0,G.jsxs)(l,{flexDirection:`column`,alignItems:`center`,children:[(0,G.jsx)(d,{dimColor:!0,children:te}),(0,G.jsx)(d,{dimColor:!0,children:M})]})]}),E===`horizontal`&&(0,G.jsx)(l,{height:`100%`,borderStyle:`single`,borderColor:`claude`,borderDimColor:!0,borderTop:!1,borderBottom:!1,borderLeft:!1}),E===`horizontal`&&(0,G.jsx)(Ai,{feeds:i?[Ii(Jt()),Pi(e)]:o?[Pi(e),Li()]:s?[Pi(e),Cn()]:[Pi(e),Fi(p)],maxWidth:ne})]})})}),(0,G.jsx)(Ca,{}),tt()&&(0,G.jsxs)(l,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(d,{color:`warning`,children:`Debug mode enabled`}),(0,G.jsxs)(d,{dimColor:!0,children:[`Logging to: `,rt()?`stderr`:nt()]})]}),(0,G.jsx)(la,{}),process.env.CLAUDE_CODE_TMUX_SESSION&&(0,G.jsxs)(l,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsxs)(d,{dimColor:!0,children:[`tmux session: `,process.env.CLAUDE_CODE_TMUX_SESSION]}),(0,G.jsx)(d,{dimColor:!0,children:process.env.CLAUDE_CODE_TMUX_PREFIX_CONFLICTS?`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} ${process.env.CLAUDE_CODE_TMUX_PREFIX} d (press prefix twice - Claude uses ${process.env.CLAUDE_CODE_TMUX_PREFIX})`:`Detach: ${process.env.CLAUDE_CODE_TMUX_PREFIX} d`})]}),m&&(0,G.jsxs)(l,{paddingLeft:2,flexDirection:`column`,children:[!process.env.IS_DEMO&&f.oauthAccount?.organizationName&&(0,G.jsxs)(d,{dimColor:!0,children:[`Message from `,f.oauthAccount.organizationName,`:`]}),(0,G.jsx)(d,{children:m})]}),a&&(0,G.jsx)(l,{paddingLeft:2,flexDirection:`column`,children:(0,G.jsx)(d,{color:`warning`,children:`Your bash commands will be sandboxed. Disable with /sandbox.`})}),process.env.USER_TYPE===`ant`&&!process.env.DEMO_VERSION&&(0,G.jsx)(l,{paddingLeft:2,flexDirection:`column`,children:(0,G.jsx)(d,{dimColor:!0,children:`Use /issue to report model behavior issues`})}),process.env.USER_TYPE===`ant`&&!process.env.DEMO_VERSION&&(0,G.jsxs)(l,{paddingLeft:2,flexDirection:`column`,children:[(0,G.jsx)(d,{color:`warning`,children:`[ANT-ONLY] Logs:`}),(0,G.jsxs)(d,{dimColor:!0,children:[`API calls: `,_t(ge())]}),(0,G.jsxs)(d,{dimColor:!0,children:[`Debug logs: `,_t(nt())]}),Tt()&&(0,G.jsxs)(d,{dimColor:!0,children:[`Startup Perf: `,_t(Et())]})]}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(Oa,{}),process.env.USER_TYPE===`ant`&&(0,G.jsx)(Aa,{})]})}var Na,G,Pa,Fa=t((()=>{h(),y(),Se(),pn(),xt(),gt(),Ei(),Ni(),zi(),dt(),hn(),st(),$e(),Na=n(h(),1),Zt(),ca(),j(),tn(),Xe(),i(),Ct(),ma(),Da(),ka(),ja(),ze(),aa(),Sn(),pe(),yn(),Ft(),G=S(),Pa=50}));function Ia({message:e,isTranscriptMode:t}){let n=e.message?.content,r=Array.isArray(n)?n:[];if(!(t&&e.type===`assistant`&&e.message?.model&&r.some(e=>e?.type===`text`)))return null;let i=e.message.model;return(0,La.jsx)(l,{minWidth:c(i)+8,children:(0,La.jsx)(d,{dimColor:!0,children:i})})}var La,Ra=t((()=>{h(),y(),La=S()}));function za({message:e,isTranscriptMode:t}){if(!(t&&e.timestamp&&e.type===`assistant`&&Array.isArray(e.message.content)&&e.message.content.some(e=>e.type===`text`)))return null;let n=new Date(e.timestamp).toLocaleTimeString(`en-US`,{hour:`2-digit`,minute:`2-digit`,hour12:!0});return(0,Ba.jsx)(l,{minWidth:c(n),children:(0,Ba.jsx)(d,{dimColor:!0,children:n})})}var Ba,Va=t((()=>{h(),y(),Ba=S()}));function Ha(e,t,n,r){for(let i=t+1;i<e.length;i++){let t=e[i];if(t?.type===`assistant`){let e=Ya(t.message.content);if(e?.type===`thinking`||e?.type===`redacted_thinking`||e?.type===`tool_use`&&(D(e.name,e.input,n).isCollapsible||r.has(e.id)))continue;return!0}if(!(t?.type===`system`||t?.type===`attachment`)&&!(t?.type===`user`&&Ya(t.message.content)?.type===`tool_result`)){if(t?.type===`grouped_tool_use`){let e=Ya(t.messages[0]?.message.content)?.input;if(D(t.toolName,e,n).isCollapsible)continue}return!0}}return!1}function Ua({message:e,isUserContinuation:t,hasContentAfter:n,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,streamingToolUseIDs:s,screen:c,canAnimate:u,onOpenRateLimitOptions:d,lastThinkingBlockId:f,latestBashOutputUUID:p,columns:m,isLoading:h,lookups:g,shouldCollapseDiffs:_}){let v=c===`transcript`,y=e.type===`grouped_tool_use`,b=e.type===`collapsed_read_search`,x=b&&(le(e,o)||h&&!n),S=y?e.displayMessage:b?Pe(e):e,C=y||b?[]:Je(e,g),w=fs(e,s,o,y||b?oe:ye(e,g),c,g),T=!1;if(u)if(y)T=e.messages.some(e=>{let t=Ya(e.message.content);return t?.type===`tool_use`&&o.has(t.id)});else if(b)T=le(e,o);else{let t=M(e);T=!t||o.has(t)}let E=v&&S.type===`assistant`&&Array.isArray(S.message.content)&&S.message.content.some(e=>e.type===`text`)&&(S.timestamp||S.message.model),D=(0,Ja.jsx)(_e,{message:e,lookups:g,addMargin:!E,containerWidth:E?void 0:m,tools:r,commands:i,verbose:a,inProgressToolUseIDs:o,progressMessagesForMessage:C,shouldAnimate:T,shouldShowDot:!0,isTranscriptMode:v,isStatic:w,onOpenRateLimitOptions:d,isActiveCollapsedGroup:x,isUserContinuation:t,lastThinkingBlockId:f,latestBashOutputUUID:p,shouldCollapseDiffs:_});return E?(0,Ja.jsx)(ve,{children:(0,Ja.jsxs)(l,{width:m,flexDirection:`column`,children:[(0,Ja.jsxs)(l,{flexDirection:`row`,justifyContent:`flex-end`,gap:1,marginTop:1,children:[(0,Ja.jsx)(za,{message:S,isTranscriptMode:v}),(0,Ja.jsx)(Ia,{message:S,isTranscriptMode:v})]}),D]})}):(0,Ja.jsx)(ve,{children:D})}function Wa(e,t){if(e.type===`grouped_tool_use`)return e.messages.some(e=>{let n=Ya(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return Me(e).some(e=>t.has(e));let n=M(e);return!!n&&t.has(n)}function Ga(e,t){if(e.type===`grouped_tool_use`)return e.messages.every(e=>{let n=Ya(e.message.content);return n?.type===`tool_use`&&t.has(n.id)});if(e.type===`collapsed_read_search`)return Me(e).every(e=>t.has(e));if(e.type===`assistant`){let n=Ya(e.message.content);if(n?.type===`server_tool_use`)return t.has(n.id)}let n=M(e);return!n||t.has(n)}function Ka(e,t){if(e.message!==t.message||e.screen!==t.screen||e.verbose!==t.verbose||e.message.type===`collapsed_read_search`&&t.screen!==`transcript`||e.columns!==t.columns||e.latestBashOutputUUID===e.message.uuid!=(t.latestBashOutputUUID===t.message.uuid)||e.lastThinkingBlockId!==t.lastThinkingBlockId&&k(t.message))return!1;let n=Wa(e.message,e.streamingToolUseIDs),r=Ga(e.message,e.lookups.resolvedToolUseIDs);return!(n||!r)}var qa,Ja,Ya,Xa,Za=t((()=>{qa=n(h(),1),y(),L(),I(),qe(),Ja=S(),Ra(),Cs(),Va(),j(),Ya=e=>{if(!Array.isArray(e))return;let t=e[0];if(!(t==null||typeof t==`string`))return t},Xa=qa.memo(Ua,Ka)}));function Qa(e){return e.type===`attachment`&&$a.has(e.attachment.type)}var $a,eo=t((()=>{$a=new Set(`hook_success.hook_additional_context.hook_cancelled.command_permissions.agent_mention.budget_usd.critical_system_reminder.edited_image_file.edited_text_file.opened_file_in_ide.output_style.plan_mode.plan_mode_exit.plan_mode_reentry.structured_output.todo_reminder.context_efficiency.deferred_tools_delta.mcp_instructions_delta.token_usage.max_turns_reached.task_reminder.auto_mode.auto_mode_exit.output_token_usage.verify_plan_reminder.current_session_memory.compaction_reminder.date_change`.split(`.`))}));function to(e){return so.filter(t=>t.isActive(e))}var K,no,ro,io,ao,oo,so,co=t((()=>{y(),h(),ce(),a(),Ze(),xt(),kt(),On(),K=S(),no={id:`large-memory-files`,type:`warning`,isActive:e=>Ne(e.memoryFiles).length>0,render:e=>(0,K.jsx)(K.Fragment,{children:Ne(e.memoryFiles).map(e=>{let t=e.path.startsWith(Qe())?jn(Qe(),e.path):e.path;return(0,K.jsxs)(l,{flexDirection:`row`,children:[(0,K.jsx)(d,{color:`warning`,children:o.warning}),(0,K.jsxs)(d,{color:`warning`,children:[`Large `,(0,K.jsx)(d,{bold:!0,children:t}),` will impact performance (`,wt(e.content.length),` chars > `,wt(A),`)`,(0,K.jsx)(d,{dimColor:!0,children:` · /memory to edit`})]})]},e.path)})})},ro={id:`claude-ai-external-token`,type:`warning`,isActive:()=>{let e=At();return Mt()&&(e.source===`ANTHROPIC_AUTH_TOKEN`||e.source===`apiKeyHelper`)},render:()=>{let e=At();return(0,K.jsxs)(l,{flexDirection:`row`,marginTop:1,children:[(0,K.jsx)(d,{color:`warning`,children:o.warning}),(0,K.jsxs)(d,{color:`warning`,children:[`Auth conflict: Using `,e.source,` instead of Claude account subscription token. Either unset`,` `,e.source,", or run `claude /logout`."]})]})}},io={id:`api-key-conflict`,type:`warning`,isActive:()=>{let{source:e}=Nt({skipRetrievingKeyFromApiKeyHelper:!0});return!!Pt()&&(e===`ANTHROPIC_API_KEY`||e===`apiKeyHelper`)},render:()=>{let{source:e}=Nt({skipRetrievingKeyFromApiKeyHelper:!0});return(0,K.jsxs)(l,{flexDirection:`row`,marginTop:1,children:[(0,K.jsx)(d,{color:`warning`,children:o.warning}),(0,K.jsxs)(d,{color:`warning`,children:[`Auth conflict: Using `,e,` instead of Console key. Either unset `,e,", or run `claude /logout`."]})]})}},ao={id:`both-auth-methods`,type:`warning`,isActive:()=>{let{source:e}=Nt({skipRetrievingKeyFromApiKeyHelper:!0}),t=At();return e!==`none`&&t.source!==`none`&&!(e===`apiKeyHelper`&&t.source===`apiKeyHelper`)},render:()=>{let{source:e}=Nt({skipRetrievingKeyFromApiKeyHelper:!0}),t=At();return(0,K.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,K.jsxs)(l,{flexDirection:`row`,children:[(0,K.jsx)(d,{color:`warning`,children:o.warning}),(0,K.jsxs)(d,{color:`warning`,children:[`Auth conflict: Both a token (`,t.source,`) and an API key (`,e,`) are set. This may lead to unexpected behavior.`]})]}),(0,K.jsxs)(l,{flexDirection:`column`,marginLeft:3,children:[(0,K.jsxs)(d,{color:`warning`,children:[`· Trying to use `,t.source===`claude.ai`?`claude.ai`:t.source,`?`,` `,e===`ANTHROPIC_API_KEY`?`Unset the ANTHROPIC_API_KEY environment variable, or claude /logout then say "No" to the API key approval before login.`:e===`apiKeyHelper`?`Unset the apiKeyHelper setting.`:`claude /logout`]}),(0,K.jsxs)(d,{color:`warning`,children:[`· Trying to use `,e,`?`,` `,t.source===`claude.ai`?`claude /logout to sign out of claude.ai.`:`Unset the ${t.source} environment variable.`]})]})]})}},oo={id:`large-agent-descriptions`,type:`warning`,isActive:e=>Dn(e.agentDefinitions)>kn,render:e=>{let t=Dn(e.agentDefinitions);return(0,K.jsxs)(l,{flexDirection:`row`,children:[(0,K.jsx)(d,{color:`warning`,children:o.warning}),(0,K.jsxs)(d,{color:`warning`,children:[`Large cumulative agent descriptions will impact performance (~`,wt(t),` tokens > `,wt(kn),`)`,(0,K.jsx)(d,{dimColor:!0,children:` · /agents to manage`})]})]})}},so=[no,oo,ro,io,ao]}));function lo({agentDefinitions:e}={}){let t={config:z(),agentDefinitions:e,memoryFiles:(0,fo.use)(T())},n=to(t);return n.length===0?null:(0,po.jsx)(l,{flexDirection:`column`,paddingLeft:1,children:n.map(e=>(0,po.jsx)(uo.Fragment,{children:e.render(t)},e.id))})}var uo,fo,po,mo=t((()=>{uo=n(h(),1),fo=n(h(),1),y(),ce(),dt(),co(),po=S()}));function ho(e,t,n){let r=(0,q.useRef)(new Map),i=(0,q.useRef)(0),a=(0,q.useRef)(0),o=(0,q.useRef)({arr:new Float64Array,version:-1,n:-1}),s=(0,q.useRef)(new Map),c=(0,q.useRef)(new Map),l=(0,q.useRef)(n),u=(0,q.useRef)(!1),d=(0,q.useRef)(null),f=(0,q.useRef)(0);if(l.current!==n){let e=l.current/n;l.current=n;for(let[t,n]of r.current)r.current.set(t,Math.max(1,Math.round(n*e)));i.current++,u.current=!0,f.current=2}let p=f.current>0?d.current:null,m=(0,q.useRef)(0),h=(0,q.useRef)(null);(0,q.useSyncExternalStore)((0,q.useCallback)(t=>e.current?.subscribe(t)??Co,[e]),()=>{let t=e.current;if(!t)return NaN;let n=t.getScrollTop()+t.getPendingDelta(),r=Math.floor(n/yo);return t.isSticky()?~r:r});let g=e.current?.getScrollTop()??-1,_=e.current?.getPendingDelta()??0,v=e.current?.getViewportHeight()??0,y=e.current?.isSticky()??!0;(0,q.useMemo)(()=>{let e=new Set(t),n=!1;for(let t of r.current.keys())e.has(t)||(r.current.delete(t),n=!0);for(let t of c.current.keys())e.has(t)||c.current.delete(t);n&&i.current++},[t]);let b=t.length;if(o.current.version!==i.current||o.current.n!==b){let e=o.current.arr.length>=b+1?o.current.arr:new Float64Array(b+1);e[0]=0;for(let n=0;n<b;n++)e[n+1]=e[n]+(r.current.get(t[n])??go);o.current={arr:e,version:i.current,n:b}}let x=o.current.arr,S=x[b],C,w;if(p)[C,w]=p,C=Math.min(C,b),w=Math.min(w,b);else if(v===0||g<0)C=Math.max(0,b-vo),w=b;else{if(y){let e=v+_o;for(C=b;C>0&&S-x[C-1]<e;)C--;w=b}else{let e=m.current,n=v*3,i=Math.min(g,g+_),a=Math.max(g,g+_),o=a-i,c=o>n&&_<0?a-n:i,l=c+Math.min(o,n),u=Math.max(0,c-e),f=l-e,p=u-_o;{let e=0,t=b;for(;e<t;){let n=e+t>>1;x[n+1]<=p?e=n+1:t=n}C=e}{let e=d.current;if(e&&e[0]<C)for(let n=e[0];n<Math.min(C,e[1]);n++){let e=t[n];if(s.current.has(e)&&!r.current.has(e)){C=n;break}}}let h=v+2*_o,y=Math.min(b,C+xo),S=0;for(w=C;w<y&&(S<h||x[w]<f+v+_o);)S+=r.current.get(t[w])??bo,w++}let e=v+2*_o,n=Math.max(0,w-xo),i=0;for(let e=C;e<w;e++)i+=r.current.get(t[e])??bo;for(;C>n&&i<e;)C--,i+=r.current.get(t[C])??bo;let o=d.current,c=Math.abs(g-a.current)+Math.abs(_);if(o&&c>v*2){let[e,t]=o;C<e-So&&(C=e-So),w>t+So&&(w=t+So),C>w&&(w=Math.min(C+So,b))}a.current=g}f.current>0?f.current--:d.current=[C,w];let T=(0,q.useDeferredValue)(C),E=(0,q.useDeferredValue)(w),D=C<T?T:C,O=w>E?E:w;if((D>O||y)&&(D=C,O=w),_>0&&(O=w),O-D>xo){let e=(x[D]+x[O])/2;g-m.current<e?O=D+xo:D=O-xo}let k=m.current,ee=x[D],te=D===0?0:ee+k,A=O===b?1/0:Math.max(ee,x[O]-v)+k;(0,q.useLayoutEffect)(()=>{y?e.current?.setClampBounds(void 0,void 0):e.current?.setClampBounds(te,A)}),(0,q.useLayoutEffect)(()=>{let e=h.current?.yogaNode;if(e&&e.getComputedWidth()>0&&(m.current=e.getComputedTop()),u.current){u.current=!1;return}let t=!1;for(let[e,n]of s.current){let i=n.yogaNode;if(!i)continue;let a=i.getComputedHeight(),o=r.current.get(e);a>0?o!==a&&(r.current.set(e,a),t=!0):i.getComputedWidth()>0&&o!==0&&(r.current.set(e,0),t=!0)}t&&i.current++});let j=(0,q.useCallback)(e=>{let t=c.current.get(e);return t||(t=t=>{if(t)s.current.set(e,t);else{let t=s.current.get(e)?.yogaNode;if(t&&!u.current){let n=t.getComputedHeight();(n>0||t.getComputedWidth()>0)&&r.current.get(e)!==n&&(r.current.set(e,n),i.current++)}s.current.delete(e)}},c.current.set(e,t)),t},[]),M=(0,q.useCallback)(e=>{let n=s.current.get(t[e])?.yogaNode;return!n||n.getComputedWidth()===0?-1:n.getComputedTop()},[t]),N=(0,q.useCallback)(e=>s.current.get(t[e])??null,[t]),P=(0,q.useCallback)(e=>r.current.get(t[e]),[t]),ne=(0,q.useCallback)(t=>{let n=o.current;t<0||t>=n.n||e.current?.scrollTo(n.arr[t]+m.current)},[e]),F=S-x[O];return{range:[D,O],topSpacer:ee,bottomSpacer:F,measureRef:j,spacerRef:h,offsets:x,getItemTop:M,getItemElement:N,getItemHeight:P,scrollToIndex:ne}}var q,go,_o,vo,yo,bo,xo,So,Co,wo=t((()=>{q=n(h(),1),go=3,_o=40,vo=30,yo=20,bo=1,xo=200,So=25,Co=()=>{}}));function To({children:e}){let[t,n]=(0,J.useState)(null),[r,i]=(0,J.useState)(null);return(0,Ao.jsx)(Mo.Provider,{value:n,children:(0,Ao.jsx)(Po.Provider,{value:i,children:(0,Ao.jsx)(jo.Provider,{value:t,children:(0,Ao.jsx)(No.Provider,{value:r,children:e})})})})}function Eo(){return(0,J.useContext)(jo)}function Do(){return(0,J.useContext)(No)}function Oo(e){let t=(0,J.useContext)(Mo);(0,J.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}function ko(e){let t=(0,J.useContext)(Po);(0,J.useEffect)(()=>{if(t)return t(e),()=>t(null)},[t,e])}var J,Ao,jo,Mo,No,Po,Fo=t((()=>{J=n(h(),1),Ao=S(),jo=(0,J.createContext)(null),Mo=(0,J.createContext)(null),No=(0,J.createContext)(null),Po=(0,J.createContext)(null)}));function Io(e){let[t,n]=(0,Y.useState)(null),r=(0,Y.useRef)(e);r.current=e;let i=(0,Y.useRef)(null),a=(0,Y.useCallback)(()=>{n(null)},[]),o=(0,Y.useCallback)(e=>{let t=Math.max(0,e.getScrollHeight()-e.getViewportHeight());e.getScrollTop()+e.getPendingDelta()>=t||i.current===null&&(i.current=e.getScrollHeight(),n(r.current))},[]),s=(0,Y.useCallback)(e=>{e&&e.scrollToBottom()},[]);return(0,Y.useEffect)(()=>{t===null?i.current=null:e<t&&(i.current=null,n(null))},[e,t]),{dividerIndex:t,dividerYRef:i,onScrollAway:o,onRepin:a,jumpToNew:s,shiftDivider:(0,Y.useCallback)((e,t)=>{n(t=>t===null?null:t+e),i.current!==null&&(i.current+=t)},[])}}function Lo(e,t){let n=0,r=!1;for(let i=t;i<e.length;i++){let t=e[i];if(t.type===`progress`||t.type===`assistant`&&!Ro(t))continue;let a=t.type===`assistant`;a&&!r&&n++,r=a}return n}function Ro(e){if(e.type!==`assistant`||!Array.isArray(e.message.content))return!1;for(let t of e.message.content)if(typeof t!=`string`&&t.type===`text`&&t.text.trim()!==``)return!0;return!1}function zo(e,t){if(t===null)return;let n=t;for(;n<e.length&&(e[n]?.type===`progress`||Qa(e[n]));)n++;let r=e[n]?.uuid;if(!r)return;let i=Lo(e,t);return{firstUnseenUuid:r,count:Math.max(1,i)}}function Bo({scrollable:e,bottom:t,overlay:n,bottomFloat:r,modal:i,modalScrollRef:a,scrollRef:o,dividerYRef:s,hidePill:c=!1,hideSticky:u=!1,newMessageCount:f=0,onPillClick:m}){let{rows:h,columns:g}=v(),[_,y]=(0,Y.useState)(null),b=(0,Y.useMemo)(()=>({setStickyPrompt:y}),[]),S=(0,Y.useSyncExternalStore)((0,Y.useCallback)(e=>o?.current?.subscribe(e)??(()=>{}),[o]),()=>{let e=o?.current,t=s?.current;return!e||t==null?!1:e.getScrollTop()+e.getPendingDelta()+e.getViewportHeight()<t});if((0,Y.useLayoutEffect)(()=>{if(!he())return;let e=p.get(process.stdout);if(e)return e.onHyperlinkClick=e=>{if(e.startsWith(`file:`))try{$t(Mn(e))}catch{}else Qt(e)},()=>{e.onHyperlinkClick=void 0}},[]),he()){let s=u?null:_,p=s!=null&&s!==`clicked`&&n==null?s:null,v=s!=null&&n==null;return(0,X.jsxs)(To,{children:[(0,X.jsx)(l,{flexDirection:`row`,flexGrow:1,overflow:`hidden`,width:`100%`,children:(0,X.jsxs)(l,{flexDirection:`column`,flexGrow:1,width:g,overflow:`hidden`,children:[(0,X.jsxs)(l,{flexGrow:1,flexDirection:`column`,overflow:`hidden`,children:[p&&(0,X.jsx)(Ho,{text:p.text,onClick:p.scrollTo}),(0,X.jsxs)(x,{ref:o,flexGrow:1,flexDirection:`column`,paddingTop:+!v,stickyScroll:!0,children:[(0,X.jsx)(Ko,{value:b,children:e}),n]}),!c&&S&&n==null&&(0,X.jsx)(Vo,{count:f,onClick:m}),r!=null&&(0,X.jsx)(l,{position:`absolute`,bottom:0,right:0,opaque:!0,children:r})]}),(0,X.jsxs)(l,{flexDirection:`column`,flexShrink:0,width:`100%`,maxHeight:`50%`,children:[(0,X.jsx)(Uo,{}),(0,X.jsx)(Wo,{}),(0,X.jsx)(l,{flexDirection:`column`,width:`100%`,flexGrow:1,overflowY:`hidden`,children:t})]})]})}),i!=null&&(0,X.jsx)(xn,{value:{rows:h-Go-1,columns:g-4,scrollRef:a??null},children:(0,X.jsxs)(l,{position:`absolute`,bottom:0,left:0,right:0,maxHeight:h-Go,flexDirection:`column`,overflow:`hidden`,opaque:!0,children:[(0,X.jsx)(l,{flexShrink:0,children:(0,X.jsx)(d,{color:`permission`,children:`▔`.repeat(g)})}),(0,X.jsx)(l,{flexDirection:`column`,paddingX:2,flexShrink:0,overflow:`hidden`,children:i})]})})]})}return(0,X.jsxs)(X.Fragment,{children:[e,t,n,i]})}function Vo({count:e,onClick:t}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(l,{position:`absolute`,bottom:0,left:0,right:0,justifyContent:`center`,children:(0,X.jsx)(l,{onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,X.jsxs)(d,{backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,dimColor:!0,children:[` `,e>0?`${e} new ${Dt(e,`message`)}`:`Jump to bottom`,` `,o.arrowDown,` `]})})})}function Ho({text:e,onClick:t}){let[n,r]=(0,Y.useState)(!1);return(0,X.jsx)(l,{flexShrink:0,width:`100%`,height:1,paddingRight:1,backgroundColor:n?`userMessageBackgroundHover`:`userMessageBackground`,onClick:t,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,X.jsxs)(d,{color:`subtle`,wrap:`truncate-end`,children:[o.pointer,` `,e]})})}function Uo(){let e=Eo();return!e||e.suggestions.length===0?null:(0,X.jsx)(l,{position:`absolute`,bottom:`100%`,left:0,right:0,paddingX:2,paddingTop:1,flexDirection:`column`,opaque:!0,children:(0,X.jsx)(gn,{suggestions:e.suggestions,selectedSuggestion:e.selectedSuggestion,maxColumnWidth:e.maxColumnWidth,overlay:!0})})}function Wo(){let e=Do();return e?(0,X.jsx)(l,{position:`absolute`,bottom:`100%`,left:0,right:0,opaque:!0,children:e}):null}var Y,X,Go,Ko,qo=t((()=>{a(),Y=n(h(),1),bn(),Fo(),Se(),y(),en(),de(),Ot(),eo(),_n(),X=S(),Go=2,Ko=(0,Y.createContext)({setStickyPrompt:()=>{}})}));function Jo(e){let t=ns.get(e);if(t!==void 0)return t;let n=gi(e);return ns.set(e,n),n}function Yo(e){let t=is.get(e);if(t!==void 0)return t;let n=Xo(e);return is.set(e,n),n}function Xo(e){let t=null;if(e.type===`user`){if(e.isMeta||e.isVisibleInTranscriptOnly)return null;let n=e.message.content[0];if(n?.type!==`text`)return null;t=n.text??null}else if(e.type===`attachment`&&e.attachment.type===`queued_command`&&e.attachment.commandMode!==`task-notification`&&!e.attachment.isMeta){let n=e.attachment.prompt;t=typeof n==`string`?n:n.flatMap(e=>e.type===`text`?[e.text??``]:[]).join(`
11
+ `)}if(t===null)return null;let n=Ke(t);return n.startsWith(`<`)||n===``?null:n}function Zo({itemKey:e,msg:t,idx:n,measureRef:r,expanded:i,hovered:a,clickable:o,onClickK:s,onEnterK:c,onLeaveK:d,renderItem:f}){return(0,es.jsx)(l,{ref:r(e),flexDirection:`column`,backgroundColor:i?`userMessageBackgroundHover`:void 0,paddingBottom:i?1:void 0,onClick:o?e=>s(t,e.cellIsBlank):void 0,onMouseEnter:o?()=>c(e):void 0,onMouseLeave:o?()=>d(e):void 0,children:(0,es.jsx)(u.Provider,{value:a&&!i?`text`:void 0,children:f(t,n)})})}function Qo({messages:e,scrollRef:t,columns:n,itemKey:r,renderItem:i,onItemClick:a,isItemClickable:o,isItemExpanded:s,extractSearchText:c=Jo,trackStickyPrompt:u,selectedIndex:d,cursorNavRef:f,setCursor:p,jumpRef:m,onSearchMatchesChange:h,scanElement:g,setPositions:_}){let v=(0,Z.useRef)([]),y=(0,Z.useRef)(e),b=(0,Z.useRef)(r);if(b.current!==r||e.length<v.current.length||e[0]!==y.current[0])v.current=e.map(e=>r(e));else for(let t=v.current.length;t<e.length;t++)v.current.push(r(e[t]));y.current=e,b.current=r;let x=v.current,{range:S,topSpacer:C,bottomSpacer:w,measureRef:T,spacerRef:E,offsets:D,getItemTop:O,getItemElement:k,getItemHeight:ee,scrollToIndex:te}=ho(t,x,n),[A,j]=S,M=(0,Z.useCallback)(t=>ee(t)!==0&&Fe(e[t]),[ee,e]);(0,Z.useImperativeHandle)(f,()=>{let n=e=>p?.({uuid:e.uuid,msgType:e.type,expanded:!1,toolName:R(e)?.name}),r=d??-1,i=(t,r,i=M)=>{for(let a=t;a>=0&&a<e.length;a+=r)if(i(a))return n(e[a]),!0;return!1},a=t=>M(t)&&e[t].type===`user`;return{enterCursor:()=>i(e.length-1,-1,a),navigatePrev:()=>i(r-1,-1),navigateNext:()=>{i(r+1,1)||(t.current?.scrollToBottom(),p?.(null))},navigatePrevUser:()=>i(r-1,-1,a),navigateNextUser:()=>i(r+1,1,a),navigateTop:()=>i(0,1),navigateBottom:()=>i(e.length-1,-1),getSelected:()=>r>=0?e[r]??null:null}},[e,d,p,M]);let N=(0,Z.useRef)({offsets:D,start:A,getItemElement:k,getItemTop:O,messages:e,scrollToIndex:te});N.current={offsets:D,start:A,getItemElement:k,getItemTop:O,messages:e,scrollToIndex:te},(0,Z.useEffect)(()=>{if(d===void 0)return;let e=N.current,n=e.getItemElement(d);n?t.current?.scrollToElement(n,1):e.scrollToIndex(d)},[d,t]);let P=(0,Z.useRef)(null),ne=(0,Z.useRef)({msgIdx:-1,positions:[]}),F=(0,Z.useRef)(-1),re=(0,Z.useRef)(0),ie=(0,Z.useRef)(0),ae=(0,Z.useRef)(()=>{}),oe=(0,Z.useRef)(()=>{}),se=(0,Z.useRef)({matches:[],ptr:0,screenOrd:0,prefixSum:[]}),ce=(0,Z.useRef)(-1),I=(0,Z.useRef)(!1);function le(e){let t=N.current.getItemTop(e);return Math.max(0,t-ts)}function ue(e){let n=t.current,{msgIdx:r,positions:i}=ne.current;if(!n||i.length===0||r<0){_?.(null);return}let a=Math.max(0,Math.min(e,i.length-1)),o=i[a],s=N.current.getItemTop(r),c=n.getViewportTop(),l=s-n.getScrollTop(),u=n.getViewportHeight(),d=c+l+o.row;(d<c||d>=c+u)&&(n.scrollTo(Math.max(0,s+o.row-ts)),l=s-n.getScrollTop(),d=c+l+o.row),_?.({positions:i,rowOffset:c+l,currentIdx:a});let f=se.current,p=f.prefixSum.at(-1)??0,m=(f.prefixSum[f.ptr]??0)+a+1;h?.(p,m),et(`highlight(i=${r}, ord=${a}/${i.length}): pos={row:${o.row},col:${o.col}} lo=${l} screenRow=${d} badge=${m}/${p}`)}oe.current=ue;let[L,de]=(0,Z.useState)(0),fe=(0,Z.useCallback)(()=>de(e=>e+1),[]);(0,Z.useEffect)(()=>{let e=P.current;if(!e)return;let{idx:n,wantLast:r,tries:i}=e,a=t.current;if(!a)return;let{getItemElement:o,getItemTop:s,scrollToIndex:c}=N.current,l=o(n),u=l?.yogaNode?.getComputedHeight()??0;if(!l||u===0){if(i>1){P.current=null,et(`seek(i=${n}): no mount after scrollToIndex, skip`),ae.current(r?-1:1);return}P.current={idx:n,wantLast:r,tries:i+1},c(n),fe();return}P.current=null,a.scrollTo(Math.max(0,s(n)-ts));let d=g?.(l)??[];if(ne.current={msgIdx:n,positions:d},et(`seek(i=${n} t=${i}): ${d.length} positions`),d.length===0){if(++re.current>20){re.current=0;return}ae.current(r?-1:1);return}re.current=0;let f=r?d.length-1:0;se.current.screenOrd=f,F.current=-1,oe.current(f);let p=ie.current;p&&(ie.current=0,ae.current(p))},[L]);function pe(e,n){let r=t.current;if(!r)return;let i=N.current,{getItemElement:a,scrollToIndex:o}=i;if(e<0||e>=i.messages.length)return;_?.(null),ne.current={msgIdx:-1,positions:[]},P.current={idx:e,wantLast:n,tries:0};let s=a(e),c=s?.yogaNode?.getComputedHeight()??0;s&&c>0?r.scrollTo(le(e)):o(e),fe()}function me(e){let t=se.current,{matches:n,prefixSum:r}=t,i=r.at(-1)??0;if(n.length===0)return;if(P.current){ie.current=e;return}F.current<0&&(F.current=t.ptr);let{positions:a}=ne.current,o=t.screenOrd+e;if(o>=0&&o<a.length){t.screenOrd=o,ue(o),F.current=-1;return}let s=(t.ptr+e+n.length)%n.length;if(s===F.current){_?.(null),F.current=-1,et(`step: wraparound at ptr=${s}, all ${n.length} msgs phantoms`);return}t.ptr=s,t.screenOrd=0,pe(n[s],e<0);let c=e<0?r[s+1]??i:r[s]+1;h?.(i,c)}ae.current=me,(0,Z.useImperativeHandle)(m,()=>({jumpToIndex:e=>{let n=t.current;n&&n.scrollTo(le(e))},setSearchQuery:e=>{P.current=null,ne.current={msgIdx:-1,positions:[]},F.current=-1,_?.(null);let n=e.toLowerCase(),r=[],i=[0];if(n){let e=N.current.messages;for(let t=0;t<e.length;t++){let a=c(e[t]),o=a.indexOf(n),s=0;for(;o>=0;)s++,o=a.indexOf(n,o+n.length);s>0&&(r.push(t),i.push(i.at(-1)+s))}}let a=i.at(-1),o=0,s=t.current,{offsets:l,start:u,getItemTop:d}=N.current,f=d(u),p=f>=0?f-l[u]:0;if(r.length>0&&s){let t=ce.current>=0?ce.current:s.getScrollTop(),n=1/0;for(let e=0;e<r.length;e++){let i=Math.abs(p+l[r[e]]-t);i<=n&&(n=i,o=e)}et(`setSearchQuery('${e}'): ${r.length} msgs · ptr=${o} msgIdx=${r[o]} curTop=${t} origin=${p}`)}se.current={matches:r,ptr:o,screenOrd:0,prefixSum:i},r.length>0?pe(r[o],!0):ce.current>=0&&s&&s.scrollTo(ce.current),h?.(a,r.length>0?i[o+1]??a:0)},nextMatch:()=>me(1),prevMatch:()=>me(-1),setAnchor:()=>{let e=t.current;e&&(ce.current=e.getScrollTop())},disarmSearch:()=>{_?.(null),P.current=null,ne.current={msgIdx:-1,positions:[]},F.current=-1},warmSearchIndex:async()=>{if(I.current)return 0;let e=N.current.messages,t=0,n=performance.now();for(let n=0;n<e.length;n+=500){await Rt(0);let r=performance.now(),i=Math.min(n+500,e.length);for(let t=n;t<i;t++)c(e[t]);t+=performance.now()-r}let r=Math.round(performance.now()-n);return et(`warmSearchIndex: ${e.length} msgs · work=${Math.round(t)}ms wall=${r}ms chunks=${Math.ceil(e.length/500)}`),I.current=!0,Math.round(t)}}),[t]);let[he,ge]=(0,Z.useState)(null),_e=(0,Z.useRef)({onItemClick:a,setHoveredKey:ge});_e.current={onItemClick:a,setHoveredKey:ge};let ve=(0,Z.useCallback)((e,t)=>{let n=_e.current;!t&&n.onItemClick&&n.onItemClick(e)},[]),ye=(0,Z.useCallback)(e=>{_e.current.setHoveredKey(e)},[]),be=(0,Z.useCallback)(e=>{_e.current.setHoveredKey(t=>t===e?null:t)},[]);return(0,es.jsxs)(es.Fragment,{children:[(0,es.jsx)(l,{ref:E,height:C,flexShrink:0}),e.slice(A,j).map((e,t)=>{let n=A+t,r=x[n],c=!!a&&(o?.(e)??!0),l=c&&he===r,u=s?.(e);return(0,es.jsx)(Zo,{itemKey:r,msg:e,idx:n,measureRef:T,expanded:u,hovered:l,clickable:c,onClickK:ve,onEnterK:ye,onLeaveK:be,renderItem:i},r)}),w>0&&(0,es.jsx)(l,{height:w,flexShrink:0}),u&&(0,es.jsx)($o,{messages:e,start:A,end:j,offsets:D,getItemTop:O,getItemElement:k,scrollRef:t})]})}function $o({messages:e,start:t,end:n,offsets:r,getItemTop:i,getItemElement:a,scrollRef:o}){let{setStickyPrompt:s}=(0,Z.useContext)(Ko);(0,Z.useSyncExternalStore)((0,Z.useCallback)(e=>o.current?.subscribe(e)??as,[o]),()=>{let e=o.current;if(!e)return NaN;let t=e.getScrollTop()+e.getPendingDelta();return e.isSticky()?-1-t:t});let c=o.current?.isSticky()??!0,l=Math.max(0,(o.current?.getScrollTop()??0)+(o.current?.getPendingDelta()??0)),u=t,d=-1;for(let e=n-1;e>=t;e--){let t=i(e);if(t>=0){if(t<l)break;d=t}u=e}let f=-1,p=null;if(u>0&&!c)for(let t=u-1;t>=0;t--){let n=Yo(e[t]);if(n===null)continue;let r=i(t);if(!(r>=0&&r+1>=l)){f=t,p=n;break}}let m=d>=0?d-r[u]:0,h=f>=0?Math.max(0,m+r[f]):-1,g=(0,Z.useRef)({idx:-1,tries:0}),_=(0,Z.useRef)(`none`),v=(0,Z.useRef)(-1);return(0,Z.useEffect)(()=>{if(g.current.idx>=0)return;if(_.current===`armed`){_.current=`force`;return}let e=_.current===`force`;if(_.current=`none`,!e&&v.current===f)return;if(v.current=f,p===null){s(null);return}let t=p.trimStart(),n=t.search(/\n\s*\n/),r=(n>=0?t.slice(0,n):t).slice(0,rs).replace(/\s+/g,` `).trim();if(r===``){s(null);return}let i=f,c=h;s({text:r,scrollTo:()=>{s(`clicked`),_.current=`armed`;let e=a(i);e?o.current?.scrollToElement(e,1):(o.current?.scrollTo(c),g.current={idx:i,tries:0})}})}),(0,Z.useEffect)(()=>{if(g.current.idx<0)return;let e=a(g.current.idx);e?(o.current?.scrollToElement(e,1),g.current={idx:-1,tries:0}):++g.current.tries>5&&(g.current={idx:-1,tries:0})}),null}var Z,es,ts,ns,rs,is,as,os=t((()=>{h(),Z=n(h(),1),wo(),y(),E(),qo(),es=S(),$e(),It(),Ci(),Ee(),ts=3,ns=new WeakMap,rs=500,is=new WeakMap,as=()=>{}}));function ss(e,t){let n=new Set(t),r=new Set;return e.filter(e=>{if(e.type===`system`)return e.subtype!==`api_metrics`;let t=e.message?.content[0];if(e.type===`assistant`)return e.isApiErrorMessage?!0:t?.type===`tool_use`&&t.name&&n.has(t.name)?(`id`in t&&r.add(t.id),!0):!1;if(e.type===`user`)return t?.type===`tool_result`?t.tool_use_id!==void 0&&r.has(t.tool_use_id):!e.isMeta;if(e.type===`attachment`){let t=e.attachment;return t?.type===`queued_command`&&t.commandMode===`prompt`&&!t.isMeta&&t.origin===void 0}return!1})}function cs(e,t){let n=new Set(t),r=new Set,i=[],a=0;for(let t=0;t<e.length;t++){let o=e[t],s=o.message?.content[0];if(o.type===`user`&&s?.type!==`tool_result`&&!o.isMeta){a++;continue}o.type===`assistant`&&(s?.type===`text`?i[t]=a:s?.type===`tool_use`&&s.name&&n.has(s.name)&&r.add(a))}return r.size===0?e:e.filter((e,t)=>{let n=i[t];return n===void 0||!r.has(n)})}function ls(e,t,n=ys,r=bs){let i=t.current,a=i?e.findIndex(e=>e.uuid===i.uuid):-1,o=a>=0?a:i?Math.min(i.idx,Math.max(0,e.length-n)):0;e.length-o>n+r&&(o=e.length-n);let s=e[o];return s&&(i?.uuid!==s.uuid||i.idx!==o)?t.current={uuid:s.uuid,idx:o}:!s&&i&&(t.current=null),o}function us(e){return(e.type===`assistant`||e.type===`user`?M(e):null)??e.uuid}function ds(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function fs(e,t,n,r,i,a){if(i===`transcript`)return!0;switch(e.type){case`attachment`:case`user`:case`assistant`:{if(e.type===`assistant`){let t=e.message.content[0];if(t?.type===`server_tool_use`)return a.resolvedToolUseIDs.has(t.id)}let i=M(e);return i?t.has(i)||n.has(i)||je(i,`PostToolUse`,a)?!1:ri(r,a.resolvedToolUseIDs):!0}case`system`:return e.subtype!==`api_error`;case`grouped_tool_use`:return e.messages.every(e=>{let t=e.message.content[0];return t?.type===`tool_use`&&a.resolvedToolUseIDs.has(t.id)});case`collapsed_read_search`:return!1;default:return!0}}var ps,Q,$,ms,hs,gs,_s,vs,ys,bs,xs,Ss,Cs=t((()=>{m(),ps=n(h(),1),Q=n(h(),1),ii(),w(),ot(),Se(),y(),Ie(),Bt(),Oe(),si(),ui(),L(),dt(),i(),de(),hi(),I(),Ot(),Ci(),Fa(),Le(),Za(),Ee(),Ce(),eo(),j(),mo(),$=S(),os(),ms=ps.memo(function({agentDefinitions:e}){return(0,$.jsx)(ve,{children:(0,$.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,$.jsx)(Ma,{}),(0,$.jsx)(ps.Suspense,{fallback:null,children:(0,$.jsx)(lo,{agentDefinitions:e})})]})})}),hs=(Ht(),e(Vt)),gs=(lt(),e(at)).BRIEF_TOOL_NAME,_s=(F(),e(re)).SEND_USER_FILE_TOOL_NAME,vs=30,ys=200,bs=50,xs=({messages:e,tools:t,commands:n,verbose:i,toolJSX:a,toolUseConfirmQueue:o,inProgressToolUseIDs:c,isMessageSelectorVisible:u,conversationId:p,screen:m,streamingToolUses:h,showAllInTranscript:g=!1,agentDefinitions:_,onOpenRateLimitOptions:y,hideLogo:x=!1,isLoading:S,hidePastThinking:w=!1,streamingThinking:T,streamingText:E,isBriefOnly:D=!1,unseenDivider:k,scrollRef:A,trackStickyPrompt:j,jumpRef:M,onSearchMatchesChange:N,scanElement:P,setPositions:F,disableRenderCap:re=!1,cursor:ie=null,setCursor:oe,cursorNavRef:ce,renderRange:I})=>{let{columns:le}=v(),ue=Ae(`transcript:toggleShowAll`,`Transcript`,`Ctrl+E`),L=(0,Q.useMemo)(()=>O(e).filter(ne),[e]),de=(0,Q.useMemo)(()=>T?T.isStreaming?!0:T.streamingEndedAt?Date.now()-T.streamingEndedAt<3e4:!1:!1,[T]),{lastThinkingBlockId:pe,latestBashOutputUUID:me}=(0,Q.useMemo)(()=>{let e=null,t=null,n=w&&!de;w&&de&&(e=`streaming`);for(let r=L.length-1;r>=0;r--){let i=L[r];if(i?.type===`user`){let r=i.message.content;if(!t){for(let e of r)if(e.type===`text`){let n=e.text??``;if(n.startsWith(`<bash-stdout`)||n.startsWith(`<bash-stderr`)){t=i.uuid;break}}}n&&!e&&(r.some(e=>e.type===`tool_result`)||(e=`no-thinking`))}else if(i?.type===`assistant`&&n&&!e){let t=i.message.content;for(let n=t.length-1;n>=0;n--)if(t[n]?.type===`thinking`){e=`${i.uuid}:${n}`;break}}if(e!==null&&t)break}return w||(e=null),{lastThinkingBlockId:e,latestBashOutputUUID:t}},[L,w,de]),ge=(0,Q.useMemo)(()=>te(L),[L]),_e=(0,Q.useMemo)(()=>h.filter(e=>!c.has(e.contentBlock.id)&&!ge.has(e.contentBlock.id)),[h,c,ge]),ve=(0,Q.useMemo)(()=>_e.flatMap(e=>{let t=Re({content:[e.contentBlock]});return t.uuid=ke(e.contentBlock.id,0),O([t])}),[_e]),ye=m===`transcript`,Se=(0,Q.useMemo)(()=>r(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL),[]),Ce=A!=null&&!Se,we=ye&&!g&&!Ce,Ee=(0,Q.useRef)(null),R=(0,Q.useRef)(null),{collapsed:Oe,lookups:je,hasTruncatedMessages:Me,hiddenMessageCount:Ne}=(0,Q.useMemo)(()=>{let e=be((i||he()?L:ee(L,{includeSnipped:!0})).filter(e=>e.type!==`progress`&&!Qa(e)&&xe(e,ye)),ve),n=[gs,_s].filter(e=>e!==null),r=[gs].filter(e=>e!==null),a=n.length>0&&!ye?D?ss(e,n):r.length>0?cs(e,r):e:e,o=we?a.slice(-30):a,s=we&&a.length>vs,{messages:c}=pi(o,t,i),l=oi(li(fe(c,t)),i),u=We(L,o),d=(()=>{let e=o.at(-1);return e?.type===`assistant`?e.message?.id:void 0})(),f;if(R.current&&R.current.key===u)f=R.current.lookups;else if(R.current&&L.length>=R.current.normalizedCount&&o.length>=R.current.messageCount&&R.current.lastAssistantMsgId===d){let e=se(R.current.lookups,R.current.normalizedCount,R.current.messageCount,L,o);e?(f=e,R.current={key:u,lookups:f,normalizedCount:L.length,messageCount:o.length,lastAssistantMsgId:d}):(f=De(L,o),R.current={key:u,lookups:f,normalizedCount:L.length,messageCount:o.length,lastAssistantMsgId:d})}else f=De(L,o),R.current={key:u,lookups:f,normalizedCount:L.length,messageCount:o.length,lastAssistantMsgId:d};let p=e.length-vs;return{collapsed:l,lookups:f,hasTruncatedMessages:s,hiddenMessageCount:p}},[i,L,ye,ve,we,t,D]),Pe=(0,Q.useMemo)(()=>{let e=!Ce&&!re?ls(Oe,Ee):0;return I?Oe.slice(I[0],I[1]):e>0?Oe.slice(e):Oe},[Oe,I,Ce,re]),Fe=(0,Q.useMemo)(()=>new Set(h.map(e=>e.contentBlock.id)),[h]),{dividerBeforeIndex:Ie,selectedIdx:Le}=(0,Q.useMemo)(()=>{if(!k&&!ie)return{dividerBeforeIndex:-1,selectedIdx:-1};let e=-1,t=-1,n=k?.firstUnseenUuid.slice(0,24);for(let r=0;r<Pe.length;r++){let i=Pe[r];if(e===-1&&n&&i.uuid.slice(0,24)===n&&(e=r),t===-1&&ie&&i.uuid===ie.uuid&&(t=r),e!==-1&&t!==-1)break}return{dividerBeforeIndex:e,selectedIdx:t}},[k,ie,Pe]),[ze,Ve]=(0,Q.useState)(()=>new Set),Ge=(0,Q.useCallback)(e=>{let t=us(e);Ve(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),Ke=(0,Q.useCallback)(e=>ze.size>0&&ze.has(us(e)),[ze]),qe=(0,Q.useRef)(je);qe.current=je;let Je=(0,Q.useCallback)(e=>{if(e.type===`collapsed_read_search`)return!0;if(e.type===`assistant`){let t=e.message.content,n=Array.isArray(t)?t[0]:void 0;return n!=null&&Be(n)&&n.type===`advisor_tool_result`&&n.content.type===`advisor_result`}if(e.type!==`user`)return!1;let n=e.message.content[0];if(n?.type!==`tool_result`||n.is_error||!e.toolUseResult)return!1;let r=qe.current.toolUseByToolUseID.get(n.tool_use_id??``)?.name;return(r?zt(t,r):void 0)?.isResultTruncated?.(e.toolUseResult)??!1},[t]),Ye=(!a||!!a.shouldContinueAnimation)&&!o.length&&!u,Xe=c.size>0,{progress:Ze}=f(),Qe=(0,Q.useRef)(null),$e=z().terminalProgressBarEnabled&&!C()&&!(hs?.isProactiveActive()??!1);(0,Q.useEffect)(()=>{let e=$e?Xe?`indeterminate`:`completed`:null;Qe.current!==e&&(Qe.current=e,Ze(e))},[Ze,$e,Xe]),(0,Q.useEffect)(()=>()=>Ze(null),[Ze]);let et=(0,Q.useCallback)(e=>`${e.uuid}-${p}`,[p]),tt=(e,r)=>{let a=r>0?Pe[r-1]?.type:void 0,o=e.type===`user`&&a===`user`,u=e.type===`collapsed_read_search`&&(!!E||Ha(Pe,r,t,Fe)),d=Pe.length-1-r>0,f=et(e),p=(0,$.jsx)(Xa,{message:e,isUserContinuation:o,hasContentAfter:u,tools:t,commands:n,verbose:i||Ke(e)||ie?.expanded===!0&&r===Le,inProgressToolUseIDs:c,streamingToolUseIDs:Fe,screen:m,canAnimate:Ye,onOpenRateLimitOptions:y,lastThinkingBlockId:pe,latestBashOutputUUID:me,columns:le,isLoading:S,lookups:je,shouldCollapseDiffs:d},f),h=(0,$.jsx)(He.Provider,{value:r===Le,children:p},f);return k&&r===Ie?[(0,$.jsx)(l,{marginTop:1,children:(0,$.jsx)(s,{title:`${k.count} new ${Dt(k.count,`message`)}`,width:le,color:`inactive`})},`unseen-divider`),h]:h},nt=(0,Q.useRef)(new WeakMap),rt=(0,Q.useCallback)(e=>{let n=nt.current.get(e);if(n!==void 0)return n;let r=gi(e);if(e.type===`user`&&e.toolUseResult&&Array.isArray(e.message.content)){let n=e.message.content.find(e=>e.type===`tool_result`);if(n&&`tool_use_id`in n){let i=je.toolUseByToolUseID.get(n.tool_use_id),a=(i&&zt(t,i.name))?.extractSearchText?.(e.toolUseResult);a!==void 0&&(r=a)}}let i=r.toLowerCase();return nt.current.set(e,i),i},[t,je]);return(0,$.jsxs)($.Fragment,{children:[!x&&!(I&&I[0]>0)&&(0,$.jsx)(ms,{agentDefinitions:_}),Me&&(0,$.jsx)(s,{title:`${ue} to show ${b.bold(Ne)} previous messages`,width:le}),ye&&g&&Ne>0&&!re&&(0,$.jsx)(s,{title:`${ue} to hide ${b.bold(Ne)} previous messages`,width:le}),Ce?(0,$.jsx)(Te.Provider,{value:!0,children:(0,$.jsx)(Qo,{messages:Pe,scrollRef:A,columns:le,itemKey:et,renderItem:tt,onItemClick:Ge,isItemClickable:Je,isItemExpanded:Ke,trackStickyPrompt:j,selectedIndex:Le>=0?Le:void 0,cursorNavRef:ce,setCursor:oe,jumpRef:M,onSearchMatchesChange:N,scanElement:P,setPositions:F,extractSearchText:rt})}):Pe.flatMap(tt),E&&!D&&(0,$.jsx)(l,{alignItems:`flex-start`,flexDirection:`row`,marginTop:1,width:`100%`,children:(0,$.jsxs)(l,{flexDirection:`row`,children:[(0,$.jsx)(l,{minWidth:2,children:(0,$.jsx)(d,{color:`text`,children:it})}),(0,$.jsx)(l,{flexDirection:`column`,children:(0,$.jsx)(Ue,{children:E})})]})}),de&&T&&!D&&(0,$.jsx)(l,{marginTop:1,children:(0,$.jsx)(ae,{param:{type:`thinking`,thinking:T.thinking},addMargin:!1,isTranscriptMode:!0,verbose:i,hideInTranscript:!1})})]})},Ss=ps.memo(xs,(e,t)=>{let n=Object.keys(e);for(let r of n)if(!(r===`onOpenRateLimitOptions`||r===`scrollRef`||r===`trackStickyPrompt`||r===`setCursor`||r===`cursorNavRef`||r===`jumpRef`||r===`onSearchMatchesChange`||r===`scanElement`||r===`setPositions`)&&e[r]!==t[r]){if(r===`streamingToolUses`){let n=e.streamingToolUses,r=t.streamingToolUses;if(n.length===r.length&&n.every((e,t)=>e.contentBlock===r[t]?.contentBlock))continue}if(r===`inProgressToolUseIDs`&&ds(e.inProgressToolUseIDs,t.inProgressToolUseIDs))continue;if(r===`unseenDivider`){let n=e.unseenDivider,r=t.unseenDivider;if(n?.firstUnseenUuid===r?.firstUnseenUuid&&n?.count===r?.count)continue}if(r===`tools`){let n=e.tools,r=t.tools;if(n.length===r.length&&n.every((e,t)=>e.name===r[t]?.name))continue}return!1}return!0})}));export{qo as a,Oo as c,ni as d,zo as i,ko as l,Cs as n,Io as o,Bo as r,Fo as s,Ss as t,ti as u};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{d as t,o as n}from"./envUtils-DSxRz_kt.js";import{Gt as r,H as i,I as a,Lt as o,P as s,fi as c,kt as l,t as u}from"./src-CDCSSo0U2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{Fb as f,Mx as p,Nx as m,mx as h,px as g}from"./loadAgentsDir-D206qwP3.js";import{Jt as _,Zt as v}from"./settings-BovzmwMP.js";import{g as y,s as b}from"./config-DmomySWC.js";import{n as x,r as S}from"./analytics-BotDBGh0.js";import{Bt as C,Ht as w,Tr as T,wr as E}from"./model-CKkOnnnx.js";import{u as D}from"./referral-CUaIo_vT.js";import{c as O,i as k,s as A}from"./terminalSetup-CuV-qU6v.js";import{t as j}from"./WelcomeV2-DqnbSdIu.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-DKIqRraH.js";import{n as P,t as F}from"./ThemePicker-BViWzLp3.js";import{n as I,t as L}from"./PressEnterToContinue-Dl9Hg9Mf.js";import{t as R}from"./ApproveApiKey-Bsy8kr2a.js";n();var z=e(c(),1),B=d();x(),v(),y(),E(),C(),D(),k(),N(),u(),u(),f(),m(),h(),P(),I(),u();var V=(0,z.createContext)({marker:``});function H({children:e}){let{marker:t}=(0,z.useContext)(V);return(0,B.jsxs)(a,{gap:1,children:[(0,B.jsx)(s,{dimColor:!0,children:t}),(0,B.jsx)(a,{flexDirection:`column`,children:e})]})}u();var U=(0,z.createContext)({marker:``});function W({children:e}){let{marker:t}=(0,z.useContext)(U),n=0;for(let t of z.Children.toArray(e))!(0,z.isValidElement)(t)||t.type!==H||n++;let r=String(n).length;return(0,B.jsx)(a,{flexDirection:`column`,children:z.Children.map(e,(e,n)=>{if(!(0,z.isValidElement)(e)||e.type!==H)return e;let i=`${String(n+1).padStart(r)}.`,a=`${t}${i}`;return(0,B.jsx)(U.Provider,{value:{marker:a},children:(0,B.jsx)(V.Provider,{value:{marker:a},children:e})})})})}W.Item=H;var G=W;u();function K({onDone:e}){let[n,c]=(0,z.useState)(0),[u,d]=(0,z.useState)(!1),[f]=(0,z.useState)(()=>w()),[m,h]=i();(0,z.useEffect)(()=>{S(`tengu_began_setup`,{oauthEnabled:f})},[f]);function v(){if(n<N.length-1){let e=n+1;c(e),S(`tengu_onboarding_step`,{oauthEnabled:f,stepId:N[e]?.id})}else e()}function y(e){h(e),v()}let x=M(),C=(0,B.jsx)(a,{marginX:1,children:(0,B.jsx)(F,{onThemeSelect:y,showIntroText:!0,helpText:`To change this later, run /theme`,hideEscToCancel:!0,skipExitHandling:!0})}),E=(0,B.jsxs)(a,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,B.jsx)(s,{bold:!0,children:`Before you start, keep in mind:`}),(0,B.jsx)(a,{flexDirection:`column`,width:70,children:(0,B.jsxs)(G,{children:[(0,B.jsxs)(G.Item,{children:[(0,B.jsx)(s,{children:`Always review changes before accepting`}),(0,B.jsxs)(s,{dimColor:!0,wrap:`wrap`,children:[`Claude can make mistakes — especially when running commands`,(0,B.jsx)(l,{}),`or editing files. You stay in control of every action.`,(0,B.jsx)(l,{})]})]}),(0,B.jsxs)(G.Item,{children:[(0,B.jsx)(s,{children:`Only use Claude Code on projects you trust`}),(0,B.jsxs)(s,{dimColor:!0,wrap:`wrap`,children:[`Untrusted code could contain prompt injection attacks.`,(0,B.jsx)(l,{}),(0,B.jsx)(o,{url:`https://code.claude.com/docs/en/security`})]})]})]})}),(0,B.jsx)(L,{})]}),D=(0,z.useMemo)(()=>{if(!process.env.ANTHROPIC_API_KEY||t())return``;let e=T(process.env.ANTHROPIC_API_KEY);if(b(e)===`new`)return e},[]);function k(e){e&&d(!0),v()}let N=[];N.push({id:`theme`,component:C}),D&&N.push({id:`api-key`,component:(0,B.jsx)(R,{customApiKeyTruncated:D,onDone:k})}),f&&N.push({id:`oauth`,component:(0,B.jsx)(q,{skip:u,onSkip:v,children:(0,B.jsx)(p,{onDone:v})})}),N.push({id:`security`,component:E}),O()&&N.push({id:`terminal-setup`,component:(0,B.jsxs)(a,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,B.jsx)(s,{bold:!0,children:`Use Claude Code's terminal setup?`}),(0,B.jsxs)(a,{flexDirection:`column`,width:70,gap:1,children:[(0,B.jsxs)(s,{children:[`For the optimal coding experience, enable the recommended settings`,(0,B.jsx)(l,{}),`for your terminal:`,` `,_.terminal===`Apple_Terminal`?`Option+Enter for newlines and visual bell`:`Shift+Enter for newlines`]}),(0,B.jsx)(g,{options:[{label:`Yes, use recommended settings`,value:`install`},{label:`No, maybe later with /terminal-setup`,value:`no`}],onChange:e=>{e===`install`?A(m).catch(()=>{}).finally(v):v()},onCancel:()=>v()}),(0,B.jsx)(s,{dimColor:!0,children:x.pending?(0,B.jsxs)(B.Fragment,{children:[`Press `,x.keyName,` again to exit`]}):(0,B.jsx)(B.Fragment,{children:`Enter to confirm · Esc to skip`})})]})]})});let P=N[n],I=(0,z.useCallback)(()=>{n===N.length-1?e():v()},[n,N.length,f,e]),V=(0,z.useCallback)(()=>{v()},[n,N.length,f,e]);return r({"confirm:yes":I},{context:`Confirmation`,isActive:P?.id===`security`}),r({"confirm:no":V},{context:`Confirmation`,isActive:P?.id===`terminal-setup`}),(0,B.jsxs)(a,{flexDirection:`column`,children:[(0,B.jsx)(j,{}),(0,B.jsxs)(a,{flexDirection:`column`,marginTop:1,children:[P?.component,x.pending&&(0,B.jsx)(a,{padding:1,children:(0,B.jsxs)(s,{dimColor:!0,children:[`Press `,x.keyName,` again to exit`]})})]})]})}function q({skip:e,onSkip:t,children:n}){return(0,z.useEffect)(()=>{e&&t()},[e,t]),e?null:n}export{K as Onboarding};
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{d as t,o as n}from"./envUtils-DSxRz_kt.js";import{Gt as r,H as i,I as a,Lt as o,P as s,fi as c,kt as l,t as u}from"./src-CDCSSo0U2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{Cx as f,Eb as p,ax as m,ix as h,wx as g}from"./loadAgentsDir-x3rlgED4.js";import{$t as _,Xt as v}from"./settings-BeLFUeie.js";import{g as y,s as b}from"./config-DRDuVyzE.js";import{n as x,r as S}from"./analytics-BotDBGh0.js";import{Bt as C,Ht as w,Tr as T,wr as E}from"./model-CZViyZnE.js";import{u as D}from"./referral-CKmHHxj_.js";import{c as O,i as k,s as A}from"./terminalSetup-3JNy6i_J.js";import{t as j}from"./WelcomeV2-C1BfrqC5.js";import{n as M,t as N}from"./useExitOnCtrlCDWithKeybindings-BwsZ5f0s.js";import{n as P,t as F}from"./ThemePicker-CVSRqTzW.js";import{n as I,t as L}from"./PressEnterToContinue-Dl9Hg9Mf.js";import{t as R}from"./ApproveApiKey-B2HJUD7h.js";n();var z=e(c(),1),B=d();x(),_(),y(),E(),C(),D(),k(),N(),u(),u(),p(),g(),m(),P(),I(),u();var V=(0,z.createContext)({marker:``});function H({children:e}){let{marker:t}=(0,z.useContext)(V);return(0,B.jsxs)(a,{gap:1,children:[(0,B.jsx)(s,{dimColor:!0,children:t}),(0,B.jsx)(a,{flexDirection:`column`,children:e})]})}u();var U=(0,z.createContext)({marker:``});function W({children:e}){let{marker:t}=(0,z.useContext)(U),n=0;for(let t of z.Children.toArray(e))!(0,z.isValidElement)(t)||t.type!==H||n++;let r=String(n).length;return(0,B.jsx)(a,{flexDirection:`column`,children:z.Children.map(e,(e,n)=>{if(!(0,z.isValidElement)(e)||e.type!==H)return e;let i=`${String(n+1).padStart(r)}.`,a=`${t}${i}`;return(0,B.jsx)(U.Provider,{value:{marker:a},children:(0,B.jsx)(V.Provider,{value:{marker:a},children:e})})})})}W.Item=H;var G=W;u();function K({onDone:e}){let[n,c]=(0,z.useState)(0),[u,d]=(0,z.useState)(!1),[p]=(0,z.useState)(()=>w()),[m,g]=i();(0,z.useEffect)(()=>{S(`tengu_began_setup`,{oauthEnabled:p})},[p]);function _(){if(n<N.length-1){let e=n+1;c(e),S(`tengu_onboarding_step`,{oauthEnabled:p,stepId:N[e]?.id})}else e()}function y(e){g(e),_()}let x=M(),C=(0,B.jsx)(a,{marginX:1,children:(0,B.jsx)(F,{onThemeSelect:y,showIntroText:!0,helpText:`To change this later, run /theme`,hideEscToCancel:!0,skipExitHandling:!0})}),E=(0,B.jsxs)(a,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,B.jsx)(s,{bold:!0,children:`Before you start, keep in mind:`}),(0,B.jsx)(a,{flexDirection:`column`,width:70,children:(0,B.jsxs)(G,{children:[(0,B.jsxs)(G.Item,{children:[(0,B.jsx)(s,{children:`Always review changes before accepting`}),(0,B.jsxs)(s,{dimColor:!0,wrap:`wrap`,children:[`Claude can make mistakes — especially when running commands`,(0,B.jsx)(l,{}),`or editing files. You stay in control of every action.`,(0,B.jsx)(l,{})]})]}),(0,B.jsxs)(G.Item,{children:[(0,B.jsx)(s,{children:`Only use Claude Code on projects you trust`}),(0,B.jsxs)(s,{dimColor:!0,wrap:`wrap`,children:[`Untrusted code could contain prompt injection attacks.`,(0,B.jsx)(l,{}),(0,B.jsx)(o,{url:`https://code.claude.com/docs/en/security`})]})]})]})}),(0,B.jsx)(L,{})]}),D=(0,z.useMemo)(()=>{if(!process.env.ANTHROPIC_API_KEY||t())return``;let e=T(process.env.ANTHROPIC_API_KEY);if(b(e)===`new`)return e},[]);function k(e){e&&d(!0),_()}let N=[];N.push({id:`theme`,component:C}),D&&N.push({id:`api-key`,component:(0,B.jsx)(R,{customApiKeyTruncated:D,onDone:k})}),p&&N.push({id:`oauth`,component:(0,B.jsx)(q,{skip:u,onSkip:_,children:(0,B.jsx)(f,{onDone:_})})}),N.push({id:`security`,component:E}),O()&&N.push({id:`terminal-setup`,component:(0,B.jsxs)(a,{flexDirection:`column`,gap:1,paddingLeft:1,children:[(0,B.jsx)(s,{bold:!0,children:`Use Claude Code's terminal setup?`}),(0,B.jsxs)(a,{flexDirection:`column`,width:70,gap:1,children:[(0,B.jsxs)(s,{children:[`For the optimal coding experience, enable the recommended settings`,(0,B.jsx)(l,{}),`for your terminal:`,` `,v.terminal===`Apple_Terminal`?`Option+Enter for newlines and visual bell`:`Shift+Enter for newlines`]}),(0,B.jsx)(h,{options:[{label:`Yes, use recommended settings`,value:`install`},{label:`No, maybe later with /terminal-setup`,value:`no`}],onChange:e=>{e===`install`?A(m).catch(()=>{}).finally(_):_()},onCancel:()=>_()}),(0,B.jsx)(s,{dimColor:!0,children:x.pending?(0,B.jsxs)(B.Fragment,{children:[`Press `,x.keyName,` again to exit`]}):(0,B.jsx)(B.Fragment,{children:`Enter to confirm · Esc to skip`})})]})]})});let P=N[n],I=(0,z.useCallback)(()=>{n===N.length-1?e():_()},[n,N.length,p,e]),V=(0,z.useCallback)(()=>{_()},[n,N.length,p,e]);return r({"confirm:yes":I},{context:`Confirmation`,isActive:P?.id===`security`}),r({"confirm:no":V},{context:`Confirmation`,isActive:P?.id===`terminal-setup`}),(0,B.jsxs)(a,{flexDirection:`column`,children:[(0,B.jsx)(j,{}),(0,B.jsxs)(a,{flexDirection:`column`,marginTop:1,children:[P?.component,x.pending&&(0,B.jsx)(a,{padding:1,children:(0,B.jsxs)(s,{dimColor:!0,children:[`Press `,x.keyName,` again to exit`]})})]})]})}function q({skip:e,onSkip:t,children:n}){return(0,z.useEffect)(()=>{e&&t()},[e,t]),e?null:n}export{K as Onboarding};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{P as n,fi as r,t as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{b as o,c as s,g as c}from"./config-DmomySWC.js";import{n as l,r as u}from"./analytics-BotDBGh0.js";import{S as d,b as f}from"./startupProfiler-xa3NmN7Z.js";import{a as p,n as m,r as h,t as g}from"./overageCreditGrant-DsUrmeBh.js";function _(){let e=m();return!e||!e.available||e.granted?!1:g(e)!==null}function v(){if(!_())return!1;let e=s();return!(e.hasVisitedExtraUsage||(e.overageCreditUpsellSeenCount??0)>=O)}function y(){m()===null&&p()}function b(){let[e]=(0,E.useState)(()=>(y(),v()));return e}function x(){let e=0;o(t=>(e=(t.overageCreditUpsellSeenCount??0)+1,{...t,overageCreditUpsellSeenCount:e})),u(`tengu_overage_credit_upsell_shown`,{seen_count:e})}function S(e){return`${e} in extra usage for third-party apps · /extra-usage`}function C(e){return`${e} in extra usage`}function w({maxWidth:e,twoLine:t}){let r=m();if(!r)return null;let i=g(r);if(!i)return null;if(t){let t=C(i);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(n,{color:`claude`,children:e?d(t,e):t}),(0,D.jsx)(n,{dimColor:!0,children:e?d(k,e):k})]})}let a=S(i),o=e?d(a,e):a,s=Math.min(C(i).length,o.length);return(0,D.jsxs)(n,{dimColor:!0,children:[(0,D.jsx)(n,{color:`claude`,children:o.slice(0,s)}),o.slice(s)]})}function T(){let e=m(),t=e?g(e):null,r=t?C(t):`extra usage credit`;return{title:r,lines:[],customContent:{content:(0,D.jsx)(n,{dimColor:!0,children:k}),width:Math.max(r.length,47)}}}var E,D,O,k,A=e((()=>{r(),E=t(r(),1),i(),l(),h(),c(),f(),D=a(),O=3,k=`On us. Works on third-party apps · /extra-usage`}));export{_ as a,A as i,T as n,v as o,x as r,b as s,w as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{P as n,fi as r,t as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{b as o,c as s,g as c}from"./config-DRDuVyzE.js";import{n as l,r as u}from"./analytics-BotDBGh0.js";import{S as d,b as f}from"./startupProfiler-xa3NmN7Z.js";import{a as p,n as m,r as h,t as g}from"./overageCreditGrant-Du3dOYVu.js";function _(){let e=m();return!e||!e.available||e.granted?!1:g(e)!==null}function v(){if(!_())return!1;let e=s();return!(e.hasVisitedExtraUsage||(e.overageCreditUpsellSeenCount??0)>=O)}function y(){m()===null&&p()}function b(){let[e]=(0,E.useState)(()=>(y(),v()));return e}function x(){let e=0;o(t=>(e=(t.overageCreditUpsellSeenCount??0)+1,{...t,overageCreditUpsellSeenCount:e})),u(`tengu_overage_credit_upsell_shown`,{seen_count:e})}function S(e){return`${e} in extra usage for third-party apps · /extra-usage`}function C(e){return`${e} in extra usage`}function w({maxWidth:e,twoLine:t}){let r=m();if(!r)return null;let i=g(r);if(!i)return null;if(t){let t=C(i);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(n,{color:`claude`,children:e?d(t,e):t}),(0,D.jsx)(n,{dimColor:!0,children:e?d(k,e):k})]})}let a=S(i),o=e?d(a,e):a,s=Math.min(C(i).length,o.length);return(0,D.jsxs)(n,{dimColor:!0,children:[(0,D.jsx)(n,{color:`claude`,children:o.slice(0,s)}),o.slice(s)]})}function T(){let e=m(),t=e?g(e):null,r=t?C(t):`extra usage credit`;return{title:r,lines:[],customContent:{content:(0,D.jsx)(n,{dimColor:!0,children:k}),width:Math.max(r.length,47)}}}var E,D,O,k,A=e((()=>{r(),E=t(r(),1),i(),l(),h(),c(),f(),D=a(),O=3,k=`On us. Works on third-party apps · /extra-usage`}));export{_ as a,A as i,T as n,v as o,x as r,b as s,w as t};
@@ -0,0 +1,17 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DSxRz_kt.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{D as o,Gr as s,Gt as c,H as l,I as u,Lt as d,P as f,T as p,Wt as ee,Xn as m,dr as h,fi as g,hn as _,j as v,k as y,n as b,ot as x,r as S,t as C,x as te,y as w}from"./src-CDCSSo0U2.js";import{t as T}from"./jsx-runtime-Bb4Xn-E0.js";import{$_ as E,$p as D,Bs as O,Cs as ne,Eb as k,Ex as A,FS as re,Fs as ie,Gg as ae,H_ as j,Hs as M,J_ as N,Js as oe,KD as se,K_ as P,Ks as ce,LS as le,M_ as ue,Os as de,PS as F,Ps as I,QD as fe,Q_ as pe,Qp as me,Qs as L,Rs as he,Ss as ge,Ts as _e,Tx as ve,U_ as ye,Us as be,Wg as xe,XD as Se,XS as R,X_ as Ce,Xs as we,Y_ as Te,Yh as Ee,Ys as De,Z_ as Oe,Zs as ke,aD as Ae,aO as je,as as Me,cD as Ne,d_ as Pe,ds as Fe,ec as Ie,ev as Le,fs as Re,fx as z,g_ as ze,h_ as Be,ix as Ve,js as He,k_ as Ue,lD as We,nO as Ge,nc as Ke,ng as qe,oO as Je,os as Ye,p_ as Xe,px as Ze,q_ as Qe,qg as $e,qs as et,rO as tt,rc as nt,rx as rt,s_ as it,u_ as at,wb as ot,y_ as st,ys as ct,zg as lt}from"./loadAgentsDir-x3rlgED4.js";import{C as ut,F as dt,S as ft,W as pt,a as mt,l as ht,z as gt}from"./debug-BrXObCdR.js";import{Dt as _t,c as vt,f as yt,g as bt,ot as xt,st as St,ut as Ct,vn as wt,wt as Tt,x as Et,yn as Dt}from"./settings-BeLFUeie.js";import{g as Ot,x as kt}from"./config-DRDuVyzE.js";import{c as At,o as jt,s as Mt}from"./log-BMCygSzM.js";import{n as Nt,r as Pt}from"./analytics-BotDBGh0.js";import{T as Ft,x as It}from"./startupProfiler-xa3NmN7Z.js";import{l as Lt,u as Rt}from"./oauth-BqJqV-2M.js";import{l as zt,n as Bt,o as Vt}from"./stringUtils-DGLPkqJ4.js";import{Bt as Ht,jt as Ut}from"./model-CZViyZnE.js";import{a as Wt,n as Gt,o as Kt,r as qt}from"./pluginFlagging-CAdaFV_D.js";import{u as Jt}from"./referral-CKmHHxj_.js";import{n as Yt,t as Xt}from"./browser-BmZuQom6.js";import{n as Zt,t as Qt}from"./pluginStartupCheck-KeU0efTj.js";import{a as $t,d as en,f as tn,i as nn,l as rn,o as an,s as on,u as sn}from"./pluginOperations-Cs_Z4C6O.js";import{a as cn,c as ln,i as un,n as dn,o as fn,s as pn,t as mn}from"./validatePlugin-6q1qmnAC.js";import{i as hn,n as gn,r as _n}from"./MCPConnectionManager-NRfIjdlj.js";import{n as vn,t as yn}from"./useExitOnCtrlCDWithKeybindings-BwsZ5f0s.js";import{t as bn}from"./SearchBox-vfLXEPed.js";import{n as xn,t as Sn}from"./useSearchInput-C5OzQnX6.js";import{i as Cn,n as wn}from"./pluginAutoupdate-0k03PVff.js";import*as Tn from"path";import*as En from"fs/promises";function Dn({serverToolsCount:e,serverPromptsCount:t,serverResourcesCount:n}){let r=[];return e>0&&r.push(`tools`),n>0&&r.push(`resources`),t>0&&r.push(`prompts`),(0,On.jsxs)(u,{children:[(0,On.jsx)(f,{bold:!0,children:`Capabilities: `}),(0,On.jsx)(f,{color:`text`,children:r.length>0?(0,On.jsx)(p,{children:r}):`none`})]})}var On,kn=e((()=>{g(),C(),On=T()}));function An(e,t){switch(e.client.type){case`connected`:return{message:`Reconnected to ${t}.`,success:!0};case`needs-auth`:return{message:`${t} requires authentication. Use the 'Authenticate' option.`,success:!1};case`failed`:return{message:`Failed to reconnect to ${t}.`,success:!1};default:return{message:`Unknown result when reconnecting to ${t}.`,success:!1}}}function jn(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var Mn=e((()=>{}));function Nn({server:e,serverToolsCount:t,onViewTools:n,onCancel:r,onComplete:i,borderless:s=!1}){let[c]=l(),m=vn(),{columns:g}=x(),[y,b]=B.useState(!1),[S,C]=B.useState(null),te=re(e=>e.mcp),w=le(),[T,E]=B.useState(null),[D,O]=(0,B.useState)(!1),ne=(0,B.useRef)(null),[k,A]=(0,B.useState)(!1),[ie,j]=(0,B.useState)(null),[M,N]=(0,B.useState)(!1),[oe,se]=(0,B.useState)(null),[P,ce]=(0,B.useState)(!1),[ue,de]=(0,B.useState)(!1),F=(0,B.useRef)(void 0),I=(0,B.useRef)(!1),[fe,pe]=(0,B.useState)(``),[me,L]=(0,B.useState)(0),[he,ge]=(0,B.useState)(null);(0,B.useEffect)(()=>()=>{I.current=!0,ne.current?.abort(),F.current!==void 0&&clearTimeout(F.current)},[]);let _e=e.isAuthenticated||e.client.type===`connected`&&t>0,ye=_n(),be=B.useCallback(async()=>{A(!1),j(null),O(!0);try{let t=await ye(e.name),n=t.client.type===`connected`;Pt(`tengu_claudeai_mcp_auth_completed`,{success:n}),n?i?.(`Authentication successful. Connected to ${e.name}.`):t.client.type===`needs-auth`?i?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):i?.(`Authentication successful, but server reconnection failed. You may need to manually restart Claude Code for the changes to take effect.`)}catch(t){Pt(`tengu_claudeai_mcp_auth_completed`,{success:!1}),i?.(jn(t,e.name))}finally{O(!1)}},[ye,e.name,i]),xe=B.useCallback(async()=>{await Ee(e.name,{...e.config,scope:e.scope}),w(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=Xe(t.mcp.tools,e.name),i=at(t.mcp.commands,e.name),a=Pe(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),Pt(`tengu_claudeai_mcp_clear_auth_completed`,{}),i?.(`Disconnected from ${e.name}.`),N(!1),se(null),ce(!1)},[e.name,e.config,e.scope,w,i]);ee(`confirm:no`,()=>{ne.current?.abort(),ne.current=null,b(!1),E(null)},{context:`Confirmation`,isActive:y}),ee(`confirm:no`,()=>{A(!1),j(null)},{context:`Confirmation`,isActive:k}),ee(`confirm:no`,()=>{N(!1),se(null),ce(!1)},{context:`Confirmation`,isActive:M}),_((e,t)=>{if(t.return&&k&&be(),t.return&&M)if(P)xe();else{let e=`${Lt().CLAUDE_AI_ORIGIN}/settings/connectors`;se(e),ce(!0),Yt(e)}if(e===`c`&&!ue){let e=T||ie||oe;e&&h(e).then(e=>{I.current||(e&&process.stdout.write(e),de(!0),F.current!==void 0&&clearTimeout(F.current),F.current=setTimeout(de,2e3,!1))})}});let Se=Bt(String(e.name)),R=Be(te.commands,e.name).length,Ce=hn(),we=B.useCallback(async()=>{let t=Lt().CLAUDE_AI_ORIGIN,n=Ut()?.organizationUuid,r;r=n&&e.config.type===`claudeai-proxy`&&e.config.id?`${t}/api/organizations/${n}/mcp/start-auth/${e.config.id.startsWith(`mcprs`)?`mcpsrv`+e.config.id.slice(5):e.config.id}?product_surface=${encodeURIComponent(process.env.CLAUDE_CODE_ENTRYPOINT||`cli`)}`:`${t}/settings/connectors`,j(r),A(!0),Pt(`tengu_claudeai_mcp_auth_started`,{}),await Yt(r)},[e.config]),Te=B.useCallback(()=>{N(!0),Pt(`tengu_claudeai_mcp_clear_auth_started`,{})},[]),De=B.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await Ce(e.name),e.config.type===`claudeai-proxy`&&Pt(`tengu_claudeai_mcp_toggle`,{new_state:t?`disabled`:`enabled`}),r()}catch(n){i?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${dt(n)}`)}},[e.client.type,e.config.type,e.name,Ce,r,i]),Oe=B.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;b(!0),C(null);let t=new AbortController;ne.current=t;try{if(e.isAuthenticated&&e.config&&await $e(e.name,e.config,{preserveStepUpState:!0}),e.config){await ae(e.name,e.config,E,t.signal,{onWaitingForCallback:e=>{ge(()=>e)}}),Pt(`tengu_mcp_auth_config_authenticate`,{wasAuthenticated:e.isAuthenticated});let n=await ye(e.name);if(n.client.type===`connected`){let t=_e?`Authentication successful. Reconnected to ${e.name}.`:`Authentication successful. Connected to ${e.name}.`;i?.(t)}else n.client.type===`needs-auth`?i?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):(At(e.name,`Reconnection failed after authentication`),i?.(`Authentication successful, but server reconnection failed. You may need to manually restart Claude Code for the changes to take effect.`))}}catch(e){e instanceof Error&&!(e instanceof lt)&&C(e.message)}finally{b(!1),ne.current=null,ge(null),pe(``)}},[e.isAuthenticated,e.config,e.name,i,ye,_e]),ke=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await $e(e.name,e.config),Pt(`tengu_mcp_auth_config_clear`,{}),await Ee(e.name,{...e.config,scope:e.scope}),w(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=Xe(t.mcp.tools,e.name),i=at(t.mcp.commands,e.name),a=Pe(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),i?.(`Authentication cleared for ${e.name}.`))};if(y){let t=e.config.type!==`claudeai-proxy`&&e.config.oauth?.xaa?` Authenticating via your identity provider`:` A browser window will open for authentication`;return(0,V.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(f,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(ot,{}),(0,V.jsx)(f,{children:t})]}),T&&(0,V.jsxs)(u,{flexDirection:`column`,children:[(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),ue?(0,V.jsx)(f,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(f,{dimColor:!0,children:(0,V.jsx)(o,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(d,{url:T})]}),y&&T&&he&&(0,V.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(f,{dimColor:!0,children:`If the redirect page shows a connection error, paste the URL from your browser's address bar:`}),(0,V.jsxs)(u,{children:[(0,V.jsxs)(f,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,V.jsx)(ve,{value:fe,onChange:pe,onSubmit:e=>{he(e.trim()),pe(``)},cursorOffset:me,onChangeCursorOffset:L,columns:g-8})]})]}),(0,V.jsx)(u,{marginLeft:3,children:(0,V.jsx)(f,{dimColor:!0,children:`Return here after authenticating in your browser. Press Esc to go back.`})})]})}if(k)return(0,V.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(f,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(ot,{}),(0,V.jsx)(f,{children:` A browser window will open for authentication`})]}),ie&&(0,V.jsxs)(u,{flexDirection:`column`,children:[(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),ue?(0,V.jsx)(f,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(f,{dimColor:!0,children:(0,V.jsx)(o,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(d,{url:ie})]}),(0,V.jsxs)(u,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(f,{color:`permission`,children:[`Press `,(0,V.jsx)(f,{bold:!0,children:`Enter`}),` after authenticating in your browser.`]}),(0,V.jsx)(f,{dimColor:!0,italic:!0,children:(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(M)return(0,V.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(f,{color:`claude`,children:[`Clear authentication for `,e.name]}),P?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f,{children:`Find the MCP server in the browser and click "Disconnect".`}),oe&&(0,V.jsxs)(u,{flexDirection:`column`,children:[(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{dimColor:!0,children:`If your browser didn't open automatically, copy this URL manually `}),ue?(0,V.jsx)(f,{color:`success`,children:`(Copied!)`}):(0,V.jsx)(f,{dimColor:!0,children:(0,V.jsx)(o,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,V.jsx)(d,{url:oe})]}),(0,V.jsxs)(u,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(f,{color:`permission`,children:[`Press `,(0,V.jsx)(f,{bold:!0,children:`Enter`}),` when done.`]}),(0,V.jsx)(f,{dimColor:!0,italic:!0,children:(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f,{children:`This will open claude.ai in the browser. Find the MCP server in the list and click "Disconnect".`}),(0,V.jsxs)(u,{marginLeft:3,flexDirection:`column`,children:[(0,V.jsxs)(f,{color:`permission`,children:[`Press `,(0,V.jsx)(f,{bold:!0,children:`Enter`}),` to open the browser.`]}),(0,V.jsx)(f,{dimColor:!0,italic:!0,children:(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(D)return(0,V.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(f,{color:`text`,children:[`Connecting to `,(0,V.jsx)(f,{bold:!0,children:e.name}),`…`]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(ot,{}),(0,V.jsx)(f,{children:` Establishing connection to MCP server`})]}),(0,V.jsx)(f,{dimColor:!0,children:`This may take a few moments.`})]});let Ae=[];return e.client.type===`disabled`&&Ae.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&Ae.push({label:`View tools`,value:`tools`}),e.config.type===`claudeai-proxy`?e.client.type===`connected`?Ae.push({label:`Clear authentication`,value:`claudeai-clear-auth`}):e.client.type!==`disabled`&&Ae.push({label:`Authenticate`,value:`claudeai-auth`}):(_e&&(Ae.push({label:`Re-authenticate`,value:`reauth`}),Ae.push({label:`Clear authentication`,value:`clear-auth`})),_e||Ae.push({label:`Authenticate`,value:`auth`})),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&Ae.push({label:`Reconnect`,value:`reconnectMcpServer`}),Ae.push({label:`Disable`,value:`toggle-enabled`})),Ae.length===0&&Ae.push({label:`Back`,value:`back`}),(0,V.jsxs)(u,{flexDirection:`column`,children:[(0,V.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:s?void 0:`round`,children:[(0,V.jsx)(u,{marginBottom:1,children:(0,V.jsxs)(f,{bold:!0,children:[Se,` MCP Server`]})}),(0,V.jsxs)(u,{flexDirection:`column`,gap:0,children:[(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,V.jsxs)(f,{children:[v(`inactive`,c)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,V.jsxs)(f,{children:[v(`success`,c)(a.tick),` connected`]}):e.client.type===`pending`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(f,{dimColor:!0,children:a.radioOff}),(0,V.jsx)(f,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,V.jsxs)(f,{children:[v(`warning`,c)(a.triangleUpOutline),` needs authentication`]}):(0,V.jsxs)(f,{children:[v(`error`,c)(a.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{bold:!0,children:`Auth: `}),_e?(0,V.jsxs)(f,{children:[v(`success`,c)(a.tick),` authenticated`]}):(0,V.jsxs)(f,{children:[v(`error`,c)(a.cross),` not authenticated`]})]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{bold:!0,children:`URL: `}),(0,V.jsx)(f,{dimColor:!0,children:e.config.url})]}),(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{bold:!0,children:`Config location: `}),(0,V.jsx)(f,{dimColor:!0,children:it(e.scope)})]}),e.client.type===`connected`&&(0,V.jsx)(Dn,{serverToolsCount:t,serverPromptsCount:R,serverResourcesCount:te.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,V.jsxs)(u,{children:[(0,V.jsx)(f,{bold:!0,children:`Tools: `}),(0,V.jsxs)(f,{dimColor:!0,children:[t,` tools`]})]})]}),S&&(0,V.jsx)(u,{marginTop:1,children:(0,V.jsxs)(f,{color:`error`,children:[`Error: `,S]})}),Ae.length>0&&(0,V.jsx)(u,{marginTop:1,children:(0,V.jsx)(Ve,{options:Ae,onChange:async t=>{switch(t){case`tools`:n();break;case`auth`:case`reauth`:await Oe();break;case`clear-auth`:await ke();break;case`claudeai-auth`:await we();break;case`claudeai-clear-auth`:Te();break;case`reconnectMcpServer`:O(!0);try{let t=await ye(e.name);e.config.type===`claudeai-proxy`&&Pt(`tengu_claudeai_mcp_reconnect`,{success:t.client.type===`connected`});let{message:n}=An(t,e.name);i?.(n)}catch(t){e.config.type===`claudeai-proxy`&&Pt(`tengu_claudeai_mcp_reconnect`,{success:!1}),i?.(jn(t,e.name))}finally{O(!1)}break;case`toggle-enabled`:await De();break;case`back`:r();break}},onCancel:r})})]}),(0,V.jsx)(u,{marginTop:1,children:(0,V.jsx)(f,{dimColor:!0,italic:!0,children:m.pending?(0,V.jsxs)(V.Fragment,{children:[`Press `,m.keyName,` again to exit`]}):(0,V.jsxs)(p,{children:[(0,V.jsx)(o,{shortcut:`↑↓`,action:`navigate`}),(0,V.jsx)(o,{shortcut:`Enter`,action:`select`}),(0,V.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var B,V,Pn=e((()=>{i(),B=t(g(),1),Nt(),Rt(),yn(),R(),C(),Jt(),xe(),qe(),gn(),st(),F(),Ht(),Xt(),gt(),jt(),Vt(),Ze(),rt(),k(),A(),kn(),Mn(),V=T()}));function Fn({server:e,serverToolsCount:t,onViewTools:n,onCancel:r,onComplete:i,borderless:s=!1}){let[c]=l(),d=vn(),ee=re(e=>e.mcp),m=_n(),h=hn(),[g,_]=(0,In.useState)(!1),y=In.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await h(e.name),r()}catch(n){i(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${dt(n)}`)}},[e.client.type,e.name,h,r,i]),b=Bt(String(e.name)),x=Be(ee.commands,e.name).length,S=[];return e.client.type!==`disabled`&&t>0&&S.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&S.push({label:`Reconnect`,value:`reconnectMcpServer`}),S.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),S.length===0&&S.push({label:`Back`,value:`back`}),g?(0,H.jsxs)(u,{flexDirection:`column`,gap:1,padding:1,children:[(0,H.jsxs)(f,{color:`text`,children:[`Reconnecting to `,(0,H.jsx)(f,{bold:!0,children:e.name})]}),(0,H.jsxs)(u,{children:[(0,H.jsx)(ot,{}),(0,H.jsx)(f,{children:` Restarting MCP server process`})]}),(0,H.jsx)(f,{dimColor:!0,children:`This may take a few moments.`})]}):(0,H.jsxs)(u,{flexDirection:`column`,children:[(0,H.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:s?void 0:`round`,children:[(0,H.jsx)(u,{marginBottom:1,children:(0,H.jsxs)(f,{bold:!0,children:[b,` MCP Server`]})}),(0,H.jsxs)(u,{flexDirection:`column`,gap:0,children:[(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,H.jsxs)(f,{children:[v(`inactive`,c)(a.radioOff),` disabled`]}):e.client.type===`connected`?(0,H.jsxs)(f,{children:[v(`success`,c)(a.tick),` connected`]}):e.client.type===`pending`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(f,{dimColor:!0,children:a.radioOff}),(0,H.jsx)(f,{children:` connecting…`})]}):(0,H.jsxs)(f,{children:[v(`error`,c)(a.cross),` failed`]})]}),(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Command: `}),(0,H.jsx)(f,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Args: `}),(0,H.jsx)(f,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Config location: `}),(0,H.jsx)(f,{dimColor:!0,children:it(Ue(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,H.jsx)(Dn,{serverToolsCount:t,serverPromptsCount:x,serverResourcesCount:ee.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,H.jsxs)(u,{children:[(0,H.jsx)(f,{bold:!0,children:`Tools: `}),(0,H.jsxs)(f,{dimColor:!0,children:[t,` tools`]})]})]}),S.length>0&&(0,H.jsx)(u,{marginTop:1,children:(0,H.jsx)(Ve,{options:S,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){_(!0);try{let{message:t}=An(await m(e.name),e.name);i?.(t)}catch(t){i?.(jn(t,e.name))}finally{_(!1)}}else t===`toggle-enabled`?await y():t===`back`&&r()},onCancel:r})})]}),(0,H.jsx)(u,{marginTop:1,children:(0,H.jsx)(f,{dimColor:!0,italic:!0,children:d.pending?(0,H.jsxs)(H.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,H.jsxs)(p,{children:[(0,H.jsx)(o,{shortcut:`↑↓`,action:`navigate`}),(0,H.jsx)(o,{shortcut:`Enter`,action:`select`}),(0,H.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var In,H,Ln=e((()=>{i(),In=t(g(),1),yn(),C(),ue(),gn(),st(),F(),gt(),Vt(),Ze(),rt(),k(),kn(),Mn(),H=T()}));function Rn({tool:e,server:t,onBack:n}){let[r,i]=zn.useState(``),a=St(e.name,t.name),o=xt(e.userFacingName?e.userFacingName({}):a),s=e.isReadOnly?.({})??!1,c=e.isDestructive?.({})??!1,l=e.isOpenWorld?.({})??!1;return zn.useEffect(()=>{async function t(){try{let t=await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]});i(t)}catch{i(`Failed to load description`)}}t()},[e]),(0,U.jsx)(w,{title:(0,U.jsxs)(U.Fragment,{children:[o,s&&(0,U.jsx)(f,{color:`success`,children:` [read-only]`}),c&&(0,U.jsx)(f,{color:`error`,children:` [destructive]`}),l&&(0,U.jsx)(f,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,U.jsxs)(f,{children:[`Press `,e.keyName,` again to exit`]}):(0,U.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,U.jsxs)(u,{flexDirection:`column`,children:[(0,U.jsxs)(u,{children:[(0,U.jsx)(f,{bold:!0,children:`Tool name: `}),(0,U.jsx)(f,{dimColor:!0,children:a})]}),(0,U.jsxs)(u,{children:[(0,U.jsx)(f,{bold:!0,children:`Full name: `}),(0,U.jsx)(f,{dimColor:!0,children:e.name})]}),r&&(0,U.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(f,{bold:!0,children:`Description:`}),(0,U.jsx)(f,{wrap:`wrap`,children:r})]}),e.inputJSONSchema&&e.inputJSONSchema.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,U.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(f,{bold:!0,children:`Parameters:`}),(0,U.jsx)(u,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,U.jsxs)(f,{children:[`• `,t,r&&(0,U.jsx)(f,{dimColor:!0,children:` (required)`}),`:`,` `,(0,U.jsx)(f,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,U.jsxs)(f,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var zn,U,Bn=e((()=>{zn=t(g(),1),C(),Ct(),Ze(),U=T()}));function Vn({server:e,onSelectTool:t,onBack:n}){let r=re(e=>e.mcp.tools),i=Hn.useMemo(()=>e.client.type===`connected`?ze(r,e.name):[],[e,r]),a=i.map((t,n)=>{let r=St(t.name,e.name),i=xt(t.userFacingName?t.userFacingName({}):r),a=t.isReadOnly?.({})??!1,o=t.isDestructive?.({})??!1,s=t.isOpenWorld?.({})??!1,c=[];return a&&c.push(`read-only`),o&&c.push(`destructive`),s&&c.push(`open-world`),{label:i,value:n.toString(),description:c.length>0?c.join(`, `):void 0,descriptionColor:o?`error`:a?`success`:void 0}});return(0,Un.jsx)(w,{title:`Tools for ${e.name}`,subtitle:`${i.length} ${zt(i.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,Un.jsxs)(f,{children:[`Press `,e.keyName,` again to exit`]}):(0,Un.jsxs)(p,{children:[(0,Un.jsx)(o,{shortcut:`↑↓`,action:`navigate`}),(0,Un.jsx)(o,{shortcut:`Enter`,action:`select`}),(0,Un.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:i.length===0?(0,Un.jsx)(f,{dimColor:!0,children:`No tools available`}):(0,Un.jsx)(Ve,{options:a,onChange:e=>{let n=parseInt(e,10),r=i[n];r&&t(r,n)},onCancel:n})})}var Hn,Un,Wn=e((()=>{Hn=t(g(),1),C(),Ct(),st(),F(),Vt(),Ze(),rt(),Un=T()}));function Gn({inputValue:e,setInputValue:t,cursorOffset:n,setCursorOffset:r,error:i,setError:a,result:s,setResult:c,setViewState:l,onAddComplete:d,cliMode:ee=!1}){let m=(0,Kn.useRef)(!1),[h,g]=(0,Kn.useState)(!1),[_,v]=(0,Kn.useState)(``),y=async()=>{let t=e.trim();if(!t){a(`Please enter a marketplace source`);return}let n=await cn(t);if(!n){a(`Invalid marketplace source format. Try: owner/repo, https://..., or ./path`);return}if(`error`in n){a(n.error);return}a(null);try{g(!0),v(``);let{name:e,resolvedSource:t}=await de(n,e=>{v(e)});M(e,{source:t}),Ke();let r=n.source;n.source===`github`&&(r=n.repo),Pt(`tengu_marketplace_added`,{source_type:r}),d&&await d(),v(``),g(!1),ee?c(`Successfully added marketplace: ${e}`):l({type:`browse-marketplace`,targetMarketplace:e})}catch(e){let t=pt(e);Mt(t),a(t.message),v(``),g(!1),c(ee?`Error: ${t.message}`:null)}};return(0,Kn.useEffect)(()=>{e&&!m.current&&!i&&!s&&(m.current=!0,y())},[]),(0,W.jsxs)(u,{flexDirection:`column`,children:[(0,W.jsxs)(u,{flexDirection:`column`,paddingX:1,borderStyle:`round`,children:[(0,W.jsx)(u,{marginBottom:1,children:(0,W.jsx)(f,{bold:!0,children:`Add Marketplace`})}),(0,W.jsxs)(u,{flexDirection:`column`,children:[(0,W.jsx)(f,{children:`Enter marketplace source:`}),(0,W.jsx)(f,{dimColor:!0,children:`Examples:`}),(0,W.jsx)(f,{dimColor:!0,children:` · owner/repo (GitHub)`}),(0,W.jsx)(f,{dimColor:!0,children:` · git@github.com:owner/repo.git (SSH)`}),(0,W.jsx)(f,{dimColor:!0,children:` · https://example.com/marketplace.json`}),(0,W.jsx)(f,{dimColor:!0,children:` · ./path/to/marketplace`}),(0,W.jsx)(u,{marginTop:1,children:(0,W.jsx)(ve,{value:e,onChange:t,onSubmit:y,columns:80,cursorOffset:n,onChangeCursorOffset:r,focus:!0,showCursor:!0})})]}),h&&(0,W.jsxs)(u,{marginTop:1,children:[(0,W.jsx)(ot,{}),(0,W.jsx)(f,{children:_||`Adding marketplace to configuration…`})]}),i&&(0,W.jsx)(u,{marginTop:1,children:(0,W.jsx)(f,{color:`error`,children:i})}),s&&(0,W.jsx)(u,{marginTop:1,children:(0,W.jsx)(f,{children:s})})]}),(0,W.jsx)(u,{marginLeft:3,children:(0,W.jsx)(f,{dimColor:!0,italic:!0,children:(0,W.jsxs)(p,{children:[(0,W.jsx)(o,{shortcut:`Enter`,action:`add`}),(0,W.jsx)(z,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]})})})]})}var Kn,W,qn=e((()=>{g(),Kn=t(g(),1),Nt(),Ze(),C(),k(),A(),gt(),jt(),nt(),I(),un(),W=T()}));function Jn(e,t,r,i){let a={};for(let o of e){let e=r[o],s=t[o]??``;if(!(e?.sensitive===!0&&s===``&&i?.[o]!==void 0))if(e?.type===`number`){if(s.trim()===``)continue;let e=Number(s);a[o]=Number.isNaN(e)?s:e}else e?.type===`boolean`?a[o]=n(s):a[o]=s}return a}function Yn({title:e,subtitle:t,configSchema:n,initialValues:r,onSave:i,onCancel:o}){let l=Object.keys(n),d=(0,Xn.useCallback)(e=>{if(n[e]?.sensitive===!0)return``;let t=r?.[e];return t===void 0?``:String(t)},[n,r]),[p,m]=(0,Xn.useState)(0),[h,g]=(0,Xn.useState)({}),[v,y]=(0,Xn.useState)(()=>l[0]?d(l[0]):``),b=l[p],x=b?n[b]:null;if(ee(`confirm:no`,o,{context:`Settings`}),c({"confirm:nextField":(0,Xn.useCallback)(()=>{if(p<l.length-1&&b){g(e=>({...e,[b]:v})),m(e=>e+1);let e=l[p+1];y(e?d(e):``)}},[p,l,b,v,d]),"confirm:yes":(0,Xn.useCallback)(()=>{if(!b)return;let e={...h,[b]:v};if(p===l.length-1)i(Jn(l,e,n,r));else{g(e),m(e=>e+1);let t=l[p+1];y(t?d(t):``)}},[b,h,v,p,l,n,i,d,r])},{context:`Confirmation`}),_((e,t)=>{if(t.backspace||t.delete){y(e=>e.slice(0,-1));return}e&&!t.ctrl&&!t.meta&&!t.tab&&!t.return&&y(t=>t+e)}),!x||!b)return null;let S=x.sensitive===!0,C=x.required===!0,te=S?`*`.repeat(s(v)):v;return(0,Zn.jsxs)(w,{title:e,subtitle:t,onCancel:o,isCancelActive:!1,children:[(0,Zn.jsxs)(u,{flexDirection:`column`,children:[(0,Zn.jsxs)(f,{bold:!0,children:[x.title||b,C&&(0,Zn.jsx)(f,{color:`error`,children:` *`})]}),x.description&&(0,Zn.jsx)(f,{dimColor:!0,children:x.description}),(0,Zn.jsxs)(u,{marginTop:1,children:[(0,Zn.jsxs)(f,{children:[a.pointerSmall,` `]}),(0,Zn.jsx)(f,{children:te}),(0,Zn.jsx)(f,{children:`█`})]})]}),(0,Zn.jsxs)(u,{flexDirection:`column`,children:[(0,Zn.jsxs)(f,{dimColor:!0,children:[`Field `,p+1,` of `,l.length]}),p<l.length-1&&(0,Zn.jsx)(f,{dimColor:!0,children:`Tab: Next field · Enter: Save and continue`}),p===l.length-1&&(0,Zn.jsx)(f,{dimColor:!0,children:`Enter: Save configuration`})]})]})}var Xn,Zn,Qn=e((()=>{i(),Xn=t(g(),1),C(),Jt(),r(),Zn=T()}));async function $n(e){let{enabled:t,disabled:n}=await Ye();return[...t,...n].find(t=>t.repository===e||t.source===e)}function er({plugin:e,pluginId:t,onDone:n}){let[r]=tr.useState(()=>{let n=[],r=P(e);Object.keys(r).length>0&&n.push({key:`top-level`,title:`Configure ${e.name}`,subtitle:`Plugin options`,schema:r,load:()=>N(t),save:n=>Te(t,n,e.manifest.userConfig)});let i=j(e);for(let r of i)n.push({key:`channel:${r.server}`,title:`Configure ${r.displayName}`,subtitle:`Plugin: ${e.name}`,schema:r.configSchema,load:()=>pe(t,r.server)??void 0,save:e=>Le(t,r.server,e,r.configSchema)});return n}),[i,a]=tr.useState(0),o=tr.useRef(n);if(o.current=n,tr.useEffect(()=>{r.length===0&&o.current(`skipped`)},[r.length]),r.length===0)return null;let s=r[i];function c(e){try{s.save(e)}catch(e){n(`error`,dt(e));return}let t=i+1;t<r.length?a(t):n(`configured`)}return(0,nr.jsx)(Yn,{title:s.title,subtitle:s.subtitle,configSchema:s.schema,initialValues:s.load(),onSave:c,onCancel:()=>n(`skipped`)},s.key)}var tr,nr,rr=e((()=>{tr=t(g(),1),gt(),Ce(),ye(),Me(),Qe(),Qn(),nr=T()}));function ir(){let e=ke();return(0,ar.jsxs)(u,{marginBottom:1,children:[(0,ar.jsxs)(f,{color:`claude`,children:[a.warning,` `]}),(0,ar.jsxs)(f,{dimColor:!0,italic:!0,children:[`Make sure you trust a plugin before installing, updating, or using it. We do not control what MCP servers, files, or other software are included in plugins and cannot verify that they will work as intended or that they won't change. See each plugin's homepage for more information.`,e?` ${e}`:``]})]})}var ar,or=e((()=>{i(),g(),C(),L(),ar=T()}));function sr(e){return e.entry.source&&typeof e.entry.source==`object`&&`source`in e.entry.source&&e.entry.source.source===`github`&&typeof e.entry.source==`object`&&`repo`in e.entry.source?e.entry.source.repo:null}function cr(e,t){let n=[{label:`Install for you (user scope)`,action:`install-user`},{label:`Install for all collaborators on this repository (project scope)`,action:`install-project`},{label:`Install for you, in this repo only (local scope)`,action:`install-local`}];return e&&n.push({label:`Open homepage`,action:`homepage`}),t&&n.push({label:`View on GitHub`,action:`github`}),n.push({label:`Back to plugin list`,action:`back`}),n}function lr({hasSelection:e}){return(0,ur.jsx)(u,{marginTop:1,children:(0,ur.jsx)(f,{dimColor:!0,italic:!0,children:(0,ur.jsxs)(p,{children:[e&&(0,ur.jsx)(z,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,ur.jsx)(z,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,ur.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,ur.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}var ur,dr=e((()=>{g(),Ze(),C(),ur=T()}));function fr({totalItems:e,maxVisible:t=mr,selectedIndex:n=0}){let r=e>t,i=(0,pr.useRef)(0),a=(0,pr.useMemo)(()=>{if(!r)return 0;let a=i.current;if(n<a)return i.current=n,n;if(n>=a+t){let e=n-t+1;return i.current=e,e}let o=Math.max(0,e-t),s=Math.min(a,o);return i.current=s,s},[n,t,r,e]),o=a,s=Math.min(a+t,e),c=(0,pr.useCallback)(e=>r?e.slice(o,s):e,[r,o,s]),l=(0,pr.useCallback)(e=>o+e,[o]),u=(0,pr.useCallback)(e=>e>=o&&e<s,[o,s]),d=(0,pr.useCallback)(e=>{},[]),f=(0,pr.useCallback)(()=>{},[]),p=(0,pr.useCallback)(()=>{},[]),ee=(0,pr.useCallback)((t,n)=>{n(Math.max(0,Math.min(t,e-1)))},[e]),m=(0,pr.useCallback)((e,t)=>!1,[]),h=Math.max(1,Math.ceil(e/t));return{currentPage:Math.floor(a/t),totalPages:h,startIndex:o,endIndex:s,needsPagination:r,pageSize:t,getVisibleItems:c,toActualIndex:l,isOnCurrentPage:u,goToPage:d,nextPage:f,prevPage:p,handleSelectionChange:ee,handlePageNavigation:m,scrollPosition:{current:n+1,total:e,canScrollUp:a>0,canScrollDown:a+t<e}}}var pr,mr,hr=e((()=>{pr=t(g(),1),mr=5}));function gr({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,targetMarketplace:s,targetPlugin:l}){let[d,m]=(0,vr.useState)(`marketplace-list`),[h,g]=(0,vr.useState)(null),[_,v]=(0,vr.useState)(null),[y,b]=(0,vr.useState)([]),[x,S]=(0,vr.useState)([]),[C,te]=(0,vr.useState)(!0),[w,T]=(0,vr.useState)(null),[E,O]=(0,vr.useState)(0),[k,A]=(0,vr.useState)(new Set),[re,ae]=(0,vr.useState)(new Set),j=fr({totalItems:x.length,selectedIndex:E}),[M,N]=(0,vr.useState)(0),[se,P]=(0,vr.useState)(!1),[le,ue]=(0,vr.useState)(null),[de,F]=(0,vr.useState)(null);ee(`confirm:no`,_r.useCallback(()=>{d===`plugin-list`?s?i({type:`manage-marketplaces`,targetMarketplace:s}):y.length===1?i({type:`menu`}):(m(`marketplace-list`),g(null),A(new Set)):d===`plugin-details`?(m(`plugin-list`),v(null)):i({type:`menu`})},[d,s,i,y.length]),{context:`Confirmation`}),(0,vr.useEffect)(()=>{async function e(){try{let e=await ie(),{marketplaces:n,failures:r}=await Ie(e),i=[];for(let{name:e,config:t,data:r}of n)if(r){let n=wt(r.plugins,t=>ne(ce(t.name,e)));i.push({name:e,totalPlugins:r.plugins.length,installedCount:n,source:we(t.source)})}i.sort((e,t)=>e.name===`claude-plugin-directory`?-1:+(t.name===`claude-plugin-directory`)),b(i);let a=De(r,wt(n,e=>e.data!==null));if(a)if(a.type===`warning`)F(a.message+`. Showing available marketplaces.`);else throw Error(a.message);if(i.length===1&&!s&&!l){let e=i[0];e&&(g(e.name),m(`plugin-list`))}if(l){let n=null,r=null;for(let[t]of Object.entries(e)){let e=await He(t);if(e){let i=e.plugins.find(e=>e.name===l);if(i){let e=ce(i.name,t);n={entry:i,marketplaceName:t,pluginId:e,isInstalled:ge(e)},r=t;break}}}if(n&&r){let e=n.pluginId;ge(e)?t(`Plugin '${e}' is already installed globally. Use '/plugin' to manage existing plugins.`):(g(r),v(n),m(`plugin-details`))}else t(`Plugin "${l}" not found in any marketplace`)}else s&&(i.some(e=>e.name===s)?(g(s),m(`plugin-list`)):t(`Marketplace "${s}" not found`))}catch(e){t(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{te(!1)}}e()},[t,s,l]),(0,vr.useEffect)(()=>{if(!h)return;let e=!1;async function n(n){te(!0);try{let t=await He(n);if(e)return;if(!t)throw Error(`Failed to load marketplace: ${n}`);let r=[];for(let e of t.plugins){let t=ce(e.name,n);D(t)||r.push({entry:e,marketplaceName:n,pluginId:t,isInstalled:ge(t)})}try{let t=await pn();if(e)return;T(t),t?r.sort((e,n)=>{let r=t.get(e.pluginId)??0,i=t.get(n.pluginId)??0;return r===i?e.entry.name.localeCompare(n.entry.name):i-r}):r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}catch(t){if(e)return;ht(`Failed to fetch install counts: ${dt(t)}`),r.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}S(r),O(0),A(new Set)}catch(n){if(e)return;t(n instanceof Error?n.message:`Failed to load plugins`)}finally{te(!1)}}return n(h),()=>{e=!0}},[h,t]);let I=async()=>{if(k.size===0)return;let e=x.filter(e=>k.has(e.pluginId));ae(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await Re({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}ae(new Set),A(new Set),Ke(),a===0?r(`✓ Installed ${n} ${zt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${oe(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${oe(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},fe=async(e,t=`user`)=>{P(!0),ue(null);let n=await Re({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await $n(e.pluginId);if(t){P(!1),m({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else P(!1),ue(n.error)};(0,vr.useEffect)(()=>{e&&r(e)},[e,r]),c({"select:previous":()=>{E>0&&O(E-1)},"select:next":()=>{E<y.length-1&&O(E+1)},"select:accept":()=>{let e=y[E];e&&(g(e.name),m(`plugin-list`))}},{context:`Select`,isActive:d===`marketplace-list`}),c({"select:previous":()=>{E>0&&j.handleSelectionChange(E-1,O)},"select:next":()=>{E<x.length-1&&j.handleSelectionChange(E+1,O)},"select:accept":()=>{if(E===x.length&&k.size>0)I();else if(E<x.length){let e=x[E];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(v(e),m(`plugin-details`),N(0),ue(null)))}}},{context:`Select`,isActive:d===`plugin-list`}),c({"plugin:toggle":()=>{if(E<x.length){let e=x[E];if(e&&!e.isInstalled){let t=new Set(k);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),A(t)}}},"plugin:install":()=>{k.size>0&&I()}},{context:`Plugin`,isActive:d===`plugin-list`});let pe=_r.useMemo(()=>{if(!_)return[];let e=_.entry.homepage;return cr(e,sr(_))},[_]);if(c({"select:previous":()=>{M>0&&N(M-1)},"select:next":()=>{M<pe.length-1&&N(M+1)},"select:accept":()=>{if(!_)return;let e=pe[M]?.action,t=_.entry.homepage,n=sr(_);e===`install-user`?fe(_,`user`):e===`install-project`?fe(_,`project`):e===`install-local`?fe(_,`local`):e===`homepage`&&t?Yt(t):e===`github`&&n?Yt(`https://github.com/${n}`):e===`back`&&(m(`plugin-list`),v(null))}},{context:`Select`,isActive:d===`plugin-details`&&!!_}),typeof d==`object`&&d.type===`plugin-options`){let{plugin:e,pluginId:t}=d;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,G.jsx)(er,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(C)return(0,G.jsx)(f,{children:`Loading…`});if(e)return(0,G.jsx)(f,{color:`error`,children:e});if(d===`marketplace-list`)return y.length===0?(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(f,{bold:!0,children:`Select marketplace`})}),(0,G.jsx)(f,{children:`No marketplaces configured.`}),(0,G.jsxs)(f,{dimColor:!0,children:[`Add a marketplace first using `,`'Add marketplace'`,`.`]}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(f,{dimColor:!0,children:(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]}):(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(f,{bold:!0,children:`Select marketplace`})}),de&&(0,G.jsx)(u,{marginBottom:1,flexDirection:`column`,children:(0,G.jsxs)(f,{color:`warning`,children:[a.warning,` `,de]})}),y.map((e,t)=>(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:+(t<y.length-1),children:[(0,G.jsx)(u,{children:(0,G.jsxs)(f,{color:E===t?`suggestion`:void 0,children:[E===t?a.pointer:` `,` `,e.name]})}),(0,G.jsx)(u,{marginLeft:2,children:(0,G.jsxs)(f,{dimColor:!0,children:[e.totalPlugins,` `,zt(e.totalPlugins,`plugin`),` available`,e.installedCount>0&&` · ${e.installedCount} already installed`,e.source&&` · ${e.source}`]})})]},e.name)),(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(f,{dimColor:!0,italic:!0,children:(0,G.jsxs)(p,{children:[(0,G.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(d===`plugin-details`&&_){let e=_.entry.homepage,t=cr(e,sr(_));return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(f,{bold:!0,children:`Plugin Details`})}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(f,{bold:!0,children:_.entry.name}),_.entry.version&&(0,G.jsxs)(f,{dimColor:!0,children:[`Version: `,_.entry.version]}),_.entry.description&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsx)(f,{children:_.entry.description})}),_.entry.author&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(f,{dimColor:!0,children:[`By:`,` `,typeof _.entry.author==`string`?_.entry.author:_.entry.author.name]})})]}),(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(f,{bold:!0,children:`Will install:`}),_.entry.commands&&(0,G.jsxs)(f,{dimColor:!0,children:[`· Commands:`,` `,Array.isArray(_.entry.commands)?_.entry.commands.join(`, `):Object.keys(_.entry.commands).join(`, `)]}),_.entry.agents&&(0,G.jsxs)(f,{dimColor:!0,children:[`· Agents:`,` `,Array.isArray(_.entry.agents)?_.entry.agents.join(`, `):Object.keys(_.entry.agents).join(`, `)]}),_.entry.hooks&&(0,G.jsxs)(f,{dimColor:!0,children:[`· Hooks: `,Object.keys(_.entry.hooks).join(`, `)]}),_.entry.mcpServers&&(0,G.jsxs)(f,{dimColor:!0,children:[`· MCP Servers:`,` `,Array.isArray(_.entry.mcpServers)?_.entry.mcpServers.join(`, `):typeof _.entry.mcpServers==`object`?Object.keys(_.entry.mcpServers).join(`, `):`configured`]}),!_.entry.commands&&!_.entry.agents&&!_.entry.hooks&&!_.entry.mcpServers&&(0,G.jsx)(G.Fragment,{children:typeof _.entry.source==`object`&&`source`in _.entry.source&&(_.entry.source.source===`github`||_.entry.source.source===`url`||_.entry.source.source===`npm`||_.entry.source.source===`pip`)?(0,G.jsx)(f,{dimColor:!0,children:`· Component summary not available for remote plugin`}):(0,G.jsx)(f,{dimColor:!0,children:`· Components will be discovered at installation`})})]}),(0,G.jsx)(ir,{}),le&&(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsxs)(f,{color:`error`,children:[`Error: `,le]})}),(0,G.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,G.jsxs)(u,{children:[M===t&&(0,G.jsx)(f,{children:`> `}),M!==t&&(0,G.jsx)(f,{children:` `}),(0,G.jsx)(f,{bold:M===t,children:se&&e.action===`install`?`Installing…`:e.label})]},e.action))}),(0,G.jsx)(u,{marginTop:1,paddingLeft:1,children:(0,G.jsx)(f,{dimColor:!0,children:(0,G.jsxs)(p,{children:[(0,G.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(x.length===0)return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(f,{bold:!0,children:`Install plugins`})}),(0,G.jsx)(f,{dimColor:!0,children:`No new plugins available to install.`}),(0,G.jsx)(f,{dimColor:!0,children:`All plugins from this marketplace are already installed.`}),(0,G.jsx)(u,{marginLeft:3,children:(0,G.jsx)(f,{dimColor:!0,italic:!0,children:(0,G.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})})})]});let me=j.getVisibleItems(x);return(0,G.jsxs)(u,{flexDirection:`column`,children:[(0,G.jsx)(u,{marginBottom:1,children:(0,G.jsx)(f,{bold:!0,children:`Install Plugins`})}),j.scrollPosition.canScrollUp&&(0,G.jsx)(u,{children:(0,G.jsxs)(f,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),me.map((t,n)=>{let r=j.toActualIndex(n),i=E===r,o=k.has(t.pluginId),s=re.has(t.pluginId);return(0,G.jsxs)(u,{flexDirection:`column`,marginBottom:n===me.length-1&&!e?0:1,children:[(0,G.jsxs)(u,{children:[(0,G.jsxs)(f,{color:i?`suggestion`:void 0,children:[i?a.pointer:` `,` `]}),(0,G.jsxs)(f,{color:t.isInstalled?`success`:void 0,children:[t.isInstalled?a.tick:s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,t.entry.category&&(0,G.jsxs)(f,{dimColor:!0,children:[` [`,t.entry.category,`]`]}),t.entry.tags?.includes(`community-managed`)&&(0,G.jsx)(f,{dimColor:!0,children:` [Community Managed]`}),t.isInstalled&&(0,G.jsx)(f,{dimColor:!0,children:` (installed)`}),w&&h===`claude-plugins-official`&&(0,G.jsxs)(f,{dimColor:!0,children:[` · `,fn(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,G.jsxs)(u,{marginLeft:4,children:[(0,G.jsx)(f,{dimColor:!0,children:Ft(t.entry.description,60)}),t.entry.version&&(0,G.jsxs)(f,{dimColor:!0,children:[` · v`,t.entry.version]})]})]},t.pluginId)}),j.scrollPosition.canScrollDown&&(0,G.jsx)(u,{children:(0,G.jsxs)(f,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,G.jsx)(u,{marginTop:1,children:(0,G.jsxs)(f,{color:`error`,children:[a.cross,` `,e]})}),(0,G.jsx)(lr,{hasSelection:k.size>0})]})}var _r,vr,G,yr=e((()=>{i(),_r=t(g(),1),vr=t(g(),1),Ze(),C(),Jt(),Dt(),Xt(),mt(),gt(),nt(),ln(),ct(),L(),I(),se(),Fe(),me(),Vt(),It(),rr(),or(),dr(),hr(),G=T()}));function br({error:e,setError:t,result:n,setResult:r,setViewState:i,onInstallComplete:o,onSearchModeChange:s,targetPlugin:l}){let[d,h]=(0,K.useState)(`plugin-list`),[g,v]=(0,K.useState)(null),[b,S]=(0,K.useState)([]),[C,te]=(0,K.useState)(!0),[w,T]=(0,K.useState)(null),[E,O]=(0,K.useState)(!1),ne=(0,K.useCallback)(e=>{O(e),s?.(e)},[s]),{query:k,setQuery:A,cursorOffset:re}=xn({isActive:d===`plugin-list`&&E&&!C,onExit:()=>{ne(!1)}}),ae=m(),{columns:j}=x(),M=(0,K.useMemo)(()=>{if(!k)return b;let e=k.toLowerCase();return b.filter(t=>t.entry.name.toLowerCase().includes(e)||t.entry.description?.toLowerCase().includes(e)||t.marketplaceName.toLowerCase().includes(e))},[b,k]),[N,se]=(0,K.useState)(0),[P,le]=(0,K.useState)(new Set),[ue,de]=(0,K.useState)(new Set),F=fr({totalItems:M.length,selectedIndex:N});(0,K.useEffect)(()=>{se(0)},[k]);let[I,fe]=(0,K.useState)(0),[pe,me]=(0,K.useState)(!1),[L,he]=(0,K.useState)(null),[_e,ve]=(0,K.useState)(null),[ye,be]=(0,K.useState)(null);(0,K.useEffect)(()=>{async function e(){try{let e=await ie(),{marketplaces:n,failures:r}=await Ie(e),i=[];for(let{name:e,data:t}of n)if(t)for(let n of t.plugins){let t=ce(n.name,e);i.push({entry:n,marketplaceName:e,pluginId:t,isInstalled:ge(t)})}let a=i.filter(e=>!e.isInstalled&&!D(e.pluginId));try{let e=await pn();T(e),e?a.sort((t,n)=>{let r=e.get(t.pluginId)??0,i=e.get(n.pluginId)??0;return r===i?t.entry.name.localeCompare(n.entry.name):i-r}):a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}catch(e){ht(`Failed to fetch install counts: ${dt(e)}`),a.sort((e,t)=>e.entry.name.localeCompare(t.entry.name))}S(a);let o=Object.keys(e).length;if(a.length===0){let e=await et({configuredMarketplaceCount:o,failedMarketplaceCount:r.length});be(e)}let s=De(r,wt(n,e=>e.data!==null));if(s)if(s.type===`warning`)ve(s.message+`. Showing available plugins.`);else throw Error(s.message);if(l){let e=i.find(e=>e.entry.name===l);e?e.isInstalled?t(`Plugin '${e.pluginId}' is already installed. Use '/plugin' to manage existing plugins.`):(v(e),h(`plugin-details`)):t(`Plugin "${l}" not found in any marketplace`)}}catch(e){t(e instanceof Error?e.message:`Failed to load plugins`)}finally{te(!1)}}e()},[t,l]);let xe=async()=>{if(P.size===0)return;let e=b.filter(e=>P.has(e.pluginId));de(new Set(e.map(e=>e.pluginId)));let n=0,a=0,s=[];for(let t of e){let e=await Re({pluginId:t.pluginId,entry:t.entry,marketplaceName:t.marketplaceName,scope:`user`});e.success?n++:(a++,s.push({name:t.entry.name,reason:e.error}))}de(new Set),le(new Set),Ke(),a===0?r(`✓ Installed ${n} ${zt(n,`plugin`)}. Run /reload-plugins to activate.`):n===0?t(`Failed to install: ${oe(s,!0)}`):r(`✓ Installed ${n} of ${n+a} plugins. Failed: ${oe(s,!1)}. Run /reload-plugins to activate successfully installed plugins.`),n>0&&o&&await o(),i({type:`menu`})},Se=async(e,t=`user`)=>{me(!0),he(null);let n=await Re({pluginId:e.pluginId,entry:e.entry,marketplaceName:e.marketplaceName,scope:t});if(n.success){let t=await $n(e.pluginId);if(t){me(!1),h({type:`plugin-options`,plugin:t,pluginId:e.pluginId});return}r(n.message),o&&await o(),i({type:`menu`})}else me(!1),he(n.error)};(0,K.useEffect)(()=>{e&&r(e)},[e,r]),ee(`confirm:no`,()=>{h(`plugin-list`),v(null)},{context:`Confirmation`,isActive:d===`plugin-details`}),ee(`confirm:no`,()=>{i({type:`menu`})},{context:`Confirmation`,isActive:d===`plugin-list`&&!E}),_((e,t)=>{let n=!t.ctrl&&!t.meta;E||(e===`/`&&n?(ne(!0),A(``)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==`i`&&(ne(!0),A(e)))},{isActive:d===`plugin-list`&&!C}),c({"select:previous":()=>{N===0?ne(!0):F.handleSelectionChange(N-1,se)},"select:next":()=>{N<M.length-1&&F.handleSelectionChange(N+1,se)},"select:accept":()=>{if(N===M.length&&P.size>0)xe();else if(N<M.length){let e=M[N];e&&(e.isInstalled?i({type:`manage-plugins`,targetPlugin:e.entry.name,targetMarketplace:e.marketplaceName}):(v(e),h(`plugin-details`),fe(0),he(null)))}}},{context:`Select`,isActive:d===`plugin-list`&&!E}),c({"plugin:toggle":()=>{if(N<M.length){let e=M[N];if(e&&!e.isInstalled){let t=new Set(P);t.has(e.pluginId)?t.delete(e.pluginId):t.add(e.pluginId),le(t)}}},"plugin:install":()=>{P.size>0&&xe()}},{context:`Plugin`,isActive:d===`plugin-list`&&!E});let R=Cr.useMemo(()=>{if(!g)return[];let e=g.entry.homepage;return cr(e,sr(g))},[g]);if(c({"select:previous":()=>{I>0&&fe(I-1)},"select:next":()=>{I<R.length-1&&fe(I+1)},"select:accept":()=>{if(!g)return;let e=R[I]?.action,t=g.entry.homepage,n=sr(g);e===`install-user`?Se(g,`user`):e===`install-project`?Se(g,`project`):e===`install-local`?Se(g,`local`):e===`homepage`&&t?Yt(t):e===`github`&&n?Yt(`https://github.com/${n}`):e===`back`&&(h(`plugin-list`),v(null))}},{context:`Select`,isActive:d===`plugin-details`&&!!g}),typeof d==`object`&&d.type===`plugin-options`){let{plugin:e,pluginId:t}=d;function n(e){r(e),o&&o(),i({type:`menu`})}return(0,q.jsx)(er,{plugin:e,pluginId:t,onDone:(t,r)=>{switch(t){case`configured`:n(`✓ Installed and configured ${e.name}. Run /reload-plugins to apply.`);break;case`skipped`:n(`✓ Installed ${e.name}. Run /reload-plugins to apply.`);break;case`error`:n(`Installed but failed to save config: ${r}`);break}}})}if(C)return(0,q.jsx)(f,{children:`Loading…`});if(e)return(0,q.jsx)(f,{color:`error`,children:e});if(d===`plugin-details`&&g){let e=g.entry.homepage,t=cr(e,sr(g));return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(f,{bold:!0,children:`Plugin details`})}),(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(f,{bold:!0,children:g.entry.name}),(0,q.jsxs)(f,{dimColor:!0,children:[`from `,g.marketplaceName]}),g.entry.version&&(0,q.jsxs)(f,{dimColor:!0,children:[`Version: `,g.entry.version]}),g.entry.description&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(f,{children:g.entry.description})}),g.entry.author&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(f,{dimColor:!0,children:[`By:`,` `,typeof g.entry.author==`string`?g.entry.author:g.entry.author.name]})})]}),(0,q.jsx)(ir,{}),L&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(f,{color:`error`,children:[`Error: `,L]})}),(0,q.jsx)(u,{flexDirection:`column`,children:t.map((e,t)=>(0,q.jsxs)(u,{children:[I===t&&(0,q.jsx)(f,{children:`> `}),I!==t&&(0,q.jsx)(f,{children:` `}),(0,q.jsx)(f,{bold:I===t,children:pe&&e.action.startsWith(`install-`)?`Installing…`:e.label})]},e.action))}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(f,{dimColor:!0,children:(0,q.jsxs)(p,{children:[(0,q.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,q.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(b.length===0)return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(f,{bold:!0,children:`Discover plugins`})}),(0,q.jsx)(Sr,{reason:ye}),(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(f,{dimColor:!0,italic:!0,children:`Esc to go back`})})]});let Ce=F.getVisibleItems(M);return(0,q.jsxs)(u,{flexDirection:`column`,children:[(0,q.jsxs)(u,{children:[(0,q.jsx)(f,{bold:!0,children:`Discover plugins`}),F.needsPagination&&(0,q.jsxs)(f,{dimColor:!0,children:[` `,`(`,F.scrollPosition.current,`/`,F.scrollPosition.total,`)`]})]}),(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsx)(y,{query:k,isFocused:E,isTerminalFocused:ae,width:j-4,cursorOffset:re})}),_e&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(f,{color:`warning`,children:[a.warning,` `,_e]})}),M.length===0&&k&&(0,q.jsx)(u,{marginBottom:1,children:(0,q.jsxs)(f,{dimColor:!0,children:[`No plugins match "`,k,`"`]})}),F.scrollPosition.canScrollUp&&(0,q.jsx)(u,{children:(0,q.jsxs)(f,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Ce.map((t,n)=>{let r=F.toActualIndex(n),i=N===r,o=P.has(t.pluginId),s=ue.has(t.pluginId);return(0,q.jsxs)(u,{flexDirection:`column`,marginBottom:n===Ce.length-1&&!e?0:1,children:[(0,q.jsxs)(u,{children:[(0,q.jsxs)(f,{color:i&&!E?`suggestion`:void 0,children:[i&&!E?a.pointer:` `,` `]}),(0,q.jsxs)(f,{children:[s?a.ellipsis:o?a.radioOn:a.radioOff,` `,t.entry.name,(0,q.jsxs)(f,{dimColor:!0,children:[` · `,t.marketplaceName]}),t.entry.tags?.includes(`community-managed`)&&(0,q.jsx)(f,{dimColor:!0,children:` [Community Managed]`}),w&&t.marketplaceName===`claude-plugins-official`&&(0,q.jsxs)(f,{dimColor:!0,children:[` · `,fn(w.get(t.pluginId)??0),` installs`]})]})]}),t.entry.description&&(0,q.jsx)(u,{marginLeft:4,children:(0,q.jsx)(f,{dimColor:!0,children:Ft(t.entry.description,60)})})]},`${F.startIndex}-${t.pluginId}`)}),F.scrollPosition.canScrollDown&&(0,q.jsx)(u,{children:(0,q.jsxs)(f,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),e&&(0,q.jsx)(u,{marginTop:1,children:(0,q.jsxs)(f,{color:`error`,children:[a.cross,` `,e]})}),(0,q.jsx)(xr,{hasSelection:P.size>0,canToggle:N<M.length&&!M[N]?.isInstalled})]})}function xr({hasSelection:e,canToggle:t}){return(0,q.jsx)(u,{marginTop:1,children:(0,q.jsx)(f,{dimColor:!0,italic:!0,children:(0,q.jsxs)(p,{children:[e&&(0,q.jsx)(z,{action:`plugin:install`,context:`Plugin`,fallback:`i`,description:`install`,bold:!0}),(0,q.jsx)(f,{children:`type to search`}),t&&(0,q.jsx)(z,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,q.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,q.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})}function Sr({reason:e}){switch(e){case`git-not-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`Git is required to install marketplaces.`}),(0,q.jsx)(f,{dimColor:!0,children:`Please install git and restart Work Mate.`})]});case`all-blocked-by-policy`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`Your organization policy does not allow any external marketplaces.`}),(0,q.jsx)(f,{dimColor:!0,children:`Contact your administrator.`})]});case`policy-restricts-sources`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`Your organization restricts which marketplaces can be added.`}),(0,q.jsx)(f,{dimColor:!0,children:`Switch to the Marketplaces tab to view allowed sources.`})]});case`all-marketplaces-failed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`Failed to load marketplace data.`}),(0,q.jsx)(f,{dimColor:!0,children:`Check your network connection.`})]});case`all-plugins-installed`:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`All available plugins are already installed.`}),(0,q.jsx)(f,{dimColor:!0,children:`Check for new plugins later or add more marketplaces.`})]});default:return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(f,{dimColor:!0,children:`No plugins available.`}),(0,q.jsx)(f,{dimColor:!0,children:`Add a marketplace first using the Marketplaces tab.`})]})}}var Cr,K,q,wr=e((()=>{i(),Cr=t(g(),1),K=t(g(),1),Ze(),bn(),C(),Sn(),R(),Jt(),Dt(),Xt(),mt(),gt(),nt(),ln(),ct(),L(),I(),se(),Fe(),me(),Vt(),It(),rr(),or(),dr(),hr(),q=T()}));function Tr({setViewState:e,error:t,setError:n,setResult:r,exitState:i,onManageComplete:o,targetMarketplace:s,action:l}){let[d,m]=(0,Dr.useState)([]),[h,g]=(0,Dr.useState)(!0),[v,y]=(0,Dr.useState)(0),[b,x]=(0,Dr.useState)(!1),[S,C]=(0,Dr.useState)(null),[te,w]=(0,Dr.useState)(null),[T,E]=(0,Dr.useState)(null),[D,ne]=(0,Dr.useState)(`list`),[k,A]=(0,Dr.useState)(null),[re,ae]=(0,Dr.useState)(0),j=(0,Dr.useRef)(!1);(0,Dr.useEffect)(()=>{async function e(){try{let e=await ie(),{enabled:r,disabled:i}=await Ye(),a=[...r,...i],{marketplaces:o,failures:c}=await Ie(e),u=[];for(let{name:e,config:t,data:n}of o){let r=a.filter(t=>t.source.endsWith(`@${e}`));u.push({name:e,source:we(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:_t(e,t)})}u.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),m(u);let d=De(c,wt(o,e=>e.data!==null));if(d)if(d.type===`warning`)C(d.message);else throw Error(d.message);if(s&&!j.current&&!t){j.current=!0;let e=u.findIndex(e=>e.name===s);if(e>=0){let t=u[e];if(l){y(e+1);let t=[...u];l===`update`?t[e].pendingUpdate=!0:l===`remove`&&(t[e].pendingRemove=!0),m(t),setTimeout(oe,100,t)}else t&&(y(e+1),A(t),ne(`details`))}else n&&n(`Marketplace not found: ${s}`)}}catch(e){n&&n(e instanceof Error?e.message:`Failed to load marketplaces`),C(e instanceof Error?e.message:`Failed to load marketplaces`)}finally{g(!1)}}e()},[s,l,t]);let M=()=>d.some(e=>e.pendingUpdate||e.pendingRemove),N=()=>({updateCount:wt(d,e=>e.pendingUpdate),removeCount:wt(d,e=>e.pendingRemove)}),oe=async t=>{let i=t||d,s=D===`details`;x(!0),C(null),w(null),E(null);try{let t=vt(`userSettings`),n=0,c=0,l=new Set;for(let e of i){if(e.pendingRemove){if(e.installedPlugins&&e.installedPlugins.length>0){let n={...t?.enabledPlugins};for(let t of e.installedPlugins){let r=ce(t.name,e.name);n[r]=!1}Et(`userSettings`,{enabledPlugins:n})}await O(e.name),c++,Pt(`tengu_marketplace_removed`,{marketplace_name:e.name,plugins_uninstalled:e.installedPlugins?.length||0});continue}e.pendingUpdate&&(await he(e.name,e=>{E(e)}),n++,l.add(e.name.toLowerCase()),Pt(`tengu_marketplace_updated`,{marketplace_name:e.name}))}let u=0;l.size>0&&(u=(await Cn(l)).length),Ke(),o&&await o();let d=await ie(),{enabled:f,disabled:p}=await Ye(),ee=[...f,...p],{marketplaces:h}=await Ie(d),g=[];for(let{name:e,config:t,data:n}of h){let r=ee.filter(t=>t.source.endsWith(`@${e}`));g.push({name:e,source:we(t.source),lastUpdated:t.lastUpdated,pluginCount:n?.plugins.length,installedPlugins:r,pendingUpdate:!1,pendingRemove:!1,autoUpdate:_t(e,t)})}if(g.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),m(g),s&&k){let e=g.find(e=>e.name===k.name);e&&A(e)}let _=[];if(n>0){let e=u>0?` (${u} ${zt(u,`plugin`)} bumped)`:``;_.push(`Updated ${n} ${zt(n,`marketplace`)}${e}`)}if(c>0&&_.push(`Removed ${c} ${zt(c,`marketplace`)}`),_.length>0){let t=`${a.tick} ${_.join(`, `)}`;s?w(t):(r(t),setTimeout(e,2e3,{type:`menu`}))}else s||e({type:`menu`})}catch(e){let t=dt(e);C(t),n&&n(t)}finally{x(!1),E(null)}},se=async()=>{if(!k)return;let e=d.map(e=>e.name===k.name?{...e,pendingRemove:!0}:e);m(e),await oe(e)},P=e=>{if(!e)return[];let t=[{label:`Browse plugins (${e.pluginCount??0})`,value:`browse`},{label:`Update marketplace`,secondaryLabel:e.lastUpdated?`(last updated ${new Date(e.lastUpdated).toLocaleDateString()})`:void 0,value:`update`}];return kt()||t.push({label:e.autoUpdate?`Disable auto-update`:`Enable auto-update`,value:`toggle-auto-update`}),t.push({label:`Remove marketplace`,value:`remove`}),t},le=async e=>{let t=!e.autoUpdate;try{await be(e.name,t),m(n=>n.map(n=>n.name===e.name?{...n,autoUpdate:t}:n)),A(e=>e&&{...e,autoUpdate:t})}catch(e){C(e instanceof Error?e.message:`Failed to update setting`)}};if(ee(`confirm:no`,()=>{ne(`list`),ae(0)},{context:`Confirmation`,isActive:!b&&(D===`details`||D===`confirm-remove`)}),ee(`confirm:no`,()=>{m(e=>e.map(e=>({...e,pendingUpdate:!1,pendingRemove:!1}))),y(0)},{context:`Confirmation`,isActive:!b&&D===`list`&&M()}),ee(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`,isActive:!b&&D===`list`&&!M()}),c({"select:previous":()=>y(e=>Math.max(0,e-1)),"select:next":()=>{let e=d.length+1;y(t=>Math.min(e-1,t+1))},"select:accept":()=>{let t=v-1;if(v===0)e({type:`add-marketplace`});else if(M())oe();else{let e=d[t];e&&(A(e),ne(`details`),ae(0))}}},{context:`Select`,isActive:!b&&D===`list`}),_(e=>{let t=v-1;if((e===`u`||e===`U`)&&t>=0)m(e=>e.map((e,n)=>n===t?{...e,pendingUpdate:!e.pendingUpdate,pendingRemove:e.pendingUpdate?e.pendingRemove:!1}:e));else if((e===`r`||e===`R`)&&t>=0){let e=d[t];e&&(A(e),ne(`confirm-remove`))}},{isActive:!b&&D===`list`}),c({"select:previous":()=>ae(e=>Math.max(0,e-1)),"select:next":()=>{let e=P(k);ae(t=>Math.min(e.length-1,t+1))},"select:accept":()=>{if(!k)return;let t=P(k)[re];if(t?.value===`browse`)e({type:`browse-marketplace`,targetMarketplace:k.name});else if(t?.value===`update`){let e=d.map(e=>e.name===k.name?{...e,pendingUpdate:!0}:e);m(e),oe(e)}else t?.value===`toggle-auto-update`?le(k):t?.value===`remove`&&ne(`confirm-remove`)}},{context:`Select`,isActive:!b&&D===`details`}),_(e=>{e===`y`||e===`Y`?se():(e===`n`||e===`N`)&&(ne(`list`),A(null))},{isActive:!b&&D===`confirm-remove`}),h)return(0,J.jsx)(f,{children:`Loading marketplaces…`});if(d.length===0)return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(f,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(f,{color:`suggestion`,children:[a.pointer,` +`]}),(0,J.jsx)(f,{bold:!0,color:`suggestion`,children:`Add Marketplace`})]}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(f,{dimColor:!0,italic:!0,children:i.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,i.keyName,` again to go back`]}):(0,J.jsxs)(p,{children:[(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]});if(D===`confirm-remove`&&k){let e=k.installedPlugins?.length||0;return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsxs)(f,{bold:!0,color:`warning`,children:[`Remove marketplace `,(0,J.jsx)(f,{italic:!0,children:k.name}),`?`]}),(0,J.jsxs)(u,{flexDirection:`column`,children:[e>0&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(f,{color:`warning`,children:[`This will also uninstall `,e,` `,zt(e,`plugin`),` from this marketplace:`]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,marginLeft:2,children:k.installedPlugins.map(e=>(0,J.jsxs)(f,{dimColor:!0,children:[`• `,e.name]},e.name))}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(f,{children:[`Press `,(0,J.jsx)(f,{bold:!0,children:`y`}),` to confirm or `,(0,J.jsx)(f,{bold:!0,children:`n`}),` to cancel`]})})]})]})}if(D===`details`&&k){let e=k.pendingUpdate||b,t=P(k);return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(f,{bold:!0,children:k.name}),(0,J.jsx)(f,{dimColor:!0,children:k.source}),(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(f,{children:[k.pluginCount||0,` available `,zt(k.pluginCount||0,`plugin`)]})}),k.installedPlugins&&k.installedPlugins.length>0&&(0,J.jsxs)(u,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(f,{bold:!0,children:[`Installed plugins (`,k.installedPlugins.length,`):`]}),(0,J.jsx)(u,{flexDirection:`column`,marginLeft:1,children:k.installedPlugins.map(e=>(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(f,{children:a.bullet}),(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(f,{children:e.name}),(0,J.jsx)(f,{dimColor:!0,children:e.manifest.description})]})]},e.name))})]}),e&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsx)(f,{color:`claude`,children:`Updating marketplace…`}),T&&(0,J.jsx)(f,{dimColor:!0,children:T})]}),!e&&te&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{color:`claude`,children:te})}),!e&&S&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{color:`error`,children:S})}),!e&&(0,J.jsx)(u,{flexDirection:`column`,marginTop:1,children:t.map((e,t)=>{if(!e)return null;let n=t===re;return(0,J.jsxs)(u,{children:[(0,J.jsxs)(f,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.label]}),e.secondaryLabel&&(0,J.jsxs)(f,{dimColor:!0,children:[` `,e.secondaryLabel]})]},e.value)})}),!e&&!kt()&&k.autoUpdate&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{dimColor:!0,children:`Auto-update enabled. Work Mate will automatically update this marketplace and its installed plugins.`})}),(0,J.jsx)(u,{marginLeft:3,children:(0,J.jsx)(f,{dimColor:!0,italic:!0,children:e?(0,J.jsx)(J.Fragment,{children:`Please wait…`}):(0,J.jsxs)(p,{children:[(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,J.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})})]})}let{updateCount:ue,removeCount:de}=N();return(0,J.jsxs)(u,{flexDirection:`column`,children:[(0,J.jsx)(u,{marginBottom:1,children:(0,J.jsx)(f,{bold:!0,children:`Manage marketplaces`})}),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(f,{color:v===0?`suggestion`:void 0,children:[v===0?a.pointer:` `,` +`]}),(0,J.jsx)(f,{bold:!0,color:v===0?`suggestion`:void 0,children:`Add Marketplace`})]}),(0,J.jsx)(u,{flexDirection:`column`,children:d.map((e,t)=>{let n=t+1===v,r=[];return e.pendingUpdate&&r.push(`UPDATE`),e.pendingRemove&&r.push(`REMOVE`),(0,J.jsxs)(u,{flexDirection:`row`,gap:1,marginBottom:1,children:[(0,J.jsxs)(f,{color:n?`suggestion`:void 0,children:[n?a.pointer:` `,` `,e.pendingRemove?a.cross:a.bullet]}),(0,J.jsxs)(u,{flexDirection:`column`,flexGrow:1,children:[(0,J.jsxs)(u,{flexDirection:`row`,gap:1,children:[(0,J.jsxs)(f,{bold:!0,strikethrough:e.pendingRemove,dimColor:e.pendingRemove,children:[e.name===`claude-plugins-official`&&(0,J.jsx)(f,{color:`claude`,children:`✻ `}),e.name,e.name===`claude-plugins-official`&&(0,J.jsx)(f,{color:`claude`,children:` ✻`})]}),r.length>0&&(0,J.jsxs)(f,{color:`warning`,children:[`[`,r.join(`, `),`]`]})]}),(0,J.jsx)(f,{dimColor:!0,children:e.source}),(0,J.jsxs)(f,{dimColor:!0,children:[e.pluginCount!==void 0&&(0,J.jsxs)(J.Fragment,{children:[e.pluginCount,` available`]}),e.installedPlugins&&e.installedPlugins.length>0&&(0,J.jsxs)(J.Fragment,{children:[` • `,e.installedPlugins.length,` installed`]}),e.lastUpdated&&(0,J.jsxs)(J.Fragment,{children:[` • Updated `,new Date(e.lastUpdated).toLocaleDateString()]})]})]})]},e.name)})}),M()&&(0,J.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,J.jsxs)(f,{children:[(0,J.jsx)(f,{bold:!0,children:`Pending changes:`}),` `,(0,J.jsx)(f,{dimColor:!0,children:`Enter to apply`})]}),ue>0&&(0,J.jsxs)(f,{children:[`• Update `,ue,` `,zt(ue,`marketplace`)]}),de>0&&(0,J.jsxs)(f,{color:`warning`,children:[`• Remove `,de,` `,zt(de,`marketplace`)]})]}),b&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{color:`claude`,children:`Processing changes…`})}),S&&(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{color:`error`,children:S})}),(0,J.jsx)(Er,{exitState:i,hasPendingActions:M()})]})}function Er({exitState:e,hasPendingActions:t}){return e.pending?(0,J.jsx)(u,{marginTop:1,children:(0,J.jsxs)(f,{dimColor:!0,italic:!0,children:[`Press `,e.keyName,` again to go back`]})}):(0,J.jsx)(u,{marginTop:1,children:(0,J.jsx)(f,{dimColor:!0,italic:!0,children:(0,J.jsxs)(p,{children:[t&&(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`apply changes`}),!t&&(0,J.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),!t&&(0,J.jsx)(o,{shortcut:`u`,action:`update`}),!t&&(0,J.jsx)(o,{shortcut:`r`,action:`remove`}),(0,J.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:t?`cancel`:`go back`})]})})})}var Dr,J,Or=e((()=>{i(),g(),Dr=t(g(),1),Nt(),Ze(),C(),Jt(),Dt(),Ot(),gt(),nt(),L(),I(),wn(),Me(),Tt(),bt(),Vt(),J=T()}));function kr(e){switch(e.type){case`path-not-found`:return`${e.component} path not found: ${e.path}`;case`git-auth-failed`:return`Git ${e.authType.toUpperCase()} authentication failed for ${e.gitUrl}`;case`git-timeout`:return`Git ${e.operation} timed out for ${e.gitUrl}`;case`network-error`:return`Network error accessing ${e.url}${e.details?`: ${e.details}`:``}`;case`manifest-parse-error`:return`Failed to parse manifest at ${e.manifestPath}: ${e.parseError}`;case`manifest-validation-error`:return`Invalid manifest at ${e.manifestPath}: ${e.validationErrors.join(`, `)}`;case`plugin-not-found`:return`Plugin "${e.pluginId}" not found in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return`Marketplace "${e.marketplace}" not found`;case`marketplace-load-failed`:return`Failed to load marketplace "${e.marketplace}": ${e.reason}`;case`mcp-config-invalid`:return`Invalid MCP server config for "${e.serverName}": ${e.validationError}`;case`mcp-server-suppressed-duplicate`:{let t=e.duplicateOf.startsWith(`plugin:`)?`server provided by plugin "${e.duplicateOf.split(`:`)[1]??`?`}"`:`already-configured "${e.duplicateOf}"`;return`MCP server "${e.serverName}" skipped — same command/URL as ${t}`}case`hook-load-failed`:return`Failed to load hooks from ${e.hookPath}: ${e.reason}`;case`component-load-failed`:return`Failed to load ${e.component} from ${e.path}: ${e.reason}`;case`mcpb-download-failed`:return`Failed to download MCPB from ${e.url}: ${e.reason}`;case`mcpb-extract-failed`:return`Failed to extract MCPB ${e.mcpbPath}: ${e.reason}`;case`mcpb-invalid-manifest`:return`MCPB manifest invalid at ${e.mcpbPath}: ${e.validationError}`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`Marketplace "${e.marketplace}" is blocked by enterprise policy`:`Marketplace "${e.marketplace}" is not in the allowed marketplace list`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Dependency "${e.dependency}" is disabled`:`Dependency "${e.dependency}" is not installed`;case`lsp-config-invalid`:return`Invalid LSP server config for "${e.serverName}": ${e.validationError}`;case`lsp-server-start-failed`:return`LSP server "${e.serverName}" failed to start: ${e.reason}`;case`lsp-server-crashed`:return e.signal?`LSP server "${e.serverName}" crashed with signal ${e.signal}`:`LSP server "${e.serverName}" crashed with exit code ${e.exitCode??`unknown`}`;case`lsp-request-timeout`:return`LSP server "${e.serverName}" timed out on ${e.method} after ${e.timeoutMs}ms`;case`lsp-request-failed`:return`LSP server "${e.serverName}" ${e.method} failed: ${e.error}`;case`plugin-cache-miss`:return`Plugin "${e.plugin}" not cached at ${e.installPath}`;case`generic-error`:return e.error}return je(e)}function Ar(e){switch(e.type){case`path-not-found`:return`Check that the path in your manifest or marketplace config is correct`;case`git-auth-failed`:return e.authType===`ssh`?`Configure SSH keys or use HTTPS URL instead`:`Configure credentials or use SSH URL instead`;case`git-timeout`:case`network-error`:return`Check your internet connection and try again`;case`manifest-parse-error`:return`Check manifest file syntax in the plugin directory`;case`manifest-validation-error`:return`Check manifest file follows the required schema`;case`plugin-not-found`:return`Plugin may not exist in marketplace "${e.marketplace}"`;case`marketplace-not-found`:return e.availableMarketplaces.length>0?`Available marketplaces: ${e.availableMarketplaces.join(`, `)}`:`Add the marketplace first using /plugin marketplace add`;case`mcp-config-invalid`:return`Check MCP server configuration in .mcp.json or manifest`;case`mcp-server-suppressed-duplicate`:return e.duplicateOf.startsWith(`plugin:`)?`Disable plugin "${e.duplicateOf.split(`:`)[1]??`the other plugin`}" if you want this plugin's version instead`:`Remove "${e.duplicateOf}" from your MCP config if you want the plugin's version instead`;case`hook-load-failed`:return`Check hooks.json file syntax and structure`;case`component-load-failed`:return`Check ${e.component} directory structure and file permissions`;case`mcpb-download-failed`:return`Check your internet connection and URL accessibility`;case`mcpb-extract-failed`:return`Verify the MCPB file is valid and not corrupted`;case`mcpb-invalid-manifest`:return`Contact the plugin author about the invalid manifest`;case`marketplace-blocked-by-policy`:return e.blockedByBlocklist?`This marketplace source is explicitly blocked by your administrator`:e.allowedSources.length>0?`Allowed sources: ${e.allowedSources.join(`, `)}`:`Contact your administrator to configure allowed marketplace sources`;case`dependency-unsatisfied`:return e.reason===`not-enabled`?`Enable "${e.dependency}" or uninstall "${e.plugin}"`:`Install "${e.dependency}" or uninstall "${e.plugin}"`;case`lsp-config-invalid`:return`Check LSP server configuration in the plugin manifest`;case`lsp-server-start-failed`:case`lsp-server-crashed`:case`lsp-request-timeout`:case`lsp-request-failed`:return`Check LSP server logs with --debug for details`;case`plugin-cache-miss`:return`Run /plugins to refresh the plugin cache`;case`marketplace-load-failed`:case`generic-error`:return null}return null}var jr=e((()=>{Je()}));function Mr({item:e,isSelected:t}){let[n]=l();if(e.type===`plugin`){let r,i;return e.pendingToggle?(r=v(`suggestion`,n)(a.arrowRight),i=e.pendingToggle===`will-enable`?`will enable`:`will disable`):e.errorCount>0?(r=v(`error`,n)(a.cross),i=`${e.errorCount} ${zt(e.errorCount,`error`)}`):e.isEnabled?(r=v(`success`,n)(a.tick),i=`enabled`):(r=v(`inactive`,n)(a.radioOff),i=`disabled`),(0,Y.jsxs)(u,{children:[(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(f,{dimColor:!t,children:[` `,(0,Y.jsx)(f,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(f,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(f,{dimColor:!t,children:i})]})}if(e.type===`flagged-plugin`){let r=v(`warning`,n)(a.warning);return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(f,{dimColor:!t,children:[` `,(0,Y.jsx)(f,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(f,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(f,{dimColor:!t,children:`removed`})]})}if(e.type===`failed-plugin`){let r=v(`error`,n)(a.cross),i=`failed to load · ${e.errorCount} ${zt(e.errorCount,`error`)}`;return(0,Y.jsxs)(u,{children:[(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(f,{dimColor:!t,children:[` `,(0,Y.jsx)(f,{backgroundColor:`userMessageBackground`,children:`Plugin`})]}),(0,Y.jsxs)(f,{dimColor:!0,children:[` · `,e.marketplace]}),(0,Y.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(f,{dimColor:!t,children:i})]})}let r,i;return e.status===`connected`?(r=v(`success`,n)(a.tick),i=`connected`):e.status===`disabled`?(r=v(`inactive`,n)(a.radioOff),i=`disabled`):e.status===`pending`?(r=v(`inactive`,n)(a.radioOff),i=`connecting…`):e.status===`needs-auth`?(r=v(`warning`,n)(a.triangleUpOutline),i=`Enter to auth`):(r=v(`error`,n)(a.cross),i=`failed`),e.indented?(0,Y.jsxs)(u,{children:[(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(f,{dimColor:!t,children:`└ `}),(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(f,{dimColor:!t,children:[` `,(0,Y.jsx)(f,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(f,{dimColor:!t,children:i})]}):(0,Y.jsxs)(u,{children:[(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:t?`${a.pointer} `:` `}),(0,Y.jsx)(f,{color:t?`suggestion`:void 0,children:e.name}),(0,Y.jsxs)(f,{dimColor:!t,children:[` `,(0,Y.jsx)(f,{backgroundColor:`userMessageBackground`,children:`MCP`})]}),(0,Y.jsxs)(f,{dimColor:!t,children:[` · `,r,` `]}),(0,Y.jsx)(f,{dimColor:!t,children:i})]})}var Y,Nr=e((()=>{i(),g(),C(),Vt(),Y=T()}));async function Pr(e){try{return(await En.readdir(e,{withFileTypes:!0})).filter(e=>e.isFile()&&e.name.endsWith(`.md`)).map(e=>Tn.basename(e.name,`.md`))}catch(t){return ht(`Failed to read plugin components from ${e}: ${dt(t)}`,{level:`error`}),Mt(pt(t)),[]}}async function Fr(e){try{let t=await En.readdir(e,{withFileTypes:!0}),n=[];for(let r of t)if(r.isDirectory()||r.isSymbolicLink()){let t=Tn.join(e,r.name,`SKILL.md`);try{(await En.stat(t)).isFile()&&n.push(r.name)}catch{}}return n}catch(t){return ht(`Failed to read skill directories from ${e}: ${dt(t)}`,{level:`error`}),Mt(pt(t)),[]}}function Ir({plugin:e,marketplace:t}){let[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(!0),[o,s]=(0,X.useState)(null);return(0,X.useEffect)(()=>{async function n(){try{if(t===`builtin`){let t=Ge(e.name);if(t){let e=t.skills?.map(e=>e.name)??[],n=t.hooks?Object.keys(t.hooks):[],i=t.mcpServers?Object.keys(t.mcpServers):[];r({commands:null,agents:null,skills:e.length>0?e:null,hooks:n.length>0?n:null,mcpServers:i.length>0?i:null})}else s(`Built-in plugin ${e.name} not found`);a(!1);return}let n=(await He(t)).plugins.find(t=>t.name===e.name);if(n){let t=[];e.commandsPath&&t.push(e.commandsPath),e.commandsPaths&&t.push(...e.commandsPaths);let i=[];for(let e of t)if(typeof e==`string`){let t=await Pr(e);i.push(...t)}let a=[];e.agentsPath&&a.push(e.agentsPath),e.agentsPaths&&a.push(...e.agentsPaths);let o=[];for(let e of a)if(typeof e==`string`){let t=await Pr(e);o.push(...t)}let s=[];e.skillsPath&&s.push(e.skillsPath),e.skillsPaths&&s.push(...e.skillsPaths);let c=[];for(let e of s)if(typeof e==`string`){let t=await Fr(e);c.push(...t)}let l=[];e.hooksConfig&&l.push(Object.keys(e.hooksConfig)),n.hooks&&l.push(n.hooks);let u=[];e.mcpServers&&u.push(Object.keys(e.mcpServers)),n.mcpServers&&u.push(n.mcpServers),r({commands:i.length>0?i:null,agents:o.length>0?o:null,skills:c.length>0?c:null,hooks:l.length>0?l:null,mcpServers:u.length>0?u:null})}else s(`Plugin ${e.name} not found in marketplace`)}catch(e){s(e instanceof Error?e.message:`Failed to load components`)}finally{a(!1)}}n()},[e.name,e.commandsPath,e.commandsPaths,e.agentsPath,e.agentsPaths,e.skillsPath,e.skillsPaths,e.hooksConfig,e.mcpServers,t]),i?null:o?(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(f,{bold:!0,children:`Components:`}),(0,Z.jsxs)(f,{dimColor:!0,children:[`Error: `,o]})]}):!n||!(n.commands||n.agents||n.skills||n.hooks||n.mcpServers)?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsx)(f,{bold:!0,children:`Installed components:`}),n.commands?(0,Z.jsxs)(f,{dimColor:!0,children:[`• Commands:`,` `,typeof n.commands==`string`?n.commands:Array.isArray(n.commands)?n.commands.join(`, `):Object.keys(n.commands).join(`, `)]}):null,n.agents?(0,Z.jsxs)(f,{dimColor:!0,children:[`• Agents:`,` `,typeof n.agents==`string`?n.agents:Array.isArray(n.agents)?n.agents.join(`, `):Object.keys(n.agents).join(`, `)]}):null,n.skills?(0,Z.jsxs)(f,{dimColor:!0,children:[`• Skills:`,` `,typeof n.skills==`string`?n.skills:Array.isArray(n.skills)?n.skills.join(`, `):Object.keys(n.skills).join(`, `)]}):null,n.hooks?(0,Z.jsxs)(f,{dimColor:!0,children:[`• Hooks:`,` `,typeof n.hooks==`string`?n.hooks:Array.isArray(n.hooks)?n.hooks.map(String).join(`, `):typeof n.hooks==`object`&&n.hooks!==null?Object.keys(n.hooks).join(`, `):String(n.hooks)]}):null,n.mcpServers?(0,Z.jsxs)(f,{dimColor:!0,children:[`• MCP Servers:`,` `,typeof n.mcpServers==`string`?n.mcpServers:Array.isArray(n.mcpServers)?n.mcpServers.map(String).join(`, `):typeof n.mcpServers==`object`&&n.mcpServers!==null?Object.keys(n.mcpServers).join(`, `):String(n.mcpServers)]}):null]})}async function Lr(e,t){let n=(await He(t))?.plugins.find(t=>t.name===e);return n&&typeof n.source==`string`?`Local plugins cannot be updated remotely. To update, modify the source at: ${n.source}`:null}function Rr(e){return e.filter(e=>{let t=e.source.split(`@`)[1]||`local`;return!D(`${e.name}@${t}`)})}function zr({setViewState:e,setResult:t,onManageComplete:n,onSearchModeChange:r,targetPlugin:i,targetMarketplace:o,action:s}){let l=re(e=>e.mcp.clients),d=re(e=>e.mcp.tools),h=re(e=>e.plugins.errors),g=Gt(),[v,b]=(0,X.useState)(!1),S=(0,X.useCallback)(e=>{b(e),r?.(e)},[r]),C=m(),{columns:te}=x(),[w,T]=(0,X.useState)(`plugin-list`),{query:D,setQuery:O,cursorOffset:ne}=xn({isActive:w===`plugin-list`&&v,onExit:()=>{S(!1)}}),[k,A]=(0,X.useState)(null),[ie,ae]=(0,X.useState)([]),[j,M]=(0,X.useState)([]),[oe,se]=(0,X.useState)(!0),[P,ce]=(0,X.useState)(new Map),le=(0,X.useRef)(!1),ue=(0,X.useRef)(void 0),de=hn();ee(`confirm:no`,Br.useCallback(()=>{if(w===`plugin-details`)T(`plugin-list`),A(null),R(null);else if(typeof w==`object`&&w.type===`failed-plugin-details`)T(`plugin-list`),R(null);else if(w===`configuring`)T(`plugin-details`),we(null);else if(typeof w==`object`&&(w.type===`plugin-options`||w.type===`configuring-options`))T(`plugin-list`),A(null),t(`Plugin enabled. Configuration skipped — run /reload-plugins to apply.`),n&&n();else if(typeof w==`object`&&w.type===`flagged-detail`)T(`plugin-list`),R(null);else if(typeof w==`object`&&w.type===`mcp-detail`)T(`plugin-list`),R(null);else if(typeof w==`object`&&w.type===`mcp-tools`)T({type:`mcp-detail`,client:w.client});else if(typeof w==`object`&&w.type===`mcp-tool-detail`)T({type:`mcp-tools`,client:w.client});else{if(P.size>0){t(`Run /reload-plugins to apply plugin changes.`);return}e({type:`menu`})}},[w,e,P,t]),{context:`Confirmation`,isActive:(w!==`plugin-list`||!v)&&w!==`confirm-project-uninstall`&&!(typeof w==`object`&&w.type===`confirm-data-cleanup`)});let F=e=>e.type===`connected`?`connected`:e.type===`disabled`?`disabled`:e.type===`pending`?`pending`:e.type===`needs-auth`?`needs-auth`:`failed`,I=(0,X.useMemo)(()=>{let e=yt(),t=new Map;for(let e of l)if(e.name.startsWith(`plugin:`)){let n=e.name.split(`:`);if(n.length>=3){let r=n[1],i=n.slice(2).join(`:`),a=t.get(r)||[];a.push({displayName:i,client:e}),t.set(r,a)}}let n=[];for(let r of j){let i=`${r.plugin.name}@${r.marketplace}`,a=e?.enabledPlugins?.[i]!==!1,o=h.filter(e=>`plugin`in e&&e.plugin===r.plugin.name||e.source===i||e.source.startsWith(`${r.plugin.name}@`)),s=r.plugin.isBuiltin?`builtin`:r.scope||`user`;n.push({item:{type:`plugin`,id:i,name:r.plugin.name,description:r.plugin.manifest.description,marketplace:r.marketplace,scope:s,isEnabled:a,errorCount:o.length,errors:o,plugin:r.plugin,pendingEnable:r.pendingEnable,pendingUpdate:r.pendingUpdate,pendingToggle:P.get(i)},originalScope:s,childMcps:t.get(r.plugin.name)||[]})}let r=new Set(n.map(({item:e})=>e.id)),i=new Set(n.map(({item:e})=>e.name)),a=new Map;for(let e of h){if(r.has(e.source)||`plugin`in e&&typeof e.plugin==`string`&&i.has(e.plugin))continue;let t=a.get(e.source)||[];t.push(e),a.set(e.source,t)}let o=Qt(),s=[];for(let[e,t]of a){if(e in g)continue;let n=fe(e),r=n.name||e,i=n.marketplace||`unknown`,a=o.get(e),c=a===`flag`||a===void 0?`user`:a;s.push({type:`failed-plugin`,id:e,name:r,marketplace:i,scope:c,errorCount:t.length,errors:t})}let c=[];for(let e of l)e.name!==`ide`&&(e.name.startsWith(`plugin:`)||c.push({type:`mcp`,id:`mcp:${e.name}`,name:e.name,description:void 0,scope:e.config.scope,status:F(e),client:e}));let u={flagged:-1,project:0,local:1,user:2,enterprise:3,managed:4,dynamic:5,builtin:6},d=[],f=new Map;for(let{item:e,originalScope:t,childMcps:r}of n){let n=e.scope;f.has(n)||f.set(n,[]),f.get(n).push(e);for(let{displayName:e,client:n}of r){let r=t===`builtin`?`user`:t;f.has(r)||f.set(r,[]),f.get(r).push({type:`mcp`,id:`mcp:${n.name}`,name:e,description:void 0,scope:r,status:F(n),client:n,indented:!0})}}for(let e of c){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let e of s){let t=e.scope;f.has(t)||f.set(t,[]),f.get(t).push(e)}for(let[e,t]of Object.entries(g)){let n=fe(e),r=n.name||e,i=n.marketplace||`unknown`;f.has(`flagged`)||f.set(`flagged`,[]),f.get(`flagged`).push({type:`flagged-plugin`,id:e,name:r,marketplace:i,scope:`flagged`,reason:`delisted`,text:`Removed from marketplace`,flaggedAt:t.flaggedAt})}let p=[...f.keys()].sort((e,t)=>(u[e]??99)-(u[t]??99));for(let e of p){let t=f.get(e),n=[],r=[],i=0;for(;i<t.length;){let e=t[i];if(e.type===`plugin`||e.type===`failed-plugin`||e.type===`flagged-plugin`){let r=[e];i++;let a=t[i];for(;a?.type===`mcp`&&a.indented;)r.push(a),i++,a=t[i];n.push(r)}else e.type===`mcp`&&!e.indented&&r.push(e),i++}n.sort((e,t)=>e[0].name.localeCompare(t[0].name)),r.sort((e,t)=>e.name.localeCompare(t.name));for(let e of n)d.push(...e);d.push(...r)}return d},[j,l,h,P,g]),pe=(0,X.useMemo)(()=>I.filter(e=>e.type===`flagged-plugin`).map(e=>e.id),[I]);(0,X.useEffect)(()=>{pe.length>0&&Wt(pe)},[pe]);let me=(0,X.useMemo)(()=>{if(!D)return I;let e=D.toLowerCase();return I.filter(t=>t.name.toLowerCase().includes(e)||`description`in t&&t.description?.toLowerCase().includes(e))},[I,D]),[L,he]=(0,X.useState)(0),ge=fr({totalItems:me.length,selectedIndex:L,maxVisible:8}),[ve,ye]=(0,X.useState)(0),[be,xe]=(0,X.useState)(!1),[Se,R]=(0,X.useState)(null),[Ce,we]=(0,X.useState)(null),[Ee,De]=(0,X.useState)(!1),[ke,je]=(0,X.useState)(!1);(0,X.useEffect)(()=>{if(!k){je(!1);return}async function e(){let e=k.plugin.manifest.mcpServers,t=!1;if(e&&(t=typeof e==`string`&&Oe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Oe(e))),!t)try{let e=Tn.join(k.plugin.path,`..`),n=Tn.join(e,`.claude-plugin`,`marketplace.json`),r=ut(await En.readFile(n,`utf-8`)).plugins?.find(e=>e.name===k.plugin.name);if(r?.mcpServers){let e=r.mcpServers;t=typeof e==`string`&&Oe(e)||Array.isArray(e)&&e.some(e=>typeof e==`string`&&Oe(e))}}catch(e){ht(`Failed to read raw marketplace.json: ${e}`)}je(t)}e()},[k]),(0,X.useEffect)(()=>{async function e(){se(!0);try{let{enabled:e,disabled:t}=await Ye(),n=yt(),r=Rr([...e,...t]),i={};for(let e of r){let t=e.source.split(`@`)[1]||`local`;i[t]||(i[t]=[]),i[t].push(e)}let a=[];for(let[e,t]of Object.entries(i)){let r=wt(t,t=>{let r=`${t.name}@${e}`;return n?.enabledPlugins?.[r]!==!1}),i=t.length-r;a.push({name:e,installedPlugins:t,enabledCount:r,disabledCount:i})}a.sort((e,t)=>e.name===`claude-plugin-directory`?-1:t.name===`claude-plugin-directory`?1:e.name.localeCompare(t.name)),ae(a);let o=[];for(let e of a)for(let t of e.installedPlugins){let n=`${t.name}@${e.name}`,r=t.isBuiltin?`builtin`:an(n).scope;o.push({plugin:t,marketplace:e.name,scope:r,pendingEnable:void 0,pendingUpdate:!1})}M(o),he(0)}finally{se(!1)}}e()},[]),(0,X.useEffect)(()=>{if(!le.current&&i&&ie.length>0&&!oe){let{name:e,marketplace:n}=fe(i),r=o??n,a=r?ie.filter(e=>e.name===r):ie;for(let t of a){let n=t.installedPlugins.find(t=>t.name===e);if(n){let{scope:e}=an(`${n.name}@${t.name}`),r={plugin:n,marketplace:t.name,scope:e,pendingEnable:void 0,pendingUpdate:!1};A(r),T(`plugin-details`),ue.current=s,le.current=!0;return}}let c=I.find(t=>t.type===`failed-plugin`&&t.name===e);c&&c.type===`failed-plugin`&&(T({type:`failed-plugin-details`,plugin:{id:c.id,name:c.name,marketplace:c.marketplace,errors:c.errors,scope:c.scope}}),le.current=!0),!le.current&&s&&(le.current=!0,t(`Plugin "${i}" is not installed in this project`))}},[i,o,ie,oe,I,s,t]);let Me=async r=>{if(!k)return;let i=k.scope||`user`,a=i===`builtin`;if(a&&(r===`update`||r===`uninstall`)){R(`Built-in plugins cannot be updated or uninstalled.`);return}if(!a&&!rn(i)&&r!==`update`){R(`This plugin is managed by your organization. Contact your admin to disable it.`);return}xe(!0),R(null);try{let o=`${k.plugin.name}@${k.marketplace}`,s;switch(r){case`enable`:{let e=await $t(o);if(!e.success)throw Error(e.message);break}case`disable`:{let e=await nn(o);if(!e.success)throw Error(e.message);s=e.reverseDependents;break}case`uninstall`:{if(a||!rn(i))break;if(sn(o)){xe(!1),T(`confirm-project-uninstall`);return}let e=_e().plugins[o],t=!e||e.length<=1?await Ae(o):null;if(t){xe(!1),T({type:`confirm-data-cleanup`,size:t});return}let n=await en(o,i);if(!n.success)throw Error(n.message);s=n.reverseDependents;break}case`update`:{if(a)break;let r=await tn(o,i);if(!r.success)throw Error(r.message);if(r.alreadyUpToDate){t(`${k.plugin.name} is already at the latest version (${r.newVersion}).`),n&&await n(),e({type:`menu`});return}break}}Ke();let c=`${k.plugin.name}@${k.marketplace}`;if(yt()?.enabledPlugins?.[c]!==!1){xe(!1),T({type:`plugin-options`});return}let l=r===`enable`?`Enabled`:r===`disable`?`Disabled`:r===`update`?`Updated`:`Uninstalled`,u=s&&s.length>0?` · required by ${s.join(`, `)}`:``;t(`✓ ${l} ${k.plugin.name}${u}. Run /reload-plugins to apply.`),n&&await n(),e({type:`menu`})}catch(e){xe(!1);let t=e instanceof Error?e.message:String(e);R(`Failed to ${r}: ${t}`),Mt(pt(e))}},Ne=(0,X.useRef)(Me);Ne.current=Me,(0,X.useEffect)(()=>{if(w===`plugin-details`&&k&&ue.current){let e=ue.current;ue.current=void 0,Ne.current(e)}},[w,k]);let Pe=Br.useCallback(()=>{if(L>=me.length)return;let e=me[L];if(e?.type!==`flagged-plugin`)if(e?.type===`plugin`){let t=`${e.plugin.name}@${e.marketplace}`,n=yt(),r=P.get(t),i=n?.enabledPlugins?.[t]!==!1,a=e.scope;if(a===`builtin`||rn(a)){let e=new Map(P);r?(e.delete(t),(async()=>{try{r===`will-disable`?await $t(t):await nn(t),Ke()}catch(e){Mt(e)}})()):(e.set(t,i?`will-disable`:`will-enable`),(async()=>{try{i?await nn(t):await $t(t),Ke()}catch(e){Mt(e)}})()),ce(e)}}else e?.type===`mcp`&&de(e.client.name)},[L,me,P,j,de]);c({"select:previous":()=>{L===0?S(!0):ge.handleSelectionChange(L-1,he)},"select:next":()=>{L<me.length-1&&ge.handleSelectionChange(L+1,he)},"select:accept":Br.useCallback(()=>{if(L>=me.length)return;let e=me[L];if(e?.type===`plugin`){let t=j.find(t=>t.plugin.name===e.plugin.name&&t.marketplace===e.marketplace);t&&(A(t),T(`plugin-details`),ye(0),R(null))}else e?.type===`flagged-plugin`?(T({type:`flagged-detail`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,reason:e.reason,text:e.text,flaggedAt:e.flaggedAt}}),R(null)):e?.type===`failed-plugin`?(T({type:`failed-plugin-details`,plugin:{id:e.id,name:e.name,marketplace:e.marketplace,errors:e.errors,scope:e.scope}}),ye(0),R(null)):e?.type===`mcp`&&(T({type:`mcp-detail`,client:e.client}),R(null))},[L,me,j])},{context:`Select`,isActive:w===`plugin-list`&&!v}),c({"plugin:toggle":Pe},{context:`Plugin`,isActive:w===`plugin-list`&&!v}),c({"select:accept":Br.useCallback(()=>{typeof w!=`object`||w.type!==`flagged-detail`||(Kt(w.plugin.id),T(`plugin-list`))},[w])},{context:`Select`,isActive:typeof w==`object`&&w.type===`flagged-detail`});let Fe=Br.useMemo(()=>{if(w!==`plugin-details`||!k)return[];let e=yt(),t=`${k.plugin.name}@${k.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=k.marketplace===`builtin`,i=[];return i.push({label:n?`Disable plugin`:`Enable plugin`,action:()=>void Me(n?`disable`:`enable`)}),r||(i.push({label:k.pendingUpdate?`Unmark for update`:`Mark for update`,action:async()=>{try{let e=await Lr(k.plugin.name,k.marketplace);if(e){R(e);return}let t=[...j],n=t.findIndex(e=>e.plugin.name===k.plugin.name&&e.marketplace===k.marketplace);n!==-1&&(t[n].pendingUpdate=!k.pendingUpdate,M(t),A({...k,pendingUpdate:!k.pendingUpdate}))}catch(e){R(e instanceof Error?e.message:`Failed to check plugin update availability`)}}}),ke&&i.push({label:`Configure`,action:async()=>{De(!0);try{let e=k.plugin.manifest.mcpServers,t=null;if(typeof e==`string`&&Oe(e))t=e;else if(Array.isArray(e)){for(let n of e)if(typeof n==`string`&&Oe(n)){t=n;break}}if(!t){R(`No MCPB file found in plugin`),De(!1);return}let n=`${k.plugin.name}@${k.marketplace}`,r=await E(t,k.plugin.path,n,void 0,void 0,!0);`status`in r&&r.status===`needs-config`?(we(r),T(`configuring`)):R(`Failed to load MCPB for configuration`)}catch(e){let t=dt(e);R(`Failed to load configuration: ${t}`)}finally{De(!1)}}}),k.plugin.manifest.userConfig&&Object.keys(k.plugin.manifest.userConfig).length>0&&i.push({label:`Configure options`,action:()=>{T({type:`configuring-options`,schema:k.plugin.manifest.userConfig})}}),i.push({label:`Update now`,action:()=>void Me(`update`)}),i.push({label:`Uninstall`,action:()=>void Me(`uninstall`)})),k.plugin.manifest.homepage&&i.push({label:`Open homepage`,action:()=>void Yt(k.plugin.manifest.homepage)}),k.plugin.manifest.repository&&i.push({label:`View repository`,action:()=>void Yt(k.plugin.manifest.repository)}),i.push({label:`Back to plugin list`,action:()=>{T(`plugin-list`),A(null),R(null)}}),i},[w,k,ke,j]);if(c({"select:previous":()=>{ve>0&&ye(ve-1)},"select:next":()=>{ve<Fe.length-1&&ye(ve+1)},"select:accept":()=>{Fe[ve]&&Fe[ve].action()}},{context:`Select`,isActive:w===`plugin-details`&&!!k}),c({"select:accept":()=>{typeof w==`object`&&w.type===`failed-plugin-details`&&(async()=>{xe(!0),R(null);let e=w.plugin.id,t=w.plugin.scope,r=rn(t)?await en(e,t,!1):await en(e,`user`,!1),i=r.success;if(!i){for(let t of[`userSettings`,`projectSettings`,`localSettings`]){let n=vt(t);n?.enabledPlugins?.[e]!==void 0&&(Et(t,{enabledPlugins:{...n.enabledPlugins,[e]:void 0}}),i=!0)}Ke()}i?(n&&await n(),xe(!1),T(`plugin-list`)):(xe(!1),R(r.message))})()}},{context:`Select`,isActive:typeof w==`object`&&w.type===`failed-plugin-details`&&w.plugin.scope!==`managed`}),c({"confirm:yes":()=>{if(!k)return;xe(!0),R(null);let r=`${k.plugin.name}@${k.marketplace}`,{error:i}=Et(`localSettings`,{enabledPlugins:{...vt(`localSettings`)?.enabledPlugins,[r]:!1}});if(i){xe(!1),R(`Failed to write settings: ${i.message}`);return}Ke(),t(`✓ Disabled ${k.plugin.name} in .claude/settings.local.json. Run /reload-plugins to apply.`),n&&n(),e({type:`menu`})},"confirm:no":()=>{T(`plugin-details`),R(null)}},{context:`Confirmation`,isActive:w===`confirm-project-uninstall`&&!!k&&!be}),_((r,i)=>{if(!k)return;let o=`${k.plugin.name}@${k.marketplace}`,s=k.scope;if(!s||s===`builtin`||!rn(s))return;let c=async r=>{xe(!0),R(null);try{let i=await en(o,s,r);if(!i.success)throw Error(i.message);Ke();let c=r?``:` · data preserved`;t(`${a.tick} ${i.message}${c}`),n&&n(),e({type:`menu`})}catch(e){xe(!1),R(e instanceof Error?e.message:String(e))}};r===`y`||r===`Y`?c(!0):r===`n`||r===`N`?c(!1):i.escape&&(T(`plugin-details`),R(null))},{isActive:typeof w==`object`&&w.type===`confirm-data-cleanup`&&!!k&&!be}),Br.useEffect(()=>{he(0)},[D]),_((e,t)=>{let n=!t.ctrl&&!t.meta;v||(e===`/`&&n?(S(!0),O(``),he(0)):n&&e.length>0&&!/^\s+$/.test(e)&&e!==`j`&&e!==`k`&&e!==` `&&(S(!0),O(e),he(0)))},{isActive:w===`plugin-list`}),oe)return(0,Z.jsx)(f,{children:`Loading installed plugins…`});if(I.length===0)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(f,{bold:!0,children:`Manage plugins`})}),(0,Z.jsx)(f,{children:`No plugins or MCP servers installed.`}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{dimColor:!0,children:`Esc to go back`})})]});if(typeof w==`object`&&w.type===`plugin-options`&&k){let r=`${k.plugin.name}@${k.marketplace}`;function i(r){t(r),n&&n(),e({type:`menu`})}return(0,Z.jsx)(er,{plugin:k.plugin,pluginId:r,onDone:(e,t)=>{switch(e){case`configured`:i(`✓ Enabled and configured ${k.plugin.name}. Run /reload-plugins to apply.`);break;case`skipped`:i(`✓ Enabled ${k.plugin.name}. Run /reload-plugins to apply.`);break;case`error`:i(`Failed to save configuration: ${t}`);break}}})}if(typeof w==`object`&&w.type===`configuring-options`&&k){let e=`${k.plugin.name}@${k.marketplace}`;return(0,Z.jsx)(Yn,{title:`Configure ${k.plugin.name}`,subtitle:`Plugin options`,configSchema:w.schema,initialValues:N(e),onSave:n=>{try{Te(e,n,w.schema),Ke(),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){R(`Failed to save configuration: ${dt(e)}`)}T(`plugin-details`)},onCancel:()=>T(`plugin-details`)})}if(w===`configuring`&&Ce&&k){let e=`${k.plugin.name}@${k.marketplace}`;async function n(n){if(!(!Ce||!k))try{let r=k.plugin.manifest.mcpServers,i=null;if(typeof r==`string`&&Oe(r))i=r;else if(Array.isArray(r)){for(let e of r)if(typeof e==`string`&&Oe(e)){i=e;break}}if(!i){R(`No MCPB file found`),T(`plugin-details`);return}await E(i,k.plugin.path,e,void 0,n),R(null),we(null),T(`plugin-details`),t(`Configuration saved. Run /reload-plugins for changes to take effect.`)}catch(e){let t=dt(e);R(`Failed to save configuration: ${t}`),T(`plugin-details`)}}function r(){we(null),T(`plugin-details`)}return(0,Z.jsx)(Yn,{title:`Configure ${Ce.manifest.name}`,subtitle:`Plugin: ${k.plugin.name}`,configSchema:Ce.configSchema,initialValues:Ce.existingConfig,onSave:n,onCancel:r})}if(typeof w==`object`&&w.type===`flagged-detail`){let e=w.plugin;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(f,{bold:!0,children:[e.name,` @ `,e.marketplace]})}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(f,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(f,{color:`error`,children:`Removed`})]}),(0,Z.jsxs)(u,{marginBottom:1,flexDirection:`column`,children:[(0,Z.jsxs)(f,{color:`error`,children:[`Removed from marketplace · reason: `,e.reason]}),(0,Z.jsx)(f,{children:e.text}),(0,Z.jsxs)(f,{dimColor:!0,children:[`Flagged on `,new Date(e.flaggedAt).toLocaleDateString()]})]}),(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:(0,Z.jsxs)(u,{children:[(0,Z.jsxs)(f,{children:[a.pointer,` `]}),(0,Z.jsx)(f,{color:`suggestion`,children:`Dismiss`})]})}),(0,Z.jsxs)(p,{children:[(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`dismiss`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})]})}if(w===`confirm-project-uninstall`&&k)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(f,{bold:!0,color:`warning`,children:[k.plugin.name,` is enabled in .claude/settings.json (shared with your team)`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(f,{children:`Disable it just for you in .claude/settings.local.json?`}),(0,Z.jsx)(f,{dimColor:!0,children:`This has the same effect as uninstalling, without affecting other contributors.`})]}),Se&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{color:`error`,children:Se})}),(0,Z.jsx)(u,{marginTop:1,children:be?(0,Z.jsx)(f,{dimColor:!0,children:`Disabling…`}):(0,Z.jsxs)(p,{children:[(0,Z.jsx)(z,{action:`confirm:yes`,context:`Confirmation`,fallback:`y`,description:`disable`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]});if(typeof w==`object`&&w.type===`confirm-data-cleanup`&&k)return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(f,{bold:!0,children:[k.plugin.name,` has `,w.size.human,` of persistent data`]}),(0,Z.jsxs)(u,{marginTop:1,flexDirection:`column`,children:[(0,Z.jsx)(f,{children:`Delete it along with the plugin?`}),(0,Z.jsx)(f,{dimColor:!0,children:We(`${k.plugin.name}@${k.marketplace}`)})]}),Se&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{color:`error`,children:Se})}),(0,Z.jsx)(u,{marginTop:1,children:be?(0,Z.jsx)(f,{dimColor:!0,children:`Uninstalling…`}):(0,Z.jsxs)(f,{children:[(0,Z.jsx)(f,{bold:!0,children:`y`}),` to delete · `,(0,Z.jsx)(f,{bold:!0,children:`n`}),` to keep · `,(0,Z.jsx)(f,{bold:!0,children:`esc`}),` to cancel`]})})]});if(w===`plugin-details`&&k){let e=yt(),t=`${k.plugin.name}@${k.marketplace}`,n=e?.enabledPlugins?.[t]!==!1,r=h.filter(e=>`plugin`in e&&e.plugin===k.plugin.name||e.source===t||e.source.startsWith(`${k.plugin.name}@`)),i=r.length===0?null:(0,Z.jsxs)(u,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(f,{bold:!0,color:`error`,children:[r.length,` `,zt(r.length,`error`),`:`]}),r.map((e,t)=>{let n=Ar(e);return(0,Z.jsxs)(u,{flexDirection:`column`,marginLeft:2,children:[(0,Z.jsx)(f,{color:`error`,children:kr(e)}),n&&(0,Z.jsxs)(f,{dimColor:!0,italic:!0,children:[a.arrowRight,` `,n]})]},t)})]});return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{children:(0,Z.jsxs)(f,{bold:!0,children:[k.plugin.name,` @ `,k.marketplace]})}),(0,Z.jsxs)(u,{children:[(0,Z.jsx)(f,{dimColor:!0,children:`Scope: `}),(0,Z.jsx)(f,{children:k.scope||`user`})]}),k.plugin.manifest.version&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(f,{dimColor:!0,children:`Version: `}),(0,Z.jsx)(f,{children:k.plugin.manifest.version})]}),k.plugin.manifest.description&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(f,{children:k.plugin.manifest.description})}),k.plugin.manifest.author&&(0,Z.jsxs)(u,{children:[(0,Z.jsx)(f,{dimColor:!0,children:`Author: `}),(0,Z.jsx)(f,{children:k.plugin.manifest.author.name})]}),(0,Z.jsxs)(u,{marginBottom:1,children:[(0,Z.jsx)(f,{dimColor:!0,children:`Status: `}),(0,Z.jsx)(f,{color:n?`success`:`warning`,children:n?`Enabled`:`Disabled`}),k.pendingUpdate&&(0,Z.jsx)(f,{color:`suggestion`,children:` · Marked for update`})]}),(0,Z.jsx)(Ir,{plugin:k.plugin,marketplace:k.marketplace}),i,(0,Z.jsx)(u,{marginTop:1,flexDirection:`column`,children:Fe.map((e,t)=>{let n=t===ve;return(0,Z.jsxs)(u,{children:[n&&(0,Z.jsxs)(f,{children:[a.pointer,` `]}),!n&&(0,Z.jsx)(f,{children:` `}),(0,Z.jsx)(f,{bold:n,color:e.label.includes(`Uninstall`)?`error`:e.label.includes(`Update`)?`suggestion`:void 0,children:e.label})]},t)})}),be&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{children:`Processing…`})}),Se&&(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{color:`error`,children:Se})}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(p,{children:[(0,Z.jsx)(z,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`select`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`failed-plugin-details`){let e=w.plugin,t=e.errors[0],n=t?kr(t):`Failed to load`;return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsxs)(f,{children:[(0,Z.jsx)(f,{bold:!0,children:e.name}),(0,Z.jsxs)(f,{dimColor:!0,children:[` @ `,e.marketplace]}),(0,Z.jsxs)(f,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,Z.jsx)(f,{color:`error`,children:n}),e.scope===`managed`?(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{dimColor:!0,children:`Managed by your organization — contact your admin`})}):(0,Z.jsxs)(u,{marginTop:1,children:[(0,Z.jsxs)(f,{color:`suggestion`,children:[a.pointer,` `]}),(0,Z.jsx)(f,{bold:!0,children:`Remove`})]}),be&&(0,Z.jsx)(f,{children:`Processing…`}),Se&&(0,Z.jsx)(f,{color:`error`,children:Se}),(0,Z.jsx)(u,{marginTop:1,children:(0,Z.jsx)(f,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(p,{children:[e.scope!==`managed`&&(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`remove`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}if(typeof w==`object`&&w.type===`mcp-detail`){let e=w.client,n=ze(d,e.name).length,r=()=>{T({type:`mcp-tools`,client:e})},i=()=>{T(`plugin-list`)},a=e=>{e&&t(e),T(`plugin-list`)},o=e.config.scope,s=e.config.type;return s===`stdio`?(0,Z.jsx)(Fn,{server:{name:e.name,client:e,scope:o,transport:`stdio`,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`sse`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`sse`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`http`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`http`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):s===`claudeai-proxy`?(0,Z.jsx)(Nn,{server:{name:e.name,client:e,scope:o,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},serverToolsCount:n,onViewTools:r,onCancel:i,onComplete:a,borderless:!0}):(T(`plugin-list`),null)}if(typeof w==`object`&&w.type===`mcp-tools`){let e=w.client,t=e.config.scope,n=e.config.type,r;return r=n===`stdio`?{name:e.name,client:e,scope:t,transport:`stdio`,config:e.config}:n===`sse`?{name:e.name,client:e,scope:t,transport:`sse`,isAuthenticated:void 0,config:e.config}:n===`http`?{name:e.name,client:e,scope:t,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:t,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Vn,{server:r,onSelectTool:t=>{T({type:`mcp-tool-detail`,client:e,tool:t})},onBack:()=>T({type:`mcp-detail`,client:e})})}if(typeof w==`object`&&w.type===`mcp-tool-detail`){let{client:e,tool:t}=w,n=e.config.scope,r=e.config.type,i;return i=r===`stdio`?{name:e.name,client:e,scope:n,transport:`stdio`,config:e.config}:r===`sse`?{name:e.name,client:e,scope:n,transport:`sse`,isAuthenticated:void 0,config:e.config}:r===`http`?{name:e.name,client:e,scope:n,transport:`http`,isAuthenticated:void 0,config:e.config}:{name:e.name,client:e,scope:n,transport:`claudeai-proxy`,isAuthenticated:void 0,config:e.config},(0,Z.jsx)(Rn,{tool:t,server:i,onBack:()=>T({type:`mcp-tools`,client:e})})}let Ie=ge.getVisibleItems(me);return(0,Z.jsxs)(u,{flexDirection:`column`,children:[(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsx)(y,{query:D,isFocused:v,isTerminalFocused:C,width:te-4,cursorOffset:ne})}),me.length===0&&D&&(0,Z.jsx)(u,{marginBottom:1,children:(0,Z.jsxs)(f,{dimColor:!0,children:[`No items match "`,D,`"`]})}),ge.scrollPosition.canScrollUp&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(f,{dimColor:!0,children:[` `,a.arrowUp,` more above`]})}),Ie.map((e,t)=>{let n=ge.toActualIndex(t)===L&&!v,r=t>0?Ie[t-1]:null,i=!r||r.scope!==e.scope;return(0,Z.jsxs)(Br.Fragment,{children:[i&&(0,Z.jsx)(u,{marginTop:+(t>0),paddingLeft:2,children:(0,Z.jsx)(f,{dimColor:e.scope!==`flagged`,color:e.scope===`flagged`?`warning`:void 0,bold:e.scope===`flagged`,children:(e=>{switch(e){case`flagged`:return`Flagged`;case`project`:return`Project`;case`local`:return`Local`;case`user`:return`User`;case`enterprise`:return`Enterprise`;case`managed`:return`Managed`;case`builtin`:return`Built-in`;case`dynamic`:return`Built-in`;default:return e}})(e.scope)})}),(0,Z.jsx)(Mr,{item:e,isSelected:n})]},e.id)}),ge.scrollPosition.canScrollDown&&(0,Z.jsx)(u,{children:(0,Z.jsxs)(f,{dimColor:!0,children:[` `,a.arrowDown,` more below`]})}),(0,Z.jsx)(u,{marginTop:1,marginLeft:1,children:(0,Z.jsx)(f,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(p,{children:[(0,Z.jsx)(f,{children:`type to search`}),(0,Z.jsx)(z,{action:`plugin:toggle`,context:`Plugin`,fallback:`Space`,description:`toggle`}),(0,Z.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`details`}),(0,Z.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})}),P.size>0&&(0,Z.jsx)(u,{marginLeft:1,children:(0,Z.jsx)(f,{dimColor:!0,italic:!0,children:`Run /reload-plugins to apply changes`})})]})}var Br,X,Z,Vr=e((()=>{i(),Br=t(g(),1),X=t(g(),1),Ze(),C(),Pn(),Ln(),Bn(),Wn(),bn(),Sn(),R(),Jt(),tt(),gn(),st(),on(),F(),Dt(),Xt(),mt(),gt(),jt(),nt(),ct(),I(),Ce(),Ne(),qt(),Se(),Me(),Qe(),me(),Zt(),bt(),ft(),Vt(),jr(),Qn(),rr(),Nr(),hr(),Z=T()}));function Hr(e){if(!e)return{type:`menu`};let t=e.trim().split(/\s+/);switch(t[0]?.toLowerCase()){case`help`:case`--help`:case`-h`:return{type:`help`};case`install`:case`i`:{let e=t[1];if(!e)return{type:`install`};if(e.includes(`@`)){let[t,n]=e.split(`@`);return{type:`install`,plugin:t,marketplace:n}}return e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`file://`)||e.includes(`/`)||e.includes(`\\`)?{type:`install`,marketplace:e}:{type:`install`,plugin:e}}case`manage`:return{type:`manage`};case`uninstall`:return{type:`uninstall`,plugin:t[1]};case`enable`:return{type:`enable`,plugin:t[1]};case`disable`:return{type:`disable`,plugin:t[1]};case`validate`:return{type:`validate`,path:t.slice(1).join(` `).trim()||void 0};case`marketplace`:case`market`:{let e=t[1]?.toLowerCase(),n=t.slice(2).join(` `);switch(e){case`add`:return{type:`marketplace`,action:`add`,target:n};case`remove`:case`rm`:return{type:`marketplace`,action:`remove`,target:n};case`update`:return{type:`marketplace`,action:`update`,target:n};case`list`:return{type:`marketplace`,action:`list`};default:return{type:`marketplace`}}}default:return{type:`menu`}}}var Ur=e((()=>{}));function Wr({onComplete:e,path:t}){return(0,Gr.useEffect)(()=>{async function n(){if(!t){e(`Usage: /plugin validate <path>
2
+
3
+ Validate a plugin or marketplace manifest file or directory.
4
+
5
+ Examples:
6
+ /plugin validate .claude-plugin/plugin.json
7
+ /plugin validate /path/to/plugin-directory
8
+ /plugin validate .
9
+
10
+ When given a directory, automatically validates .claude-plugin/marketplace.json
11
+ or .claude-plugin/plugin.json (prefers marketplace if both exist).
12
+
13
+ Or from the command line:
14
+ claude plugin validate <path>`);return}try{let n=await dn(t),r=``;r+=`Validating ${n.fileType} manifest: ${n.filePath}\n\n`,n.errors.length>0&&(r+=`${a.cross} Found ${n.errors.length} ${zt(n.errors.length,`error`)}:\n\n`,n.errors.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
15
+ `),n.warnings.length>0&&(r+=`${a.warning} Found ${n.warnings.length} ${zt(n.warnings.length,`warning`)}:\n\n`,n.warnings.forEach(e=>{r+=` ${a.pointer} ${e.path}: ${e.message}\n`}),r+=`
16
+ `),n.success?(n.warnings.length>0?r+=`${a.tick} Validation passed with warnings\n`:r+=`${a.tick} Validation passed\n`,process.exitCode=0):(r+=`${a.cross} Validation failed\n`,process.exitCode=1),e(r)}catch(t){process.exitCode=2,Mt(t),e(`${a.cross} Unexpected error during validation: ${dt(t)}`)}}n()},[e,t]),(0,Kr.jsx)(u,{flexDirection:`column`,children:(0,Kr.jsx)(f,{children:`Running validation...`})})}var Gr,Kr,qr=e((()=>{i(),g(),Gr=t(g(),1),C(),gt(),jt(),mn(),Vt(),Kr=T()}));function Jr({onComplete:e}){return(0,Q.useEffect)(()=>{async function t(){try{let t=await ie(),n=Object.keys(t);n.length===0?e(`No marketplaces configured`):e(`Configured marketplaces:\n${n.map(e=>` • ${e}`).join(`
17
+ `)}`)}catch(t){e(`Error loading marketplaces: ${dt(t)}`)}}t()},[e]),(0,$.jsx)(f,{children:`Loading marketplaces...`})}function Yr(){return process.env.USER_TYPE===`ant`?(0,$.jsxs)(u,{flexDirection:`row`,alignItems:`flex-start`,paddingLeft:1,marginTop:1,borderLeft:!0,borderRight:!1,borderTop:!1,borderBottom:!1,borderColor:`permission`,borderStyle:`single`,children:[(0,$.jsx)(u,{flexShrink:0,children:(0,$.jsxs)(f,{bold:!0,italic:!0,color:`permission`,children:[`i`,` `]})}),(0,$.jsx)(f,{children:`[ANT-ONLY] MCP servers are now managed in /plugins. Use /mcp no-redirect to test old UI`})]}):null}function Xr(e){let t=[];for(let{source:n,scope:r}of[{source:`userSettings`,scope:`user`},{source:`projectSettings`,scope:`project`},{source:`localSettings`,scope:`local`}])vt(n)?.extraKnownMarketplaces?.[e]&&t.push({source:n,scope:r});return{editableSources:t,isInPolicy:!!vt(`policySettings`)?.extraKnownMarketplaces?.[e]}}function Zr(e){let{editableSources:t,isInPolicy:n}=Xr(e);return t.length>0?{kind:`remove-extra-marketplace`,name:e,sources:t}:n?{kind:`managed-only`,name:e}:{kind:`navigate`,tab:`marketplaces`,viewState:{type:`manage-marketplaces`,targetMarketplace:e,action:`remove`}}}function Qr(e){return{kind:`navigate`,tab:`installed`,viewState:{type:`manage-plugins`,targetPlugin:e,action:`uninstall`}}}function $r(e){return si.has(e.type)}function ei(e){if(`pluginId`in e&&e.pluginId)return e.pluginId;if(`plugin`in e&&e.plugin)return e.plugin;if(e.source.includes(`@`))return e.source.split(`@`)[0]}function ti(e,t,n,r,i,a,o){let s=[];for(let e of a){let t=`pluginId`in e?e.pluginId:`plugin`in e?e.plugin:void 0;s.push({label:t??e.source,message:kr(e),guidance:`Restart to retry loading plugins`,action:{kind:`none`}})}let c=new Set;for(let t of e){c.add(t.name);let e=Zr(t.name),n=Xr(t.name),r=n.isInPolicy?`managed`:n.editableSources[0]?.scope;s.push({label:t.name,message:t.error??`Installation failed`,guidance:e.kind===`managed-only`?`Managed by your organization — contact your admin`:void 0,action:e,scope:r})}for(let e of t){let t=`marketplace`in e?e.marketplace:e.source;if(c.has(t))continue;c.add(t);let n=Zr(t),r=Xr(t),i=r.isInPolicy?`managed`:r.editableSources[0]?.scope;s.push({label:t,message:kr(e),guidance:n.kind===`managed-only`?`Managed by your organization — contact your admin`:Ar(e),action:n,scope:i})}for(let e of i)c.has(e.name)||(c.add(e.name),s.push({label:e.name,message:e.error,action:{kind:`remove-installed-marketplace`,name:e.name}}));let l=new Set;for(let e of n){let t=ei(e);if(t&&l.has(t))continue;t&&l.add(t);let n=`marketplace`in e?e.marketplace:void 0,r=t?o.get(e.source)??o.get(t):void 0;s.push({label:t?n?`${t} @ ${n}`:t:e.source,message:kr(e),guidance:Ar(e),action:t?Qr(t):{kind:`none`},scope:r})}for(let e of r)s.push({label:e.source,message:kr(e),guidance:Ar(e),action:{kind:`none`}});return s}function ni(e,t){for(let{source:n}of t){let t=vt(n);if(!t)continue;let r={};if(t.extraKnownMarketplaces?.[e]&&(r.extraKnownMarketplaces={...t.extraKnownMarketplaces,[e]:void 0}),t.enabledPlugins){let n=`@${e}`,i=!1,a={...t.enabledPlugins};for(let e in a)e.endsWith(n)&&(a[e]=void 0,i=!0);i&&(r.enabledPlugins=a)}Object.keys(r).length>0&&Et(n,r)}}function ri({setViewState:e,setActiveTab:t,markPluginsChanged:n}){let r=re(e=>e.plugins.errors),i=re(e=>e.plugins.installationStatus),o=le(),[s,l]=(0,Q.useState)(0),[d,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{(async()=>{try{let{failures:e}=await Ie(await ie());g(e)}catch{}})()},[]);let _=i.marketplaces.filter(e=>e.status===`failed`),v=new Set(_.map(e=>e.name)),y=r.filter($r),b=ti(_,r.filter(e=>(e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`)&&!v.has(e.marketplace)),r.filter(e=>$r(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:ei(e)!==void 0),r.filter(e=>$r(e)||e.type===`marketplace-not-found`||e.type===`marketplace-load-failed`||e.type===`marketplace-blocked-by-policy`?!1:ei(e)===void 0),h,y,Qt());ee(`confirm:no`,()=>{e({type:`menu`})},{context:`Confirmation`}),c({"select:previous":()=>l(e=>Math.max(0,e-1)),"select:next":()=>l(e=>Math.min(b.length-1,e+1)),"select:accept":()=>{let r=b[s];if(!r)return;let{action:i}=r;switch(i.kind){case`navigate`:t(i.tab),e(i.viewState);break;case`remove-extra-marketplace`:{let e=i.sources.map(e=>e.scope).join(`, `);ni(i.name,i.sources),Ke(),o(e=>({...e,plugins:{...e.plugins,errors:e.plugins.errors.filter(e=>!(`marketplace`in e&&e.marketplace===i.name)),installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.filter(e=>e.name!==i.name)}}})),m(`${a.tick} Removed "${i.name}" from ${e} settings`),n();break}case`remove-installed-marketplace`:(async()=>{try{await O(i.name),Ke(),g(e=>e.filter(e=>e.name!==i.name)),m(`${a.tick} Removed marketplace "${i.name}"`),n()}catch(e){m(`Failed to remove "${i.name}": ${e instanceof Error?e.message:String(e)}`)}})();break;case`managed-only`:break;case`none`:break}}},{context:`Select`,isActive:b.length>0});let x=Math.min(s,Math.max(0,b.length-1));x!==s&&l(x);let S=b[x]?.action,C=S&&S.kind!==`none`&&S.kind!==`managed-only`;return b.length===0?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(u,{marginLeft:1,children:(0,$.jsx)(f,{dimColor:!0,children:`No plugin errors`})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(f,{dimColor:!0,italic:!0,children:(0,$.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})})]}):(0,$.jsxs)(u,{flexDirection:`column`,children:[b.map((e,t)=>{let n=t===x;return(0,$.jsxs)(u,{marginLeft:1,flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(f,{children:[(0,$.jsxs)(f,{color:n?`suggestion`:`error`,children:[n?a.pointer:a.cross,` `]}),(0,$.jsx)(f,{bold:n,children:e.label}),e.scope&&(0,$.jsxs)(f,{dimColor:!0,children:[` (`,e.scope,`)`]})]}),(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(f,{color:`error`,children:e.message})}),e.guidance&&(0,$.jsx)(u,{marginLeft:3,children:(0,$.jsx)(f,{dimColor:!0,italic:!0,children:e.guidance})})]},t)}),d&&(0,$.jsx)(u,{marginTop:1,marginLeft:1,children:(0,$.jsx)(f,{color:`claude`,children:d})}),(0,$.jsx)(u,{marginTop:1,children:(0,$.jsx)(f,{dimColor:!0,italic:!0,children:(0,$.jsxs)(p,{children:[(0,$.jsx)(z,{action:`select:previous`,context:`Select`,fallback:`↑`,description:`navigate`}),C&&(0,$.jsx)(z,{action:`select:accept`,context:`Select`,fallback:`Enter`,description:`resolve`}),(0,$.jsx)(z,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}function ii(e){switch(e.type){case`help`:return{type:`help`};case`validate`:return{type:`validate`,path:e.path};case`install`:return e.marketplace?{type:`browse-marketplace`,targetMarketplace:e.marketplace,targetPlugin:e.plugin}:e.plugin?{type:`discover-plugins`,targetPlugin:e.plugin}:{type:`discover-plugins`};case`manage`:return{type:`manage-plugins`};case`uninstall`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`uninstall`};case`enable`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`enable`};case`disable`:return{type:`manage-plugins`,targetPlugin:e.plugin,action:`disable`};case`marketplace`:return e.action===`list`?{type:`marketplace-list`}:e.action===`add`?{type:`add-marketplace`,initialValue:e.target}:e.action===`remove`?{type:`manage-marketplaces`,targetMarketplace:e.target,action:`remove`}:e.action===`update`?{type:`manage-marketplaces`,targetMarketplace:e.target,action:`update`}:{type:`marketplace-menu`};default:return{type:`discover-plugins`}}}function ai(e){return e.type===`manage-plugins`?`installed`:e.type===`manage-marketplaces`?`marketplaces`:`discover`}function oi({onComplete:e,args:t,showMcpRedirectMessage:n}){let r=Hr(t),i=ii(r),[a,o]=(0,Q.useState)(i),[s,c]=(0,Q.useState)(ai(i)),[l,d]=(0,Q.useState)(a.type===`add-marketplace`&&a.initialValue||``),[p,m]=(0,Q.useState)(0),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),[y,x]=(0,Q.useState)(!1),C=le(),w=re(e=>{let t=e.plugins.errors.length;for(let n of e.plugins.installationStatus.marketplaces)n.status===`failed`&&t++;return t}),T=w>0?`Errors (${w})`:`Errors`,E=vn(),D=r.type===`marketplace`&&r.action===`add`&&r.target!==void 0,O=(0,Q.useCallback)(()=>{C(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})},[C]),ne=(0,Q.useCallback)(e=>{let t=e;switch(c(t),g(null),t){case`discover`:o({type:`discover-plugins`});break;case`installed`:o({type:`manage-plugins`});break;case`marketplaces`:o({type:`manage-marketplaces`});break;case`errors`:break}},[]);return(0,Q.useEffect)(()=>{a.type===`menu`&&!_&&e()},[a.type,_,e]),(0,Q.useEffect)(()=>{a.type===`browse-marketplace`&&s!==`discover`&&c(`discover`)},[a.type,s]),ee(`confirm:no`,(0,Q.useCallback)(()=>{c(`marketplaces`),o({type:`manage-marketplaces`}),d(``),g(null)},[]),{context:`Settings`,isActive:a.type===`add-marketplace`}),(0,Q.useEffect)(()=>{_&&e(_)},[_,e]),(0,Q.useEffect)(()=>{a.type===`help`&&e()},[a.type,e]),a.type===`help`?(0,$.jsxs)(u,{flexDirection:`column`,children:[(0,$.jsx)(f,{bold:!0,children:`Plugin Command Usage:`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Installation:`}),(0,$.jsx)(f,{children:` /plugin install - Browse and install plugins`}),(0,$.jsx)(f,{children:` /plugin install <marketplace> - Install from specific marketplace`}),(0,$.jsx)(f,{children:` /plugin install <plugin> - Install specific plugin`}),(0,$.jsx)(f,{children:` /plugin install <plugin>@<market> - Install plugin from marketplace`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Management:`}),(0,$.jsx)(f,{children:` /plugin manage - Manage installed plugins`}),(0,$.jsx)(f,{children:` /plugin enable <plugin> - Enable a plugin`}),(0,$.jsx)(f,{children:` /plugin disable <plugin> - Disable a plugin`}),(0,$.jsx)(f,{children:` /plugin uninstall <plugin> - Uninstall a plugin`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Marketplaces:`}),(0,$.jsx)(f,{children:` /plugin marketplace - Marketplace management menu`}),(0,$.jsx)(f,{children:` /plugin marketplace add - Add a marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace add <path/url> - Add marketplace directly`}),(0,$.jsx)(f,{children:` /plugin marketplace update - Update marketplaces`}),(0,$.jsx)(f,{children:` /plugin marketplace update <name> - Update specific marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace remove - Remove a marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace remove <name> - Remove specific marketplace`}),(0,$.jsx)(f,{children:` /plugin marketplace list - List all marketplaces`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Validation:`}),(0,$.jsx)(f,{children:` /plugin validate <path> - Validate a manifest file or directory`}),(0,$.jsx)(f,{children:` `}),(0,$.jsx)(f,{dimColor:!0,children:`Other:`}),(0,$.jsx)(f,{children:` /plugin - Main plugin menu`}),(0,$.jsx)(f,{children:` /plugin help - Show this help`}),(0,$.jsx)(f,{children:` /plugins - Alias for /plugin`})]}):a.type===`validate`?(0,$.jsx)(Wr,{onComplete:e,path:a.path}):a.type===`marketplace-menu`?(o({type:`menu`}),null):a.type===`marketplace-list`?(0,$.jsx)(Jr,{onComplete:e}):a.type===`add-marketplace`?(0,$.jsx)(Gn,{inputValue:l,setInputValue:d,cursorOffset:p,setCursorOffset:m,error:h,setError:g,result:_,setResult:v,setViewState:o,onAddComplete:O,cliMode:D}):(0,$.jsx)(te,{color:`suggestion`,children:(0,$.jsxs)(S,{title:`Plugins`,selectedTab:s,onTabChange:ne,color:`suggestion`,disableNavigation:y,banner:n&&s===`installed`?(0,$.jsx)(Yr,{}):void 0,children:[(0,$.jsx)(b,{id:`discover`,title:`Discover`,children:a.type===`browse-marketplace`?(0,$.jsx)(gr,{error:h,setError:g,result:_,setResult:v,setViewState:o,onInstallComplete:O,targetMarketplace:a.targetMarketplace,targetPlugin:a.targetPlugin}):(0,$.jsx)(br,{error:h,setError:g,result:_,setResult:v,setViewState:o,onInstallComplete:O,onSearchModeChange:x,targetPlugin:a.type===`discover-plugins`?a.targetPlugin:void 0})}),(0,$.jsx)(b,{id:`installed`,title:`Installed`,children:(0,$.jsx)(zr,{setViewState:o,setResult:v,onManageComplete:O,onSearchModeChange:x,targetPlugin:a.type===`manage-plugins`?a.targetPlugin:void 0,targetMarketplace:a.type===`manage-plugins`?a.targetMarketplace:void 0,action:a.type===`manage-plugins`?a.action:void 0})}),(0,$.jsx)(b,{id:`marketplaces`,title:`Marketplaces`,children:(0,$.jsx)(Tr,{setViewState:o,error:h,setError:g,setResult:v,exitState:E,onManageComplete:O,targetMarketplace:a.type===`manage-marketplaces`?a.targetMarketplace:void 0,action:a.type===`manage-marketplaces`?a.action:void 0})}),(0,$.jsx)(b,{id:`errors`,title:T,children:(0,$.jsx)(ri,{setViewState:o,setActiveTab:c,markPluginsChanged:O})})]})})}var Q,$,si,ci=e((()=>{i(),g(),Q=t(g(),1),Ze(),C(),yn(),Jt(),F(),gt(),nt(),L(),I(),Zt(),bt(),qn(),yr(),wr(),Or(),Vr(),jr(),Ur(),qr(),$=T(),si=new Set([`git-auth-failed`,`git-timeout`,`network-error`])}));export{Rn as a,Ln as c,Wn as i,Nn as l,ci as n,Bn as o,Vn as r,Fn as s,oi as t,Pn as u};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gr as n,I as r,P as i,fi as a,ot as o,t as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{aC as l}from"./loadAgentsDir-D206qwP3.js";import{C as u,T as d,b as f}from"./startupProfiler-xa3NmN7Z.js";function p(e){return e.startsWith(`file-`)?`+`:e.startsWith(`mcp-resource-`)?`◇`:e.startsWith(`agent-`)?`*`:`+`}function m(e){return e.startsWith(`file-`)||e.startsWith(`mcp-resource-`)||e.startsWith(`agent-`)}function h({suggestions:e,selectedSuggestion:t,maxColumnWidth:i,overlay:a}){let{rows:s}=o(),c=a?5:Math.min(6,Math.max(1,s-3));if(e.length===0)return null;let l=i??Math.max(...e.map(e=>n(e.displayText)))+5,u=Math.max(0,Math.min(t-Math.floor(c/2),e.length-c)),d=Math.min(u+c,e.length),f=e.slice(u,d);return(0,_.jsx)(r,{flexDirection:`column`,justifyContent:a?void 0:`flex-end`,children:f.map(n=>(0,_.jsx)(v,{item:n,maxColumnWidth:l,isSelected:n.id===e[t]?.id},n.id))})}var g,_,v,y,b=e((()=>{g=t(a(),1),l(),s(),f(),_=c(),v=(0,g.memo)(function({item:e,maxColumnWidth:t,isSelected:r}){let a=o().columns;if(m(e.id)){let t=p(e.id),o=r?`suggestion`:void 0,s=!r,c=e.id.startsWith(`file-`),l=e.id.startsWith(`mcp-resource-`),f=e.description?3:0,m;if(c){let t=e.description?Math.min(20,n(e.description)):0,r=a-2-4-f-t;m=u(e.displayText,r)}else m=l?d(e.displayText,30):e.displayText;let h=a-2-n(m)-f-4,g;if(e.description){let n=Math.max(0,h),r=d(e.description.replace(/\s+/g,` `),n);g=`${t} ${m} – ${r}`}else g=`${t} ${m}`;return(0,_.jsx)(i,{color:o,dimColor:s,wrap:`truncate`,children:g})}let s=Math.floor(a*.4),c=Math.min(t??n(e.displayText)+5,s),l=e.color||(r?`suggestion`:void 0),f=!r,h=e.displayText;n(h)>c-2&&(h=d(h,c-2));let g=h+` `.repeat(Math.max(0,c-n(h))),v=e.tag?`[${e.tag}] `:``,y=n(v),b=Math.max(0,a-c-y-4),x=e.description?d(e.description.replace(/\s+/g,` `),b):``;return(0,_.jsxs)(i,{wrap:`truncate`,children:[(0,_.jsx)(i,{color:l,dimColor:f,children:g}),v?(0,_.jsx)(i,{color:e.tag===`local`?`ansi:yellow`:void 0,dimColor:e.tag!==`local`,children:v}):null,(0,_.jsx)(i,{color:r?`suggestion`:void 0,dimColor:!r,children:x})]})}),y=(0,g.memo)(h)}));export{y as n,b as r,h as t};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gr as n,I as r,P as i,fi as a,ot as o,t as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{XS as l}from"./loadAgentsDir-x3rlgED4.js";import{C as u,T as d,b as f}from"./startupProfiler-xa3NmN7Z.js";function p(e){return e.startsWith(`file-`)?`+`:e.startsWith(`mcp-resource-`)?`◇`:e.startsWith(`agent-`)?`*`:`+`}function m(e){return e.startsWith(`file-`)||e.startsWith(`mcp-resource-`)||e.startsWith(`agent-`)}function h({suggestions:e,selectedSuggestion:t,maxColumnWidth:i,overlay:a}){let{rows:s}=o(),c=a?5:Math.min(6,Math.max(1,s-3));if(e.length===0)return null;let l=i??Math.max(...e.map(e=>n(e.displayText)))+5,u=Math.max(0,Math.min(t-Math.floor(c/2),e.length-c)),d=Math.min(u+c,e.length),f=e.slice(u,d);return(0,_.jsx)(r,{flexDirection:`column`,justifyContent:a?void 0:`flex-end`,children:f.map(n=>(0,_.jsx)(v,{item:n,maxColumnWidth:l,isSelected:n.id===e[t]?.id},n.id))})}var g,_,v,y,b=e((()=>{g=t(a(),1),l(),s(),f(),_=c(),v=(0,g.memo)(function({item:e,maxColumnWidth:t,isSelected:r}){let a=o().columns;if(m(e.id)){let t=p(e.id),o=r?`suggestion`:void 0,s=!r,c=e.id.startsWith(`file-`),l=e.id.startsWith(`mcp-resource-`),f=e.description?3:0,m;if(c){let t=e.description?Math.min(20,n(e.description)):0,r=a-2-4-f-t;m=u(e.displayText,r)}else m=l?d(e.displayText,30):e.displayText;let h=a-2-n(m)-f-4,g;if(e.description){let n=Math.max(0,h),r=d(e.description.replace(/\s+/g,` `),n);g=`${t} ${m} – ${r}`}else g=`${t} ${m}`;return(0,_.jsx)(i,{color:o,dimColor:s,wrap:`truncate`,children:g})}let s=Math.floor(a*.4),c=Math.min(t??n(e.displayText)+5,s),l=e.color||(r?`suggestion`:void 0),f=!r,h=e.displayText;n(h)>c-2&&(h=d(h,c-2));let g=h+` `.repeat(Math.max(0,c-n(h))),v=e.tag?`[${e.tag}] `:``,y=n(v),b=Math.max(0,a-c-y-4),x=e.description?d(e.description.replace(/\s+/g,` `),b):``;return(0,_.jsxs)(i,{wrap:`truncate`,children:[(0,_.jsx)(i,{color:l,dimColor:f,children:g}),v?(0,_.jsx)(i,{color:e.tag===`local`?`ansi:yellow`:void 0,dimColor:e.tag!==`local`,children:v}):null,(0,_.jsx)(i,{color:r?`suggestion`:void 0,dimColor:!r,children:x})]})}),y=(0,g.memo)(h)}));export{y as n,b as r,h as t};